Skip to content

Commit

Permalink
custom class name to highlight can be provided as an argument to the …
Browse files Browse the repository at this point in the history
…reset() function
  • Loading branch information
asvd committed Jun 9, 2016
1 parent aa35669 commit 80e81e1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions microlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@
_3px_0px_5 = '3px 0px 5',
brace = ')',

el, // current microlighted element to run through
i,
microlighted,
el; // current microlighted element to run through

// dynamic set of nodes to highlight
microlighted = _document.getElementsByClassName('microlight');


var reset = function(i) {
var reset = function(cls) {
// nodes to highlight
microlighted = _document.getElementsByClassName(cls||'microlight');

for (i = 0; el = microlighted[i++];) {
var text = el.textContent,
pos = 0, // current position
Expand Down Expand Up @@ -201,7 +204,7 @@
if (_document.readyState == 'complete') {
reset();
} else {
_window.addEventListener('load', reset, 0);
_window.addEventListener('load', function(){reset()}, 0);
}
}));

0 comments on commit 80e81e1

Please sign in to comment.