diff options
author | Yorhel <git@yorhel.nl> | 2020-07-21 09:07:22 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-07-21 09:07:22 +0200 |
commit | 4e52a94f33964a8b7f49b2f02d82d0e3189b7bf7 (patch) | |
tree | 2415c0e50b0b6d40b92af7adda117032f6f322d3 /data | |
parent | 7c6c8cf206296829bc602b3072f7ce6084f05906 (diff) |
Delete old producer edit form + a few more cleanups
Diffstat (limited to 'data')
-rw-r--r-- | data/js/main.js | 4 | ||||
-rw-r--r-- | data/js/misc.js | 19 | ||||
-rw-r--r-- | data/js/prodrel.js | 108 | ||||
-rw-r--r-- | data/js/tabs.js | 49 | ||||
-rw-r--r-- | data/style.css | 43 |
5 files changed, 6 insertions, 217 deletions
diff --git a/data/js/main.js b/data/js/main.js index f335f1f5..8f3f6ca2 100644 --- a/data/js/main.js +++ b/data/js/main.js @@ -31,13 +31,9 @@ VARS.resolutions = [ //include dropdown.js //include dateselector.js //include dropdownsearch.js -//include tabs.js // Page/functionality-specific widgets //include filter.js //include misc.js -// Producer editing (/p+/edit) -//include prodrel.js - // @license-end diff --git a/data/js/misc.js b/data/js/misc.js index 9c151eae..9658bccf 100644 --- a/data/js/misc.js +++ b/data/js/misc.js @@ -1,22 +1,3 @@ -// expand/collapse release listing (/p+) -(function(){ - var lnk = byId('expandprodrel'); - if(!lnk) - return; - function setexpand() { - var exp = !(getCookie('prodrelexpand') == 1); - setText(lnk, exp ? 'collapse' : 'expand'); - setClass(byId('prodrel'), 'collapse', !exp); - }; - lnk.onclick = function () { - setCookie('prodrelexpand', getCookie('prodrelexpand') == 1 ? 0 : 1); - setexpand(); - return false; - }; - setexpand(); -})(); - - // search tabs (function(){ function click() { diff --git a/data/js/prodrel.js b/data/js/prodrel.js deleted file mode 100644 index ec6082e3..00000000 --- a/data/js/prodrel.js +++ /dev/null @@ -1,108 +0,0 @@ -function prrLoad() { - // read the current relations - var rels = byId('prodrelations').value.split('|||'); - for(var i=0; i<rels.length && rels[0].length>1; i++) { - var rel = rels[i].split(',', 3); - prrAdd(rel[0], rel[1], rel[2]); - } - prrEmpty(); - - // bind the add-link - byName(byClass(byId('relation_new'), 'td', 'tc_add')[0], 'a')[0].onclick = prrFormAdd; - - // dropdown - dsInit(byName(byClass(byId('relation_new'), 'td', 'tc_prod')[0], 'input')[0], '/xml/producers.xml?q=', function(item, tr) { - tr.appendChild(tag('td', { style: 'text-align: right; padding-right: 5px'}, 'p'+item.getAttribute('id'))); - tr.appendChild(tag('td', shorten(item.firstChild.nodeValue, 40))); - }, function(item) { - return 'p'+item.getAttribute('id')+':'+item.firstChild.nodeValue; - }, prrFormAdd); -} - -function prrAdd(rel, pid, title) { - var sel = tag('select', {onchange: prrSerialize}); - var ops = byName(byClass(byId('relation_new'), 'td', 'tc_rel')[0], 'select')[0].options; - for(var i=0; i<ops.length; i++) - sel.appendChild(tag('option', {value: ops[i].value, selected: ops[i].value==rel}, getText(ops[i]))); - - byId('relation_tbl').appendChild(tag('tr', {id:'relation_tr_'+pid}, - tag('td', {'class':'tc_prod' }, 'p'+pid+':', tag('a', {href:'/p'+pid}, shorten(title, 40))), - tag('td', {'class':'tc_rel' }, sel), - tag('td', {'class':'tc_add' }, tag('a', {href:'#', onclick:prrDel}, 'remove')) - )); - - prrEmpty(); -} - -function prrEmpty() { - var tbl = byId('relation_tbl'); - if(byName(tbl, 'tr').length < 1) - tbl.appendChild(tag('tr', {id:'relation_tr_none'}, tag('td', {colspan:4}, 'Nothing selected.'))); - else if(byId('relation_tr_none')) - tbl.removeChild(byId('relation_tr_none')); -} - -function prrSerialize() { - var r = []; - var trs = byName(byId('relation_tbl'), 'tr'); - for(var i=0; i<trs.length; i++) { - if(trs[i].id == 'relation_tr_none') - continue; - var rel = byName(byClass(trs[i], 'td', 'tc_rel')[0], 'select')[0]; - r[r.length] = [ - rel.options[rel.selectedIndex].value, - trs[i].id.substr(12), - getText(byName(byClass(trs[i], 'td', 'tc_prod')[0], 'a')[0]) - ].join(','); - } - byId('prodrelations').value = r.join('|||'); -} - -function prrDel() { - var tr = this; - while(tr.nodeName.toLowerCase() != 'tr') - tr = tr.parentNode; - byId('relation_tbl').removeChild(tr); - prrSerialize(); - prrEmpty(); - return false; -} - -function prrFormAdd() { - var relnew = byId('relation_new'); - var txt = byName(byClass(relnew, 'td', 'tc_prod')[0], 'input')[0]; - var sel = byName(byClass(relnew, 'td', 'tc_rel')[0], 'select')[0]; - var lnk = byName(byClass(relnew, 'td', 'tc_add')[0], 'a')[0]; - var input = txt.value; - - if(!input.match(/^p[0-9]+/)) { - alert('Producer textbox should start with an ID (e.g. "p7:")'); - return false; - } - - txt.disabled = sel.disabled = true; - txt.value = 'Loading...'; - setText(lnk, 'Loading...'); - - ajax('/xml/producers.xml?q='+encodeURIComponent(input), function(hr) { - txt.disabled = sel.disabled = false; - txt.value = ''; - setText(lnk, 'add'); - - var items = hr.responseXML.getElementsByTagName('item'); - if(items.length < 1) - return alert('Producer not found'); - - var id = items[0].getAttribute('id'); - if(byId('relation_tr_'+id)) - return alert('Producer already selected!'); - - prrAdd(sel.options[sel.selectedIndex].value, id, items[0].firstChild.nodeValue); - sel.selectedIndex = 0; - prrSerialize(); - }); - return false; -} - -if(byId('prodrelations')) - prrLoad(); diff --git a/data/js/tabs.js b/data/js/tabs.js deleted file mode 100644 index 470bd077..00000000 --- a/data/js/tabs.js +++ /dev/null @@ -1,49 +0,0 @@ -/* Javascript tabs. General usage: - * - * <ul id="jt_select"> - * <li><a href="#<name>" id="jt_sel_<name>">..</a></li> - * .. - * </ul> - * - * Can then be used to show/hide the following box: - * - * <div id="jt_box_<name>"> .. </div> - * - * The name of the active box will be set to and (at page load) read from - * location.hash. The parent node of the active link will get the 'tabselected' - * class. A link with the special name "all" will display all boxes associated - * with jt_select links. - * - * Only one jt_select list-of-tabs can be used on a single page. - */ -var links = byId('jt_select') ? byName(byId('jt_select'), 'a') : []; - -function init() { - var sel; - var first; - for(var i=0; i<links.length; i++) { - links[i].onclick = function() { set(this.id); return false }; - if(!first) - first = links[i].id; - if(location.hash && links[i].id == 'jt_sel_'+location.hash.substr(1)) - sel = links[i].id; - } - if(first) - set(sel||first, 1); -} - -function set(which, nolink) { - which = which.substr(7); - - for(var i=0; i<links.length; i++) { - var name = links[i].id.substr(7); - if(name != 'all') - setClass(byId('jt_box_'+name), 'hidden', which != 'all' && which != name); - setClass(links[i].parentNode, 'tabselected', name == which); - } - - if(!nolink) - location.href = '#'+which; -} - -init(); diff --git a/data/style.css b/data/style.css index 81076de0..7f4a59a0 100644 --- a/data/style.css +++ b/data/style.css @@ -589,17 +589,6 @@ div.producerbrowse { padding-bottom: 10px } .producerbrowse ul li abbr { margin-right: 5px; margin-top: 1px; } -/***** Producer edit *****/ - -#jt_box_pedit_rel table { margin-bottom: 10px; } -#jt_box_pedit_rel h2 { margin: 0 0 3px 0px; } -#jt_box_pedit_rel td { padding: 1px 2px; vertical-align: middle; } -#jt_box_pedit_rel td.tc_prod { width: 290px; padding-left: 10px } -#jt_box_pedit_rel td.tc_add { width: 40px; text-align: left } -#jt_box_pedit_rel td.tc_prod input { width: 280px; } -#jt_box_pedit_rel td.tc_rel select { width: 130px; } - - /***** Release page *****/ @@ -711,35 +700,15 @@ div.charsum_list .charsum_bubble { /***** Staff edit *****/ -#jt_box_vn_cast #cast_import { clear: right; float: right; } -#jt_box_vn_cast table, -#jt_box_vn_staff table { margin-bottom: 10px; margin-left: 20px } -#jt_box_vn_cast h2, -#jt_box_vn_staff h2 { margin: 0 0 3px 0px; } -#jt_box_vn_cast td, -#jt_box_vn_staff td { padding: 1px 2px; vertical-align: middle; } -#jt_box_vn_cast td.tc_role, -#jt_box_vn_cast td.tc_role select, -#jt_box_vn_staff td.tc_role, -#jt_box_vn_staff td.tc_role select { width: 120px } -#jt_box_vn_cast td.tc_staff, -#jt_box_vn_staff td.tc_staff, -.staffedit td.tc_name, -.staffedit td.tc_original { width: 200px } -#jt_box_vn_cast td.tc_staff input, -#jt_box_vn_staff td.tc_staff input, -.staffedit td.tc_name input, -.staffedit td.tc_original input { width: 200px } -#jt_box_vn_cast td.tc_note, -#jt_box_vn_cast td.tc_note input, -#jt_box_vn_staff td.tc_note, -#jt_box_vn_staff td.tc_note input { width: 250px } -#jt_box_vn_cast td.tc_add, -#jt_box_vn_staff td.tc_add, -.staffedit td.tc_add { width: 40px; text-align: left; white-space: nowrap } +.staffedit td.tc_name, +.staffedit td.tc_original { width: 200px } +.staffedit td.tc_name input, +.staffedit td.tc_original input { width: 200px } +.staffedit td.tc_add { width: 40px; text-align: left; white-space: nowrap } .staffedit table.names td { padding: 1px 2px; vertical-align: middle; } .staffedit table.names tr.alias_new td { padding-top: 8px } + /***** Documentation pages *****/ .docs { padding: 0 15% 20px 15%; line-height: 1.4 } |