User:Kingemocut/global.js/Radio.js

/*I Got this from http://habbo.wikia.com/wiki/MediaWiki:Common.js/radio.js so the script is not mine, again, i am just here to annotate this script. */ //setting a cookie function setCookie(a, d) { var b = 365; //declaring variable b to contain the number 365 (for no of days in a normal year) var e = new Date; //Setting a new date e.setDate(e.getDate + b); //Making the new date today's date +365 days(aprox next year) var c = escape(d) + ((b == null) ? "" : "; expires=" + e.toUTCString); //all i know is that variable c will contain something to do with variable d, along with variable b becoming 0 and for the cookie to expire at a variable e's UTC date. document.cookie = a + "=" + c //creating the cookie itself } //connecting to get the users last preferences function getCookie(b) { var c, a, e, d = document.cookie.split(";"); //variables c a e and d are all derived from the cookie then getting split for (c = 0; c < d.length; c++) { //create a for loop asking if variable c is nothing, and if c is less then the length of d, then c will have 1 extra number up       a = d[c].substr(0, d[c].indexOf("=")); //setting variable a to be based of variable d (which is based of var c) everything else skips me        e = d[c].substr(d[c].indexOf("=") + 1); //setting variable a to be based of variable d (which is based of var c) everything else skips me        a = a.replace(/^\s+|\s+$/g, "");making variable a something i have no idea about if (a == b) { return unescape(e) }   } }

var opened = false; //set variable as the boolean command false (0) $(document).ready(function { //JQueary stuff, so i have no idea   $("body").append('     '); // a long string to do with thbe radio, when a 'button' gets clicked it hides    if(getCookie("radiohide") == "disabled") { //if loop for the cookie radiohide, asking if it is disabled        $("#radio_panel").addClass("minimized"); //get the div container with the id of radio_panel to add the class minimized        opened = true //setting open to boolean true (1)    } //end if loop    $("#radio_panel").click(function { //when the div container with ID of radio_panel gets clicked, run function of... if(opened) { //if loop to check if radio is opened, and if it is to run the following setTimeout(function {opened = false}, 500); //set the timeout of a function (which will just make sure that the radio variable opened = the bool value false(0)) setCookie("radiohide", "enabled"); //set a cookie to know that the radio was hidden, and make it enabled $("#radio_panel").removeClass("minimized") //gets the element with the id of "radio_panel" and removes the class called "nibinized" } /end the JQueary }); //end the function based on opening the mediaplayer }); //end the entire media player functions

function menu_hide { //function to hide the menu if(!opened) { //check if the media player is opened $("#radio_panel").addClass("minimized"); //if it is opened then get element with the id of radio_panel and adding the class minimized setCookie("radiohide", "disabled"); //setting the cookie to know that the radio panel is disabled setTimeout(function {opened = true}, 500); //setting a timeout  again } }