Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente | |||
|
user:domenge:javascript:congres [2017/12/19 17:33] domenge [Demòra de far] |
user:domenge:javascript:congres [2018/01/22 06:41] (Version actuelle) domenge [Demòra de far] |
||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | ====== Basic - algoritme per trachar los tèrms espandits e/o communs ====== | ||
| + | L'algoritme foncciona sus la partida clienta, es a dire lo navigador de l'usatgièr. Cada pic dins un ''camp dialectal'' (Lengadocian, Gascon, Provençal e Lemosin, Auvernhat, Vivaro-Alpenc) las donadas son cambiadas, lo boton « Aplicar » s'enlusís per far mòstra que los camps non cambiadisses ''espandit'' e ''commun'' devon èsser mes a jorn. Al picar del boton e se las reglas son realizadas, los camps son apasturats e lo boton torna a son estat normal.\\ | ||
| + | Cada còp possible son normalizadas las entradas dins los ''camps dialectals'' al nivèl de la ponctuacion. | ||
| + | <note> | ||
| + | L'empliment dels camps ''commun'' e ''espandit'' es sonque indicatiu e temporari, devenon permanent quand la ficha es **enregistrada**. | ||
| + | </note> | ||
| + | ===== Demòra de far ===== | ||
| + | |||
| + | FIXME PAS DE BESONH <del>Trachar la nocion de ''/'' coma separator per dos tèrmes eqüivalents.</del>\\ | ||
| + | FIXME FACH <del>Ordonar los tèrmes espandits segon lor emplec demest los dialèctes.</del>\\ | ||
| + | FIXME La cumulacion dels tèrmes sufixats al/au nos cal tanben trachar èl/èu/èth, ...\\ | ||
| + | FIXME FACH <del>Enebir l'afichatge dels camps mièjornal e septentrional se lo tèrme es espandit o commun.</del>\\ | ||
| + | FIXME integrar los lexícs Vivaro-alpenc e Provençau\\ | ||
| + | FIXME integrar la seconda partida dels lexíc Lemosin\\ | ||
| + | FIXME FACH La possibilitat de desvarolhar los camps non cambiadisses (es a dire enebir l'algoritme) se pòt concebre quand lo camp ''manual'' es botat, alara los automatismes del formulari son enebits e l'autor en darrièra fin pòt pelfinar lo trabalh. L'enregistrament es totjorn possible.\\ | ||
| + | FIXME Un messatge per avisar que la ficha es estada modificada. | ||
| + | |||
| + | ===== Definicions ===== | ||
| + | ;''camp dialectal'' : un camp de sasida dins lo formulari que corespond a cada dialècte occitan. | ||
| + | ;''term'' (tèrme) : un lexèm que corespond al tèrm francés. Se lo lexèm ven amb lo masculin e lo femenin son separats amb une virgula '',''. Mai d'un tèrme se pòdon trapar dins un sol camp dialectal, lor separator es un punt-virgula '';''. | ||
| + | ;''weight'' (pes) : cada occuréncia d'un tèrme dins un camp lexical apond un pes qu'es una poténcia de 2. Çò qu'es mai simple de manejar lo tèrme amb una aritmetica de bits (//bitwise//). | ||
| + | | ||
| + | ===== Reglas ===== | ||
| + | Un tèrme es ''commun'' se es present dins cada camp dialectal. Son pes es 63.\\ | ||
| + | Un tèrme es ''espandit'' se existís dins las doas zònas ''miejornala'' e ''septentrionala'' e qu'es pas ''commun''.\\ | ||
| + | Per una entrada, i pòt avure al encòp de tèrmes ''espandits'' e ''communs''. | ||
| + | |||
| + | ===== Exemple ===== | ||
| + | {{:user:domenge:javascript:algo_aporloc_basic_v2.png|}}\\ | ||
| + | |||
| + | ===== Per comptar los bits a 1 dins lo pes (Bit Counter) ===== | ||
| + | Per ordonar los tèrms espandits segon lor emplec demest los dialèctes, avèm de comptar lo nombre de dialèctes que lo tèrme i es dedins. Cada dialècte a una plaça per son bit. 32 per lo vivarés-alpenc, 16 l'auvernhat, 8 lo lemosin, 4 lo provençal, 2 lo gascon, 1 lo lengadocian.\\ | ||
| + | Un masq es creat amb la valor 32, puèi lo masq es aplicat al pes amb un operator binari & (and) e se torna 1 (//TRUE//) los dos bit son a 1, lo comptador es incrementat (a 32 lo dialècte vivavo-alpenc es evaluat). Puèi lo masque es mudat cap a drecha d'una plaça, ansin la valor del masque passa de 32, 16, 8, 4, 2, 1, 0 per agachar cada bit del pes. Quand lo masque es agotat, la bocla s'acaba, e se torna la resulta.\\ | ||
| + | |||
| + | <code javascript> | ||
| + | var MASK_MAX = 0x20; // 32 | ||
| + | // Entry.bitCount() | ||
| + | this.bitCount = function(){ | ||
| + | var mask = MASK_MAX; | ||
| + | var valret = 0; | ||
| + | while (mask > 0){ | ||
| + | if (this.weight & mask){valret++;}//if | ||
| + | mask>>>= 1; | ||
| + | } // while | ||
| + | return valret; | ||
| + | }//bitCount | ||
| + | </code> | ||
| + | | ||
| + | ===== L'algoritme entièr ===== | ||
| + | <code javascript> | ||
| + | /* | ||
| + | * WEIGHTS | ||
| + | */ | ||
| + | var LENG = 1; | ||
| + | var GASC = 2; | ||
| + | var PROV = 4; | ||
| + | var LEM = 8; | ||
| + | var AUV = 16; | ||
| + | var ALP = 32; | ||
| + | var ALLDIALECTS = 63; | ||
| + | var MASK_MAX = 0x20; // 32 | ||
| + | |||
| + | /** | ||
| + | * Entry | ||
| + | */ | ||
| + | function Entry(aString){ | ||
| + | this.aString = aString; | ||
| + | this.weight = 0; | ||
| + | this.equals = function(aEntry){ | ||
| + | return (aEntry.aString === this.aString); | ||
| + | } // equals | ||
| + | | ||
| + | this.addDialect = function(aDialect){return(aEntry.aString == this.aString);} | ||
| + | this.toString = function(){return this.aString;} | ||
| + | | ||
| + | /** | ||
| + | * definition : | ||
| + | * to be commonly used the weight MUST be at its maximum | ||
| + | */ | ||
| + | this.isCommunlyUsed = function(){ | ||
| + | return (this.weight == ALLDIALECTS); | ||
| + | } // isCommunlyUsed | ||
| + | | ||
| + | /** | ||
| + | * definition : | ||
| + | * used in all southern dialects | ||
| + | */ | ||
| + | this.isSouthern = function(){ | ||
| + | return (this.weight & LENG && this.weight & GASC && this.weight & PROV); | ||
| + | } // isSouthern | ||
| + | | ||
| + | /** | ||
| + | * definition : | ||
| + | * used in all northern dialects | ||
| + | */ | ||
| + | this.isNorthern = function(){ | ||
| + | return (this.weight & LEM && this.weight & AUV && this.weight & ALP); | ||
| + | } // isNorthern | ||
| + | | ||
| + | /** | ||
| + | * definition : | ||
| + | * to be widely used, a term MUST NOT be used in all dialects but at least in the south and the north part of Occitania | ||
| + | */ | ||
| + | this.isWidelyUsed = function(){ | ||
| + | return (this.weight != ALLDIALECTS && (this.weight & LENG || this.weight & GASC || this.weight & PROV) && (this.weight & LEM || this.weight & AUV || this.weight & ALP)); | ||
| + | } // isWidelyUsed | ||
| + | | ||
| + | this.setWeight = function(dialectWeight){ | ||
| + | this.weight |= dialectWeight; | ||
| + | // console.log( 'string : ' + this.aString + ', w : ' + this.weight + ', dialectWeight : ' + dialectWeight); | ||
| + | } // setWeight | ||
| + | |||
| + | this.bitCount = function(){ | ||
| + | var mask = MASK_MAX; | ||
| + | var valret = 0; | ||
| + | while (mask > 0){ | ||
| + | if (this.weight & mask){valret ++;} // if | ||
| + | mask>>>= 1; | ||
| + | } // while | ||
| + | // console.log(this.aString +' : ' + valret + ' : ' + mask); | ||
| + | return valret; | ||
| + | } // bitCount | ||
| + | |||
| + | } // Entry | ||
| + | |||
| + | /** | ||
| + | * Singles | ||
| + | * | ||
| + | * this object is a singleton that maintain a list of unique terms. The data model is set with two arrays : | ||
| + | * - an array of string | ||
| + | * - an array of Entry objects | ||
| + | * the two lists grow alongside and they are used as a replacement for hash table. | ||
| + | * The use of the first is necessary by the need of the method indexOf | ||
| + | */ | ||
| + | function Singles(){ | ||
| + | this.occurences = []; | ||
| + | this.terms = []; | ||
| + | |||
| + | /** | ||
| + | * populateOccurences | ||
| + | */ | ||
| + | this.tokenizeAndAddEntry = function(dialectWeight, data){ | ||
| + | if (typeof data !== 'undefined' && data.length > 0){ | ||
| + | // clean the string | ||
| + | data = data.replace(/\s*,\s*/g,','); | ||
| + | data = data.replace(/\s*;\s*/g,";"); | ||
| + | data = data.replace(/\s*$/g,''); | ||
| + | | ||
| + | var arr = data.split(";"); | ||
| + | |||
| + | for (i=0; i < arr.length; i++){ | ||
| + | var entry = new Entry(arr[i]); | ||
| + | this.addEntry(entry,dialectWeight); | ||
| + | } | ||
| + | } | ||
| + | } // tokenizeAndAddEntry | ||
| + | /** | ||
| + | * populateOccurences | ||
| + | */ | ||
| + | this.populateOccurences = function(){ | ||
| + | |||
| + | this.tokenizeAndAddEntry(LENG,'bla, bla ; bli, bli ; ble, ble'); | ||
| + | this.tokenizeAndAddEntry(GASC,'bli, bli ; blo, blo ; bla, bla ; ble,ble'); | ||
| + | this.tokenizeAndAddEntry(PROV,'bla, bla ; bli, bli'); | ||
| + | this.tokenizeAndAddEntry(LEM,'bla, bla ; blu'); | ||
| + | this.tokenizeAndAddEntry(AUV,'bla, bla ; blu'); | ||
| + | this.tokenizeAndAddEntry(ALP,'bli, bli ; bla, bla; ble, ble'); | ||
| + | | ||
| + | } // populateOccurences | ||
| + | | ||
| + | /** | ||
| + | * addEntry | ||
| + | */ | ||
| + | this.addEntry = function(aEntry, dialectWeight){ | ||
| + | var ind = this.terms.indexOf(aEntry.aString); | ||
| + | if (ind === -1){ | ||
| + | aEntry.setWeight(dialectWeight); | ||
| + | this.occurences.push(aEntry); | ||
| + | this.terms.push(aEntry.aString); | ||
| + | } else{ | ||
| + | this.occurences[ind].setWeight(dialectWeight); | ||
| + | } | ||
| + | } // addEntry | ||
| + | |||
| + | /** | ||
| + | * getEntriesCommunlyUsed | ||
| + | */ | ||
| + | this.getEntriesCommunlyUsed = function(){ | ||
| + | var arr = []; | ||
| + | for (i= 0 ; i < this.occurences.length;i++){ | ||
| + | if (this.occurences[i].isCommunlyUsed()){ | ||
| + | arr.push(this.occurences[i]); | ||
| + | } // if | ||
| + | } // for | ||
| + | | ||
| + | return arr; | ||
| + | } // getEntriesCommunlyUsed | ||
| + | | ||
| + | /** | ||
| + | * getEntriesWidelyUsed | ||
| + | */ | ||
| + | this.getEntriesWidelyUsed = function(){ | ||
| + | var arr = []; | ||
| + | for (i= 0 ; i < this.occurences.length;i++){ | ||
| + | if (this.occurences[i].isWidelyUsed()){ | ||
| + | arr.push(this.occurences[i]); | ||
| + | } // if | ||
| + | } // for | ||
| + | // the sort function uses our customized one | ||
| + | arr.sort(function(a,b){ return b.bitCount() - a.bitCount();}); | ||
| + | return arr; | ||
| + | } // getEntriesWidelyUsed | ||
| + | |||
| + | /** | ||
| + | * getEntriesMeridional | ||
| + | */ | ||
| + | this.getEntriesSouthern = function(){ | ||
| + | var arr = []; | ||
| + | for (i= 0 ; i < this.occurences.length;i++){ | ||
| + | if (this.occurences[i].isSouthern()){ | ||
| + | arr.push(this.occurences[i]); | ||
| + | } // if | ||
| + | } // for | ||
| + | return arr; | ||
| + | } // getEntriesSouthern | ||
| + | |||
| + | /** | ||
| + | * getEntriesNorthern | ||
| + | */ | ||
| + | this.getEntriesNorthern = function(){ | ||
| + | var arr = []; | ||
| + | for (i= 0 ; i < this.occurences.length;i++){ | ||
| + | if (this.occurences[i].isNorthern()){ | ||
| + | arr.push(this.occurences[i]); | ||
| + | } // if | ||
| + | } // for | ||
| + | return arr; | ||
| + | } // getEntriesNorthern | ||
| + | |||
| + | /** | ||
| + | * check | ||
| + | */ | ||
| + | this.check = function(){ | ||
| + | for (i= 0 ; i < this.occurences.length;i++){ | ||
| + | console.log("occurence : " + this.occurences[i].toString() + " weight : " + this.occurences[i].weight); | ||
| + | } // for | ||
| + | |||
| + | var arr = this.getEntriesCommunlyUsed(); | ||
| + | var s = ""; | ||
| + | for (i= 0 ; i < arr.length;i++){ | ||
| + | s += arr[i].toString() + ' ; '; | ||
| + | } // for | ||
| + | s = s.replace(/\s;\s$/,''); | ||
| + | console.log("communlyUsed : " + s); | ||
| + | |||
| + | arr = this.getEntriesWidelyUsed(); | ||
| + | s = ''; | ||
| + | for (i= 0 ; i < arr.length;i++){ | ||
| + | s += arr[i].toString() + ' ; '; | ||
| + | } // for | ||
| + | s = s.replace(/\s;\s$/,''); | ||
| + | console.log("widelyUsed : " + s); | ||
| + | } // check | ||
| + | /************************************************* | ||
| + | * | ||
| + | * R E F R E S H | ||
| + | * The most important function | ||
| + | * | ||
| + | ************************************************/ | ||
| + | this.refresh = function(){ | ||
| + | |||
| + | aSingles.reset(); | ||
| + | aSingles.tokenizeAndAddEntry(LENG,document.getElementById("leng").value); | ||
| + | aSingles.tokenizeAndAddEntry(GASC,document.getElementById("gasc").value); | ||
| + | aSingles.tokenizeAndAddEntry(PROV,document.getElementById("prov").value); | ||
| + | aSingles.tokenizeAndAddEntry(LEM,document.getElementById("lemosin").value); | ||
| + | aSingles.tokenizeAndAddEntry(AUV,document.getElementById("auvernhat").value); | ||
| + | aSingles.tokenizeAndAddEntry(ALP,document.getElementById("vivalpenc").value); | ||
| + | // Entries communly used | ||
| + | var arr = this.getEntriesCommunlyUsed(); | ||
| + | var s = ""; | ||
| + | for (i= 0 ; i < arr.length;i++){ | ||
| + | s += arr[i].toString() + ' ; '; | ||
| + | } // for | ||
| + | s = s.replace(/\s;\s$/,''); | ||
| + | s = s.replace(/\s;\s$/,''); | ||
| + | document.getElementById("commun").value = s; | ||
| + | // console.log("commun : " + s); | ||
| + | |||
| + | // Entries widely used | ||
| + | arr = this.getEntriesWidelyUsed(); | ||
| + | s = ''; | ||
| + | for (i= 0 ; i < arr.length;i++){ | ||
| + | s += arr[i].toString() + ' ; '; | ||
| + | } // for | ||
| + | s = s.replace(/\s;\s$/,''); | ||
| + | s = s.replace(/\s;\s$/,''); | ||
| + | // console.log("widelyUsed : " + s); | ||
| + | document.getElementById("espandit").value = s; | ||
| + | | ||
| + | // Southern entries | ||
| + | arr = this.getEntriesSouthern(); | ||
| + | s = ''; | ||
| + | for (i= 0 ; i < arr.length;i++){ | ||
| + | if (! arr[i].isWidelyUsed() && !arr[i].isCommunlyUsed()){ | ||
| + | s += arr[i].toString() + ' ; '; | ||
| + | } | ||
| + | } // for | ||
| + | s = s.replace(/\s;\s$/,''); | ||
| + | s = s.replace(/\s;\s$/,''); | ||
| + | // console.log("southern : " + s); | ||
| + | document.getElementById("southern").value = s; | ||
| + | |||
| + | // Northern entries | ||
| + | arr = this.getEntriesNorthern(); | ||
| + | s = ''; | ||
| + | for (i= 0 ; i < arr.length;i++){ | ||
| + | if (! arr[i].isWidelyUsed() && ! arr[i].isCommunlyUsed()){ | ||
| + | s += arr[i].toString() + ' ; '; | ||
| + | } | ||
| + | } // for | ||
| + | s = s.replace(/\s;\s$/,''); | ||
| + | s = s.replace(/\s;\s$/,''); | ||
| + | // console.log("northern : " + s); | ||
| + | document.getElementById("northern").value = s; | ||
| + | | ||
| + | // turns the button in its normal state | ||
| + | document.getElementById("applyButton").classList.remove('btn-warning'); | ||
| + | |||
| + | } // refresh | ||
| + | |||
| + | /** | ||
| + | * reset | ||
| + | */ | ||
| + | this.reset = function(){ | ||
| + | this.occurences = []; | ||
| + | this.terms = []; | ||
| + | }// reset | ||
| + | } // Singles | ||
| + | |||
| + | /** | ||
| + | * THE OBJECT | ||
| + | */ | ||
| + | var aSingles = {}; | ||
| + | |||
| + | function postwith (to,p) { | ||
| + | var myForm = document.createElement("form"); | ||
| + | myForm.method="post" ; | ||
| + | myForm.action = to ; | ||
| + | for (var k in p) { | ||
| + | var myInput = document.createElement("input") ; | ||
| + | myInput.setAttribute("name", k) ; | ||
| + | myInput.setAttribute("value", p[k]); | ||
| + | myForm.appendChild(myInput) ; | ||
| + | } | ||
| + | document.body.appendChild(myForm) ; | ||
| + | myForm.submit() ; | ||
| + | document.body.removeChild(myForm) ; | ||
| + | }// postwith | ||
| + | |||
| + | function setApplyButtonState(){ | ||
| + | var isCompleted = document.getElementById("completedCheckbox").checked; | ||
| + | var applyButton = document.getElementById("applyButton"); | ||
| + | |||
| + | if (isCompleted){ | ||
| + | applyButton.disabled = true; | ||
| + | applyButton.classList.remove('btn-warning'); | ||
| + | }else{ | ||
| + | applyButton.disabled = false; | ||
| + | applyButton.classList.add('btn-warning'); | ||
| + | } | ||
| + | | ||
| + | } // setApplyButtonStyle | ||
| + | |||
| + | function definitionAsSeen(){ | ||
| + | |||
| + | var glossterm =document.getElementById("glossterm").value; | ||
| + | var categorie =document.getElementById("categorie").value; | ||
| + | var commun =document.getElementById("commun").value; | ||
| + | var espandit =document.getElementById("espandit").value; | ||
| + | var southern =document.getElementById("southern").value; | ||
| + | var northern =document.getElementById("northern").value; | ||
| + | var leng =document.getElementById("leng").value; | ||
| + | var gasc =document.getElementById("gasc").value; | ||
| + | var prov =document.getElementById("prov").value; | ||
| + | var lemosin =document.getElementById("lemosin").value; | ||
| + | var auvernhat =document.getElementById("auvernhat").value; | ||
| + | var vivalpenc =document.getElementById("vivalpenc").value; | ||
| + | |||
| + | var glosstermFmt ='glosstermFmt'; | ||
| + | var categorieFmt ='categorieFmt'; | ||
| + | var communFmt =''; | ||
| + | var espanditFmt =''; | ||
| + | var southernFmt =''; | ||
| + | var northernFmt =''; | ||
| + | var lengFmt =''; | ||
| + | var gascFmt =''; | ||
| + | var provFmt =''; | ||
| + | var lemosinFmt =''; | ||
| + | var auvernhatFmt =''; | ||
| + | var vivalpencFmt =''; | ||
| + | |||
| + | if (glossterm != ''){glosstermFmt ='<span class="fr">[fr] ' + glossterm + '</span>';} | ||
| + | if (categorie != ''){ categorieFmt ='<span class="categorie">[catg] ' + categorie + '</span>';} | ||
| + | if (commun != ''){communFmt ='<span class="commun">[com] ' + commun + '</span>';} | ||
| + | if (espandit != ''){espanditFmt ='<span class="espandit">[esp] ' + espandit + '</span>';} | ||
| + | if (southern != ''){southernFmt ='<span class="southern">[miej] ' + southern + '</span>';} | ||
| + | if (northern != ''){ northernFmt ='<span class="northern">[sept] ' + northern + '</span>';} | ||
| + | if (leng != ''){lengFmt ='<span class="leng">[leng] ' + leng + '</span>';} | ||
| + | if (gasc != ''){gascFmt ='<span class="gasc">[gasc] ' + gasc + '</span>';} | ||
| + | if (prov != ''){ provFmt ='<span class="prov">[prov] ' + prov + '</span>';} | ||
| + | if (lemosin != ''){lemosinFmt ='<span class="lem">[lem] ' + lemosin + '</span>';} | ||
| + | if (auvernhat != '') {auvernhatFmt ='<span class="auv">[auv] ' + auvernhat + '</span>';} | ||
| + | if (vivalpenc != '') {vivalpencFmt ='<span class="alp">[alp] ' + vivalpenc + '</span>';} | ||
| + | |||
| + | var x = glosstermFmt + " (" + categorieFmt + ") : "+ communFmt + "," + espanditFmt + "," + southernFmt + "," + lengFmt + "," | ||
| + | + gascFmt + "," + provFmt + "," + northernFmt + "," + lemosinFmt + "," + auvernhatFmt + "," + vivalpencFmt + "."; | ||
| + | // some formatting and clean up | ||
| + | x = x.replace(/,,/g,','); | ||
| + | x = x.replace(/,,/g,','); | ||
| + | x = x.replace(/,,/g,','); | ||
| + | x = x.replace(/: ,/g,': '); | ||
| + | x = x.replace(/,\./g,'.'); | ||
| + | |||
| + | x = x.replace(/,/g,', '); | ||
| + | return x; | ||
| + | } // definitionAsSeen | ||
| + | |||
| + | |||
| + | if (Drupal.jsEnabled){ | ||
| + | $(window).load( | ||
| + | function(){ | ||
| + | aSingles = new Singles(); | ||
| + | aSingles.refresh(); | ||
| + | setApplyButtonState(); | ||
| + | } | ||
| + | ); | ||
| + | | ||
| + | $(document).ready(function(){ | ||
| + | //event | ||
| + | $("#applyButton").click( | ||
| + | function(){ | ||
| + | aSingles.refresh(); | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | } // function | ||
| + | ); // event | ||
| + | $("#acception").keyup(function () { | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | }).keyup(); | ||
| + | $("#commun").keyup(function () { | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | }).keyup(); | ||
| + | $("#espandit").keyup(function () { | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | }).keyup(); | ||
| + | $("#southern").keyup(function () { | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | }).keyup(); | ||
| + | $("#leng").keyup(function () { | ||
| + | setApplyButtonState(); | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | }).keyup(); | ||
| + | $("#gasc").keyup(function () { | ||
| + | setApplyButtonState(); | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | }).keyup(); | ||
| + | $("#prov").keyup(function () { | ||
| + | setApplyButtonState(); | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | }).keyup(); | ||
| + | $("#northern").keyup(function () { | ||
| + | setApplyButtonState(); | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | }).keyup(); | ||
| + | $("#auvernhat").keyup(function () { | ||
| + | setApplyButtonState(); | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | }).keyup(); | ||
| + | $("#lemosin").keyup(function () { | ||
| + | setApplyButtonState(); | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | }).keyup(); | ||
| + | $("#vivalpenc").keyup(function () { | ||
| + | setApplyButtonState(); | ||
| + | $("#definition_seen").html(definitionAsSeen()); | ||
| + | }).keyup(); | ||
| + | $("#completedCheckbox").change(function () { | ||
| + | var isCompleted = document.getElementById("completedCheckbox").checked; | ||
| + | var applyButton = document.getElementById("applyButton"); | ||
| + | var communInput = document.getElementById("commun"); | ||
| + | var espanditInput = document.getElementById("espandit"); | ||
| + | var southernInput = document.getElementById("southern"); | ||
| + | var northernInput = document.getElementById("northern"); | ||
| + | |||
| + | if (isCompleted){ | ||
| + | applyButton.disabled = true; | ||
| + | applyButton.classList.remove('btn-warning'); | ||
| + | communInput.readOnly = false; | ||
| + | espanditInput.readOnly = false; | ||
| + | southernInput.readOnly = false; | ||
| + | northernInput.readOnly = false; | ||
| + | }else{ | ||
| + | applyButton.disabled = false; | ||
| + | communInput.readOnly = true; | ||
| + | espanditInput.readOnly = true; | ||
| + | southernInput.readOnly = true; | ||
| + | northernInput.readOnly = true; | ||
| + | } | ||
| + | }); | ||
| + | }); // document ready | ||
| + | }; // if Js | ||
| + | |||
| + | |||
| + | </code> | ||
