Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 1.40 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. jQuery.attr('src') replace not working in FF
  2. $("img[src*='libraries/phpthumb/phpThumbYT.php']").each(function(){
  3. var t=$(this);
  4. var src1= t.attr('src'); // initial src
  5. var old_src = src1.substring(src1.lastIndexOf('media/'), src1.lenght);; // extract old source attr    
  6. var media_id = old_src.substring(6,8); // extract media ID (directory name)
  7. if ( old_src.indexOf("animation=1") != -1 )
  8. {
  9.     t.hover(function(){
  10.         // on hover
  11.         $(this).attr('src', 'libraries/phpthumb/phpThumbYT.php?w=131&h=92&far=C&iar=1&sfn=3&zc=C&f=gif&src=http://domain.name/media/'+media_id+'/preview.gif');  
  12.     }, function(){
  13.        // on rollout
  14.         $(this).attr('src', src1);
  15.     });
  16. }
  17. });
  18.        
  19. $("img[src*='libraries/phpthumb/phpThumbYT.php']").each(function(){
  20. var t=$(this);
  21. var src1= t.attr('src'); // initial src
  22. var old_src = src1.substring(src1.lastIndexOf('media/')); // extract old source attr    
  23. var media_id = old_src.substring(6,8); // extract media ID (directory name)
  24. media_id = media_id.replace('/',''); // trim '/' from the end of media_id in case the ID is < 10
  25. if ( old_src.indexOf("animation=1") != -1 )
  26. {
  27.     t.hover(function(){
  28.         // on hover
  29.         $(this).attr('src', 'libraries/phpthumb/phpThumbYT.php?w=131&h=92&far=C&iar=1&sfn=3&zc=C&f=gif&src=http://slovoprekazdeho.sk/media/'+media_id+'/preview.gif');  
  30.     }, function(){
  31.        // on rollout
  32.         $(this).attr('src', src1);
  33.     });
  34. }
  35. });