js: Use an IIFE.

This commit is contained in:
Florian Bruhin 2015-05-12 07:10:08 +02:00
parent 7a67af24f0
commit 3f21ac6b6a
2 changed files with 24 additions and 23 deletions

View File

@ -16,7 +16,7 @@ rules:
no-throw-literal: 2 no-throw-literal: 2
no-void: 2 no-void: 2
radix: 2 radix: 2
wrap-iife: 2 wrap-iife: [2, "inside"]
brace-style: [2, "1tbs", {"allowSingleLine": true}] brace-style: [2, "1tbs", {"allowSingleLine": true}]
comma-style: [2, "last"] comma-style: [2, "last"]
consistent-this: [2, "self"] consistent-this: [2, "self"]

View File

@ -81,7 +81,7 @@ function isElementInViewport(node) {
return boundingRect.top >= -20; return boundingRect.top >= -20;
} }
(function() {
var walker = document.createTreeWalker(document.body, 4, null); var walker = document.createTreeWalker(document.body, 4, null);
var node; var node;
var textNodes = []; var textNodes = [];
@ -105,3 +105,4 @@ if (el !== undefined) {
sel.removeAllRanges(); sel.removeAllRanges();
sel.addRange(range); sel.addRange(range);
} }
})();