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.
// TODO -- make a [[User:AzaToth/morebits.js]] version of this input sequencevarlang=/*prompt("Get results in what language?", */"en"/*)*/;varpageNames=/*prompt("Page names to get results for?", /*"Augustus Pablo|Avian Java|Bentley Java|Chrysler Java|Coffee|Coffee County, Alabama|HMS Java|Java|Java, Alabama|Java, New York|Java, Ohio|Java, South Dakota|Java, São Tomé and Príncipe|Java, Virginia|Java-eiland|JavaScript|Java (Martin Mystère)|Java (band)|Java (board game)|Java (chicken)|Java (cigarette)|Java (composition)|Java (dance)|Java (programming language)|Java (software platform)|Java (town)|Java District|Java Joel|Java Man|Java Road|Java Sea|Java Trench|Java class cruiser|Java coffee|Java virtual machine|Javanese (disambiguation)|Javanese alphabet|List of The Tribe characters|Metamorpho|SS Java|USS Java (1815)"*/"foo"/*)*/;if(pageNames.indexOf("|")===-1){pageNames=newArray(pageNames);}else{pageNames=pageNames.split("|");}varrangeToGet=newArray(30,60,90);varvisitRank=0;varpageHits=0;varhits30=0;varhits60=0;varhits90=0;varfullResults=[];functiondisplayAnswer(){vartable="{| class=\"collapsible collapsed sortable\" width=\"95%\" border=\"1\"";table+="\n|-\n! colspan=\"5\"| Pageview stats for pages related to {{{PAGENAME}}}";table+="\n|-\n! Page Name !! width=\"15%\"| Hits in 30 days !! width=\"15%\"| Hits in 60 days !! width=\"15%\"| Hits in 90 days !! width=\"5%\"| Rank";for(varpageNameinpageNames){table+="\n|- style=\"text-align: center;\"";table+="\n| style=\"text-align: left; font-weight: bold;\" | [["+pageNames[pageName]+"]] ";table+="|| {{Plainlinks|url=http://stats.grok.se/"+lang+"/latest30/"+encodeURIComponent(pageNames[pageName])+"|name="+fullResults[pageName].hits30+"}} ";table+="|| {{Plainlinks|url=http://stats.grok.se/"+lang+"/latest60/"+encodeURIComponent(pageNames[pageName])+"|name="+fullResults[pageName].hits60+"}} ";table+="|| {{Plainlinks|url=http://stats.grok.se/"+lang+"/latest90/"+encodeURIComponent(pageNames[pageName])+"|name="+fullResults[pageName].hits90+"}} ";table+="|| "+fullResults[pageName].rank;}table+="\n|}";alert(table);}/* temp set to only pull hits30 for debugging */vardaysToGet=0;varrangeToGet=[];rangeToGet[daysToGet]=30;/* temp set to only pull [[foo]] for debugging */varpageName=0;//for(var pageName in pageNames){// for(var daysToGet in rangeToGet){console.info("Attempting to get data from: http://stats.grok.se/json/"+lang+"/latest"+rangeToGet[daysToGet]+"/"+encodeURIComponent(pageNames[pageName]));$.ajax({url:'http://stats.grok.se/json/'+lang+'/latest'+rangeToGet[daysToGet]+'/'+encodeURIComponent(pageNames[pageName]),dataType:'json',success:function(getStats){for(vardateingetStats.daily_views){pageHits+=getStats.daily_views[date];}console.log("Going to try to assign "+pageHits+" to hits"+rangeToGet[daysToGet]);switch(rangeToGet[daysToGet]){case30:visitRank=getStats.rank;hits30=pageHits;break;case60:hits60=pageHits;break;case90:hits90=pageHits;break;default:break;}pageHits=0;},fail:function(errorMsg){alert("Failed to get results for: http://stats.grok.se/json/"+lang+"/latest"+rangeToGet[daysToGet]+"/"+encodeURIComponent(pageNames[pageName])+"\nInstead received:"+errorMsg);}});// }console.warn("Setting fullResults["+pageName+"] = {\"rank\": "+visitRank+", \"hits30\": "+hits30+", \"hits60\": "+hits60+", \"hits90\": "+hits90+"};");fullResults[pageName]={"rank":visitRank,"hits30":hits30,"hits60":hits60,"hits90":hits90};console.error("Results are %o",fullResults[pageName]);visitRank=0;hits30=0;hits60=0;hits90=0;if(pageName===(pageNames.length-1)){displayAnswer();}//}