Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Сделал прозрачные события для touch/desktop

click/touchstart
mousedown/touchstart
mousemove/touchmove
mouseend/touchend
  • Loading branch information...
commit b34fd1d04596749438d5236e3cadafbc1196fb26 1 parent 4023f9c
@doochik doochik authored
View
4 external/modernizr.js
@@ -0,0 +1,4 @@
+/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
+ * Build: http://modernizr.com/download/#-touch-teststyles-prefixes
+ */
+;window.Modernizr=function(a,b,c){function v(a){i.cssText=a}function w(a,b){return v(l.join(a+";")+(b||""))}function x(a,b){return typeof a===b}function y(a,b){return!!~(""+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,"function")?f.bind(d||b):f}return!1}var d="2.6.2",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l=" -webkit- -moz- -o- -ms- ".split(" "),m={},n={},o={},p=[],q=p.slice,r,s=function(a,c,d,e){var h,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:g+(d+1),l.appendChild(j);return h=["&#173;",'<style id="s',g,'">',a,"</style>"].join(""),l.id=g,(m?l:n).innerHTML+=h,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=f.style.overflow,f.style.overflow="hidden",f.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),f.style.overflow=k),!!i},t={}.hasOwnProperty,u;!x(t,"undefined")&&!x(t.call,"undefined")?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=q.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(q.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(q.call(arguments)))};return e}),m.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:s(["@media (",l.join("touch-enabled),("),g,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c};for(var A in m)u(m,A)&&(r=A.toLowerCase(),e[r]=m[A](),p.push((e[r]?"":"no-")+r));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)u(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof enableClasses!="undefined"&&enableClasses&&(f.className+=" "+(b?"":"no-")+a),e[a]=b}return e},v(""),h=j=null,e._version=d,e._prefixes=l,e.testStyles=s,e}(this,this.document);
View
2  src/no.action.js
@@ -82,7 +82,7 @@ no.action.init = function() {
var HREF_JS_REGEXP = /^\s*javascript:/i;
$("body")
- .on("click dblclick", "a, .no-action", function(e) {
+ .on(no.V.EVENTS.click, "a, .no-action", function(e) {
@chestozo Owner

А так везде надо будет писать теперь вместо просто click?

@doochik Owner
doochik added a note

если ты хочешь работать и там и там, то да

@chestozo Owner

Всегда считал, что прозрачный означает, что ты как вешал click, так и вешаешь )

@doochik Owner
doochik added a note

тоже хороший вариант :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
var target = e.currentTarget;
var $target = $(target);
var href = target.getAttribute('href');
View
54 src/no.consts.events.js
@@ -0,0 +1,54 @@
+/**
+ * @fileOverview DOM events for no.View
+ */
+
+/**
+ * Хеш событий для удобного биндинга touch/desktop
+ * @type {Object}
+ */
+no.V.EVENTS = {};
+
+/**
+ * Список DOM-событий.
+ * @type {Array}
+ * @constant
+ */
+no.V.DOM_EVENTS = [
+ 'blur',
+ 'change',
+ 'dblclick',
+ 'focus',
+ 'focusin',
+ 'focusout',
+ 'keydown',
+ 'keypress',
+ 'keyup',
+ 'mouseenter',
+ 'mouseleave',
+ 'mouseout',
+ 'mouseover',
+ 'resize',
+ 'scroll',
+ 'submit'
+];
+
+//TODO: Pointer events support (MSIE 10)
+
+if (Modernizr && Modernizr.touch) {
+ no.V.DOM_EVENTS.push('touchstart', 'touchmove', 'touchend');
+ no.V.EVENTS = {
+ 'click': 'touchstart',
+ 'mousedown': 'touchstart',
+ 'mousemove': 'touchmove',
+ 'mouseup': 'touchend'
+ };
+
+} else {
+ no.V.DOM_EVENTS.push('click', 'mousedown', 'mousemove', 'mouseup');
+ no.V.EVENTS = {
+ 'click': 'click',
+ 'mousedown': 'mousedown',
+ 'mousemove': 'mousemove',
+ 'mouseup': 'mouseup'
+ };
+}
View
33 src/no.consts.js
@@ -44,39 +44,6 @@ no.V.STATUS = {
INVALID: 4
};
-/**
- * Список DOM-событий.
- * @type {Array}
- * @constant
- */
-no.V.DOM_EVENTS = [
- 'blur',
- 'change',
- 'click',
- 'dblclick',
- 'focus',
- 'focusin',
- 'focusout',
- 'keydown',
- 'keypress',
- 'keyup',
- 'mousedown',
- 'mouseenter',
- 'mouseleave',
- 'mousemove',
- 'mouseout',
- 'mouseover',
- 'mouseup',
- 'resize',
- 'scroll',
- 'submit',
-//TODO: сделать прозрачные (mousedown/touchstart/MSPointerDown) константы в зависимости от окружения
-// пример тут https://github.com/nolimits4web/Swiper/blob/master/dist/idangerous.swiper-1.7.js
- 'touchstart',
- 'touchmove',
- 'touchend'
-];
-
// ----------------------------------------------------------------------------------------------------------------- //
/**
Please sign in to comment.
Something went wrong with that request. Please try again.