Last active
November 9, 2022 00:56
-
-
Save cyio/cc74b44189cc0a9f2b818c745c910a3b to your computer and use it in GitHub Desktop.
新复制网页标题及地址 copy url title cp cpy https://c.runoob.com/front-end/51
This file contains hidden or 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
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{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 = 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++) { | |
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(); | |
})()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment