diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Add stable markup hooks for site themes
Diffstat (limited to 'assets/cgit.js')
| -rw-r--r-- | assets/cgit.js | 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 20 insertions, 6 deletions
diff --git a/assets/cgit.js b/assets/cgit.js index 78adfd0..2c0a828 100644 --- a/assets/cgit.js +++ b/assets/cgit.js @@ -54,12 +54,13 @@ function render_age(element, age) { } /* - * Measures every age on the page against the clock and books the next pass. - * There is no point coming back before the finest unit on the page could - * change, so a page already counted in hours is left alone for minutes and - * one counted in years for a day. + * Measures every age on the page against the clock and returns how many + * seconds may pass before one of them could read differently. There is no + * point coming back before the finest unit on the page could change, so a + * page already counted in hours is left alone for minutes and one counted in + * years for a day. */ -function refresh_ages() { +function update_ages() { var bucket, elements, i, age; var delay = 24 * 3600; var now = Math.round(new Date().getTime() / 1000); @@ -82,11 +83,19 @@ function refresh_ages() { } } - window.setTimeout(refresh_ages, delay * 1000); + return delay; +} + +function refresh_ages() { + window.setTimeout(refresh_ages, update_ages() * 1000); } document.addEventListener("DOMContentLoaded", refresh_ages, false); +// A site script that adds rows of its own can ask for one pass over them. +window.cgit = window.cgit || {}; +window.cgit.updateAges = update_ages; + })(); /* @@ -139,4 +148,9 @@ function place_bar() { document.addEventListener("DOMContentLoaded", place_bar, false); window.addEventListener("hashchange", place_bar, false); +// A site script that moves the lines about can ask for the bar to be laid +// again. +window.cgit = window.cgit || {}; +window.cgit.highlightLines = place_bar; + })(); |
