Commit c938e4e9 authored by Sylvain Coulange's avatar Sylvain Coulange
Browse files

correction bugs custPhon underline, makeTable()

parent 4628d6a8
...@@ -81,7 +81,7 @@ def getLenDic(lang): ...@@ -81,7 +81,7 @@ def getLenDic(lang):
##### MISE EN MÉMOIRE DES DICTIONNAIRES (seulement les transcriptions+regions) ##### MISE EN MÉMOIRE DES DICTIONNAIRES (seulement les transcriptions+regions)
def makeWord2trans(alemDic): def makeWord2trans(alemDic):
query = alemDic.find()#.limit(1000) query = alemDic.find().limit(1000)
word2trans = {} word2trans = {}
cpt = 0 cpt = 0
for q in query: for q in query:
......
...@@ -540,7 +540,7 @@ function getPopUp() { ...@@ -540,7 +540,7 @@ function getPopUp() {
if (m.index === regexSpan.lastIndex) { if (m.index === regexSpan.lastIndex) {
regexSpan.lastIndex++; regexSpan.lastIndex++;
} }
// console.log("group1:",m[1],"group2:",m[2],"group3:",m[3],"group4:",m[4],"group5:",m[5]); console.log("group1:",m[1],"group2:",m[2],"group3:",m[3],"group4:",m[4],"group5:",m[5]);
if (m[5]) { if (m[5]) {
var newOutputSpan = "<span style='"; var newOutputSpan = "<span style='";
newOutputSpan += expFonte + expSizeBase + expNoBold; newOutputSpan += expFonte + expSizeBase + expNoBold;
...@@ -617,12 +617,15 @@ function getPopUp() { ...@@ -617,12 +617,15 @@ function getPopUp() {
// console.log("finalOutput :",finalOutput); // console.log("finalOutput :",finalOutput);
function phon2color(p1){ function phon2color(p1){
if (p1 in bicol2colcol) { var thisRawColor = getRawColor(p1);
if (thisRawColor == "") {
// Il s'agit d'un bicolore (actif)
var col1 = getComputedStyle(document.documentElement).getPropertyValue(bicol2colcol[p1][0]); var col1 = getComputedStyle(document.documentElement).getPropertyValue(bicol2colcol[p1][0]);
var col2 = getComputedStyle(document.documentElement).getPropertyValue(bicol2colcol[p1][1]); var col2 = getComputedStyle(document.documentElement).getPropertyValue(bicol2colcol[p1][1]);
var res = 'background-color:'+col1+';color:'+col2+';-webkit-text-stroke-width: 0.5px;-webkit-text-stroke-color: #000000;'; var res = 'background-color:'+col1+';color:'+col2+';-webkit-text-stroke-width: 0.5px;-webkit-text-stroke-color: #000000;';
} else { } else {
var col = getComputedStyle(document.documentElement).getPropertyValue('--'+p1); // Il s'agit d'un phonème simple, ou d'un bicolore désactivé (var(--phon_base))
var col = thisRawColor;
var res = 'color:'+col+';-webkit-text-stroke-width: 0.5px;-webkit-text-stroke-color: #000000;'; var res = 'color:'+col+';-webkit-text-stroke-width: 0.5px;-webkit-text-stroke-color: #000000;';
} }
return res; return res;
......
...@@ -50,6 +50,7 @@ function setPhon(phon) { ...@@ -50,6 +50,7 @@ function setPhon(phon) {
thisCSS.cssRules[r].style['color'] = memClass[phon]['color'] thisCSS.cssRules[r].style['color'] = memClass[phon]['color']
thisCSS.cssRules[r].style['stop-color'] = memClass[phon]['stop-color'] thisCSS.cssRules[r].style['stop-color'] = memClass[phon]['stop-color']
thisCSS.cssRules[r].style['-webkit-text-fill-color'] = memClass[phon]['-webkit-text-fill-color'] thisCSS.cssRules[r].style['-webkit-text-fill-color'] = memClass[phon]['-webkit-text-fill-color']
thisCSS.cssRules[r].style['text-decoration'] = memClass[phon]['text-decoration']
} }
} }
} }
...@@ -68,23 +69,35 @@ function unsetPhon(phon) { ...@@ -68,23 +69,35 @@ function unsetPhon(phon) {
console.log("Modification CSS:",r,thisCSS.cssRules[r]) console.log("Modification CSS:",r,thisCSS.cssRules[r])
// Enregistrement des couleurs dans memClass pour la clé phon // Enregistrement des couleurs dans memClass pour la clé phon
var [fill,col,stop,webkit] = [ var [fill,col,stop,webkit,line] = [
thisCSS.cssRules[r].style['fill'], thisCSS.cssRules[r].style['fill'],
thisCSS.cssRules[r].style['color'], thisCSS.cssRules[r].style['color'],
thisCSS.cssRules[r].style['stop-color'], thisCSS.cssRules[r].style['stop-color'],
thisCSS.cssRules[r].style['-webkit-text-fill-color'] thisCSS.cssRules[r].style['-webkit-text-fill-color'],
thisCSS.cssRules[r].style['text-decoration']
] ]
memClass[phon] = {'fill':fill, 'color':col, 'stop-color':stop, '-webkit-text-fill-color':webkit} memClass[phon] = {'fill':fill, 'color':col, 'stop-color':stop, '-webkit-text-fill-color':webkit, 'text-decoration':line}
// Suppression indications couleurs dans la css // Suppression indications couleurs dans la css
thisCSS.cssRules[r].style['fill'] = 'var(--phon_base)' thisCSS.cssRules[r].style['fill'] = 'var(--phon_base)'
thisCSS.cssRules[r].style['color'] = 'var(--phon_base)' thisCSS.cssRules[r].style['color'] = 'var(--phon_base)'
thisCSS.cssRules[r].style['stop-color'] = 'var(--phon_base)' thisCSS.cssRules[r].style['stop-color'] = 'var(--phon_base)'
thisCSS.cssRules[r].style['-webkit-text-fill-color'] = '' thisCSS.cssRules[r].style['-webkit-text-fill-color'] = ''
if (thisCSS.cssRules[r].style['text-decoration'] != '') thisCSS.cssRules[r].style['text-decoration'] = 'underline var(--phon_base)'
} }
} }
} }
function getRawColor(phon) {
for (r=0; r<thisCSS.cssRules.length; r++) {
if(thisCSS.cssRules[r].selectorText == "."+phon) {
var thisCssVar = thisCSS.cssRules[r].style["color"];
console.log(thisCssVar.substring(4,thisCssVar.length-1));
return getComputedStyle(document.documentElement).getPropertyValue(thisCssVar.substring(4,thisCssVar.length-1));
}
}
}
//------------------------------------------------ //------------------------------------------------
//>>>>>>>>>>>>> document.styleSheets[3].cssRules[69].style.fill //>>>>>>>>>>>>> document.styleSheets[3].cssRules[69].style.fill
// ------------------------------------------------- // -------------------------------------------------
...@@ -94,15 +107,6 @@ function setCol(phon, color) { ...@@ -94,15 +107,6 @@ function setCol(phon, color) {
console.log("Set color of",phon,"to",color); console.log("Set color of",phon,"to",color);
} }
function setAllUncheckedCol(color) {
cblist = document.querySelectorAll('.check-phon');
for (i=0; i<cblist.length; i++) {
if (!cblist[i].checked) {
setCol(cblist[i].id.slice(3),color)
}
}
}
function getCol(phon) { function getCol(phon) {
return getComputedStyle(document.documentElement).getPropertyValue('--'+phon); return getComputedStyle(document.documentElement).getPropertyValue('--'+phon);
} }
...@@ -148,7 +152,7 @@ function makePhonTable(lang) { ...@@ -148,7 +152,7 @@ function makePhonTable(lang) {
custphonList = document.querySelectorAll('.custphonc'); custphonList = document.querySelectorAll('.custphonc');
for (i=0; i<custphonList.length; i++) { for (i=0; i<custphonList.length; i++) {
var api = custphonList[i].dataset.phon; var api = custphonList[i].dataset.phon;
var colpick = ' <input type="color" id="colorPicker-'+api2class[api]+'" class="colorSetting" onchange="setCol(\''+api2class[api]+'\',this.value)" value="'+ memCol[api] +'">'; var colpick = ' <input type="color" id="colorPicker-'+api2class[api]+'" class="colorSetting" onchange="setCol(\''+api2class[api]+'\',this.value)" value="'+ getCol(api2class[api]) +'">';
if (bi.includes(api)){ if (bi.includes(api)){
colpick = ''; colpick = '';
} }
...@@ -158,7 +162,7 @@ function makePhonTable(lang) { ...@@ -158,7 +162,7 @@ function makePhonTable(lang) {
custphonList = document.querySelectorAll('.custphonv'); custphonList = document.querySelectorAll('.custphonv');
for (i=0; i<custphonList.length; i++) { for (i=0; i<custphonList.length; i++) {
var api = custphonList[i].dataset.phon; var api = custphonList[i].dataset.phon;
var colpick = ' <input type="color" id="colorPicker-'+api2class[api]+'" class="colorSetting" onchange="setCol(\''+api2class[api]+'\',this.value)" value="'+ memCol[api] +'">'; var colpick = ' <input type="color" id="colorPicker-'+api2class[api]+'" class="colorSetting" onchange="setCol(\''+api2class[api]+'\',this.value)" value="'+ getCol(api2class[api]) +'">';
if (bi.includes(api)){ if (bi.includes(api)){
colpick = ''; colpick = '';
} }
...@@ -168,7 +172,7 @@ function makePhonTable(lang) { ...@@ -168,7 +172,7 @@ function makePhonTable(lang) {
custphonList = document.querySelectorAll('.custphonvn'); custphonList = document.querySelectorAll('.custphonvn');
for (i=0; i<custphonList.length; i++) { for (i=0; i<custphonList.length; i++) {
var api = custphonList[i].dataset.phon; var api = custphonList[i].dataset.phon;
var colpick = ' <input type="color" id="colorPicker-'+api2class[api]+'" class="colorSetting" onchange="setCol(\''+api2class[api]+'\',this.value)" value="'+ memCol[api] +'">'; var colpick = ' <input type="color" id="colorPicker-'+api2class[api]+'" class="colorSetting" onchange="setCol(\''+api2class[api]+'\',this.value)" value="'+ getCol(api2class[api]) +'">';
if (bi.includes(api)){ if (bi.includes(api)){
colpick = ''; colpick = '';
} }
...@@ -178,7 +182,7 @@ function makePhonTable(lang) { ...@@ -178,7 +182,7 @@ function makePhonTable(lang) {
custphonList = document.querySelectorAll('.custphonschwa'); custphonList = document.querySelectorAll('.custphonschwa');
for (i=0; i<custphonList.length; i++) { for (i=0; i<custphonList.length; i++) {
var api = custphonList[i].dataset.phon; var api = custphonList[i].dataset.phon;
var colpick = ' <input type="color" id="colorPicker-'+api2class[api]+'" class="colorSetting" onchange="setCol(\''+api2class[api]+'\',this.value)" value="'+ memCol[api] +'">'; var colpick = ' <input type="color" id="colorPicker-'+api2class[api]+'" class="colorSetting" onchange="setCol(\''+api2class[api]+'\',this.value)" value="'+ getCol(api2class[api]) +'">';
if (bi.includes(api)){ if (bi.includes(api)){
colpick = ''; colpick = '';
} }
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample"> <div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample">
<div class="accordion-body"> <div class="accordion-body">
<p class="langspan" id="sp_customExplain"></p> <p class="langspan" id="sp_customExplain"></p>
<span class="langspan" id="sp_customColBase"></span> <input type="color" id="colorPicker-Base" class="colorSetting" onchange="setAllUncheckedCol(this.value)"> <span class="langspan" id="sp_customColBase"></span> <input type="color" id="colorPicker-Base" class="colorSetting" onchange="setCol('phon_base',this.value)">
<!-- TABLES DES PHONEMES --> <!-- TABLES DES PHONEMES -->
<small><div id="phonTable"></div></small> <small><div id="phonTable"></div></small>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment