bookmarks‎ > ‎addons‎ > ‎

firegestures脚本

参考: firegestures/getscripts   
 keyconfig扩展中的脚本也可用于firegestures

主页H   向下一级  全屏口  另存为S    源代码C   tool
 
      前进   R  →       ↑  U    上页               撤销 RL ←═       ∣↓  UD重载                                   状态栏   RLR ≡→      ‖↑ UDU         
      后退   L  ←       ↓   D   下页               新建 LR ═ →      ∣↑  DU停止                                   复制tab   LRL←≡      ‖↓ DUD    

       顶部RU  _↑       ↑_ LU 翻上页           最小化窗口 RUD ╜ ╙ LUD url-
       底部 RD  ̄↓       ↓ ̄ LD 翻下页           最大化窗口 RDU╖ ╓ LDU url+

关闭窗口←┘      └→关闭标签           关其他标签 ╛  ╘ 弹出最近关闭tab
左边标签←┐      ┌→ 右边标签          关左全标签 ╕  ╒ 关右全标签
UDL←‖  ‖→UDR
DUL←‖  ‖→DUR
LRU═↑   ↑═LRU
LRD═↓   ↓═LRD

打开一个网页
当前标签:gBrowser.loadURI('http://www.baidu.com');
新建标签:gBrowser.addTab("http://www.baidu.com")
新建标签:gBrowser.loadOneTab('http://baidu.com', null, null, null, true, false);
新建窗口:toOpenWindowByType('pref:pref', 'http://www.baidu.com');

当前窗口打开一个网页

gBrowser.loadURI('http://news.google.com');

新窗口打开一个网页

gBrowser.loadOneTab('http://www.fda.gov')


新窗口打开一个网页并转到这个网页

const URL = "http://www.fda.gov";
const IN_NEW_TAB = true;
const IN_BACKGROUND = false;

if (IN_NEW_TAB)
gBrowser.loadOneTab(URL, null, null, null, IN_BACKGROUND, false);
else
gBrowser.loadURI(URL);

打开多个网页

////////////////////////////////////////////////////////////////
// OPTIONS
const URLs = [
"http://www.people.com.cn/",
"http://www.xinhuanet.com/",
"http://www.phoenixtv.com/",
"http://news.163.com/",
"http://news.baidu.com/",
"http://news.google.cn/",
];

const IN_BACKGROUND = true;
const REPLACE_CURRENT_TABS = false;

////////////////////////////////////////////////////////////////
// SCRIPT (don't edit after this line.)
gBrowser.loadTabs(URLs, IN_BACKGROUND, REPLACE_CURRENT_TABS);
const REPLACE_CURRENT_TABS = false;修改值为true则取代当前标签页

pharm

////////////////////////////////////////////////////////////////
// OPTIONS
const URLs = [
"http://www.sda.gov.cn",
"http://www.fda.gov/",
"http://www.emea.europa.eu/",
"http://www.cde.org.cn",
"http://www.chp.org.cn",
"http://www.zybh.gov.cn",
"http://www.nicpbp.org.cn",
"http://www.moh.gov.cn",
"http://www.bjda.gov.cn",
"http://www.moh.gov.cn",
];

const IN_BACKGROUND = true;
const REPLACE_CURRENT_TABS = false;

////////////////////////////////////////////////////////////////
// SCRIPT (don't edit after this line.)
gBrowser.loadTabs(URLs, IN_BACKGROUND, REPLACE_CURRENT_TABS);

computer576

FireGestures.generatePopup(event,
  [
    { label: "addons", oncommand: "gBrowser.loadURI('http://sites.google.com/site/bookmarks576/Home/addons');" },
    { label: "firegestures", oncommand: "gBrowser.loadURI('http://sites.google.com/site/bookmarks576/Home/addons/jiao-ben');" },
    { label: "keyconfig", oncommand: "gBrowser.loadURI('http://sites.google.com/site/bookmarks576/Home/addons/keyconfig');" },
    { label: "userchrome", oncommand: "gBrowser.loadURI('http://sites.google.com/site/bookmarks576/Home/addons/userchrome');" },
    { label: "Greasemonkey", oncommand: "gBrowser.loadURI('http://sites.google.com/site/bookmarks576/Home/addons/greasemonkey');" },
    { label: "search", oncommand: "gBrowser.loadURI('http://sites.google.com/site/bookmarks576/Home/addons/search');" },
    { label: "bookmarklets", oncommand: "gBrowser.loadURI('http://sites.google.com/site/bookmarks576/Home/addons/bookmarklets');" },
    { label: "-"},
    { label: "system-soft", oncommand: "gBrowser.loadURI('http://sites.google.com/site/bookmarks576/Home/system-soft');" },
    { label: "computer576", oncommand: "gBrowser.loadURI('http://sites.google.com/site/computer576/');" },
    { label: "ubuntu576", oncommand: "gBrowser.loadURI('http://sites.google.com/site/ubuntu576/');" },
    { label: "windowsxp576", oncommand: "gBrowser.loadURI('http://sites.google.com/site/windowsxp576/');" },
    { label: "bookmarks576", oncommand: "gBrowser.loadURI('http://sites.google.com/site/bookmarks576/');" },
  ]
);
//    { label: "-", oncommand: "gBrowser.loadURI('');" },



关闭所有tab打开一个blank

gBrowser.removeAllTabsBut(gBrowser.addTab("about:blank"));

All-in-One Tools

FireGestures.generatePopup(event,
  [
    { label: "Downloads",     oncommand: "document.getElementById('Tools:Downloads').doCommand();" },
    { label: "Add-ons",       oncommand: "document.getElementById('Tools:Addons').doCommand();" },
    { label: "Options",       oncommand: "openPreferences();" },
    { label: "清除隐私",       oncommand: "document.getElementById('Tools:Sanitize').doCommand();" },
    { label: "Error Console", oncommand: "toJavaScriptConsole();" },
  ]
);

弹出菜单

FireGestures.generatePopup(event,
  [
    { label: "下载",     oncommand: "document.getElementById('Tools:Downloads').doCommand();" },
    { label: "清隐",       oncommand: "document.getElementById('Tools:Sanitize').doCommand();" },
    { label: "附加",       oncommand: "document.getElementById('Tools:Addons').doCommand();" },
    { label: "选项",       oncommand: "openPreferences();" },
    { label: "config", oncommand: "toOpenWindowByType('pref:pref', 'About:config');" },
    { label: "错误台", oncommand: "toJavaScriptConsole();" },
    { label: "状态栏", oncommand: "goToggleToolbar('status-bar','toggle_taskbar');" },
    { label: "-", oncommand: "" },
    { label: "最左页", oncommand: "gBrowser.selectedTab = gBrowser.mTabContainer.firstChild;" },
    { label: "关其他", oncommand: "gBrowser.removeAllTabsBut(gBrowser.mCurrentTab);" },
    { label: "links", oncommand: "if(window.loadURI) loadURI(getShortcutOrURI('列出所有链接',{}));" },
    { label: "滚屏", oncommand: "if(window.loadURI) loadURI(getShortcutOrURI('滚屏慢',{}));" },
    { label: "翻译", oncommand: "if(window.loadURI) loadURI(getShortcutOrURI('译成中文(简体)',{}));" },
    { label: "天气", oncommand: "gBrowser.loadURI('http://www.weather.com.cn/html/weather/101010100.shtml');" },
    { label: "新闻", oncommand: "gBrowser.loadURI('http://www.bj.xinhuanet.com');" },
  ]
);
注:滚屏、翻译等采用书签关键字(小书签)

翻页 下一页

// derived from All-in-One Gestures created by Marc Boullet

////////////////////////////////////////////////////////////////
// OPTIONS

// "prev" or "next"
// const PREV_NEXT = "prev";
const PREV_NEXT = "next";

// part of string which the link should contain
// const KEYWORDS = ["prev", "下一页"];
const KEYWORDS = ["next", "下一页"];

////////////////////////////////////////////////////////////////
// PROGRAM

// first, we search for LINK tags
var doc = FireGestures.sourceNode.ownerDocument;
var links = doc.getElementsByTagName("link");
for (var i = 0; i < links.length; i++) {
if (links[i].href &&
links[i].hasAttribute("rel") &&
links[i].getAttribute("rel").toLowerCase().indexOf(PREV_NEXT) == 0) {
loadURI(links[i].href);
return;
}
}

// second, we search for A tags
var regexp = new RegExp("(?:" + KEYWORDS.join("|") + ")", "i");
links = doc.links;
for (i = 0; i < links.length; i++) {
if (links[i].href &&
links[i].textContent &&
links[i].textContent.match(regexp)) {
loadURI(links[i].href);
return;
}
}

移除页面元素

var node = FireGestures.sourceNode;
node.parentNode.removeChild(node);

google 英翻中

var t = content.getSelection().toString();
if(t) {gBrowser.addTab("http://translate.google.cn/translate_t?hl=en#auto|zh-CN|"+t);}
else {gBrowser.addTab("http://translate.google.cn/translate?u="+content.location);}

打开外部程序(记事本)路径可改\\

var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
file.initWithPath("C:\\WINDOWS\\system32\\notepad.exe");
file.launch();
打开文件夹
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
file.initWithPath("D:\\firefox");
file.launch();

设置窗口大小

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: "600 x 400", oncommand: "this.API_resizeWindow(600, 400);", type: "radio", checked: (currentWidth == 600 && currentHeight == 400) },
{ label: "640 x 480", oncommand: "this.API_resizeWindow(640, 480);", type: "radio", checked: (currentWidth == 640 && currentHeight == 480) },
{ label: "720 x 540", oncommand: "this.API_resizeWindow(720, 540);", type: "radio", checked: (currentWidth == 720 && currentHeight == 540) },
{ label: "800 x 600", oncommand: "this.API_resizeWindow(800, 600);", type: "radio", checked: (currentWidth == 800 && currentHeight == 600) },
{ label: "880 x 660", oncommand: "this.API_resizeWindow(880, 660);", type: "radio", checked: (currentWidth == 880 && currentHeight == 660) },
{ label: "1024 x 768", oncommand: "this.API_resizeWindow(1024, 768);", type: "radio", checked: (currentWidth == 1024 && currentHeight == 768) },
]
);


在线代理
const IN_NEW_TAB = true;
const IN_BACKGROUND = false;
var linkURL = FireGestures.getLinkURL();
if (linkURL)
    var URL="http://www.sneakme.net/browse.php?u="+  linkURL ;
else
    var URL = "http://www.sneakme.net/browse.php?u="+content.location;
if (IN_NEW_TAB)
    gBrowser.loadOneTab(URL, null, null, null, IN_BACKGROUND, false);
else
    gBrowser.loadURI(URL);

地址栏清除链接并获得焦点
var urlbar = document.getElementById('urlbar');
if (urlbar) {
        urlbar.value = "";
        urlbar.focus();
}

搜索栏清除关键字并获得焦点
        var searchbar = document.getElementById('searchbar');
        if (searchbar) {
                if (searchbar.mTextbox) searchbar.mTextbox.value = "";
                searchbar.value = "";
                var evt = document.createEvent("Events");
                evt.initEvent("oninput", true, true);
                searchbar.dispatchEvent(evt);
                searchbar.focus();
        }


侧边栏打开google 笔记本
openWebPanel("Google 笔记本", "http://www.google.com/notebook/ig");

弹出打开外部程序和文件夹位置的菜单

手势弹出菜单

FireGestures.generatePopup(event,
  [
    { label: "记事本", oncommand: "myfunction();" },
    { label: "word", oncommand: "myafunction();" },
    { label: "excel", oncommand: "mybfunction();" },
    { label: "-", oncommand: "" },
    { label: "我的文档", oncommand: "mycfunction();" },
    { label: "文件夹", oncommand: "mydfunction();" },
    { label: "Documents", oncommand: "myefunction();" },
  ]
);

myfunction = function(){
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
file.initWithPath("C:\\WINDOWS\\system32\\notepad.exe");
file.launch();
}


myafunction = function(){
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
file.initWithPath("C:\\Program Files\\Microsoft Office\\OFFICE11\\WINWORD.exe");
file.launch();
}


mybfunction = function(){
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
file.initWithPath("C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.exe");
file.launch();
}


mycfunction = function(){
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
file.initWithPath("C:\\WINDOWS\\explorer.exe");
file.launch();
}


mydfunction = function(){
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
file.initWithPath("D:\\文件夹");
file.launch();
}


myefunction = function(){
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
file.initWithPath("D:\\Documents");
file.launch();
}

程序和文件夹

FireGestures.generatePopup(event,
  [
    { label: "多媒体", oncommand: "LaunchApp('C:\\\\Program Files\\\\Windows Media Player\\\\wmplayer.exe');" },
    { label: "ACDSee", oncommand: "LaunchApp('C:\\\\Program Files\\\\ACDSee5RC\\\\ACDSee5.exe');" },
    { label: "画  图", oncommand: "LaunchApp('C:\\\\WINDOWS\\\\system32\\\\mspaint.exe');" },
    { label: "计算器", oncommand: "LaunchApp('C:\\\\WINDOWS\\\\system32\\\\calc.exe');" },
    { label: "记事本", oncommand: "LaunchApp('C:\\\\WINDOWS\\\\system32\\\\notepad.exe');" },
    { label: "word", oncommand: "LaunchApp('C:\\\\Program Files\\\\Microsoft Office\\\\OFFICE11\\\\WINWORD.exe');" },
    { label: "excel", oncommand: "LaunchApp('C:\\\\Program Files\\\\Microsoft Office\\\\OFFICE11\\\\EXCEL.exe');" },
    { label: "IE浏览器", oncommand: "LaunchApp('C:\\\\Program Files\\\\Internet Explorer\\\\iexplore.exe');" },
    { label: "世界之窗", oncommand: "LaunchApp('C:\\\\Program Files\\\\The World 2.1\\\\TheWorld.exe');" },
    { label: "---------", oncommand: "" },
    { label: "我的电脑", oncommand: "LaunchApp('::{20D04FE0-3AEA-1069-A2D8-08002B30309D}');" },
    { label: "我的文档", oncommand: "LaunchApp('C:\\\\WINDOWS\\\\explorer.exe');" },
    { label: "Mozilla", oncommand: "LaunchApp('C:\\\\Program Files\\\\Mozilla Firefox');" },
    { label: "Profiles", oncommand: "LaunchApp('C:\\\\Documents and Settings\\\\Administrator\\\\Application Data\\\\Mozilla\\\\Firefox\\\\Profiles');" },
    { label: "firefox", oncommand: "LaunchApp('D:\\\\firefox');" },
    { label: "F盘", oncommand: "LaunchApp('F:\\\\');" },
    { label: "movie", oncommand: "LaunchApp('E:\\\\movie');" },
  ]
);

LaunchApp = function(aPath){
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
file.initWithPath(aPath);
file.launch();
}

自定义搜索手势
1.只搜索一个固定的词。
2.搜不固定的词。
3.搜不固定的词同时打开几个网页。
4.搜不固定的词同时打开几个网页,还同时打开某些程序,
比如分析事物A,搜索A,判断分析得到A的属性B、C等,再去另外几个网站搜索B、C等,打开某程序验证,再根据结果搜其他网站,再用word整理成文,再上传到某个网站。

弹出搜索菜单

var searchTerms = FireGestures.getSelectedText();

FireGestures.generatePopup(event,
  [
    { label: "搜 Desperate Housewives", oncommand: "SearchDH();" },
    { label: "搜索电视剧" + ' "' + searchTerms + '"', oncommand: "SearchTV();" },
    { label: "搜索电影" + ' "' + searchTerms + '"', oncommand: "SearchMovie();" },
    { label: "分析" + ' "' + searchTerms + '"', oncommand: "Analytics();" },
  ]
);

SearchDH = function() {
gBrowser.loadOneTab('http://www.mininova.org/search/?search=desperate+housewives&cat=0');
gBrowser.loadOneTab('http://shooter.cn/search/Sub:desperate+housewives/');
gBrowser.loadOneTab('http://www.gougou.com/search?search=desperate+housewives&id=45');
gBrowser.loadOneTab('http://www.verycd.com/topics/375624/');
gBrowser.loadOneTab('http://www.verycd.com/topics/375842/');
gBrowser.loadOneTab('http://bbs.sfileydy.com/forumdisplay.php?fid=12');
}

SearchTV = function() {
gBrowser.loadOneTab('http://www.mininova.org/search/?search=' + searchTerms + '&cat=0', null, null, null, true, false);
gBrowser.loadOneTab('http://shooter.cn/search/Sub:' + searchTerms + '/', null, null, null, true, false);
gBrowser.loadOneTab('http://www.gougou.com/search?search=' + searchTerms + '&id=45', null, null, null, true, false);
gBrowser.loadOneTab('http://www.verycd.com/sto/teleplay/occident/');
gBrowser.loadOneTab('http://bbs.sfileydy.com/index.php');
}

SearchMovie = function() {
gBrowser.loadOneTab('http://www.imdb.com/find?s=all&q=' + searchTerms, null, null, null, true, false);
gBrowser.loadOneTab('http://www.douban.com/subject_search?search_text=' + searchTerms, null, null, null, true, false);
gBrowser.loadOneTab('http://video.gougou.com/search?s=' + searchTerms, null, null, null, true, false);
gBrowser.loadOneTab('http://www.funshion.com/search_media/search?word=' + searchTerms, null, null, null, true, false);
gBrowser.loadOneTab('http://www.gougou.com/search?search=高清+' + searchTerms, null, null, null, true, false);
gBrowser.loadOneTab('http://www.gougou.com/search?search=1024+' + searchTerms, null, null, null, true, false);
}

Analytics = function() {
gBrowser.loadOneTab('http://www.google.com/search?q=' + searchTerms + '&ie=gb2312', null, null, null, true, false);
gBrowser.loadOneTab('http://www.baidu.com/baidu?wd=' + searchTerms, null, null, null, true, false);
gBrowser.loadOneTab('http://www.yahoo.com');
gBrowser.loadOneTab('http://www.google.com/mail');
var file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsILocalFile);
file.initWithPath("C:\\WINDOWS\\system32\\notepad.exe");
file.launch();
}

中文字符转成UTF-8后搜索

var searchTerms = FireGestures.getSelectedText();

gBrowser.loadOneTab('http://www.mininova.org/search/?search=' + EncodeUtf8(searchTerms) + '&cat=0', null, null, null, true, false);
gBrowser.loadOneTab('http://www.imdb.com/find?s=all&q=' + searchTerms, null, null, null, true, false);
gBrowser.loadOneTab('http://www.douban.com/subject_search?search_text=' + EncodeUtf8(searchTerms), null, null, null, true, false);
gBrowser.loadOneTab('http://www.funshion.com/search_media/search?word=' + EncodeUtf8(searchTerms), null, null, null, true, false);
gBrowser.loadOneTab('http://www.google.com/search?q=' + EncodeUtf8(searchTerms), null, null, null, true, false);

//--------把中文字符转换成Utf8编码------------------------//
 function EncodeUtf8(s1)
  {
      var s = escape(s1);
      var sa = s.split("%");
      var retV ="";
      if(sa[0] != "")
      {
         retV = sa[0];
      }
      for(var i = 1; i < sa.length; i ++)
      {
           if(sa[i].substring(0,1) == "u")
           {
               retV += Hex2Utf8(Str2Hex(sa[i].substring(1,5)));
             
           }
           else retV += "%" + sa[i];
      }
    
      return retV;
  }
  function Str2Hex(s)
  {
      var c = "";
      var n;
      var ss = "0123456789ABCDEF";
      var digS = "";
      for(var i = 0; i < s.length; i ++)
      {
         c = s.charAt(i);
         n = ss.indexOf(c);
         digS += Dec2Dig(eval(n));
         
      }
      //return value;
      return digS;
  }
  function Dec2Dig(n1)
  {
      var s = "";
      var n2 = 0;
      for(var i = 0; i < 4; i++)
      {
         n2 = Math.pow(2,3 - i);
         if(n1 >= n2)
         {
            s += '1';
            n1 = n1 - n2;
          }
         else
          s += '0';
        
      }
      return s;
    
  }
  function Dig2Dec(s)
  {
      var retV = 0;
      if(s.length == 4)
      {
          for(var i = 0; i < 4; i ++)
          {
              retV += eval(s.charAt(i)) * Math.pow(2, 3 - i);
          }
          return retV;
      }
      return -1;
  }
  function Hex2Utf8(s)
  {
     var retS = "";
     var tempS = "";
     var ss = "";
     if(s.length == 16)
     {
         tempS = "1110" + s.substring(0, 4);
         tempS += "10" +  s.substring(4, 10);
         tempS += "10" + s.substring(10,16);
         var sss = "0123456789ABCDEF";
         for(var i = 0; i < 3; i ++)
         {
            retS += "%";
            ss = tempS.substring(i * 8, (eval(i)+1)*8);
          
          
          
            retS += sss.charAt(Dig2Dec(ss.substring(0,4)));
            retS += sss.charAt(Dig2Dec(ss.substring(4,8)));
         }
         return retS;
     }
     return "";
  }







ċ
代替鼠标手势All-in-OneGestures,firegestures的脚本_MouseGestures2.uc.rar
(11k)
76 5,
2009年7月1日 上午2:04
ċ
76 5,
2009年7月3日 上午5:07
Comments