📄 global.js
字号:
function PsMenu(){
this.pid = null;
this.obj = null;
this.w = null;
this.w = null;
this.t = 0;
this.menu = null;
this.init();
}
PsMenu.prototype = {
init : function() {
this.menu = document.createElement('div');
document.body.insertBefore(this.menu,document.body.firstChild);
},
guide : function(){
read.menu.innerHTML = '<div style="padding:13px 30px;border:1px solid #B5DBF7"><img src="'+imgpath+'/loading.gif" align="absbottom" /> 正在加载数据...</div>';
read.menu.className = 'menu';
read.menupz(read.obj,1);
},
close : function() {
read.t = setTimeout("closep();",100);
},
move : function(e){
if(is_ie){
document.body.onselectstart = function(){return false;}
}
var e = is_ie ? window.event : e;
var o = read.menu;
var x = e.clientX;
var y = e.clientY;
read.w = e.clientX - parseInt(o.offsetLeft);
read.h = e.clientY - parseInt(o.offsetTop);
document.onmousemove = read.moving;
document.onmouseup = read.moved;
},
moving : function(e){
var e = is_ie ? window.event : e;
var x = e.clientX;
var y = e.clientY;
read.menu.style.left = x - read.w + 'px';
read.menu.style.top = y - read.h + 'px';
},
moved : function(){
if(is_ie){
document.body.onselectstart = function(){return true;}
}
document.onmousemove = '';
document.onmouseup = '';
},
open : function(idName,object,type,pz){
clearTimeout(read.t);
if(typeof type == "undefined") type = 1;
if(typeof pz == "undefined") pz = 0;
read.menu.innerHTML = $(idName).innerHTML;
read.menu.className = $(idName).className;
read.menupz(object,type,pz);
if(type!=2){
$(object).onmouseout = function(){
read.close();
$(object).onmouseout = '';
}
read.menu.onmouseout = read.close;
read.menu.onmouseover = function(){
clearTimeout(read.t);
}
}
},
menupz : function(obj,type,pz){
read.menu.onmouseout = '';
read.menu.style.display = '';
read.menu.style.cssText = 'FILTER:Alpha(opacity=95);opacity:0.95;left:-500px;z-index:3000';
if(typeof obj == 'string'){
obj = $(obj);
}
if (obj == null) {
read.menu.style.top = (ietruebody().clientHeight - read.menu.offsetHeight)/2 + ietruebody().scrollTop + 'px';
read.menu.style.left = (ietruebody().clientWidth - read.menu.offsetWidth)/2 + 'px';
} else {
var top = findPosY(obj);
var left = findPosX(obj);
var pz_h = Math.floor(pz/10);
var pz_w = pz % 10;
if(pz_h!=1 && (pz_h==2 || top < ietruebody().clientHeight/2)){
top += ietruebody().scrollTop + obj.offsetHeight;
} else{
top += ietruebody().scrollTop - read.menu.offsetHeight;
}
if(pz_w!=1 && (pz_w==2 || left > (ietruebody().clientWidth)*3/5)){
left -= read.menu.offsetWidth - obj.offsetWidth;
}
read.menu.style.top = top + 'px';
read.menu.style.left = left + 'px';
}
},
InitMenu : function(){
function setopen(a,b){
if(IsElement(a)){
$(a).onmouseover = function(){read.open(b,a);}
}
}
for(var i in openmenu)
setopen(i,openmenu[i]);
},
IsShow : function(){
return (read.menu.hasChildNodes() && read.menu.style.display!='none') ? true : false;
}
}
var read = new PsMenu();
function closep(){
read.menu.style.display = 'none';
}
function findPosX(obj){
var curleft = 0;
if(obj.offsetParent){
while(obj.offsetParent){
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
} else if(obj.x){
curleft += obj.x;
}
return curleft - ietruebody().scrollLeft;
}
function findPosY(obj){
var curtop = 0;
if(obj.offsetParent){
while(obj.offsetParent){
curtop += obj.offsetTop
obj = obj.offsetParent;
}
} else if(obj.y){
curtop += obj.y;
}
return curtop - ietruebody().scrollTop;
}
function in_array(str,a){
for(var i=0;i<a.length;i++){
if(str == a[i]) return true;
}
return false;
}
function loadjs(path){
var header = document.getElementsByTagName("head")[0];
var s = document.createElement("script");
s.src = path;
header.appendChild(s);
}
function opencode(menu,td){
if(read.IsShow() && read.menu.firstChild.className == 'ck') return;
read.open(menu,td,2,11);
$('checkcode').src = 'checkcode.php?nowtime=' + new Date().getTime();
document.onclick = function(e){
var o = is_ie ? window.event.srcElement : e.target;
if(o.id == td){
return;
} else if(o.className == 'ck' || o.parentNode.className == 'ck'){
$('checkcode').src = 'checkcode.php?nowtime=' + new Date().getTime();
} else{
closep();
document.onclick = '';
}
}
}
var ifcheck = true;
function CheckAll(form){
for(var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if(e.type == 'checkbox' && e.disabled == false) e.checked = ifcheck;
}
ifcheck = ifcheck == true ? false : true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -