Khác biệt giữa bản sửa đổi của “MediaWiki:Common.js”
Không có tóm lược sửa đổi |
Không có tóm lược sửa đổi |
||
| Dòng 9: | Dòng 9: | ||
for (j = 0; j < dd.length; j++) { | for (j = 0; j < dd.length; j++) { | ||
if (dd[j].clientWidth + parseFloat(window.getComputedStyle(dd[j])['marginLeft']) > dl[i].clientWidth / 2) { | if (dd[j].clientWidth + parseFloat(window.getComputedStyle(dd[j])['marginLeft']) > dl[i].clientWidth / 2) { | ||
dd[j].style.setProperty('min-width', '100%'); | |||
dd[j].style.setProperty('column-span', 'all'); | dd[j].style.setProperty('column-span', 'all'); | ||
} else { | } else { | ||
dd[j].style.setProperty('min-width', 'max-content'); | |||
dd[j].style.setProperty('column-span', 'unset'); | dd[j].style.setProperty('column-span', 'unset'); | ||
}; | }; | ||
if (maxwidth < dd[j].clientWidth && window.getComputedStyle(dd[j]).minWidth != '100%') { | if (maxwidth < dd[j].clientWidth && window.getComputedStyle(dd[j]).minWidth != '100%') { | ||
maxwidth = dd[j].clientWidth + parseFloat(window.getComputedStyle(dd[j])['marginLeft']) + 5; | maxwidth = dd[j].clientWidth + parseFloat(window.getComputedStyle(dd[j])['marginLeft']) + 5; | ||
} | } | ||
cnt++; | |||
} | |||
if (cnt >= 6 && maxwidth * 3 < dl[i].clientWidth) { | |||
dl[i].style.columns = 3 | |||
} else if (cnt >= 6 && maxwidth * 2 < dl[i].clientWidth) { | |||
dl[i].style.columns = 2 | |||
} | } | ||
} | } | ||
} | } | ||
| Dòng 31: | Dòng 36: | ||
var coglis = cognates[c].querySelectorAll('li'); | var coglis = cognates[c].querySelectorAll('li'); | ||
for (var l = 0; l < coglis.length; l++) { | for (var l = 0; l < coglis.length; l++) { | ||
if (widest == null) { | if (widest == null) { | ||
widestwidth = coglis[l].clientWidth; | widestwidth = coglis[l].clientWidth; | ||
widest = l; | widest = l; | ||
| Dòng 102: | Dòng 107: | ||
var entries = ''; | var entries = ''; | ||
if (window.location.href.search('index.php') < 0 && window.location.href.lastIndexOf(':') == 5) { | if (window.location.href.search('index.php') < 0 && window.location.href.lastIndexOf(':') == 5) { | ||
entries = document.querySelector('ol').querySelectorAll('li'); | entries = document.querySelector('ol').querySelectorAll('li'); | ||
for (i = 0; i < entries.length; i++) { | for (i = 0; i < entries.length; i++) { | ||
if (entries[i].innerHTML.match(/> →/g) != null) { | |||
var entry = entries[i].innerHTML.split('> →'); | |||
entries[i].innerHTML = ''; | |||
entries[i].innerHTML += entry[0] + 'b>'; | |||
for (j = 1; j < entry.length - 1; j++) { | |||
entries[i].innerHTML += '<br><span style="display:inline-block;margin-left:calc(' + (j + 1) + 'em + 0.5ch);text-indent: calc(-1em - 0.5ch)">' + '<arrow>↳ </arrow>' + entry[j] + '></span>'; | |||
} | |||
if (entry[entry.length - 1].search('dl') > -1 && entry[entry.length - 1].split('<dl')[0].slice(0, entry[entry.length - 1].split('<dl')[0].lastIndexOf(' ')).slice(entry[entry.length - 1].split('<dl')[0].slice(0, entry[entry.length - 1].split('<dl')[0].lastIndexOf(' ')).length - 2) != '<a') { | |||
entries[i].innerHTML += '<br><span style="display:inline-block;margin-left:calc(' + entry.length + 'em + 0.5ch);text-indent: calc(-1em - 0.5ch)">' + '<arrow>↳ </arrow>' + entry[entry.length - 1].split('<dl')[0].slice(0, entry[entry.length - 1].split('<dl')[0].lastIndexOf(' ')) + ' ' + entry[entry.length - 1].split('<dl')[0].slice(entry[entry.length - 1].split('<dl')[0].lastIndexOf(' ') + 1) + '</span><dl' + entry[entry.length - 1].split('<dl')[1]; | |||
} else if (entry[entry.length - 1].slice(entry[entry.length - 1].lastIndexOf(' ') - 2, entry[entry.length - 1].lastIndexOf(' ')) != '<a') { | |||
entries[i].innerHTML += '<br><span style="display:inline-block;margin-left:calc(' + entry.length + 'em + 0.5ch);text-indent: calc(-1em - 0.5ch)">' + '<arrow>↳ </arrow>' + entry[entry.length - 1].slice(0, entry[entry.length - 1].lastIndexOf(' ')) + ' ' + entry[entry.length - 1].slice(entry[entry.length - 1].lastIndexOf(' ') + 1) + '</span>'; | |||
} else { | |||
entries[0].innerHTML += '<br><span style="display:inline-block;margin-left:calc(' + entry.length + 'em + 0.5ch);text-indent: calc(-1em - 0.5ch)">' + '<arrow>↳ </arrow>' + entry[entry.length - 1] | |||
} | |||
} | } | ||
} | } | ||
} | } | ||
// Remove double spaces & replace Word Connectors * replace → arrow | // Remove double spaces & replace Word Connectors * replace → arrow | ||
| Dòng 126: | Dòng 131: | ||
} | } | ||
if (window.location.href.indexOf('index') == -1) { | if (window.location.href.indexOf('index') == -1) { | ||
document.getElementById('mw-content-text').innerHTML = document.getElementById('mw-content-text').innerHTML.replaceAll(' > ','<con> > </con>').replaceAll(' ~ ','<con> ~ </con>'); | document.getElementById('mw-content-text').innerHTML = document.getElementById('mw-content-text').innerHTML.replaceAll(' > ', '<con> > </con>').replaceAll(' ~ ', '<con> ~ </con>'); | ||
} | } | ||
| Dòng 187: | Dòng 192: | ||
ttzoom[tt].style.left = '-800%' | ttzoom[tt].style.left = '-800%' | ||
} | } | ||
} | } | ||
// Hide empty ruby text | // Hide empty ruby text | ||
var rt = document.getElementsByTagName('rt'); | var rt = document.getElementsByTagName('rt'); | ||
| Dòng 200: | Dòng 205: | ||
var textimg = document.querySelectorAll('[class*="textimg"]'); | var textimg = document.querySelectorAll('[class*="textimg"]'); | ||
if (textimg.length > 0) { | if (textimg.length > 0) { | ||
for (var i = 0; i < textimg.length; i++) { | |||
textimg[i].querySelector('img').src = 'https://www.tunguyentiengviet.com/images/4/47/Placeholder.png'; | |||
i++; | |||
} | |||
} | } | ||