MediaWiki:Common.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ // Tables with class=zebra $(document).ready(function() { // the "className" includes all the classes so we must use re; // CSS is case-sensitive anyway, so there is no point ignoring case: var re = /\bzebra\b/, t = document.getElementsByTagName("TABLE"), n = t.length, r, nr; for (var i=0; i<n; i++) { if ( re.test(t[i].className)) { r = t[i].getElementsByTagName("TR"); nr = r.length; for (var j=1; j < nr; j+=2) { if (r[j].className) { r[j].className += " stripe";} else r[j].className = "stripe"; } } } });