Topic: e621 mobile version

dddguardian said:
This will fix the vídeo display with the site.

To use this, you must be in the cuberope's e621 mobile or it's mirrors before use this script

You can run this anytime inside cuberope's e621 mobile, the script will try to preserve your search

(Pick one)
*Paste this script in the URL bar (some browsers will cut the javascript: part, you need to type javascript: in the beginning
*Paste this script in the console
*Create a bookmarklet, then, use it

javascript:function repair(){function preparePage(){document.getElementsByTagName("body")[0].innerHTML="";var ifrm=document.createElement("iframe");ifrm.setAttribute("src",window.location.href),ifrm.setAttribute("id","iframe"),ifrm.setAttribute("onload","repair()"),ifrm.style.position="fixed",ifrm.style.top="0px",ifrm.style.left="0px",ifrm.style.bottom="0px",ifrm.style.right="0px",ifrm.style.width="100%",ifrm.style.height="100%",ifrm.style.border="none",ifrm.style.margin="0",ifrm.style.padding="0",ifrm.style.overflow="hidden",document.body.appendChild(ifrm)}function periodicRepair(){for(var iframe=document.getElementById("iframe"),list=iframe.contentWindow.document.getElementsByTagName("a"),index=0;index<list.length;index++)list[index].innerHTML.search("webm")>-1&&list[index].innerHTML.search("img")>-1&&(list[index].innerHTML=list[index].innerHTML.replace("img","video controls loop"))}function fixUrl(){var iframeurl=document.getElementById("iframe").contentWindow.location.href;window.history.pushState("","",iframeurl)}null==document.getElementById("iframe")&&preparePage(),fixUrl(),periodicRepair()}repair();

Because this is a hackquick fix, the script will fix video display when page finish the loading. If the page has multiple gifs and heavy images, the videos will only appear when they are fully loaded

This works flawlessly!
It adds much value to the functionality of the site, thanks mate.

I've been trying to convert this to a Tampermonkey script to make it run automatically, but without success. Maybe you can help me figure this out?

Updated by anonymous