summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-01-19 13:12:17 +0100
committerYorhel <git@yorhel.nl>2021-01-20 09:06:12 +0100
commit9d1727c77d4b00d2a861c2c31f93d3aebff2f2d9 (patch)
tree61d77e79edb2590c06cca80c8d029d8630a5aabc /data
parentb35af5ba52f3bceb603e8c7dda10d4abb84c6bd9 (diff)
v2rw: Rewrite done, time to clean up old v2 code
Yay! There are no more request handlers in the VNDB::* namespace and no more Javascript in data/js/. This cleans up a lot of old legacy code that wasn't fun to maintain.
Diffstat (limited to 'data')
-rw-r--r--data/js/dateselector.js84
-rw-r--r--data/js/dropdown.js91
-rw-r--r--data/js/dropdownsearch.js204
-rw-r--r--data/js/filter.js727
-rw-r--r--data/js/lib.js179
-rw-r--r--data/js/main.js39
-rw-r--r--data/js/misc.js25
7 files changed, 0 insertions, 1349 deletions
diff --git a/data/js/dateselector.js b/data/js/dateselector.js
deleted file mode 100644
index ed96ab8a..00000000
--- a/data/js/dateselector.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Date selector widget for the 'release date'-style dates, with support for
- * TBA and unknown month or day. Usage:
- *
- * <input type="hidden" class="dateinput" .. />
- *
- * Will add a date selector to the HTML at that place, and automatically
- * read/write the value of the hidden field. Alternative usage:
- *
- * var obj = dateLoad(ref, serfunc);
- *
- * If 'ref' is set, it will behave as above with 'ref' being the input object.
- * Otherwise it will return the widget object. The setfunc, if set, will be
- * called whenever the date widget is focussed or its value is changed.
- *
- * The object returned by dateLoad() can be used as follows:
- * obj.date_val: Always contains the currently selected date.
- * obj.dateSet(val): Change the selected date
- */
-function load(obj, serfunc) {
- var i;
- var selops = {style: 'width: 70px', onfocus:serfunc, onchange: serialize, tabIndex: 10};
-
- var year = tag('select', selops,
- tag('option', {value:0}, '-year-'),
- tag('option', {value:9999}, 'TBA')
- );
- for(i=(new Date()).getFullYear()+5; i>=1980; i--)
- year.appendChild(tag('option', {value: i}, i));
-
- var month = tag('select', selops,
- tag('option', {value:99}, '-month-')
- );
- for(i=1; i<=12; i++)
- month.appendChild(tag('option', {value: i}, i));
-
- var day = tag('select', selops,
- tag('option', {value:99}, '-day-')
- );
- for(i=1; i<=31; i++)
- day.appendChild(tag('option', {value: i}, i));
-
- var div = tag('div', {
- date_obj: obj,
- date_serfunc: serfunc,
- date_val: obj ? obj.value : 0
- }, year, month, day);
- div.dateSet = function(v){ set(div, v) };
-
- set(div, div.date_val);
- return obj ? obj.parentNode.insertBefore(div, obj) : div;
-}
-
-function set(div, val) {
- val = +val || 0;
- val = [ Math.floor(val/10000), Math.floor(val/100)%100, val%100 ];
- if(val[1] == 0) val[1] = 99;
- if(val[2] == 0) val[2] = 99;
- var l = byName(div, 'select');
- for(var i=0; i<l.length; i++)
- for(var j=0; j<l[i].options.length; j++)
- l[i].options[j].selected = l[i].options[j].value == val[i];
- serialize(div, true);
-}
-
-function serialize(div, nonotify) {
- div = div.dateSet ? div : this.parentNode;
- var sel = byName(div, 'select');
- var val = [
- sel[0].options[sel[0].selectedIndex].value*1,
- sel[1].options[sel[1].selectedIndex].value*1,
- sel[2].options[sel[2].selectedIndex].value*1
- ];
- div.date_val = val[0] == 0 ? 0 : val[0] == 9999 ? 99999999 : val[0]*10000+val[1]*100+(val[1]==99?99:val[2]);
- if(div.date_obj)
- div.date_obj.value = div.date_val;
- if(!nonotify && div.date_serfunc)
- div.date_serfunc(div);
-}
-
-var l = byClass('input', 'dateinput');
-for(var i=0; i<l.length; i++)
- load(l[i]);
-
-window.dateLoad = load;
diff --git a/data/js/dropdown.js b/data/js/dropdown.js
deleted file mode 100644
index 76be3f35..00000000
--- a/data/js/dropdown.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Dropdown widget, used as follows:
- *
- * ddInit(obj, align, func);
- *
- * Show a dropdown box on mouse-over on 'obj'. 'func' should generate and
- * return the contents of the box as a DOM node, or null to not show a dropdown
- * box at all. The 'align' argument indicates where the box should be shown,
- * relative to the obj:
- *
- * left: To the left of obj
- * bottom: To the bottom of obj
- * tagmod: Special alignment for tagmod page
- *
- * Other functions:
- *
- * ddHide(); Hides the box
- * ddRefresh(); Refreshes the box contents
- */
-var box;
-
-function init(obj, align, contents) {
- obj.dd_align = align;
- obj.dd_contents = contents;
- obj.onmouseover = show;
-}
-
-function show() {
- if(!box) {
- box = tag('div', {id:'dd_box', 'class':'hidden'});
- addBody(box);
- }
- box.dd_lnk = this;
- document.onmousemove = mouse;
- document.onscroll = hide;
- refresh();
-}
-
-function hide() {
- if(box) {
- setText(box, '');
- setClass(box, 'hidden', true);
- box.dd_lnk = document.onmousemove = document.onscroll = null;
- }
-}
-
-function mouse(e) {
- e = e || window.event;
- // Don't hide if the cursor is on the link
- for(var lnk = e.target || e.srcElement; lnk; lnk=lnk.parentNode)
- if(lnk == box.dd_lnk)
- return;
-
- // Hide if it's 10px outside of the box
- var mouseX = e.pageX || (e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft);
- var mouseY = e.pageY || (e.clientY + document.body.scrollTop + document.documentElement.scrollTop);
- if(mouseX < box.dd_x-10 || mouseX > box.dd_x+box.offsetWidth+10 || mouseY < box.dd_y-10 || mouseY > box.dd_y+box.offsetHeight+10)
- hide();
-}
-
-function refresh() {
- if(!box || !box.dd_lnk)
- return hide();
- var lnk = box.dd_lnk;
- var content = lnk.dd_contents(lnk, box);
- if(content == null)
- return hide();
- setContent(box, content);
- setClass(box, 'hidden', false);
-
- var o = lnk;
- ddx = ddy = 0;
- do {
- ddx += o.offsetLeft;
- ddy += o.offsetTop;
- } while(o = o.offsetParent);
-
- if(lnk.dd_align == 'left')
- ddx -= box.offsetWidth;
- if(lnk.dd_align == 'tagmod')
- ddx += lnk.offsetWidth-35;
- if(lnk.dd_align == 'bottom')
- ddy += lnk.offsetHeight;
- box.dd_x = ddx;
- box.dd_y = ddy;
- box.style.left = ddx+'px';
- box.style.top = ddy+'px';
-}
-
-window.ddInit = init;
-window.ddHide = hide;
-window.ddRefresh = refresh;
diff --git a/data/js/dropdownsearch.js b/data/js/dropdownsearch.js
deleted file mode 100644
index 428858cd..00000000
--- a/data/js/dropdownsearch.js
+++ /dev/null
@@ -1,204 +0,0 @@
-/* Interactive drop-down search widget. Usage:
- *
- * dsInit(obj, url, trfunc, serfunc, retfunc);
- *
- * obj: An <input type="text"> object.
- *
- * url: The base URL of the XML API, e.g. "/xml/tags.xml?q=", the search query is appended to this URL.
- * The resource at the URL should return an XML document with a
- * <item id="something" ..>..</item>
- * element for each result.
- *
- * trfunc(item, tr): Function that is given an <item> object given by the XML
- * document and an empty <tr> object. The function should format the data of
- * the item to be shown in the tr.
- *
- * serfunc(item, obj): Called whenever a user selects an item from the search
- * results. Should return a string, which will be used as the new value of the
- * input object.
- *
- * retfunc(obj): Called whenever the user selects an item from the search
- * results (after setfunc()) or when enter is pressed (even if nothing is
- * selected).
- *
- * setfunc and retfunc can be null.
- *
- * TODO: Some users of this widget consider serfunc() as their final "apply
- * this selection" function, whereas others use retfunc() for this. Might be
- * worth investigating whether the additional flexibility offered by
- * retfunc() is actually necessary, and remove the callback if not.
- */
-var boxobj;
-
-function box() {
- if(!boxobj) {
- boxobj = tag('div', {id: 'ds_box', 'class':'hidden'}, tag('b', 'Loading...'));
- addBody(boxobj);
- }
- return boxobj;
-}
-
-function init(obj, url, trfunc, serfunc, retfunc) {
- obj.setAttribute('autocomplete', 'off');
- obj.onkeydown = keydown;
- obj.onclick = obj.onchange = obj.oninput = function() { return textchanged(obj); };
- obj.onblur = blur;
- obj.ds_returnFunc = retfunc;
- obj.ds_trFunc = trfunc;
- obj.ds_serFunc = serfunc;
- obj.ds_searchURL = url;
- obj.ds_selectedId = 0;
- obj.ds_dosearch = null;
- obj.ds_lastVal = obj.value;
-}
-
-function blur() {
- setTimeout(function () {
- setClass(box(), 'hidden', true)
- }, 500)
-}
-
-function setselected(obj, id) {
- obj.ds_selectedId = id;
- var l = byName(box(), 'tr');
- for(var i=0; i<l.length; i++)
- setClass(l[i], 'selected', id && l[i].id == 'ds_box_'+id);
-}
-
-function setvalue(obj) {
- if(obj.ds_selectedId != 0)
- obj.value = obj.ds_lastVal = obj.ds_serFunc(byId('ds_box_'+obj.ds_selectedId).ds_itemData, obj);
- if(obj.ds_returnFunc)
- obj.ds_returnFunc(obj);
-
- setClass(box(), 'hidden', true);
- setContent(box(), tag('b', 'Loading...'));
- setselected(obj, 0);
- if(obj.ds_dosearch) {
- clearTimeout(obj.ds_dosearch);
- obj.ds_dosearch = null;
- }
-}
-
-function enter(obj) {
- // Make sure the form doesn't submit when enter is pressed.
- // This solution is a hack, but it's simple and reliable.
- var frm = obj;
- while(frm && frm.nodeName.toLowerCase() != 'form')
- frm = frm.parentNode;
- if(frm) {
- var oldsubmit = frm.onsubmit;
- frm.onsubmit = function() { return false };
- setTimeout(function() { frm.onsubmit = oldsubmit }, 100);
- }
-
- setvalue(obj);
- return false;
-}
-
-function updown(obj, up) {
- var i, sel, l = byName(box(), 'tr');
- if(l.length < 1)
- return true;
-
- if(obj.ds_selectedId == 0)
- sel = up ? l.length-1 : 0;
- else
- for(i=0; i<l.length; i++)
- if(l[i].id == 'ds_box_'+obj.ds_selectedId)
- sel = up ? (i>0 ? i-1 : l.length-1) : (l[i+1] ? i+1 : 0);
-
- setselected(obj, l[sel].id.substr(7));
- return false;
-}
-
-function textchanged(obj) {
- // Ignore this event if the text hasn't actually changed.
- if(obj.ds_lastVal == obj.value)
- return true;
- obj.ds_lastVal = obj.value;
-
- // perform search after a timeout
- if(obj.ds_dosearch)
- clearTimeout(obj.ds_dosearch);
- obj.ds_dosearch = setTimeout(function() {
- search(obj);
- }, 500);
- return true;
-}
-
-function keydown(ev) {
- var c = document.layers ? ev.which : document.all ? event.keyCode : ev.keyCode;
- var obj = this;
-
- if(c == 9) // tab
- return true;
-
- if(c == 13) // enter
- return enter(obj);
-
- if(c == 38 || c == 40) // up / down
- return updown(obj, c == 38);
-
- return textchanged(obj);
-}
-
-function search(obj) {
- var b = box();
- var val = obj.value;
-
- clearTimeout(obj.ds_dosearch);
- obj.ds_dosearch = null;
-
- // hide the ds_box div if the search string is too short
- if(val.length < 2) {
- setClass(b, 'hidden', true);
- setContent(b, tag('b', 'Loading...'));
- setselected(obj, 0);
- return;
- }
-
- // position the div
- var ddx=0;
- var ddy=obj.offsetHeight;
- var o = obj;
- do {
- ddx += o.offsetLeft;
- ddy += o.offsetTop;
- } while(o = o.offsetParent);
-
- b.style.position = 'absolute';
- b.style.left = ddx+'px';
- b.style.top = ddy+'px';
- b.style.width = obj.offsetWidth+'px';
- setClass(b, 'hidden', false);
-
- // perform search
- ajax(obj.ds_searchURL + encodeURIComponent(val), function(hr) { results(hr, obj) });
-}
-
-function results(hr, obj) {
- var lst = hr.responseXML.getElementsByTagName('item');
- var b = box();
- if(lst.length < 1) {
- setContent(b, tag('b', 'No results...'));
- setselected(obj, 0);
- return;
- }
-
- var tb = tag('tbody', null);
- for(var i=0; i<lst.length; i++) {
- var id = lst[i].getAttribute('id');
- var tr = tag('tr', {id: 'ds_box_'+id, ds_itemData: lst[i]} );
-
- tr.onmouseover = function() { setselected(obj, this.id.substr(7)) };
- tr.onmousedown = function() { setselected(obj, this.id.substr(7)); setvalue(obj) };
-
- obj.ds_trFunc(lst[i], tr);
- tb.appendChild(tr);
- }
- setContent(b, tag('table', tb));
- setselected(obj, obj.ds_selectedId != 0 && !byId('ds_box_'+obj.ds_selectedId) ? 0 : obj.ds_selectedId);
-}
-
-window.dsInit = init;
diff --git a/data/js/filter.js b/data/js/filter.js
deleted file mode 100644
index 8c2edb6d..00000000
--- a/data/js/filter.js
+++ /dev/null
@@ -1,727 +0,0 @@
-/* Filter box definition:
- * [ <title>,
- * [ <category_name>,
- * [ <fieldcode>, <fieldname>, <fieldcontents>, <fieldreadfunc>, <fieldwritefunc>, <fieldshowfunc> ], ..
- * ], ..
- * ]
- * Where:
- * <title> human-readable title of the filter box
- * <category_name> human-readable name of the category. ignored if there's only one category
- * <fieldcode> code of this field, refers to the <field> in the filter format. Empty string for just a <tr>
- * <fieldname> human-readanle name of the field. Empty to not display a label. Space for always-enabled items (without checkbox)
- * <fieldcontents> tag() object, or an array of tag() objects
- * <fieldreadfunc> function reference. argument: <fieldcontents>; must return data to be used in the filter format
- * <fieldwritefunc> function reference, argument: <fieldcontents>, data from filter format; must update the contents with the passed data
- * <fieldshowfunc> function reference, argument: <fieldcontents>, called when the field is displayed
- *
- * Filter string format:
- * <field>-<value1>~<value2>.<field2>-<value>.<field3>-<value1>~<value2>
- * Where:
- * <field> = [a-z0-9]+
- * <value> = [a-zA-Z0-9_]+ and any UTF-8 characters not in the ASCII range
- * Escaping of the <value>:
- * "_<two-number-code>"
- * Where <two-number-code> is the decimal index to the following array:
- * _ <space> ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ ` { | } ~
- * For boolean fields, the <value> is either 0 or 1.
- */
-
-var fil_escape = "_ !\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~".split('');
-var fil_objs = [];
-
-function getObj(obj) {
- while(!obj.fil_fields)
- obj = obj.parentNode;
- return obj;
-}
-
-
-function filLoad(lnk, serobj) {
- var type = lnk.href.match(/#r$/) ? 'r' : lnk.href.match(/#c$/) ? 'c' : lnk.href.match(/#s$/) ? 's' : 'v';
- var l = {r: filReleases, c: filChars, s: filStaff, v: filVN}[type]();
-
- var fields = {};
- var cats = [];
- var p = tag('p', {'class':'browseopts'});
- var c = tag('div', null);
- var idx = 0;
- for(var i=1; i<l.length; i++) {
- if(!l[i])
- continue;
-
- // category link
- var a = tag('a', { href: '#', onclick: selectCat, fil_onshow:[] }, l[i][0]);
- cats.push(a);
- p.appendChild(a);
- p.appendChild(tag(' '));
-
- // category contents
- var t = tag('table', {'class':'formtable hidden', fil_a: a}, null);
- a.fil_t = t;
- for(var j=1; j<l[i].length; j++) {
- var fd = l[i][j];
- var lab = typeof fd[1] == 'object' ? fd[1][0] : fd[1];
- var name = 'fil_check_'+type+'_'+fd[0];
- var f = tag('tr', {'class':'newfield', fil_code: fd[0], fil_readfunc: fd[3], fil_writefunc: fd[4]},
- // Checkbox
- fd[0] ? tag('td', {'class':'check'},
- tag('input', {type:'checkbox', id:name, name:name, 'class': 'enabled_check'+(fd[1]==' '?' hidden':''), onclick: selectField }))
- : tag('td', null),
- // Label
- fd[1] ? tag('td', {'class':'label'},
- tag('label', {'for':name}, lab),
- typeof fd[1] == 'object' ? tag('b', fd[1][1]) : null
- ) : null,
- // Contents
- tag('td', {'class':'cont' }, fd[2]));
- if(fd[0])
- fields[fd[0]] = f;
- if(fd[5])
- a.fil_onshow.push([ fd[5], fd[2] ]);
- t.appendChild(f);
- }
- c.appendChild(t);
- idx++;
- }
-
- var savenote = tag('p', {'class':'hidden'}, '')
- var obj = tag('div', {
- 'class': 'fil_div hidden',
- fil_fields: fields,
- fil_cats: cats,
- fil_savenote: savenote,
- fil_serobj: serobj,
- fil_lnk: lnk,
- fil_type: type
- },
- tag('a', {href:'#', onclick:show, 'class':'close'}, 'close'),
- tag('h3', l[0]),
- p,
- tag('b', {'class':'ruler'}, null),
- c,
- tag('b', {'class':'ruler'}, null),
- tag('input', {type:'button', 'class':'submit', value: 'Apply', onclick:function () {
- var f = serobj;
- while(f.nodeName.toLowerCase() != 'form')
- f = f.parentNode;
- f.submit();
- }}),
- tag('input', {type:'button', 'class':'submit', value: 'Reset', onclick:function () { serobj.value = ''; deSerialize(obj) } }),
- byId('pref_code') && lnk.id == 'filselect' ? tag('input', {type:'button', 'class':'submit', value: 'Save as default', onclick:saveDefault }) : null,
- savenote
- );
- lnk.fil_obj = obj;
- lnk.onclick = show;
-
- addBody(obj);
- fil_objs.push(obj);
- deSerialize(obj);
- selectCat(obj.fil_cats[0]);
-}
-
-
-function saveDefault() {
- var but = this;
- var obj = getObj(this);
- var note = obj.fil_savenote;
- setText(note, 'Loading...');
- but.enabled = false;
- setClass(note, 'hidden', false);
- var type = obj.fil_type == 'r' ? 'release' : 'vn';
- ajax('/xml/prefs.xml?formcode='+byId('pref_code').title+';key=filter_'+type+';value='+obj.fil_serobj.value, function (hr) {
- setText(note, 'Your saved filters will be applied automatically to several other parts of the site as well, such as the homepage.'+
- ' To change these filters, come back to this page and use the "Save as default" button again.'+
- ' To remove your saved filters, hit "Reset" and then save.');
- but.enable = true;
- });
-}
-
-
-function selectCat(n) {
- var lnk = n.fil_onshow ? n : this;
- var obj = getObj(lnk);
- setClass(obj.fil_savenote, 'hidden', true);
- for(var i=0; i<obj.fil_cats.length; i++) {
- var n = obj.fil_cats[i];
- setClass(n, 'optselected', n == lnk);
- setClass(n.fil_t, 'hidden', n != lnk);
- }
- for(var i=0; i<lnk.fil_onshow.length; i++)
- lnk.fil_onshow[i][0](lnk.fil_onshow[i][1]);
- return false
-}
-
-
-function selectField(f) {
- if(!f.parentNode)
- f = this;
- setClass(getObj(f).fil_savenote, 'hidden', true);
-
- // update checkbox and label
- var o = f;
- while(o.nodeName.toLowerCase() != 'tr')
- o = o.parentNode;
- var c = byClass(o, 'enabled_check')[0];
- if(c != f)
- c.checked = true;
- if(hasClass(c, 'hidden')) // When there's no label (e.g. tagspoil selector)
- c.checked = true;
- var l = byName(o, 'label')[0];
- if(l)
- setClass(l, 'active', c.checked);
-
- // update category link
- while(o.nodeName.toLowerCase() != 'table')
- o = o.parentNode;
- var l = byName(o, 'tr');
- var n=0;
- for(var i=0; i<l.length; i++) {
- var ch = byClass(l[i], 'enabled_check')[0];
- if(ch && !hasClass(ch, 'hidden') && ch.checked)
- n++;
- }
- setClass(o.fil_a, 'active', n>0);
-
- // serialize
- serialize(getObj(o));
- return true;
-}
-
-
-function escapeVal(val) {
- var r = [];
- for(var h=0; h<val.length; h++) {
- var vs = (''+val[h]).split('');
- r[h] = '';
-
- // this isn't a very fast escaping method, blame JavaScript for inflexible search/replace support
- for(var i=0; i<vs.length; i++) {
- for(var j=0; j<fil_escape.length; j++)
- if(vs[i] == fil_escape[j])
- break;
- r[h] += j == fil_escape.length ? vs[i] : '_'+(j<10?'0'+j:j);
- }
- }
-
- return r[0] == '' ? '' : r.join('~');
-}
-
-
-function serialize(obj) {
- if(!obj.fil_fields)
- obj = getObj(this);
- var num = 0;
- var values = {};
-
- for(var f in obj.fil_fields) {
- var fo = obj.fil_fields[f];
- var ch = byClass(fo, 'enabled_check')[0];
- if(!ch || !ch.checked)
- continue;
- if(!hasClass(ch, 'hidden'))
- num++;
-
- var v = escapeVal(fo.fil_readfunc(byClass(fo, 'cont')[0].childNodes[0]));
- if(v != '')
- values[fo.fil_code] = v;
- }
-
- var l = [];
- for(var f in values)
- l.push(f+'-'+values[f]);
-
- obj.fil_serobj.value = l.join('.');
- setText(byName(obj.fil_lnk, 'i')[1], num > 0 ? ' ('+num+')' : '');
-}
-
-
-function deSerialize(obj) {
- var d = obj.fil_serobj.value;
- var fs = d.split('.');
-
- var f = {};
- for(var i=0; i<fs.length; i++) {
- var v = fs[i].split('-');
- if(obj.fil_fields[v[0]])
- f[v[0]] = v[1];
- }
-
- for(var fn in obj.fil_fields)
- if(!f[fn])
- f[fn] = '';
- for(var fn in f) {
- var c = byClass(obj.fil_fields[fn], 'enabled_check')[0];
- if(!c)
- continue;
- c.checked = f[fn] != '';
-
- var v = f[fn].split('~');
- for(var i=0; i<v.length; i++)
- v[i] = v[i].replace(/_([0-9]{2})/g, function (a, e) { return fil_escape[Math.floor(e)] });
-
- obj.fil_fields[fn].fil_writefunc(byClass(obj.fil_fields[fn], 'cont')[0].childNodes[0], v);
- // not very efficient: selectField() does a lot of things that can be
- // batched after all fields have been updated, and in some cases the
- // writefunc() triggers the same selectField() as well
- selectField(c);
- }
-}
-
-
-function show() {
- var obj = this.fil_obj || getObj(this);
-
- // Hide other filter objects
- for(var i=0; i<fil_objs.length; i++)
- if(fil_objs[i] != obj) {
- setClass(fil_objs[i], 'hidden', true);
- setText(byName(fil_objs[i].fil_lnk, 'i')[0], collapsed_icon);
- }
-
- var hid = !hasClass(obj, 'hidden');
- setClass(obj, 'hidden', hid);
- setText(byName(obj.fil_lnk, 'i')[0], hid ? collapsed_icon : expanded_icon);
- setClass(obj.fil_savenote, 'hidden', true);
-
- var o = obj.fil_lnk;
- ddx = ddy = 0;
- do {
- ddx += o.offsetLeft;
- ddy += o.offsetTop;
- } while(o = o.offsetParent);
- ddy += obj.fil_lnk.offsetHeight+2;
- ddx += (obj.fil_lnk.offsetWidth-obj.offsetWidth)/2;
- obj.style.left = ddx+'px';
- obj.style.top = ddy+'px';
-
- return false;
-}
-
-
-var curSlider = null;
-function filFSlider(c, n, min, max, def, unit, ser, deser) {
- // min/max/def/fil_val are in serialized form (i.e. a "value")
- if(!ser) ser = function(v) { return v }; // integer -> value
- if(!deser) deser = function(v) { return parseInt(v) }; // value -> integer
-
- min = deser(min);
- max = deser(max);
- var bw = 200; var pw = 1; // slidebar width and pointer width
- var s = tag('p', {fil_val:def, 'class':'slider'});
- var b = tag('div', {style:'width:'+(bw-2)+'px;', s:s});
- var p = tag('div', {style:'width:'+pw+'px;', s:s});
- var v = tag('span', def+' '+unit);
- s.appendChild(b);
- b.appendChild(p);
- s.appendChild(v);
-
- var set = function (e, v) {
- var w = bw-pw-6;
- var s,x;
-
- if(v) {
- s = e;
- x = deser(v[0] == '' ? def : v[0]);
- x = (x-min)*w/(max-min);
- } else {
- s = curSlider;
- if(!e) e = window.event;
- x = (!e) ? (deser(def)-min)*w/(max-min)
- : (e.pageX || e.clientX + document.body.scrollLeft - document.body.clientLeft)-5;
- var o = s.childNodes[0];
- while(o.offsetParent) {
- x -= o.offsetLeft;
- o = o.offsetParent;
- }
- }
-
- if(x<0) x = 0; if(x>w) x = w;
- s.fil_val = ser(min + Math.floor(x*(max-min)/w));
- s.childNodes[1].innerHTML = s.fil_val+' '+unit;
- s.childNodes[0].childNodes[0].style.left = x+'px';
- return false;
- }
-
- b.onmousedown = p.onmousedown = function (e) {
- curSlider = this.s;
- if(!curSlider.oldmousemove) curSlider.oldmousemove = document.onmousemove;
- if(!curSlider.oldmouseup) curSlider.oldmouseup = document.onmouseup;
- document.onmouseup = function () {
- document.onmousemove = curSlider.oldmousemove;
- curSlider.oldmousemove = null;
- document.onmouseup = curSlider.oldmouseup;
- curSlider.oldmouseup = null;
- selectField(curSlider);
- return false;
- }
- document.onmousemove = set;
- return set(e);
- }
-
- return [c, n, s, function (c) { return [ c.fil_val ]; }, set ];
-}
-
-function filFSelect(c, n, lines, opts) {
- var s = tag('select', {onfocus: selectField, onchange: serialize, multiple: lines > 1, size: lines});
- for(var i=0; i<opts.length; i++) {
- if(typeof opts[i][1] != 'object')
- s.appendChild(tag('option', {name: opts[i][0]}, opts[i][1]));
- else {
- var g = tag('optgroup', {label: opts[i][0]});
- for(var j=1; j<opts[i].length; j++)
- g.appendChild(tag('option', {name: opts[i][j][0]}, opts[i][j][1]));
- s.appendChild(g);
- }
- }
- return [ c, lines > 1 ? [ n, 'Boolean or, selecting more gives more results' ] : n, s,
- function (c) {
- var l = [];
- for(var i=0; i<c.options.length; i++)
- if(c.options[i].selected)
- l.push(c.options[i].name);
- return l;
- },
- function (c, f) {
- for(var i=0; i<c.options.length; i++) {
- for(var j=0; j<f.length; j++)
- if(c.options[i].name+'' == f[j]+'') // beware of JS logic: 0 == '', but '0' != ''
- break;
- c.options[i].selected = j != f.length;
- }
- }
- ];
-}
-
-function filFInput(c, n) {
- return [ c, n,
- tag('input', {type: 'text', 'class': 'text', onfocus: selectField, onchange: serialize}),
- function (c) { return [c.value] },
- function (c, f) { c.value = f }
- ]
-}
-
-function filFEngine(c, n) {
- var input = tag('input', {type: 'text', 'class': 'text', onfocus: selectField, onchange: serialize});
- dsInit(input, '/xml/engines.xml?q=',
- function(item, tr) { tr.appendChild(tag('td', shorten(item.firstChild.nodeValue, 40))); },
- function(item, obj) { return item.firstChild.nodeValue; },
- function(o) { selectField(o) }
- );
- return [ c, n, input,
- function (c) { return [c.value] },
- function (c, f) { c.value = f }
- ]
-}
-
-
-function filFOptions(c, n, opts) {
- var p = tag('p', {'class':'opts', fil_val:opts[0][0]});
- var sel = function (e) {
- var o = typeof e == 'string' ? e : this.fil_n;
- var l = byName(p, 'a');
- for(var i=0; i<l.length; i++)
- setClass(l[i], 'tsel', l[i].fil_n+'' == o+'');
- p.fil_val = o;
- if(typeof e != 'string')
- selectField(p);
- return false
- };
- for(var i=0; i<opts.length; i++) {
- p.appendChild(tag('a', {href:'#', fil_n: opts[i][0], onclick:sel}, opts[i][1]));
- if(i<opts.length-1)
- p.appendChild(tag('b', '|'));
- }
- return [ c, n, p,
- function (c) { return [ c.fil_val ] },
- function (c, v) { sel(v[0]) }
- ];
-}
-
-
-// fieldcode -> See <fieldcode> in filter definitions
-// fieldname -> See <fieldname> in filter definitions
-// src -> The API URL where to get items, must work with dropdownsearch.js and support appending ';q=', ';id=' and ';r=' to it.
-// fmtlist -> Called with item id + XML data, should return an inline element to inject into the list view.
-function filFDList(fieldcode, fieldname, src, fmtds, fmtlist) {
- var visible = false;
- var addel = function(ul, id, data) {
- ul.appendChild(
- tag('li', { fil_id: id },
- data ? fmtlist(id, data) : null,
- ' (', tag('a', {href:'#',
- onclick:function () {
- // a -> li -> ul -> div
- var ul = this.parentNode.parentNode;
- ul.removeChild(this.parentNode);
- selectField(ul.parentNode);
- return false
- }
- }, 'remove'), ')'
- ));
- }
- var fetch = function(c) {
- var v = c.fil_val;
- var ul = byName(c, 'ul')[0];
- var txt = byName(c, 'input')[0];
- if(v == null)
- return;
- if(!v[0]) {
- setText(ul, '');
- txt.disabled = false;
- txt.value = '';
- return;
- }
- if(!visible)
- setText(ul, '');
- var q = [];
- for(var i=0; i<v.length; i++) {
- q.push('id='+v[i]);
- if(!visible)
- addel(ul, v[i]);
- }
- txt.value = 'Loading...';
- txt.disabled = true;
- if(visible)
- ajax(src+';r=50;'+q.join(';'), function (hr) {
- var items = hr.responseXML.getElementsByTagName('item');
- setText(ul, '');
- for(var i=0; i<items.length; i++)
- addel(ul, items[i].getAttribute('id'), items[i]);
- txt.value = '';
- txt.disabled = false;
- c.fil_val = null;
- }, 1);
- };
- var input = tag('input', {type:'text', 'class':'text', style:'width:300px', onfocus:selectField});
- var list = tag('ul', null);
- dsInit(input, src+';q=', fmtds,
- function(item, obj) {
- if(byName(obj.parentNode, 'li').length >= 50)
- alert('Too many items selected');
- else {
- obj.parentNode.fil_val = null;
- addel(byName(obj.parentNode, 'ul')[0], item.getAttribute('id'), item);
- selectField(obj);
- }
- return '';
- },
- function(o) { selectField(o) }
- );
-
- return [
- fieldcode, fieldname, tag('div', list, input),
- function(c) {
- var v = []; var l = byName(c, 'li');
- for(var i=0; i<l.length; i++)
- v.push(l[i].fil_id);
- return v;
- },
- function(c,v) { c.fil_val = v; fetch(c) },
- function(c) { visible = true; fetch(c); }
- ];
-}
-
-function filFTagInput(code, name) {
- return filFDList(code, name, '/xml/tags.xml?searchable=1',
- function(item, tr) {
- tr.appendChild(tag('td', shorten(item.firstChild.nodeValue, 40)));
- },
- function(id, item) {
- return tag('span', tag('a', {href:'/g'+id}, item.firstChild.nodeValue||'g'+id))
- }
- )
-}
-
-function filFTraitInput(code, name) {
- return filFDList(code, name, '/xml/traits.xml?searchable=1',
- function(item, tr) {
- var g = item.getAttribute('groupname');
- tr.appendChild(tag('td',
- g ? tag('b', {'class':'grayedout'}, g+' / ') : null,
- shorten(item.firstChild.nodeValue, 40)
- ));
- },
- function(id, item) {
- var g = item.getAttribute('groupname');
- return tag('span',
- g ? tag('b', {'class':'grayedout'}, g+' / ') : null,
- tag('a', {href:'/i'+id}, item.firstChild.nodeValue||'i'+id)
- )
- }
- )
-}
-
-function filFProducerInput(code, name) {
- return filFDList(code, name, '/xml/producers.xml?',
- function(item, tr) {
- tr.appendChild(tag('td', shorten(item.firstChild.nodeValue, 40)));
- },
- function(id, item) {
- return tag('span', tag('a', {href:'/p'+id}, item.firstChild.nodeValue||'p'+id))
- }
- )
-}
-
-function filFStaffInput(code, name) {
- return filFDList(code, name, '/xml/staff.xml?staffid=1',
- function(item, tr) {
- tr.appendChild(tag('td', shorten(item.firstChild.nodeValue, 40)));
- },
- function(id, item) {
- return tag('span', tag('a', {href:'/s'+id}, item.firstChild.nodeValue||'s'+id))
- }
- )
-}
-
-
-function filChars() {
- var ontraitpage = location.pathname.indexOf('/i') == 0;
-
- var cup_ser = function(v) { return VARS.cup_size[parseInt(v)] };
- var cup_deser = function(v) {
- for(var i=0; i<VARS.cup_size.length; i++)
- if(VARS.cup_size[i] == v)
- return i;
- return 0;
- };
-
- return [
- 'Character filters',
- [ 'General',
- filFSelect('gender', 'Gender', 4, VARS.genders),
- filFSelect('bloodt', 'Blood type', 5, VARS.blood_types),
- '',
- filFSlider('bust_min', 'Bust min', 20, 120, 40, 'cm'),
- filFSlider('bust_max', 'Bust max', 20, 120, 100, 'cm'),
- filFSlider('waist_min', 'Waist min', 20, 120, 40, 'cm'),
- filFSlider('waist_max', 'Waist max', 20, 120, 100, 'cm'),
- filFSlider('hip_min', 'Hips min', 20, 120, 40, 'cm'),
- filFSlider('hip_max', 'Hips max', 20, 120, 100, 'cm'),
- '',
- filFSlider('height_min', 'Height min', 0, 300, 60, 'cm'),
- filFSlider('height_max', 'Height max', 0, 300, 240, 'cm'),
- filFSlider('weight_min', 'Weight min', 0, 400, 80, 'kg'),
- filFSlider('weight_max', 'Weight max', 0, 400, 320, 'kg'),
- filFSlider('cup_min', 'Cup size min', 'AAA', 'Z', 'AAA', '', cup_ser, cup_deser),
- filFSlider('cup_max', 'Cup size max', 'AAA', 'Z', 'E', '', cup_ser, cup_deser)
- ],
- ontraitpage ? [ 'Traits',
- [ '', ' ', tag('Additional trait filters are not available on this page. Use the character browser instead (available from the main menu -> characters).') ],
- ] : [ 'Traits',
- [ '', ' ', tag('Boolean and, selecting more gives less results') ],
- filFTraitInput('trait_inc', 'Traits to include'),
- filFTraitInput('trait_exc', 'Traits to exclude'),
- filFOptions('tagspoil', ' ', [[0, 'Hide spoilers'],[1, 'Show minor spoilers'],[2, 'Spoil me!']]),
- ],
- [ 'Roles', filFSelect('role', 'Roles', 4, VARS.char_roles) ],
- [ 'Seiyuu',
- [ '', ' ', tag('Boolean or, selecting more gives more results') ],
- filFStaffInput('va_inc', 'Seiyuu to include'),
- filFStaffInput('va_exc', 'Seiyuu to exclude')
- ],
- ];
-}
-
-function filReleases() {
- var plat = VARS.platforms;
- plat.splice(0, 0, [ 'unk', 'Unknown' ]);
- var med = VARS.media;
- med.splice(0, 0, [ 'unk', 'Unknown' ]);
- return [
- 'Release filters',
- [ 'General',
- filFOptions('type', 'Release type', VARS.release_types),
- filFOptions('patch', 'Patch status', [ [1, 'Patch'], [0, 'Standalone'] ]),
- filFOptions('freeware', 'Freeware', [ [1, 'Only freeware'], [0, 'Only non-free releases'] ]),
- filFOptions('doujin', 'Doujin', [ [1, 'Only doujin releases'], [0, 'Only commercial releases'] ]),
- filFOptions('uncensored','Censoring', [ [1, 'Only uncensored releases'], [0, 'Censored or non-erotic releases'] ]),
- [ 'date_after', 'Released after', dateLoad(null, selectField), function (c) { return [c.date_val] }, function(o,v) { o.dateSet(v) } ],
- [ 'date_before', 'Released before', dateLoad(null, selectField), function (c) { return [c.date_val] }, function(o,v) { o.dateSet(v) } ],
- filFOptions('released', 'Release date', [ [1, 'Past (already released)'], [0, 'Future (to be released)'] ])
- ],
- [ 'Age rating', filFSelect('minage', 'Age rating', 15, VARS.age_ratings) ],
- [ 'Language', filFSelect('lang', 'Language', 20, VARS.languages) ],
- byId('rfilselect') ? null :
- [ 'Original language', filFSelect('olang', 'Original language', 20, VARS.languages) ],
- [ 'Screen resolution', filFSelect('resolution', 'Screen resolution', 15, VARS.resolutions) ],
- [ 'Platform', filFSelect('plat', 'Platform', 20, plat) ],
- [ 'Producer',
- [ '', ' ', tag('Boolean or, selecting more gives more results') ],
- filFProducerInput('prod_inc', 'Producers to include'),
- filFProducerInput('prod_exc', 'Producers to exclude')
- ],
- [ 'Misc',
- filFSelect('med', 'Medium', 10, med),
- filFSelect('voiced', 'Voiced', 5, VARS.voiced),
- filFSelect('ani_story', 'Story animation', 5, VARS.animated),
- filFSelect('ani_ero', 'Ero animation', 5, VARS.animated),
- filFEngine('engine', 'Engine')
- ]
- ];
-}
-
-function filVN() {
- var ontagpage = location.pathname.indexOf('/v/') < 0;
-
- return [
- 'Visual Novel Filters',
- [ 'General',
- filFSelect( 'length', 'Length', 6, VARS.vn_lengths),
- filFOptions('hasani', 'Anime', [[1, 'Has anime'], [0, 'Does not have anime']]),
- filFOptions('hasshot','Screenshots', [[1, 'Has screenshot'],[0, 'Does not have a screenshot']]),
- [ 'date_after', 'Released after', dateLoad(null, selectField), function (c) { return [c.date_val] }, function(o,v) { o.dateSet(v) } ],
- [ 'date_before', 'Released before', dateLoad(null, selectField), function (c) { return [c.date_val] }, function(o,v) { o.dateSet(v) } ],
- filFOptions('released', 'Release date', [ [1, 'Past (already released)'], [0, 'Future (to be released)'] ])
- ],
- ontagpage ? [ 'Tags',
- [ '', ' ', tag('Additional tag filters are not available on this page. Use the visual novel browser instead (available from the main menu -> visual novels).') ],
- ] : [ 'Tags',
- [ '', ' ', tag('Boolean and, selecting more gives less results') ],
- [ '', ' ', byId('pref_code') ? tag('These filters are ignored on tag pages (when set as default).') : null ],
- filFTagInput('tag_inc', 'Tags to include'),
- filFTagInput('tag_exc', 'Tags to exclude'),
- filFOptions('tagspoil', ' ', [[0, 'Hide spoilers'],[1, 'Show minor spoilers'],[2, 'Spoil me!']])
- ],
- [ 'Language', filFSelect('lang', 'Language', 20, VARS.languages) ],
- [ 'Original language', filFSelect('olang','Original language', 20, VARS.languages) ],
- [ 'Platform', filFSelect('plat', 'Platform', 20, VARS.platforms) ],
- [ 'Staff',
- [ '', ' ', tag('Boolean or, selecting more gives more results') ],
- filFStaffInput('staff_inc', 'Staff to include'),
- filFStaffInput('staff_exc', 'Staff to exclude')
- ],
- !byId('pref_code') ? null : [
- 'My lists',
- filFOptions('ul_notblack', 'Blacklist', [[1, 'Exclude VNs on my blacklist']]),
- filFOptions('ul_onwish', 'Wishlist', [[0, 'Not on my wishlist'],[1, 'On my wishlist']]),
- filFOptions('ul_voted', 'Voted', [[0, 'Not voted on'], [1, 'Voted on' ]]),
- filFOptions('ul_onlist', 'VN list', [[0, 'Not on my VN list'],[1, 'On my VN list']])
- ],
- ];
-}
-
-function filStaff() {
- var gend = VARS.genders.slice(0, 3);
-
- // Insert seiyuu into the list of roles, before the "staff" role.
- var roles = VARS.credit_type;
- roles.splice(-1, 0, ['seiyuu', 'Voice actor']);
-
- return [
- 'Staff filters',
- [ 'General',
- filFOptions('truename', 'Names', [[1, 'Primary names only'],[0, 'Include aliases']]),
- filFSelect('role', 'Roles', roles.length, roles),
- '',
- filFSelect('gender', 'Gender', gend.length, gend),
- ],
- [ 'Language', filFSelect('lang', 'Language', 20, VARS.languages) ],
- ];
-}
-
-if(byId('filselect'))
- filLoad(byId('filselect'), byId('fil'));
-if(byId('rfilselect'))
- filLoad(byId('rfilselect'), byId('rfil'));
-if(byId('cfilselect'))
- filLoad(byId('cfilselect'), byId('cfil'));
diff --git a/data/js/lib.js b/data/js/lib.js
deleted file mode 100644
index a4921d3e..00000000
--- a/data/js/lib.js
+++ /dev/null
@@ -1,179 +0,0 @@
-window.expanded_icon = '▾',
-window.collapsed_icon = '▸';
-
-
-var ajax_req;
-window.ajax = function(url, func, async, body) {
- if(!async && ajax_req)
- ajax_req.abort();
- var req = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
- if(!async)
- ajax_req = req;
- req.onreadystatechange = function() {
- if(!req || req.readyState != 4 || !req.responseText)
- return;
- if(req.status != 200)
- return alert('Whoops, error! :(');
- func(req);
- };
- if(!body)
- url += (url.indexOf('?')>=0 ? ';' : '?')+(Math.floor(Math.random()*999)+1);
- req.open(body ? 'POST' : 'GET', url, true);
- req.send(body);
- return req;
-};
-
-
-window.setCookie = function(n,v) {
- var date = new Date();
- date.setTime(date.getTime()+(365*24*60*60*1000));
- document.cookie = VARS.cookie_prefix+n+'='+v+'; expires='+date.toGMTString()+'; path=/';
-};
-
-window.getCookie = function(n) {
- var l = document.cookie.split(';');
- n = VARS.cookie_prefix+n;
- for(var i=0; i<l.length; i++) {
- var c = l[i];
- while(c.charAt(0) == ' ')
- c = c.substring(1,c.length);
- if(c.indexOf(n+'=') == 0)
- return c.substring(n.length+1,c.length);
- }
- return null;
-};
-
-
-window.byId = function(n) {
- return document.getElementById(n)
-};
-
-window.byName = function(){
- var d = arguments.length > 1 ? arguments[0] : document;
- var n = arguments.length > 1 ? arguments[1] : arguments[0];
- return d.getElementsByTagName(n);
-};
-
-window.byClass = function() { // [class], [parent, class], [tagname, class], [parent, tagname, class]
- var par = typeof arguments[0] == 'object' ? arguments[0] : document;
- var t = arguments.length == 2 && typeof arguments[0] == 'string' ? arguments[0] : arguments.length == 3 ? arguments[1] : '*';
- var c = arguments[arguments.length-1];
- var l = byName(par, t);
- var ret = [];
- for(var i=0; i<l.length; i++)
- if(hasClass(l[i], c))
- ret[ret.length] = l[i];
- return ret;
-};
-
-
-/* wrapper around DOM element creation
- * tag('string') -> createTextNode
- * tag('tagname', tag(), 'string', ..) -> createElement(), appendChild(), ..
- * tag('tagname', { class: 'meh', title: 'Title' }) -> createElement(), setAttribute()..
- * tag('tagname', { <attributes> }, <elements>) -> create, setattr, append */
-window.tag = function() {
- if(arguments.length == 1)
- return typeof arguments[0] != 'object' ? document.createTextNode(arguments[0]) : arguments[0];
- var el = typeof document.createElementNS != 'undefined'
- ? document.createElementNS('http://www.w3.org/1999/xhtml', arguments[0])
- : document.createElement(arguments[0]);
- for(var i=1; i<arguments.length; i++) {
- if(arguments[i] == null)
- continue;
- if(typeof arguments[i] == 'object' && !arguments[i].appendChild) {
- for(attr in arguments[i]) {
- if(attr == 'style' || attr.match(/^data-/))
- el.setAttribute(attr, arguments[i][attr]);
- else
- el[ attr == 'class' ? 'className' : attr == 'for' ? 'htmlFor' : attr ] = arguments[i][attr];
- }
- } else
- el.appendChild(tag(arguments[i]));
- }
- return el;
-};
-
-
-window.addBody = function(el) {
- if(document.body.appendChild)
- document.body.appendChild(el);
- else if(document.documentElement.appendChild)
- document.documentElement.appendChild(el);
- else if(document.appendChild)
- document.appendChild(el);
-};
-
-window.setContent = function() {
- setText(arguments[0], '');
- for(var i=1; i<arguments.length; i++)
- if(arguments[i] != null)
- arguments[0].appendChild(tag(arguments[i]));
-};
-
-window.getText = function(obj) {
- return obj.textContent || obj.innerText || '';
-};
-
-window.setText = function(obj, txt) {
- if(obj.textContent != null)
- obj.textContent = txt;
- else
- obj.innerText = txt;
-};
-
-
-window.listClass = function(obj) {
- var n = obj.className;
- if(!n)
- return [];
- return n.split(/ /);
-};
-
-window.hasClass = function(obj, c) {
- var l = listClass(obj);
- for(var i=0; i<l.length; i++)
- if(l[i] == c)
- return true;
- return false;
-};
-
-window.setClass = function(obj, c, set) {
- var l = listClass(obj);
- var n = [];
- if(set) {
- n = l;
- if(!hasClass(obj, c))
- n[n.length] = c;
- } else {
- for(var i=0; i<l.length; i++)
- if(l[i] != c)
- n[n.length] = l[i];
- }
- obj.className = n.join(' ');
-};
-
-window.onSubmit = function(form, handler) {
- var prev_handler = form.onsubmit;
- form.onsubmit = function(e) {
- if(prev_handler)
- if(!prev_handler(e))
- return false;
- return handler(e);
- }
-};
-
-
-window.shorten = function(v, l) {
- return v.length > l ? v.substr(0, l-3)+'...' : v;
-};
-
-
-window.fmtspoil = function(s) {
- return ['neutral', 'no spoiler', 'minor spoiler', 'major spoiler'][s+1];
-}
-
-
-window.jsonParse = function(s) {
- return s ? JSON.parse(s) : '';
-};
diff --git a/data/js/main.js b/data/js/main.js
deleted file mode 100644
index 8f3f6ca2..00000000
--- a/data/js/main.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0-only
-// @source: https://code.blicky.net/yorhel/vndb/src/branch/master/data/js
-// SPDX-License-Identifier: AGPL-3.0-only
-
-
-/* This is the main Javascript file. This file is processed by util/jsgen.pl to
- * generate the final JS file(s) used by the site. */
-
-// Variables from jsgen.pl
-VARS = /*VARS*/;
-
-// Relic of the past
-VARS.resolutions = [
- ["unknown","Unknown / console / handheld"],
- ["nonstandard","Non-standard"],
- ["4:3",["640x480","640x480"],["800x600","800x600"],["1024x768","1024x768"],["1280x960","1280x960"],["1600x1200","1600x1200"]],
- ["widescreen",["640x400","640x400"],["960x600","960x600"],["960x640","960x640"],["1024x576","1024x576"],["1024x600","1024x600"],["1024x640","1024x640"],["1280x720","1280x720"],["1280x800","1280x800"],["1366x768","1366x768"],["1600x900","1600x900"],["1920x1080","1920x1080"]]
-];
-
-/* The include directives below automatically wrap the file contents inside an
- * anonymous function, so each file has its own local namespace. Included files
- * can't access variables or functions from other files, unless these variables
- * are explicitely shared in DOM objects or (more commonly) the global 'window'
- * object.
- */
-
-// Reusable library functions
-//include lib.js
-
-// Reusable widgets
-//include dropdown.js
-//include dateselector.js
-//include dropdownsearch.js
-
-// Page/functionality-specific widgets
-//include filter.js
-//include misc.js
-
-// @license-end
diff --git a/data/js/misc.js b/data/js/misc.js
deleted file mode 100644
index 9658bccf..00000000
--- a/data/js/misc.js
+++ /dev/null
@@ -1,25 +0,0 @@
-// search tabs
-(function(){
- function click() {
- var str = byId('q').value;
- if(str.length > 1) {
- this.href = this.href.split('?')[0];
- if(this.href.indexOf('/g') >= 0 || this.href.indexOf('/i') >= 0)
- this.href += '/list';
- this.href += '?q=' + encodeURIComponent(str);
- }
- return true;
- };
- if(byId('searchtabs')) {
- var l = byName(byId('searchtabs'), 'a');
- for(var i=0; i<l.length; i++)
- l[i].onclick = click;
- }
-})();
-
-
-// spam protection on all forms
-setTimeout(function() {
- for(var i=1; i<document.forms.length; i++)
- document.forms[i].action = document.forms[i].action.replace(/\/nospam\?/,'');
-}, 500);