From aa298f73ba1c5c181bb20c1e670c13b7f4dcf598 Mon Sep 17 00:00:00 2001 From: hogelog Date: Mon, 25 Jan 2010 14:20:30 +0000 Subject: * tabcommands.js: add tab commands * :lock, :protect, :freeze, :ren[ame], :dup[licate] git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36531 d0d07461-0603-4401-acd4-de1884942a52 --- tabcommands.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 tabcommands.js (limited to 'tabcommands.js') diff --git a/tabcommands.js b/tabcommands.js new file mode 100644 index 0000000..eb1b4de --- /dev/null +++ b/tabcommands.js @@ -0,0 +1,59 @@ +// PLUGIN_INFO//{{{ +var PLUGIN_INFO = + + {NAME} + add some tab commands + hogelog + 0.0.1 + 2.2 + 2.2 + http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/tabcommands.js + +; +//}}} +(function(){ +commands.add(["dup[licate]"], "duplicate current tab", function(args) { + gBrowser.duplicateTab(gBrowser.mCurrentTab); +}); +commands.add(["ren[ame]"], "rename current tab", function(args) { + gBrowser.renameTab(gBrowser.mCurrentTab); +}); +commands.add(["freeze"], "freeze current tab", function(args) { + let protect = gBrowser.mCurrentTab.hasAttribute("protected"); + let lock = gBrowser.mCurrentTab.hasAttribute("locked"); + if (protect && lock) { + gBrowser.mCurrentTab.removeAttribute("protected"); + gBrowser.mCurrentTab.removeAttribute("locked"); + } else + gBrowser.freezeTab(gBrowser.mCurrentTab); +}); +commands.add(["protect"], "protect current tab", function(args) { + let protect = gBrowser.mCurrentTab.hasAttribute("protected"); + if (protect) + gBrowser.mCurrentTab.removeAttribute("protected"); + else + gBrowser.mCurrentTab.setAttribute("protected", true); +}); +commands.add(["lock"], "lock current tab", function(args) { + let lock = gBrowser.mCurrentTab.hasAttribute("locked"); + if (lock) + gBrowser.mCurrentTab.removeAttribute("locked"); + else + gBrowser.mCurrentTab.setAttribute("locked", true); +}); + +})(); +// vim: fdm=marker sw=4 ts=4 et: -- cgit v1.2.3