SoFunction
Updated on 2025-04-10

Web CSS realizes switching between the entire site styles


//Get elements and use two $ to avoid conflict with jquery
function $$(s) {
    return (s);
}
function setblue() {
//Write cookies first
    //writeCookie("ISCSSSTYLE", "css/CRM_blue.css", 365, true);
//Set new css file
    $$("maincss").href = "css/CRM_blue.css";
//Take the main frame page and reset the css file
    //var childobj = ("ManagerMain").contentWindow;
    //("maincss").href = "css/CRM_blue.css";
}
function setgreen() {
//Write cookies first
    //writeCookie("ISCSSSTYLE", "css/", 365, true);
//Set new css file
    $$('maincss').href = "css/";
//Take the main frame page and reset the css file
    //var childobj = ("ManagerMain").contentWindow;
    //("maincss").href = "css/";
}
function setgray() {
//Write cookies first
    //writeCookie("ISCSSSTYLE", "css/CRM_gray.css", 365, true);
//Set new css file
    $$('maincss').href = "css/CRM_gray.css";
//Take the main frame page and reset the css file
    //var childobj = ("ManagerMain").contentWindow;
    //("maincss").href = "css/CRM_gray.css";
}


function setActiveStyleSheet(title) {
    //    var i, a, main; 
    //    for(i=0; (a = ("link")[i]); i++) 
    //    { 
    //        if(("rel").indexOf("style")!= -1 && ("title")) 
    //        { 
    //            = true; 
    //            if(("title") == title) 
    //            = false; 
    //        }
    //    }
    //$$("maincss").attr("href", "css/CRM_blue.css");
    //$$('maincss').href = "css/CRM_blue.css";
//Set css file
    $$('maincss').href = title;
}
function getActiveStyleSheet() {
    //    var i, a; 
    //    for(i=0; (a = ("link")[i]); i++) 
    //    { 
    //        if(("rel").indexOf("style")!= -1 && 
    //         ("title") && !) 
    //            return ("title"); 
    //    }
    //    return null;
    var cssfile = $$('maincss').href;
    //alert(cssfile);
    return cssfile;
}
function getPreferredStyleSheet() {
    //    var i, a; 
    //    for(i=0; (a = ("link")[i]); i++) 
    //    { 
    //        if(("rel").indexOf("style") != -1 
    //            && ("rel").indexOf("alt") == -1 
    //            && ("title")) 
    //            return ("title"); 
    //    }
    //    return null;
    var cssfile = $$('maincss').href;
    //alert(cssfile);
    return cssfile;
}
function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        (() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + ();
    }
    else
        expires = "";
    = name + "=" + value + expires + "; path=/";


}
function writeCookie(name, value, hours, escp) {
    var expire = "";
    if (hours != null) {
        expire = new Date((new Date()).getTime() + hours * 3600000);
        expire = "; expires=" + ();
    }
    if (escp == "True") {
        = name + "=" + value + expire;
    } else {
        = name + "=" + escape(value) + expire;
    }
}


function readCookie(name) {
    var nameEQ = name + "=";


    var ca = (';');


    for (var i = 0; i < ; i++) {
        var c = ca[i];


        while ((0) == ' ')
            c = (1, );
        if ((nameEQ) == 0)
            return (, );
    }
    return null;
}
$(document).ready(function() {


    //var title = readCookie("ISCSSSTYLE");
    //var title = "css/CRM_blue.css";


    //if (title != null && title != "undefined") {
    //    setActiveStyleSheet(title);
    //}
});