?? colorsetting.js
字號:
<!-- color script written entirely in JavaScript -->
<!-- Written by myhyli & 色瞇瞇的小瘋狗, 2003/05/12. -->
<!-- Member Of Blueidea Web Team. -->
<!-- Welcome to www.blueidea.com. -->
var temp_bt_colorSetting;
var tempTimeout;
var tempState = true;
var _queue = [];
var cssQueue = ['body','listtitle','listcontent','listcontentmedium','a','a_hover','columntitle','columncontent','content','hottitle','hotcontent','navlight','navlink','navdark','logobackground','pageseparator','border','pagelight','pageicon','pagesubject','docparameter','docparameter_text','pagelighter'];
function initializeUI() {
if(GetCookie('blueidea_colorSetting')!=null && /^#/.test(GetCookie('blueidea_colorSetting'))) {
document.styleSheets[0].disabled=true;
updateColor(GetCookie('blueidea_colorSetting'),true);
document.styleSheets[0].disabled=false;
}
}
initializeUI();
function settingColor() {
var reValue=window.showModelessDialog('/js/color/colorSetting.htm',window,'dialogWidth:460px;dialogHeight:415px;status:no;scroll:no;help:no;');
}
function updateColor(settings,grade) {
if(tempState==false) return false;
clearTimeout(tempTimeout);
////為了增加顏色轉換的效果和消除切換的生硬感,使用了濾鏡
if(grade!=true) {
tempState=false;
var oldBody=document.body;
if(oldBody!=null) {
var newBody=oldBody.cloneNode();//必須在應用濾鏡前進行,以確保body對象是干凈的
var tempScroll = [oldBody.scrollLeft,oldBody.scrollTop];
oldBody.style.filter='blendTrans(duration=1)';
oldBody.filters[0].apply();
}
}
var colors=new Object();
for(var i=0;i<cssQueue.length;i++) {
colors[cssQueue[i]]=settings.split(';')[i];
}
for(i=0;i<document.styleSheets[0].rules.length;i++) {
with(document.styleSheets[0].rules[i]) {
var tempText=selectorText.toLowerCase().replace(/[^\.]*\./i,'').replace(/:\w*/i,'');
switch(tempText) {
case 'a':
if(selectorText.match(/:hover/)!=null)style.color=colors['a_hover'];
else style.color=colors[tempText];
break;
case 'navlink':
style.color=colors[tempText];
break;
case 'content':
style.color=colors[tempText];
break;
case 'td':
style.color=colors['content'];
break;
case 'docparameter td':
style.color=colors['docparameter_text'];
break;
default:
if(colors[tempText]) {
if(tempText=='body' && document.body!=null && bt_colorSetting!=null) {
bt_colorSetting.style.backgroundColor=colors[tempText];
}
else if(tempText=='body' && (document.body==null || bt_colorSetting==null)) {
temp_bt_colorSetting=colors[tempText];
}
style.backgroundColor=colors[tempText];
}
break;
}
}
}
////播放濾鏡,并且在播放完畢后更新body,以消除應用濾鏡后的滯后感,該部分代碼作者:色瞇瞇的小瘋狗
if(grade!=true) {
document.body.filters[0].play();
tempTimeout=setTimeout(function() {
if(oldBody!=null) {
//oldBody.className='';
if(oldBody!=null) {
oldBody.applyElement(newBody, "inside")
oldBody.swapNode(newBody);
oldBody.removeNode(true);
}
document.body.scrollLeft = tempScroll[0];
document.body.scrollTop = tempScroll[1];
}
tempState = true;
for(var i=0;i<_queue.length;i++) {
eval(_queue[i].split(',')[0]+'('+_queue[i].split(',').slice(1)+')');
}
_queue = [];
},1500);
}
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = window.document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (window.document.cookie.substring(i, j) == arg) return getCookieVal (j);
i = window.document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function getCookieVal (offset) {
var endstr = window.document.cookie.indexOf (";", offset);
if (endstr == -1) endstr = window.document.cookie.length;
return unescape(window.document.cookie.substring(offset, endstr));
}
function SetCookie (name, value) {
var exp = new Date();
exp.setTime(exp.getTime() + (30*24*60*60*1000));
window.document.cookie = name + "=" + escape (value) + "; expires=" + exp.toGMTString()+";path=/";
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
window.document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString()+";path=/";
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -