作者共发了3篇帖子。 内容转换:不转换▼
 
点击 回复
763 2
【备份】pictures.js
一派护法 十九级
1楼 发表于:2010-12-5 12:48
var pic={
 albums:{
  create:function(){
   jswindow.open("创建相册","back/create_albums.php?b="+pic.board.url,450,220);
  },
  edit:function(id){
   jswindow.open("编辑相册","back/create_albums.php?action=edit&i="+id,450,220);
  },
  drop:function(id){
   jswindow.open("删除相册","back/create_albums.php?action=drop&i="+id,450,220);
  },
  hualun:{
   moveup:{
    onmouseover:function(that){
     if (this.disabled(that)) return false;
     that.className='onmouseover';
    },
    onmouseout:function(that){
     if (this.disabled(that)) return false;
     that.className='';
    },
    disabled:function(that){
     return that.className=="disabled";
    },
    setdisabled:function(that,isTrue){
     if (isTrue!==false) isTrue=true;
     var cn=(isTrue)?'disabled':'';
     that.className=cn;
     return cn;
    },
    onclick:function(fx){
     if (fx==0){
      pic.albums.hualun.marqueeArea.wheel(null,1,true);
     }else{
      pic.albums.hualun.marqueeArea.wheel(null,2,true);
     }
    }
   },
   marqueeArea:{
    lastNode:null,
    onmouseover:function(that){
     if (this.selected(that)) return false;
     that.className="onmouseover";
    },
    onmouseout:function(that){
     if (this.selected(that)) return false;
     that.className="";
    },
    onclick:function(that){
     if (this.selected(that)) return false;
     if (this.lastNode!==null) this.lastNode.className='';
     that.className="selected";
     this.lastNode=that;
     var si=Number(that.id.replace(/^whole_for/,''));
     this.selectedid=si;
     pic.albums.show(si);
    },
    selected:function(that){
     var cn=that.className;
     return (cn=="selected");
    },
    wheel:function(event,result,clicked){
     var size=40;
     var basenum=120;
     switch (result){
      case 1:
       //向上
       var sil=$('marqueeArea');
       if (clicked===true){
        //计算应滚动到哪个相册
        var cur=Number(sil.scrollTop);
        var bal=Math.ceil(cur/basenum)*basenum-basenum;
        for (var i=0;i<(cur-bal)/2;i++){
         var fund=function(){
          var d=$('marqueeArea');
          d.scrollTop-=2;
          pic.albums.hualun.marqueeArea.updateDisabled(d);
         }
         window.setTimeout(fund,i+1);
        }
       }else{
        sil.scrollTop-=size;
       }
       this.updateDisabled(sil);
       break;
      case 2:
       //向下
       var sil=$('marqueeArea');
       if (clicked===true){
        var cur=Number(sil.scrollTop);
        var bal=Math.ceil(cur/basenum)*basenum+basenum;
        for (var i=0;i<(bal-cur)/2;i++){
         var fund=function(){
          var d=$('marqueeArea');
          d.scrollTop+=2;
          pic.albums.hualun.marqueeArea.updateDisabled(d);
         }
         window.setTimeout(fund,i+1);
        }
       }else{
        sil.scrollTop+=size;
        this.updateDisabled(sil);
       }
       break;
      default:
       if (!event) event=window.event;
       if (event.wheelDelta){
        //IE
        switch (event.wheelDelta){
         case 120:
          this.wheel(null,1);
          break;
         case -120:
          this.wheel(null,2);
          break;
         default:
          return false;
        }
       }else if (event.detail){
        //Firefox
        switch (event.detail){
         case 3:
          this.wheel(null,2);
          break;
         case -3:
          this.wheel(null,1);
          break;
        }
       }
       break;
     }
    },
    updateDisabled:function(sock){
     //更新按钮状态
     var a=(sock.scrollTop==0);
     var b=(sock.scrollTop+sock.clientHeight==sock.scrollHeight);
     $('moveup').className=a?'disabled':'';
     $('movedown').className=b?'disabled':'';
     return new Array(a,b);
    }
   }
  },
  show:function(alid){
   var url="../Ajax/pictures_data.php";
   var pars="id="+alid+"&type=getalbum";
   var comp=function(q){
    var xm=q.responseXML.documentElement.childNodes;
    var reg=/:\d{0,2}$/;
    var name=xmlvalue(xm[0]);
    var user=xmlvalue(xm[1]);
    var addtime=xm[2].getAttribute("add").replace(reg,'');
    var edittime=xm[2].getAttribute("edit").replace(reg,'');
    var clicks=xmlvalue(xm[3]);
    var desc=xmlvalue(xm[4]);
    var img=xm[5].getAttribute("src");
    var amount=xmlvalue(xm[6]);
    
    $('xcName').innerHTML=name;
    $('xcUser').innerHTML=user;
    $('xcAddTime').innerHTML=addtime;
    $('xcEditTime').innerHTML=edittime;
    $('xcClicks').innerHTML=clicks
    $('xcDescription').innerHTML=desc;
    if (img=="no") img="../Images/board/nopictures.gif";
    $('xchm').src=img;
    $('xcAmount').innerHTML=Number(amount);
   }
   var myAjax=new Ajax.Request(url,{method:'post',parameters:pars,onComplete:comp});
  }
 },
 page:{
  createAlbums:{
   onload:function(){
    $('textfield').select();
   },
   onsubmit:function(){
    var name=Trim($F('textfield'));
    var descr=Trim($F('textarea'));
    var url="../Ajax/pictures.php";
    var pars="type=0&bi="+$F('bi')+"&name="+ajaxcode(name)+"&descr="+ajaxcode('descr');
    $('button').disabled=true;
    var myAjax=new Ajax.Request(url,{method:'post',parameters:pars,onComplete:this.submited});
    return false;
   },
   submited:function(q){
    try{
     var msg=Number(q.responseXML.documentElement.firstChild.nodeValue);
     switch (msg){
      case 0:
       top.Alert("操作失败","没有权限(错误代码:1144)",300,110,'$_WIN(1).pic.page.createAlbums.failed()');
       break;
      case 1:
       top.Alert("操作失败","相册名称只能由中文、数字、字母和下划线组成",350,110,'$_WIN(1).pic.page.createAlbums.failed()');
       break;
      case 2:
       top.Alert("操作失败","指定的相册名称与现有相册重名,请另换一个名称",400,110,'$_WIN(1).pic.page.createAlbums.failed()');
       break;
      case 3:
       top.document.URL=top.location.href;
       break;
     }
    }catch(e){
     top.Alert("操作失败","系统错误(错误代码:1133)",300,110,'$_WIN(1).pic.page.createAlbums.failed()');
    }
   },
   failed:function(){
    $('button').disabled=false;
    top.jswindow.close();
   }
  }
 },
 photos:{
  upload:function(type){
   var url="back/newpictures.php?b="+pic.board.url;
   if (type=="albums") url+="&selectedid="+pic.albums.hualun.marqueeArea.selectedid;
   jswindow.open("图片上传",url,620,570,null,true);
  },
  startupload:function(){
   $('button').disabled=true;
   //判断是否至少上传一个文件
   var f1=$F('fileField0');
   if (f1==""){
    top.Alert('操作失败','必须至少选择一个文件',300,110,'$_WIN(1).pic.photos.failed()');
    return false;
   }else{
    document.form1.target="yager";
    document.form1.action="../Ajax/pbase_upload.php";
    return true;
   }
  },
  iframe:function(){
   try{
    var msg=window.frames['yager'].document.getElementById('msg').innerHTML;
    if (msg=="default"){
     return true;
    }
   }catch(e){
    return e;
   }
  },
  failed:function(){
   $('button').disabled=false;
   top.jswindow.close();
  }
 },
 onload:function(){
  set_searchtext(this.board.name);
  
  //加载滑轮
  switch (this.board.hualunid){
   case 1:
    var span=$('hualun');
    var eve=new Function("event","pic.albums.hualun.marqueeArea.wheel(event);return false");
    if (window.addEventListener){
     //Firefox
     window.addEventListener('DOMMouseScroll',eve,false);
    }else{
     //IE
     span.onmousewheel=eve;
    }
    var hsd=Number(pic.board.hualun_selectedid);
    if (hsd>0){
     var hsD=$('whole_for'+hsd);
     if (hsD!==null){
      pic.albums.hualun.marqueeArea.lastNode=hsD; //初始相册
      
      //滑轮滑动到初始相册
      var sock=$('marqueeArea');
      var lis=sock.getElementsByTagName('li');
      var j=0;
      var reg=/^whole_for\d+$/;
      for (var i=0;i<lis.length;i++){
       if (lis[i].className=="selected"){
        var scs=(j-2)*120;
        sock.scrollTop=scs;
        this.albums.hualun.marqueeArea.updateDisabled(sock);
        break;
       }else if (reg.test(lis[i].id)){
        j++;
       }
      }
      
      //调用相册信息
      pic.albums.hualun.marqueeArea.selectedid=hsd;
      pic.albums.show(hsd);
     }
    }
    break;
  }
 }
}
一派护法 十九级
2楼 发表于:2010-12-5 12:48
#noalbums {
 margin-top: 10px;
 margin-bottom: 50px;
 text-align: center;
}
#noalbums div.tishi {
 margin-bottom: 50px;
 margin-top: 50px;
}
.pictures_pages {
 margin-top: 10px;
 margin-bottom: 20px;
}
.pictures_result {
 margin-top: 10px;
 margin-bottom: 10px;
 margin-left: 15px;
}
.itemname {
 margin-top: 5px;
 margin-bottom: 5px;
}
.itemedit {
 margin-bottom: 5px;
}
.itemedit a {
 color: #666666;
}
.hualun {
 margin-top: 30px;
 margin-bottom: 30px;
}
.hualun #moveup {
 height: 20px;
 width: 143px;
 cursor: pointer;
 background-image: url(../Images/board/videoAlbumList_bg.gif);
 background-repeat: no-repeat;
 background-position: 0px -423px;
}
.hualun #moveup.onmouseover {
 background-position: 0px -509px;
}
.hualun #moveup.disabled {
 background-position: 0px -465px;
 cursor: default;
}
.hualun #movedown {
 height: 20px;
 width: 143px;
 cursor: pointer;
 background-image: url(../Images/board/videoAlbumList_bg.gif);
 background-repeat: no-repeat;
 background-position: 0px -565px;
 margin-top: 5px;
}
.hualun #movedown.onmouseover {
 background-position: 0px -651px;
}
.hualun #movedown.disabled {
 background-position: 0px -605px;
 cursor: default;
}
.hualun #marqueeArea {
 margin: 0px;
 padding: 0px;
 list-style-type: none;
 height: 575px;
 overflow: hidden;
}
.hualun #marqueeArea li {
 height: 110px;
 width: 144px;
 margin-top: 5px;
}
.hualun #marqueeArea li.onmouseover {
 background-image: url(../Images/board/videoAlbumList_bg.gif);
 background-repeat: no-repeat;
 cursor: pointer;
}
.hualun #marqueeArea li.selected {
 background-image: url(../Images/board/videoAlbumList_bg.gif);
 background-repeat: no-repeat;
 background-position: 0px -240px;
 width: 156px;
 margin-left: 12px;
}
.hualun #marqueeArea li div.modal {
 background-image: url(../Images/board/picAlbum_bg.gif);
 height: 88px;
 width: 107px;
}
.hualun #marqueeArea li div.modal img {
 margin-top: 13px;
 margin-left: 17px; 
}
.hualun #marqueeArea li div.aleft {
 padding-left: 19px;
 padding-top: 3px;
}
.hualun #marqueeArea li div.modal_text {
 width: 110px;
 text-align: center;
 margin-top: 3px;
}
.photoframe {
 border: 1px solid #D5D5D5;
 padding: 3px 6px 3px 6px;
}
#xcXX {
 margin-top: 20px;
}
.newpictures_base {
 margin: 10px;
}
#rlview {
 height: 10px;
 width: 100px;
 border: 1px solid #CCCCCC;
 cursor: default;
 float: left;
 margin-left: 20px;
}
#rltext {
 float: left;
}
#rlview .z {
 background-color: #01CE35;
 height: 10px;
}
.newpictures_base .lim {
 margin-top: 5px;
}
.newpictures_base .smalllim {
 margin-top: 2px;
}
.newpictures_base size_12 #form1 {
 margin: 0px;
 padding: 0px;
}
div.finally {
 margin-top: 10px;
}
一派护法 十九级
3楼 发表于:2010-12-5 13:00
}else if (event.detail){
        //Firefox
        //判断鼠标是否放在滑轮控件上
        var reg=/^(_wheel_(img(_div|Parent)?|text|for)\d+|marqueeArea)$/;
        try{
         var cnode=event.target.id; //鼠标所在容器id
         if (!reg.test(cnode)) return false;
        }catch(e){
         return false; //若没有节点则直接退出
        }
        
        //执行滚动
        switch (event.detail){
         case 3:
          this.wheel(null,2);
          break;
         case -3:
          this.wheel(null,1);
          break;
        }
       }

回复帖子

内容:
抱歉,系统已内测完毕,本吧不能发帖
抱歉,系统已内测完毕,本吧不能发帖
用户名: 您目前是匿名发表
(快捷键:Ctrl+Enter)
 

本帖信息

点击数:763 回复数:2
评论数: ?
作者:巨大八爪鱼
最后回复:巨大八爪鱼
最后回复时间:2010-12-5 13:00
精品区:代码备份区
 
©2010-2024 Arslanbar Ver2.0
除非另有声明,本站采用知识共享署名-相同方式共享 3.0 Unported许可协议进行许可。