08 April, 2015

UserJS: Fix Tinypic and Photobucket on Opera 12.

Tinypic embedded images are not showing on Opera 12. Even on tinypic.com images are not visible. It's done on purpose, since the image container has an added class "imgtmp" (with "visibility: hidden") on Opera 12 only (not on Firefox).
This script can solve the problem, at least for a while (until they change something again).
Note: Requires jQuery (downloaded and put in User JS folder).


▐▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▌

// ==UserScript==
// @name
tinypic
// @include *
// @author Drozdman
// ==/UserScript==


window.addEventListener('DOMContentLoaded',function(){tinypic_IMG() } ,false)

//window.addEventListener('click',function(){tinypic_IMG() } ,false)

tinypic_IMG=function(){

if(location.hostname.match('tinypic.com')){
$("#imgFrame").removeClass("imgtmp")
}else{

$("img").each(function(){
var url=this.src;
  if(url.search(/tinypic\.com|photobucket\.com/)>-1){
  url=url.replace(/i(\d+)/,"oi$1")

 $(this).attr("src",url)
}
});
}



▐▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▌  

8 comments:

  1. Great! It works perfectly! Thank you very much!

    ReplyDelete
  2. Thank you, thank you, you're a hero,. I'm a proud user of Opera Presto (the real Opera) and this issue was causing me many headaches.

    ReplyDelete
  3. Can you make a "how to do". I don´t understand how to do it.
    THANKS¡¡

    ReplyDelete
  4. If anyone is interested, I have created a version of the same code, but avoiding jQuery dependencies, as well as adding some additional checkings, and speedingup it, but using string functions, instead of regular expressions.

    http://www.javiergutierrezchamorro.com/opera-no-muestra-imagenes-de-tinypic/2466

    Let me know if any concerns.

    ReplyDelete
  5. Just added support for Photobucket too, which experienced same issue.

    ReplyDelete
  6. O, yeah. Thanks. Photobucket also doesn't work in Opera and it's the same fix. I will also add it to the script.

    ReplyDelete
  7. You are welcome! Thanks to you for the great idea for the script. In fact mine, is only an improvement over your findings, so you deserve the credit.

    ReplyDelete
  8. Glad to see you finally added Photobucket. And glad to see in this case it was the oposite, you gathered my idea :-)

    ReplyDelete