Browse Source

gBrowser -> getBrowser()

pull/1/head
10sr 11 years ago
parent
commit
49f39c5c80
2 changed files with 20 additions and 27 deletions
  1. +17
    -24
      _keysnail.js
  2. +3
    -3
      emacs.el

+ 17
- 24
_keysnail.js View File

@@ -296,8 +296,8 @@ ext.add("my-index-html", function(ev, arg){
}, "open my index.html"); }, "open my index.html");


ext.add("echo-tab-info", function(){ ext.add("echo-tab-info", function(){
var all = gBrowser.tabs.length;
var ix = gBrowser.mCurrentTab._tPos;
var all = getBrowser().tabs.length;
var ix = getBrowser().mCurrentTab._tPos;
var title = window.document.title; var title = window.document.title;
var url = window.content.location.href; var url = window.content.location.href;
display.echoStatusBar((ix + 1).toString() + " / " + display.echoStatusBar((ix + 1).toString() + " / " +
@@ -465,10 +465,10 @@ ext.add('auto-install-plugins', function(ev, arg){
}, 'Install plugins automatically if not installed yet.'); }, 'Install plugins automatically if not installed yet.');


ext.add('put-aside-this-page', function (ev, arg) { ext.add('put-aside-this-page', function (ev, arg) {
var n = gBrowser.mCurrentTab._tPos;
gBrowser.moveTabTo(gBrowser.mCurrentTab, 0);
var n = getBrowser().mCurrentTab._tPos;
getBrowser().moveTabTo(getBrowser().mCurrentTab, 0);
if (n != 0) { if (n != 0) {
gBrowser.selectedTab = gBrowser.mTabs[n];
getBrowser().selectedTab = getBrowser().mTabs[n];
} }
}, 'put aside this page'); }, 'put aside this page');


@@ -495,9 +495,9 @@ ext.add("hide-sidebar", function(){
}, "hide-sidebar"); }, "hide-sidebar");


ext.add("close-and-next-tab", function (ev, arg) { ext.add("close-and-next-tab", function (ev, arg) {
var n = gBrowser.mCurrentTab._tPos;
gBrowser.removeCurrentTab();
gBrowser.selectedTab = gBrowser.mTabs[n];
var n = getBrowser().mCurrentTab._tPos;
getBrowser().removeCurrentTab();
getBrowser().selectedTab = getBrowser().mTabs[n];
}, "close and focus to next tab"); }, "close and focus to next tab");


////////////////////////////////////// //////////////////////////////////////
@@ -693,7 +693,7 @@ ext.add("list-closed-tabs", function () {
ext.add("list-tab-history", function () { ext.add("list-tab-history", function () {
const fav = "chrome://mozapps/skin/places/defaultFavicon.png"; const fav = "chrome://mozapps/skin/places/defaultFavicon.png";
var tabHistory = []; var tabHistory = [];
var sessionHistory = gBrowser.webNavigation.sessionHistory;
var sessionHistory = getBrowser().webNavigation.sessionHistory;
if (sessionHistory.count < 1) if (sessionHistory.count < 1)
return void display.echoStatusBar("Tab history not exist", 2000); return void display.echoStatusBar("Tab history not exist", 2000);
var curIdx = sessionHistory.index; var curIdx = sessionHistory.index;
@@ -720,7 +720,8 @@ ext.add("list-tab-history", function () {
header : ["Title", "URL"], header : ["Title", "URL"],
initialIndex : thIdx, initialIndex : thIdx,
callback : function(i) { callback : function(i) {
if (i >= 0) gBrowser.webNavigation.gotoIndex(tabHistory[i][3]);
if (i >= 0)
getBrowser().webNavigation.gotoIndex(tabHistory[i][3]);
} }
}); });
}, 'List tab history'); }, 'List tab history');
@@ -747,7 +748,7 @@ key.suspendKey = "Not defined";
hook.setHook('KeyBoardQuit', function (aEvent) { hook.setHook('KeyBoardQuit', function (aEvent) {
// ext.exec("hide-sidebar"); // ext.exec("hide-sidebar");
let(elem = document.commandDispatcher.focusedElement) elem && elem.blur(); let(elem = document.commandDispatcher.focusedElement) elem && elem.blur();
gBrowser.focus();
getBrowser().focus();
content.focus(); content.focus();
command.closeFindBar(); command.closeFindBar();
if (util.isCaretEnabled()) { if (util.isCaretEnabled()) {
@@ -775,11 +776,11 @@ hook.setHook('Unload', function () {
// ============================= Key bindings ============================== // // ============================= Key bindings ============================== //


key.setGlobalKey('C-<right>', function () { key.setGlobalKey('C-<right>', function () {
gBrowser.mTabContainer.advanceSelectedTab(1, true);
getBrowser().mTabContainer.advanceSelectedTab(1, true);
}, 'ひとつ右のタブへ'); }, 'ひとつ右のタブへ');


key.setGlobalKey('C-<left>', function () { key.setGlobalKey('C-<left>', function () {
gBrowser.mTabContainer.advanceSelectedTab(-1, true);
getBrowser().mTabContainer.advanceSelectedTab(-1, true);
}, 'ひとつ左のタブへ'); }, 'ひとつ左のタブへ');


key.setGlobalKey('C-<up>', function () { key.setGlobalKey('C-<up>', function () {
@@ -803,7 +804,7 @@ key.setGlobalKey('C-<down>', function () {


key.setGlobalKey('<delete>', function (ev, arg) { key.setGlobalKey('<delete>', function (ev, arg) {
let (elem = document.commandDispatcher.focusedElement) elem && elem.blur(); let (elem = document.commandDispatcher.focusedElement) elem && elem.blur();
gBrowser.focus();
getBrowser().focus();
content.focus(); content.focus();
}, 'コンテンツへフォーカス', true); }, 'コンテンツへフォーカス', true);


@@ -847,7 +848,7 @@ key.setViewKey(['t', 'p'], function (ev, arg) {
ext.exec("twitter-client-tweet-this-page", arg, ev); ext.exec("twitter-client-tweet-this-page", arg, ev);
}, 'このページのタイトルと URL を使ってつぶやく', true); }, 'このページのタイトルと URL を使ってつぶやく', true);


key.setViewKey('u', function (ev) {
key.setViewKey([['u'], ['S-SPC']], function (ev) {
goDoCommand("cmd_scrollPageUp"); goDoCommand("cmd_scrollPageUp");
}, '一画面分スクロールアップ'); }, '一画面分スクロールアップ');


@@ -913,7 +914,7 @@ key.setViewKey('a', function (ev, arg) {
allTabs.open(); allTabs.open();
}, 'alltabs.open'); }, 'alltabs.open');


key.setViewKey('d', function (ev) {
key.setViewKey([['d'], ['SPC']], function (ev) {
goDoCommand("cmd_scrollPageDown"); goDoCommand("cmd_scrollPageDown");
}, '一画面スクロールダウン'); }, '一画面スクロールダウン');


@@ -1028,11 +1029,3 @@ key.setEditKey('C-p', function (ev) {
key.setEditKey('C-o', function (ev) { key.setEditKey('C-o', function (ev) {
command.openLine(ev); command.openLine(ev);
}, '行を開く (Open line)'); }, '行を開く (Open line)');

key.setViewKey('S-SPC', function (ev) {
goDoCommand("cmd_scrollPageUp");
}, '一画面分スクロールアップ');

key.setViewKey('SPC', function (ev) {
goDoCommand("cmd_scrollPageDown");
}, '一画面スクロールダウン');

+ 3
- 3
emacs.el View File

@@ -1017,8 +1017,8 @@ found, otherwise returns nil."
(interactive) (interactive)
(js2-enter-key) (js2-enter-key)
(indent-for-tab-command))) (indent-for-tab-command)))
(add-hook (kill-local-variable 'before-save-hook)
'js2-before-save)
;; (add-hook (kill-local-variable 'before-save-hook)
;; 'js2-before-save)
;; (add-hook 'before-save-hook ;; (add-hook 'before-save-hook
;; 'my-indent-buffer ;; 'my-indent-buffer
;; nil ;; nil
@@ -1364,7 +1364,7 @@ If called intearctively, find word at point."
t) ; save to file immediately after adding file to recentf list t) ; save to file immediately after adding file to recentf list
(add-hook 'kill-emacs-hook (add-hook 'kill-emacs-hook
'recentf-load-list) 'recentf-load-list)
(run-with-idle-timer 5 t 'recentf-save-list)
;;(run-with-idle-timer 5 t 'recentf-save-list)
;; (add-hook 'find-file-hook ;; (add-hook 'find-file-hook
;; (lambda () ;; (lambda ()
;; (recentf-add-file default-directory))) ;; (recentf-add-file default-directory)))


Loading…
Cancel
Save