Mercurial > hg > rc2
comparison skins/classic/splitter.min.js @ 8:bf99236cc5cd default tip
try to recover from upgrade fail
author | Charlie Root |
---|---|
date | Sat, 29 Dec 2018 07:07:34 -0500 |
parents | 4681f974d28b |
children |
comparison
equal
deleted
inserted
replaced
7:65fd7d441cf1 | 8:bf99236cc5cd |
---|---|
1 function rcube_splitter(e){this.p1id=e.p1;this.p2id=e.p2;this.id=e.id?e.id:this.p1id+"_"+this.p2id+"_splitter";this.orientation=e.orientation;this.horizontal=(this.orientation=="horizontal"||this.orientation=="h");this.pos=e.start?e.start*1:0;this.relative=e.relative?true:false;this.drag_active=false;this.callback=e.callback;var d=this;this.init=function(){this.p1=document.getElementById(this.p1id);this.p2=document.getElementById(this.p2id);this.p1pos=this.relative?$(this.p1).position():$(this.p1).offset();this.p2pos=this.relative?$(this.p2).position():$(this.p2).offset();if(this.horizontal){var j=this.p1pos.top+this.p1.offsetHeight;this.layer=new rcube_layer(this.id,{x:0,y:j,height:10,width:"100%",vis:1,parent:this.p1.parentNode})}else{var i=this.p1pos.left+this.p1.offsetWidth;this.layer=new rcube_layer(this.id,{x:i,y:0,width:10,height:"100%",vis:1,parent:this.p1.parentNode})}this.elm=this.layer.elm;this.elm.className="splitter "+(this.horizontal?"splitter-h":"splitter-v");this.elm.unselectable="on";$(this.elm).mousedown(f);if(bw.ie){$(window).resize(c)}var h=rcmail.get_cookie(this.id);if(h&&!isNaN(h)){this.pos=parseFloat(h);this.resize()}else{if(this.pos){this.resize();this.set_cookie()}}};this.resize=function(){if(this.horizontal){var h=this.layer.height;this.p1.style.height=Math.floor(this.pos-this.p1pos.top-h/2)+"px";this.p2.style.top=Math.ceil(this.pos+h/2)+"px";this.layer.move(this.layer.x,Math.round(this.pos-h/2+1));if(bw.ie){var j=parseInt(this.p2.parentNode.offsetHeight,10)-parseInt(this.p2.style.top,10)-(bw.ie8?2:0);this.p2.style.height=(j>0?j:0)+"px"}}else{this.p1.style.width=Math.floor(this.pos-this.p1pos.left-this.layer.width/2)+"px";this.p2.style.left=Math.ceil(this.pos+this.layer.width/2)+"px";this.layer.move(Math.round(this.pos-this.layer.width/2+1),this.layer.y);if(bw.ie){var i=parseInt(this.p2.parentNode.offsetWidth,10)-parseInt(this.p2.style.left,10);this.p2.style.width=(i>0?i:0)+"px"}}$(this.p2).resize();$(this.p1).resize()};function f(h){d.drag_active=true;if(bw.konq||bw.chrome||bw.safari){document.body.style.webkitUserSelect="none"}d.p1pos=d.relative?$(d.p1).position():$(d.p1).offset();d.p2pos=d.relative?$(d.p2).position():$(d.p2).offset();$(document).bind("mousemove."+d.id,a).bind("mouseup."+d.id,g);$("iframe").each(function(){$('<div class="iframe-splitter-fix"></div>').css({background:"#fff",width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body")})}function a(h){if(!d.drag_active){return false}window.clearTimeout(d.ts);d.ts=window.setTimeout(function(){b(h)},1);return false}function b(i){var j=rcube_event.get_mouse_pos(i);if(d.relative){var h=$(d.p1.parentNode).offset();j.x-=h.left;j.y-=h.top}if(d.horizontal){if(((j.y-d.layer.height*1.5)>d.p1pos.top)&&((j.y+d.layer.height*1.5)<(d.p2pos.top+d.p2.offsetHeight))){d.pos=j.y;d.resize()}}else{if(((j.x-d.layer.width*1.5)>d.p1pos.left)&&((j.x+d.layer.width*1.5)<(d.p2pos.left+d.p2.offsetWidth))){d.pos=j.x;d.resize()}}d.p1pos=d.relative?$(d.p1).position():$(d.p1).offset();d.p2pos=d.relative?$(d.p2).position():$(d.p2).offset()}function g(h){d.drag_active=false;if(bw.konq||bw.chrome||bw.safari){document.body.style.webkitUserSelect="auto"}$(document).unbind("."+d.id);$("div.iframe-splitter-fix").remove();d.set_cookie();if(typeof d.callback=="function"){d.callback(d)}return bw.safari?true:rcube_event.cancel(h)}function c(j){if(d.horizontal){var i=parseInt(d.p2.parentNode.offsetHeight,10)-parseInt(d.p2.style.top,10)-(bw.ie8?2:0);d.p2.style.height=(i>0?i:0)+"px"}else{var h=parseInt(d.p2.parentNode.offsetWidth,10)-parseInt(d.p2.style.left,10);d.p2.style.width=(h>0?h:0)+"px"}}this.set_cookie=function(){var h=new Date();h.setYear(h.getFullYear()+1);rcmail.set_cookie(this.id,this.pos,h)}}; | 1 /** |
2 * Roundcube splitter GUI class | |
3 * | |
4 * @licstart The following is the entire license notice for the | |
5 * JavaScript code in this file. | |
6 * | |
7 * Copyright (c) 2006-2014, The Roundcube Dev Team | |
8 * | |
9 * The JavaScript code in this page is free software: you can redistribute it | |
10 * and/or modify it under the terms of the GNU General Public License | |
11 * as published by the Free Software Foundation, either version 3 of | |
12 * the License, or (at your option) any later version. | |
13 * | |
14 * @licend The above is the entire license notice | |
15 * for the JavaScript code in this file. | |
16 * | |
17 * @constructor | |
18 */ | |
19 function rcube_splitter(b){function e(c){a.drag_active=!0;if(bw.konq||bw.chrome||bw.safari)document.body.style.webkitUserSelect="none";a.p1pos=a.relative?$(a.p1).position():$(a.p1).offset();a.p2pos=a.relative?$(a.p2).position():$(a.p2).offset();$(document).on("mousemove."+a.id,f).on("mouseup."+a.id,g);$("iframe").each(function(){$('<div class="iframe-splitter-fix"></div>').css({background:"#fff",width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css($(this).offset()).appendTo("body")})} | |
20 function f(c){if(!a.drag_active)return!1;window.clearTimeout(a.ts);a.ts=window.setTimeout(function(){var d=rcube_event.get_mouse_pos(c);if(a.relative){var b=$(a.p1.parentNode).offset();d.x-=b.left;d.y-=b.top}a.horizontal?d.y-1.5*a.layer.height>a.p1pos.top&&d.y+1.5*a.layer.height<a.p2pos.top+a.p2.offsetHeight&&(a.pos=d.y,a.resize()):d.x-1.5*a.layer.width>a.p1pos.left&&d.x+1.5*a.layer.width<a.p2pos.left+a.p2.offsetWidth&&(a.pos=d.x,a.resize());a.p1pos=a.relative?$(a.p1).position():$(a.p1).offset(); | |
21 a.p2pos=a.relative?$(a.p2).position():$(a.p2).offset()},1);return!1}function g(c){a.drag_active=!1;if(bw.konq||bw.chrome||bw.safari)document.body.style.webkitUserSelect="auto";$(document).off("."+a.id);$("div.iframe-splitter-fix").remove();a.set_cookie();"function"==typeof a.callback&&a.callback(a);return bw.safari?!0:rcube_event.cancel(c)}function h(c){a.horizontal?(c=parseInt(a.p2.parentNode.offsetHeight,10)-parseInt(a.p2.style.top,10),a.p2.style.height=(0<c?c:0)+"px"):(c=parseInt(a.p2.parentNode.offsetWidth, | |
22 10)-parseInt(a.p2.style.left,10),a.p2.style.width=(0<c?c:0)+"px")}this.p1id=b.p1;this.p2id=b.p2;this.id=b.id?b.id:this.p1id+"_"+this.p2id+"_splitter";this.orientation=b.orientation;this.horizontal="horizontal"==this.orientation||"h"==this.orientation;this.pos=b.start?1*b.start:0;this.relative=b.relative?!0:!1;this.drag_active=!1;this.callback=b.callback;var a=this;this.init=function(){this.p1=document.getElementById(this.p1id);this.p2=document.getElementById(this.p2id);this.p1pos=this.relative?$(this.p1).position(): | |
23 $(this.p1).offset();this.p2pos=this.relative?$(this.p2).position():$(this.p2).offset();this.layer=this.horizontal?new rcube_layer(this.id,{x:0,y:this.p1pos.top+this.p1.offsetHeight,height:10,width:"100%",vis:1,parent:this.p1.parentNode}):new rcube_layer(this.id,{x:this.p1pos.left+this.p1.offsetWidth,y:0,width:10,height:"100%",vis:1,parent:this.p1.parentNode});this.elm=this.layer.elm;this.elm.className="splitter "+(this.horizontal?"splitter-h":"splitter-v");this.elm.unselectable="on";$(this.elm).mousedown(e); | |
24 bw.ie&&$(window).resize(h);var a=rcmail.get_cookie(this.id);a&&!isNaN(a)?(this.pos=parseFloat(a),this.resize()):this.pos&&(this.resize(),this.set_cookie())};this.resize=function(){if(this.horizontal){var a=this.layer.height;this.p1.style.height=Math.floor(this.pos-this.p1pos.top-a/2)+"px";this.p2.style.top=Math.ceil(this.pos+a/2)+"px";this.layer.move(this.layer.x,Math.round(this.pos-a/2+1));bw.ie&&(a=parseInt(this.p2.parentNode.offsetHeight,10)-parseInt(this.p2.style.top,10),this.p2.style.height= | |
25 (0<a?a:0)+"px")}else this.p1.style.width=Math.floor(this.pos-this.p1pos.left-this.layer.width/2)+"px",this.p2.style.left=Math.ceil(this.pos+this.layer.width/2)+"px",this.layer.move(Math.round(this.pos-this.layer.width/2+1),this.layer.y),bw.ie&&(a=parseInt(this.p2.parentNode.offsetWidth,10)-parseInt(this.p2.style.left,10),this.p2.style.width=(0<a?a:0)+"px");$(this.p2).resize();$(this.p1).resize()};this.set_cookie=function(){var a=new Date;a.setYear(a.getFullYear()+1);rcmail.set_cookie(this.id,this.pos, | |
26 a)}}; |