help
');var e=area.value;e=(e=e.replace(/\t/gi," ")).replace(/\n/gi,"
"),win.document.write(e),win.document.write(""),win.alert("Press browser Menu button and select Print...\nTo save paper & trees: print to PDF file or set 2-sided printing."),win.print()}function Help(){window.location.href="notepad_help.html"}function Exit(){window.open("","_self",""),window.close()}function New(){cancelSaveFile(),Snapshot(),""!=area.value&&!0==confirm("All old text will be deleted. Are you sure?")&&(area.value="",params.filename="",SetDocTitle()),area.focus()}function Open(){cancelSaveFile(),fileElem.focus(),fileElem.click()}function Save_As(){""!=area.value&&(getFilename.style.display="flex")}function Save(){if(""==area.value){autoSaveModal.show(),alert("Save canceled - there is no text to save...");return}return""==params.filename?(autoSaveModal.hide(),getFilename.style.display="flex",filename.focus()):saveFile(),!1}function getShareData(){var e=window.getSelection().toString();""==e&&(e=area.value);var t="https://jobsvacancy.in/tools/notepad.html?txt="+encodeURIComponent(e);return t.length>=16384&&(t=t.substring(0,16384),alert("The URL length is limited to 16384")),{txt:e,url:t}}function Share(){if(navigator.share){var e=getShareData();navigator.share({title:"My notes",text:e.txt,url:e.url}).then(()=>console.log("Successful share")).catch(e=>console.log("Error sharing:",e))}}function shareFB(){var e=getShareData();sharefb.href="https://facebook.com/sharer/sharer.php?u="+encodeURIComponent(e.url)+"&title="+encodeURIComponent("My notes")}function shareTW(){var e=getShareData();sharetw.href="https://twitter.com/intent/tweet?text="+encodeURIComponent(e.txt)+"&url="+encodeURIComponent(e.url)}function shareWA(){var e=getShareData();sharewa.href="https://api.whatsapp.com/send?text="+encodeURIComponent(e.txt)+" "+encodeURIComponent(e.url)}function shareMail(){var e=getShareData();shareml.href="mailto:?to=&subject="+encodeURIComponent("My notes")+"&body="+encodeURIComponent(e.txt+"\n"+e.url)}function SelectAll(){area.select()}function Del(){0!=(s=getSelect(area)).text.length&&(Snapshot(),fillString(area.value,"",s.start,s.end)),setCaret(pos=s.start)}function Del2(){0!=(s=getSelect(area)).text.length&&(Snapshot(),fillString(area.value,"",s.start,s.end-1)),setCaret(pos=s.start)}function Cut(e){0!=(s=getSelect(area)).text.length?(Snapshot(),selectedText=s.text,void 0!==navigator.clipboard&&navigator.clipboard.writeText(selectedText),e||fillString(area.value,"",s.start,s.end)):selectedText="",e||setCaret(pos=s.start),area.focus()}function Copy(){selectedText=0!=(s=getSelect(area)).text.length?s.text:"",setSelect(area,s.start,s.end),area.focus(),void 0!==navigator.clipboard&&navigator.clipboard.writeText(selectedText)}function Paste(){s=getSelect(area),Snapshot();var e=area.value;void 0!==navigator.clipboard?navigator.clipboard.readText().then(t=>{fillString(e,t,s.start,s.end),setCaret(pos=s.start+t.length)}):0!=selectedText.length&&(fillString(e,selectedText,s.start,s.end),setCaret(pos=s.start+selectedText.length)),area.focus()}function cancelSaveFile(){getFilename.style.display="none"}function saveFile(){isFileTxtChange=!1,getFilename.style.display="none";var e=filename.value;""==e&&(e="filename.txt"),params.filename=e,SetDocTitle(),LocalSave(),s=area.value,"Windows"==(OSName=GetOS())&&(s=s.replace(/\n/g,"\r\n")),saveAs(new Blob([s],{type:"text/plain;charset=utf-8"}),params.filename)}function loadFile(){var e=fileElem.files[0].name,t=new FileReader;t.onloadend=function(t){t.target.readyState==FileReader.DONE&&(params.filename=e,SetDocTitle(),s=t.target.result,"Windows"==(OSName=GetOS())&&(s=s.replace(/\r\n/g,"\n")),area.value=s,area.focus(),area.scrollTo(0,0))},t.readAsText(fileElem.files[0])}function getSelect(e){var t=e.selectionStart,a=e.selectionEnd,n=e.value.substring(t,a);return{start:t,end:a,text:n}}function setSelect(e,t,a){e.focus(),e.selectionStart=t,e.selectionEnd=a}function fillString(e,t,a,n){var o=e.substring(0,a),r=e.substring(a,n),l=e.substring(n,e.length);r=t,area.value=o+r+l}function getCaret(){return area.selectionStart}function setCaret(e){area.selectionStart=e,area.selectionEnd=e,area.focus()}function Snapshot(){var e=getCaret(),t=area.value;if(!(ihist>0)||txt_hist[ihist-1]!=t){if(ihist==nhist)pos_hist.push(e),txt_hist.push(t),ihist++,pos_hist.length>Nhist&&(pos_hist.shift(),txt_hist.shift(),ihist--);else{for(pos_hist[++ihist]=e,txt_hist[ihist]=t,i=ihist+1;i8&&(params.fontSize--,params.fontSize>=15&¶ms.fontSize--,SetFontSize())}function IncSize(){params.fontSize<50&&(params.fontSize++,params.fontSize>=15&¶ms.fontSize++,SetFontSize())}function SetFontSize(){area.style.fontSize=params.fontSize+"px"}function SetDocTitle(){var e=params.filename;""==e?document.title="Notepad | Write your notes online":document.title="Notepad - "+e}function SetBar(e){var t=area.selectionEnd,a=area.value;e&&(chars=a.length,words=a.countWords());var n=(a=a.substring(0,t)).split("\n"),o=n.length,r=n[o-1].length+1;bar.innerHTML="Line "+o+", Column "+r+"    Chars "+chars+", Words "+words}window.addEventListener("storage",function(e){null==localStorage.getItem("notepad_text")&&LocalSave()}),window.addEventListener("beforeunload",function(e){isFileTxtChange&&""!=area.value&¶ms.autoSaveExit&&saveFile(),!0==resetParamsFlag&&localStorage.removeItem("notepad_params")}),document.addEventListener("visibilitychange",function(e){"hidden"===document.visibilityState&&(selectedText="",LocalSave())}),document.addEventListener("DOMContentLoaded",function(e){txt_hist=[],pos_hist=[],Nhist=10,nhist=0,ihist=0,prefModal=new bootstrap.Modal("#prefModal",{keyboard:!1}),autoSaveModal=new bootstrap.Modal("#autoSaveModal",{keyboard:!1}),LocalLoad(),area.onkeydown=function(e){onkeydown(e)},area.onkeyup=function(e){-1==[key.shiftKey,key.ctrlKey,key.altKey,key.capsKey,key.pageupKey,key.pagedownKey,key.leftKey,key.upKey,key.rightKey,key.downKey].indexOf(e.which)?SetBar(1):SetBar(0)},area.onclick=function(e){return(pos=getCaret())!=pos_hist[ihist]&&Snapshot(),SetBar(0),!1},sharefb.href="https://facebook.com/sharer/sharer.php?u="+encodeURIComponent(window.location.href)+"&title="+encodeURIComponent(document.title),sharetw.href="https://twitter.com/intent/tweet?text="+encodeURIComponent(document.title)+"&url="+encodeURIComponent(window.location.href),sharewa.href="https://api.whatsapp.com/send?text="+encodeURIComponent(document.title)+" "+encodeURIComponent(window.location.href),shareml.href="mailto:?to=&subject="+encodeURIComponent(document.title)+"&body="+encodeURIComponent(window.location.href),sharefb.onclick=function(){shareFB()},sharetw.onclick=function(){shareTW()},sharewa.onclick=function(){shareWA()},shareml.onclick=function(){shareMail()},resetParamsBtn.onclick=function(){resetParams()},autoSaveSwitch.onchange=function(){setAutoSave()},autoSaveNum.onchange=function(){setAutoSave()},autoSaveSel.onchange=function(){setAutoSave()},autoSaveExit.onchange=function(){setAutoSaveExit()},textLinesSwitch.onchange=function(){setTextLines()},darkmodeSwitch.onchange=function(){darkModeToggle()},fontSizeNum.onchange=function(){setFont()},fontFamilySel.onchange=function(){setFont()},fontWeightSel.onchange=function(){setFont()},autoSaveDownBtn.onclick=function(){Save()},autoSavePrefBtn.onclick=function(){showPrefModal()} //!!!!!!!!!!!!!!!!!!!!<<button:nth-child(3)").style.display="none");var t=GetURLParams();Object.keys(t).length>0&&""!=t.txt&&(area.value=decodeURIComponent(t.txt)+"\n\n"+area.value)}),Storage.prototype.setObject=function(e,t){this.setItem(e,JSON.stringify(t))},Storage.prototype.getObject=function(e){var t=this.getItem(e);return null==t||"undefined"==t?null:t&&JSON.parse(t)},Storage.prototype.persist=function(){navigator.storage&&navigator.storage.persist&&navigator.storage.persist().then(e=>{})},String.prototype.countWords=function(){return this.trim().split(/\s+\b/).length};