Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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(){
- //console.log('repair start');
- var iframe = document.getElementById("iframe");
- var list = iframe.contentWindow.document.getElementsByTagName('a');
- for (var index = 0; index < list.length; index++) {
- if (list[index].innerHTML.search('webm') > -1 && list[index].innerHTML.search('img') > -1) {
- list[index].innerHTML = list[index].innerHTML.replace('img', 'video controls loop');
- }
- }
- //console.log('repair ends');
- //setTimeout(periodicRepair,3000);
- }
- function fixUrl(){
- var iframeurl = document.getElementById("iframe").contentWindow.location.href;
- window.history.pushState('', '', iframeurl);
- }
- if(document.getElementById('iframe') == null){
- preparePage();
- }
- fixUrl();
- periodicRepair();
- //setTimeout(periodicRepair,3000);
- }
- repair();
- /*
- 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 [i]javascript:[/i] part, you need to type [i]javascript:[/i] in the beginning
- *Paste this script in the console
- *Create a bookmarklet, then, use it
- [code]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();
- [/code]
- Because this is a [s]hack[/s]quick 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
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement