Декъашхо:Sasan700/charcounter.js
Билгалдаккхар: Ӏалашйинчул тӀаьхьа хийцамаш га браузеран кэш цӀанйан йезаш хила мега.
- Firefox / Safari: Shift тӀетаӀийна йитина, гӀирсийн панелан тӀера тӀетаӀайе Карлайаккха йа Ctrl+F5 йа Ctrl+R (⌘+R Mac тӀехь)
- Google Chrome: тӀетаӀайе Ctrl+Shift+R (⌘+Shift+R Mac тӀехь)
- Internet Explorer / Edge: тӀетаӀийна йитина Ctrl, тӀетаӀайе Карлайаккха йа тӀетаӀайе Ctrl+F5
- Opera: тӀетаӀайе Ctrl+F5.
//Redoquçe çoh́ sh́agoydu yozan duqalla, myal bayt yu/On editpage displays textarea char/bytes counter
if (document.URL.match(/action=(edit|submit)/))
$(function(){
txtarea = document.getElementById('wpTextbox1'); //global var
if (!txtarea) return;
txtCounterSpan = document.createElement('span'); //global var
txtCounterSpan.id = 'txtCounterSpan';
txtCounterSpan.style.position = 'absolute';
txtCounterSpan.style.top = '100px';
txtCounterSpan.style.left = '-100px';
txtCounterSpan.style.zIndex = '100';
txtarea.form.style.position = 'relative';
txtarea.form.appendChild(txtCounterSpan);
addEvent(txtarea, 'keyup', countChars);
addEvent(txtarea, 'mouseup', countChars);
addEvent(txtCounterSpan, 'click', countBytes);
countChars();
countBytes();
})
function countChars(){
txtCounterSpan.innerHTML = txtarea.value.length;
}
function countBytes(){
var st = txtarea.value;
var bb, extra=0;
for (var i=0; i<st.length; i++)
if ((bb = st.charCodeAt(i)) > 127) {
extra++;
if (bb > 2048) extra++;
}
txtCounterSpan.innerHTML = st.length + ':' + (st.length + extra);
// + ':' + st.split(' ').length //number of words
}
function addEvent(obj, event, func) {
if (obj.addEventListener) obj.addEventListener( event, func, false );
else if (obj.attachEvent) obj.attachEvent ('on'+event, func)
}