Makaze

Photobucket Display Links on Upload Script - Jayn

Jan 17th, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var root = "http://i1064.photobucket.com/albums/u361/Jaynabelle/";
  2.  
  3. var folder = $('a.goalbum:contains(View)').html().split('View ')[1];
  4.  
  5. if (folder.match(/library/gi)) {
  6.   folder = "";
  7. } else {
  8.   folder = folder + "/";
  9. }
  10.  
  11. setInterval(button, 1000);
  12.  
  13. function button() {
  14.   if ($('#createlinks').length <= 0 && $('#filesUploading .completed').length > 0) {
  15.     $('div.uploadThumbnails:last').after('<div id="createlinks"><input type="button" id="generatel" value="Generate Links" /></div><div id="link-group"></div>');
  16.   }
  17. }
  18.  
  19. setInterval(generatel, 1000);
  20.  
  21. function generatel() {
  22. $('#generatel').click(function() {
  23.   $('#filesUploading .completed').each(function() {
  24.     var file = $(this).attr('title');
  25.     if ($('.img-link:contains("' + file + '")').length <= 0) {
  26.       $('#link-group').append('<div class="img-link" style="border: 1px dashed #555; border-radius: 5px; padding: 2px 4px 1px; margin: 2px 0; background-color: rgba(255, 255, 255, .3);">' + root + folder + file + '</div>');
  27.     };
  28.   });
  29.  
  30.   $('.img-link').click(function() {
  31.     $(this).attr('id', 'link');
  32.     selectAll('link');
  33.     $(this).attr('id', '');
  34.   });
  35. });
  36. }
  37.  
  38. function selectAll(element) {
  39.     var doc = document
  40.         , text = doc.getElementById(element)
  41.         , range, selection
  42.     ;    
  43.     if (doc.body.createTextRange) {
  44.         range = document.body.createTextRange();
  45.         range.moveToElementText(text);
  46.         range.select();
  47.     } else if (window.getSelection) {
  48.         selection = window.getSelection();        
  49.         range = document.createRange();
  50.         range.selectNodeContents(text);
  51.         selection.removeAllRanges();
  52.         selection.addRange(range);
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment