123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479 |
-
- Namespace.register("U.UF.CP");
- U.UF.CP.wheel = function (fun) {
- this.onwheel = fun;
- }
- U.UF.CP.wheelGet = function () {
- return this.onwheel;
- }
- U.UF.CP.setInnerText = function (str) {
- this.textContent = str;
- }
- U.UF.CP.setInnerTextGet = function () {
- return this.textContent;
- }
- U.UF.CP.outerHtml = function (str) {
- var i,
- _this = U.selectEl(this),
- _div = $$("div", { "innerHTML": str }).childNodes,
- _create = $$("frag");
-
- for (i = 0; i < _div.length; i++) {
- _create.appendChild(_div[i]);
- }
- _create.insertBefore(_create, this);
- _this.remove();
- }
- U.UF.CP.outerHtmlGet = function () {
- var _copy = this.cloneNode(true);
- var _div = $$("div", {});
- _div.appendChild(_copy);
- return _div.innerHTML;
- }
- U.UF.CP.getStyleGet = function () {
- return getComputedStyle(this, false);
- }
- U.UF.CP.setCapture = function () {
- return function () {
- window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
- }
- }
- U.UF.CP.releaseCapture = function () {
- return function () {
- window.releaseEvents(Event.MOUSEMOVE | Event.MOUSEUP)
- }
- }
- U.UF.CP.onresize = function (fun) {
- if (this.tagName) {
-
- var _position,
- _sizeelement = this.__SizeElement__;
- if (!_sizeelement || U.selectEl(_sizeelement).Parent() != this && fun) {
- _position = U.UF.EL.getStyle(this, "position");
- if (_position == "" || _position == "static") { this.style.position = "relative"; }
- _sizeelement = this.__SizeElement__ = $$("object", {
- "onload": function () {
- if (fun) {
- _sizeelement.contentDocument.defaultView.onresize = function () {
- fun();
- }
-
-
-
- }
- else {
- try {
- delete this.__SizeElement__;
- } catch (e) { }
- }
- },
- "type": "text/html",
- "data": "about:blank",
- "style": {
- "cssText": "display:block;position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden;pointer-events:none;z-index:-1;visibility:hidden;margin:0;padding:0;"
- }
- }, this);
- }
- else {
- if (fun) {
- _sizeelement.contentDocument.defaultView.onresize = function () { fun(); }
- }
- else {
- try {
- delete this.__SizeElement__;
- } catch (e) { }
- }
- }
- }
- }
- U.UF.CP.onresizeGet = function () {
- try {
- return this.__SizeElement__.contentDocument.defaultView.onresize;
- }
- catch (e) {
- return null;
- }
- }
- U.UF.CP.eventGet = function () {
- var _currentfun = arguments.callee;
- while (_currentfun.caller) {
- _currentfun = _UDE.caller;
- }
- if (_currentfun.arguments[0]) {
- return _currentfun.arguments[0];
- }
- else {
- return null;
- }
- }
- U.UF.CP.targetGet = function () {
- return event.target;
- }
- U.UF.CP.keyCodeGet = function () {
- return event.which;
- }
- U.UF.CP.onreadystatechangeGet = function () {
- return this.onload;
- }
- U.UF.CP.onreadystatechange = function (cb) {
- this.onload = cb;
- }
- U.UF.CP.componentFromPoint = function () {
- return function () {
- var _position = U.UF.EL.getMousePosition();
- var _elinfo = U.UF.EL.getElementInfo(this);
- if ((_position["X"] > _elinfo["CW"] + _elinfo["TX"]) || (_position["Y"] > _elinfo["CH"] + _elinfo["TY"])) {
- return "outside";
- }
- return "";
- }
- }
- U.UF.CP.init = function () {
-
- if (window.HTMLElement) {
-
-
-
-
- if (!("onmousewheel" in HTMLElement.prototype)) {
-
- if ("onwheel" in HTMLElement.prototype) {
-
- HTMLElement.prototype.__defineGetter__("onmousewheel", U.UF.CP.wheelGet);
- HTMLElement.prototype.__defineSetter__("onmousewheel", U.UF.CP.wheel);
- }
-
- else {
- window.addEventListener("DOMMouseScroll", function (e) {
-
- var _fun = null,
- _currentevent = e.srcElement;
- do {
- _fun = U.selectEl(_currentevent).attr("onmousewheel") || _currentevent.onmousewheel;
- _currentevent = U.selectEl(_currentevent).Parent();
- }
- while (!(_fun || !_currentevent));
- if (_fun) {
- if (U.UF.C.isString(_fun)) {
- _currentevent.onmousewheel = new Function(_fun);
- }
- U.UF.EV.stopDefault();
-
- setTimeout(function () {
- obj.call(this, e);
- }, 0);
- }
- }, false);
- }
- }
-
-
-
-
-
-
-
-
- if (!("innerText" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("innerText", U.UF.CP.setInnerTextGet);
- HTMLElement.prototype.__defineSetter__("innerText", U.UF.CP.setInnerText);
- }
-
-
- if (!("outerHTML" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("outerHTML", U.UF.CP.outerHtmlGet);
- HTMLElement.prototype.__defineSetter__("outerHTML", U.UF.CP.outerHtml);
- }
-
-
- if (!("currentStyle" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("currentStyle", U.UF.CP.getStyleGet);
- }
-
-
- if (!("setCapture" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("setCapture", U.UF.CP.setCapture);
- }
-
-
- if (!("releaseCapture" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("releaseCapture", U.UF.CP.releaseCapture);
- }
-
-
- if (!("onresize" in HTMLElement.prototype) || !(U.UF.CI.getBrowser().browser == "msie")) {
- HTMLElement.prototype.__defineGetter__("onresize", U.UF.CP.onresizeGet);
- HTMLElement.prototype.__defineSetter__("onresize", U.UF.CP.onresize);
- }
-
- if (!("componentFromPoint" in HTMLElement.prototype)) {
- HTMLElement.prototype.__defineGetter__("componentFromPoint", U.UF.CP.componentFromPoint);
- }
-
-
- if (!("event" in window.constructor.prototype)) {
- window.constructor.prototype.__defineGetter__("event", U.UF.CP.eventGet);
- }
-
- if (window.Event.prototype) {
-
-
- if (!("srcElement" in window.Event.prototype)) {
- window.Event.__defineGetter__("target", U.UF.CP.targetGet);
- }
-
-
- if (!("keyCode" in window.Event.prototype) && window.Event.__defineGetter__) {
- window.Event.__defineGetter__("keyCode", U.UF.CP.keyCodeGet);
- }
- }
- }
- }
- U.UF.C.style;
- document.querySelectorAll = document.querySelectorAll || function (str, el) {
- var _addstyle = U.UF.C.style,
- _returnarr = [],
- _firstchild = document.documentElement.firstChild,
- _arr = (el || document).all,
- i = _arr.length;
-
- try {
- _addstyle.styleSheet.cssText = str + "{q:1}";
- }
- catch (e) {
- U.UF.C.style = $$("style", {
- "type": "text/css",
- "styleSheet": {
- "cssText": str + "{q:1}"
- }
- }, _firstchild);
- }
-
- while (i--) {
- if (_arr[i].currentStyle.q) {
- _returnarr.unshift(_arr[i]);
- }
- }
- return _returnarr;
- };
- document.querySelector = document.querySelector || function (num) {
- var _num = document.querySelectorAll(num);
- if (_num.length) {
- return _num[0];
- }
- else {
- return null;
- }
- };
- U.UF.CP.selectorElement = function (str, el) {
- var _ishasid = (el.id === "" && el != document),
- _query = $$("div").querySelectorAll;
- if (_ishasid) {
- el.id = el.uniqueID;
- }
- try {
- if (_query) {
- return (el || document).querySelectorAll((el.id ? ("#" + el.id + " ") : " ") + str, el);
- }
-
- else {
- return document.querySelectorAll((el.id ? ("#" + el.id + " ") : " ") + str, el);
- }
- }
- catch (e) {
- return null;
- }
- finally {
- if (_ishasid) {
- el.id = "";
- }
- }
- }
- U.UF.CP.touch = function () {
-
- if (U.UF.C.touchstart) {
- U.UF.EV.delElementEvent("touchstart", document, U.UF.C.touchstart, true);
- }
-
- U.UF.EV.addElementEvent("touchstart", document, U.UF.C.touchstart, true);
- }
- U.UF.C.touchstart = function () {
- var i,
- _eventsrc = event.srcElement;
-
- U.UF.C.ismove = null;
-
- U.UF.EV.stopBubble();
-
- U.UF.EV.delElementEvent("touchstart", document, U.UF.C.touchstart, true);
-
- U.UF.EV.simulatePhoneTouch(_eventsrc, "touchstart");
-
- U.UF.EV.addElementEvent("touchstart", document, U.UF.C.touchstart, true);
-
- U.UF.EV.addElementEvent("touchmove", document, U.UF.C.touchmove);
-
- U.UF.EV.addElementEvent("touchend", document, U.UF.C.touchend, true);
- }
- U.UF.C.touchmove = function () {
- U.UF.C.ismove = true;
- U.UF.EV.delElementEvent("touchmove", document, U.UF.C.touchmove);
- U.UF.EV.simulatePhoneTouch(event.srcElement, "touchmove");
- U.UF.EV.stopBubble();
- }
- U.UF.C.touchend = function () {
- U.UF.EV.delElementEvent("touchend", document, U.UF.C.touchend, true);
- U.UF.EV.stopBubble();
-
- if (!U.UF.C.ismove) {
- U.UF.EV.simulatePhoneTouch(event.srcElement, "touchend");
- }
- }
|