- -pv
スレッドの閲覧状況:
現在、- がスレを見ています。
これまでに合計 - 表示されました。
※PC・スマホの表示回数をカウントしてます。
※24時間表示がないスレのPVはリセットされます。

Mozilla Firefox 拡張機能スレッド【お兄ちゃん】

678名無しさん@おーぷん :2017/12/18(月)02:15:18 ID:KNz
http://egg.5ch.net/test/read.cgi/software/1506030128/997
↑の再起動スクリプトを元に別のスクリプトに改変してみた

// Control+Shift+Alt+W で左側のタブをすべて閉じる
var CloseTabsOnLeftKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(CloseTabsOnLeftKey);
CloseTabsOnLeftKey.id = "CloseTabsOnLeft-key";
CloseTabsOnLeftKey.setAttribute("key", "W");
CloseTabsOnLeftKey.setAttribute("oncommand", "CloseTabsOnLeft();");
CloseTabsOnLeftKey.setAttribute("modifiers", "control shift alt");

function CloseTabsOnLeft() {
var tabs = gBrowser.tabContainer.childNodes;
for (var i = tabs.length - 1; tabs[i] != gBrowser.mCurrentTab; i--) {
}
for (i--; i >=0 ; i--) {
gBrowser.removeTab(tabs[i]);
}
}
679名無しさん@おーぷん :2017/12/18(月)02:15:51 ID:KNz
// Control+Shift+Alt+E で右側のタブをすべて閉じる
var CloseTabsOnRightKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(CloseTabsOnRightKey);
CloseTabsOnRightKey.id = "CloseTabsOnRight-key";
CloseTabsOnRightKey.setAttribute("key", "E");
CloseTabsOnRightKey.setAttribute("oncommand", "CloseTabsOnRight();");
CloseTabsOnRightKey.setAttribute("modifiers", "control shift alt");

function CloseTabsOnRight() {
var tabs = gBrowser.tabContainer.childNodes;
for (var i = tabs.length - 1; tabs[i] != gBrowser.selectedTab; i--) {
gBrowser.removeTab(tabs[i]);
}
}
680名無しさん@おーぷん :2017/12/18(月)02:16:15 ID:KNz
// Control+Shift+Alt+Q で他のタブをすべて閉じる
var CloseOtherTabsKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(CloseOtherTabsKey);
CloseOtherTabsKey.id = "CloseOtherTabs-key";
CloseOtherTabsKey.setAttribute("key", "Q");
CloseOtherTabsKey.setAttribute("oncommand", "CloseOtherTabs();");
CloseOtherTabsKey.setAttribute("modifiers", "control shift alt");

function CloseOtherTabs() {
var browser = getBrowser(); browser.removeAllTabsBut(browser.mCurrentTab);
}
681名無しさん@おーぷん :2017/12/18(月)02:16:37 ID:KNz
// Control+Shift+Alt+T ですべてのタブを閉じる
var CloseAllTabsKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(CloseAllTabsKey);
CloseAllTabsKey.id = "CloseAllTabs-key";
CloseAllTabsKey.setAttribute("key", "T");
CloseAllTabsKey.setAttribute("oncommand", "CloseAllTabs();");
CloseAllTabsKey.setAttribute("modifiers", "control shift alt");

function CloseAllTabs() {
var browser = getBrowser(); var ctab = browser.addTab("about:newtab"); browser.removeAllTabsBut(ctab);
}
682名無しさん@おーぷん :2017/12/18(月)02:17:07 ID:KNz
// Control+Shift+Alt+I でURL中の数値を増加
var IncrementURLKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(IncrementURLKey);
IncrementURLKey.id = "IncrementURL-key";
IncrementURLKey.setAttribute("key", "I");
IncrementURLKey.setAttribute("oncommand", "IncrementURL(+1);");
IncrementURLKey.setAttribute("modifiers", "control shift alt");

function IncrementURL(aIncrement) {
var url = gBrowser.currentURI.spec;
if (!url.match(/(\d+)(\D*)$/))
throw "No numeric value in URL";
var num = RegExp.$1;
var digit = (num.charAt(0) == "0") ? num.length : null;
num = parseInt(num, 10) + aIncrement;
if (num < 0)
throw "Cannot decrement number in URL anymore";
num = num.toString();
digit = digit - num.length;
for (var i = 0; i < digit; i++)
num = "0" + num;
loadURI(RegExp.leftContext + num + RegExp.$2);
}
683名無しさん@おーぷん :2017/12/18(月)02:17:32 ID:KNz
// Control+Shift+Alt+D でURL中の数値を減少
var DecrementURLKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(DecrementURLKey);
DecrementURLKey.id = "DecrementURL-key";
DecrementURLKey.setAttribute("key", "D");
DecrementURLKey.setAttribute("oncommand", "DecrementURL(-1);");
DecrementURLKey.setAttribute("modifiers", "control shift alt");

function DecrementURL(aIncrement) {
var url = gBrowser.currentURI.spec;
if (!url.match(/(\d+)(\D*)$/))
throw "No numeric value in URL";
var num = RegExp.$1;
var digit = (num.charAt(0) == "0") ? num.length : null;
num = parseInt(num, 10) + aIncrement;
if (num < 0)
throw "Cannot decrement number in URL anymore";
num = num.toString();
digit = digit - num.length;
for (var i = 0; i < digit; i++)
num = "0" + num;
loadURI(RegExp.leftContext + num + RegExp.$2);
}
684名無しさん@おーぷん :2017/12/18(月)02:18:00 ID:KNz
// Control+Shift+Alt+A で履歴の先頭へ戻る
var RewindKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(RewindKey);
RewindKey.id = "Rewind-key";
RewindKey.setAttribute("key", "A");
RewindKey.setAttribute("oncommand", "Rewind();");
RewindKey.setAttribute("modifiers", "control shift alt");

function Rewind() {
SessionStore.getSessionHistory(gBrowser.selectedTab, history => {
gBrowser.gotoIndex(history.entries.length = 0)
});
}
685名無しさん@おーぷん :2017/12/18(月)02:18:20 ID:KNz
// Control+Shift+Alt+Z で履歴の末尾へ進む
var FastForwardKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(FastForwardKey);
FastForwardKey.id = "FastForward-key";
FastForwardKey.setAttribute("key", "Z");
FastForwardKey.setAttribute("oncommand", "FastForward();");
FastForwardKey.setAttribute("modifiers", "control shift alt");

function FastForward() {
SessionStore.getSessionHistory(gBrowser.selectedTab, history => {
gBrowser.gotoIndex(history.entries.length - 1)
});
}
686名無しさん@おーぷん :2017/12/18(月)02:27:17 ID:KNz
「Shortkeys (Custom Keyboard Shortcuts) for Firefox」を消した
更新したら設定飛んだのでもう要らない
やりたいことはucjsスクリプトで代替出来た
687名無しさん@おーぷん :2017/12/19(火)00:26:41 ID:3Yq
// Control+Shift+Alt+F でタブを閉じて先頭のタブへフォーカス
var CloseTabFocusFirstKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(CloseTabFocusFirstKey);
CloseTabFocusFirstKey.id = "CloseTabFocusFirst-key";
CloseTabFocusFirstKey.setAttribute("key", "F");
CloseTabFocusFirstKey.setAttribute("oncommand", "CloseTabFocusFirst();");
CloseTabFocusFirstKey.setAttribute("modifiers", "control shift alt");

function CloseTabFocusFirst() {
var tab = gBrowser.mCurrentTab;
if(tab.previousSibling)
gBrowser.tabContainer.selectedIndex = 0;
gBrowser.removeTab(tab);
}
688名無しさん@おーぷん :2017/12/19(火)00:27:00 ID:3Yq
// Control+Shift+Alt+L でタブを閉じて末尾のタブへフォーカス
var CloseTabFocusLastKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(CloseTabFocusLastKey);
CloseTabFocusLastKey.id = "CloseTabFocusLast-key";
CloseTabFocusLastKey.setAttribute("key", "L");
CloseTabFocusLastKey.setAttribute("oncommand", "CloseTabFocusLast();");
CloseTabFocusLastKey.setAttribute("modifiers", "control shift alt");

function CloseTabFocusLast() {
var tab = gBrowser.mCurrentTab;
if(tab.previousSibling)
gBrowser.tabContainer.selectedIndex = 0;
gBrowser.selectTabAtIndex(gBrowser.browsers.length-1);
gBrowser.removeTab(tab);
}
689名無しさん@おーぷん :2017/12/19(火)00:27:35 ID:3Yq
// Control+Shift+Alt+S で左隣のタブのみ閉じる
var CloseTheLeftOneKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(CloseTheLeftOneKey);
CloseTheLeftOneKey.id = "CloseTheLeftOne-key";
CloseTheLeftOneKey.setAttribute("key", "S");
CloseTheLeftOneKey.setAttribute("oncommand", "CloseTheLeftOne();");
CloseTheLeftOneKey.setAttribute("modifiers", "control shift alt");

function CloseTheLeftOne() {
var childNodes = gBrowser.tabContainer.childNodes;
var currentTab = gBrowser.tabContainer.selectedIndex;
if ( currentTab > 0 )
gBrowser.removeTab(childNodes[currentTab - 1]);
}
690名無しさん@おーぷん :2017/12/19(火)00:27:58 ID:3Yq
// Control+Shift+Alt+X で右隣のタブのみ閉じる
var CloseTheRightOneKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(CloseTheRightOneKey);
CloseTheRightOneKey.id = "CloseTheRightOne-key";
CloseTheRightOneKey.setAttribute("key", "X");
CloseTheRightOneKey.setAttribute("oncommand", "CloseTheRightOne();");
CloseTheRightOneKey.setAttribute("modifiers", "control shift alt");

function CloseTheRightOne() {
var childNodes = gBrowser.tabContainer.childNodes;
var currentTab = gBrowser.tabContainer.selectedIndex;
if ( currentTab < childNodes.length - 1 )
gBrowser.removeTab(childNodes[currentTab + 1]);
}
691名無しさん@おーぷん :2017/12/19(火)00:28:26 ID:3Yq
// Control+Shift+Alt+C でページの配色を有効/無効
var DocumentColorKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(DocumentColorKey);
DocumentColorKey.id = "DocumentColor-key";
DocumentColorKey.setAttribute("key", "C");
DocumentColorKey.setAttribute("oncommand", "DocumentColor();");
DocumentColorKey.setAttribute("modifiers", "control shift alt");

function DocumentColor() {
const kPrefName = "browser.display.document_color_use";
var prefVal = gPrefService.getIntPref(kPrefName);
prefVal = prefVal == 1 ? 2 : 1;
gPrefService.setIntPref(kPrefName, prefVal);
}
692名無しさん@おーぷん :2017/12/23(土)00:28:27 ID:APT
「Open in Google Translate」を削除して「テキストリンク&Google翻訳」に絞った
でもページ翻訳ボタンがある所までマウスカーソルを移動させるのがだるいので
FireGesturesの「ページを翻訳」スクリプトを拝借しchromeフォルダに放り込み
ショートカットをEasystrokeでジェスチャー登録した

// Control+Shift+Alt+G でGoogle翻訳(en → ja)
var GoogleTranslateKey = document.createElement("key")
document.getElementById("mainKeyset").appendChild(GoogleTranslateKey);
GoogleTranslateKey.id = "GoogleTranslate-key";
GoogleTranslateKey.setAttribute("key", "G");
GoogleTranslateKey.setAttribute("oncommand", "GoogleTranslate();");
GoogleTranslateKey.setAttribute("modifiers", "control shift alt");

function GoogleTranslate() {
const FROM = "en";
const TO = "ja";
const DOMAIN = "translate.google.com";
//const URL = "http://" + DOMAIN + "/translate?langpair=" + FROM + "-" + TO + "&hl=" + TO + "&u=";
const URL = "http://" + DOMAIN + "/translate?sl=en&tl=ja" + FROM + "-" + TO + "&hl=" + TO + "&u=";
var curURL = gBrowser.currentURI.spec;
if (curURL.indexOf(DOMAIN) != -1)
BrowserReload();
else
//gBrowser.loadURI(URL + encodeURIComponent(curURL));
gBrowser.loadOneTab(URL + encodeURIComponent(curURL), {inBackground: false, relatedToCurrent: true});
}

新着レスの表示 | ここまで読んだ

名前: mail:





Mozilla Firefox 拡張機能スレッド【お兄ちゃん】
CRITEO