Last active
November 27, 2017 15:11
-
-
Save jacaetevha/a9dfeb5183cd38e07037844073cee39c to your computer and use it in GitHub Desktop.
editable text area in a browser tab (for use in creating templatized Slack notes)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data:text/html;charset=utf-8,<title>TextEditor</title><style>body{background:#fbfbfb;color:#333;margin:0%20auto;width:50rem}textarea{background:#fbfbfb;border:1px%20solid%20#ddd;color:#333;font-family:monospace;font-size:16px;height:90%;line-height:1.4;margin:0%20auto;outline:0;padding:4rem;width:100%;margin-top:1rem;}button{background-color:#fbfbfb;border:1px%20#ccc%20solid;color:#999;cursor:pointer;float:right;margin:10px%200;padding:5px%2010px}.fixed-top-right{position:fixed;top:0.4rem;right:8rem;}@media%20(max-width:768px){body{width:100%;padding:0}textarea{padding:10px}button{float:none}}</style><body><div%20class="fixed-top-right"><button%20onclick="sM();%20return%20false">New%20Section</button></div><textarea%20contenteditable%20id=TE%20spellcheck=true%20placeholder=Write...%20autofocus></textarea><script>var%20dates={};%20for(var%20i=1;i<32;i++){%20if(i<10){%20dates[i]="0"+i;%20}else{%20dates[i]=i;%20}%20};%20var%20days={6:"Mon",0:"Mon",1:"Mon",2:"Tue",3:"Wed",4:"Thu",5:"Fri"};%20var%20months={};%20for(var%20i=0;i<12;i++){%20var%20j=i+1;%20if(j<=9){%20months[i]="0"+j;%20}else{%20months[i]=j};%20};%20function%20formatDate(d)%20{%20return%20days[d.getDay()]%20+%20",%20"%20+%20[d.getFullYear(),months[d.getMonth()],dates[d.getDate()]].join("-");%20}%20function%20newSection(){%20var%20today=new%20Date();%20var%20tomorrow=new%20Date(today.getTime()+86400000);%20return%20"\n\n=================================================================\n\n"%20+%20"*"%20+%20formatDate(today)%20+%20"*\n%20%20%E2%80%A2%20...\n\n"%20+%20"*"%20+%20formatDate(tomorrow)%20+%20"*\n%20%20%E2%80%A2%20...\n\n"%20+%20"*Blocking*\n%20%20%E2%80%A2%20...\n\n";%20}function%20sM(){var%20editor=$("#TE");var%20oldVal=editor.val();editor.focus().val("").val(oldVal+newSection());editor.scrollTop(editor[0].scrollHeight-editor.height());};</script><script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment