📄 main.js
字号:
if(X.tab.getGrp(tds[i].getAttribute('name')) == curGrp){
t.s.push(item);
}else{
t.o.push(item);
}
}
t.s.each(
function(i){
tList.appendChild( Builder.node('li',{className:i.cname,tname:i.name,onclick:"X.tab.fg(this.getAttribute('tname'))"},i.label))
}
)
tList.appendChild( Builder.node('hr'));
t.o.each(
function(i){
tList.appendChild( Builder.node('li',{className:i.cname,tname:i.name,onclick:"X.tab.fg(this.getAttribute('tname'))"},i.label))
}
)
p = Position.cumulativeOffset(obj.parentNode);
tList.style.top = p[1]+obj.offsetHeight+'px';
document.body.appendChild(X.menus.bind(tList));
if(tList.offsetWidth <150)tList.style.width = '150px';
tList.style.left = p[0]+obj.parentNode.offsetWidth-tList.offsetWidth+'px';
tList.style.visibility = '';
},
getGrp:function(str){
var k=str.indexOf('/');
if(k>0){
return str.substr(0,k);
}else{
var j=str.indexOf(':');
if(j>0){
return str.substr(0,j);
}else{
return str;
}
}
}
},
/*}}}*/
menus:{
runtime:{m:[]},
bind:function(obj,options){
this.options = {
noPop:false,
inClick:true
};
Object.extend(this.options, options || {});
if(this.options.noPop){
Event.observe(obj,'click',function(e){Event.stop(e);colorPic.action.cancel();},false);
}
Event.observe(document.body,'click',X.menus.close,false);
X.menus.runtime.init = this.options.inClick;
X.menus.runtime.m.push(obj);
return obj;
},
close:function(e){
if(X.menus.runtime.init){
X.menus.runtime.init=false;
return;
}
Event.stopObserving(document.body,'click',X.menus.close,false);
X.menus.runtime.m.each(
function(i){
if(i.parentNode)removeElement(i);
}
)
X.menus.runtime.m=[];
}
},
setTitle:function(t){
var re =/\[[^\]]+\]/;
match = re.exec(document.title);
if(match!=null){
document.title = document.title.replace(re,'['+t+']');
}else{
document.title = '['+t+'] '+document.title;
}
} ,
mce:{
init:function(obj){
Editor.init(obj);
}
}
,
dashboard:{
update:function(){
X.go({ctl:'dashboard',act:'update'},{target:'__BG__'});
},
display:function(d){
e = $('dashboard').getElementsByTagName('*');
for(var i=0;i<e.length;i++){
if(e[i].getAttribute){
w = e[i].getAttribute('widget');
if(w){
eval(d.dashboard[w].method)(d.dashboard[w].data,e[i]);
}
}
}
/*
$('status').innerHTML = '';
h = Builder.node('h1',{},[__('New Info')]),
base = Builder.node('ul',{},[
Builder.node('li',{className:'newOrder',onclick:'X.go({ctl:\'order/olist\',act:\'index\', p:[\'active\']})'},[
__('New Order:'),
Builder.node('span',{},[d.status[0]])
]),
Builder.node('li',{className:'newOrderMsg',onclick:'X.go({ctl:\'order/olist\',act:\'index\', p:[\'message\']})'},[
__('New Order Message:'),
Builder.node('span',{},[d.status[1]])
]),
Builder.node('li',{className:'newComment',onclick:'X.compact.go(\'admin_comment_list.php\',\'__INPAGE__\',\''+__('New Comment')+'\')'},[
__('New Comment:'),
Builder.node('span',{},[d.status[2]])
]),
Builder.node('li',{className:'newCustomerMsg',onclick:'X.compact.go(\'admin_bbs_list.php\',\'__INPAGE__\',\''+__('New Customer Message')+'\')'},[
__('New Customer Message:'),
Builder.node('span',{},[d.status[3]])
]),
Builder.node('li',{className:'newArrivalNotice',onclick:'X.compact.go(\'admin_goodsnotify_list.php\',\'__INPAGE__\',\''+__('New Arrival Notice')+'\')'},[
__('New Arrival Notice:'),
Builder.node('span',{},[d.status[4]])
]),
Builder.node('li',{className:'stockAlarm',onclick:'X.compact.go(\'admin_goods_list.php?alarm_recsts=1\',\'__INPAGE__\',\''+__('Stock Alarm')+'\')'},[
__('Stock Alarm:'),
Builder.node('span',{},[d.status[5]])
])
]);
$('status').appendChild(h);
$('status').appendChild(base);
*/
if ($('status_newOrder')) $('status_newOrder').innerHTML = d.status[0]==0?'':' ('+d.status[0]+')';
if ($('status_newOrderMsg')) $('status_newOrderMsg').innerHTML = d.status[1]==0?'':' ('+d.status[1]+')';
if ($('status_newComment')) $('status_newComment').innerHTML = d.status[2]==0?'':' ('+d.status[2]+')';
if ($('status_newCustomerMsg')) $('status_newCustomerMsg').innerHTML = d.status[3]==0?'':' ('+d.status[3]+')';
if ($('status_newArrivalNotice')) $('status_newArrivalNotice').innerHTML = d.status[4]==0?'':' ('+d.status[4]+')';
if ($('status_stockAlarm')) $('status_stockAlarm').innerHTML = d.status[5]==0?'':' ('+d.status[5]+')';
$('checkSystem').innerHTML = '';
if (d.checkSystem){
u = Builder.node('ul');
d.checkSystem.each(
function (v) {
if(v.id){
if(v.url){
l = Builder.node('li',{id:v.id, onclick:'X.compact.go(\''+v.url+'\',\'__INPAGE__\',\''+v.title+'\')'},[v.message]);
} else if(v.ctl){
l = Builder.node('li',{id:v.id, onclick:'X.go({ctl:\''+v.ctl+'\',act:\''+v.act+'\'}, {target:\''+v.target+'\'})'},[v.message]);
}
if(l)u.appendChild(l);
}else{
//$(v.id).style.display='';
//Event.observe($(v.id),'click',X.dashboard.showExp,false);
}
}
)
$('checkSystem').appendChild(u);
} else {
$('checkSystem').hide();
}
},
showExp:function(){
fbox.open({ctl:'dashboard',act:'clearExp'},{noClose:true,width:500,height:300});
},
version:{
init:function(d){
if(d.syspatchs){
$('shop-version').className = 'new-version';
X.dashboard.version.syspatchs = d.syspatchs;
X.dashboard.version.lastVer = d.lastVer;
X.dashboard.version.tplpatchs = d.tplpatchs;
$('new-version-up').style.display='';
Event.observe($('new-version-up'),'click',X.dashboard.version.show,false);
Event.observe($('shop-version'),'click',X.dashboard.version.show,false);
Event.observe($('upgrade'),'click',X.dashboard.version.show,false);
}
else
{
$('shop-version').title='';
}
if(d.call){
eval(d.call);
}
},
show:function(e){
var base = Builder.node('div',{},__('Lastest Version:')+X.dashboard.version.lastVer);
for(i=0; i<X.dashboard.version.syspatchs.length; i++){
div = Builder.node('div', {style:'clear:both;'}, [
Builder.node('a',{href:X.dashboard.version.syspatchs[i].url,target:'_blank'},X.dashboard.version.syspatchs[i].version),
Builder.node('div', {}, [X.dashboard.version.syspatchs[i].info])
]);
base.appendChild(div);
}
fbox.msgbox(base,[
{label:__('Close'),onclick:'fbox.close()'}
],{title:__('Update Patch'),height:300});
}
}
},
init:function(){
/*
var area = $('tpanel').getElementsByClassName('setupmenu');
if (Appear.pub == 0) {
var c1 = $('tpanel').getElementsByClassName('publishwrap');
area[0].removeChild(c1[0]);
}
if (Appear.help == 0) {
var c2 = $('tpanel').getElementsByClassName('link help');
area[0].removeChild(c2[0]);
}
*/
tabber.init(document.body);
f = document.body.getElementsByTagName('form');
for(var i=0;i<f.length;i++){
Event.observe(f[i],'submit',X.form.onsubmit);
}
removeElement($('loading'));
$('container').show();
Round.roundworld();
X.dashboard.update();
setInterval("X.dashboard.update()", 60000);
if(!$('_debugger'))Event.observe(window, 'beforeunload', X.exit_confirm, true);
cpanel.menus.init();
Event.observe($('history'),'load',X.history,false);
if(CR){
setTimeout("X.wget.go(pingUrl,{onSuccess:X.dashboard.version.init})",5000);
}
setTimeout("X.do_check_certificate()",500);
setTimeout("X.showTop()",500);
},
do_check_certificate:function(){
X.go({ctl:'dashboard',act:'checkLicense'});
},
showTop:function(){
X.go({ctl:'dashboard',act:'showTop'});
},
history:function(e){
var t = $('history').contentWindow.location.search.slice(1);
if (t == '__F_WIN__') {
X.runtime.s = '__F_WIN__';
}
if(X.runtime.s != '__F_WIN__'){
if(X.tab.$(t)) X.tab.fg(t);
Event.stop(e);
}
},
exit_confirm:function(e){
e.returnValue = __('Sure to leave?');
},
exit:function(e){
},
canExit:function(){
Event.stopObserving(window,'beforeunload',X.exit_confirm,true);
}
}
function __(s){
return I18n[s] || s;
}
Event.observe(window, 'load', X.init, true);
function disableMouseSelection(element){
if (element.onselectstart !== undefined){
element.onselectstart = returnFalse;
}
else if (element.style.MozUserSelect !== undefined){
element.style.MozUserSelect = "none";
}
else if (element.style.KhtmlUserSelect !== undefined){
element.style.KhtmlUserSelect = "none";
}
else {
element.onmousedown = returnFalse;
}
if (element.ondrag !== undefined){
element.ondrag = returnFalse;
}
}
function $S(v) { return($(v).style); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function within(v,a,z) { return((v>=a && v<=z)?true:false); }
function XY(e,v) { var z=agent('msie')?[event.clientX+document.body.scrollLeft,event.clientY+document.body.scrollTop]:[e.pageX,e.pageY]; return(z[zero(v)]); }
function XYwin(v) { var z=agent('msie')?[document.body.clientHeight,document.body.clientWidth]:[window.innerHeight,window.innerWidth]; return(!isNaN(v)?z[v]:z); }
function zero(v) { v=parseInt(v); return(!isNaN(v)?v:0); }
var maxValue={'h':360,'s':100,'v':100}, HSV={0:360,1:100,2:100};
var hSV=165, wSV=162, hH=163, slideHSV={0:360,1:100,2:100}, zINDEX=15, stop=1;
function toHex(v) { v=Math.round(Math.min(Math.max(0,v),255));return("0123456789ABCDEF".charAt((v-v%16)/16)+"0123456789ABCDEF".charAt(v%16)); }
function rgb2hex(r) { return (toHex(r[0])+toHex(r[1])+toHex(r[2])); }
function hsv2hex(h) { return(rgb2hex(hsv2rgb(h))); }
function hsv2rgb(r) {
var R,B,G,S=r[1]/100,V=r[2]/100,H=r[0]/360;
if(S>0) { if(H>=1) H=0;
H=6*H; F=H-Math.floor(H);
A=Math.round(255*V*(1.0-S));
B=Math.round(255*V*(1.0-(S*F)));
C=Math.round(255*V*(1.0-(S*(1.0-F))));
V=Math.round(255*V);
switch(Math.floor(H)) {
case 0: R=V; G=C; B=A; break;
case 1: R=B; G=V; B=A; break;
case 2: R=A; G=V; B=C; break;
case 3: R=A; G=B; B=V; break;
case 4: R=C; G=A; B=V; break;
case 5: R=V; G=A; B=B; break;
}
return([R?R:0,G?G:0,B?B:0]);
}
else return([(V=Math.round(V*255)),V,V]);
}
function cNum(num16){
var hex ="0123456789abcdef",num10;
num10=null;
num16=num16.toLowerCase();
for(i=0;i<num16.length;i++){
if(hex.indexOf(num16.charAt(i))==-1){
return false;
}
}
for(i=0;i<num16.length;i++){
num10+= (hex.indexOf(num16.charAt(i)))*(Math.pow(16,(num16.length-1-i)));
}
return num10;
}
function rgb2hsv(val){
var r,g,b;
val = val.substr(1);
r = cNum(val.substr(0,2));
g = cNum(val.substr(2,2));
b = cNum(val.substr(4,2));
var v = Math.max(r,g,b);
var t = Math.min(r,g,b);
var s = (v == 0)?0:(v-t)/v;
if(s == 0){
var h = -1;
}else{
var a = v-t;
var cr = (v-r)/a;
var cg = (v-g)/a;
var cb = (v-b)/a;
var h = (r==v)?cb-cg:((g==v)?2+cr-cb:((b==v)?h=4+cg-cr:0));
h = h*60;
h = (h<0)?h+360:h;
}
return arrayHSV = new Array(h,s,v);
}
function purge(d) {
var a = d.attributes, i, l, n;
if (a) {
l = a.length;
for (i = 0; i < l; i += 1) {
n = a[i].name;
if (typeof d[n] === 'function') {
d[n] = null;
}
}
}
//for(n=d.firstChild;n;n=n.nextSibling){
// purge(n);
//}
delete(i);
delete(n);
}
function removeElement(d){
//purge(d);
d.parentNode.removeChild(d);
d=null;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -