summaryrefslogtreecommitdiff
path: root/data/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'data/script.js')
-rw-r--r--data/script.js37
1 files changed, 29 insertions, 8 deletions
diff --git a/data/script.js b/data/script.js
index 521c30df..61f37d66 100644
--- a/data/script.js
+++ b/data/script.js
@@ -14,6 +14,25 @@
* tvs -> VN page tag spoilers
* vnr -> VN relation editor
*/
+
+/* Internationalization note:
+ * The translation keys to be inserted in the header of this file are parsed
+ * from the source code. So when using mt(), make sure it is in the following
+ * format:
+ * mt('<exact translation key>',<more arguments>
+ * or
+ * mt('<exact translation key>')
+ * The single quotes and (lack of) spaces are significant!
+ *
+ * To use non-exact translation keys as argument to mt(), make sure to
+ * indicate which keys should be inserted in the header by adding a comment
+ * containing the following format:
+ * l10n /<perl regex>/
+ * any keys matching that regex will be included.
+ *
+ * The "_lang_*" keys for all languages for which we have a translation are
+ * already included automatically.
+ */
var expanded_icon = '▾';
var collapsed_icon = '▸';
@@ -41,10 +60,11 @@ function ajax(url, func) {
function setCookie(n,v) {
var date = new Date();
date.setTime(date.getTime()+(365*24*60*60*1000));
- document.cookie = n+'='+v+'; expires='+date.toGMTString()+'; path=/';
+ document.cookie = cookie_prefix+n+'='+v+'; expires='+date.toGMTString()+'; path=/';
}
function getCookie(n) {
var l = document.cookie.split(';');
+ n = cookie_prefix+n;
for(var i=0; i<l.length; i++) {
var c = l[i];
while(c.charAt(0) == ' ')
@@ -365,14 +385,14 @@ function rlDropDown(lnk) {
var rs = tag('ul', tag('li', tag('b', mt('_vnpage_uopt_relrstat'))));
var vs = tag('ul', tag('li', tag('b', mt('_vnpage_uopt_relvstat'))));
for(var i=0; i<rlst_rstat.length; i++) {
- var val = mt('_rlst_rstat_'+rlst_rstat[i]);
+ var val = mt('_rlst_rstat_'+rlst_rstat[i]); // l10n /_rlst_rstat_\d+/
if(st[0] && st[0].indexOf(val) >= 0)
rs.appendChild(tag('li', tag('i', val)));
else
rs.appendChild(tag('li', tag('a', {href:'#', rl_rid:relid, rl_act:'r'+rlst_rstat[i], onclick:rlMod}, val)));
}
for(var i=0; i<rlst_vstat.length; i++) {
- var val = mt('_rlst_vstat_'+rlst_vstat[i]);
+ var val = mt('_rlst_vstat_'+rlst_vstat[i]); // l10n /_rlst_vstat_\d+/
if(st[1] && st[1].indexOf(val) >= 0)
vs.appendChild(tag('li', tag('i', val)));
else
@@ -1040,7 +1060,7 @@ function scrAdd(id, nsfw, rel) {
var tr = tag('tr', { id:'scr_tr_'+id, scr_id: id, scr_status: id?2:1, scr_rel: rel, scr_nsfw: nsfw},
tag('td', { 'class': 'thumb'}, mt('_js_loading')),
tag('td',
- tag('b', mt(id ? '_vnedit_scr_fetching' : '_vnedit_scr_uploading')),
+ tag('b', id ? mt('_vnedit_scr_fetching') : mt('_vnedit_scr_uploading')),
tag('br', null),
id ? null : mt('_vnedit_scr_upl_msg'),
tag('br', null),
@@ -1189,7 +1209,8 @@ function scrUploadComplete() {
tr.scr_id = -10;
}
if(tr.scr_id < 0) {
- alert(mt(tr.scr_id == -10 ? '_vnedit_scr_oops' : tr.scr_id == -1 ? '_vnedit_scr_errformat' : '_vnedit_scr_errempty'));
+ alert(tr.scr_id == -10 ? mt('_vnedit_scr_oops') :
+ tr.scr_id == -1 ? mt('_vnedit_scr_errformat') : mt('_vnedit_scr_errempty'));
scrDel(tr);
} else {
tr.id = 'scr_tr_'+tr.scr_id;
@@ -1220,7 +1241,7 @@ function scrSerialize() {
byId('screenshots').value = r.join(' ');
}
-if(byId('jt_box_vn_scr'))
+if(byId('jt_box_vn_scr') && byId('scr_table'))
scrLoad();
@@ -1232,7 +1253,7 @@ var tglSpoilers = [];
function tglLoad() {
for(var i=0; i<=3; i++)
- tglSpoilers[i] = mt('_tagv_spoil'+i);
+ tglSpoilers[i] = mt('_tagv_spoil'+i); // l10n /_tagv_spoil\d+/
// tag dropdown search
dsInit(byId('tagmod_tag'), '/xml/tags.xml?q=', function(item, tr) {
@@ -1872,7 +1893,7 @@ if(byId('expandlist')) {
var lnk = byId('expandlist');
setexpand = function() {
var exp = getCookie('histexpand') == 1;
- setText(lnk, mt(exp ? '_js_collapse' : '_js_expand'));
+ setText(lnk, exp ? mt('_js_collapse') : mt('_js_expand'));
var tbl = lnk;
while(tbl.nodeName.toLowerCase() != 'table')
tbl = tbl.parentNode;