[FireGestures] Copy Page URL to Clipboard (CLS URL)

改寫官方提供的Copy Page Title and URL to Clipboard,並加入多餘參數清除功能,方便貼在MSN
目前支援:
  • Youtube
  • RSS Source
  • Mobile01
  • Mobile01 貼圖區

const AS_HTML = true;

function htmlEscape(s) {
  s = s.replace(/&/g, "&");
  s = s.replace(/>/g, ">");
  s = s.replace(/</g, "&lt;");
  s = s.replace(/"/g, "&quot;");
  return s;
}
var l=window.content.location, tmp=l.href;
if(/(\?|&)utm_source.*/.test(tmp)) tmp=tmp.replace(/(\?|&)utm_source.*/i,'');
if((l.href.indexOf('youtube.com')!=-1) && (/(v=.{11})/.test(l.search))) tmp='http://www.youtube.com/watch'+l.search.replace(/.*(v=.{11}).*/i,'?$1');
if(/www\.mobile01\.com/.test(tmp)) tmp=tmp.replace(/&last=.*/,'');
if(/www\.mobile01\.com/.test(tmp) && /gallerydetail\.php/.test(tmp)) tmp=tmp.replace(/&fp=(\d{1})/,'');
var title = window.content.document.title;
var txt = AS_HTML ? '<a href="' + htmlEscape(tmp) + '">' + htmlEscape(title) + '</a>' : title + "\n" + tmp;
var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
clipboard.copyString(txt);

FireGestures :: Get Scripts
相關文章:
delicious URL Clean