スクマ ver.3
code:script.js
var global = window;
global.COPY_TO_CLIPBOARD = global.COPY_TO_CLIPBOARD || {};
global.COPY_TO_CLIPBOARD.getUrlInfo = function () {
var title = document.title;
var replacedStrings = {
':': ':',
'\\[': '[',
'\\]': ']',
'\\|': '|'
};
for (var key in replacedStrings) {
title = title.replace(new RegExp(key, 'g'), replacedStringskey); }
var quote=window.getSelection().toString();
if (quote.trim())
lines=lines.concat(quote.split(/\n/g).map(function(line){return ' > '+line}));
var body=lines.join('\n').replace(/^\n/g,"");
return body;
};
global.COPY_TO_CLIPBOARD.copyToClipboard = function() {
var copyFrom = document.createElement("textarea");
copyFrom.textContent = this.getUrlInfo();
var bodyElm = document.getElementsByTagName("body")0; bodyElm.appendChild(copyFrom);
copyFrom.select();
var retVal = document.execCommand('copy');
bodyElm.removeChild(copyFrom);
return retVal;
};
global.COPY_TO_CLIPBOARD.copyToClipboard();