目前共有3篇帖子。
【備份】/^window.(j|cs)s$/ V2.0
1樓 巨大八爪鱼 2010-11-6 15:28
var jswindow=new Object();
jswindow.move=new Object();
jswindow.move.mouse=new Object();
jswindow.move.dragging=false;
var jswindow_maxid=0; //最高窗口
var jswindow_id=0; //當前窗口
jswindow.opened=false;
jswindow.closeimgurl=websiteaddress+"Images/System/dialogclose.gif";
jswindow.flickering=false;
jswindow.flickertimes=0;
jswindow.open=function(str_title,url,width,height,onclose){
 /*
 ----------------------------------------------
   ● 窗口Div清單
 ----------------------------------------------
  0:窗口div容器
  1:背景層
  2:窗口陰影層
  3:窗口主框架
  4:窗口標題欄
  5:窗口內容區
  6:用於遮罩內容區的div
  7:關閉按鈕
 ----------------------------------------------
 */
 top.jswindow_maxid++;
 top.jswindow_id=top.jswindow_maxid;
 this.info=top.window_info();
 if (onclose==undefined || onclose==null) onclose="top.jswindow.close()";
 
 //計算窗口出現時的坐標
 var cw=this.info["Width"];
 var ch=this.info["Height"];
 var x=cw/2-width/2;
 var y=ch/2-height/2;
 if (x<0) x=0;
 if (y<0) y=0;
 x+=this.info["ScrollX"];
 y+=this.info["ScrollY"];
 
 var base=createNode("jswindow_base"+top.jswindow_id,'div',top.document.body); //0
 base.className="jswindow";
 var background=createNode('jswindow_background'+top.jswindow_id,'div',base); //1
 background.className="background";
 background.style.width=this.info["ContentWidth"]+"px";
 background.style.height=this.info["ContentHeight"]+"px";
 background.onmousedown=function(){jswindow.flicker();return false;};
 background.oncontextmenu=function(){return false;};
 
 var behind=createNode("jswindow_behind"+top.jswindow_id,'div',base); //2
 behind.className="behind";
 behind.style.left=(x+4)+"px";
 behind.style.top=(y+4)+"px";
 behind.style.width=width+"px";
 behind.style.height=height+"px";
 
 var frame=createNode("jswindow_frame"+top.jswindow_id,'div',base); //3
 frame.className="frame";
 frame.style.width=width+"px";
 frame.style.height=height+"px";
 frame.style.left=x+"px";
 frame.style.top=y+"px";
 this.move.mouse.lastmodalX=x;
 this.move.mouse.lastmodalY=y;
 
 var title=createNode("jswindow_title"+top.jswindow_id,"div",frame); //4
 title.className="title";
 title.innerHTML=str_title;
 title.onselectstart=function(){return false;};
 title.oncontextmenu=function(){return false;};
 
 var content=createNode("jswindow_content"+top.jswindow_id,"div",frame); //5
 content.className="content";
 content.innerHTML='<iframe id="jswindow_iframe'+top.jswindow_id+'" name="jswindow_iframe'+top.jswindow_id+'" src="'+url+'" width="100%" height="'+(height-26)+'" frameborder="no" marginwidth="0" marginheight="0" border="0" style="background-color:#FFFFFF"></iframe>';
 
 var cover=createNode("jswindow_content_cover"+top.jswindow_id,"div",base); //6
 cover.style.display="none";
 cover.className="cover";
 cover.style.left=(x+1)+"px";
 cover.style.top=(y+25)+"px";
 cover.style.width=(width-2)+"px";
 cover.style.height=(height-26)+"px";
 cover.oncontextmenu=function(){return false;};
 
 var closediv=createNode("jswindow_closediv"+top.jswindow_id,"div",frame); //7
 closediv.className="closediv";
 closediv.style.right="6px";
 closediv.style.top="5px";
 closediv.oncontextmenu=function(){return false;};
 var closelink=createNode("jswindow_closelink"+top.jswindow_id,"a",closediv);
 closelink.href="#";
 closelink.onclick=new Function(onclose+";return false");
 closelink.title="關閉";
 closelink.oncontextmenu=function(){return false;};
 var closeimg=createNode("jswindow_closeimg"+top.jswindow_id,"img",closelink);
 closeimg.src=this.closeimgurl;
 closeimg.style.border="none";
 closeimg.oncontextmenu=function(){return false;};
 
 title.onmousedown=function(event){jswindow.move.start(event);return false;};
}
jswindow.close=function(){
 drapNode("jswindow_base"+top.jswindow_id);
 top.jswindow_maxid--;
 top.jswindow_id=top.jswindow_maxid;
}
jswindow.move.start=function(event){
 if (!event) event=top.window.event;
 this.mouse.button=event.button;
 if (this.mouse.button!=1) return false; //只能用滑鼠左鍵拖移窗口
 this.mouse.startX=event.pageX?event.pageX:event.screenX;
 this.mouse.startY=event.pageY?event.pageY:event.screenY;
 this.mouse.modalX=this.mouse.lastmodalX;
 this.mouse.modalY=this.mouse.lastmodalY;
 top.document.onmousemove=function(event){jswindow.move.drag(event);return false;};
 top.document.onmouseup=function(){jswindow.move.end();return false;};
 $_DAM("jswindow_content_cover"+top.jswindow_id).style.display="";
 this.dragging=true;
}
jswindow.move.drag=function(event){
 if (!event) event=top.window.event;
 if ((!this.dragging) || event.button!=this.mouse.button){
  this.end();
 }else{
  var eventX=typeof(event.pageX)!='undefined'?event.pageX:event.screenX;
  var eventY=typeof(event.pageY)!='undefined'?event.pageY:event.screenY;
  var xChange=eventX-this.mouse.startX+this.mouse.modalX;
  var yChange=eventY-this.mouse.startY+this.mouse.modalY;
  this.changeposition(xChange,yChange);
 }
}
jswindow.move.end=function(){
 top.document.onmousemove=null;
 top.document.onmouseup=null;
 $_DAM("jswindow_content_cover"+top.jswindow_id).style.display="none";
 this.dragging=false;
}
jswindow.move.changeposition=function(cx,cy){
 var wid=top.jswindow_id;
 if (cx<0) cx=0; //左上角x坐標(瀏覽器左邊框到js窗口左邊框的距離)
 if (cy<0) cy=0; //左上角y坐標(瀏覽器上邊框到js窗口上邊框的距離)
 
 var beh=$_DAM('jswindow_background'+wid).style;
 var dx=Number(beh.width.replace(/px$/gi,'')); //背景層寬度
 var dy=Number(beh.height.replace(/px$/gi,'')); //背景層高度
 beh=$_DAM('jswindow_frame'+wid).style;
 var ew=Number(beh.width.replace(/px$/gi,'')); //當前js窗口寬度
 var eh=Number(beh.height.replace(/px$/gi,'')); //當前js窗口高度
 var fx=cx+ew+4; //窗口右上角x坐標
 var fy=cy+eh+4; //窗口右下角y坐標
 //防止窗口超出背景層
 if (fx>dx) cx=dx-ew-4;
 if (fy>dy) cy=dy-eh-4;
 
 
 beh=$_DAM('jswindow_behind'+wid).style;
 beh.left=(cx+4)+"px";
 beh.top=(cy+4)+"px";
 beh=$_DAM('jswindow_frame'+wid).style;
 beh.left=cx+"px";
 beh.top=cy+"px";
 beh=$_DAM('jswindow_content_cover'+wid).style;
 beh.left=(cx+1)+"px";
 beh.top=(cy+25)+"px";
 
 this.mouse.lastmodalX=cx;
 this.mouse.lastmodalY=cy;
}
jswindow.flicker=function(){
 var wid=top.jswindow_id;
 var b=this.flickertimes;
 this.flickertimes+=8;
 if (!this.flickering){ //防止重複創建周期執行對象
  $_DAM('jswindow_content_cover'+wid).style.display='';
  this.flickering=true;
  this.timeoutId=window.setInterval(this.flickerings,70);
  this.flickerfx=0;
 }
}
jswindow.flickerings=function(){
 var f=$_DAM('jswindow_frame'+top.jswindow_id).style;
 if (jswindow.flickertimes<1){
  window.clearTimeout(jswindow.timeoutId);
  $_DAM('jswindow_content_cover'+top.jswindow_id).style.display='none';
  f.background='#6B97CE';
  jswindow.flickering=false;
  jswindow.flickertimes=0;
  return true;
 }else{
  f.background=(jswindow.flickerfx==0)?'#93B4DB':'#6B97CE';
  jswindow.flickerfx=(jswindow.flickerfx==0)?1:0;
  jswindow.flickertimes--;
 }
}
2樓 巨大八爪鱼 2010-11-6 15:29
.jswindow div.background {
 position: absolute;
 left: 0px;
 top: 0px;
 filter: Alpha(Opacity=15);
 opacity: 0.15;
 background-color: #999999;
}
.jswindow div.frame {
 background-color: #6B97CE;
 position: absolute;
}
.jswindow div.frame div.title {
 color: #FFFFFF;
 font-size: 14px;
 font-weight: bold;
 cursor: move;
 height: 18px;
 padding-top: 6px;
 padding-left: 8px;
}
.jswindow div.behind {
 position: absolute;
 filter: Alpha(Opacity=50);
 opacity: 0.5;
 background-color: #999999;
}
.jswindow div.frame div.content {
 padding-top: 1px;
 padding-right: 1px;
 padding-left: 1px;
}
.jswindow div.frame div.closediv {
 position: absolute;
}
.jswindow div.cover {
 position: absolute;
 background-color: #999999;
 filter: alpha(opacity=0);
 opacity: 0;
}
3樓 巨大八爪鱼 2010-11-6 15:29
var xmlDoc;
/*--------------------------------------------------------------------------
  ● 字元串相關函數
--------------------------------------------------------------------------*/
function Trim(s){
 return s.replace(/(^\s*)|(\s*$)/g,"");
}
function True(s){
 var reg=/^[\w\u4e00-\u9fa5ⅠⅡⅢⅣⅤⅥⅦⅧ·ⅨⅩⅪⅫ\+\-]+$/;
 return reg.test(s);
}
function Length(s){
 var d=0;
 var a=s.split("");
 for (i=0;i<a.length;i++){
  if (a[i].charCodeAt(0)<299){
   d++;
  }else{
   d+=2;
  }
 }
 return d;
}
function is_number(n){
 //判斷是否為有理數(不是循環小數)
 var reg=/^[\-\+]?[1-9]*\d(\.\d+)?$/;
 return reg.test(n);
}
/*--------------------------------------------------------------------------
  ● 驗證碼
--------------------------------------------------------------------------*/
var captcha_id=0;
function captcha_update(name,kongjianname){
 if (name=="") name='captcha_image';
 if (kongjianname=="") kongjianname='captcha_val';
 captcha_id++;
 var url=currentaddress+'Include/Captcha.php?k='+captcha_id;
 $_DOM(name).src=url;
 $_DOM(kongjianname).value='';
 $_DOM(kongjianname).focus();
 return false;
}
function captcha_true(kongjianname,baocuospan){
 if (kongjianname=="") kongjianname='captcha_val';
 if (baocuospan=="") baocuospan='captcha_error_span';
 $_DOM(kongjianname).value=Trim($_DOM(kongjianname).value);
 if ($_DOM(kongjianname).value==""){
  $_DOM(baocuospan).innerHTML='請輸入驗證碼';
  return false;
 }else{
  $_DOM(baocuospan).innerHTML='';
  return true;
 }
}
/*--------------------------------------------------------------------------
  ● 表單相關函數
--------------------------------------------------------------------------*/
function value_radio(id){
 // 獲得單選框的值
 var val=$_DOM(id);
 for (var i=0;i<val.length;i++){
  if (val[i].checked) return val[i].value;
 }
}
function value_checkbox(id,explode){
 // 獲得複選框的值
 var val=$_DOM(id);
 var ret="";
 for (var i=0;i<val.length;i++){
  if (val[i].checked){
   if (ret==""){
    ret=val[i].value;
   }else{
    ret=ret+explode+val[i].value;
   }
  }
 }
 return ret;
}
function formarea_loaded(){
 //處理IFRAME方式提交的帖子數據
 try{
  var msg=window.frames['form_area'].document.getElementById('msg').innerHTML;
  if (msg=="default") return false;
  else if (msg=="created") F5();
  else if (msg=="OK") window.frames['form_area'].document.location='Include/default2.php';
  else topic_alert(msg,(msg=="驗證碼輸入錯誤" || msg=="驗證碼超時,請重新輸入")?'topic_alerted_yzm':'topic_alerted_else');
 }catch(e){
  alert('無法連接到伺服器,請檢查您的網路連接');
  document.form1.button3.disabled=false;
  return false;
 }
}
/*--------------------------------------------------------------------------
  ● 搜索框
--------------------------------------------------------------------------*/
function search_submit(){
 var span=document.search_form.text;
 span.value=Trim(span.value);
 if (span.value==""){
  span.focus();
  return false;
 }else{
  return true;
 }
}
function set_searchtext(str){
 document.search_form.text.value=str;
 return true;
}
function search_start(){
 document.search_form.text.focus();
 return true;
}
/*--------------------------------------------------------------------------
  ● 模態窗口函數
--------------------------------------------------------------------------*/
function diag_close(){
 try{
  top.window_close();
 }catch(e){
  return false;
 }
}
function window_open(tit,url,wid,hei,userdefined){
 top.jswindow.open(tit,url,wid,hei);
}
function window_close(){
 top.jswindow.close();
}
function Alert(title,msg,w,h,fun){
 if (fun==undefined) fun='';
 var ru='../Include/Alert.php?t='+title+'&m='+msg+'&fun='+fun;
 window_open(title,ru,w,h,true);
}
function Confirm(title,msg,w,h,func){
 window_open(title,'../Include/Confirm.php?t='+title+'&m='+msg+'&u='+func,w,h);
}
function window_info(){
 var ret=Array();
 var scrollX=0,scrollY=0,width=0,height=0,contentWidth=0,contentHeight=0;
 
 if (typeof(window.pageXOffset)=="number"){
  scrollX=window.pageXOffset;
  scrollY=window.pageYOffset;
 }else if (document.body&&(document.body.scrollLeft||document.body.scrollTop)){
  scrollX=document.body.scrollLeft;
  scrollY=document.body.scrollTop;
 }else if (document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){
  scrollX=document.documentElement.scrollLeft;
  scrollY=document.documentElement.scrollTop;
 }
 
 if (typeof(window.innerWidth)=="number"){
  width=window.innerWidth;
  height=window.innerHeight;
 }else if (document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){
  width=document.documentElement.clientWidth;
  height=document.documentElement.clientHeight;
 }else if (document.body&&(document.body.clientWidth||document.body.clientHeight)){
  width=document.body.clientWidth;
  height=document.body.clientHeight;
 }
 
 if (document.documentElement&&(document.documentElement.scrollHeight||document.documentElement.offsetHeight)){
  if (document.documentElement.scrollHeight>document.documentElement.offsetHeight){
   contentWidth=document.documentElement.scrollWidth;
   contentHeight=document.documentElement.scrollHeight;
  }else{
   contentWidth=document.documentElement.offsetWidth;
   contentHeight=document.documentElement.offsetHeight;
  }
 }else if (document.body&&(document.body.scrollHeight||document.body.offsetHeight)){
  if (document.body.scrollHeight>document.body.offsetHeight){
   contentWidth=document.body.scrollWidth;
   contentHeight=document.body.scrollHeight;
  }else{
   contentWidth=document.body.offsetWidth;
   contentHeight=document.body.offsetHeight;
  }
 }else{
  contentWidth=width;
  contentHeight=height;
 }
 if (height>contentHeight) height=contentHeight;
 if (width>contentWidth) width=contentWidth;
 
 ret['ScrollX']=scrollX;
 ret['ScrollY']=scrollY;
 ret['Width']=width;
 ret['Height']=height;
 ret['ContentWidth']=contentWidth;
 ret['ContentHeight']=contentHeight;
 
 return ret;
}
/*--------------------------------------------------------------------------
  ● 文檔對象操作函數
--------------------------------------------------------------------------*/
function $_DOM(id){
 return document.getElementById(id);
}
function $_DAM(obj){
 return top.document.getElementById(obj);
}
function dom_delete($ob){
 document.body.removeChild($_DOM($ob));
 return true;
}
function createNode(ikk,lable_name,weizhi){
 var nod=top.document.createElement(lable_name);
 nod.id=ikk;
 weizhi.appendChild(nod);
 return nod; //返回創建的節點
}
function createAttribute(name,value,weizhi){
 var nod=top.document.createAttribute(name);
 nod.value=value;
 weizhi.setAttributeNode(nod);
 return nod;
}
function window_setTitle(s){
 $_DOM('window_title').innerHTML=s;
}
function dropNode(id){
 id=id.split(',');
 for (i=0;i<id.length;i++) dom_delete(id[i]);
}
function drapNode(id){
 id=id.split(',');
 for (i=0;i<id.length;i++) top.document.body.removeChild($_DAM(id[i]));
}
function divPosition(e){
 var x=e.offsetLeft;
 var y=e.offsetTop;
 while(e=e.offsetParent){
  x+=e.offsetLeft;
  y+=e.offsetTop;
 }
 var t=Array();
 t['x']=x;
 t['y']=y;
 return t;
}
function sed(obj,con){
 try{
  obj.innerHTML=con;
  return true;
 }catch(e){
  return false;
 }
}
function $_URL(id){
 //獲取url變數的值
 var qs=document.location.search.replace(/\?/gi,'').split('&');
 var ds=Array();
 for (var i=0;i<qs.length;i++){
  qs[i]=qs[i].split('=');
  ds[qs[i][0]]=qs[i][1];
 }
 if (ds[id]==undefined) ds[id]='';
 return ds[id];
}
/*--------------------------------------------------------------------------
  ● Cookie函數
--------------------------------------------------------------------------*/
function Cookie(id){
 var cookies=document.cookie();
 cookies=cookies.split(';');
 for (i=0;i<cookies.length;i++) cookies[i]=cookies[i].split('=');
 for (var i=0;i<cookies.length;i++) if (cookies[i][0]==id) return unescape(cookies[i][1]);
}
function setCookie(name,val){
 document.cookie=name+"="+escape(val);
}
/*--------------------------------------------------------------------------
  ● XML
--------------------------------------------------------------------------*/
function loadXML(xmlFile){
 var _xmlDoc=null;
 if (window.ActiveXObject) _xmlDoc=new ActiveXObject('Microsoft.XMLDOM');
 else{
  try{
   _xmlDoc=document.implementation.createDocument('','',null);
  }catch(ex){
   alert(ex.message);
   _xmlDoc=null;
  }
 }
 
 if (_xmlDoc!=null){
  _xmlDoc.async=false;
  try{
   _xmlDoc.load(xmlFile);
  }catch(ex){
   alert(ex.message);
   _xmlDoc=null;
  }
  return _xmlDoc;
 }
}
function xmlvalue(obj){
 return obj.firstChild.nodeValue;
}
/*--------------------------------------------------------------------------
  ● Ajax
--------------------------------------------------------------------------*/
function ajaxcode(str){
 var regs=[[],['*0','*1','*2','*3','*4','*5','*6']];
 regs[0][0]=/\*/gi;
 regs[0][1]=/\+/gi;
 regs[0][2]=/\//gi;
 regs[0][3]=/\?/gi;
 regs[0][4]=/&/gi;
 regs[0][5]=/#/gi;
 regs[0][6]=/%/gi;
 for (var i=0;i<regs[0].length;i++) str=str.replace(regs[0][i],regs[1][i]);
 return str;
}
/*--------------------------------------------------------------------------
  ● 其他函數
--------------------------------------------------------------------------*/
function copy($str){
 window.clipboardData.setData("Text",$str);
 return true;
}
function wait(z){
 var j=0;
 z*=100000;
 for (var i=0;i<z;i++) j++;
 alert(z);
 return true;
}
function blank(){};
function Escape(str){
 return escape(str);
}
function F5(){
 document.location=window.location.href;
 return true;
}
function browser_ie(){
 return window.attachEvent&&(!window.opera);
}
function spali(){
 var msg=top.window.frames['newiframe'].document.getElementById('msg').innerHTML;
 if (msg=="default") return false;
 var stt="OK(name=";
 var str=msg.substring(0,stt.length);
 if (msg=="") msg="未知錯誤";
 else if (str==stt){
  var file_name=msg.split('=');
  file_name=file_name[1].split(')');
  file_name=file_name[0];
  var cot='<img src="'+file_name+'" border="0" onload="if (this.height>428) this.height=428;if (this.width>570) this.width=570" />';
  editor_insert(cot);
  top.window_close();
 }else Alert('上傳失敗',msg,400,110,'spalierrored()');
}
function $_DAMW(obj){
 if (obj=="window_close_img") obj="window_closeimg"; //舊版本兼容代碼
 return $_DAM("js"+obj+String(top.jswindow_id));
}
function $_WIN(fx){
 if (fx==undefined) fx=0;
 var ob=window.frames['window_iframes_for'+String(top.window_id-fx)];
 return ob;
}
function redir(url){
 document.location=url;
}
function isundefined(v){
 return (v=="undefined");
}
function past_class(vari,name){
 if (Trim(vari)==""){
  return vari;
 }else{
  return vari+' '+name;
 }
}
/*--------------------------------------------------------------------------
  ● 通用函數
--------------------------------------------------------------------------*/
function spalierrored(){
 with($_WIN(1)){
  document.getElementById('button').disabled=false;
  document.getElementById('fileField').focus();
 }
 diag_close();
}
function show_membertequans(){
 window_open('會員特權','Include/membertequan.php',542,205);
 return false;
}
function bdkjdgyj_play(fstr){
 window_open('百度空間動感影集',fstr,480,394);
}
/*--------------------------------------------------------------------------
  ● 獲取數據
--------------------------------------------------------------------------*/
xa=loadXML("../fictitious/Ajax/website.xml"); //讀取虛擬目錄中的xml數據文件
xn=xa.documentElement; //website根節點
var website_address=xn.getAttribute('address'); //網站根地址
var website_name=xn.getAttribute('name'); //網站名稱
io=xn.childNodes[1].childNodes; //產品目錄
ion=io.length; //產品數量
var website_products=Array();
for (i=0;i<ion;i++) website_products[io[i].getAttribute('comment')]=io[i].getAttribute('address'); //循環遍歷各產品
var tieba_address=website_products['貼吧'];
websiteaddress=tieba_address;
var currentaddress='http://'+document.location.hostname+"/";

回復帖子

  抱歉,本吧禁止發帖
內容:
用戶名: 您目前是匿名發表
 
 
©2010-2024 Arslanbar [手機版] [桌面版]
除非另有聲明,本站採用創用CC姓名標示-相同方式分享 3.0 Unported許可協議進行許可。