123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666 |
- Namespace.register("U.UF.F");
- U.UF.F.isTop = false;
- U.UF.F.hisTory = true;
- U.UF.F.maskFrame = function () {
- return $$("div", { "style": { "cssText": "width:100%;height:100%;position:absolute;top:0;left:0;" } }, document.body);
- }
- U.UF.F.windowZooming = function (el) {
- var _csstext = el.initcsstext,
- _ismax = el.ismaximize;
-
- if (_ismax) {
- el.style.cssText = _csstext;
- el.ismaximize = false;
- }
-
- else {
-
- _ismax = document.body.offsetHeight == el.offsetHeight && document.body.offsetWidth == el.offsetWidth;
- if (_ismax) {
- el.style.cssText += "width:70%;height:90%;";
- U.UF.F.windowTopCenter(el);
- }
- else {
- el.initcsstext = el.style.cssText;
- el.ismaximize = true;
-
- U.selectEl(el).css({
- "width": "100%",
- "height": "100%",
- "top": "0px",
- "left": "0px"
- });
- }
- }
-
- }
- U.UF.F.windowMinimize = function (el) {
-
- el.style.cssText += "display:none";
-
- }
- U.UF.F.closeWindow = function (el, str) {
- var _el = U.selectEl(el);
- if (_el[0].style.display != "none" && str == "remove") {
- _el.remove();
- _el = null;
- }
- else {
- _el.css("display", "none");
- }
- }
- U.UF.F.windowTopCenter = function (el) {
-
-
-
- var _scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop,
-
- _iwidth = document.documentElement.clientWidth,
-
- _iheight = document.documentElement.clientHeight;
- el.style.display = "block";
- _zindex = (US || parent.US).ZINDEX++;
- U.selectEl(el).css({
- "zIndex": _zindex,
-
- "left": (_iwidth - el.clientWidth) / 2 + "px",
-
- "top": (_iheight - el.clientHeight) / 2 + "px"
- });
-
- }
- U.UF.F.topWindow = function (el) {
- var _zindex,
- _el1 = U.UF.F.getWindow(el),
- _el3;
- if (_el1 && _el1.length || el && el.length) {
- for (var i = 0; i < _el1.length; i++) {
- _el3 = U.selectEl(_el1[i]).Parent();
-
- if (_el3 && (_el3 == document.body || _el3.id == "usestudio_server") && ($(_el1[i]).attr("__top__") != "false" && _el1[i]["__top__"] != "false")) {
- _zindex = (US || parent.US).ZINDEX++;
-
- U.selectEl(_el1[i]).addAttrArray({ "style": { "cssText": _el1[i].style.cssText + ";z-index:" + _zindex + ";display:block" } });
- }
- else {
- U.selectEl(_el1[i]).addAttrArray({ "style": { "cssText": _el1[i].style.cssText + ";display:block" } });
- }
- }
- }
- }
- U.UF.F.getWindow = function (el) {
- var _arr = [],
- _el2 = el,
- _el3 = document.body,
- _el4 = U.selectEl("#U_MD_Home")[0] || U.selectEl("#usestudio_server")[0] || _el3;
-
- if (_el4) {
-
- while ((_el2 = U.UF.EL.offsetParent(_el2, true)) && (_el2 && (_el2 != _el4 && _el2 != _el3))) {
- if (_el2.style.position != "relative") {
- _arr.push(_el2);
- }
- _el2 = _el2.parentNode;
- }
- return _arr;
- }
- }
- U.UF.F.clickTopWindow = function (cb) {
-
- U.selectEl(document.body).bind({
- mousedown: function () {
-
- if (U.UF.C.isFunction(cb)) {
- cb(event.srcElement, true);
- }
-
- top.U.UF.F.topWindow(event.srcElement, true);
- }
- });
- }
- U.UF.F.stretching = function (obj1, str) {
- var e = window.event;
-
-
-
-
- var _disX, _disY, _dragMinWidth = 70, _dragMinHeight = 70;
-
-
-
- e.preventDefault();
- _disX = e.clientX;
- _disY = e.clientY;
- var _iparenttop = obj1.offsetTop;
- var _iparentleft = obj1.offsetLeft;
- var _iparentwidth = obj1.offsetWidth;
- var _iparentheight = obj1.offsetHeight;
- if (!$("#U_UF_F_drag_flag")[0]) {
- var _div = $$("div", { "style": { "cssText": "width: 100%;height: 100%;z-index: 99999;position: absolute;top:0;left:0;" }, "id": "U_UF_F_drag_flag" }, document.body);
-
-
- }
- var _windowfun = {
- "mousemove": function (e) {
- e = e || event;
- var _iL = e.clientX - _disX - 3;
-
- var _iT = e.clientY - _disY;
-
- var _maxw = document.documentElement.clientWidth - _iparentleft - 2;
- var _maxh = document.documentElement.clientHeight - _iparenttop - 2;
- if (str == "bottom") {
- var _ih = _iT + _iparentheight;
- if (_ih < _dragMinHeight) { _ih = _dragMinHeight } else if (_ih > _maxh) { _ih = _maxh; };
-
-
- obj1.style.height = _ih + 'px';
- }
- if (str == "right") {
- var _iw = _iL + _iparentwidth
- if (_iw < _dragMinWidth) {
- _iw = _dragMinWidth
- } else if (_iw > _maxw) {
- _iw = _maxw;
- };
-
- obj1.style.width = _iw + 'px';
- }
- if (str == "top") {
- var _ih = _iparentheight - _iT
- obj1.style.top = _iparenttop + _iT + 'px';
- if (obj1.style.top < '0') {
- obj1.style.top = '0px';
- document.onmousemove = null;
- }
- if (_ih < _dragMinHeight) {
- var _bh = _ih
- _ih = _dragMinHeight;
- obj1.style.top = (_iparenttop + _iT) - (_dragMinHeight - _bh) + 'px';
- }
- obj1.style.height = _ih - '2' + 'px';
- }
- if (str == "left") {
- var _iw = _iparentwidth - _iL
- obj1.style.left = _iparentleft + _iL + 'px';
- if (_iw < _dragMinWidth) {
- var _bl = _iw
- _iw = _dragMinWidth
- obj1.style.left = (_siparentleft + _iL) - (_dragMinWidth - _bl) + 'px';
- }
- obj1.style.width = _iw - '2' + 'px';
- }
- if (str == "rightBottom") {
- var _iw = _iL + _iparentwidth;
- var _ih = _iT + _iparentheight;
- if (_iw < _dragMinWidth) {
- _iw = _dragMinWidth
- } else if (_iw > _maxw) {
- _iw = _maxw;
- };
- obj1.style.width = _iw - '2' + 'px';
- if (_ih < _dragMinHeight) {
- _ih = _dragMinHeight;
- } else if (_ih > _maxh) {
- _ih = _maxh;
- };
- obj1.style.height = _ih + 'px';
- }
- if (str == "rightTop") {
- var _iw = _iL + _iparentwidth;
- var _ih = _iparentheight - _iT;
- obj1.style.top = _iparenttop + _iT + 'px';
- if (obj1.style.top < '0') { obj1.style.top = '0px'; document.onmousemove = null; }
- if (_iw < _dragMinWidth) {
- _iw = _dragMinWidth
- } else if (_iw > _maxw) { _iw = _maxw; };
- obj1.style.width = _iw + 'px';
- if (_ih < _dragMinHeight) {
- var _bh = _ih
- _ih = _dragMinHeight;
- obj1.style.top = (_iparenttop + _iT) - (_dragMinHeight - _bh) + 'px';
- } else if (_ih > (_iparenttop + _iparentheight)) {
- _ih = (_iparenttop + _iparentheight)
- };
- obj1.style.height = _ih - '2' + 'px';
- }
- if (str == "leftTop") {
- var _iw = _iparentwidth - _iL
- obj1.style.left = _iparentleft + _iL + 'px';
- var _ih = _iparentheight - _iT
- obj1.style.top = _iparenttop + _iT + 'px';
- if (obj1.style.top < '0') { obj1.style.top = '0px'; document.onmousemove = null; }
- if (_iw < _dragMinWidth) {
- var _bl = _iw;
- _iw = _dragMinWidth;
- obj1.style.left = (_iparentleft + _iL) - (_dragMinWidth - _bl) + 'px';
- } else if (_iw > (_iparentleft + _iparentwidth)) {
- _iw = (_iparentleft + _iparentwidth)
- };
- obj1.style.width = _iw - '2' + 'px';
- if (_ih < _dragMinHeight) {
- var _bh = _ih;
- _ih = _dragMinHeight;
- obj1.style.top = (_iparenttop + _iT) - (_dragMinHeight - _bh) + 'px';
- } else if (_ih > (_iparenttop + _iparentheight)) {
- _ih = (_iparenttop + _iparentheight)
- };
- obj1.style.height = _ih - '2' + 'px';
- }
- if (str == "leftBottom") {
- var _iw = _iparentwidth - _iL;
- obj1.style.left = _iparentleft + _iL + 'px';
- var _ih = _iT + _iparentheight;
- if (_iw < _dragMinWidth) {
- var _bl = _iw;
- _iw = _dragMinWidth;
- obj1.style.left = (_iparentleft + _iL) - (_dragMinWidth - _bl) + 'px';
- } else if (_iw > (_iparentleft + _iparentwidth)) {
- _iw = (_iparentleft + _iparentwidth)
- };
- obj1.style.width = _iw - '2' + 'px';
- if (_ih < _dragMinHeight) {
- _ih = _dragMinHeight;
- } else if (_ih > _maxh) {
- _ih = _maxh;
- };
- obj1.style.height = _ih - '2' + 'px';
- }
- if (((str == 'left' || str == 'leftTop' || str == 'leftBottom') && _iw == _dragMinWidth) || ((str == 'top' || str == 'rightTop' || str == 'leftTop') && _ih == _dragMinHeight)) {
- document.onmousemove = null;
- };
- return false;
- },
- "mouseup": function () {
- document.onmousemove = null;
- document.onmouseup = null;
- if ($("#U_UF_F_drag_flag")[0]) {
- U.selectEl("#U_UF_F_drag_flag").remove();
- }
- U.selectEl(document.body).unbind(_windowfun);
- }
- }
- U.selectEl(document.body).bind(_windowfun);
- }
- U.UF.F.drag = function (el, cb1, cb2) {
-
- var _x, _y, _l, _t, _drag;
- var _event = event || window.event;
-
- _drag = el;
- _x = _event.clientX;
- _y = _event.clientY;
- _l = _drag.offsetLeft;
- _t = _drag.offsetTop;
-
- var _windowfun = {
-
- "mousemove": function (event) {
-
- if (_drag) {
-
- var _event = event || window.event,
- _newx = _event.clientX - _x,
- _newy = _event.clientY - _y,
- _left = _newx + _l,
- _top = _newy + _t,
- _body = U.selectEl(document.body)[0];
-
-
-
-
-
- _drag.style.left = _left + 'px';
- _drag.style.top = _top + 'px';
- if (!$("#U_UF_F_drag_flag")[0] && (_newx != 0 || _newy != 0)) {
- var _div = $$("div", { "style": { "cssText": "width: 100%;height: 100%;z-index: 99999;position: absolute;top:0;left:0;" }, "id": "U_UF_F_drag_flag" }, document.body);
- }
- if (cb1 && typeof cb1 == "function" && _newx != 0 && _newy != 0) { cb1(); }
- }
- },
-
- "mouseup": function (event) {
-
- if (_drag && cb2 && typeof cb2 == "function") { cb2(el) };
- if ($("#U_UF_F_drag_flag")[0]) {
- U.selectEl("#U_UF_F_drag_flag").remove();
- }
-
- _drag = null;
- U.selectEl(document.body).unbind(_windowfun);
- }
- }
- U.selectEl(document.body).bind(_windowfun);
- }
- U.UF.F.dragSelect = function (el, fun) {
-
- if (event.button != 2) {
- var _x,
- _y,
- _dragel,
- _mousep = U.UF.EL.getMousePosition(el),
- _record = { x: _mousep.x, y: _mousep.y },
-
- _mousemove = function () {
-
- U.UF.F.dragSelect.drag(el, _mousep, _dragel, fun, _record);
- },
-
- _mouseup = function () {
- U.selectEl(_dragel).remove();
-
- U.selectEl(document).unbind({
- "mousemove": _mousemove,
- "mouseup": _mouseup
- });
- U.selectEl(el).unbind({
- "scroll": _mousemove
- });
- };
-
- _mousep.left = el.scrollLeft;
- _mousep.top = el.scrollTop;
- _x = _mousep.x;
- _y = _mousep.y;
-
- _dragel = $$("div", { "style": { "cssText": "position:absolute;width:0;height:0;font-size:0;margin:0;padding:0;border:1px solid #89b1e6;background-color:#c3d5ed;z-index:1000;filter:alpha(opacity:60);opacity:.6;background-image: url(/img/UXZT.png); display: inline-block; z-index: 1000; zoom: 1;" + "top:" + _y + "px;left:" + _x + "px;zIndex:" + US.ZINDEX + 1 } }, el);
-
- U.selectEl(document).bind({
- "mousemove": _mousemove,
- "mouseup": _mouseup
- });
- U.selectEl(el).bind({
- "scroll": _mousemove
- });
- }
- else {
- if (el.dragel) {
- el.dragel = null;
- }
- }
- }
- U.UF.F.dragSelect.drag = function (el, mouseup, dragel, fun, record) {
- var _m = event.type == "scroll" ? record : U.UF.EL.getMousePosition(el),
- _left = mouseup.x + mouseup.left,
- _top = mouseup.y + mouseup.top,
- _ctop = _m.y + el.scrollTop,
- _cleft = _m.x + el.scrollLeft,
- _w = Math.abs(_cleft - _left),
- _h = Math.abs(_ctop - _top),
- _l = Math.min(_cleft, _left),
- _t = Math.min(_ctop, _top)
- ;
-
- record.x = _m.x;
- record.y = _m.y;
-
- U.selectEl(dragel).addAttrArray({ "style": { "cssText": "width:" + _w + "px;height:" + _h + "px;top:" + _t + "px;left:" + _l + "px;" } });
-
- U.UF.F.dragSelect.isLocation(dragel, el, { "width": _w, "height": _h, "left": _l, "top": _t }, fun);
- }
- U.UF.F.dragSelect.isLocation = function (dragel, el, obj, fun) {
- var i,
- _left,
- _top,
- _width,
- _height,
- _arr = [],
- _child = U.selectEl(el).Child()
- ;
-
- for (i = 0; i < _child.length; i++) {
-
- if (_child[i] != dragel) {
- _left = _child[i].offsetLeft;
- _top = _child[i].offsetTop;
- _width = _child[i].offsetWidth;
- _height = _child[i].offsetHeight;
-
- if ((obj.left < _left + _width && obj.left + obj.width > _left) && (obj.top < _top + _height && obj.top + obj.height > _top)) {
- _arr.push(_child[i]);
- }
- }
- }
-
- if (fun) {
- fun(_arr);
- }
- }
|