MCPcopy Create free account
hub / github.com/BloombergGraphics/whatiscode / rewrite

Function rewrite

modules/grabbag/grabbag.js:334–360  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

332 }
333
334 function rewrite() {
335
336 var speed = 1,
337 n = 0;
338
339 var articleTemplate = $("article").html(),
340 styleTemplate = $("style").html();
341
342 var article = $("article"),
343 style = $("style");
344
345 var timer = setInterval(function() {
346 if(read(n,n)) {
347 speed *= 1.01;
348 n += speed;
349 } else {
350 clearInterval(timer);
351 }
352 });
353
354 function read(n_article, n_style) {
355 article.html(articleTemplate.substr(0,n_article));
356 style.html(styleTemplate.substr(0,n_style));
357 return n_article <= articleTemplate.length || n_style <= styleTemplate.length;
358 }
359
360 }
361
362})();

Callers

nothing calls this directly

Calls 2

readFunction · 0.85
$Function · 0.50

Tested by

no test coverage detected