diff options
author | Yorhel <git@yorhel.nl> | 2008-11-22 17:01:07 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2008-11-22 17:01:07 +0100 |
commit | f4e62131b577b740147d58d1d16a490ac2fc57aa (patch) | |
tree | 54d744562c0ad89fd802b56a0a265d3df0922ca0 /static | |
parent | 0dd7477ce4334d04971e0fb1f29a34a1d097c7c9 (diff) |
Added category editor
Copied a lot from 1.x, doesn't look very nice, either...
Diffstat (limited to 'static')
-rw-r--r-- | static/f/forms.js | 58 | ||||
-rw-r--r-- | static/f/script.js | 4 | ||||
-rw-r--r-- | static/f/style.css | 43 |
3 files changed, 105 insertions, 0 deletions
diff --git a/static/f/forms.js b/static/f/forms.js new file mode 100644 index 00000000..8b3c29d0 --- /dev/null +++ b/static/f/forms.js @@ -0,0 +1,58 @@ +// various form functions +// called by script.js + + + /************************\ + * C A T E G O R I E S * + \************************/ + + +function catLoad() { + var i; + var cats=[]; + var ct = x('categories'); + var l = ct.value.split(','); + for(i=0;i<l.length;i++) + cats[l[i].substr(0,3)] = Math.floor(l[i].substr(3,1)); + + l = x('jt_box_categories').getElementsByTagName('a'); + for(i=0;i<l.length;i++) { + if(l[i].id.substr(0, 4) != 'cat_') + continue; + catSet(l[i].id.substr(4), cats[l[i].id.substr(4)]||0); + l[i].onclick = function() { + var c = this.id.substr(4); + if(!cats[c]) cats[c] = 0; + if(c.substr(0,1) == 'p' || c == 'gaa' || c == 'gab' || c.substr(0,1) == 'h' || c.substr(0,1) == 'l' || c.substr(0,1) == 't') { + if(cats[c]++) + cats[c] = 0; + } else if(++cats[c] == 4) + cats[c] = 0; + catSet(c, cats[c]); + + // has to be ordered before serializing! + var r;l=[];i=0; + for(r in cats) + l[i++] = r; + l = l.sort(); + r=''; + for(i=0;i<l.length;i++) + if(cats[l[i]] > 0) + r+=(r?',':'')+l[i]+cats[l[i]]; + ct.value = r; + return false; + }; + } +} + +function catSet(id, rnk) { + // doesn't work very nice with skins... + var c = rnk == 0 ? '' : + rnk == 1 ? '#0c0' : + rnk == 2 ? '#cc0' : '#c00'; + x('b_'+id).style.color = c; + x('cat_'+id).style.color = c; + x('b_'+id).innerHTML = rnk; +} + + diff --git a/static/f/script.js b/static/f/script.js index dd7d41b5..52a0a60a 100644 --- a/static/f/script.js +++ b/static/f/script.js @@ -202,6 +202,10 @@ DOMLoad(function() { // Javascript tabs jtInit(); + // forms.js + if(x('categories')) + catLoad(); + // spam protection on all forms if(document.forms.length >= 1) for(i=0; i<document.forms.length; i++) diff --git a/static/f/style.css b/static/f/style.css index 653349ce..f2152aee 100644 --- a/static/f/style.css +++ b/static/f/style.css @@ -542,6 +542,49 @@ div.vndescription p { +/***** VN edit *****/ + +#jt_box_categories ul { + list-style-type: none; + padding: 0; + margin: 0; +} +#jt_box_categories li { + display: block; + width: 170px; + float: left; + clear: none; + font-weight: bold; +} +#jt_box_categories li li { + display: list-item; + width: auto; + float: none; + clear: left; + font-weight: normal; + padding: 0 0 0 20px; + margin: 0; + cursor: pointer; + list-style-type: none; + /*background: url(/f/select.png) no-repeat;*/ +} +a.help { + vertical-align: super; + font-size: 6pt; + text-decoration: none; + font-weight: bold; + padding-left: 1px; +} +form #jt_box_categories li li { padding: 0; background: none; } +form #jt_box_categories li li b { width: 13px; font-weight: bold; } +#maincontent form #jt_box_categories li li a { color: #ccc; text-decoration: none; display: block; width: 160px; border: none } +#jt_box_categories li li.inc { background-position: 0px -16px; color: #090; } +#jt_box_categories li li.exc { background-position: 0px -33px; color: #900; } + + + + + /***** Producer page/list *******/ .producerpage p.description { |