Adding new functionality that I did commit when I should have...
This commit is contained in:
parent
d04501a303
commit
d2338283aa
47
main.css
47
main.css
|
@ -2,6 +2,14 @@
|
||||||
font-size: 1em
|
font-size: 1em
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#myed-status {
|
||||||
|
border-bottom: 1px dotted #999999;
|
||||||
|
margin-bottom: 0.4em;
|
||||||
|
margin-top: 0.4em;
|
||||||
|
padding-bottom: 0.4em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
#myed-freq-start {
|
#myed-freq-start {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +57,22 @@
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.myed-indikator {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myed-indikator:hover {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myed-indikator:before {
|
||||||
|
content: " (";
|
||||||
|
}
|
||||||
|
|
||||||
|
.myed-indikator:after {
|
||||||
|
content: ") ";
|
||||||
|
}
|
||||||
|
|
||||||
.clanek {
|
.clanek {
|
||||||
font-family: Verdana, sans-serif;
|
font-family: Verdana, sans-serif;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
@ -101,6 +125,14 @@
|
||||||
content: "(";
|
content: "(";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.myed-prevod-razlaga[taksonomija='true'] {
|
||||||
|
color: grey;
|
||||||
|
}
|
||||||
|
|
||||||
|
#myed-tax {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.myed-prevod-semicolon {}
|
.myed-prevod-semicolon {}
|
||||||
.myed-prevod-semicolon-hidden {
|
.myed-prevod-semicolon-hidden {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -119,12 +151,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.myed-oznaka:not(:empty) {
|
.myed-oznaka:not(:empty) {
|
||||||
color: #666666;
|
color: #387434;
|
||||||
text-transform: uppercase;
|
text-transform: lowercase;
|
||||||
font-size: 0.85em;
|
font-size: 0.85em;
|
||||||
margin-right: 0.2em;
|
margin-right: 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.myed-oznaka-div select {
|
||||||
|
width: 15em;
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.myed-oznaka-key {
|
||||||
|
width: 5em;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.clanek label:hover {box-shadow: 0px 0px 4px #666666;}
|
.clanek label:hover {box-shadow: 0px 0px 4px #666666;}
|
||||||
.clanek label:active {box-shadow: 0px 0px 2px #666666;}
|
.clanek label:active {box-shadow: 0px 0px 2px #666666;}
|
||||||
.clanek label input {position: relative; top: 0.15em;}
|
.clanek label input {position: relative; top: 0.15em;}
|
||||||
|
|
213
main.js
213
main.js
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
prevodi: null,
|
prevodi: [],
|
||||||
zgledi: null,
|
zgledi: [],
|
||||||
vecjez: null,
|
vecjez: [],
|
||||||
|
indikatorji: [],
|
||||||
xml: null,
|
xml: null,
|
||||||
original: null,
|
original: null,
|
||||||
freq_start: null,
|
freq_start: null,
|
||||||
|
@ -10,36 +11,62 @@ prevod_locations: [
|
||||||
'pomen > vecjez',
|
'pomen > vecjez',
|
||||||
'pomen > skladenjske_skupine > skladenjska_struktura > kolokacije > vecjez',
|
'pomen > skladenjske_skupine > skladenjska_struktura > kolokacije > vecjez',
|
||||||
'pomen > stalne_zveze > stalna_zveza > vecjez',
|
'pomen > stalne_zveze > stalna_zveza > vecjez',
|
||||||
'frazeoloske_zveze > frazeoloska_enota > vecjez'
|
'skladenjske_zveze > skladenjska_zveza > vecjez',
|
||||||
|
'frazeoloske_zveze > frazeoloska_enota > vecjez',
|
||||||
|
'pomen > podpomen > skladenjske_skupine > skladenjska_struktura > kolokacije > vecjez'
|
||||||
],
|
],
|
||||||
zgledi_locations: [
|
zgledi_locations: [
|
||||||
'zgledi > vecjez',
|
'zgledi > vecjez',
|
||||||
'zgledi'
|
'zgledi'
|
||||||
],
|
],
|
||||||
empty_prevod: '<prevod><tekst></tekst><vir></vir></prevod>',
|
oznake: OZNAKE_JSON,
|
||||||
oznake: ["a", "b", "c", "iztok", "ozbo", "hhhh"],
|
|
||||||
freq_stars_limits: [0, 552, 5206, 8613, 22561],
|
freq_stars_limits: [0, 552, 5206, 8613, 22561],
|
||||||
|
|
||||||
|
empty_prevod: function() {
|
||||||
|
var result = '<prevod>';
|
||||||
|
for(let oznaka_tip in this.oznake) {
|
||||||
|
result += `<oznaka tip="${ oznaka_tip }"></oznaka>`;
|
||||||
|
}
|
||||||
|
result += '<tekst></tekst><vir></vir></prevod>';
|
||||||
|
return result;
|
||||||
|
},
|
||||||
storeXml: function(xml) {
|
storeXml: function(xml) {
|
||||||
this.xml = xml;
|
this.xml = xml;
|
||||||
this.prevodi = [];
|
|
||||||
this.vecjez = [];
|
for(let loznaka of xml.find("prevod > oznaka")) {
|
||||||
this.zgledi = [];
|
var oznaka = $(loznaka);
|
||||||
|
var tip = oznaka.attr('tip');
|
||||||
|
if (!(tip in this.oznake)) {
|
||||||
|
oznaka.attr('tip', 'star');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(let fstring of this.prevod_locations) {
|
for(let fstring of this.prevod_locations) {
|
||||||
for(let vecjez of xml.find(fstring)) {
|
for(let vecjez of xml.find(fstring)) {
|
||||||
for(let pp of $(vecjez).find('pp')) {
|
for(let pp of $(vecjez).find('pp')) {
|
||||||
$(pp).prev().attr('semicolon', 'true');
|
$(pp).parent().attr('semicolon', 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let lprevod of $(vecjez).find("prevod")) {
|
for(let lprevod of $(vecjez).find("prevod")) {
|
||||||
var prevod = $(lprevod);
|
var prevod = $(lprevod);
|
||||||
if(prevod.text()) {
|
if(true) {
|
||||||
prevod.attr('prevod_id', this.prevodi.length);
|
prevod.attr('prevod_id', this.prevodi.length);
|
||||||
this.prevodi.push(prevod);
|
this.prevodi.push(prevod);
|
||||||
}
|
}
|
||||||
prevod.attr('line_num', this.vecjez.length);
|
prevod.attr('line_num', this.vecjez.length);
|
||||||
prevod.attr('semicolon', prevod.attr('semicolon') || false);
|
prevod.attr('semicolon', prevod.attr('semicolon') || false);
|
||||||
|
|
||||||
|
for(let oznaka_tip in this.oznake) {
|
||||||
|
var old = prevod.find(`oznaka[tip="${ oznaka_tip }"]`);
|
||||||
|
if(!old.length) {
|
||||||
|
to_prepend = `<oznaka tip="${ oznaka_tip }"></oznaka>`;
|
||||||
|
prevod.prepend($(to_prepend, xml));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(prevod.find('rzg').length == 0) {
|
||||||
|
prevod.append($("<rzg />", xml));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.vecjez.push($(vecjez));
|
this.vecjez.push($(vecjez));
|
||||||
}
|
}
|
||||||
|
@ -61,11 +88,30 @@ storeXml: function(xml) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(let lpomen of xml.find("pomen")) {
|
||||||
|
var pomen = $(lpomen);
|
||||||
|
var indikator = pomen.children(':first');
|
||||||
|
if(indikator.prop("tagName") != "indikator") {
|
||||||
|
indikator = $(`<indikator />`, xml)
|
||||||
|
pomen.prepend(indikator);
|
||||||
|
}
|
||||||
|
|
||||||
|
indikator.attr('indikator_id', this.indikatorji.length);
|
||||||
|
this.indikatorji.push(indikator);
|
||||||
|
}
|
||||||
|
|
||||||
var opomba = xml.find('glava > opomba');
|
var opomba = xml.find('glava > opomba');
|
||||||
if(!opomba.length) {
|
if(!opomba.length) {
|
||||||
var zaglavje = xml.find('glava > zaglavje');
|
var zaglavje = xml.find('glava > zaglavje');
|
||||||
zaglavje.after($('<opomba></opomba>', xml));
|
zaglavje.after($('<opomba></opomba>', xml));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(let lclanek of xml.find('clanek')) {
|
||||||
|
var clanek = $(lclanek);
|
||||||
|
if(!clanek.find('status').length) {
|
||||||
|
clanek.prepend($("<status>A-HU</status>", xml));
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
loadDependencies: function(url) {
|
loadDependencies: function(url) {
|
||||||
this.loadJs("https://cdn.jsdelivr.net/npm/sweet-modal@1.3.2/dist/min/jquery.sweet-modal.min.js");
|
this.loadJs("https://cdn.jsdelivr.net/npm/sweet-modal@1.3.2/dist/min/jquery.sweet-modal.min.js");
|
||||||
|
@ -89,10 +135,13 @@ loadJs: function(url) {
|
||||||
render_freq_start: function() {
|
render_freq_start: function() {
|
||||||
var element = $("#myed-freq-start");
|
var element = $("#myed-freq-start");
|
||||||
var freq = element.attr("freq");
|
var freq = element.attr("freq");
|
||||||
|
element.text('FREKVENCA: ' + freq);
|
||||||
|
/*
|
||||||
for(let f_lim of this.freq_stars_limits) {
|
for(let f_lim of this.freq_stars_limits) {
|
||||||
var cls = (f_lim > freq) ? "s0" : "s1";
|
var cls = (f_lim > freq) ? "s0" : "s1";
|
||||||
element.append($(`<span class=${ cls }>*</span>`));
|
element.append($(`<span class=${ cls }>*</span>`));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
},
|
},
|
||||||
isLast: function(el) {
|
isLast: function(el) {
|
||||||
return el.next().hasClass("myed-prevod-add") || el.next().hasClass('myed-prevod-bin');
|
return el.next().hasClass("myed-prevod-add") || el.next().hasClass('myed-prevod-bin');
|
||||||
|
@ -145,12 +194,24 @@ bin: function(el) {
|
||||||
change: function(el, func_after) {
|
change: function(el, func_after) {
|
||||||
var text_el = el.find('.myed-prevod-text');
|
var text_el = el.find('.myed-prevod-text');
|
||||||
var razlaga_el = el.find('.myed-prevod-razlaga');
|
var razlaga_el = el.find('.myed-prevod-razlaga');
|
||||||
|
var oznake_el = el.find('.myed-oznaka').map(function() {
|
||||||
|
var result = $(this).text();
|
||||||
|
if(result.length)
|
||||||
|
return result;
|
||||||
|
});
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.show_modal(text_el.text(), razlaga_el.text(), function(status, text, razlaga) {
|
self.show_modal(text_el.text(), razlaga_el, oznake_el, function(status, data) {
|
||||||
|
var text = data["prevedek"];
|
||||||
|
var razlaga = data['razlaga'];
|
||||||
|
var razlaga_tax = data['razlaga_tax'];
|
||||||
|
var deleteOld = data['remove_old'];
|
||||||
|
var oznake = data['oznake'];
|
||||||
|
|
||||||
if(status) {
|
if(status) {
|
||||||
text_el.text(text);
|
text_el.text(text);
|
||||||
razlaga_el.text(razlaga);
|
razlaga_el.text(razlaga);
|
||||||
|
razlaga_el.attr('taksonomija', razlaga_tax);
|
||||||
|
|
||||||
var xml_el = self.prevodi[el.attr('prevod_id')];
|
var xml_el = self.prevodi[el.attr('prevod_id')];
|
||||||
xml_el.find('tekst').text(text);
|
xml_el.find('tekst').text(text);
|
||||||
|
@ -159,6 +220,30 @@ change: function(el, func_after) {
|
||||||
xml_el.append("<rzg />", this.xml);
|
xml_el.append("<rzg />", this.xml);
|
||||||
}
|
}
|
||||||
xml_el.find('rzg').text(razlaga);
|
xml_el.find('rzg').text(razlaga);
|
||||||
|
xml_el.find('rzg').attr('taksonomija', razlaga_tax);
|
||||||
|
|
||||||
|
for (let oznaka of oznake) {
|
||||||
|
var tip = oznaka[0];
|
||||||
|
var value = oznaka[1];
|
||||||
|
|
||||||
|
// remove --
|
||||||
|
while(value.startsWith('-') || value.startsWith(' ')) {
|
||||||
|
value = value.substring(1, );
|
||||||
|
}
|
||||||
|
|
||||||
|
// write into xml
|
||||||
|
var oznaka_xml = xml_el.find(`oznaka[tip="${ tip }"]`);
|
||||||
|
oznaka_xml.text(value);
|
||||||
|
|
||||||
|
// write into html
|
||||||
|
var oznaka_html = el.find(`span[title="${ tip }"]`);
|
||||||
|
oznaka_html.text(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(deleteOld) {
|
||||||
|
xml_el.find(`oznaka[tip="star"]`).text("");
|
||||||
|
el.find(`span[title="star"]`).text("");
|
||||||
|
}
|
||||||
|
|
||||||
Screenful.Editor.changed();
|
Screenful.Editor.changed();
|
||||||
}
|
}
|
||||||
|
@ -180,7 +265,7 @@ add: function(el) {
|
||||||
|
|
||||||
clone.insertBefore(el);
|
clone.insertBefore(el);
|
||||||
var xml_container = this.vecjez[el.attr('line_num')];
|
var xml_container = this.vecjez[el.attr('line_num')];
|
||||||
var new_child = $(this.empty_prevod, this.xml);
|
var new_child = $(this.empty_prevod(), this.xml);
|
||||||
|
|
||||||
xml_container.append(new_child);
|
xml_container.append(new_child);
|
||||||
this.prevodi.push(new_child);
|
this.prevodi.push(new_child);
|
||||||
|
@ -213,6 +298,11 @@ action: function(el, action) {
|
||||||
this.semicolon(el);
|
this.semicolon(el);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
indikatorEdit: function(el, val) {
|
||||||
|
this.indikatorji[$(el).attr('indikator_id')].text(val);
|
||||||
|
$(el).text(val);
|
||||||
|
Screenful.Editor.changed();
|
||||||
|
},
|
||||||
zgledPrevod: function(el, val) {
|
zgledPrevod: function(el, val) {
|
||||||
var zgled_id = el.attr('zgled_id');
|
var zgled_id = el.attr('zgled_id');
|
||||||
var zgled = this.zgledi[zgled_id];
|
var zgled = this.zgledi[zgled_id];
|
||||||
|
@ -249,6 +339,13 @@ registerCallbacks: function() {
|
||||||
self.add($(this));
|
self.add($(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
root.on('click', '.myed-indikator', function() {
|
||||||
|
var el = $(this);
|
||||||
|
$.sweetModal.prompt('Indikator', 'Vstavi:', el.text(), function(val) {
|
||||||
|
self.indikatorEdit(el, val);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
root.on('keydown', '.myed-prevod-div', function(e) {
|
root.on('keydown', '.myed-prevod-div', function(e) {
|
||||||
var action = {
|
var action = {
|
||||||
13: "edit",
|
13: "edit",
|
||||||
|
@ -351,7 +448,7 @@ editor: function(div, entry, uneditable) {
|
||||||
// for "dodajanje prevodov" we need a model div to copy.
|
// for "dodajanje prevodov" we need a model div to copy.
|
||||||
// we create one here, that is then made invisible, but is
|
// we create one here, that is then made invisible, but is
|
||||||
// available for copying
|
// available for copying
|
||||||
$(this.empty_prevod, xml).insertBefore(xml.find('prevod').first());
|
$(this.empty_prevod(), xml).insertBefore(xml.find('prevod').first());
|
||||||
|
|
||||||
// adding prevod_id to prevodi
|
// adding prevod_id to prevodi
|
||||||
this.storeXml(xml);
|
this.storeXml(xml);
|
||||||
|
@ -380,25 +477,66 @@ editor: function(div, entry, uneditable) {
|
||||||
// select nothing in all hamburger dropdowns
|
// select nothing in all hamburger dropdowns
|
||||||
$('.myed-clanek-select').prop("selectedIndex", -1);
|
$('.myed-clanek-select').prop("selectedIndex", -1);
|
||||||
},
|
},
|
||||||
show_modal: function(prevedek, razlaga, callback) {
|
oznaka_callback: function(el) {
|
||||||
|
var select = el.parent().find('select');
|
||||||
|
var text = window.prompt("Nova oznaka");
|
||||||
|
select.append($('<option>', { text: text, selected: "selected" }));
|
||||||
|
},
|
||||||
|
show_modal: function(prevedek, razlaga, oznake, callback) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
function grabContent(status) {
|
function grabContent(status) {
|
||||||
if(!callback) return;
|
if(!callback) return;
|
||||||
var prevedek_t = $('#myed-sm-prevedek').val();
|
var oznake_t = $('.myed-oznaka-div').map(function() {
|
||||||
var razlaga_t = $('#myed-sm-razlaga').val();
|
var selected = $(this).find(":selected").text();
|
||||||
callback(status, prevedek_t, razlaga_t);
|
var tip = $.trim($(this).find('.myed-oznaka-key').first().text());
|
||||||
|
return [[tip, selected]];
|
||||||
|
}).get();
|
||||||
|
var callback_data = {
|
||||||
|
"prevedek": $('#myed-sm-prevedek').val(),
|
||||||
|
"razlaga": $('#myed-sm-razlaga').val(),
|
||||||
|
"razlaga_tax": $('#myed-tax').prop( "checked" ),
|
||||||
|
"remove_old": $( ".myed-old-oznaka-delete" ).prop( "checked" ),
|
||||||
|
"oznake": oznake_t
|
||||||
|
};
|
||||||
|
callback(status, callback_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
var options = "";
|
function isOznakaChosen(opt) {
|
||||||
for(let option of this.oznake) {
|
for(let o of oznake) {
|
||||||
options += `<option>${ option }</option>`;
|
var idx = opt.indexOf(o);
|
||||||
|
// either the whole word or after '-- '
|
||||||
|
// solving the problem of "-- biokemija" and "kemija" and simmilar (i know, a bad solution)
|
||||||
|
if(idx == 0 || idx == 3) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var options = "";
|
||||||
|
for(let [key, value] of Object.entries(this.oznake)) {
|
||||||
|
options += `<div class='myed-oznaka-div'><span class="myed-oznaka-key">${key}</span> <select><option></option>`;
|
||||||
|
for(let option of value) {
|
||||||
|
var optStart = "<option";
|
||||||
|
if(isOznakaChosen(option)) {
|
||||||
|
optStart += " selected";
|
||||||
|
}
|
||||||
|
options += `${optStart}>${ option }</option>`;
|
||||||
|
}
|
||||||
|
options += "</select><input class='myed-oznaka-input' type='button' value='drugo' /></div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
var tax = razlaga.attr('taksonomija') == "true" ? "checked" : "";
|
||||||
|
var izbrisiStareOznake = '<input class="myed-old-oznaka-delete" type="checkbox" name="deleteold" value="deleteold" id="deleteold"><label for="deleteold">Izbrisi stare oznake</label>';
|
||||||
|
|
||||||
$.sweetModal({
|
$.sweetModal({
|
||||||
title: 'Spreminjanje Prevedka',
|
title: 'Spreminjanje Prevedka',
|
||||||
content: `
|
content: `
|
||||||
Prevedek: <div class="sweet-modal-prompt"><input id="myed-sm-prevedek" type="text" value="${ prevedek }" /></div><br />
|
Prevedek: <div class="sweet-modal-prompt"><input id="myed-sm-prevedek" type="text" value="${ prevedek }" /></div><br />
|
||||||
Razlaga: <div class="sweet-modal-prompt"><input id="myed-sm-razlaga" type="text" value="${ razlaga }" /></div><br />
|
Razlaga: <div class="sweet-modal-prompt"><input id="myed-sm-razlaga" type="text" value="${ razlaga.text() }" /></div><br />
|
||||||
Oznaka: <select> ${ options } </select`,
|
<input id="myed-tax" type="checkbox" name="taksonomija" value="taksonomija" ${ tax }><label for="taksonomija">Razlaga je taksonomija</label><br />
|
||||||
|
Oznake: ${ options }<br />${ izbrisiStareOznake }`,
|
||||||
buttons: {
|
buttons: {
|
||||||
save: {
|
save: {
|
||||||
label: 'Shrani',
|
label: 'Shrani',
|
||||||
|
@ -411,7 +549,10 @@ show_modal: function(prevedek, razlaga, callback) {
|
||||||
action: function() { grabContent(false); },
|
action: function() { grabContent(false); },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onOpen: function() { $('#myed-sm-prevedek').focus(); }
|
onOpen: function() {
|
||||||
|
$('#myed-sm-prevedek').focus();
|
||||||
|
$('.myed-oznaka-input').on('click', function(e) { self.oznaka_callback($(this)); });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
harvester: function(div) {
|
harvester: function(div) {
|
||||||
|
@ -421,17 +562,35 @@ harvester: function(div) {
|
||||||
$(pp).remove();
|
$(pp).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let lprevod of $(vecjez).find("prevod")) {
|
var all_prevod = $(vecjez).find("prevod");
|
||||||
|
// if only one prevod and that one is deleted, just create an empty one.
|
||||||
|
if(all_prevod.length == 1 && $(all_prevod[0]).attr('bin') == 'true') {
|
||||||
|
var empty = this.empty_prevod();
|
||||||
|
all_prevod.append(empty);
|
||||||
|
$(all_prevod[0]).after(empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(let lprevod of all_prevod) {
|
||||||
var prevod = $(lprevod);
|
var prevod = $(lprevod);
|
||||||
|
if(prevod.attr('bin') == 'true') {
|
||||||
|
prevod.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(prevod.attr('semicolon') == 'true') {
|
if(prevod.attr('semicolon') == 'true') {
|
||||||
prevod.append($("<pp/>", this.xml));
|
prevod.append($("<pp/>", this.xml));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prevod.removeAttr('semicolon');
|
||||||
|
prevod.removeAttr('bin');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log((new XMLSerializer()).serializeToString(this.xml[0]));
|
// save status
|
||||||
// return sessionStorage.myed_original;
|
var status_txt = $('input[name=status]:checked', '#myed-status').val();
|
||||||
|
this.xml.find('status').text(status_txt);
|
||||||
|
|
||||||
return (new XMLSerializer()).serializeToString(this.xml[0]);
|
return (new XMLSerializer()).serializeToString(this.xml[0]);
|
||||||
},
|
},
|
||||||
xslt: XSLFILE,
|
xslt: XSLFILE,
|
||||||
|
|
95
main.xslt
95
main.xslt
|
@ -8,13 +8,64 @@
|
||||||
</div>
|
</div>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="clanek/status">
|
||||||
|
<form id="myed-status">
|
||||||
|
<xsl:element name="input">
|
||||||
|
<xsl:attribute name="type">radio</xsl:attribute>
|
||||||
|
<xsl:attribute name="name">status</xsl:attribute>
|
||||||
|
<xsl:attribute name="value">A-HU</xsl:attribute>
|
||||||
|
<xsl:if test="text()='A-HU'"><xsl:attribute name="checked" /></xsl:if>
|
||||||
|
</xsl:element>
|
||||||
|
nepregledano
|
||||||
|
<xsl:element name="input">
|
||||||
|
<xsl:attribute name="type">radio</xsl:attribute>
|
||||||
|
<xsl:attribute name="name">status</xsl:attribute>
|
||||||
|
<xsl:attribute name="value">DESLO</xsl:attribute>
|
||||||
|
<xsl:if test="text()='DESLO'"><xsl:attribute name="checked" /></xsl:if>
|
||||||
|
</xsl:element>
|
||||||
|
v delu
|
||||||
|
<xsl:element name="input">
|
||||||
|
<xsl:attribute name="type">radio</xsl:attribute>
|
||||||
|
<xsl:attribute name="name">status</xsl:attribute>
|
||||||
|
<xsl:attribute name="value">PREHUN</xsl:attribute>
|
||||||
|
<xsl:if test="text()='PREHUN'"><xsl:attribute name="checked" /></xsl:if>
|
||||||
|
</xsl:element>
|
||||||
|
za HUN redakcijo
|
||||||
|
<xsl:element name="input">
|
||||||
|
<xsl:attribute name="type">radio</xsl:attribute>
|
||||||
|
<xsl:attribute name="name">status</xsl:attribute>
|
||||||
|
<xsl:attribute name="value">PRISLO</xsl:attribute>
|
||||||
|
<xsl:if test="text()='PRISLO'"><xsl:attribute name="checked" /></xsl:if>
|
||||||
|
</xsl:element>
|
||||||
|
za SLO dopolnitev
|
||||||
|
<xsl:element name="input">
|
||||||
|
<xsl:attribute name="type">radio</xsl:attribute>
|
||||||
|
<xsl:attribute name="name">status</xsl:attribute>
|
||||||
|
<xsl:attribute name="value">OUT</xsl:attribute>
|
||||||
|
<xsl:if test="text()='OUT'"><xsl:attribute name="checked" /></xsl:if>
|
||||||
|
</xsl:element>
|
||||||
|
za izlocitev
|
||||||
|
<xsl:element name="input">
|
||||||
|
<xsl:attribute name="type">radio</xsl:attribute>
|
||||||
|
<xsl:attribute name="name">status</xsl:attribute>
|
||||||
|
<xsl:attribute name="value">Z</xsl:attribute>
|
||||||
|
<xsl:if test="text()='Z'"><xsl:attribute name="checked" /></xsl:if>
|
||||||
|
</xsl:element>
|
||||||
|
ZAKLJUCENO
|
||||||
|
</form>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="clanek/glava">
|
<xsl:template match="clanek/glava">
|
||||||
<div>
|
<div>
|
||||||
<xsl:apply-templates select="korpusi/korpus[1]/frek_lema | oblika/iztocnica | zaglavje/besedna_vrsta"/>
|
<xsl:apply-templates select="korpusi/korpus[1]/frek_lema | oblika/iztocnica | zaglavje/besedna_vrsta"/>
|
||||||
<span id="myed-opomba"><xsl:apply-templates select="opomba"/></span>
|
<xsl:apply-templates select="opomba"/>
|
||||||
</div>
|
</div>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="glava/opomba">
|
||||||
|
<span id="myed-opomba"><xsl:apply-templates/></span>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="korpusi/korpus/frek_lema">
|
<xsl:template match="korpusi/korpus/frek_lema">
|
||||||
<xsl:element name="span">
|
<xsl:element name="span">
|
||||||
<xsl:attribute name="id">myed-freq-start</xsl:attribute>
|
<xsl:attribute name="id">myed-freq-start</xsl:attribute>
|
||||||
|
@ -92,32 +143,29 @@
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!--disambiguators anywhere-->
|
<!--disambiguators anywhere-->
|
||||||
<xsl:template match="indikator[text() or *]">
|
<xsl:template match="indikator">
|
||||||
<xsl:if test="count(parent::pomen/../pomen)>1 or oznaka">
|
<xsl:if test="count(parent::pomen/../pomen)>0 or oznaka">
|
||||||
<xsl:text xml:space="preserve"> </xsl:text>
|
<xsl:element name="span">
|
||||||
<span>
|
<xsl:attribute name="class">myed-indikator</xsl:attribute>
|
||||||
<xsl:if test="not(oznaka) or text()"><xsl:text xml:space="preserve">(</xsl:text></xsl:if>
|
<xsl:attribute name="indikator_id"><xsl:value-of select="@indikator_id"/></xsl:attribute>
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
<xsl:if test="not(oznaka) or text()"><xsl:text xml:space="preserve">)</xsl:text></xsl:if>
|
</xsl:element>
|
||||||
</span>
|
|
||||||
<xsl:text xml:space="preserve"> </xsl:text>
|
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
<xsl:template match="oznaka[text() or *]">
|
<xsl:template match="oznaka">
|
||||||
<xsl:if test="not(parent::indikator)"><xsl:text xml:space="preserve"> </xsl:text></xsl:if>
|
<xsl:element name="span">
|
||||||
<span class="myed-oznaka">
|
<xsl:attribute name="class">myed-oznaka</xsl:attribute>
|
||||||
|
<xsl:attribute name="title"><xsl:value-of select="@tip" /></xsl:attribute>
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
</span>
|
</xsl:element>
|
||||||
<xsl:if test="not(parent::indikator)"><xsl:text xml:space="preserve"> </xsl:text></xsl:if>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
<xsl:template match="oznaka[text() or *]">
|
<xsl:template match="rzg">
|
||||||
<span class="myed-oznaka">
|
<xsl:element name="span">
|
||||||
<xsl:if test="not(parent::indikator/text())"><xsl:text xml:space="preserve">(</xsl:text></xsl:if>
|
<xsl:attribute name="class">myed-prevod-razlaga</xsl:attribute>
|
||||||
|
<xsl:attribute name="taksonomija"><xsl:value-of select="@taksonomija" /></xsl:attribute>
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
<xsl:if test="not(parent::indikator/text())"><xsl:text xml:space="preserve">)</xsl:text></xsl:if>
|
</xsl:element>
|
||||||
</span>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
<xsl:template match="indikator | oznaka"/>
|
|
||||||
|
|
||||||
<!--sense-level translations-->
|
<!--sense-level translations-->
|
||||||
<xsl:template match="vecjez/prevod">
|
<xsl:template match="vecjez/prevod">
|
||||||
|
@ -131,10 +179,10 @@
|
||||||
<xsl:attribute name="prevod_id"><xsl:value-of select="@prevod_id" /></xsl:attribute>
|
<xsl:attribute name="prevod_id"><xsl:value-of select="@prevod_id" /></xsl:attribute>
|
||||||
<xsl:attribute name="tabindex">1</xsl:attribute>
|
<xsl:attribute name="tabindex">1</xsl:attribute>
|
||||||
|
|
||||||
<span class="myed-prevod-oznaka"><xsl:apply-templates select=".//oznaka"/></span>
|
<xsl:apply-templates select=".//oznaka | .//ustaljena_oblika"/>
|
||||||
<span class="myed-prevod-text"><xsl:apply-templates select=".//tekst"/></span>
|
<span class="myed-prevod-text"><xsl:apply-templates select=".//tekst"/></span>
|
||||||
<sup><xsl:apply-templates select=".//vir"/></sup>
|
<sup><xsl:apply-templates select=".//vir"/></sup>
|
||||||
<span class="myed-prevod-razlaga"><xsl:apply-templates select=".//rzg"/></span>
|
<xsl:apply-templates select=".//rzg"/>
|
||||||
|
|
||||||
<select class="myed-clanek-select">
|
<select class="myed-clanek-select">
|
||||||
<option value="edit" title="Spremeni / HUN">✎</option>
|
<option value="edit" title="Spremeni / HUN">✎</option>
|
||||||
|
@ -150,6 +198,9 @@
|
||||||
myed-prevod-semicolon
|
myed-prevod-semicolon
|
||||||
<xsl:if test="@semicolon!='true'">myed-prevod-semicolon-hidden</xsl:if>
|
<xsl:if test="@semicolon!='true'">myed-prevod-semicolon-hidden</xsl:if>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
|
<xsl:attribute name="ozbo">
|
||||||
|
<xsl:value-of select="@semicolon" />
|
||||||
|
</xsl:attribute>
|
||||||
;
|
;
|
||||||
</xsl:element>
|
</xsl:element>
|
||||||
</xsl:element>
|
</xsl:element>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user