From f73879f43e52c63877f4e1dfba60d895281f1878 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 11 May 2009 01:20:45 +1000 Subject: [PATCH] Add :stopall. --- common/content/buffer.js | 24 +++--------- common/content/tabs.js | 40 ++++++++++++++++++++ vimperator/NEWS | 1 + vimperator/contrib/vim/syntax/vimperator.vim | 4 +- vimperator/locale/en-US/browsing.txt | 16 +++++--- vimperator/locale/en-US/index.txt | 9 +++-- xulmus/content/config.js | 3 +- 7 files changed, 67 insertions(+), 30 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index a90f91ce..19d69cc4 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -254,14 +254,8 @@ function Buffer() //{{{ }); mappings.add(myModes, [""], - "Stop loading", - function () - { - if (config.stop) - config.stop(); - else - window.BrowserStop(); - }); + "Stop loading the current web page", + function () { tabs.stop(getBrowser().mCurrentTab); }); // scrolling mappings.add(myModes, ["j", "", ""], @@ -430,7 +424,7 @@ function Buffer() //{{{ // reloading mappings.add(myModes, ["r"], - "Reload current page", + "Reload the current web page", function () { tabs.reload(getBrowser().mCurrentTab, false); }); mappings.add(myModes, ["R"], @@ -592,7 +586,7 @@ function Buffer() //{{{ }); commands.add(["re[load]"], - "Reload current page", + "Reload the current web page", function (args) { tabs.reload(getBrowser().mCurrentTab, args.bang); }, { bang: true, @@ -642,14 +636,8 @@ function Buffer() //{{{ }); commands.add(["st[op]"], - "Stop loading", - function () - { - if (config.stop) - config.stop(); - else - window.BrowserStop(); - }, + "Stop loading the current web page", + function () { tabs.stop(getBrowser().mCurrentTab); }, { argCount: "0" }); commands.add(["vie[wsource]"], diff --git a/common/content/tabs.js b/common/content/tabs.js index c4802f59..c3d9f059 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -527,6 +527,11 @@ function Tabs() //{{{ bang: true }); + commands.add(["stopa[ll]"], + "Stop loading all tab pages", + function () { tabs.stopAll(); }, + { argCount: "0" }); + // TODO: add count support commands.add(["tabm[ove]"], "Move the current tab after tab N", @@ -886,6 +891,13 @@ function Tabs() //{{{ getBrowser().mTabContainer.selectedIndex = index; }, + /** + * Reload the specified tab. + * + * @param {Object} tab The tab to reload. + * @param {boolean} bypassCache Whether to bypass the cache when + * reloading. + */ reload: function (tab, bypassCache) { if (bypassCache) @@ -899,6 +911,12 @@ function Tabs() //{{{ } }, + /** + * Reload all tabs. + * + * @param {boolean} bypassCache Whether to bypass the cache when + * reloading. + */ reloadAll: function (bypassCache) { if (bypassCache) @@ -922,6 +940,28 @@ function Tabs() //{{{ } }, + /** + * Stop loading the specified tab. + * + * @param {Object} tab The tab to stop loading. + */ + stop: function (tab) + { + if (config.stop) + config.stop(tab); + else + tab.linkedBrowser.stop(); + }, + + /** + * Stop loading all tabs. + */ + stopAll: function () + { + for (let [,browser] in this.browsers) + browser.stop(); + }, + // "buffer" is a string which matches the URL or title of a buffer, if it // is null, the last used string is used again switchTo: function (buffer, allowNonUnique, count, reverse) diff --git a/vimperator/NEWS b/vimperator/NEWS index 3a3191b8..d9ebe362 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -4,6 +4,7 @@ * TabMixPlus (and other tab extensions) should work much better now together with Vimperator unless you :set guioptions+=[nN] * remove 'preload' option. You can fake it by some custom javascript in your init file + * add :stopall * add :tabdo * add 'encoding' * add 'hintinputs' diff --git a/vimperator/contrib/vim/syntax/vimperator.vim b/vimperator/contrib/vim/syntax/vimperator.vim index 42aa9bb8..8f560919 100644 --- a/vimperator/contrib/vim/syntax/vimperator.vim +++ b/vimperator/contrib/vim/syntax/vimperator.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: VIMperator configuration file " Maintainer: Doug Kearns -" Last Change: 2009 Apr 30 +" Last Change: 2009 May 11 if exists("b:current_syntax") finish @@ -26,7 +26,7 @@ syn keyword vimperatorCommand ab[breviate] ab[clear] addo[ns] bN[ext] b[uffer] b \ ino[remap] iu[nmap] iuna[bbrev] javas[cript] js ju[mps] let loadplugins lpl ls ma[rk] macros map mapc[lear] marks mes[sages] \ mkv[imperatorrc] no[remap] noh[lsearch] norm[al] o[pen] optionu[sage] pa[geinfo] pagest[yle] pc[lose] pl[ay] pref[erences] \ prefs pw[d] q[uit] qa[ll] qma[rk] qmarks quita[ll] re[draw] re[load] reloada[ll] res[tart] run runt[ime] sav[eas] sb[ar] - \ sb[open] sbcl[ose] scrip[tnames] se[t] setg[lobal] setl[ocal] sideb[ar] so[urce] st[op] sty[le] tN[ext] t[open] tab + \ sb[open] sbcl[ose] scrip[tnames] se[t] setg[lobal] setl[ocal] sideb[ar] so[urce] st[op] stopall sty[le] tN[ext] t[open] tab \ tabN[ext] tabc[lose] tabd[uplicate] tabde[tach] tabd[o] tabe[dit] tabfir[st] tabl[ast] tabm[ove] tabn[ext] tabnew tabo[nly] \ tabopen tabp[revious] tabr[ewind] tabs time tn[ext] tp[revious] u[ndo] una[bbreviate] undoa[ll] unl[et] unm[ap] ve[rsion] \ vie[wsource] viu[sage] w[rite] wc[lose] win[open] winc[lose] wine[dit] wo[pen] wq wqa[ll] xa[ll] zo[om] diff --git a/vimperator/locale/en-US/browsing.txt b/vimperator/locale/en-US/browsing.txt index c1cf0af7..7a3a5be9 100644 --- a/vimperator/locale/en-US/browsing.txt +++ b/vimperator/locale/en-US/browsing.txt @@ -240,22 +240,22 @@ section:Reloading[reloading] |r| ||r|| ________________________________________________________________________________ -Force reloading of the current page. +Force reloading of the current web page. ________________________________________________________________________________ |R| ||R|| ________________________________________________________________________________ -Force reloading of the current page skipping the cache. +Force reloading of the current web page skipping the cache. ________________________________________________________________________________ |:re| |:reload| + ||:re[load][!]|| ________________________________________________________________________________ -Reload current page. Forces reloading of the current page. If [!] is -given, skip the cache. +Reload current web page. Forces reloading of the current page. If [!] is given, +skip the cache. ________________________________________________________________________________ @@ -277,7 +277,13 @@ ________________________________________________________________________________ |:st| |:stop| ||:st[op]|| ________________________________________________________________________________ -Stop loading. Stop loading current web page. +Stop loading the current web page. +________________________________________________________________________________ + +|:stopa| |:stopall| + +||:stopa[ll]|| +________________________________________________________________________________ +Stop loading all web pages. ________________________________________________________________________________ section:Writing[writing,save-file] diff --git a/vimperator/locale/en-US/index.txt b/vimperator/locale/en-US/index.txt index 70cefa02..cd9aa2d4 100644 --- a/vimperator/locale/en-US/index.txt +++ b/vimperator/locale/en-US/index.txt @@ -14,7 +14,7 @@ section:Normal{nbsp}mode[normal-index] ||[m][m]|| Select the alternate tab or the [count]th tab + ||[m][m]|| Increment last number in URL + ||[m][m]|| Scroll up a full page + -||[m][m]|| Stop loading + +||[m][m]|| Stop loading the current web page + ||[m][m]|| Scroll window downwards in the buffer + ||[m][m]|| Scroll down a full page + ||[m][m]|| Print the current file name + @@ -66,7 +66,7 @@ section:Normal{nbsp}mode[normal-index] ||[m]o[m]|| Open one or more URLs + ||[m]p[m]|| Open (put) a URL based on the current clipboard contents in the current buffer + ||[m]q[m]|| Record a key sequence into a macro + -||[m]r[m]|| Reload current page + +||[m]r[m]|| Reload the current web page + ||[m]t[m]|| Open one or more URLs in a new tab + ||[m]u[m]|| Undo closing of a tab + ||[m]y[m]|| Yank current location to the clipboard + @@ -222,7 +222,7 @@ section:Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:quit[c]|| Quit current tab + ||[c]:quitall[c]|| Quit Vimperator + ||[c]:redraw[c]|| Redraw the screen + -||[c]:reload[c]|| Reload current page + +||[c]:reload[c]|| Reload the current web page + ||[c]:reloadall[c]|| Reload all tab pages + ||[c]:restart[c]|| Force the browser to restart + ||[c]:runtime[c]|| Source the specified file from each directory in 'runtimepath' + @@ -236,7 +236,8 @@ section:Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:silent[c]|| Execute a command silently + ||[c]:style[c]|| Style Vimperator and web sites + ||[c]:source[c]|| Read Ex commands from a file + -||[c]:stop[c]|| Stop loading + +||[c]:stop[c]|| Stop loading the current web page + +||[c]:stopall[c]|| Stop loading all tab pages + ||[c]:tab[c]|| Execute a command and tell it to output in a new tab + ||[c]:tabdo[c]|| Execute a command in each tab + ||[c]:tabdetach[c]|| Detach current tab to its own window + diff --git a/xulmus/content/config.js b/xulmus/content/config.js index 64a9b04c..579fa979 100644 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -174,7 +174,8 @@ const config = { //{{{ "library.js" ], - stop: function () + // FIXME: tab arg and media tab exception? + stop: function (tab) { SBGetBrowser().mCurrentBrowser.stop(); },