+ Reply to Thread
Results 1 to 6 of 6

Thread: The Browser Scripts Thread

  1. #1

    The Browser Scripts Thread

    Hello my friends! I'd like to use this new thread to list browser scripts that are either used in greasemonkey/tampermonkey or in url bar.
    Here's my own personal url bar scripts that I use and have saved me loads of time:

    Domain search for duckduckgo.com
    Code:
    javascript:window.location.href='https://duckduckgo.com/?&q=%s+site:'+location.host
    Domain search for google.com (this one doesn't change domain/results are given only by google.com regardless of location)
    Code:
    javascript:window.location.href='https://www.google.com/search?q=%s+site:'+location.host+'&pws=0&gl=us&gws_rd=cr'
    Domain search for google.com (redirects when used in other countries)
    Code:
    javascript:window.location.href='https://www.google.com/search?q=%s+site:'+location.host

    Google translate any language to EN
    Code:
    javascript:window.location.href='http://translate.google.com/translate?js=y&sl=auto&tl=en&u='+window.location.href

    When used, it allows to edit all text areas of a web page.
    Code:
    javascript:document.body.contentEditable%20=%20'true';%20document.designMode='on';%20void%200

    When finished editing, execute this code to save the page.
    Code:
    javascript:document.body.contentEditable%20=%20'false';%20document.designMode='off';%20void%200
    downforeveryoneorjustme.com
    Code:
    javascript:window.location.href='http://www.downforeveryoneorjustme.com/'+location.host.replace('www.','')
    The idea is to get the ball rolling and share any kind of scripts.
    Last edited by Master Razor; 20.05.17 at 02:17.
    Reply With QuoteReply With Quote
    Thanks

  2. #2
    Moderator anon's Avatar
    Join Date
    01.02.08
    Posts
    39,385
    Activity Longevity
    11/20 19/20
    Today Posts
    4/5 ssss39385
    I think these are bookmarklets rather than scripts. And the contentEditable one is legendary, people here used it to fake ratio proofs in 2009.
    "I just remembered something that happened a long time ago."
    Reply With QuoteReply With Quote
    Thanks

  3. #3
    True these are not scripts!

    Spoiler This is an actual Script:
    Code:
    // ==UserScript==
    // @name          Javascript Link Fixer
    // @namespace     DoomTay
    // @description   Converts Javascript links that open new windows into regular old links
    // @version       1.2.4
    // @grant         none
    
    // ==/UserScript==
    
    var links = document.querySelectorAll("[href *= 'javascript:'],a[onclick]");
    
    var paramTable = {};
    	paramTable["open"] = 0;
    	paramTable["window.open"] = 0;
    
    for (var l = 0; l < links.length; l++)
    {
    	if(links[l].href == undefined) continue;
    	if(links[l].href.indexOf("void") > -1) continue;
    	if(links[l].href.substring(11) != "" && links[l].href.substring(11) != ";")
    	{
    		var hrefSplitter = /javascript:(\S+)\((\S+(?:,(?: )\S+)*)?\)/.exec(links[l].href);
    		if(hrefSplitter != null)
    		{
    			var functionName = decodeURIComponent(hrefSplitter[1]).trim();
    			var params = hrefSplitter[2] ? eval("[" + decodeURIComponent(hrefSplitter[2]) + "]") : [];
    			var functionDig = deconstructFunction(functionName,params);
    			if(functionDig != null)
    			{
    				links[l].setAttribute("onclick",decodeURIComponent(links[l].href).substring(links[l].href.indexOf("javascript:") + 11) + "; return false");
    				if(functionDig.indexOf("/") == 0 && window.location.href.indexOf("archive.org/web") > -1 && functionDig.indexOf("/web") != 0)
    				{
    					links[l].href = window.location.href.substring(0,window.location.href.indexOf("/",window.location.href.lastIndexOf("//") + 2)) + functionDig;
    				}
    				else links[l].href = functionDig;
    				continue;
    			}
    		}
    	}
    	if(links[l].getAttribute("onclick"))
    	{
    		if(links[l].getAttribute("onclick").indexOf("void") > -1) continue;
    		if(links[l].getAttribute("onclick").substring(11) != "" && links[l].getAttribute("onclick").substring(11) != ";")
    		{
    			var funcSplitter = /(\S+)\(([^;]+)\)/.exec(links[l].getAttribute("onclick"));
    			if(funcSplitter != null)
    			{
    				var functionName = decodeURIComponent(funcSplitter[1]).trim();
    				var params = funcSplitter[2] ? eval("[" + decodeURIComponent(funcSplitter[2]) + "]") : [];
    				if(links[l].getAttribute("csclick"))
    				{
    					if(CSAct[params][1].indexOf("/") == 0 && window.location.href.indexOf("archive.org/web") > -1 && CSAct[params][1].indexOf("/web") != 0)
    					{
    						links[l].href = window.location.href.substring(0,window.location.href.indexOf("/",window.location.href.lastIndexOf("//") + 2)) + CSAct[params][1];
    					}
    					else links[l].href = CSAct[params][1];
    					continue;
    				}
    				var functionDig = deconstructFunction(functionName,params);
    				if(functionDig != null)
    				{
    					if(functionDig.indexOf("/") == 0 && window.location.href.indexOf("archive.org/web") > -1 && functionDig.indexOf("/web") != 0)
    					{
    						links[l].href = window.location.href.substring(0,window.location.href.indexOf("/",window.location.href.lastIndexOf("//") + 2)) + functionDig;
    					}
    					else links[l].href = functionDig;
    					continue;
    				}
    			}
    		}
    	}
    }
    
    function deconstructFunction(functionName,params)
    {
    	if(functionName == "history.go") return null;
    	if(functionName == "window.close") return null;
    	var sourceCode = uneval(window[functionName]);
    	var functionBody = sourceCode.substring(sourceCode.indexOf("{") + 1,sourceCode.lastIndexOf("}")).trim();
    	while(functionBody.indexOf(functionName + ".arguments") > -1) functionBody = functionBody.replace(functionName + ".arguments","params");
    	if(functionBody.indexOf("for") > -1) return null;
    	var args = /\(((?: )?\S+(?:,(?: )\S+)*)?(?: )?\)/.exec(sourceCode);
    	args = args && args[1] ? args[1].split(/\s*,\s*/) : [];
    	var containedFunctions = functionBody.match(/(\S+\(\S+(?:,(?: )?\S+)*\))/g) || [];
    	var ifCollection = functionBody.match(/if ?\([a-zA-z '?=+&.<>!()0-9;]+\)[ \n\t]+?{[\s\S][\na-zA-z '?=+.,">\/()0-9;!@#$%^&*\t]+[\s]+}/g);
    	var variableMatches = functionBody.match(/(\S+ ?[+\-*\/]?= ?.+)/g);
    	
    	for(var a = 0; a < params.length; a++)
    	{
    		eval(args[a] + "= \"" + params[a] + "\"");
    	}
    	if(variableMatches)
    	{
    		for(var m = 0; m < variableMatches.length; m++)
    		{
    			if(variableMatches[m].indexOf("==") > -1 || variableMatches[m].indexOf("!=") > -1 || variableMatches[m].indexOf("//") > -1 || variableMatches[m].indexOf(">=") > -1 || variableMatches[m].indexOf("<=") > -1) continue;
    			if(containedFunctions != null && containedFunctions.some(elem => variableMatches[m].substring(variableMatches[m].indexOf("=") + 1).trim().indexOf(elem) > -1)) continue;
    			if(ifCollection != null && ifCollection.some(elem => elem.indexOf(variableMatches[m]) > -1)) continue;
    			if(/.+\(/.test(variableMatches[m]) && variableMatches[m].indexOf("eval(") == -1) continue;
    			var varSplitter = /(?!["'=><!])? ?[+\-*\/]?= ?(?!["'=><!])/;
    			var splitVars = [variableMatches[m].substring(0,variableMatches[m].search(varSplitter)).trim(),variableMatches[m].substring(variableMatches[m].search(varSplitter) + 2).trim()];
    			//Making sure we're not altering any properties
    			if(splitVars[0].indexOf(".location") > -1 || /location(?:.href)? ?= ? (?!yes|no)/.test(variableMatches[m])) return eval(splitVars[1]);
    			else if(splitVars[0].indexOf(".") == -1) eval(variableMatches[m]);
    		}
    	}
    	
    	if(ifCollection)
    	{
    		for(var i = 0; i < ifCollection.length; i++)
    		{
    			eval(ifCollection[i]);
    		}
    	}
    
    	if(containedFunctions)
    	{
    		for(var f = 0; f < containedFunctions.length; f++)
    		{
    			var capture = /(\S+)\((\S+(?:,(?: )?\S+)*)?\);?/.exec(containedFunctions[f]);
    			var statementName = capture[1];
    			if(statementName == "if") continue;
    			var statementParams = capture[2];
    			statementParams = eval("[" + statementParams + "]");
    			if(paramTable.hasOwnProperty(statementName)) return(statementParams[paramTable[statementName]]);
    			var digDeeper = deconstructFunction(statementName,statementParams);
    			if(digDeeper) return digDeeper;
    		}
    	}
    	if(functionBody.indexOf(".location = ") > -1)
    	{
    		var test = /\.location ?= ?(\S+);/.exec(functionBody)[1];
    		for(var p = 0; p < params.length; p++)
    		{
    			if(test == args[p]) return params[p];
    		}
    	}
    	return null;
    }


    The script is by DoomTay which block JavaScript window link opener (usually ads sometimes click-jacking) and turns it into the regular links opened in a new tab. This is useful for sites which require you click on certain links to download content. Make sure to use this script with Tamper Monkey or Grease Monkey and No scripts add-on!
    Reply With QuoteReply With Quote
    Thanks

  4. #4
    Moderator anon's Avatar
    Join Date
    01.02.08
    Posts
    39,385
    Activity Longevity
    11/20 19/20
    Today Posts
    4/5 ssss39385
    Speaking of which, I use very few user scripts. Only LinkTube, Unhide Referrer and that one Sazzy wrote for me to autoselect the right settings on Imagebam.
    "I just remembered something that happened a long time ago."
    Reply With QuoteReply With Quote
    Thanks

  5. #5
    What difference does it make what they are? The thread's aim is twords scripts. I written in the first post what I thought was correct "personal url bar scripts". So instead of url bar scripts they are called bookmarklets. Big deal.

    And the contentEditable one is legendary, people here used it to fake ratio proofs in 2009.
    Regardless, it has many other uses rather than faking ratio proofs.
    Last edited by Master Razor; 22.05.17 at 21:10.
    Reply With QuoteReply With Quote
    Thanks

  6. #6
    Spoiler AdsBypasser (Skip Some Adlinks i.e., Ad.fly,Adfoc.us etc):


    Spoiler Endless Google (scroll down to load all pages):


    Spoiler Google hit domain (Hide Links on Google):


    Spoiler Google Ad Remover (remove Ads from Google):


    Spoiler Google Redirect Remover (Open Direct links from Google Search):


    Spoiler Google Cache Comeback (Bring Back Google Cache+Good if you scrap content):


    Spoiler Google Bangs (Add bangs option as in DuckDuckGo):


    Spoiler Youtube MP4 downloader (+Adds download button):


    Spoiler Youtube Mp3 downloader (+ Adds download button):


    Spoiler Remove Web Limits (Cut+Paste+Copy on protected Sites):


    Spoiler Anti-Adware (Block forced or silent downloads of adware from certain sites):


    Spoiler Youtube + (Add multiple features to You-tube):
    Reply With QuoteReply With Quote
    Thanks

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •