/*! (c) 2016 Jagex Limited */ var creation;RESPONSIVE.account-(creation={initialise:function(){return RESPONSIVE.global.facebook.loadFacebookAPI(RESPONSIVE.global.facebook.setUpEvents),PAGEGLOBALS.FB.queryString=PAGEGLOBALS.FB.queryString.replace(/amp;/g,""),$(document).ready(function(a){return function(){return a.validateCaptcha(),a.listenForm()}}(this))},listenForm:function(){return $("#create-email-form").on("forminvalid.zf.abide",function(){return $("#layout-vista__container").addClass("layout-vista__container--style-attention")})},validateCaptcha:function(){return $("#create-email-form").on("submit",function(a){var b;if(b=$("#google-recaptcha"),b.length&&"undefined"!=typeof grecaptcha)return""===grecaptcha.getResponse()?(a.preventDefault(),$("#google-recaptcha-error").addClass("component-google-recaptcha-error--visibility-show")):$("#google-recaptcha-error").removeClass("component-google-recaptcha-error--visibility-show")})}}),document.domain="runescape.com",RESPONSIVE.global={initialise:function(){return $(document).ready(function(){return $(document).foundation()})},facebook:{/* loadFacebookAPI This function loads in the Facebook API, and then initialises our RS app. params: initCallback (function to be called after the FB app has been initted) */ loadFacebookAPI:function(a){if("undefined"==typeof FB||null===FB)return 0===$("#fb-root").length&&$("body").prepend('
'),window.fbAsyncInit=function(){if(FB.init({appId:PAGEGLOBALS.FB.appId,status:!1,cookie:!0,xfbml:!0,version:"v2.2",oauth:!0}),a)return a()},function(a,b){var c,d,e,f;if(e="",d="facebook-jssdk",f=a.getElementsByTagName("script")[0],c="",b&&(c="/debug"),!a.getElementById(d))return e=a.createElement("script"),e.id=d,e.async=!0,e.src="//connect.facebook.net/en_US/sdk"+c+".js",f.parentNode.insertBefore(e,f)}(document,!1)},fbLoginRedirect:function(a,b){var c,d,e,f;return d=PAGEGLOBALS.FB.fbURL,c=PAGEGLOBALS.FB.checkLoginURL,f=PAGEGLOBALS.FB.loginURL,e=500,$.getJSON(c+"?json=?",{tips:0,token:FB.getAuthResponse().accessToken,expiry:FB.getAuthResponse().expiresIn,signed:FB.getAuthResponse().signedRequest},function(c){var g,h;if(g="",h="",c.sso<0)return window.alert("There was a problem verifying your login. Please try again."),!1;if(c.sso.length>1){if(!(c.sna>-1))return null==b&&(b=""),h=f+"?key="+c.sso+"?"+a,"_parent"===b?window.parent.location=h:"_top"===b?window.top.location=h:"_blank"===b?window.open(h,"_blank"):window.location=h,!0;h=d+"?key="+c.sso+"&tps=0&"+a,"_parent"===b&&(window.parent.location=h),e=620}else h=d+"?"+a,"_parent"===b&&(window.parent.location=h);return"_parent"!==b?$.fancybox({href:h,type:"iframe",width:462,height:e,autoSize:!1,wrapCSS:"loginFancyBoxFB"}):void 0}),!1},fbButtonClickHandler:function(a,b){var c;return c=a||PAGEGLOBALS.FB.queryString,"undefined"==typeof FB||null===FB||"function"!=typeof FB.getAuthResponse?window.alert("Couldn't contact Facebook. Please try again later."):null==FB.getAuthResponse()?FB.login(function(a){return a.authResponse?RESPONSIVE.global.facebook.fbLoginRedirect(c,b):window.alert("Authentication with Facebook failed. Please try again.")},{scope:PAGEGLOBALS.FB.scope}):RESPONSIVE.global.facebook.fbLoginRedirect(c,b)},setUpEvents:function(){return $("#facebooklogin").click(function(a){var b,c,d;return a.preventDefault(),d=$(this),b=d.data("redirecturl"),c=d.attr("target"),RESPONSIVE.global.facebook.fbButtonClickHandler(b,c)})}}},RESPONSIVE.load=function(){var a;switch(RESPONSIVE.global.initialise(),a=document.getElementsByTagName("body")[0].id){case"page-create-account":return RESPONSIVE.account-creation.initialise();case"page-login":return RESPONSIVE.login.initialise();case"page-logout":return RESPONSIVE.logout.initialise();case"page-sn-manage":return RESPONSIVE.snaManage.initialise();case"page-sn-noassociation":return RESPONSIVE.snaNoassociation.initialise();case"page-sn-upgrade":return RESPONSIVE.snaGlobal.initialise();case"page-sn-confirmreplace":return RESPONSIVE.snaGlobal.initialise();case"page-sn-denied":return RESPONSIVE.snaGlobal.initialise()}},RESPONSIVE.login={initialise:function(){return RESPONSIVE.global.facebook.loadFacebookAPI(RESPONSIVE.global.facebook.setUpEvents),PAGEGLOBALS.FB.queryString=PAGEGLOBALS.FB.queryString.replace(/amp;/g,""),$(document).ready(function(a){return function(){return a.validateCaptcha(),a.listenForm()}}(this))},listenForm:function(){return $("#login-form").on("forminvalid.zf.abide",function(){return $("#layout-vista__container").addClass("layout-vista__container--style-attention")})},validateCaptcha:function(){return $("#login-form").on("submit",function(a){var b;if(b=$("#google-recaptcha"),b.length&&"undefined"!=typeof grecaptcha){if(""!==grecaptcha.getResponse())return $("#google-recaptcha-error").removeClass("component-google-recaptcha-error--visibility-show");if(a.preventDefault(),$("#google-recaptcha-error").addClass("component-google-recaptcha-error--visibility-show"),""!==$("#login-username").val()&&""!==$("#login-password").val())return $(".login-error").remove()}})}},RESPONSIVE.logout={initialise:function(){return setTimeout(function(){return RESPONSIVE.logout.redirect()},15e3)},redirect:function(){if(null!=RESPONSIVE.constant.url.home)return location.href=RESPONSIVE.constant.url.home}},RESPONSIVE.snaGlobal={resize:function(){var a;if(a=$("body"),parent&&"function"==typeof parent.resizeRaggedBox)return void parent.resizeRaggedBox(frameElement,a.outerHeight(!0))},initialise:function(){return RESPONSIVE.snaGlobal.resize()}},RESPONSIVE.snaManage={initialise:function(){return RESPONSIVE.snaGlobal.resize(),errorCode!==ERROR_UNABLE_TO_UPGRADE&&$(".sn-account-window__disassociate-link").on("click",function(a){var b,c;return a.preventDefault(),b=$(this),c=b.data("service"),$(".sn-account-window__disassociate-form--visibility-show").removeClass("sn-account-window__disassociate-form--visibility-show"),$(".sn-account-window__disassociate-link--visibility-hide").removeClass("sn-account-window__disassociate-link--visibility-hide"),$("#"+c).addClass("sn-account-window__disassociate-form--visibility-show"),b.addClass("sn-account-window__disassociate-link--visibility-hide")}),$("#facebooklogin").on("click",function(a){return a.preventDefault(),null===FB.getAuthResponse()||"undefined"==typeof FB.getAuthResponse()?getWebScriptPermissions?FB.login(function(a){if(a.authResponse)return fbLoginRedirect()},{scope:getWebScriptPermissions}):FB.login(function(a){if(a.authResponse)return fbLoginRedirect()}):fbLoginRedirect()})}},RESPONSIVE.snaNoassociation={initialise:function(){return $("#syncAccount").on("click",function(a){return a.preventDefault(),$("#sn-box__container").removeClass("layout-vista__container--size-wide"),$("#landing-screen").remove(),$("#errorMessageForm").remove(),$("#associateAccount").addClass("sn-integration-sync--visibility-show")})}};