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

3
docs/assets/js/fingerblast.js

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

9
js/.jshintrc

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

4
js/modals.js

@ -4,7 +4,7 @@
* http://opensource.org/licenses/MIT * http://opensource.org/licenses/MIT
* ---------------------------------- */ * ---------------------------------- */
!function () { !(function () {
'use strict'; 'use strict';
var findModals = function (target) { var findModals = function (target) {
@ -34,4 +34,4 @@
event.preventDefault(); // prevents rewriting url (apps can still use hash values in url) 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 * http://opensource.org/licenses/MIT
* ---------------------------------- */ * ---------------------------------- */
!function () { !(function () {
'use strict'; 'use strict';
var popover; var popover;
@ -25,7 +25,7 @@
popover.removeEventListener('webkitTransitionEnd', onPopoverHidden); popover.removeEventListener('webkitTransitionEnd', onPopoverHidden);
}; };
var backdrop = function () { var backdrop = (function () {
var element = document.createElement('div'); var element = document.createElement('div');
element.classList.add('backdrop'); element.classList.add('backdrop');
@ -37,7 +37,7 @@
}); });
return element; return element;
}(); }());
var getPopover = function (e) { var getPopover = function (e) {
var anchor = findPopovers(e.target); var anchor = findPopovers(e.target);
@ -81,4 +81,4 @@
window.addEventListener('touchend', showHidePopover); window.addEventListener('touchend', showHidePopover);
window.addEventListener('click', showHidePopover); window.addEventListener('click', showHidePopover);
}(); }());

28
js/push.js

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

4
js/segmented-controllers.js

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

4
js/sliders.js

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

8
js/toggles.js

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

Loading…
Cancel
Save