1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- //#region 手机应用处理使用
- Namespace.register("U.PH");
- //Touch事件执行
- if ("ontouchstart" in document) {
- (U.M.OTS) && (U.M.ReEvent("touchstart", document, U.M.OTS, true));
- //touchstart
- U.M.AddEvent("touchstart", document, U.M.OTS = function () {
- var i, _UDOD = event.srcElement; U.M.UTX = null; U.M.StopBubble();
- U.M.ReEvent("touchstart", document, U.M.OTS, true); //移除start事件
- U.M.TouchE(_UDOD, "touchstart"); U.M.AddEvent("touchstart", document, U.M.OTS, true); //添加事件取消冒泡
- U.M.AddEvent("touchmove", document, U.M.OTSM); //添加move事件监听
- U.M.AddEvent("touchend", document, U.M.OTSE, true); //end事件等待
- }, true);
- U.M.OTSM = function () { //移动监视
- U.M.UTX = true; U.M.ReEvent("touchmove", document, U.M.OTSM); U.M.TouchE(event.srcElement, "touchmove"); U.M.StopBubble();
- }
- //执行toucastart
- U.M.OTSE = function (UDOD) {
- U.M.ReEvent("touchend", document, U.M.OTSE, true); U.M.StopBubble(); //移除事件
- if (!U.M.UTX) { U.M.TouchE(event.srcElement, "touchend"); } //事件执行
- }
- }
- /**
- * 对象数组,需要批量给对象添加属性。
- * @param {array} U.CD的自定义变量或者Array,Object等系统变量
- * @param {object} 属性的集合,形如:{ "domain": "1473.cn", "SystemId": 0}
- * @param {object} 属性的集合,形如:{ "domain": "1473.cn", "SystemId": 0}
- */
- U.PH.up = function (UDOD, UCB, UDE) {
- new _UDE.init(UDOD, UCB, UDE);
- }
- /**
- * 对象数组,需要批量给对象添加属性。
- * @param {array} U.CD的自定义变量或者Array,Object等系统变量
- * @param {object} 属性的集合,形如:{ "domain": "1473.cn", "SystemId": 0}
- * @param {object} 属性的集合,形如:{ "domain": "1473.cn", "SystemId": 0}
- */
- U.PH.up.init = function (UDOD, UCB, UDE) {
- U.Ut.AddObj(this, { obj: UDOD,
- cb: UCB,
- s: U.M.apply(this, this.start),
- m: U.M.apply(this, this.move),
- e: U.M.apply(this, this.end)
- });
- (UDE) && (U.Ut.AddObj(this, UDE)); //生成变量
- U.M.AddEvent("touchstart", UDOD, this.s);
- U.M.AddEvent("touchmove", UDOD, this.m); U.M.AddEvent("touchend", UDOD, this.e); //事件添加
- }
- U.PH.up.init.prototype = {
- start: function () { //启动使用
- (!this.obj.scrollTop) && (this.tf = true, this.entf = false, this.t = U.M.GetMousep());
- },
- move: function () { //使用启动
- U.M.StopBubble();
- if (this.tf) {
- var _UDE = U.M.GetMousep(),
- _UTY = _UDE.Y - this.t.Y;
- if (_UTY > 0) {
- this.entf = _UTY;
- (U.Ut.isFunction(this.mcb)) && (this.mcb(_UTY));
- }
- else { this.entf = false; }
- }
- },
- end: function () { //结束
- if (this.tf && this.entf && U.Ut.isFunction(this.cb)) { this.cb(this.entf); } this.tf = this.entf = this.t = null;
- if (this.sf) { U.M.ReEvent("touchstart", this.obj, this.s); U.M.ReEvent("touchmove", this.obj, this.m); U.M.ReEvent("touchend", this.obj, this.e); } //结束释放
- }
- }
- //#endregion
|