b3log-solo skin 5style for 0.5.0
This commit is contained in:
35
5styles/js/5styles.js
Normal file
35
5styles/js/5styles.js
Normal file
@@ -0,0 +1,35 @@
|
||||
// *** Cookies ***
|
||||
function writeCookie(name, value) {
|
||||
exp = new Date();
|
||||
exp.setTime(exp.getTime() + (86400 * 1000 * 30));
|
||||
document.cookie = name + "=" + escape(value) + "; expires=" + exp.toGMTString() + "; path=/";
|
||||
document.cookie.replace("stylesheet=css0","stylesheet="+value);
|
||||
}
|
||||
function readCookie(name) {
|
||||
var search;
|
||||
search = name + "=";
|
||||
offset = document.cookie.indexOf(search);
|
||||
if (offset != -1) {
|
||||
offset += search.length;
|
||||
end = document.cookie.indexOf(";", offset);
|
||||
if (end == -1){
|
||||
end = document.cookie.length;
|
||||
}
|
||||
return unescape(document.cookie.substring(offset, end));
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function setStyleSheet(strCSS){
|
||||
var objs=document.getElementsByTagName("link");
|
||||
var intFound=0;
|
||||
for(var i=0;i<objs.length;i++){
|
||||
if(objs[i].type.indexOf("css")>-1&&objs[i].title){
|
||||
objs[i].disabled = true;
|
||||
if(objs[i].title==strCSS) intFound=i;
|
||||
}
|
||||
}
|
||||
objs[intFound].disabled = false;
|
||||
writeCookie("stylesheet",objs[intFound].title);
|
||||
}
|
||||
Reference in New Issue
Block a user