/usr/lib/python2.7/dist-packages/klaus/static/klaus.js is in python-klaus 1.2.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | var forEach = function(collection, func) {
for(var i = 0; i < collection.length; ++i) {
func(collection[i]);
}
}
/* General collapse/expand/toggle framework. Used for hiding diffs in commits */
var toggler = {
expand: function(elem) {
elem.className = elem.className.replace("collapsed", "");
},
collapse: function(elem) {
if (!/collapsed/.test(elem.className)) {
elem.className += " collapsed";
}
},
collapseAll: function(selector) {
forEach(document.querySelectorAll(selector), toggler.collapse);
},
expandAll: function(selector) {
forEach(document.querySelectorAll(selector), toggler.expand);
}
};
/* Line highlighting logic for diffs */
var highlight_linenos = function(opts) {
var links = document.querySelectorAll(opts.linksSelector),
currentHash = location.hash;
forEach(links, function(a) {
var lineno = a.getAttribute('href').substr(1),
associatedLine = document.getElementById(lineno);
var highlight = function() {
a.className = 'highlight-line';
associatedLine.className = 'highlight-line';
currentHighlight = a;
}
var unhighlight = function() {
if (a.getAttribute('href') != location.hash) {
a.className = '';
associatedLine.className = '';
}
}
a.onmouseover = associatedLine.onmouseover = highlight;
a.onmouseout = associatedLine.onmouseout = unhighlight;
// Initial highlight
if (a.getAttribute('href') == location.hash) {
highlight();
}
});
window.onpopstate = function() {
if (currentHash) {
forEach(document.querySelectorAll('a[href="' + currentHash + '"]'),
function(e) { e.onmouseout() })
}
if (location.hash) {
forEach(document.querySelectorAll('a[href="' + location.hash + '"]'),
function(e) { e.onmouseover() });
currentHash = location.hash;
}
};
}
|