Skip to content

Instantly share code, notes, and snippets.

@CSElliyas
Created July 11, 2019 18:07
Show Gist options
  • Select an option

  • Save CSElliyas/e239fe756bece7b5fabf85cb02032b69 to your computer and use it in GitHub Desktop.

Select an option

Save CSElliyas/e239fe756bece7b5fabf85cb02032b69 to your computer and use it in GitHub Desktop.
function Insert(e,n){if(document.selection)e.focus(),sel=document.selection.createRange(),sel.text=n,sel.collapse(!0),sel.select();else if(e.selectionStart||"0"==e.selectionStart){var t=e.selectionStart,l=e.selectionEnd,o=e.scrollTop;t=-1==t?e.value.length:t,e.value=e.value.substring(0,t)+n+e.value.substring(l,e.value.length),e.focus(),e.selectionStart=t+n.length,e.selectionEnd=t+n.length,e.scrollTop=o}else{o=e.scrollTop;e.value+=value,e.focus(),e.scrollTop=o}}function RemoveNInsert(e,n,t){if(document.selection)e.focus(),sel=document.selection.createRange(),e.value.length>=t&&sel.moveStart("character",-1*t),sel.text=n,sel.collapse(!0),sel.select();else if(e.selectionStart||0==e.selectionStart){e.focus();var l=e.selectionStart-t,o=e.selectionEnd,s=e.scrollTop;l=-1==l?e.value.length:l,e.value=e.value.substring(0,l)+n+e.value.substring(o,e.value.length),e.focus(),e.selectionStart=l+n.length,e.selectionEnd=l+n.length,e.scrollTop=s}else{s=e.scrollTop;e.value+=n,e.focus(),e.scrollTop=s}}function capsDetect(e){if(e||(e=window.event),!e)return!1;var n=e.which?e.which:e.keyCode?e.keyCode:e.charCode?e.charCode:0,t=e.shiftKey||e.modifiers&&4&e.modifiers;return n>64&&n<91&&!t||n>96&&n<123&&t}function HideDIV(e){document.getElementById?document.getElementById(e).style.display="none":document.layers?document.id.display="none":document.all.id.style.display="none"}function ShowDIV(e){document.getElementById?document.getElementById(e).style.display="block":document.layers?document.id.display="block":document.all.id.style.display="block"}function IsBanglaDigit(e){return"০"==e||"১"==e||"২"==e||"৩"==e||"৪"==e||"৫"==e||"৬"==e||"৭"==e||"৮"==e||"৯"==e}function IsBanglaPreKar(e){return"ি"==e||"ৈ"==e||"ে"==e}function IsBanglaPostKar(e){return"া"==e||"ো"==e||"ৌ"==e||"ৗ"==e||"ু"==e||"ূ"==e||"ী"==e||"ৃ"==e}function IsBanglaKar(e){return!(!IsBanglaPreKar(e)&&!IsBanglaPostKar(e))}function IsBanglaBanjonborno(e){return"ক"==e||"খ"==e||"গ"==e||"ঘ"==e||"ঙ"==e||"চ"==e||"ছ"==e||"জ"==e||"ঝ"==e||"ঞ"==e||"ট"==e||"ঠ"==e||"ড"==e||"ঢ"==e||"ণ"==e||"ত"==e||"থ"==e||"দ"==e||"ধ"==e||"ন"==e||"প"==e||"ফ"==e||"ব"==e||"ভ"==e||"ম"==e||"শ"==e||"ষ"==e||"স"==e||"হ"==e||"য"==e||"র"==e||"ল"==e||"য়"==e||"ং"==e||"ঃ"==e||"ঁ"==e||"ৎ"==e}function IsBanglaSoroborno(e){return"অ"==e||"আ"==e||"ই"==e||"ঈ"==e||"উ"==e||"ঊ"==e||"ঋ"==e||"ঌ"==e||"এ"==e||"ঐ"==e||"ও"==e||"ঔ"==e}function IsBanglaNukta(e){return"ং"==e||"ঃ"==e||"ঁ"==e}function IsBanglaFola(e){return"্য"==e||"্র"==e}function IsBanglaHalant(e){return"্"==e}function IsSpace(e){return" "==e||"\t"==e||"\n"==e||"\r"==e}function MapKarToSorborno(e){var n=e;return"া"==e?n="আ":"ি"==e?n="ই":"ী"==e?n="ঈ":"ু"==e?n="উ":"ূ"==e?n="ঊ":"ৃ"==e?n="ঋ":"ে"==e?n="এ":"ৈ"==e?n="ঐ":"ো"==e?n="ও":"ো"==e?n="ও":"ৌ"==e?n="ঔ":"ৌ"==e&&(n="ঔ"),n}function MapSorbornoToKar(e){var n=e;return"আ"==e?n="া":"ই"==e?n="ি":"ঈ"==e?n="ী":"উ"==e?n="ু":"ঊ"==e?n="ূ":"ঋ"==e?n="ৃ":"এ"==e?n="ে":"ঐ"==e?n="ৈ":"ও"==e?n="ো":"ঔ"==e&&(n="ৌ"),n}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment