123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589 |
-
- Namespace.register("U.D");
- U.D.DragMouseDown = function (UDOD, UCB, UDE) {
- if (event.button < 2) {
- var _UTE = new U.D.DragMouseDown.init(UDOD, UCB, UDE),
- _UKE = {
- "mousemove": U.M.apply(_UTE, _UTE.Drag),
- "mouseup": U.M.apply(_UTE, _UTE.DragUp)
- };
-
- U.Ut.AddObj(_UTE, _UKE);
- _UTE.create();
- $(document).bind(_UKE);
-
- return (U.D.DragMouseDown.ST = _UTE);
- }
- }
- U.D.DragMouseDown.init = function (UDOD, UCB, UDE, UCE) {
- (UCE && UCE.start) && (UCE.start());
- this.set(UCE);
-
- this.set({
- max: (UDE && UDE.MaxLeft) ? UDE : null,
- SO: UDOD,
- AF: UCB,
- ESO: event.srcElement
- });
- return this;
- }
- U.D.DragMouseDown.init.prototype = {
-
- set: function (UDE) {
- (UDE) && (U.Ut.AddObj(this, UDE));
- },
-
- create: function () {
- var _UDOD = this.SO,
- _UHE = U.M.GetElementAllInfo(_UDOD);
-
- U.Ut.AddObj(this, {
- IsD: false,
- XY: U.M.GetMousep(),
- E: _UHE,
- MaxTop: _UHE["PXT"] + US.Height - 10,
- MaxLeft: _UHE["PXL"] + US.Width,
- MinLeft: -_UHE["OW"] + 10,
- MinTop: 0
- });
-
- (this.max) && (this.IsMinAndMax());
- },
-
- IsMinAndMax: function (UDE) {
- U.Ut.AddObj(this,
- { "MaxLeft": this.E["PXL"] + UDE["MaxLeft"] || this.MaxLeft,
- "MinLeft": UDE["MinLeft"] || this.MinLeft,
- "MinTop": UDE["MinTop"] || this.MinTop,
- "MaxTop": this.E["PXT"] + UDE["MaxTop"] || this.MaxTop
- });
- },
-
- Drag: function () {
- var i, _UHE, _UDTD, _UDMD,
- _UDOD = this.SO,
- _UDE = [["X", "Left", "L"], ["Y", "Top", "T"]],
- _UME = this.E,
- _UCE = this.XY,
- _UE = U.M.GetMousep();
- (this.move) && (this.move(this));
-
- for (i = 0; i < _UDE.length; i++) {
- _UDE[i] = Math.min(Math.max(_UE[(_UHE = _UDE[i])[0]] - _UCE[_UHE[0]] + _UME["O" + _UHE[2]], this["Min" + _UHE[1]]), this["Max" + _UHE[1]]);
- }
-
- if (!this.IsD) {
- this.IsD = true;
- U.Ut.AddObj(this, {
- VDB: U.D.foundVirtualBox(_UDOD),
- UMD: U.D.Masklayer()
- });
-
- $(this.UMD).bind({
- mousemove: this.mousemove,
- mouseup: this.mouseup
- });
-
- U.D.SetDTop(this.UMD);
- U.D.SetDTop(this.VDB);
-
- this.VDB.setCapture();
- }
-
- $(this.VDB).addAttrArray({ "style": { "cssText": "left:" + _UDE[0] + "px;top:" + _UDE[1] + "px;"} });
- },
-
- DragUp: function () {
-
- $[document, this.UMD].unbind(
- {
- "mousemove": this.mousemove,
- "mouseup": this.mouseup
- });
- this.IsD = false;
-
- if (this.VDB) {
- var _UDMD = this.UMD,
- _UDTD = this.VDB,
- _UDE = U.M.GetElementInfo(_UDTD);
- _UDTD.releaseCapture();
- U.D.DragMouseDown.chche = U.D.DragMouseDown.ST = null;
- $[_UDMD, this.VDB].remove();
- $(this.SO).addAttrArray({ "style": { "cssText": "top:" + (_UDE["OT"] + 2) + "px;left:" + (_UDE["OL"] + 2) + "px;"} });
- U.D.withf(this.UCB);
- }
- }
- }
- U.D.iconmove = function (UDOD, UDE) {
- if (event.button != 2) {
- var _UTE = new U.D.iconmove.init(UDOD, UDE);
- return _UTE;
- }
- }
- U.D.iconmove.init = function (UDOD, UDE) {
- if (UDOD) {
- var i, _UE = U.M.GetElementAllInfo($(UDOD)[0]),
- _UKE = U.M.GetMousep(),
- _UCE = this.UCE = {
- "mousemove": U.M.apply(this, this.move),
- "mouseup": U.M.apply(this, this.up)
- };
- (UDE && UDE["ST"]) && (UDE["ST"].call(this, UDOD));
-
- U.Ut.AddObj(this, {
- IsD: false,
-
- E: _UKE,
- SO: UDOD,
- UE: _UE,
- UCF: UDE,
- MT: _UE["PXT"] + US.Height - 10,
- ML: _UE["PXL"] + US.Width, MIL: -_UE["OW"] + 10,
- MIT: 0
- });
-
- UDOD.setCapture();
- $(document).bind(_UCE);
- U.D.SetDTop(this.UMD, true);
- $(UDOD).css("z-index", 9999);
- return this;
- }
- }
- U.D.iconmove.init.prototype = {
-
- move: function () {
- var i, _UTL,
- _UDOD = this.SO;
- _UE = U.M.GetMousep(),
- _UKE = this.E,
- _UME = this.UE,
- _UAE = [["X", "L"], ["Y", "T"]];
- U.M.StopBubble();
- if (!this.UMD) {
- this.UMD = U.D.Masklayer();
- $(this.UMD).bind(this.UCE);
- }
-
- for (i = 0; i < _UAE.length; i++) {
- _UTL = _UE[_UAE[i][0]] - _UKE[_UAE[i][0]];
- (Math.abs(_UTL) > 2) && (this.IsD = true);
- _UAE[i] = Math.min(Math.max(_UTL + _UME["O" + _UAE[i][1]], this["MI" + _UAE[i][1]]), this["M" + _UAE[i][1]]);
- }
-
- $(_UDOD).addAttrArray({ "style": { "cssText": "left:" + _UAE[0] + "px;top:" + _UAE[1] + "px"} });
- (this.UCF && this.UCF["Move"]) && (this.UCF["Move"].apply(this, [_UDOD, _UAE, _UKE, _UE]));
- this.ism = true;
- },
-
- up: function () {
- var _UDOD = this.SO,
- _UFE = this.UCF;
- U.M.StopBubble();
- _UDOD.setCapture();
-
- this.ism = null;
- $(this.UMD).remove();
- $(document).unbind(this.UCE);
- $(_UDOD).css("z-index", "");
-
- (_UFE && _UFE["UP"]) && (_UFE["UP"].apply(this, [_UDOD]));
- setTimeout(function () { _UDOD.releaseCapture() }, 0); ;
- }
- }
- U.D.DragSelectE = function (UDE) {
- if (event.button != 2) {
- var _UTE, _UCE, _UKE,
- _UDOD = UDE["SO"],
- _UE = U.M.GetMousep(),
- _UTF = _UDOD.componentFromPoint(_UE["X"] + 2, _UE["Y"] + 2);
-
- if (_UTF != "outside" && _UTF.indexOf("scroll") == -1) {
- _UTE = (new U.D.DragSelectE.init(UDE)).create().SetHover().event();
- return _UTE;
- }
- }
- else {
- (U.D.DragE) && (U.D.DragE.SetHover());
- }
- }
- U.D.DragSelectE.init = function (UDE) {
- var _UDOD = UDE["SO"],
- _UDTD = UDE["SSO"] || _UDOD,
- _USC = UDE["CS"];
-
- U.Ut.AddObj(this, {
- "EL": _UDOD,
- "SSO": _UDTD,
- "OS": _UDTD.onscroll,
- "CB": _UDOD.onmousedown,
- "CS": _USC,
- "PEL": U.M.GetStyle(_UDOD, "position") != "static" ? _UDOD : U.M.TOSP(_UDOD), "TC": [],
- "Fun": UDE["FUN"],
- "ElO": "",
- "ESO": "",
- "UT": "",
- "UL": "",
- "UW": "",
- "UH": "",
- "X": "",
- "Y": "",
- "TX": "",
- "TY": "",
- "PUX": "",
- "PUY": "",
- "W": "",
- "H": "",
- "T": "",
- "L": ""
- });
- }
- U.D.DragSelectE.init.prototype = {
- event: function (UTF) {
- var i, j, k, z, _USH, _UKE,
-
- _UCE = this.e = this.e || [[document, { "mousemove": ["Drag"], "mouseup": ["DragUp"]}], [this.SSO, { "scroll": ["CTA", "Drag"]}], [this["EL"], { "mousedown": ["Event"]}]];
-
- for (i = 0; i < _UCE.length; i++) {
- _UKE = _UCE[i]; (!U.Ut.isArray(_UKE[0])) && (_UKE[0] = [_UKE[0]]);
-
- for (j in _UKE[1]) {
- if (_UKE[1].hasOwnProperty(j)) {
- for (k = 0; k < _UKE[1][j].length; k++) {
- (U.Ut.isString(_UKE[1][j][k])) && (_UKE[1][j][k] = U.M.apply(this, [[this[_UKE[1][j][k]]]]));
- for (z = 0; z < _UKE[0].length; z++) {
- $(_UKE[0][z])[(UTF ? "un" : "") + "bind"](j, _UKE[1][j][k]);
- }
- }
- }
- }
- }
- },
-
- CTA: function () {
- var _UXE = this.ElO = U.M.GetElementAllInfo(this.EL),
-
- _UAE = {
- "PUX": this["PUX"],
- "PUY": this["PUY"]
- };
-
- U.Ut.AddObj(this, { "PUX": _UXE["SL"] + _UXE["PXL"], "PUY": _UXE["ST"] + _UXE["PXT"] });
- if (_UAE["PUX"] !== "") {
- this.DBH({
- "UW": this.UW + (this["PUX"] - _UAE["PUX"]),
- "UH": this.UH + (this["PUY"] - _UAE["PUY"]),
- "UT": this.UT, "UL": this.UL
- });
- }
- return _UXE;
- },
-
- create: function () {
- var i, _UKE, _UDTD,
- _UDOD = this.EL,
- _UE = U.M.GetMousep(),
- _UXE = this.CTA();
-
- U.Ut.AddObj(this, {
- "C": $(_UDOD).Child(),
- "TX": _UXE.TX,
- "TY": _UXE.TY,
- "X": _UE.X - _UXE.TX + this["PUX"],
- "Y": _UE.Y - _UXE.TY + this["PUY"]
- });
-
- if ((_UDTD = this.C[0])) {
- _UKE = ["Left", "Top", "Right", "Bottom"];
- for (i = 0; i < _UKE.length; i++) {
- _UKE[i] = U.M.GetStyle(_UDTD, "margin" + _UKE[i]); _UKE[i] = (!_UKE[i] || _UKE[i] == "auto") ? 0 : parseInt(_UKE[i]);
- }
-
- U.Ut.AddObj(this, {
- "W": _UDTD.offsetWidth + _UKE[0] + _UKE[2],
- "H": _UDTD.offsetHeight + _UKE[1] + _UKE[3],
- "T": _UKE[1] + _UKE[3],
- "L": _UKE[0] + _UKE[2]
- });
- }
-
- this.ESO = $$("div", { "className": "UD_DSE", "style": { "cssText": "top:" + this.Y + "px;left:" + this.X + "px;zIndex:" + US.ZV + 1} }, _UDOD);
- return this;
- },
- Drag: function () {
- var _UDOD = this.EL,
- _UE = U.M.GetMousep(),
- _UT = Math.min(Math.max(_UE["Y"] - this.TY + this["PUY"], 0), Math.max(this.ElO["SH"], this.ElO["OH"]) - 2),
- _UL = Math.min(Math.max(_UE["X"] - this.TX + this["PUX"], 0), this.ElO["SW"] - 2),
- _UW = _UL - this.X,
- _UH = _UT - this.Y;
-
- if (_UW < 0) { _UW = Math.abs(_UW); }
- else { _UL = this.X; }
- if (_UH < 0) { _UH = Math.abs(_UH); }
- else { _UT = this.Y; }
- this.DBH({
- "UW": _UW,
- "UH": _UH,
- "UT": _UT,
- "UL": _UL
- });
- },
-
- DBH: function (UDE) {
- var _UE = {};
- $(this.ESO).addAttrArray({ "style": { "cssText": "width:" + UDE.UW + "px;height:" + UDE.UH + "px;top:" + UDE.UT + "px;left:" + UDE.UL + "px;"} });
- U.Ut.AddObj(this, UDE);
-
- U.Ut.AddObj(_UE, {
- "X": UDE.UL,
- "Y": UDE.UT,
- "BX": UDE.UW + UDE.UL,
- "BY": UDE.UH + UDE.UT
- });
- this.IsLocation(_UE);
- },
-
- IsLocation: function (UDE) {
- if (this.C[0]) {
- var i, _UKE, _UDTD, _UTF,
- _ULE = this.GetLXY(UDE);
-
- if (this.TC.length) {
- for (i = 0; i < this.TC.length; i++) {
- $(_UDTD).removeClass(this.CS);
- }
- }
-
- this.TC = [];
- for (i = _ULE[0]; i < _ULE[1]; i++) {
- if ((_UDTD = this.C[i])) {
-
- _UTF = ((_UKE = i % _ULE[4]) >= _ULE[2]) && (_UKE <= _ULE[3]) && ((_UKE + 1) * this.W >= UDE["X"]);
- if (_UTF && (_UDTD.offsetTop > UDE["BY"] || (_UDTD.offsetTop + this.H - this.T < UDE.Y))) {
- _UTF = false;
- }
- $(_UDTD)[(_UTF ? "add" : "remove") + "Class"](this.CS);
- (_UTF) && (this.TC.push(_UDTD));
- }
- }
- U.D.DragE = this;
- }
- },
-
- GetLXY: function (ULE) {
- var _UL, _UDE = [0, 0];
- _UDE[4] = _UL = Math.floor(this.ElO["SW"] / this.W);
- _UDE[0] = ((Math.floor(ULE["Y"] / this.H) - 1) * _UL);
- _UDE[1] = _UDE[0] + ((Math.ceil((ULE["BY"]) / this.H) - Math.floor(_UDE[0] / _UL)) * _UL);
- _UDE[2] = Math.min(Math.ceil(ULE["X"] / this.W), _UL) - 1; _UDE[3] = Math.min(Math.ceil(ULE["BX"] / this.W), _UL) - 1; return _UDE;
- },
-
- Event: function () {
- if (event.button == 2) {
- var i, _UHT, _UHL, _UTF,
- _UDCD = this.TC, _UE = U.M.GetMousep(),
- _UT = _UE["Y"] - this.TY + this["PUY"],
- _UL = _UE["X"] - this.TX + this["PUX"];
-
- for (i = 0; i < _UDCD.length; i++) {
- if (((_UHT = _UDCD[i].offsetTop) <= _UT && (_UHT + this.H - this.T) >= _UT) && ((_UHL = _UDCD[i].offsetLeft) <= _UL && (_UHL + this.W) > _UL)) {
- _UTF = true;
- }
- }
-
- if (_UTF) {
- (this.Fun) && (this.Fun(this.TC));
- }
- return !_UTF;
- }
- },
-
- DragUp: function () {
- var _UDOD = this.EL;
- this.event(true);
- _UDOD.releaseCapture();
- _UDOD.removeChild(this.ESO);
- },
-
- SetHover: function () {
- var _UTE = U.D.DragE || this;
- (_UTE.TC && _UTE.TC.length) && ($(_UTE.TC).removeClass(this.CS));
- U.D.DragE = this.TC.length = 0;
- return this;
- }
- }
- U.D.DragAb = function (UDOD, UDE) {
- if (UDOD) {
- UDE = UDE || {};
- new U.D.DragAb.init(UDOD, UDE);
- }
- }
- U.D.DragAb.init = function (UDOD, UDE) {
- var _UDTD = $(UDOD),
- _UDSD = _UDTD.parentg(),
- _UDPD = _UDTD.prev(),
- _UDND = _UDTD.next();
-
- U.Ut.AddObj(this, {
- UDPD: _UDSD,
- w: _UDSD.width(),
- pw: _UDSD.parentg().width(),
- UDOD: UDOD,
- UE: U.M.GetMousep(),
- prev: _UDPD,
- next: _UDND,
- uw: [_UDPD.width(), _UDND.width()]
- });
-
- U.Ut.AddObj(this, UDE);
-
- UDOD.setCapture();
-
- $(document.body).bind({
- "mousemove": (this.move = U.M.apply(this, UDE.tf ? this.dragB : this.drag)),
- "mouseup": (this.mup = U.M.apply(this, this.up))
- });
- }
- U.D.DragAb.init.prototype = {
-
- drag: function () {
- var _UDVD = this.prev,
- _UDND = this.next,
- _UW = this.uw,
- _UE = this.UE,
- _UME = U.M.GetMousep();
- _UME["X"] = Math.min(Math.max(-_UW[0], _UME["X"] - _UE["X"]), _UW[1]); _UDVD.css("width", _UW[0] + _UME["X"] + "px"); _UDND.css("width", _UW[1] + _UME["X"] + "px");
- (this.scb) && (this.scb());
- },
-
- dragB: function () {
- var _UW,
- _UDPD = this.UDPD,
- _UDSD = this.prev,
- _UPW = this.pw,
- _UW = this.uw[0],
- _UE = this.UE,
- _UME = U.M.GetMousep();
- _UME["X"] = Math.max(-_UW, _UME["X"] - _UE["X"]);
- _UDSD.css("width", _UW + _UME["X"] + "px");
- _UDPD.css("width", (_UW = (_UME["X"] + this.w)) > this.pw ? _UW + "px" : this.pw + "px");
- (this.scb) && (this.scb());
- },
-
- up: function () {
- this.UDOD.releaseCapture();
- $(document.body).unbind({ "mousemove": this.move, "mouseup": this.mup });
- (this.upcb) && (this.upcb());
- }
- }
|