📄 core.js
字号:
/**
* config path to apnana
*/
var $path = '/a/';
/**
* 获取对象
* @param {Object} p
*/
$=function(p)
{
return document.getElementById(p);
}
/**
* Check is IE
*/
$isie=function()
{
return(window.navigator.userAgent.indexOf('MSIE')>=1);
}
/**
* Check is Firefox
*/
$isff=function()
{
return(window.navigator.userAgent.indexOf('Firefox')>=1);
}
/**
* 获取iframe对象
* @param {Object} p
*/
$f=function(p)
{
return document.frames?document.frames[p]:$(p).contentWindow;
}
/**
* 获取对象位置
* @param {Object} p
*/
$l=function(p)
{
var si = $s();
if($isie())return {x: p.getBoundingClientRect().left-2+si.l, y: p.getBoundingClientRect().top-2+si.t}
x=0;y=0;
p=p.offsetParent;
while(p!=null)
{
if ( p.style.position == 'absolute' || p.style.position == 'relative' || ( p.style.overflow != 'visible' && p.style.overflow != '' ) ) break;
x += p.offsetLeft;
y += p.offsetTop;
p=p.offsetParent;
}
return {x:x, y:y};
}
/**
* 获取滚动位置
*/
$s=function()
{
var t, l, w, h;
if (document.documentElement && document.documentElement.scrollTop) {
t = document.documentElement.scrollTop;
l = document.documentElement.scrollLeft;
w = document.documentElement.scrollWidth;
h = document.documentElement.scrollHeight;
} else if (document.body) {
t = document.body.scrollTop;
l = document.body.scrollLeft;
w = document.body.scrollWidth;
h = document.body.scrollHeight;
}
return { t: t, l: l, w: w, h: h };
}
/**
*
* @param {Object} p
*/
$p=function(p)
{
var hrefstr,pos,parastr,para,tempstr;
hrefstr = window.location.href;
pos = hrefstr.indexOf("?");
parastr = hrefstr.substring(pos+1);
para = parastr.split("&");
tempstr="";
for(i=0;i<para.length;i++)
{
tempstr = para[i];
pos = tempstr.indexOf("=");
if(tempstr.substring(0,pos) == p)
return tempstr.substring(pos+1);
}
return "";
}
$t=function()
{
a = new Date();
return a.getTime();
}
/**
*
* @param {Object} n
*/
String.prototype.cstr = function(n)
{
var a=0,i=0,temp='';
for (i=0;i<this.length;i++)
{
if(this.charCodeAt(i)>255)a+=2;
else a++;
if(a>n)return temp+'...';
temp += this.charAt(i);
}
return this;
}
String.prototype.replaceAll = function(search, replace)
{
var regex = new RegExp(search, "g");
return this.replace(regex, replace);
}
var $showu = function(uid,uname)
{
APIframe.open(uname+' -- 17xie会员卡片','/m/user/viewuser.php?uid='+uid,448,350)
}
/*
function op_ap(title,obj,width,height,url)
{
var pos = $l(obj);
APIframe.open(title,url,width,height);
APIframe.stack[APIframe.nframe].style.top = (pos.y+12)+'px';
APIframe.stack[APIframe.nframe].style.left = (pos.x+12)+'px';
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -