0&&$(".premier-overview__more a").attr("href",d)}})},buyNowButtons:function(){
//Buy now tracking on packages
$(".btnWrap a").on("click",function(a){var b=$(this),c=b.attr("href"),d="12",// Non-specific, click through to billing with no package preselected - Gold selected - all showing
e="Default Gold";c.indexOf("rsprem15b")>0&&(d=3,// 3 Months
e="Bronze"),c.indexOf("rsprem15s")>0&&(d=6,// Months
e="Silver"),c.indexOf("rsprem15g")>0&&(d=12,// Months
e="Gold"),RS3.tracking.pushTrackEvent("premier_club","buy_now",e,d)})},
//Fire the pixel to the premier club tracking url
trackingPixel:function(){// tracking pixels only for premier club page for page load only
"use strict";var a=baseURL+"/track/?jptg=pc&jptv=0";$.ajax({url:a,dataType:"jsonp",timeout:3e3,complete:function(){}})},init:function(){RS3.premierClub.getPrices(),RS3.premierClub.buyNowButtons(),RS3.premierClub.trackingPixel()}},RS3.companion={carousel:function(){var a=$("#carousel");a.flexslider({animation:"fade",slideshow:!1,slideshowSpeed:2e4,controlNav:!0,before:function(a){var b=a.animatingTo,c=a.slides.eq(b).find("img"),d=$(".flex-active-slide"),e=d.find("a");e.find("img").attr("src");c.attr("src")!=c.data("src")&&c.attr("src",c.data("src"))}})},preloadImages:function(){var a=new Image;a.src=RS3.imgRoot+"/companion_app/slide1.jpg";var b=new Image;b.src=RS3.imgRoot+"/companion_app/slide2.jpg";var c=new Image;c.src=RS3.imgRoot+"/companion_app/slide3.jpg";var d=new Image;d.src=RS3.imgRoot+"/companion_app/slide4.jpg"},events:function(){$("#appCode").on("click",function(){$(this).select()})},init:function(){RS3.companion.carousel(),// Carousel on Bonds page
RS3.companion.preloadImages(),// Preload images used on carousel
RS3.companion.events()}},RS3.topTrumps={init:function(){"use strict";var a=[];RS3.topTrumps.pageLoadTrack(),$(".trumpJSInfoSection").hide(),$(".trumpSelectionSection").show();for(var b=0;b<=5;b+=1)a[b]=new Image;a[0].src=RS3.imgRoot+"/top_trumps/trump_hero_kre.jpg",a[1].src=RS3.imgRoot+"/top_trumps/trump_hero_zil.jpg",a[2].src=RS3.imgRoot+"/top_trumps/trump_hero_kin.jpg",a[3].src=RS3.imgRoot+"/top_trumps/trump_hero_sar.jpg",a[4].src=RS3.imgRoot+"/top_trumps/trump_hero_evi.jpg",a[5].src=RS3.imgRoot+"/top_trumps/trump_all_cards.jpg",!window.location.hash.length||"#kreearra"!==window.location.hash&&"#commander_zilyana"!==window.location.hash&&"#king_black_dragon"!==window.location.hash&&"#saradomin_colossus"!==window.location.hash&&"#evil_chicken"!==window.location.hash&&"#runescape_top_trumps"!==window.location.hash||RS3.topTrumps.cardSelect($(window.location.hash+"_select")),$(".trumpBuyNow").on("click","a",function(a){var b=new Image;b.src="/track/?jptg=tt&jptv=1"}),$(".trumpSelectionCard").on("mouseenter",function(){$(this).hasClass("trumpSelectionCardCurrent")||$(this).stop().animate({marginTop:"40px"},"fast")}).on("mouseleave",function(){$(this).hasClass("trumpSelectionCardCurrent")||$(this).stop().animate({marginTop:"60px"},"fast")}).on("click",function(a){$(this).hasClass("trumpSelectionCardCurrent")||RS3.topTrumps.cardSelect($(this))}),RS3.topTrumps.showBonds()},cardSelect:function(a){"use strict";$(".trumpSelectionCardCurrent").stop().animate({marginTop:"60px"},"fast"),$(".trumpSelectionCardCurrent").removeClass("trumpSelectionCardCurrent"),$(".trumpCardDetailsCurrent").fadeOut("fast").removeClass("trumpCardDetailsCurrent"),a.stop().animate({marginTop:"0px"},"fast"),a.addClass("trumpSelectionCardCurrent"),$("#"+a.data("assoc")).fadeIn("fast").addClass("trumpCardDetailsCurrent")},pageLoadTrack:function(){"use strict";var a=baseURL+"/track/?jptg=tt&jptv=0";$.ajax({url:a,dataType:"jsonp",timeout:3e3,complete:function(){}})},showBonds:function(){var a=$("#showBonds"),b=$("#collapse");a.click(function(a){a.preventDefault(),b.stop().slideToggle()})}},RS3.gamePage={
//Overlay tracking for game page moved from gameOptions.js
overlayTracking:function(){function a(a){var b,c=JSON.parse?JSON.parse(JSON.stringify(a.data)):{};return"TRACKING"===c.type&&void("opened"===c.text?(RS3.tracking.pushTrackEvent("game_html5_overlay_loaded","load",pageLocation),RS3.tracking.trackingPixel(null,TRACKING_GAME_HTML5_OVERLAY_LOADED,null,!0)):(b=parseInt(c.text.split("reply-")[1]),0===b?(RS3.tracking.pushTrackEvent("game_html5_overlay_accepted","accepted",pageLocation),RS3.tracking.trackingPixel(null,TRACKING_GAME_HTML5_OVERLAY_ACCEPTED,null,!0)):1===b||3===b?(RS3.tracking.pushTrackEvent("game_html5_overlay_declined","declined",pageLocation),RS3.tracking.trackingPixel(null,TRACKING_GAME_HTML5_OVERLAY_DECLINED,null,!0)):2===b&&(RS3.tracking.pushTrackEvent("game_html5_overlay_error","error",pageLocation),RS3.tracking.trackingPixel(null,TRACKING_GAME_HTML5_OVERLAY_ERROR,null,!0))))}window.addEventListener?window.addEventListener("message",a):window.attachEvent&&window.attachEvent("onmessage",a)},showDownloadPage:function(){
//Load a failed screen encase we cannot redirect the user
RS3.gamePage.showFailedScreen(),window.location=downloadUrl},showThanksScreen:function(){$.removeCookie("JXRSLAUNCHING"),$("#launchingTitle,#gameUnsupportedPage").remove(),$("#thanksTitle").addClass("game-launch-page__title--show"),$("#gameLaunchingContent").addClass("game-launch-page__content--nospin")},showFailedScreen:function(){$.removeCookie("JXRSLAUNCHING"),$("#failedLaunchPage").addClass("game-failed-page--show"),$("#gameLaunchingPage,#game").remove()},failure:function(){
//Load a failed screen encase we cannot redirect the user
RS3.gamePage.showFailedScreen(),window.location=gameFailedUrl},init:function(){
//We need to set a cookie so the script is not re-ran when we fire the protocol link
if(
//Listen for the not loading link
$("#gameLaunchNotLoad").on("click",function(){RS3.gamePage.showFailedScreen()}),$.cookie("JXRSLAUNCHING")){var a=setTimeout(function(){$("#gameShouldLaunch").addClass("game-launch-page__should--show"),clearTimeout(a)},1e3);$.removeCookie("JXRSLAUNCHING");var b=setTimeout(function(){RS3.gamePage.showThanksScreen(),clearTimeout(b)},2e4)}else{
//Deploy global checks of browser and os
var c=JXGLOBAL.user.browser(),d=(JXGLOBAL.user.os(),null);
//Set the current browser string used for protocol checker
c.isChrome?d="chrome":c.isFirefox?d="mozilla":c.isIE?d="msie":c.isEdge&&(d="edge");
//We now need to wait to ensure all our vars have been retreived
var e=setTimeout(function(){if(
//Set the launcing cookie to avoid duplicate runs
$.cookie("JXRSLAUNCHING",!0),c.isEdge)RS3.gamePage.showDownloadPage();else{$("#gameShouldLaunch").addClass("game-launch-page__should--show");
//Check if the protocol works
var a="rs-launch://www.runescape.com/l="+currentLangId+"/jav_config.ws";checkProtocol(a,d);
//Wait for our check protocol to return
var b=setTimeout(function(){
//If the protocol is not supported removing the launching cookie and show the install screen unless the client cookie is set
if(protocolSupport[a])var c=setTimeout(function(){RS3.gamePage.showThanksScreen(),clearTimeout(c)},1e4);else $.removeCookie("JXRSLAUNCHING"),
//Any value for this cookie will indicate that the client will have been installed with the protocol
$.cookie("JXRSCLIENTVERSION")?RS3.gamePage.showThanksScreen():RS3.gamePage.showDownloadPage();clearTimeout(b)},2e3)}clearTimeout(e)},1e3)}
//Perform tracking logic
RS3.tracking.pushTrackEvent("game_java_client_loaded","load",pageLocation),RS3.tracking.trackingPixel(null,TRACKING_GAME_JAVA_CLIENT_LOADED,null,!0),RS3.gamePage.overlayTracking()}},RS3.gamePageConstants={javaVersion:"1.7.0_25+",hasJava:!1,hasJavaVersion:!1},RS3.gamePageBrowser={checkJs:function(){var a,b=document.getElementById("game");b&&(a=b.src.split(",j0,").join(",j1,"),b.src=a)},showGameScreen:function(){var a=$("#game");$.removeCookie("JXRSLAUNCHING"),$("#gameStateScreens,footer").remove(),a.addClass("java-frame--show"),a.attr("src",worldLink),
//Check for js and append to the iframe
RS3.gamePageBrowser.checkJs()},checkJava:function(){RS3.gamePageConstants.hasJava=deployJava.getJREs().length>=1,RS3.gamePageConstants.hasJavaVersion=deployJava.versionCheck(RS3.gamePageConstants.javaVersion)},init:function(){
//Listen for the not loading link
$("#gameLaunchNotLoad").on("click",function(){RS3.gamePage.failure()}),
//Run the java check
RS3.gamePageBrowser.checkJava();var a=1e3,b=JXGLOBAL.user.browser();b.isIE&&(a=5e3);
//We now need to wait to ensure all our vars have been retreived
var c=setTimeout(function(){
//Get variables
var a=RS3.gamePageConstants.hasJava,b=RS3.gamePageConstants.hasJavaVersion,d=JXGLOBAL.user.os();
//If Java is supported (and we are not on a mac) load the client as normal and remove everything else
a&&b&&!d.isMac?RS3.gamePageBrowser.showGameScreen():RS3.gamePage.failure(),clearTimeout(c)},a);
//Perform tracking logic
RS3.tracking.pushTrackEvent("game_java_client_loaded","load",pageLocation),RS3.tracking.trackingPixel(null,TRACKING_GAME_JAVA_CLIENT_LOADED,null,!0),RS3.gamePage.overlayTracking()}},RS3.grandExchange={data:null,options:null,chartObj:null,formatter:null,ticker:function(){var a=$("#ticker"),b=a.find(".ticker-wrap");b.webTicker({speed:50,direction:"left",moving:!0,startEmpty:!1,duplicate:!1,rssurl:!1,rssfrequency:0,updatetype:"reset"})},chart:function(){RS3.grandExchange.formatter=new google.visualization.NumberFormat({pattern:"#,###"}),this.drawChart(average30),
//If the user clicks a filter option
$("#filter a").on("click",function(a){a.preventDefault();var b,c=$(this),d=c.parent(),e=c.parents("ul");
//Check if there is a change of current data set
d.hasClass("active")||(e.find(".active").removeClass("active"),d.addClass("active"),e.prepend(d),
//Work out which data we need an create a data table for google
b=window["average"+c[0].hash.substr(1)],RS3.grandExchange.data=google.visualization.arrayToDataTable(b),
//For the 6month and 3month set reduce the dot size to avoid overlap
b==average30?RS3.grandExchange.options.pointSize=5:RS3.grandExchange.options.pointSize=3,
//Format column 1 data for tooltip
RS3.grandExchange.formatter.format(RS3.grandExchange.data,1),
//If we do not want the second column remove it
$("#toggleTrend").is(":checked")?RS3.grandExchange.formatter.format(RS3.grandExchange.data,2):RS3.grandExchange.data.removeColumn(2),
//Redraw the graph with our new data
RS3.grandExchange.renderChart())}),
//If the user toggles the trend line
$("#toggleTrend").on("change",function(){if($(this).is(":checked")){
//Work out which data we need an create a data table for google
var a=window["average"+$("#filter .active a")[0].hash.substr(1)];RS3.grandExchange.data=google.visualization.arrayToDataTable(a),
//Format the data in both columns for the tooltip
RS3.grandExchange.formatter.format(RS3.grandExchange.data,1),RS3.grandExchange.formatter.format(RS3.grandExchange.data,2)}else
//If the user does not want the trendline remove the column from the existing data table
RS3.grandExchange.data.removeColumn(2);
//Redraw the graph with the applicable data
RS3.grandExchange.renderChart()})},drawChart:function(a){var b=JXGLOBAL.user.browser();
//Get the applicable dataSet and create a data table
RS3.grandExchange.data=google.visualization.arrayToDataTable(a),
//Remove trend line on first start
RS3.grandExchange.data.removeColumn(2),
//Format the data in column 1 for the tooltip
RS3.grandExchange.formatter.format(RS3.grandExchange.data,1),
//Setup chart options
RS3.grandExchange.options={animation:{duration:1e3,startup:!0},chartArea:{left:95,height:"85%",top:50,width:"77%",backgroundColor:{stroke:"#23333e",strokeWidth:2}},backgroundColor:"transparent",legend:{position:"none"},pointSize:5,pointShape:"circle",pointsVisible:!0,series:{0:{color:"#e1bb34"},1:{color:"#b2dbee"}},hAxis:{baselineColor:"#23333e",textStyle:{color:"white"},gridlines:{color:"#23333e",count:-1},minorGridlines:{color:"transparent",count:0},titleTextStyle:{color:"transparent"}},vAxis:{baselineColor:"#23333e",format:"short",textStyle:{color:"white"},gridlines:{color:"#23333e",count:-1},title:"GP",titleTextStyle:{color:"white"}},width:665},
//Only show hAxis gridlines in chrome
b.isChrome||(RS3.grandExchange.options.hAxis.gridlines.color="transparent"),
//Define our chart object and render it
RS3.grandExchange.chartObj=new google.visualization.LineChart(document.getElementById("itemchart")),this.renderChart()},renderChart:function(){
//Render the chart using the open scope vars for data and options
RS3.grandExchange.chartObj.draw(RS3.grandExchange.data,RS3.grandExchange.options)},searchFilter:function(){$(".filter-link").on("click",function(a){a.preventDefault();var b=$("#filter");b.hasClass("showElement")?(b.removeClass("showElement"),$(".filter-link").removeClass("expand")):(b.addClass("showElement"),$(".filter-link").addClass("expand"))}),this.updateMinMax()},updateMinMax:function(){if($("#priceSlider").length){var a=$("#priceSlider").val().split(";");a[0]>495500?$("#minPrice").val("495500"):$("#minPrice").val(a[0]),a[1]==maxScale&&(a[1]="+",$(".jslider-value-to span").html("500,000+")),$("#maxPrice").val(a[1])}},init:function(){this.ticker(),this.searchFilter(),"undefined"!=typeof average30&&this.chart()}},RS3.polls={
//Draw poll results for the given id
drawPollResults:function(a){var b=$(".showElement"),c=b.parent().attr("id");$(".pollExpand.expanded").removeClass("expanded"),$(".polls").find(".showContent").removeClass("showContent"),
//If different poll add new class
c!="pollTab"+a&&($("#pollTab"+a+" .pollExpand").addClass("expanded"),$(".expanded").parent().parent().addClass("showContent"));
//Check if the poll details are already in the dom
var d=$("#pollDetails"+a);d.length>0?d.addClass("showElement"):RS3.polls.requestPoll(a),b.removeClass("showElement")},
//Determine how to show the remaining time
calculateReturnString:function(a){var b="",c=0;return a>=216e3?(c=a/86400,b=c.toFixed(1)+" "+pollLoc_days):a>=3600?(c=a/3600,b=c.toFixed(1)+" "+pollLoc_hours):a>=60?(c=a/60,b=c.toFixed(1)+" "+pollLoc_minutes):b=a+" "+pollLoc_seconds,b},
//Request the poll details
requestPoll:function(a){$.ajax({url:pollUrl+"/pollResults.json?id="+a,dataType:"jsonp",timeout:3e3,success:function(b){if(b.errorCode>0)RS3.polls.drawErrorPane(a,b.errorCode);else if(b.isBanned&&1==b.status)RS3.polls.drawErrorPane(a,9);else if(b.pollDetails[0].options[0].hidden&&b.playerAlreadyVoted)RS3.polls.drawHiddenMessagePane(a);else if(b.pollDetails[0].options.length>9||b.pollDetails.length>1)b.running&&!b.playerAlreadyVoted&&b.canPlayerVote?window.location=pollUrl+"/vote.ws?id="+a:window.location=pollUrl+"/results.ws?id="+a;else{var c=RS3.polls.generateResultsPane(b,a),d=RS3.polls.generateDetailsPane(b,a),e="",
//Add the poll details to the DOM
$("#pollTab"+a).append(e),
//This is necessary so that the animation will not play till the article is drawn
setTimeout(function(){$("#pollDetails"+a).addClass("showElement")},1),
//Re-listen for clicked forms
RS3.polls.onPageSubmit()}},failure:function(){RS3.polls.drawErrorPane(a,-1)},error:function(){RS3.polls.drawErrorPane(a,-1)}})},
//Build the description panel based on the poll state
generateDetailsPane:function(a,b){var c=""+pollLoc_description+"
"+a.pollDetails[0].questionText+"
";
//Check the poll states to see what to add to the description box
return a.playerAlreadyVoted>0&&(c+=""+pollLoc_totalvotes+": "+a.totalNumberofVotes+"
"+pollLoc_haveVoted+"
"),a.secondsRemaining>0&&(c+=""+RS3.polls.calculateReturnString(a.secondsRemaining)+" "+pollLoc_remaining+"
"),a.playerAlreadyVoted&&(c+="= "+pollLoc_yourVote,a.canPlayerVote&&(c+=" ("+pollLoc_change+")"),c+="
"),c},
//Build the answers panel based on whether or not the player has voted and if the poll is active
generateResultsPane:function(a,b){var c=a.pollDetails[0].options.length,d="",e=0;
//If the player already voted, the poll is closed or they cannot vote show results-->
if(a.playerAlreadyVoted||0==a.status||!a.canPlayerVote){d+=""+pollLoc_results+"
";for(var f=0;f"+a.pollDetails[0].options[f].optionName+"",d+="80&&(d+="style='right: "+(100-e)+"%' "),d+=">("+a.pollDetails[0].options[f].optionTotal+" votes) "+a.pollDetails[0].options[f].optionPercentage+"%
";d+="
"}else{d+=""+pollLoc_options+"
'}return d},drawErrorPane:function(a,b){if($(".pollError").removeClass("showElement"),$("#pollDetails"+a).length>0)$("#pollDetails"+a).addClass("showElement");else{var c="";switch(b){case 0:c+=pollLoc_alreadyVoted+" "+pollLoc_viewCurrent+"";break;case 1:c+=pollLoc_sorryMember+" "+pollLoc_becomeMember+" "+pollLoc_toCast;break;case 2:case 9:case 10:case 11:c+=pollLoc_sorryNotEligible;break;case 3:c+=pollLoc_sorryExperienced;break;case 5:c+=pollLoc_sorryClosed+" "+pollLoc_viewCurrent+".";break;case 12:c+=pollLoc_sorryExperienced;break;case 20:c+=pollLoc_sorryLanguage;break;default:c+=pollLoc_sorryError}c+="
",$("#pollTab"+a).append(c),setTimeout(function(){$("#pollDetails"+a).addClass("showElement")},1)}},drawHiddenMessagePane:function(a){var b=""+pollLoc_resultsHidden+"
";$("#pollTab"+a).append(b),setTimeout(function(){$("#pollDetails"+a).addClass("showElement")},1)},
//If the user votes on the landing page
onPageSubmit:function(){
//Check if a vote button is clicked
$(".voteForm").submit(function(a){a.preventDefault();var b=$(this),c=b.find("input[name='id']").val(),d=b.serialize();$("input[name='question0']:checked").length>0&&$.ajax({dataType:"jsonp",url:pollUrl+"/postPollVote.json?"+d,timeout:3e3,success:function(a){$("#pollTab"+a.pollID).addClass("pollTab--voted");var b=$("#pollDetails"+a.pollID+" .pollDetailsRight"),d=$("#pollDetails"+a.pollID+" .pollDetailsLeft");b.html("loading...
"),$.ajax({dataType:"jsonp",url:pollUrl+"/pollResults.json?id="+a.pollID,timeout:3e3,success:function(e){
//If results are hidden draw the hidden pane
if(e.pollDetails[0].options[0].hidden&&e.playerAlreadyVoted)$("#pollDetails"+a.pollID).remove(),RS3.polls.drawHiddenMessagePane(c);else{var f=RS3.polls.generateResultsPane(e,a.pollID),g=RS3.polls.generateDetailsPane(e,a.pollID);b.html(f),d.html(g)}},fail:function(){RS3.polls.drawErrorPane(c,-1)},error:function(){RS3.polls.drawErrorPane(c,-1)}})},fail:function(){RS3.polls.drawErrorPane(c,-1)},error:function(){RS3.polls.drawErrorPane(c,-1)}})})},init:function(){
//When clicking a poll show details or force login
$(".pollExpand").on("click",function(a){if(loggedIn>0){a.preventDefault();var b=this.getAttribute("data-pollid");RS3.polls.drawPollResults(b)}})}},RS3.offerwall={callSonic:function(){$("#offerwallBox").append('')},callPeanut:function(){$("#offerwallBox").append('')},callSuperRewards:function(){$("#offerwallBox").append('')},drawError:function(){$("#offerwallBox").append(""+offerwallErrorMessage+"
")},init:function(){switch("game"==wallOrigin?$("#closeWall").on("click",function(a){a.preventDefault(),document.location=unshim+"?closeBilling=1"}):"store"==wallOrigin&&$("#closeWall").on("click",function(a){a.preventDefault(),document.domain="runescape.com",window.parent.$("#closeBillingWindow").click()}),wallProvider){case supersonicWallId:""==supersonicButton?this.drawError():this.callSonic();break;case peanutLabsWallId:this.callPeanut();break;case superRewardsWallId:this.callSuperRewards();break;default:
//unknown wall type
this.drawError()}}},RS3.support={init:function(){function a(){var a=!!navigator.cookieEnabled;return"undefined"!=typeof navigator.cookieEnabled||a||(document.cookie="testcookie",a=document.cookie.indexOf("testcookie")!=-1),a}function b(a,b,c,d,e){try{var f=b.value.replace(/\r/g,"");e&&f.length>d&&(e.disabled=!0),f.length>d&&(1==a&&0==g&&(alert("{#alerttext}"),g=!0),b.value=f=f.substring(0,d)),c.childNodes[0].nodeValue=d-f.length}catch(h){}}function c(a,c,d,e,f,g,h){try{c.onkeyup=function(){b(a,c,d,e,g)},c.onkeydown=function(){b(a,c,d,e,g)},c.onkeypress=function(){b(a,c,d,e,g)},c.onmousemove=function(){b(a,c,d,e,g)},c.onchange=function(){b(!1,c,d,e,g)},f&&(f.onsubmit=function(){b(a,c,d,e,g)}),h&&f&&(h.onclick=function(){f.reset(),b(a,c,d,e,g)}),b(!1,c,d,e,g)}catch(i){}}function d(){if(!h){h=!0;try{for(var a=document.getElementsByTagName("textarea"),b=0;b=b){var e=d.substr(b),f=document.getElementById("charlimit_info"+e),g=document.getElementById("charlimit_count"+e),h=document.getElementById("charlimit_form"+e),i=document.getElementById("charlimit_submit"+e),j=document.getElementById("charlimit_reset"+e);if(f&&g){var k=!1;e.match(/^_msg/i)&&(k=!0);var l=parseInt(g.childNodes[0].nodeValue);c(k,a,g,l,h,i,j),f.style.display="inline"}}}$("#internet_type").change(function(){var a=$(this),b=a.parents(".formPartPair").find(".formAdditional");"0"===a.val()?(b.show(),$("#internet_type_other").attr("required","required")):(b.val("").hide(),$("#internet_type_other").removeAttr("required"))}),$('input[type="number"]').keydown(function(){"undefined"!=typeof $(this).attr("maxlength")&&this.value>=parseInt($(this).attr("maxlength"))&&(this.value=this.value.slice(0,parseInt($(this).attr("maxlength"))-1))});var f={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version",this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(a){for(var b=0;b999,e.invalid=b,b&&(e.error=a),e}},
// Switch statement run by keyup and submit for testing validation
switchType:function(a){var b;switch(a){case"email":b=RS3.accountcreation.validationTest.email();break;case"password":case"text":b=RS3.accountcreation.validationTest.password();break;case"number":b=RS3.accountcreation.validationTest.age()}return b},events:{
// Keyup event used to show on the fly valid input (input goes green)
keyup:function(){RS3.accountcreation.validationElements.inputs.on("input",function(a){var b=$(this);if(RS3.accountcreation.validationTest.browser()){var c=RS3.accountcreation.switchType(this.type);c.invalid?(b.removeClass("valid"),b[0].setCustomValidity(c.error)):(b.addClass("valid").removeClass("invalid"),b.siblings(".error").remove(),b[0].setCustomValidity(""))}else b.removeClass("invalid").siblings(".error").remove()})},
// Submit used to capture front-end validation before submitting to server
submit:function(){var a=RS3.accountcreation.validationElements.form;a.on("submit",function(a){var b=a,c=$(".g-recaptcha");
//Check Captcha
c.length&&"undefined"!=typeof grecaptcha&&(""==grecaptcha.getResponse()?(b.preventDefault(),c.addClass("g-recaptcha--error")):c.removeClass("g-recaptcha--error")),RS3.accountcreation.validationElements.inputs.each(function(a){var c=$(this),d=c.parent(),e=validation.switchType(this.type),f=$("").addClass("error"),g=d.find(".error");
// If validation fails, prevent form submission and add error
e.invalid?(b.preventDefault(),1!=g.length&&(c.addClass("invalid"),f.text(e.error),d.prepend(f))):(c.removeClass("invalid"),g.remove())})})},password:function(){
// Change input type function for Show/Hide password
RS3.accountcreation.validationElements.toggle.on("change",function(a){var b=$(this),c=RS3.accountcreation.validationElements.password;b.prop("checked")?c.attr("type","text"):c.attr("type","password")})}},setupValidation:function(){
// Capture keyup for on the fly validation
this.events.keyup(),
// Capture form submit for front-end validation
RS3.accountcreation.validationTest.browser()&&this.events.submit(),
// Show and hide password with link
this.events.password()},/*
* Game options used for Java checking and Pixel tracking on account creation
*/
gameOptionsTracking:function(){var a,b=new Image,c=new Image,d=$.cookie("JXFRONTUID");switch(b.src="https://www.googleadservices.com/pagead/conversion/1031096559/?value=0&label=LBGlCLm0lQcQ75HV6wM&guid=ON&script=1",affiliate){case"451":c.src="https://www.facebook.com/offsite_event.php?id=6013952264290&value=0¤cy=USD";break;case"907":case"908":case"909":c.src="http://ad2games.com/convert/13140";break;case"934":a=$.cookie("bidalgouid"),c.src="http://www.massoftraffic.com/maca-webapp/app/biz/lead?channel=JagexRuneScape&appUniqueIdentifier="+d+"&uid="+a;break;case"935":a=$.cookie("dauupid"),c.src="https://srv.ministerial5.com/convnew/?t=6&p=1456&l=0&aid="+d+"&uid="+a;break;case"936":c.src="https://track.popmog.com/games/643/campaign_tracking?reg_id="+d}affiliate>=923&&affiliate<=932&&(c.src="https://www.facebook.com/offsite_event.php?id=6014296706039&value=0¤cy=GBP")},gameOptions:function(){var a=$("#downloadBtn"),b=JXGLOBAL.user.os();if(a.length>0){if(b.isMac){var c=_.filter(JXGLOBAL.client,function(a){return a.platform.indexOf("OSX")>-1});$("#downloadBtn, #downloadBtnImage").attr("href",baseURL+"/downloads/"+c[0].filename+"?"+c[0].version),$("#downloadSize").html("0.3")}setTimeout(function(){window.location=a.attr("href")},2e3)}$("#accountCreated").length>0&&this.gameOptionsTracking()},init:function(a){switch(a){case"account-creation--create-account":this.setupValidation(),RS3.global.facebook.loadFacebookAPI(RS3.global.facebook.setUpEvents);// Load FB Api for FB login and FB like button
break;case"account-creation--download":this.gameOptions()}}},RS3.downloadNxt={binaryPrefixUnits:[" B"," KiB"," MiB"," GiB"," TiB"," PiB"," EiB"],intToLocalisedString:function(a,b,c,d){var e="",f=",",g=".";//no-break space
if(0===d&&(f=".",g=","),2===d&&(g=" "),b>0){var h=Math.pow(10,b);e=f+a%h,a=Math.floor(a/h)}for(;a>1e3;)e=a%1e3+e,a%1e3<10?e="00"+e:a%1e3<100&&(e="0"+e),e=g+e,a=Math.floor(a/1e3);return e=a+e},toBinaryPrefixFormat:function(a,b,c,d){for(var e=0,f=null;a>=1024&&e0?(a*=Math.pow(10,b),a=Math.floor(a/1024),f=this.intToLocalisedString(a,b,c,d)+this.binaryPrefixUnits[e]):f=this.intToLocalisedString(a,0,c,d)+this.binaryPrefixUnits[e],f},init:function(){
//Get Windows details
$.getJSON(baseContentUrl+"/downloads-info/windows/RuneScape-Setup.exe.json",function(a){$("#download-nxt__size-win").append(RS3.downloadNxt.toBinaryPrefixFormat(a.size,2,!0,currentLang)),$("#download-win a").attr("href",baseContentUrl+"/downloads/windows/RuneScape-Setup.exe?crc="+a.crc),$("#method-logo-win").attr("href",baseContentUrl+"/downloads/windows/RuneScape-Setup.exe?crc="+a.crc)}),
//Get MAC details
$.getJSON(baseContentUrl+"/downloads-info/osx/RuneScape.dmg.json",function(a){$("#download-nxt__size-mac").append(RS3.downloadNxt.toBinaryPrefixFormat(a.size,2,!0,currentLang)),$("#download-mac a").attr("href",baseContentUrl+"/downloads/osx/RuneScape.dmg?crc="+a.crc),$("#method-logo-mac").attr("href",baseContentUrl+"/downloads/osx/RuneScape.dmg?crc="+a.crc)}),
//Get version and change log details
$.getJSON(baseContentUrl+"/downloads/changelog.json",function(a){var b="";if(a.length>0){var c=0,d="";$("#download-version").append(a[0].version+" ("+$.datepicker.formatDate("dd M yy",new Date(a[0].date))+")"),b+="",$.each(a,function(a,e){3==c&&(d="nxt-client-updates__hidden-item"),b+="- "+e.version+" ("+$.datepicker.formatDate("dd M yy",new Date(e.date))+")
",e.changes.length>0&&(b+="",$.each(e.changes,function(a,c){b+="- "+c+"
"}),b+="
"),c++}),b+="
",
//Only render the change log for english as we cannot translate it
0===currentLang&&$("#change-log").html(b)}}),
//Listen for linux click then show instructions
$("#download-lin a").on("click",function(a){a.preventDefault(),$("#linux-instructions").toggleClass("download-nxt__linux-instr--show")}),$("#method-logo-lin").on("click",function(a){a.preventDefault(),$("#linux-instructions").toggleClass("download-nxt__linux-instr--show")});var a=$("#earlier-updates");a.on("click",function(b){b.preventDefault();var c=$(".nxt-client-updates__hidden-item"),d=6;c.length0){var h=Math.pow(10,b);e=f+a%h,a=Math.floor(a/h)}for(;a>1e3;)e=a%1e3+e,a%1e3<10?e="00"+e:a%1e3<100&&(e="0"+e),e=g+e,a=Math.floor(a/1e3);return e=a+e},toBinaryPrefixFormat:function(a,b,c,d){for(var e=0,f=null;a>=1024&&e0?(a*=Math.pow(10,b),a=Math.floor(a/1024),f=this.intToLocalisedString(a,b,c,d)+this.binaryPrefixUnits[e]):f=this.intToLocalisedString(a,0,c,d)+this.binaryPrefixUnits[e],f},init:function(){callJson&&(
//Get Windows details
$.getJSON(baseContentUrl+"/downloads-info/windows/RuneScape-Setup.exe.json",function(a){$("#size-win").text("("+RS3.newClient.toBinaryPrefixFormat(a.size,2,!0,currentLang)+")"),$("#download-win a").attr("href",baseContentUrl+"/downloads/windows/RuneScape-Setup.exe?crc="+a.crc),$("#method-logo-win").attr("href",baseContentUrl+"/downloads/windows/RuneScape-Setup.exe?crc="+a.crc)}),
//Get MAC details
$.getJSON(baseContentUrl+"/downloads-info/osx/RuneScape.dmg.json",function(a){$("#size-mac").text("("+RS3.newClient.toBinaryPrefixFormat(a.size,2,!0,currentLang)+")"),$("#download-mac a").attr("href",baseContentUrl+"/downloads/osx/RuneScape.dmg?crc="+a.crc),$("#method-logo-mac").attr("href",baseContentUrl+"/downloads/osx/RuneScape.dmg?crc="+a.crc)}),
//Get version and change log details
$.getJSON(baseContentUrl+"/downloads/changelog.json",function(a){var b="";a.length>0&&($("#download-version").append(a[0].version+" ("+$.datepicker.formatDate("dd M yy",new Date(a[0].date))+")"),b+="",$.each(a,function(a,c){b+="- "+c.version+" ("+$.datepicker.formatDate("dd M yy",new Date(c.date))+")
",c.changes.length>0&&(b+="",$.each(c.changes,function(a,c){b+="- "+c+"
"}),b+="
")}),b+="
",
//Only render the change log for english as we cannot translate it
0===currentLang&&$("#change-log").html(b))}),
//Listen for linux click then show instructions
$("#download-lin a").on("click",function(a){a.preventDefault(),$("#linux-instructions").toggleClass("download-nxt__linux-instr--show")}),$("#method-logo-lin").on("click",function(a){a.preventDefault(),$("#linux-instructions").toggleClass("download-nxt__linux-instr--show")}))}},RS3.onLoad={init:function(){"use strict";RS3.tracking.init(),// Google Analytics
"undefined"!=typeof Modernizr&&(Modernizr.input.placeholder||$(".placeholder").placeholder());var a=document.getElementsByTagName("body")[0].id;switch("legacy"!=a&&RS3.global.init(),a){case"home":RS3.homepage.init();// Homepage functionality
break;case"splash":RS3.splashpage.init();// Splash functionality
break;case"news":RS3.news.init();// News functionality
break;case"membersBenefits":RS3.membersBenefits.init();// Members Benefits functionality
break;case"hiscore":// Functionality across all hiscore pages (temporary & normal)
RS3.hiscores.init();break;case"hiscore--summer2016":RS3.hiscoreSummer2016.init();break;case"accountAssoc":// Functionality for the Facebook and partner account popup
RS3.assoc.init();break;case"legacy":RS3.legacy.init();// For legacy pages using new header and footer
break;case"weblogin":case"weblogin loginiframe":RS3.weblogin.init();// For login pages
break;case"storeLoc":RS3.storeloc.init();break;case"bonds":// For the bonds page
RS3.bonds.init();break;case"combat":// For the Combat Beta page
RS3.combat.init();break;case"goodwill":// For the goodwill page
RS3.goodwill.init();break;case"runemetrics":case"premier":RS3.premierClub.init();break;case"companion":RS3.companion.init();break;case"topTrumps":RS3.topTrumps.init();break;case"gamePage":RS3.gamePage.init();break;case"game-applet":RS3.gamePageBrowser.init();break;case"grandexchange":RS3.grandExchange.init();break;case"newclient":RS3.newClient.init();break;case"download-nxt-page":RS3.downloadNxt.init();break;case"polls":RS3.polls.init();break;case"offerwall":RS3.offerwall.init();break;case"support":case"support-new":RS3.support.init();break;case"authenticator":RS3.authenticator.init();break;case"player-proposal--ideas":RS3.global.detailsElement(),RS3.runelabs.updateLastSearch();break;case"season-promo":RS3.seasonpromo.init();break;case"account-creation--create-account":case"account-creation--download":RS3.accountcreation.init(a)}}},$(document).ready(RS3.onLoad.init());