Skip to content

Instantly share code, notes, and snippets.

@cyio
Last active November 9, 2022 00:56
Show Gist options
  • Select an option

  • Save cyio/cc74b44189cc0a9f2b818c745c910a3b to your computer and use it in GitHub Desktop.

Select an option

Save cyio/cc74b44189cc0a9f2b818c745c910a3b to your computer and use it in GitHub Desktop.

Revisions

  1. cyio revised this gist Nov 9, 2022. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions copy-url-title-bookmark.js
    Original file line number Diff line number Diff line change
    @@ -4,10 +4,11 @@ javascript: void((function() {
    }
    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="text">Text</label><input id="text"></input><label for="markdown">Markdown</label><input id="markdown"></input><label for="html">HTML</label><input id="html"></input><label for="title">Title</label><input id="title"></input>');
    w.document.write('<style>*{margin:0;padding:0;font-size:16px;}body{margin:10px;}label,input{margin-bottom:4px;}label{white-space:nowrap;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="text">Text</label><input id="text"></input><label for="markdown">Markdown</label><input id="markdown"><label for="markdown-image">MD Image</label><input id="markdown-image"></input><label for="html">HTML</label><input id="html"></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;
    $('title').value = encodeURIComponent(document.title);
    $('markdown').value = "%5B" + document.title + "%5D" + "%28" + encodeURI(location.href) + "%29";
    $('markdown-image').value = "!%5B" + document.title + "%5D" + "%28" + encodeURI(location.href) + "%29";
    $('text').value = document.title + " " + encodeURI(location.href);
    var z = w.document.getElementsByTagName('input');
    for (var i = 0; i < z.length; i++) {
  2. cyio revised this gist May 30, 2021. No changes.
  3. cyio revised this gist May 30, 2021. No changes.
  4. cyio revised this gist May 30, 2021. 1 changed file with 23 additions and 1 deletion.
    24 changes: 23 additions & 1 deletion copy-url-title-bookmark.js
    Original file line number Diff line number Diff line change
    @@ -1 +1,23 @@
    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();})());
    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="text">Text</label><input id="text"></input><label for="markdown">Markdown</label><input id="markdown"></input><label for="html">HTML</label><input id="html"></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";
    $('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;
    };
    }
    $('text').focus();
    })());
  5. cyio created this gist Feb 24, 2021.
    1 change: 1 addition & 0 deletions copy-url-title-bookmark.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    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();})());