summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-11-10 21:01:14 +0100
committerYorhel <git@yorhel.nl>2010-11-10 21:04:37 +0100
commit15808bc64c7717c0a157c24ee9bfd0a097daf707 (patch)
treecc8782101c744ae43f6f9e2529ce85582c892600 /data
parent134ebe506dc37073b474a83a5c3a3ab33fa411a1 (diff)
Started on adding an "official" flag to vn<->vn relations
This is the first part. The flag is stored in the database, can be edited through the usual VN edit form, and is displayed in the diff viewer. Things to do to make this feature fully functional: - display "official" status on VN page at the relation listing - update relation graphs to display unofficial relations differently - update guidelines
Diffstat (limited to 'data')
-rw-r--r--data/lang.txt25
-rw-r--r--data/script.js20
-rw-r--r--data/style.css2
3 files changed, 37 insertions, 10 deletions
diff --git a/data/lang.txt b/data/lang.txt
index 41751efd..d5a4884a 100644
--- a/data/lang.txt
+++ b/data/lang.txt
@@ -5924,15 +5924,22 @@ cs : Přidat vztah
hu : Összefüggés hozzáadása
nl : Voeg relatie toe
-# <title1> is a <relation> of <title2>
+# <title1> is an [x] official <relation> of <title2>
# this trick doesn't even work very well in English, so just an approximation is fine
:_vnedit_rel_isa
-en : is a
+en : is an
ru : это
cs : je
hu : -
nl : is een
+:_vnedit_rel_official
+en : official
+ru*:
+cs*:
+hu*:
+nl : officiële
+
:_vnedit_rel_of
en : of
ru : для
@@ -6351,6 +6358,20 @@ cs : NSFW
hu : Nem munkabarát
nl : Niet veilig
+:_vndiff_rel_official
+en : official
+ru*:
+cs*:
+hu*:
+nl : officiëel
+
+:_vndiff_rel_unofficial
+en : unofficial
+ru*:
+cs*:
+hu*:
+nl : officieus
+
# VN page (/v+)
diff --git a/data/script.js b/data/script.js
index beac7926..e8367fce 100644
--- a/data/script.js
+++ b/data/script.js
@@ -797,8 +797,8 @@ function vnrLoad() {
// read the current relations
var rels = byId('vnrelations').value.split('|||');
for(var i=0; i<rels.length && rels[0].length>1; i++) {
- var rel = rels[i].split(',', 3);
- vnrAdd(rel[0], rel[1], rel[2]);
+ var rel = rels[i].split(',', 4);
+ vnrAdd(rel[0], rel[1], rel[2]==1?true:false, rel[3]);
}
vnrEmpty();
@@ -821,7 +821,7 @@ function vnrLoad() {
}, vnrFormAdd);
}
-function vnrAdd(rel, vid, title) {
+function vnrAdd(rel, vid, official, title) {
var sel = tag('select', {onchange: vnrSerialize});
var ops = byName(byClass(byId('relation_new'), 'td', 'tc_rel')[0], 'select')[0].options;
for(var i=0; i<ops.length; i++)
@@ -829,7 +829,11 @@ function vnrAdd(rel, vid, title) {
byId('relation_tbl').appendChild(tag('tr', {id:'relation_tr_'+vid},
tag('td', {'class':'tc_vn' }, 'v'+vid+':', tag('a', {href:'/v'+vid}, shorten(title, 40))),
- tag('td', {'class':'tc_rel' }, mt('_vnedit_rel_isa')+' ', sel, ' '+mt('_vnedit_rel_of')),
+ tag('td', {'class':'tc_rel' },
+ mt('_vnedit_rel_isa')+' ',
+ tag('input', {type: 'checkbox', onclick:vnrSerialize, id:'official_'+vid, checked:official}),
+ tag('label', {'for':'official_'+vid}, mt('_vnedit_rel_official')),
+ sel, ' '+mt('_vnedit_rel_of')),
tag('td', {'class':'tc_title'}, shorten(byId('title').value, 40)),
tag('td', {'class':'tc_add' }, tag('a', {href:'#', onclick:vnrDel}, mt('_vnedit_rel_del')))
));
@@ -855,6 +859,7 @@ function vnrSerialize() {
r[r.length] = [
rel.options[rel.selectedIndex].value, // relation
trs[i].id.substr(12), // vid
+ byName(byClass(trs[i], 'td', 'tc_rel')[0], 'input')[0].checked ? '1' : '0', // official
getText(byName(byClass(trs[i], 'td', 'tc_vn')[0], 'a')[0]) // title
].join(',');
}
@@ -874,6 +879,7 @@ function vnrDel() {
function vnrFormAdd() {
var relnew = byId('relation_new');
var txt = byName(byClass(relnew, 'td', 'tc_vn')[0], 'input')[0];
+ var off = byName(byClass(relnew, 'td', 'tc_rel')[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;
@@ -883,12 +889,12 @@ function vnrFormAdd() {
return false;
}
- txt.disabled = sel.disabled = true;
+ txt.disabled = sel.disabled = off.disabled = true;
txt.value = mt('_js_loading');
setText(lnk, mt('_js_loading'));
ajax('/xml/vn.xml?q='+encodeURIComponent(input), function(hr) {
- txt.disabled = sel.disabled = false;
+ txt.disabled = sel.disabled = off.disabled = false;
txt.value = '';
setText(lnk, mt('_vnedit_rel_addbut'));
@@ -900,7 +906,7 @@ function vnrFormAdd() {
if(byId('relation_tr_'+id))
return alert(mt('_vnedit_rel_double'));
- vnrAdd(sel.options[sel.selectedIndex].value, id, items[0].firstChild.nodeValue);
+ vnrAdd(sel.options[sel.selectedIndex].value, id, off.checked, items[0].firstChild.nodeValue);
sel.selectedIndex = 0;
vnrSerialize();
});
diff --git a/data/style.css b/data/style.css
index 638782cc..5e522c01 100644
--- a/data/style.css
+++ b/data/style.css
@@ -741,7 +741,7 @@ b.datepart b { font-weight: normal }
#jt_box_vn_rel h2 { margin: 0 0 3px 0px; }
#jt_box_vn_rel td { padding: 1px 2px; vertical-align: middle; }
#jt_box_vn_rel td.tc_vn { width: 300px; text-align: right }
-#jt_box_vn_rel td.tc_rel { width: 170px; white-space: nowrap }
+#jt_box_vn_rel td.tc_rel { width: 220px; white-space: nowrap }
#jt_box_vn_rel td.tc_title { width: 200px; }
#jt_box_vn_rel td.tc_add { width: 40px; text-align: right }
#jt_box_vn_rel td.tc_vn input { width: 280px; }