| 64 | | liberator.commands.add(["hatebu"], "Hatena Bookmark", function() { |
| 65 | | var url = 'http://b.hatena.ne.jp/entry/'+liberator.buffer.URL; |
| 66 | | getBrowser().addTab(url, null, null, null); |
| 67 | | }); |
| | 75 | [ |
| | 76 | [['sfl'], 'Subscribe Fastladder', function() liberator.open('http://fastladder.com/subscribe/'+buffer.URL, liberator.CURRENT_TAB)], |
| | 77 | [['hateb'], 'Hatena Bookmark', function() liberator.open('http://b.hatena.ne.jp/entry/'+buffer.URL, liberator.NEW_BACKGROUND_TAB)], |
| | 78 | [['hatea'], 'Hatena Antenna', function() liberator.open('http://a.hatena.ne.jp/append?'+buffer.URL, liberator.NEW_BACKGROUND_TAB)] |
| | 79 | ].forEach(function([cmd, description, action]) commands.addUserCommand(cmd, description, action)); |
| 70 | | ['bbs2chreader', 'bbs2chreader', 'chrome://bbs2chreader/content/bbsmenu/page.xul', 'resizable,width=200,height=700'], |
| 71 | | ['scrapbook', 'ScrapBook', 'chrome://scrapbook/content/scrapbook.xul', 'resizable,width=300,height=700'], |
| 72 | | ['foxage2ch', 'Foxage2ch', 'chrome://foxage2ch/content/foxage2ch.xul'], |
| 73 | | ['livehttpheaders', 'Live HTTP Headers', 'chrome://livehttpheaders/content/LiveHTTPHeaders.xul'], |
| 74 | | ].forEach(function([name, description, uri, args]) liberator.config.dialogs.push([name, description, function() openDialog(uri, "_blank", args)])); |
| | 82 | ['bbs2chreader', 'bbs2chreader', 'chrome://bbs2chreader/content/bbsmenu/page.xul', 'resizable,width=200,height=700'], |
| | 83 | ['scrapbook', 'ScrapBook', 'chrome://scrapbook/content/scrapbook.xul', 'resizable,width=300,height=700'], |
| | 84 | ['foxage2ch', 'Foxage2ch', 'chrome://foxage2ch/content/foxage2ch.xul'], |
| | 85 | ['livehttpheaders', 'Live HTTP Headers', 'chrome://livehttpheaders/content/LiveHTTPHeaders.xul'], |
| | 86 | ].forEach(function([name, description, uri, args]) config.dialogs.push([name, description, function() openDialog(uri, "_blank", args)])); |
| 77 | | liberator.commands.add(["saves[ession]"], "Save Session", function() gSessionManager.saveWindow()); |
| | 89 | commands.add(["saves[ession]"], "Save Session", function() gSessionManager.saveWindow()); |
| | 90 | |
| | 91 | hints.addMode("i", "Focus to textbox", |
| | 92 | function(elem) elem.focus(), |
| | 93 | function() "//input[not(@type='hidden')] | //textarea | //xhtml:input[not(@type='hidden')] | //xhtml:textarea" |
| | 94 | ); |
| | 95 | hints.addMode("I", "delete image", |
| | 96 | function(elem) elem.style.display="none", |
| | 97 | function() "//img"); |
| | 98 | hints.addMode("D", "delete block", |
| | 99 | function(elem) elem.parentNode.removeChild(elem), |
| | 100 | function() "//p | //div | //table | //iframe"); |
| | 101 | hints.addMode("d", "delete element", |
| | 102 | function(elem) elem.parentNode.removeChild(elem), |
| | 103 | function() "//*"); |
| 110 | | |
| 111 | | liberator.commands.addUserCommand(["gmcommand", "gmcmd"], "Run Greasemonkey Command", |
| 112 | | function(value) { |
| 113 | | var commander = GM_BrowserUI.getCommander(getBrowser().selectedTab.linkedBrowser.contentWindow); |
| 114 | | for (var i = 0; i < commander.menuItems.length; i++) { |
| 115 | | var menuItem = commander.menuItems[i]; |
| 116 | | if (menuItem.getAttribute("label") == value) { |
| 117 | | menuItem._commandFunc(); |
| 118 | | return; |
| 119 | | } |
| 120 | | } |
| 121 | | liberator.echoerr(value+" is not defined userscript command."); |
| 122 | | }, |
| 123 | | { |
| 124 | | completer: function(filter) { |
| 125 | | var commander = GM_BrowserUI.getCommander(getBrowser().selectedTab.linkedBrowser.contentWindow); |
| 126 | | var completions = []; |
| 127 | | var exp = new RegExp(".*" + filter + ".*"); |
| 128 | | for (var i = 0; i < commander.menuItems.length; i++) { |
| 129 | | var label = commander.menuItems[i].getAttribute("label"); |
| 130 | | if (!filter || exp.test(label)) { |
| 131 | | completions.push([label, label]); |
| 132 | | } |
| 133 | | } |
| 134 | | return [0, completions]; |
| 135 | | } |
| 136 | | }); |