diff options
author | Yorhel <git@yorhel.nl> | 2020-04-24 16:00:28 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-04-24 16:00:34 +0200 |
commit | 493866f8114dc785433e401b4e3203516be9f71b (patch) | |
tree | e71aad73b32e0fa909d0866cdf374c574b19cb11 /data | |
parent | 935d17e532e8d382e4db22f197a5f53a4cc94f98 (diff) |
v2rw/VN::Page: Remove old and unused code
There's a lot of unused code in VNDB::DB::{VN,Release} still, but I'll
not fiddle with that for now.
Diffstat (limited to 'data')
-rw-r--r-- | data/js/charops.js | 88 | ||||
-rw-r--r-- | data/js/main.js | 3 | ||||
-rw-r--r-- | data/js/misc.js | 223 | ||||
-rw-r--r-- | data/js/polls.js | 21 | ||||
-rw-r--r-- | data/js/vnreldropdown.js | 36 |
5 files changed, 0 insertions, 371 deletions
diff --git a/data/js/charops.js b/data/js/charops.js deleted file mode 100644 index 9478ca95..00000000 --- a/data/js/charops.js +++ /dev/null @@ -1,88 +0,0 @@ -var spoil, sexual, t; - - -// Fixes the commas between trait names and the hidden status of the entire row -function fixrow(c) { - var l = byName(byName(c, 'td')[1], 'span'); - var first = 1; - for(var i=0; i<l.length; i++) - if(!hasClass(l[i], 'ishidden')) { - first = 0; - break; - } - setClass(c, 'hidden', first); -} - - -function restripe() { - for(var i=0; i<t.length; i++) { - var b = byName(t[i], 'tbody'); - if(!b.length) - continue; - setClass(t[i], 'stripe', false); - var r = 1; - var rows = byName(b[0], 'tr'); - for(var j=0; j<rows.length; j++) { - if(hasClass(rows[j], 'traitrow')) - fixrow(rows[j]); - if(!hasClass(rows[j], 'nostripe') && !hasClass(rows[j], 'hidden')) - setClass(rows[j], 'odd', r++&1); - } - } -} - - -function setall() { - var k = byClass('charspoil'); - for(var i=0; i<k.length; i++) - setClass(k[i], 'ishidden', - !sexual && hasClass(k[i], 'sexual') ? true : - hasClass(k[i], 'charspoil_0') ? false : - hasClass(k[i], 'charspoil_-1') ? spoil > 1 : - hasClass(k[i], 'charspoil_1') ? spoil < 1 : spoil < 2); - - if(k.length) - restripe(); - return false; -} - - -function init() { - var opsParent = byId('charops'); - if(!opsParent) - return; - - t = byClass('table', 'stripe'); - - // Spoiler level - for(var i=0; i<3; i++) { - var splChk = byClass(opsParent, 'radio_spoil' + i)[0]; - if(!splChk) - continue; - - splChk.num = i; - splChk.onchange = function() { - spoil = this.num; - return setall(); - }; - if(splChk.checked) - spoil = i; - }; - - // Sexual toggle - var sexChk = byClass(opsParent, 'sexual_check'); - if(sexChk.length) { - sexChk = sexChk[0] - - sexChk.onchange = function() { - sexual = !sexual; - return setall(); - }; - sexual = sexChk.checked; - } - setall(); -} - - -if(byId('charops')) - init(); diff --git a/data/js/main.js b/data/js/main.js index fdb6a813..042c18e8 100644 --- a/data/js/main.js +++ b/data/js/main.js @@ -27,11 +27,8 @@ VARS = /*VARS*/; //include tabs.js // Page/functionality-specific widgets -//include vnreldropdown.js -//include charops.js //include filter.js //include misc.js -//include polls.js // VN editing (/v+/edit) //include vnrel.js diff --git a/data/js/misc.js b/data/js/misc.js index ccacd0ee..9c151eae 100644 --- a/data/js/misc.js +++ b/data/js/misc.js @@ -1,226 +1,3 @@ -function ulist_redirect(type, path, formcode, args) { - var r = new RegExp('/('+type+'[0-9]+).*$'); - location.href = location.href.replace(r, '/$1')+path - +'?formcode='+formcode - +';ref='+encodeURIComponent(location.pathname+location.search) - +';'+args; -} - - -function vote_validate(s) { - if(s < 1) - s = prompt('Please input your vote as a number between 1 and 10. One digit after the decimal is allowed, for example: 8.6 or 7.3.', ''); - if(!s) - return 0; - s = s.replace(',', '.'); - if(!s.match(/^([1-9]|10)([\.,][0-9])?$/) || s > 10 || s < 1) { - alert('Invalid number.'); - return 0; - } - if(s == 1 && !confirm('You are about to give this visual novel a 1 out of 10.'+ - ' This is a rather extreme rating, meaning this game has absolutely nothing to offer, and that it\'s the worst game you have ever played.'+ - ' Are you really sure this visual novel matches that description?')) - return 0; - if(s == 10 && !confirm('You are about to give this visual novel a 10 out of 10.'+ - ' This is a rather extreme rating, meaning this is one of the best visual novels you\'ve ever played and it\'s unlikely that any other game could ever be better than this one.'+ - ' It is generally a bad idea to have more than three games in your vote list with this rating, choose carefully!')) - return 0; - return s; -} - - -// VN Voting (/v+) -if(byId('votesel')) - byId('votesel').onchange = function() { - var s = this.options[this.selectedIndex].value; - if(s == -3) - return; - if(s != -1) - s = vote_validate(s); - if(!s) - this.selectedIndex = 0; - else - ulist_redirect('v', '/vote', this.name, 'v='+s); - }; - - -// VN voting from list (/u+/votes) -if(byId('batchvotes')) - byId('batchvotes').onchange = function() { - var s = this.options[this.selectedIndex].value; - if(s == -2) - return; - if(s != -1) - s = vote_validate(s); - if(!s) { - this.selectedIndex = 0; - return; - } - this.options[this.selectedIndex].value = s; - var frm = this; - while(frm.nodeName.toLowerCase() != 'form') - frm = frm.parentNode; - frm.submit(); - }; - - -// VN Wishlist dropdown box (/v+) -if(byId('wishsel')) - byId('wishsel').onchange = function() { - if(this.selectedIndex != 0) - ulist_redirect('v', '/wish', this.name, ';s='+this.options[this.selectedIndex].value); - }; - - -// 'more' / 'less' summarization of some boxes on VN pages -(function(){ - function set(o, h) { - var a = tag('a', {href:'#', summarizeOn:false}, ''); - var toggle = function() { - a.summarizeOn = !a.summarizeOn; - o.style.maxHeight = a.summarizeOn ? h+'px' : null; - o.style.overflowY = a.summarizeOn ? 'hidden' : null; - setText(a, a.summarizeOn ? '⇓ more ⇓' : '⇑ less ⇑'); - return false; - }; - a.onclick = toggle; - var t = tag('div', {'class':'summarize_more'}, a); - l[i].parentNode.insertBefore(t, l[i].nextSibling); - toggle(); - } - - var l = byClass(document, 'summarize'); - - for(var i=0; i<l.length; i++) { - var h = Math.floor(l[i].getAttribute('data-summarize-height') || 150); - if(l[i].offsetHeight > h+100) - set(l[i], h); - } -})(); - - -// make some fields readonly when patch flag is set and hide uncensored -// checkbox when age rating isn't 18+ (/r+/edit) -(function(){ - function sync() { - byId('doujin').disabled = - byId('resolution').disabled = - byId('voiced').disabled = - byId('ani_story').disabled = - byId('ani_ero').disabled = - byId('engine').disabled = - byId('engine_oth').disabled = - byId('patch').checked; - - setClass( - byId('uncensored').parentNode.parentNode, - 'hidden', - byId('minage').options[byId('minage').selectedIndex].value != 18 - ); - }; - if(byId('jt_box_rel_geninfo')) { - sync(); - byId('patch').onclick = byId('minage').onclick = sync; - } -})(); - - -// Release edit engine selection (/r+/edit) -(function(){ - var en = byId('engine'); - var en_other = byId('engine_oth'); - if(en && en_other) { - en.onchange = function() { - setClass(en_other, 'hidden', en.options[en.selectedIndex].value != '_other_'); - return true; - }; - } -})(); - - -// Batch edit dropdown box (/u+/wish) -if(byId('batchedit')) - byId('batchedit').onchange = function() { - if(this.selectedIndex == 0) - return true; - var frm = this; - while(frm.nodeName.toLowerCase() != 'form') - frm = frm.parentNode; - frm.submit(); - }; - - -// collapse/expand row groups (/u+/list) -(function(){ - var table = byId('expandall'); - if(!table) - return; - while(table.nodeName.toLowerCase() != 'table') - table = table.parentNode; - var heads = byClass(table, 'td', 'collapse_but'); - var allhid = false; - - function sethid(l, h, hid) { - var i; - for(i=0; i<l.length; i++) { - setClass(l[i], 'hidden', hid); - // Set the hidden class on the input checkbox, if it exists. This - // prevents the "select all" functionality from selecting it if the row - // is not visible. - var sel = byName(l[i], 'input')[0]; - if(sel) - setClass(sel, 'hidden', hid); - } - for(i=0; i<h.length; i++) - setText(h[i], allhid ? collapsed_icon : expanded_icon); - } - - function alltoggle() { - allhid = !allhid; - setText(byId('expandall'), allhid ? collapsed_icon : expanded_icon); - sethid(byClass(table, 'tr', 'collapse'), heads, allhid); - return false; - } - - function singletoggle() { - var l = byClass(table, 'tr', 'collapse_'+this.id); - sethid(l, [this], !hasClass(l[0], 'hidden')); - } - - byId('expandall').onclick = alltoggle; - for(var i=0; i<heads.length; i++) - heads[i].onclick = singletoggle; - alltoggle(); -})(); - - -// external links dropdown for releases (/v+) -(function(){ - var l = byClass('rllinks'); - for(var i=0; i<l.length; i++) { - var o = byName(l[i].parentNode, 'ul')[0]; - if(o) { - l[i].links_ul = l[i].parentNode.removeChild(o); - setClass(l[i].links_ul, 'hidden', false); - ddInit(l[i], 'left', function(acr) { - return acr.links_ul; - }); - if(l[i].href.match(/#$/)) { - l[i].onclick = function() { return false; }; - } - } - } -})(); - -// set note input box (/u+/list) -if(byId('not') && byId('vns')) - byId('vns').onchange = function () { - if(this.options[this.selectedIndex].value == 999) - byId('not').value = prompt('Set notes (leave empty to remove note)', ''); - return true; - }; - - // expand/collapse release listing (/p+) (function(){ var lnk = byId('expandprodrel'); diff --git a/data/js/polls.js b/data/js/polls.js deleted file mode 100644 index 94a0bba2..00000000 --- a/data/js/polls.js +++ /dev/null @@ -1,21 +0,0 @@ -// Discussion board polls -if(byId('jt_box_postedit') && byId('poll')) { - var c = byId('poll'); - var parentNode = function(n, tag) { - while(n && n.nodeName.toLowerCase() != tag) - n = n.parentNode; - return n; - }; - var show = function(v) { - setClass(parentNode(byId('poll_question'), 'tr'), 'hidden', !v); - setClass(parentNode(byId('poll_options'), 'tr'), 'hidden', !v); - setClass(parentNode(byId('poll_max_options'), 'tr'), 'hidden', !v); - setClass(parentNode(byId('poll_preview'), 'tr'), 'hidden', !v); - setClass(parentNode(byId('poll_recast'), 'tr'), 'hidden', !v); - }; - c.onclick = function() { - show(this.checked); - return true; - }; - show(c.checked); -} diff --git a/data/js/vnreldropdown.js b/data/js/vnreldropdown.js deleted file mode 100644 index 16a1dbcd..00000000 --- a/data/js/vnreldropdown.js +++ /dev/null @@ -1,36 +0,0 @@ -function dropdown(lnk) { - var relid = lnk.id.substr(6); - var st = getText(lnk); - if(st == 'Loading...') - return null; - - var o = tag('ul', null); - for(var i=0; i<VARS.rlist_status.length; i++) { - var val = VARS.rlist_status[i]; - o.appendChild(tag('li', st == val[1] - ? tag('i', val[1]) - : tag('a', {href:'#', rl_rid:relid, rl_act:val[0], onclick:change}, val[1]))); - } - if(st != '--') - o.appendChild(tag('li', tag('a', {href:'#', rl_rid:relid, rl_act:-1, onclick:change}, 'Remove from list'))); - - return tag('div', o); -} - -function change() { - var lnk = byId('rlsel_'+this.rl_rid); - var code = getText(byId('vnrlist_code')); - var act = this.rl_act; - ddHide(); - setContent(lnk, tag('b', {'class': 'grayedout'}, 'Loading...')); - ajax('/xml/rlist.xml?formcode='+code+';id='+this.rl_rid+';e='+act, function(hr) { - setText(lnk, act == -1 ? '--' : VARS.rlist_status[act][1]); - }); - return false; -} - -if(byId('vnrlist_code')) { - var l = byClass('a', 'vnrlsel'); - for(var i=0; i<l.length; i++) - ddInit(l[i], 'left', dropdown); -} |