This is an old revision of this page, as edited by Mr. Stradivarius(talk | contribs) at 15:09, 8 December 2021(fix cross-site scripting vulnerability in the Wikidata link; I also changed all of the links to use JQuery, as that is less risky than assembling them directly with HTML, which basically makes this a rewrite). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.Revision as of 15:09, 8 December 2021 by Mr. Stradivarius(talk | contribs)(fix cross-site scripting vulnerability in the Wikidata link; I also changed all of the links to use JQuery, as that is less risky than assembling them directly with HTML, which basically makes this a rewrite)
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/*The script adds a few options beside articleMain script by Writ and may be seen at https://en.wikipedia.org/wiki/User:Writ_Keeper/Scripts/googleTitle.jsScript improved by User:SD0001, see diff https://en.wikipedia.org/wiki/Special:ComparePages?page1=User%3ATitodutta%2Fscripts%2FSearchHelper.js&rev1=&page2=User%3ASD0001%2FSearchHelper.js&rev2=&action=&diffonly=&unhide=&diffmode=source*/$(document).ready(function(){functiongetSubject(){letpageName=mw.config.get("wgTitle");if(pageName.charAt(pageName.length-1)==")"){returnpageName.substring(0,pageName.lastIndexOf("(")-1);}else{returnpageName;}}functionescapeSubject(subject){returnencodeURIComponent(subject.replace(/_/g," "))}functioncreateLink(url,display){return$("<a>").attr("href",url).append($("<span>").css("font-size","x-small").text(display));}functionappendLinks($node,links){$.each(links,function(index,$link){$node.append(document.createTextNode(" "),$link);});}$firstHeading=$("#firstHeading");if(mw.config.get("wgCanonicalNamespace")==""||mw.config.get("wgCanonicalNamespace")=="Draft"){letsubject=getSubject();letlinks=[/*WRS from User:Sam Sailor/Scripts/WRStitle.js*/createLink("https://www.google.com/custom?hl=en&cx=007734830908295939403%3Agalkqgoksq0&cof=FORID%3A13%3BAH%3Aleft%3BCX%3AWikipedia%2520Reference%2520Search&q="+escapeSubject(subject),"WRS"),createLink("http://www.google.com/search?q="+escapeSubject(subject)+"+-wikipedia.org","Google search"),createLink("https://news.google.com/search?q="+escapeSubject(subject)+"+-wikipedia.org","Google News"),createLink("https://www.google.com/search?tbm=bks&q="+escapeSubject(subject)+"+-wikipedia.org","Google Books"),createLink("https://www.google.com/search?tbm=isch&q="+escapeSubject(subject),"Google images"),createLink("https://search.yahoo.com/search?p="+escapeSubject(subject),"Yahoo"),createLink("https://duckduckgo.com/?q="+escapeSubject(subject),"DuckDuckGo"),createLink("https://www.youtube.com/results?search_query="+escapeSubject(subject),"YouTube"),createLink("https://commons.wikimedia.org/w/index.php?search="+escapeSubject(subject),"Commons"),createLink("http://www.flickr.com/search/?l=commderiv&q="+escapeSubject(subject),"Flickr (CC)"),createLink("https://www.imdb.com/find?q="+escapeSubject(subject),"IMDb"),createLink("https://www.jstor.org/action/doBasicSearch?Query="+escapeSubject(subject),"JSTOR"),createLink("http://edwardbetts.com/find_link/"+escapeSubject(subject),"Find link"),createLink("https://www.google.com/custom?hl=en&cx=014196815420355252912:fownxmjrhle&cof=FORID%3A13%3BAH%3Aleft%3BCX%3AWikipedia%2520Reference%2520Search&q="+escapeSubject(subject),"Indian newspapers")];appendLinks($firstHeading,links);}if(mw.config.get("wgCanonicalNamespace")==""&&$('#t-wikibase').length){letlink=createLink($('li#t-wikibase a:first').attr('href'),"Wikidata");appendLinks($firstHeading,[link]);}});