PageSourceSearch

https://foscam.com/Public/Home/css/jebox.js?ver=2.2

js foscam.com collected 2026-09-24 19:47:22 UTC 39,049 bytes, 831 lines download raw bytes

1/**
2 @Name : jeBox v1.0 弹层组件
3 @Author: chen guojun
4 @Date: 2016-4-2
5 @QQ群:516754269
6 @官网:http://www.jayui.com/jebox/ 或 https://github.com/singod/jeBox
7 */
8(function(window, undefined) {
9    var document = window.document, toString = {}.toString;
10    //基础库
11    function selFind(selector, node) {
12        var fors = function(arr, fun){
13			for (var i = 0;i < arr.length; i++) {
14				if (fun(i, arr[i]) === false) break;
15			}	
16		},
17		getId = function(id) {
18            return document.getElementById(id);
19        }, //获取CLASS节点数组
20        getClass = function(cls, isNode) {
21            var node = isNode != undefined ? isNode :document, temps = [];
22            var clsall = node.getElementsByTagName("*");
23			fors(clsall,function(i,cell){
24                //遍历所有节点,判断是否有包含className
25                if (new RegExp("(\\s|^)" + cls + "(\\s|$)").test(cell.className)) temps.push(cell);
26            })
27            return temps;
28        }, //获取TAG节点数组
29        getTagName = function(tag, isNode) {
30            var node = isNode != undefined ? isNode :document, temps = [], regCls = /\./.test(tag), regTag = /\=/.test(tag),  
31			tagCls = regTag ? tag.match(/\w+\[([\w\-_][^=]+)=([\'\[\]\w\-_]+)\]/) :tag.split(".");
32            var tags = node.getElementsByTagName(regCls ? tagCls[0] : tagCls[0].split("[")[0]);
33            if ((regCls && tagCls[1] != undefined) || regTag) {
34                var clsn = regCls ? tagCls[1] : tagCls, 
35				clas = /MSIE (6|7)/i.test(navigator.userAgent) ? "className" :"class", 
36				atts = regCls ? clas :clsn[1], clsof = regCls ? clsn :clsn[2];   
37				fors(tags,function(i,cell){
38                    if (new RegExp(clsof).test(cell.getAttribute(atts))) temps.push(cell);
39                })
40            } else {
41				fors(tags,function(i,cell){ temps.push(cell); })
42            }
43            return temps;
44        };
45        //创建一个数组,用来保存获取的节点或节点数组
46        var thatElem = this.elements = [];
47        //当参数是一个字符串,说明是常规css选择器,不是this,或者function
48        if (typeof selector == "string") {
49            selector = selector.replace(/(^\s*)|(\s*$)/g, "");
50            //css模拟,就是跟CSS后代选择器一样
51            var sj = /\s+/g, args = /\>/.test(selector) ? selector.replace(/([ \t\r\n\v\f])*>([ \t\r\n\v\f])*/g, ">").replace(/\>/g, " ").replace(sj, " ") :selector.replace(sj, " "),
52			    expId = /^\#/, expCls = /^\./;
53            if (/\,/.test(args)) {
54                var argspl = args.split(/,/g), len = argspl.length;
55                for (var idx = 0; idx < len; ++idx) thatElem = thatElem.concat(selFind(argspl[idx]));
56            }else if (/\s*/.test(args)) {
57                //把节点拆分开并保存在数组里
58                var elements = args.split(" ");
59                //存放临时节点对象的数组,解决被覆盖问题
60                var tempNode = [], node = [];
61                //用来存放父节点用的
62				fors(elements,function(i,elems){
63                    //如果默认没有父节点,就指定document
64                    if (node.length == 0) node.push(document);
65					var elmSub = elems.substring(1)
66					tempNode = [];
67					if(expId.test(elems)){  //id
68						tempNode.push(getId(elmSub));
69					}else if(expCls.test(elems)){  //class
70						fors(node,function(j,nd){
71							fors(getClass(elmSub, nd),function(k,tp){ tempNode.push(tp); })
72                        })
73					}else{  //tag
74						fors(node,function(j,nd){
75                            fors(getTagName(elems, nd),function(k,tp){tempNode.push(tp); })
76                        })
77					}
78					node = tempNode;
79                })
80                thatElem = tempNode;
81            } else {
82                //find模拟,就是说只是单一的选择器
83				var argSub = args.substring(1);
84				if(expId.test(args)){  //id
85					thatElem.push(getId(argSub));
86				}else if(expCls.test(args)){  //class
87					thatElem = getClass(argSub);
88				}else{  //tag
89					thatElem = getTagName(args);
90				}
91            }
92        } else if (typeof args == "Object") {
93            if (args != undefined) {
94                thatElem[0] = args;
95            }
96        }
97        return thatElem;
98    }
99    var JED = function(args, node) {
100        var newJED = new JED.fn.init(args, node);
101        return newJED;
102    };
103    JED.extend = function() {
104        var _extend = function me(dest, source) {
105            for (var name in dest) {
106                if (dest.hasOwnProperty(name)) {
107                    //当前属性是否为对象,如果为对象,则进行递归
108                    if (dest[name] instanceof Object && source[name] instanceof Object) {
109                        me(dest[name], source[name]);
110                    }
111                    //检测该属性是否存在
112                    if (source.hasOwnProperty(name)) {
113                        continue;
114                    } else {
115                        source[name] = dest[name];
116                    }
117                }
118            }
119        };
120        var _result = {}, arr = arguments;
121        //遍历属性,至后向前
122        if (!arr.length) return {};
123        for (var i = arr.length - 1; i >= 0; i--) {
124            _extend(arr[i], _result);
125        }
126        arr[0] = _result;
127        return _result;
128    };
129    JED.each = function(arr, fun) {
130        var i = 0, len = arr.length;
131        for (;i < len; i++) {
132            if (fun(i, arr[i]) === false) break;
133        }
134    };
135    JED.isType = function(obj, type) {
136        var types = type.replace(/\b(\w)|\s(\w)/g, function(m) {
137            return m.toUpperCase();
138        });
139        return Object.prototype.toString.call(obj) === "[object " + types + "]";
140    };
141    JED.inArray = function(elem, arr, i) {
142        var core_indexOf = Array.prototype.indexOf;
143        if (arr) {
144            if (core_indexOf) return core_indexOf.call(arr, elem, i);
145            var len = arr.length;
146            i = i ? i < 0 ? Math.max(0, len + i) :i :0;
147            for (;i < len; i++) {
148                if (i in arr && arr[i] === elem) return i;
149            }
150        }
151        return -1;
152    };
153    // 清除数组中重复的数据
154    JED.unique = function(arr) {
155        var rets = [], i = 0, len = arr.length;
156        if (JED.isType(arr, "array")) {
157            for (;i < len; i++) {
158                if (JED.inArray(arr[i], rets) === -1) rets.push(arr[i]);
159            }
160        }
161        return rets;
162    };
163    JED.merge = function(first, second) {
164        var sl = second.length, i = first.length, j = 0;
165        if (JED.isType(sl, "number")) {
166            for (;j < sl; j++) {
167                first[i++] = second[j];
168            }
169        } else {
170            while (second[j] !== undefined) {
171                first[i++] = second[j++];
172            }
173        }
174        first.length = i;
175        return first;
176    };
177    JED.trim = function(str) {
178        return str.replace(/(^\s*)|(\s*$)/g, "");
179    };
180    JED.fn = JED.prototype = {
181        init:function(selector, node) {
182            if (!selector) return this;
183            if (selector.nodeType) {
184                this.node = this[0] = selector;
185				this.length=1;
186                return this;
187            }
188			if(selector != null && selector == selector.window){
189				this.context = this[0] = window;
190				this.length=1;
191				return this;
192			}
193            if (selector === "body" && document.body) {
194                this.node = document;
195                this[0] = document.body;
196                this.selector = selector;
197				this.length=1;
198                return this;
199            }
200            if (typeof selector === "string") {
201                node = node || document;
202                var selSize = selFind(selector, node), rets = [];
203                for (var i = 0; i < selSize.length; i++) {
204                    rets.push(selSize[i]);
205                }
206                return JED(this).pushStack(rets);
207            }
208            return this;
209        },
210        find:function(selector) {
211            return JED(selector, this);
212        },
213        size:function() {
214            return this.length;
215        },
216        each:function(callback) {
217            JED.each(this, callback);
218            return this;
219        },
220        pushStack:function(elems) {
221            var obj = JED(), i = 0, len = elems.length;
222            for (;i < len; i++) {
223                obj[i] = elems[i];
224            }
225            obj.length = len;
226            return obj;
227        },
228        css:function(name, value) {
229            var that = this, obj = arguments[0];
230            if (typeof name == "string" && typeof value == "string") {
231                return that.each(function(i, elem) {  elem.style[name] = value; });
232            } else if (typeof name == "string" && typeof value === "undefined") {
233                if (that.size() == 0) return null;
234                var ele = this[0], JeS = function() {
235                    var def = document.defaultView;
236                    return new Function("el", "style", [ "style.indexOf('-')>-1 && (style=style.replace(/-(\\w)/g,function(m,a){return a.toUpperCase()}));", "style=='float' && (style='", def ? "cssFloat" :"styleFloat", "');return el.style[style] || ", def ? "window.getComputedStyle(el, null)[style]" :"el.currentStyle[style]", " || null;" ].join(""));
237                }();
238                return JeS(ele, name);
239            } else {
240                return that.each(function(i, elem) {
241                    for (var k in obj) elem.style[k] = obj[k];
242                });
243            }
244        },
245        hasClass:function(selector) {
246			var className = " " + selector + " ", i = 0, len = this.length;
247			for ( ; i < len; i++ ) {
248				if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(/[\n\t\r]/g, " ").indexOf( className ) > -1 ) return true;
249			}
250		    return false;
251        },
252        // 添加样式类
253        addClass:function(name) {
254            if (!this.hasClass(name)) this[0].className = JED.trim(this[0].className + " " + name + " ");
255            return this;
256        },
257        // 移除样式类
258        removeClass:function(name) {
259            var elem = this[0];
260            if (!name) {
261                elem.className = "";
262            } else if (this.hasClass(name)) {
263                elem.className = JED.trim((" " + elem.className + " ").replace(" " + name + " ", " "));
264            }
265            return this;
266        },
267        // 获取所有子节点
268        contents:function() {
269            var elems, i = 0, len = this.length, rets = [];
270            for (;i < len; i++) {
271                rets = JED.merge(rets, this[i].childNodes);
272            }
273            // 排重
274            rets = JED.unique(rets);
275            return this.pushStack(rets);
276        },
277        //获取当前元素的坐标
278        position:function() {
279            if (this.size() == 0) return null;
280            var elem = this[0];
281            return { left:elem.offsetLeft,  top:elem.offsetTop };
282        },
283        // 元素取宽度
284        width:function(value) {
285            if (value == undefined) {
286                return getWidthOrHeight(this, "width");
287            } else {
288                this.css("width", typeof value === "number" ? value + "px" :value);
289            }
290            return this;
291        },
292        // 元素取高度
293        height:function(value) {
294            if (value == undefined) {
295                return getWidthOrHeight(this, "height");
296            } else {
297                this.css("height", typeof value === "number" ? value + "px" :value);
298            }
299            return this;
300        },
301        //获取与设置,自定义属性
302        attr:function(name, value) {
303            var that = this[0], ret;
304            if (typeof value === "undefined") {
305                if (that && that.nodeType === 1) {
306                    ret = that.getAttribute(name);
307                }
308                // 属性不存在,返回undefined
309                return ret == null ? undefined :ret;
310            }
311            return this.each(function(i, elem) {
312                if (elem.nodeType === 1) elem.setAttribute(name, value);
313            });
314        },
315        // 读取设置节点内容
316        html:function(value) {
317            var that = this[0];
318            return typeof value === "undefined" ? that && that.nodeType === 1 ? that.innerHTML :undefined :typeof value !== "undefined" && value == true ? that && that.nodeType === 1 ? that.outerHTML :undefined :this.each(function(i, elem) {
319                elem.innerHTML = value;
320            });
321        },
322        // 读取设置节点文本内容
323        text:function(value) {
324            var that = this[0];
325            var innText = document.all ? "innerText" :"textContent";
326            return typeof value === "undefined" ? that && that.nodeType === 1 ? that[innText] :undefined :this.each(function(i, elem) {
327                elem[innText] = value;
328            });
329        },
330        // 读取设置表单元素的值
331        val:function(value) {
332            var that = this[0];
333            if (typeof value === "undefined") {
334                return that && that.nodeType === 1 && typeof that.value !== "undefined" ? that.value :undefined;
335            }
336            // 将value转化为string
337            value = value == null ? "" :value + "";
338            return this.each(function(i, elem) {
339                if (typeof elem.value !== "undefined") {
340                    elem.value = value;
341                }
342            });
343        },
344        bind:function(type, fn) {
345            return this.each(function(i, elem) {
346                elem.attachEvent ? elem.attachEvent("on" + type, function() {
347                    fn.call(elem, window.type);
348                }) :elem.addEventListener(type, fn, false);
349            });
350        }
351    };
352    // 宽高属性单位auto转化
353    function getWidthOrHeight(elem, name) {
354        // 将样式属性转为驼峰式
355        function camelCase(name) {
356            return name.replace(/\-(\w)/g, function(all, letter) {
357                return letter.toUpperCase();
358            });
359        }
360        var padding = name === "width" ? [ "left", "right" ] :[ "top", "bottom" ], ret = elem[0][camelCase("offset-" + name)];
361        if (ret <= 0 || ret == null) {
362            ret = parseFloat(elem[0][camelCase("client-" + name)]) - parseFloat(elem.css("padding-" + padding[0]) || 0) - parseFloat(elem.css("padding-" + padding[1]) || 0);
363        }
364        return ret;
365    }
366    JED.fn.init.prototype = JED.fn;
367    window.JED = $D = JED;
368})(window);
369
370//核心弹层代码
371(function($D, win, undefined) {
372    var doc = document, docBody = document.body, docEle = document.documentElement, jeBox = {}, jeyer = {}, 
373	regPxe = /\px|em/g, isIE = !-[ 1 ], isIE6 = /msie 6/.test(navigator.userAgent.toLowerCase());
374    jeBox.index = Math.floor(Math.random() * 9e3);
375	//缓存常用字符
376    var doms = ["jeBox",".jeBox-wrap",".jeBox-header",".jeBox-content",".jeBox-footer",".jeBox-close",".jeBox-maxbtn"];
377    jeyer.endfun = {};
378    var config = {
379        cell:"",   // 独立ID,用于控制弹层唯一标识
380        title:"提示信息",  // 标题,参数一:提示文字,参数二:提示条样式  ["提示信息",{color:"#ff0000"}]
381        content:"暂无内容!",  // 内容
382        boxStyle:{},  //设置弹层的样式
383        closeBtn:true,   // 标题上的关闭按钮 
384        maxBtn:false,  //是否开启最大化按钮
385        area:"auto",  // 参数一:弹层宽度,参数二: 弹层高度
386        padding:"5px",  // 自定义边距
387        offset:[ "auto", "auto" ],  //坐标轴
388        type:1,  // 显示基本层类型
389        icon:0,  // 图标,信息框和加载层的私有参数
390        button:[],  // 各按钮
391        yesfun:null,  // 确定按钮回调方法
392        nofun:null,  // 取消和关闭按钮触发的回调
393        time:0,   // 自动关闭时间(秒),0表示不自动关闭
394        masklock:true,  // 是否开启遮罩层
395        maskClose:false,   // 点击遮罩层是否可以关闭
396        maskColor:[ "#000", .5 ],  // 参数一:遮罩层颜色,参数二:遮罩层透明度
397        isDrag:true,   // 是否可以拖拽	
398        fixed:true,  // 是否静止定位
399        zIndex:9999,  // 弹层层级关系	
400        scrollbar:true,  // 是否允许浏览器出现滚动条
401        shadow:true,  //拖拽风格
402        success:null,  // 层弹出后的成功回调方法
403        endfun:null
404    };
405    //核心方法
406    var jeConCell, Dialog = function(options) {
407        var that = this;
408        that.config = $D.extend(config, options || {});
409        that.index = that.config.cell != "" ? that.config.cell :++jeBox.index;
410        jeConCell = that.config.content;
411        that.initView();
412    };
413    Dialog.prototype = {
414        //初始化弹层
415        initView:function() {
416            var that = this, opts = that.config;  jeyer.scrollbar = opts.scrollbar;
417            //判断ID是否已经存在
418            if (opts.cell != "" && $D("#"+ doms[0] + that.index)[0]) return;
419            //创建按钮模板
420            var btnHtml = function() {
421                var btnStrA = opts.button ? function() {
422                    var butArr = [];
423                    typeof opts.button === "array" && (opts.button = [ opts.button ]);
424                    for (var i = 0; i < opts.button.length; i++) {
425                        var isDisabled = opts.button[i].hasOwnProperty("disabled") && opts.button[i].disabled == true ? "disabled" :"";
426                        butArr.push('<button type="button" class="jeBox-btn' + i + '" jebtn="' + i + '" ' + isDisabled + ">" + opts.button[i].name + "</button>");
427                    }
428                    return butArr.reverse().join("");
429                }() :"";
430                return '<div class="jeBox-footer">' + btnStrA + "</div>";
431            }();
432            //创建默认的弹出层内容模板
433            var templates = '<span class="jeBox-headbtn"><a href="javascript:;" class="jeBox-maxbtn"></a><a href="javascript:;" class="jeBox-close" title="&#20851;&#38381;">&times;</a></span>' + '<div class="jeBox-header"></div>' + '<div class="jeBox-content" style="padding:' + (opts.padding != "" ? opts.padding :0) + ';"></div>' + btnHtml;
434            //创建弹窗外部DIV	
435            var getZindex = function(elem) {
436                var maxZindex = 0;
437                for (z = 0; z < elem.length; z++) {
438                    maxZindex = Math.max(maxZindex, elem[z].style.zIndex);
439                }
440                return maxZindex;
441            }, WarpCls = $D(doms[1]);
442            //计算层级并置顶
443            var Zwarp = WarpCls[0] ? getZindex(WarpCls) + 5 :opts.zIndex + 5, Zmask = WarpCls[0] ? getZindex(WarpCls) + 2 :opts.zIndex,
444                divBox = document.createElement("div"), maskBox = document.createElement("div");
445            that.id = divBox.id = doms[0] + that.index;
446            divBox.className = doms[1].replace(/\./g,"");
447            divBox.style.position = opts.fixed ? "fixed" :"absolute";
448            divBox.style.zIndex = Zwarp;
449            divBox.innerHTML = templates;
450            divBox.setAttribute("jeb", that.index);
451            $D("body")[0].appendChild(divBox);
452            //是否开启遮罩层
453            if (opts.masklock) {
454                that.mask = maskBox.id = "jemask" + that.index;
455                maskBox.className = "jeBox-mask";
456                maskBox.style.cssText = "left:0;top:0;background-color:" + opts.maskColor[0] + ";z-index:" + Zmask + ";opacity:" + opts.maskColor[1] + ";filter:alpha(opacity=" + opts.maskColor[1] * 100 + ");";
457                $D("body")[0].appendChild(maskBox);
458            }
459            var thatID = "#" + that.id, isTitle = opts.title == false || opts.title == "false", 
460			    titType = typeof opts.title === "object", msgTitle = titType ? opts.title :[ opts.title, {} ], 
461				isBtn = opts.btn == "" && opts.btn == null;
462            $D(thatID + " "+ doms[2]).html(isTitle ? "" :msgTitle[0]).css({ display:isTitle ? "none" :"",  height:isTitle ? "0px" :"" }).css(msgTitle[1]);
463            $D(thatID + " "+ doms[4]).css({ display:isBtn ? "none" :"", height:isBtn ? "0px" :"" });
464            $D(thatID + " "+ doms[5]).css("display", opts.closeBtn ? "" :"none");
465			$D(thatID + " "+ doms[6]).css("display", opts.maxBtn ? "" :"none");  			
466            !opts.scrollbar && $D("body").css("overflow", "hidden");  
467            that.content(opts).layerSize(opts).position(opts).btnCallback(opts);
468            if (opts.isDrag) {
469                var wrapCell = $D(thatID), titCell = $D(thatID + " "+ doms[2]);
470                that.dragLayer(wrapCell, titCell, .4, opts.shadow);
471            }
472            setTimeout(function() {
473                opts.success && opts.success($D(thatID),that.index);
474            }, 1);
475        },
476        //设置内容
477        content:function(opts) {
478            var that = this, conCell = $D("#" + that.id + " "+ doms[3]), msg = opts.content, conType = typeof msg === "object";
479            iconMsg = '<div class="jeBox-iconbox jeicon' + opts.icon + '">' + msg + "</div>";
480            switch (opts.type) {
481              case 1:
482                if (typeof msg === "string") {
483                    conCell.html(opts.icon !== 0 ? iconMsg :msg);
484                } else if (msg && msg.nodeType === 1) {
485                    //查询传入的位置
486                    jeyer.Dispy = msg.style.display;
487                    jeyer.Prev = msg.previousSibling;
488                    jeyer.Next = msg.nextSibling;
489                    jeyer.Parent = msg.parentNode;
490                    var tempWrap = document.createElement("div");
491                    if (msg.style.display == "none") msg.style.display = "block";
492                    //把已知的html片段包裹并插入到弹层中
493                    conCell[0].appendChild(tempWrap.appendChild(msg));
494                }
495                break;
496
497              case 2:
498                var conMsg = conType ? msg :[ msg || "http://www.jayui.com/", "auto" ];
499                conCell.html('<iframe scrolling="' + (conMsg[1] || "auto") + '" allowtransparency="true" id="jeboxiframe' + that.index + '" name="' + that.index + '" onload="this.className=\'\';" frameborder="0" width="100%" height="100%" src="' + conMsg[0] + '"></iframe>');
500                break;
501
502              case 3:
503                conCell.html('<div class="jeBox-loadbox jeload' + opts.icon + '">' + msg + "</div>");
504                break;
505            }
506            return that;
507        },
508        //设置弹层尺寸
509        layerSize:function(opts) {
510            var that = this, fixW = "", fixH = "", WarpID = "#" + that.id, wrapWidth, wrapHeight, conWidth, conHeight, conCell = $D(WarpID + " "+ doms[3]), 
511			    docW = docEle.clientWidth, docH = docEle.clientHeight, conhead = jeyer.conhead = $D(WarpID + " "+ doms[2]).height(), confoot = jeyer.confoot = $D(WarpID + " "+ doms[4]).height(), 
512			    Padtb = jeyer.getPads(conCell, "padding-top") + jeyer.getPads(conCell, "padding-bottom"), Padlr = jeyer.getPads(conCell, "padding-left") + jeyer.getPads(conCell, "padding-right");
513			opts.area.length == 1 ? (fixW = opts.area, fixH = opts.area) : (fixW = opts.area[0], fixH = opts.area[1]);
514            //设置层的宽度
515            if ($D.isType(opts.area, "array")) {
516                if ($D.isType(fixW, "number")) {
517                    wrapWidth = fixW;
518                } else if (fixW == "auto") {
519                    wrapWidth = conWidth = "auto";
520                } else {
521                    var bfW = /^\d+%$/.test(fixW.toString()) ? parseInt(docW * (fixW.replace("%", "") / 100)) :parseInt(fixW.replace(regPxe, "")), nPerW = bfW >= docW ? docW :bfW;
522                    wrapWidth = nPerW + "px";
523                    conWidth = nPerW - Padlr + "px";
524                }
525            }
526            //设置层的高度
527            if ($D.isType(opts.area, "array")) {
528                if ($D.isType(fixH, "number")) {
529                    wrapHeight = fixH;
530                } else if (fixH == "auto") {
531                    wrapHeight = conHeight = "auto";
532                } else {
533                    var bfH = /^\d+%$/.test(fixH.toString()) ? parseInt(docH * (fixH.replace("%", "") / 100)) :parseInt(fixH.replace(regPxe, "")), nPerH = bfH >= docH ? docH :bfH;
534                    wrapHeight = nPerH + "px";
535                    conHeight = nPerH - Padtb - conhead - confoot + "px";
536                }
537            }
538            opts.maxBtn && $D(WarpID).attr("area", [ wrapWidth, wrapHeight, conWidth, conHeight ].toString().replace(regPxe, ""));
539            $D(WarpID).css({ width:wrapWidth, height:wrapHeight }).css(opts.boxStyle);
540            $D(WarpID + " "+ doms[3]).css({ width:conWidth, height:conHeight });
541            return that;
542        },
543        //定位层显示的位置
544        position:function(opts) {
545            var that = this, PosID = $D("#" + that.id), elemtr, elembl, isOffsetArr = $D.isType(opts.offset, "array"),
546			    Postr = opts.offset[0], Posbl = opts.offset[1], dcWidth = docEle.clientWidth, dcHeight = docEle.clientHeight, 
547				eleW = PosID.width(), eleH = PosID.height();    
548            elemtr = (isOffsetArr && /^\@/.test(Postr)) ?
549                Postr.replace(/\@/g, "") : ((Postr == "auto") ? (dcHeight - eleH) / 2  + "px" :  /^\d+%$/.test(Postr) ? Postr :Postr.replace(regPxe, "") + "px");
550            elembl = (isOffsetArr && /^\@/.test(Posbl)) ?
551                Posbl.replace(/\@/g, "") : ((Posbl == "auto") ? (dcWidth - eleW) / 2  + "px" : /^\d+%$/.test(Posbl) ? Posbl :Posbl.replace(regPxe, "") + "px");
552				
553            isOffsetArr && (/^\@/.test(Postr) || /^\@/.test(Posbl)) ? PosID.css({ right:elemtr, bottom:elembl }) : PosID.css({ top:elemtr, left:elembl });
554            opts.maxBtn && PosID.attr("offset", [ PosID.position().top, PosID.position().left ]);
555            return that;
556        },
557        //各关闭按钮的事件
558        btnCallback:function(opts) {
559            var that = this, CallID = "#" + that.id, maxBtn = $D(CallID + " "+ doms[6]);
560            //自动关闭
561            opts.time <= 0 || setTimeout(function() {
562                jeBox.close(that.index);
563            }, opts.time * 1e3);
564            function cancel() {
565                var close = opts.nofun && opts.nofun(that.index);
566                close === false || jeBox.close(that.index);
567            }
568            //关闭按钮事件
569            opts.closeBtn && $D(CallID + " "+ doms[5]).bind("click", cancel);
570            //最大化按钮
571            opts.maxBtn && maxBtn.bind("click", function() {
572                if (maxBtn.hasClass("revert")) {
573                    maxBtn.removeClass("revert");
574                    jeBox.restore(that.index);
575                } else {
576                    maxBtn.addClass("revert");
577                    jeBox.full(that.index);
578                }
579            });
580            //更多按钮
581            opts.button && $D(CallID + " "+ doms[4]).find("button").bind("click", function() {
582                var index = parseInt($D(this).attr("jebtn"));
583                if (index === 0) {
584                    opts.yesfun ? opts.yesfun(that.index, $D(CallID)) :jeBox.close(that.index);
585                }
586                if (opts.button.length > 1) {
587                    if (index === 1) {
588                        cancel();
589                    } else {
590                        opts.button[index]["callback"] && opts.button[index]["callback"](that.index, $D(CallID));
591                        opts.button[index]["callback"] || jeBox.close(that.index);
592                    }
593                }
594            });
595            //点遮罩关闭
596            opts.maskClose && $D("#jemask" + that.index).bind("click", function() {
597                jeBox.close(that.index);
598            });
599            //自适应
600			$D(window).bind("resize",function() {
601                if ($D.isType(opts.offset, "array") && (/^\@/.test(opts.offset[0]) || /^\@/.test(opts.offset[1]))) {
602                    $D(CallID).css({ top:"", left:"" });
603                }
604                that.layerSize(opts).position(opts);
605            });
606            opts.endfun && (jeyer.endfun[that.index] = opts.endfun);
607            return that;
608        },
609        //拖拽事件
610        dragLayer:function(warpCell, titCell, opacityVal, isShadow) {
611            var that = this, isIES = !-[ 1 ];
612            titCell = titCell || warpCell;
613            that.tmpX = that.tmpY = 0;
614            that.isMoveable = false;
615            titCell[0].style.cursor = "move";
616            if (isShadow) {
617                that.isShadow = isShadow ? isShadow == true || isShadow == false ? isShadow :false :false;
618                if (that.isShadow) that.opacity = opacityVal;
619            } else {
620                that.opacity = 100, that.isShadow = false;
621            }
622            that.tempLayer = document.createElement("div");
623            titCell[0].onmousedown = function(event) {
624                var event = event || window.event;
625                //只允许通过鼠标左键进行拖拽,IE鼠标左键为1 FireFox为0
626                if (isIES && event.button != 1 || isIES && event.button == 0) return false;
627				//创建临时拖动层
628                if (that.isShadow) {
629                    that.tempLayer.style.cssText = "width : " + (warpCell[0].offsetWidth - 4) + "px;height : " + (warpCell[0].offsetHeight - 4) + "px;left : " + warpCell[0].offsetLeft + "px;top : " + warpCell[0].offsetTop + "px;opacity:" + that.opacity + ";filter:alpha(opacity=" + that.opacity * 100 + ");z-Index : 29860813;";
630                    that.tempLayer.className = "jeBox-moves";
631                    warpCell[0].parentNode.appendChild(that.tempLayer);
632                }
633                that.isMoveable = true;
634                that.tmpX = event.clientX - warpCell[0].offsetLeft;
635                that.tmpY = event.clientY - warpCell[0].offsetTop;
636                //FireFox 去除容器内拖拽图片问题
637                if (event.preventDefault) {
638                    event.preventDefault();
639                    event.stopPropagation();
640                }
641                document.onmousemove = function(event) {
642                    if (!that.isMoveable) return;
643                    window.getSelection ? window.getSelection().removeAllRanges() :document.selection.empty();
644                    //控制元素不被拖出窗口外
645                    var event = event || window.event, elemCopy = that.isShadow ? that.tempLayer :warpCell, 
646					DmpX = event.clientX - that.tmpX, DmpY = event.clientY - that.tmpY, 
647					maxW = docEle.clientWidth - warpCell[0].offsetWidth, maxH = docEle.clientHeight - warpCell[0].offsetHeight;
648                    DmpX <= 0 && (DmpX = 0);
649                    DmpY <= 0 && (DmpY = 0);
650                    DmpX >= maxW && (DmpX = maxW);
651                    DmpY >= maxH && (DmpY = maxH);
652                    elemCopy.style.top = DmpY + "px";
653                    elemCopy.style.left = DmpX + "px";
654                };
655                document.onmouseup = function() {
656                    if (that.isMoveable) {
657                        that.isMoveable = false;
658                        that.tmpX = that.tmpY = 0;
659                        warpCell.css({ right:"", bottom:"" });
660                        if (that.isShadow) {
661                            //判断并把虚框的位置信息传给弹层
662                            warpCell.css({
663                                top:that.tempLayer.offsetTop + "px",
664                                left:that.tempLayer.offsetLeft + "px"
665                            });
666                            //判断并删除新创建的虚框
667                            docBody.removeChild(that.tempLayer);
668                        }
669                        if (docEle.clientWidth != warpCell[0].offsetWidth) {
670                            warpCell.attr("offset", [ warpCell[0].offsetTop, warpCell[0].offsetLeft ]);
671                        }
672                    }
673                };
674            };
675            return that;
676        }
677    };
678	//获取内边距
679	jeyer.getPads = function(cell, name) {
680		return parseInt(cell.css(name).replace(regPxe, ""));
681	}
682	//获取窗口大小
683	jeyer.docSize = function(name) {
684		var dowSize, inner = [ "inner" + name ], client = [ "client" + name ];
685		if (window[inner]) {
686			dowSize = window[inner];
687		} else if (docBody && docBody[client]) {
688			dowSize = docBody[client];
689		}
690		// 通过深入 Document 内部对 body 进行检测,获取窗口大小
691		if (docEle && docEle[client]) {
692			dowSize = docEle[client];
693		}
694		return dowSize;
695	}
696    //弹层核心
697    jeBox.open = function(opts) {
698		var jedia = new Dialog(opts || {})
699        return jedia.index;
700    };
701    //关闭指定层
702    jeBox.close = function(idx) {
703        var boxCell = $D("#"+ doms[0] + idx)[0], maskCell = $D("#jemask" + idx)[0];
704        if (!boxCell) return;
705        if (jeConCell && jeConCell.nodeType === 1) backSitu(jeConCell, jeyer.Prev, jeyer.Next, jeyer.Parent, jeyer.Dispy);
706        docBody.removeChild(boxCell);
707        maskCell && docBody.removeChild(maskCell);
708        $D("body").css("overflow") == "hidden" && $D("body").css("overflow", "");
709		typeof jeyer.endfun[idx] === 'function' && jeyer.endfun[idx]();
710        delete jeyer.endfun[idx]; 
711    };
712    //关闭所有层
713    jeBox.closeAll = function() {
714        $D(doms[1]).each(function(i, elem) {
715            jeBox.close(elem.getAttribute("jeb"));
716        });
717    };
718	//版本
719	jeBox.version = "1.0";
720    //改变当前弹层title
721    jeBox.title = function(name, idx) {
722        $D("#"+ doms[0] + idx + " "+ doms[2]).html(name);
723    };
724	//改变当前弹层内容
725    jeBox.content = function(content, idx) {
726        $D("#"+ doms[0] + idx + " "+ doms[3]).html(content);
727    };
728    //最常用提示层
729    jeBox.msg = function(content, options, end) {
730        var type = typeof options === "function";
731        if (type) end = options;
732        return jeBox.open($D.extend({
733            title:false,
734            content:content,
735            padding:"10px",
736            boxStyle:{  background:"#fff",  border:"1px solid #e3e3e3", "border-radius":"4px", color:"#333", opacity:"0.93", filter:"alpha(opacity=90)" },
737            time:3,
738            masklock:false,
739            closeBtn:false,
740            end:end
741        }, !type && function() {
742            options = options || {};
743            return options;
744        }()));
745    };
746    jeBox.alert = function(content, options, yes) {
747        var type = typeof options === "function";
748        if (type) yes = options;
749        return jeBox.open($D.extend({
750            content:content,
751            yesfun:yes,
752            button:[ { name:"确定"  } ]
753        }, type ? {} :options));
754    };
755    jeBox.loading = function(icon, content, options) {
756        return jeBox.open($D.extend({
757            title:false,
758            closeBtn:false,
759            type:3,
760            masklock:false,
761            content:content == undefined ? "" : content,
762            icon:icon || 1,
763            boxStyle:{ background:"#fff",  border:"1px solid #fff", "border-radius":"4px", color:"#111",  opacity:"0.93", filter:"alpha(opacity=90)" }
764        }, options));
765    };
766	//还原
767	jeBox.restore = function(index){
768		var CallID = $D("#"+ doms[0] + index), callCon = $D("#"+ doms[0] + index + " "+ doms[3]), 
769		    revArea = CallID.attr("area").split(/,/g), revOffset = CallID.attr("offset").split(/,/g);
770		$D("body").css('overflow',jeyer.scrollbar == false ? 'hidden' : '');
771		CallID.css({
772			width:revArea[0] + "px", height:revArea[1] + "px",
773			top:revOffset[0] + "px", left:revOffset[1] + "px",
774			right:"", bottom:""
775		});
776		callCon.css({  width:revArea[2] + "px", height:revArea[3] + "px" });
777	}
778	//全屏
779    jeBox.full = function(index){
780		var timer, CallID = $D("#"+ doms[0] + index), callCon = $D("#"+ doms[0] + index + " "+ doms[3]),
781		    warpMagtb = jeyer.getPads(CallID, "borderTopWidth") + jeyer.getPads(CallID, "borderBottomWidth"), 
782			warpMaglr = jeyer.getPads(CallID, "borderLeftWidth") + jeyer.getPads(CallID, "borderRightWidth"), 
783			conPadtb = jeyer.getPads(callCon, "padding-top") + jeyer.getPads(callCon, "padding-bottom"), 
784			conPadlr = jeyer.getPads(callCon, "padding-left") + jeyer.getPads(callCon, "padding-right");
785		$D("body").css('overflow','hidden');
786		clearTimeout(timer);
787		timer = setTimeout(function(){
788			$D(CallID + " "+ doms[6]).addClass("revert");
789			var isfix = CallID.css('position') === 'fixed', offset = CallID.attr("offset").split(/,/g),
790			    docWidth = jeyer.docSize("Width"), docHeight = jeyer.docSize("Height");
791			CallID.css({
792				width:docWidth - warpMagtb + "px",
793				height:docHeight - warpMaglr + "px",
794				top:isfix ? 0 : offset[0] + "px", left:isfix ? 0 : offset[1] + "px", right:"", bottom:""
795			});
796			callCon.css({
797				width:docWidth - (conPadlr + warpMagtb) + "px",
798				height:docHeight - (conPadtb + jeyer.conhead + jeyer.confoot + warpMaglr) + "px"
799			});
800		}, 1);
801	}
802    //获取子iframe的DOM
803    jeBox.getChildFrame = function(selector, index) {
804        index = index || $(".jeboxiframe").attr("jeb");
805        return $D("#"+ doms[0] + index).find("iframe").contents().find(selector);
806    };
807    //得到当前iframe层的索引,子iframe时使用
808    jeBox.getFrameIndex = function(name) {
809        return $D("#"+ doms[0] + name).attr("jeb");
810    };
811    //重置iframe url
812    jeBox.iframeUrl = function(idx, url) {
813        $D("#"+ doms[0] + idx).find("iframe").attr("src", url);
814    };
815    // 让传入的元素在对话框关闭后可以返回到原来的地方
816    function backSitu(elem, jePrev, jeNext, jeParent, jeDispy) {
817        if (jePrev && jePrev.parentNode) {
818            jePrev.parentNode.insertBefore(elem, jePrev.nextSibling);
819        } else if (jeNext && jeNext.parentNode) {
820            jeNext.parentNode.insertBefore(elem, jeNext);
821        } else if (jeParent) {
822            jeParent.appendChild(elem);
823        }
824        elem.style.display = jeDispy;
825        this.backSitu = null;
826    }
827    // 多环境支持
828    "function" === typeof define ? define(function() {
829        return jeBox;
830    }) :"object" === typeof module && "object" === typeof module.exports ? module.exports = jeBox :window.jeBox = jeDialog = jeBox;
831})(window.$D, window);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.