diff options
author | Yorhel <git@yorhel.nl> | 2012-01-25 13:59:43 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2012-01-25 13:59:43 +0100 |
commit | 6f33c4786786978ee785bc3e5020cef5f66254ef (patch) | |
tree | 6f6de09886a4baeacbae9e5e8982e4415b881dc7 /data | |
parent | 616ddb08bf4f10560229bee326eb89ce1bef7488 (diff) |
Do most of the table striping in CSS
Using CSS3 selectors. This is a more elegant approach, and since browser
support for CSS3 selectors isn't as crap as it used to be I can finally
make use of them.
Diffstat (limited to 'data')
-rw-r--r-- | data/script.js | 24 | ||||
-rw-r--r-- | data/style.css | 4 |
2 files changed, 3 insertions, 25 deletions
diff --git a/data/script.js b/data/script.js index 5c8b7ead..011f0b94 100644 --- a/data/script.js +++ b/data/script.js @@ -1059,7 +1059,6 @@ function scrAdd(id, nsfw, rel) { ) ); byId('scr_table').appendChild(tr); - scrStripe(); return tr; } @@ -1091,13 +1090,6 @@ function scrLast() { tag('input', {type:'button', value:mt('_vnedit_scr_addbut'), 'class':'submit', onclick:scrUpload}) ) )); - scrStripe(); -} - -function scrStripe() { - var l = byName(byId('scr_table'), 'tr'); - for(var i=0; i<l.length; i++) - setClass(l[i], 'odd', i%2==0); } function scrCheckStatus() { @@ -1275,7 +1267,6 @@ function tglLoad() { byId('tagmod_add').onclick = tglAdd; // JS'ify the voting bar and spoiler setting - tglStripe(); var trs = byName(byId('tagtable'), 'tr'); for(var i=0; i<trs.length; i++) { if(hasClass(trs[i], 'tagmod_cat')) @@ -1397,17 +1388,10 @@ function tglAdd() { tag('td', {'class':'tc_allspoil'}, ' '), tag('td', {'class':'tc_allwho'}, '') )); - tglStripe(); tglSerialize(); }); } -function tglStripe() { - var l = byName(byId('tagtable'), 'tr'); - for(var i=0; i<l.length; i++) - setClass(l[i], 'odd', i%2); -} - function tglSerialize() { var r = []; var l = byName(byId('tagtable'), 'tr'); @@ -1456,7 +1440,6 @@ function rvnAdd(id, title) { tag('td', {'class':'tc_title'}, 'v'+id+':', tag('a', {href:'/v'+id}, shorten(title, 40))), tag('td', {'class':'tc_rm'}, tag('a', {href:'#', onclick:rvnDel}, mt('_js_remove'))) )); - rvnStripe(); rvnEmpty(); } @@ -1467,7 +1450,6 @@ function rvnDel() { tr.parentNode.removeChild(tr); rvnEmpty(); rvnSerialize(); - rvnStripe(); return false; } @@ -1479,12 +1461,6 @@ function rvnEmpty() { tbl.removeChild(byId('rvn_tr_none')); } -function rvnStripe() { - var l = byName(byId('vn_tbl'), 'tr'); - for(var i=0; i<l.length; i++) - setClass(l[i], 'odd', i%2); -} - function rvnFormAdd() { var txt = byId('vn_input'); var lnk = byId('vn_add'); diff --git a/data/style.css b/data/style.css index 6d9c1c53..0513a95c 100644 --- a/data/style.css +++ b/data/style.css @@ -5,9 +5,11 @@ a { color: $link$; text-decoration: none; } a:hover { border-bottom: 1px dotted $maintext$; } table { border-collapse: collapse; } table td { vertical-align: top; padding: 3px; } -table tr.odd { background: url($_boxbg$) repeat; } img { border: none; } +table tr.odd, +table.stripe tbody tr:nth-child(odd):not(.nostripe) { background: url($_boxbg$) repeat; } + #bgright { position: absolute; top: 0px; right: 0px; $_bgright$ } #header { position: absolute; top: 80px; left: 400px; } #header h1, #header h1 a { |