非常不错的一个javascript 类
复制代码 代码如下:
/*
* Author:aoao
* Homepage:http://www.loaoao.com
* Email:loaoao@gmail.com / QQ:2222342
* Copyright (c) 2006 aoao
* Licensed under a Creative Commons Attribution 2.5 License (http://creativecommons.org/licenses/by/2.5/)
*/
var jscc = new Object();
var loaoao = new Object();//^_^//
jscc = {
init:function(){/*_*/},
path:"/scripts/jscc/",
include:function (file){
var j=document.createElement("script");
j.setAttribute('type','text/javascript');
j.setAttribute('src',jscc.path+file+'.js');
document.getElementsByTagName("head")[0].appendChild(j);
}
};
jscc.addEvent = function( obj, type, fn ) {
if ( obj.attachEvent ) {
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
obj.attachEvent( 'on'+type, obj[type+fn] );
} else {
obj.addEventListener( type, fn, false );
}
};
// Cookies
jscc.cookie = {
create:function (name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else expires = "";
document.cookie = name+"="+value+expires+"; path=/";
},
read:function(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
};
jscc.getPageSize=function(){
// reference lightbox (http://www.huddletogether.com/projects/lightbox/lightbox.js)
var theWidth,theHeight;
if (window.innerHeight&&window.scrollMaxY) {
theWidth = window.innerWidth;
theHeight = window.innerHeight+ window.scrollMaxY;
}
else if (document.body){
theWidth=((document.body.scrollWidth > document.body.offsetWidth)?document.body.scrollWidth : document.body.offsetWidth );
theHeight=((document.body.scrollHeight > document.body.offsetHeight)?document.body.scrollHeight : document.body.offsetHeight );
}
var winWidth ,winHeight;
if (self.innerHeight) {
winWidth = self.innerWidth;
winHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) {
winWidth = document.documentElement.clientWidth;
winHeight = document.documentElement.clientHeight;
} else if (document.body) {
winWidth = document.body.clientWidth;
winHeight = document.body.clientHeight;
}
var pWidth=(theWidth>winWidth?theWidth:winWidth)
var pHeight=(theHeight>winHeight?theHeight:winHeight)
var yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
}
var getPageSize = new Array(pWidth,pHeight,winWidth,winHeight,yScroll)
return getPageSize;
}
jscc.widgets = {/**/};
jscc.widgets.fixedsidebar = {
fixedHeight:0,
oldScrolltop:0,
init: function(){
if (!document.getElementById("sidebar")) return;
jscc.addEvent(window,"scroll",function(e){jscc.widgets.fixedsidebar.setFixed()});
jscc.addEvent(window,"resize",function(e){jscc.widgets.fixedsidebar.setFixed()});
this.fixedHeight=document.getElementById("sidebar").offsetTop;
this.setFixed();
},
setFixed:function(){
var sidebar=document.getElementById("sidebar");
var ref=document.getElementById("main");
var s_t=sidebar.offsetTop;
var s_h=sidebar.offsetHeight;
var s_th=s_t+s_h;
var r_th=ref.offsetTop+ref.offsetHeight;
var d_st;
if(document.documentElement.scrollTop){
d_st=document.documentElement.scrollTop;
}
else{
d_st=document.body.scrollTop
}
if(r_th>(s_t+s_h)){
var seHeight=0;
if (self.innerHeight) { seHeight = self.innerHeight;} else if (document.documentElement && document.documentElement.clientHeight) { seHeight = document.documentElement.clientHeight;} else if (document.body) {seHeight = document.body.clientHeight;}
try{
if(seHeight>s_h){
var newtop=(d_st<this.fixedHeight?0:d_st-this.fixedHeight-42);
}
else{
// Thank you dron (http://www.ucren.com/)
switch (d_st-this.oldScrolltop>0)
{
case true:
if (d_st-this.fixedHeight > s_t -seHeight){
var newtop= d_st -this.fixedHeight - (s_h-seHeight)-68;
}
break;
case false:
if (d_st-this.fixedHeight<parseInt(sidebar.style.marginTop,10)){
var newtop= d_st-this.fixedHeight;
}
break;
}
}
this.oldScrolltop = d_st;
if(newtop==undefined){ return;};
newtop=(newtop<0?0:newtop);
sidebar.style.marginTop= newtop+"px";
}
catch(e){
//alert(e.description);
}
}
else{
sidebar.style.marginTop="0px";
}
}
};
//jscc.addEvent(window,"load",function(e){jscc.widgets.fixedsidebar.init()});
jscc.widgets.wraphandler = {
//jscc.widgets.wraphandler reference http://www.collylogic.com/includes/resizer.js (http://www.collylogic.com/?/comments/redesign-notes-1-width-based-layout/)
init: function() {
//if (!document.getElementById) return;
if( document.getElementById('wrapper').className=="col3"){
jscc.wraphandler.setWrapper();
jscc.addEvent(window,"resize",jscc.wraphandler.setWrapper);
}
else{return}
},
setWrapper: function() {
var getPS=jscc.getPageSize();
var _width=getPS[2];
if (_width < 940) {
document.getElementById('wrapper').className = 'col2';
} else {
document.getElementById('wrapper').className = 'col3';
}
if(document.all) {
if (_width < 780) {
document.getElementById('wrapper').style.width="750px"
} else {
document.getElementById('wrapper').style.width="auto"
}
}
}
};
//jscc.addEvent(window,"load",function(e){jscc.widgets.wraphandler.init()});
jscc.widgets.styleSwitcher = {
// jscc.widgets.styleSwitcher reference StyleSwitcher functions( written by Paul Sowden http://www.idontsmoke.co.uk/ss/ . For the details, visit ALA: http://www.alistapart.com/stories/alternate/)
init:function(e) {
var cookie = jscc.cookie.read("style");
var title = cookie ? cookie : this.getPreferred();
title = (title==null?"left":title);
this.setActive(title);
var operactioner = document.getElementById("themes").getElementsByTagName("A");
operactioner[0].onclick=function() {
jscc.widgets.styleSwitcher.setActive("left");
return false;
};
operactioner[1].onclick=function() {
jscc.widgets.styleSwitcher.setActive("right");
return false;
};
this.switcher(title);
},
setActive:function(title){
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
this.switcher(title);
//jscc.cookie.create("style", title,"365");
},
getActive:function(){
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");}
return null;
},
getPreferred:function (){
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("rel").indexOf("alt") == -1
&& a.getAttribute("title")
) return a.getAttribute("title");
}
return null;
},
switcher:function(theme){
if(!document.getElementById(["theme_"+theme])) { return;}
var notheme=(theme=="left"?"right":"left");
document.getElementById(["theme_"+notheme]).style.display="inline";
document.getElementById(["theme_"+theme]).style.display="none";
},
end:function(e){
var title = this.getActive();
jscc.cookie.create("style", title,"365");
}
};
//jscc.addEvent(window,"load",function(e){jscc.widgets.styleSwitcher.init()});
jscc.addEvent(window,"unload",function(e){jscc.widgets.styleSwitcher.end()});
jscc.widgets.toTop = {
init:function(){
document.getElementById("toTop").onclick=function(e){
jscc.widgets.toTop.set();
return false;
}
},
waitTimer:null,
set:function(){
var d_st=document.documentElement.scrollTop;
if(window.navigator.userAgent.indexOf("MSIE")>=1){
for (var i=d_st; i>10; i-=Math.floor(i/6)){
window.scrollTo(0,i);
}
window.scrollTo(0,10);
}
else{
window.scrollTo(0,Math.floor(d_st / 2));
if(d_st>10){
waitTimer=setTimeout("jscc.widgets.toTop.set()",20);
}
else{
clearTimeout(waitTimer);
}
}
}
}
jscc.api={
google:{
init:function(){
try{
var searchControl = new GSearchControl();
}
catch(e){
return;
}
var options = new GdrawOptions();
options.setSearchFormRoot(document.getElementById("googleSearchForm"));
options.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
searchControl.setLinkTarget(GSearch.LINK_TARGET_SELF);
searchControl.setResultSetSize(GSearch.LARGE_RESULTSET);
var siteSearch = new GwebSearch();
siteSearch.setUserDefinedLabel("站内搜索");
siteSearch.setUserDefinedClassSuffix("siteSearch");
siteSearch.setSiteRestriction("www.loaoao.com");
searchControl.addSearcher(siteSearch);
var labSearch = new GwebSearch();
labSearch.setUserDefinedLabel("嗷嗷的实验室搜索");
labSearch.setUserDefinedClassSuffix("labSearch");
labSearch.setSiteRestriction("lab.loaoao.com");
searchControl.addSearcher(labSearch);
var wwwSearch = new GwebSearch();
wwwSearch.setUserDefinedLabel("Google搜索");
labSearch.setUserDefinedClassSuffix("wwwSearch");
searchControl.addSearcher(wwwSearch);
searchControl.draw(document.getElementById("googleSearchResults"), options);
// searchControl.execute("css");
}
}
}
loaoao.com = function(){
if (!document.getElementById) return;
jscc.widgets.styleSwitcher.init();
jscc.widgets.fixedsidebar.init();
jscc.widgets.toTop.init();
jscc.api.google.init();
};
jscc.addEvent(window,"load",loaoao.com);
复制代码 代码如下:
/*
* Author:aoao
* Homepage:http://www.loaoao.com
* Email:loaoao@gmail.com / QQ:2222342
* Copyright (c) 2006 aoao
* Licensed under a Creative Commons Attribution 2.5 License (http://creativecommons.org/licenses/by/2.5/)
*/
var jscc = new Object();
var loaoao = new Object();//^_^//
jscc = {
init:function(){/*_*/},
path:"/scripts/jscc/",
include:function (file){
var j=document.createElement("script");
j.setAttribute('type','text/javascript');
j.setAttribute('src',jscc.path+file+'.js');
document.getElementsByTagName("head")[0].appendChild(j);
}
};
jscc.addEvent = function( obj, type, fn ) {
if ( obj.attachEvent ) {
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
obj.attachEvent( 'on'+type, obj[type+fn] );
} else {
obj.addEventListener( type, fn, false );
}
};
// Cookies
jscc.cookie = {
create:function (name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else expires = "";
document.cookie = name+"="+value+expires+"; path=/";
},
read:function(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
};
jscc.getPageSize=function(){
// reference lightbox (http://www.huddletogether.com/projects/lightbox/lightbox.js)
var theWidth,theHeight;
if (window.innerHeight&&window.scrollMaxY) {
theWidth = window.innerWidth;
theHeight = window.innerHeight+ window.scrollMaxY;
}
else if (document.body){
theWidth=((document.body.scrollWidth > document.body.offsetWidth)?document.body.scrollWidth : document.body.offsetWidth );
theHeight=((document.body.scrollHeight > document.body.offsetHeight)?document.body.scrollHeight : document.body.offsetHeight );
}
var winWidth ,winHeight;
if (self.innerHeight) {
winWidth = self.innerWidth;
winHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) {
winWidth = document.documentElement.clientWidth;
winHeight = document.documentElement.clientHeight;
} else if (document.body) {
winWidth = document.body.clientWidth;
winHeight = document.body.clientHeight;
}
var pWidth=(theWidth>winWidth?theWidth:winWidth)
var pHeight=(theHeight>winHeight?theHeight:winHeight)
var yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
}
var getPageSize = new Array(pWidth,pHeight,winWidth,winHeight,yScroll)
return getPageSize;
}
jscc.widgets = {/**/};
jscc.widgets.fixedsidebar = {
fixedHeight:0,
oldScrolltop:0,
init: function(){
if (!document.getElementById("sidebar")) return;
jscc.addEvent(window,"scroll",function(e){jscc.widgets.fixedsidebar.setFixed()});
jscc.addEvent(window,"resize",function(e){jscc.widgets.fixedsidebar.setFixed()});
this.fixedHeight=document.getElementById("sidebar").offsetTop;
this.setFixed();
},
setFixed:function(){
var sidebar=document.getElementById("sidebar");
var ref=document.getElementById("main");
var s_t=sidebar.offsetTop;
var s_h=sidebar.offsetHeight;
var s_th=s_t+s_h;
var r_th=ref.offsetTop+ref.offsetHeight;
var d_st;
if(document.documentElement.scrollTop){
d_st=document.documentElement.scrollTop;
}
else{
d_st=document.body.scrollTop
}
if(r_th>(s_t+s_h)){
var seHeight=0;
if (self.innerHeight) { seHeight = self.innerHeight;} else if (document.documentElement && document.documentElement.clientHeight) { seHeight = document.documentElement.clientHeight;} else if (document.body) {seHeight = document.body.clientHeight;}
try{
if(seHeight>s_h){
var newtop=(d_st<this.fixedHeight?0:d_st-this.fixedHeight-42);
}
else{
// Thank you dron (http://www.ucren.com/)
switch (d_st-this.oldScrolltop>0)
{
case true:
if (d_st-this.fixedHeight > s_t -seHeight){
var newtop= d_st -this.fixedHeight - (s_h-seHeight)-68;
}
break;
case false:
if (d_st-this.fixedHeight<parseInt(sidebar.style.marginTop,10)){
var newtop= d_st-this.fixedHeight;
}
break;
}
}
this.oldScrolltop = d_st;
if(newtop==undefined){ return;};
newtop=(newtop<0?0:newtop);
sidebar.style.marginTop= newtop+"px";
}
catch(e){
//alert(e.description);
}
}
else{
sidebar.style.marginTop="0px";
}
}
};
//jscc.addEvent(window,"load",function(e){jscc.widgets.fixedsidebar.init()});
jscc.widgets.wraphandler = {
//jscc.widgets.wraphandler reference http://www.collylogic.com/includes/resizer.js (http://www.collylogic.com/?/comments/redesign-notes-1-width-based-layout/)
init: function() {
//if (!document.getElementById) return;
if( document.getElementById('wrapper').className=="col3"){
jscc.wraphandler.setWrapper();
jscc.addEvent(window,"resize",jscc.wraphandler.setWrapper);
}
else{return}
},
setWrapper: function() {
var getPS=jscc.getPageSize();
var _width=getPS[2];
if (_width < 940) {
document.getElementById('wrapper').className = 'col2';
} else {
document.getElementById('wrapper').className = 'col3';
}
if(document.all) {
if (_width < 780) {
document.getElementById('wrapper').style.width="750px"
} else {
document.getElementById('wrapper').style.width="auto"
}
}
}
};
//jscc.addEvent(window,"load",function(e){jscc.widgets.wraphandler.init()});
jscc.widgets.styleSwitcher = {
// jscc.widgets.styleSwitcher reference StyleSwitcher functions( written by Paul Sowden http://www.idontsmoke.co.uk/ss/ . For the details, visit ALA: http://www.alistapart.com/stories/alternate/)
init:function(e) {
var cookie = jscc.cookie.read("style");
var title = cookie ? cookie : this.getPreferred();
title = (title==null?"left":title);
this.setActive(title);
var operactioner = document.getElementById("themes").getElementsByTagName("A");
operactioner[0].onclick=function() {
jscc.widgets.styleSwitcher.setActive("left");
return false;
};
operactioner[1].onclick=function() {
jscc.widgets.styleSwitcher.setActive("right");
return false;
};
this.switcher(title);
},
setActive:function(title){
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
this.switcher(title);
//jscc.cookie.create("style", title,"365");
},
getActive:function(){
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");}
return null;
},
getPreferred:function (){
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("rel").indexOf("alt") == -1
&& a.getAttribute("title")
) return a.getAttribute("title");
}
return null;
},
switcher:function(theme){
if(!document.getElementById(["theme_"+theme])) { return;}
var notheme=(theme=="left"?"right":"left");
document.getElementById(["theme_"+notheme]).style.display="inline";
document.getElementById(["theme_"+theme]).style.display="none";
},
end:function(e){
var title = this.getActive();
jscc.cookie.create("style", title,"365");
}
};
//jscc.addEvent(window,"load",function(e){jscc.widgets.styleSwitcher.init()});
jscc.addEvent(window,"unload",function(e){jscc.widgets.styleSwitcher.end()});
jscc.widgets.toTop = {
init:function(){
document.getElementById("toTop").onclick=function(e){
jscc.widgets.toTop.set();
return false;
}
},
waitTimer:null,
set:function(){
var d_st=document.documentElement.scrollTop;
if(window.navigator.userAgent.indexOf("MSIE")>=1){
for (var i=d_st; i>10; i-=Math.floor(i/6)){
window.scrollTo(0,i);
}
window.scrollTo(0,10);
}
else{
window.scrollTo(0,Math.floor(d_st / 2));
if(d_st>10){
waitTimer=setTimeout("jscc.widgets.toTop.set()",20);
}
else{
clearTimeout(waitTimer);
}
}
}
}
jscc.api={
google:{
init:function(){
try{
var searchControl = new GSearchControl();
}
catch(e){
return;
}
var options = new GdrawOptions();
options.setSearchFormRoot(document.getElementById("googleSearchForm"));
options.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
searchControl.setLinkTarget(GSearch.LINK_TARGET_SELF);
searchControl.setResultSetSize(GSearch.LARGE_RESULTSET);
var siteSearch = new GwebSearch();
siteSearch.setUserDefinedLabel("站内搜索");
siteSearch.setUserDefinedClassSuffix("siteSearch");
siteSearch.setSiteRestriction("www.loaoao.com");
searchControl.addSearcher(siteSearch);
var labSearch = new GwebSearch();
labSearch.setUserDefinedLabel("嗷嗷的实验室搜索");
labSearch.setUserDefinedClassSuffix("labSearch");
labSearch.setSiteRestriction("lab.loaoao.com");
searchControl.addSearcher(labSearch);
var wwwSearch = new GwebSearch();
wwwSearch.setUserDefinedLabel("Google搜索");
labSearch.setUserDefinedClassSuffix("wwwSearch");
searchControl.addSearcher(wwwSearch);
searchControl.draw(document.getElementById("googleSearchResults"), options);
// searchControl.execute("css");
}
}
}
loaoao.com = function(){
if (!document.getElementById) return;
jscc.widgets.styleSwitcher.init();
jscc.widgets.fixedsidebar.init();
jscc.widgets.toTop.init();
jscc.api.google.init();
};
jscc.addEvent(window,"load",loaoao.com);
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?
更新日志
2024年11月26日
2024年11月26日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]