NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name page sanitizer // @author keepcalmandbelogical // @description Removes unwanted objects from the page: <object> and <iframe> tags from unknown sources // @version 0.1.7 // @include http://*divxatope*.com* // @include http://*newpct*.com* // @include http://*elitetorrent.net* // @include http://*tumejortorrent.com* // @include http://*descargas2020.com* // @grant none // @run-at document-end // @downloadURL https://openuserjs.org/install/keepcalmandbelogical/page_sanitizer.user.js // @supportURL https://openuserjs.org/scripts/keepcalmandbelogical/page_sanitizer/issues // @license MIT // ==/UserScript== (function() { var sn=function(node,sn0) { var i,x,n; x=node.children; for(i=0;i<x.length;i++) { switch(x[i].tagName.toLowerCase()) { case "object": node.removeChild(x[i]); break; case "iframe": if(!/(http|https):\/\/(.*\.)?(youtube\.com|google\.com|facebook\.com|tweeter\.com|disqus\.com)\/.*/.test(x[i].src)) node.removeChild(x[i]); break; default: n=x[i].children.length; sn0.apply(this,[x[i],sn0]); if(n>0 && x[i].children.length===0) node.removeChild(x[i]); break; } } return node; }; HTMLDocument.prototype.createElement=(function(sn0) { var sn1=sn0; var ce=HTMLDocument.prototype.createElement; return function(name) { var str=name.toLowerCase(); if(/<?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[\^'">\s]+))?)+\s*|\s*)?>/i.test(str)) str=(/<?(\w+)/i.exec(str))[1]; switch(str) { case "object": case "iframe": case "script": return null; default: return sn1.apply(this,[ce.apply(this,[name]),sn1]); } }; })(sn); Element.prototype.appendChild=(function(sn0) { var sn1=sn0; var ac=Element.prototype.appendChild; return function(node) { switch(node.tagName.toLowerCase()) { case "object": case "iframe": return null; default: return ac.apply(this,[sn1.apply(this,[node,sn1])]); } }; })(sn); Element.prototype.insertBefore=(function(sn0) { var sn1=sn0; var ib=Element.prototype.insertBefore; return function(node,beforeNode) { switch(node.tagName.toLowerCase()) { case "object": case "iframe": return null; default: return ib.apply(this,[sn1.apply(this,[name,sn1]),beforeNode]); } }; })(sn); sn.apply(this,[document.body,sn]); sn=null; })();