support Omi.deletePlugin method
This commit is contained in:
parent
ceed3e1cad
commit
48cadc0d2d
|
@ -1,77 +1,73 @@
|
|||
/*!
|
||||
* omi-finger v0.1.3 by dntzhang
|
||||
* Omi / AlloyFinger integration. Support touch and gesture events in your Omi project.
|
||||
* Github: https://github.com/AlloyTeam/omi
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
;(function () {
|
||||
|
||||
var OmiFinger = {};
|
||||
var AlloyFinger = typeof require === 'function'
|
||||
? require('alloyfinger')
|
||||
: window.AlloyFinger;
|
||||
var Omi = typeof require === 'function'
|
||||
? require('omi')
|
||||
: window.Omi;
|
||||
|
||||
var noop = function(){
|
||||
|
||||
};
|
||||
|
||||
var getHandler = function(name, dom, instance) {
|
||||
var value = dom.getAttribute(name);
|
||||
if (value === null) {
|
||||
return noop;
|
||||
}else{
|
||||
return instance[value].bind(instance);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
OmiFinger.init = function(){
|
||||
Omi.extendPlugin('omi-finger',function(dom, instance){
|
||||
if(!instance.alloyFingerInstances)instance.alloyFingerInstances = [];
|
||||
var len = instance.alloyFingerInstances.length;
|
||||
var i = 0 ;
|
||||
for(;i<len;i++){
|
||||
if(instance.alloyFingerInstances[i].dom===dom){
|
||||
instance.alloyFingerInstances[i].fg.destroy();
|
||||
instance.alloyFingerInstances.splice(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var alloyFinger = new AlloyFinger(dom,{
|
||||
touchStart: getHandler('touchStart', dom, instance),
|
||||
touchMove: getHandler('touchMove', dom, instance),
|
||||
touchEnd: getHandler('touchEnd', dom, instance),
|
||||
touchCancel: getHandler('touchCancel', dom, instance),
|
||||
multipointStart: getHandler('multipointStart', dom, instance),
|
||||
multipointEnd: getHandler('multipointEnd', dom, instance),
|
||||
tap: getHandler('tap', dom, instance),
|
||||
doubleTap: getHandler('doubleTap', dom, instance),
|
||||
longTap: getHandler('longTap', dom, instance),
|
||||
singleTap: getHandler('singleTap', dom, instance),
|
||||
rotate: getHandler('rotate', dom, instance),
|
||||
pinch: getHandler('pinch', dom, instance),
|
||||
pressMove: getHandler('pressMove', dom, instance),
|
||||
swipe: getHandler('swipe', dom, instance)
|
||||
|
||||
});
|
||||
instance.alloyFingerInstances.push({fg:alloyFinger,dom:dom});
|
||||
});
|
||||
}
|
||||
|
||||
OmiFinger.destroy = function(){
|
||||
delete Omi.plugins['omi-finger'];
|
||||
};
|
||||
|
||||
if (typeof exports == "object") {
|
||||
module.exports = OmiFinger;
|
||||
} else if (typeof define == "function" && define.amd) {
|
||||
define([], function(){ return OmiFinger });
|
||||
} else {
|
||||
window.OmiFinger = OmiFinger;
|
||||
}
|
||||
|
||||
/*!
|
||||
* omi-finger v0.1.3 by dntzhang
|
||||
* Omi / AlloyFinger integration. Support touch and gesture events in your Omi project.
|
||||
* Github: https://github.com/AlloyTeam/omi
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
;(function () {
|
||||
|
||||
var OmiFinger = {};
|
||||
var AlloyFinger = typeof require === 'function'
|
||||
? require('alloyfinger')
|
||||
: window.AlloyFinger;
|
||||
var Omi = typeof require === 'function'
|
||||
? require('omi')
|
||||
: window.Omi;
|
||||
|
||||
var noop = function(){
|
||||
|
||||
};
|
||||
|
||||
var getHandler = function(name, dom, instance) {
|
||||
var value = dom.getAttribute(name);
|
||||
if (value === null) {
|
||||
return noop;
|
||||
}else{
|
||||
return instance[value].bind(instance);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
OmiFinger.init = function(){
|
||||
Omi.extendPlugin('omi-finger',function(dom, instance){
|
||||
if(!instance.alloyFingerInstances)instance.alloyFingerInstances = [];
|
||||
var len = instance.alloyFingerInstances.length;
|
||||
var i = 0 ;
|
||||
for(;i<len;i++){
|
||||
if(instance.alloyFingerInstances[i].dom===dom){
|
||||
instance.alloyFingerInstances[i].fg.destroy();
|
||||
instance.alloyFingerInstances.splice(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var alloyFinger = new AlloyFinger(dom,{
|
||||
touchStart: getHandler('touchStart', dom, instance),
|
||||
touchMove: getHandler('touchMove', dom, instance),
|
||||
touchEnd: getHandler('touchEnd', dom, instance),
|
||||
touchCancel: getHandler('touchCancel', dom, instance),
|
||||
multipointStart: getHandler('multipointStart', dom, instance),
|
||||
multipointEnd: getHandler('multipointEnd', dom, instance),
|
||||
tap: getHandler('tap', dom, instance),
|
||||
doubleTap: getHandler('doubleTap', dom, instance),
|
||||
longTap: getHandler('longTap', dom, instance),
|
||||
singleTap: getHandler('singleTap', dom, instance),
|
||||
rotate: getHandler('rotate', dom, instance),
|
||||
pinch: getHandler('pinch', dom, instance),
|
||||
pressMove: getHandler('pressMove', dom, instance),
|
||||
swipe: getHandler('swipe', dom, instance)
|
||||
|
||||
});
|
||||
instance.alloyFingerInstances.push({fg:alloyFinger,dom:dom});
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof exports == "object") {
|
||||
module.exports = OmiFinger;
|
||||
} else if (typeof define == "function" && define.amd) {
|
||||
define([], function(){ return OmiFinger });
|
||||
} else {
|
||||
window.OmiFinger = OmiFinger;
|
||||
}
|
||||
|
||||
})();
|
|
@ -1,54 +1,50 @@
|
|||
/*!
|
||||
* omi-jquery-date-picker v0.1.0 by dntzhang
|
||||
* Omi / JQuery Date Picker integration.
|
||||
* Github: https://github.com/AlloyTeam/omi
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
;(function () {
|
||||
|
||||
var OmiJQueryDatePicker = {};
|
||||
var Omi = typeof require === 'function'
|
||||
? require('omi')
|
||||
: window.Omi;
|
||||
|
||||
OmiJQueryDatePicker.init = function() {
|
||||
Omi.extendPlugin('omi-jquery-date-picker', function (dom, instance) {
|
||||
var data = Omi.getParameters(dom, instance, {
|
||||
numberType: ['minDays','maxDays','duration'],
|
||||
booleanType: ['autoClose','startDate','endDate','showShortcuts','inline','alwaysOpen','singleDate','lookBehind','batchMode','stickyMonths','showTopbar','swapTime','selectForward','selectBackward','showWeekNumbers'],
|
||||
functionType: ['onFirstDateSelected','onChange','onApply','onClose','onClosed','onOpen','onOpened'],
|
||||
stringType: ['format','separator','language','startOfWeek','container','applyBtnClass','singleMonth']
|
||||
});
|
||||
|
||||
$(dom).dateRangePicker(data).bind('datepicker-first-date-selected', data['onFirstDateSelected'])
|
||||
.unbind('datepicker-change')
|
||||
.unbind('datepicker-apply')
|
||||
.unbind('datepicker-close')
|
||||
.unbind('datepicker-closed')
|
||||
.unbind('datepicker-open')
|
||||
.unbind('datepicker-opened')
|
||||
.bind('datepicker-change', data['onChange'])
|
||||
.bind('datepicker-apply', data['onApply'])
|
||||
.bind('datepicker-close', data['onClose'])
|
||||
.bind('datepicker-closed', data['onClosed'])
|
||||
.bind('datepicker-open', data['onOpen'])
|
||||
.bind('datepicker-opened', data['onOpened']);
|
||||
|
||||
instance[dom.getAttribute('instanceRef')] = $(dom).data('dateRangePicker');
|
||||
});
|
||||
}
|
||||
|
||||
OmiJQueryDatePicker.destroy = function(){
|
||||
delete Omi.plugins['omi-jquery-date-picker'];
|
||||
};
|
||||
|
||||
if (typeof exports == "object") {
|
||||
module.exports = OmiJQueryDatePicker;
|
||||
} else if (typeof define == "function" && define.amd) {
|
||||
define([], function(){ return OmiJQueryDatePicker });
|
||||
} else {
|
||||
window.OmiJQueryDatePicker = OmiJQueryDatePicker;
|
||||
}
|
||||
|
||||
})();
|
||||
/*!
|
||||
* omi-jquery-date-picker v0.1.0 by dntzhang
|
||||
* Omi / JQuery Date Picker integration.
|
||||
* Github: https://github.com/AlloyTeam/omi
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
;(function () {
|
||||
|
||||
var OmiJQueryDatePicker = {};
|
||||
var Omi = typeof require === 'function'
|
||||
? require('omi')
|
||||
: window.Omi;
|
||||
|
||||
OmiJQueryDatePicker.init = function() {
|
||||
Omi.extendPlugin('omi-jquery-date-picker', function (dom, instance) {
|
||||
var data = Omi.getParameters(dom, instance, {
|
||||
numberType: ['minDays','maxDays','duration'],
|
||||
booleanType: ['autoClose','startDate','endDate','showShortcuts','inline','alwaysOpen','singleDate','lookBehind','batchMode','stickyMonths','showTopbar','swapTime','selectForward','selectBackward','showWeekNumbers'],
|
||||
functionType: ['onFirstDateSelected','onChange','onApply','onClose','onClosed','onOpen','onOpened'],
|
||||
stringType: ['format','separator','language','startOfWeek','container','applyBtnClass','singleMonth']
|
||||
});
|
||||
|
||||
$(dom).dateRangePicker(data).bind('datepicker-first-date-selected', data['onFirstDateSelected'])
|
||||
.unbind('datepicker-change')
|
||||
.unbind('datepicker-apply')
|
||||
.unbind('datepicker-close')
|
||||
.unbind('datepicker-closed')
|
||||
.unbind('datepicker-open')
|
||||
.unbind('datepicker-opened')
|
||||
.bind('datepicker-change', data['onChange'])
|
||||
.bind('datepicker-apply', data['onApply'])
|
||||
.bind('datepicker-close', data['onClose'])
|
||||
.bind('datepicker-closed', data['onClosed'])
|
||||
.bind('datepicker-open', data['onOpen'])
|
||||
.bind('datepicker-opened', data['onOpened']);
|
||||
|
||||
instance[dom.getAttribute('instanceRef')] = $(dom).data('dateRangePicker');
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof exports == "object") {
|
||||
module.exports = OmiJQueryDatePicker;
|
||||
} else if (typeof define == "function" && define.amd) {
|
||||
define([], function(){ return OmiJQueryDatePicker });
|
||||
} else {
|
||||
window.OmiJQueryDatePicker = OmiJQueryDatePicker;
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
|
@ -115,10 +115,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
OmiRouter.destroy = function () {
|
||||
delete Omi.plugins['omi-router']
|
||||
}
|
||||
|
||||
if (typeof exports == "object") {
|
||||
module.exports = OmiRouter
|
||||
} else if (typeof define == "function" && define.amd) {
|
||||
|
|
|
@ -1,78 +1,74 @@
|
|||
/*!
|
||||
* omi-touch v0.1.0 by dntzhang
|
||||
* AlloyTouch / Omi integration. Smooth scrolling, rotation, pull to refresh, page transition and any motion for your Omi project.
|
||||
* Github: https://github.com/AlloyTeam/omi
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
;(function () {
|
||||
|
||||
var OmiTouch = {};
|
||||
var AlloyTouch = typeof require === 'function' ? require('alloytouch') : window.AlloyTouch;
|
||||
var Transform = typeof require === 'function' ? require('css3transform') : window.Transform;
|
||||
var Omi = typeof require === 'function' ? require('omi') : window.Omi;
|
||||
|
||||
var noop = function(){
|
||||
|
||||
};
|
||||
|
||||
var getHandler = function(name, dom, instance) {
|
||||
var value = dom.getAttribute(name);
|
||||
if (value === null) {
|
||||
return noop;
|
||||
}else{
|
||||
return instance[value].bind(instance);
|
||||
}
|
||||
};
|
||||
|
||||
var getNum = function(name, dom){
|
||||
var value = dom.getAttribute(name);
|
||||
if(value){
|
||||
return parseFloat(value);
|
||||
}
|
||||
}
|
||||
|
||||
OmiTouch.init = function(){
|
||||
Omi.extendPlugin('omi-touch',function(dom, instance){
|
||||
var target = instance.refs[ dom.getAttribute('motionRef')];
|
||||
Transform(target);
|
||||
var initialValue = dom.getAttribute('initialValue');
|
||||
if(initialValue){
|
||||
target[dom.getAttribute('property') || "translateY"] = parseInt(initialValue);
|
||||
}
|
||||
|
||||
new AlloyTouch({
|
||||
touch: dom,//反馈触摸的dom
|
||||
vertical: dom.getAttribute('vertical') === 'false' ? false : true,//不必需,默认是true代表监听竖直方向touch
|
||||
target: target, //运动的对象
|
||||
property: dom.getAttribute('property') || "translateY", //被运动的属性
|
||||
min: getNum('min', dom), //不必需,运动属性的最小值
|
||||
max: getNum('max', dom), //不必需,滚动属性的最大值
|
||||
sensitivity: getNum('sensitivity', dom) ,//不必需,触摸区域的灵敏度,默认值为1,可以为负数
|
||||
factor: getNum('factor', dom) ,//不必需,表示触摸位移与被运动属性映射关系,默认值是1
|
||||
step: getNum('step', dom),//用于校正到step的整数倍
|
||||
bindSelf: dom.getAttribute('bindSelf') === 'true' ? true : false,
|
||||
change: getHandler('change', dom, instance),
|
||||
touchStart: getHandler('touchStart', dom, instance),
|
||||
touchMove: getHandler('touchMove', dom, instance),
|
||||
touchEnd: getHandler('touchEnd', dom, instance),
|
||||
tap: getHandler('tap', dom, instance),
|
||||
pressMove: getHandler('pressMove', dom, instance),
|
||||
animationEnd: getHandler('animationEnd', dom, instance)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
OmiTouch.destroy = function(){
|
||||
delete Omi.plugins['omi-touch'];
|
||||
};
|
||||
|
||||
if (typeof exports == "object") {
|
||||
module.exports = OmiTouch;
|
||||
} else if (typeof define == "function" && define.amd) {
|
||||
define([], function(){ return OmiTouch });
|
||||
} else {
|
||||
window.OmiTouch = OmiTouch;
|
||||
}
|
||||
|
||||
/*!
|
||||
* omi-touch v0.1.0 by dntzhang
|
||||
* AlloyTouch / Omi integration. Smooth scrolling, rotation, pull to refresh, page transition and any motion for your Omi project.
|
||||
* Github: https://github.com/AlloyTeam/omi
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
;(function () {
|
||||
|
||||
var OmiTouch = {};
|
||||
var AlloyTouch = typeof require === 'function' ? require('alloytouch') : window.AlloyTouch;
|
||||
var Transform = typeof require === 'function' ? require('css3transform') : window.Transform;
|
||||
var Omi = typeof require === 'function' ? require('omi') : window.Omi;
|
||||
|
||||
var noop = function(){
|
||||
|
||||
};
|
||||
|
||||
var getHandler = function(name, dom, instance) {
|
||||
var value = dom.getAttribute(name);
|
||||
if (value === null) {
|
||||
return noop;
|
||||
}else{
|
||||
return instance[value].bind(instance);
|
||||
}
|
||||
};
|
||||
|
||||
var getNum = function(name, dom){
|
||||
var value = dom.getAttribute(name);
|
||||
if(value){
|
||||
return parseFloat(value);
|
||||
}
|
||||
}
|
||||
|
||||
OmiTouch.init = function(){
|
||||
Omi.extendPlugin('omi-touch',function(dom, instance){
|
||||
var target = instance.refs[ dom.getAttribute('motionRef')];
|
||||
Transform(target);
|
||||
var initialValue = dom.getAttribute('initialValue');
|
||||
if(initialValue){
|
||||
target[dom.getAttribute('property') || "translateY"] = parseInt(initialValue);
|
||||
}
|
||||
|
||||
new AlloyTouch({
|
||||
touch: dom,//反馈触摸的dom
|
||||
vertical: dom.getAttribute('vertical') === 'false' ? false : true,//不必需,默认是true代表监听竖直方向touch
|
||||
target: target, //运动的对象
|
||||
property: dom.getAttribute('property') || "translateY", //被运动的属性
|
||||
min: getNum('min', dom), //不必需,运动属性的最小值
|
||||
max: getNum('max', dom), //不必需,滚动属性的最大值
|
||||
sensitivity: getNum('sensitivity', dom) ,//不必需,触摸区域的灵敏度,默认值为1,可以为负数
|
||||
factor: getNum('factor', dom) ,//不必需,表示触摸位移与被运动属性映射关系,默认值是1
|
||||
step: getNum('step', dom),//用于校正到step的整数倍
|
||||
bindSelf: dom.getAttribute('bindSelf') === 'true' ? true : false,
|
||||
change: getHandler('change', dom, instance),
|
||||
touchStart: getHandler('touchStart', dom, instance),
|
||||
touchMove: getHandler('touchMove', dom, instance),
|
||||
touchEnd: getHandler('touchEnd', dom, instance),
|
||||
tap: getHandler('tap', dom, instance),
|
||||
pressMove: getHandler('pressMove', dom, instance),
|
||||
animationEnd: getHandler('animationEnd', dom, instance)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof exports == "object") {
|
||||
module.exports = OmiTouch;
|
||||
} else if (typeof define == "function" && define.amd) {
|
||||
define([], function(){ return OmiTouch });
|
||||
} else {
|
||||
window.OmiTouch = OmiTouch;
|
||||
}
|
||||
|
||||
})();
|
|
@ -37,10 +37,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
OmiTransform.destroy = function(){
|
||||
delete Omi.plugins['omi-transform'];
|
||||
};
|
||||
|
||||
if (typeof exports == "object") {
|
||||
module.exports = OmiTransform;
|
||||
} else if (typeof define == "function" && define.amd) {
|
||||
|
|
|
@ -305,4 +305,8 @@ Omi.mixIndexToArray = function(arr ,indexName){
|
|||
})
|
||||
}
|
||||
|
||||
Omi.deletePlugin = function(name){
|
||||
delete Omi.plugins[name]
|
||||
}
|
||||
|
||||
module.exports = Omi
|
Loading…
Reference in New Issue