function loadjscssfile(filename, filetype){ if (filetype=="js"){ //if filename is a external JavaScript file var fileref=document.createElement('script') fileref.setAttribute("type","text/javascript") fileref.setAttribute("src", filename) } else if (filetype=="css"){ //if filename is an external CSS file var fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet") fileref.setAttribute("type", "text/css") fileref.setAttribute("href", filename) } if (typeof fileref!="undefined"){ document.getElementsByTagName("head")[0].appendChild(fileref) } } function modRule(showClassName){ if(!document.styleSheets) return; var thecss = (document.styleSheets[0].cssRules) ? document.styleSheets[0].cssRules : document.styleSheets[0].rules; for(i=0; i < thecss.length; i++){ if(thecss[i].selectorText==showClassName) thecss[i].style.cssText="display:block;"; } } // If there is a UID cookie (means they are logged in), turn the loggedin styles on if(cookiejar.fetch("UID") && cookiejar.fetch("fakeuser") == null){ modRule(".loggedin"); // If UID, BUT no curUserInfo login cookie yet, means they've JUST logged in: call setLoginCookies to initialize the login cookies if((cookiejar.fetch("curUserInfo") == null || cookiejar.fetch("curUserInfo") == "") || cookiejar.fetch("at") == "") { loadjscssfile("http://www.brandonsun.com/templates/WFP_determine_login_status?c=n&ran=" + Math.floor(Math.random()*1000000), "js") } var thisSite = "brandonsun"; var testwfpsub = cookiejar.fetch("wfpSub"); if(thisSite == "winnipegfreepress" && subcookiejar.fetch("curUserInfo", "wfpSub") == "Y"){ modRule(".isSbscrbr"); modRule(".pluck-comm-input-content"); modRule(".pluck-comm-reply-button"); modRule(".pluck-comm-rate-controls"); modRule(".pmobile-comments-submit-wrap"); modRule(".pmobile-comments-comment"); modRule(".pmobile-comments-vote-up"); modRule(".pmobile-comments-vote-down"); } else if(thisSite == "brandonsun" && subcookiejar.fetch("curUserInfo", "brandonSub") == "Y"){ modRule(".isSbscrbr"); } else{ modRule(".isNotSbscrbr"); } } // If there is no longer a UID (means they are logged out), turn the loggedout styles on, and make sure the cookies we set upon login get cleared out else if(cookiejar.fetch("UID") == null){ modRule(".loggedout"); cookiejar.crumble("UID"); cookiejar.bake('curUserInfo', '', -1, '/', '.brandonsun.com'); cookiejar.bake('at', '', -1, '/', '.brandonsun.com'); } else{ modRule(".loggedout"); cookiejar.crumble("UID") cookiejar.crumble("fakeuser") cookiejar.bake('curUserInfo', '', -1, '/', '.brandonsun.com'); cookiejar.bake('at', '', -1, '/', '.brandonsun.com'); }