Skip to content

Instantly share code, notes, and snippets.

@cyio
Created July 20, 2013 19:03
Show Gist options
  • Save cyio/6046093 to your computer and use it in GitHub Desktop.
Save cyio/6046093 to your computer and use it in GitHub Desktop.
打开后鼠标焦点就在Markdown里,方便喜欢Markdown的人。使用:请新建书签,并粘贴下面的代码。
javascript:void((function(){function $(id){return w.document.getElementById(id)}var w=window.open("about:blank","","width=500,height=150");w.document.title='Refer to "'+document.title+'"';w.document.write('<style>*{margin:0;padding:0;font-size:16px;}body{margin:10px;}label,input{margin-bottom:4px;}label{clear:both;font-weight:bold;height:20px;width:15%25;float:left;line-height:20px;text-align:right;display:block;font-family:arial,sans-serif}input{font-family:monospace;border:dashed 1px black;width:80%25;float:right;height:20px;}</style><label for="markdown">Markdown</label><input id="markdown"></input><label for="html">HTML</label><input id="html"><label for="ubb">ubb</label><input id="ubb"></input></input><label for="text">Text</label><input id="text"></input><label for="title">Title</label><input id="title"></input>');$('html').value='<a href="'+encodeURI(location.href)+'" target="_blank">'+document.title+'</a>';$('title').value=document.title;$('markdown').value="%5B"+document.title+"%5D"+"%28"+encodeURI(location.href)+"%29";$('ubb').value="%5Burl="+encodeURI(location.href)+"%5D"+document.title+"%5B/url%5D";$('text').value=document.title+" "+encodeURI(location.href);var z=w.document.getElementsByTagName('input');for(var i=0;i<z.length;i++){z%5Bi%5D.onfocus=z%5Bi%5D.onmousemove=function(){this.select();};z%5Bi%5D.onclick=z%5Bi%5D.onmousedown=z%5Bi%5D.onmouseup=function(){this.select();return false;};}$('markdown').focus();})());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment