summaryrefslogtreecommitdiff
path: root/static/f
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-05-31 10:44:36 +0200
committerYorhel <git@yorhel.nl>2009-05-31 10:44:36 +0200
commit82aea85bad2913a1e9f25751cbe998dc671bd520 (patch)
treec535850205aa8124730e2150b6dcb70c774d1078 /static/f
parentd6eb18f061870fde4c7bdce212f976e48049cd50 (diff)
Option to expand/collapse edit summaries on history browser
Makes use of cookies to store the users' preference. Might be a good idea to store this in the DB for logged in users, together with the tagspoil cookie.
Diffstat (limited to 'static/f')
-rw-r--r--static/f/script.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/static/f/script.js b/static/f/script.js
index 48002287..8cc35118 100644
--- a/static/f/script.js
+++ b/static/f/script.js
@@ -606,6 +606,32 @@ DOMLoad(function() {
l[i].onmouseout = function() { this.className = 'spoiler' };
}
+ // expand/collapse edit summaries on */hist
+ if(x('history_comments')) {
+ setcomment = function() {
+ var e = readCookie('histexpand') == 1;
+ var l = x('history_comments');
+ l.innerHTML = e ? 'collapse' : 'expand';
+ while(l.nodeName.toLowerCase() != 'table')
+ l = l.parentNode;
+ l = l.getElementsByTagName('tr');
+ for(var i=0;i<l.length;i++)
+ //alert(l[i].className);
+ if(l[i].className.indexOf('editsum') >= 0) {
+ if(!e && l[i].className.indexOf('hidden') < 0)
+ l[i].className += ' hidden';
+ if(e && l[i].className.indexOf('hidden') >= 0)
+ l[i].className = l[i].className.replace(/hidden/, '');
+ }
+ };
+ setcomment();
+ x('history_comments').onclick = function () {
+ setCookie('histexpand', readCookie('histexpand') == 1 ? 0 : 1);
+ setcomment();
+ return false;
+ };
+ }
+
// Are we really vndb?
if(location.hostname != 'vndb.org') {
var d = document.createElement('div');