顯示具有 Add-on 標籤的文章。 顯示所有文章
顯示具有 Add-on 標籤的文章。 顯示所有文章

[FireGestures] Paste and Go

const IN_NEW_TAB = true;
const IN_BACKGROUND = false;

var str = readFromClipboard();
var s='http://www.google.com.tw/search?q=@search&oe=utf-8&hl=zh-TW';
if (!str) return;
if (!/^(\s*)http(s?):\/\//.test(str)) str=s.replace('@search',encodeURIComponent(str));
if (IN_NEW_TAB)
gBrowser.loadOneTab(str, null, null, null, IN_BACKGROUND, false);
else
gBrowser.loadURI(str);

FireGestures :: Get Scripts -> Open URL from Clipboard
求高手將Paste and go ,Paste and search這兩個腳本合二為一 - 閱讀主題 :: Mozilla Firefox中文社區

[FireGestures] Resize Browser

if (FireGestures.API_resizeWindow === undefined) {
  FireGestures.API_resizeWindow = function(w, h) {
    window.resizeTo(w, h);
    window.screenX = 0;
    window.screenY = 0;
    this.setStatusText("Resized the window to " + w + " x " + h);
    this.clearStatusText(3000);
  };
}

var currentWidth = window.outerWidth;
var currentHeight = window.outerHeight;

FireGestures.generatePopup(event,
  [
    { label: "640 x 480",  oncommand: "this.API_resizeWindow(640, 480);",  type: "radio", checked: (currentWidth == 640 && currentHeight == 480) },
    { label: "800 x 600",  oncommand: "this.API_resizeWindow(800, 600);",  type: "radio", checked: (currentWidth == 800 && currentHeight == 600) },
    { label: "1024 x 768", oncommand: "this.API_resizeWindow(1024, 768);", type: "radio", checked: (currentWidth == 1024 && currentHeight == 768) },
    { label: "1280 x 1024", oncommand: "this.API_resizeWindow(1280, 1024);", type: "radio", checked: (currentWidth == 1280 && currentHeight == 1024) }
  ]
);

FireGestures :: Make Scripts
FireGestures :: Get Scripts -> [Popup] Resize Window

[FireGestures] Browser Position

使用寬螢幕(1920 x 1280)時,快速切換Browser位置至左、中、右,寬度為1280,高度為screen.availHeight

FireGestures.BrowserPosition = function (x) {
    window.resizeTo(1280, screen.availHeight);
    window.screenX = x;
    window.screenY = 0;
};
FireGestures.generatePopup(event,
    [
        { label: "Left" ,oncommand: "this.BrowserPosition(0);" },
        { label: "Center" ,oncommand: "this.BrowserPosition((screen.width - 1280)/2);" },
        { label: "Right" ,oncommand: "this.BrowserPosition(screen.width-1280);" }
    ]
);

FireGestures :: Make Scripts
FireGestures :: Get Scripts -> [Popup] Resize Window

[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