Browse Source

Update JSHint rules.

Enabled:

* `immed`
* `newcap`
* `latedef`

Removed:

* `boss`
* `laxbreak`
* `validthis`

Also move `bitwise` to fingerblast.js since that's where it's only needed.
pull/379/head
XhmikosR 11 years ago
parent
commit
4b76127723
  1. 7
      docs/assets/js/docs.js
  2. 3
      docs/assets/js/fingerblast.js
  3. 9
      js/.jshintrc
  4. 4
      js/modals.js
  5. 8
      js/popovers.js
  6. 28
      js/push.js
  7. 4
      js/segmented-controllers.js
  8. 4
      js/sliders.js
  9. 8
      js/toggles.js

7
docs/assets/js/docs.js

@ -137,6 +137,10 @@ $(function() {
device[0].setAttribute('style','');
}
function updateContent(content) {
$('#iwindow').html(content);
}
// Injection of components into device
for (var l = contentSection.length; l--;) {
if ((topCache[l] - currentTop) < windowHeight) {
@ -159,9 +163,6 @@ $(function() {
}
}
function updateContent(content) {
$('#iwindow').html(content);
}
};
// Toolbar toggle

3
docs/assets/js/fingerblast.js

@ -2,6 +2,7 @@
// --------------
// Adapted from phantom limb by Brian Cartensen
/* jshint bitwise: false */
/* global GLOBAL: true */
function FingerBlast(element) {
@ -33,7 +34,7 @@ FingerBlast.prototype = {
} else if ('contains' in ancestor) {
return ancestor !== element && ancestor.contains(element);
} else {
for (descendants = ancestor.getElementsByTagName('*'), index = 0; descendant = descendants[index++];) {
for ((descendants = ancestor.getElementsByTagName('*')), index = 0; (descendant = descendants[index++]);) {
if (descendant === element) {
return true;
}

9
js/.jshintrc

@ -1,5 +1,5 @@
{
"boss" : true,
"bitwise" : true,
"browser" : true,
"camelcase" : true,
"curly" : true,
@ -9,13 +9,14 @@
"expr" : true,
"forin" : true,
"freeze" : true,
"immed" : true,
"indent" : 2,
"laxbreak" : true,
"latedef" : true,
"newcap" : true,
"nonbsp" : true,
"quotmark" : "single",
"strict" : true,
"trailing" : true,
"undef" : true,
"unused" : true,
"validthis" : true
"unused" : true
}

4
js/modals.js

@ -4,7 +4,7 @@
* http://opensource.org/licenses/MIT
* ---------------------------------- */
!function () {
!(function () {
'use strict';
var findModals = function (target) {
@ -34,4 +34,4 @@
event.preventDefault(); // prevents rewriting url (apps can still use hash values in url)
}
});
}();
}());

8
js/popovers.js

@ -4,7 +4,7 @@
* http://opensource.org/licenses/MIT
* ---------------------------------- */
!function () {
!(function () {
'use strict';
var popover;
@ -25,7 +25,7 @@
popover.removeEventListener('webkitTransitionEnd', onPopoverHidden);
};
var backdrop = function () {
var backdrop = (function () {
var element = document.createElement('div');
element.classList.add('backdrop');
@ -37,7 +37,7 @@
});
return element;
}();
}());
var getPopover = function (e) {
var anchor = findPopovers(e.target);
@ -81,4 +81,4 @@
window.addEventListener('touchend', showHidePopover);
window.addEventListener('click', showHidePopover);
}();
}());

28
js/push.js

@ -7,7 +7,7 @@
/* global _gaq: true */
!function () {
!(function () {
'use strict';
var noop = function () {};
@ -87,18 +87,16 @@
var getTarget = function (e) {
var target = findTarget(e.target);
if (
! target
|| e.which > 1
|| e.metaKey
|| e.ctrlKey
|| isScrolling
|| location.protocol !== target.protocol
|| location.host !== target.host
|| !target.hash && /#/.test(target.href)
|| target.hash && target.href.replace(target.hash, '') === location.href.replace(location.hash, '')
|| target.getAttribute('data-ignore') === 'push'
) { return; }
if (!target ||
e.which > 1 ||
e.metaKey ||
e.ctrlKey ||
isScrolling ||
location.protocol !== target.protocol ||
location.host !== target.host ||
!target.hash && /#/.test(target.href) ||
target.hash && target.href.replace(target.hash, '') === location.href.replace(location.hash, '') ||
target.getAttribute('data-ignore') === 'push') { return; }
return target;
};
@ -158,7 +156,7 @@
}
if (direction === 'back' && !transitionFromObj.id) {
return PUSH.id = id;
return (PUSH.id = id);
}
transition = direction === 'back' ? transitionMap[transitionFromObj.transition] : transitionFromObj.transition;
@ -477,4 +475,4 @@
window.addEventListener('popstate', popstate);
window.PUSH = PUSH;
}();
}());

4
js/segmented-controllers.js

@ -4,7 +4,7 @@
* http://opensource.org/licenses/MIT
* ---------------------------------- */
!function () {
!(function () {
'use strict';
var getTarget = function (target) {
@ -58,4 +58,4 @@
});
window.addEventListener('click', function (e) { if (getTarget(e.target)) {e.preventDefault();} });
}();
}());

4
js/sliders.js

@ -5,7 +5,7 @@
* http://opensource.org/licenses/MIT
* ---------------------------------- */
!function () {
!(function () {
'use strict';
var pageX;
@ -127,4 +127,4 @@
window.addEventListener('touchmove', onTouchMove);
window.addEventListener('touchend', onTouchEnd);
}();
}());

8
js/toggles.js

@ -4,7 +4,7 @@
* http://opensource.org/licenses/MIT
* ---------------------------------- */
!function () {
!(function () {
'use strict';
var start = {};
@ -68,10 +68,10 @@
e.preventDefault();
if (distanceX < 0) {
return handle.style.webkitTransform = 'translate3d(0,0,0)';
return (handle.style.webkitTransform = 'translate3d(0,0,0)');
}
if (distanceX > offset) {
return handle.style.webkitTransform = 'translate3d(' + offset + 'px,0,0)';
return (handle.style.webkitTransform = 'translate3d(' + offset + 'px,0,0)');
}
handle.style.webkitTransform = 'translate3d(' + distanceX + 'px,0,0)';
@ -110,4 +110,4 @@
toggle = false;
});
}();
}());

Loading…
Cancel
Save