diff options
author | trapezoid | 2008-12-06 08:49:51 +0000 |
---|---|---|
committer | trapezoid | 2008-12-06 08:49:51 +0000 |
commit | f417812b520e599923e346715dc455021db1ceff (patch) | |
tree | 39a1964208e02f1147b6f809d1831f6937ea96c3 /ldrize_cooperation.js | |
parent | 23bbc7f8acdaa2102ba1b6346eef50eece417ca2 (diff) | |
download | vimperator-plugins-f417812b520e599923e346715dc455021db1ceff.tar.bz2 |
LDRizeの段落を使ったHintsの候補絞り込みを、hints.addModeを使うように修正
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@25997 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'ldrize_cooperation.js')
-rw-r--r-- | ldrize_cooperation.js | 70 |
1 files changed, 19 insertions, 51 deletions
diff --git a/ldrize_cooperation.js b/ldrize_cooperation.js index b091f41..a15cabe 100644 --- a/ldrize_cooperation.js +++ b/ldrize_cooperation.js @@ -1,6 +1,6 @@ // Vimperator plugin: 'Cooperation LDRize Mappings'
-// Version: 0.22
-// Last Change: 21-Nov-2008. Jan 2008
+// Version: 0.23
+// Last Change: 06-Dec-2008. Jan 2008
// License: Creative Commons
// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid
//
@@ -29,8 +29,6 @@ // Mappings:
// Mappings for LDRize
// default: 'j','k','p','o'
-// ',f'
-// Show hints that specified by LDRize's siteinfo
// Commands:
// 'm' or 'mb' or 'minibuffer':
// Execute args as Minibuffer Command
@@ -44,6 +42,11 @@ // 'ldrc' or 'toggleldrizecooperation':
// Toggle LDRize Cooperation
// usage: :toggleldrizecooperation
+// Hints:
+// ';l':
+// narrow down the candidates to LDRize paragraphes
+// ',L':
+// narrow down the candidates to LDRize paragraphes (in a new tab)
// Options:
// 'ldrc'
// Enable LDRize Cooperation
@@ -206,55 +209,20 @@ initLDRizeCooperationFuture: function(){
var self = this;
- var originalHinttags = liberator.modules.options.hinttags;
- var originalExtendedHinttags = liberator.modules.options.hinttags;
+ //Hints
+ [
+ ["l","LDRize paragraphes",liberator.CURRENT_TAB],
+ ["L","LDRize paragraphes (in a new tab", liberator.NEW_TAB]
+ ].forEach(function([mode,prompt,target]){
+ liberator.modules.hints.addMode(mode,prompt,
+ function (elem) liberator.modules.buffer.followLink(elem, target),
+ function () {
+ var siteinfo = self.LDRize.getSiteinfo();
+ return siteinfo.paragraph + "/" + siteinfo.link;
+ });
- function setHinttags(enable){
- if(enable){
- let siteinfo = self.LDRize.getSiteinfo();
- if(siteinfo.link && siteinfo.paragraph){
- liberator.modules.options.hinttags = siteinfo.paragraph + "/" + siteinfo.link;
- liberator.modules.options.extendedhinttags = siteinfo.paragraph + "/" + siteinfo.link;
- }else{
- liberator.modules.options.hinttags = originalHinttags;
- liberator.modules.options.extendedhinttags = originalExtendedHinttags;
- }
- }else{
- liberator.modules.options.hinttags = originalHinttags;
- liberator.modules.options.extendedhinttags = originalExtendedHinttags;
- }
- }
-
-
- //Mappings
- liberator.modules.mappings.add([liberator.modules.modes.NORMAL], [",f"],
- "Start QuickHint mode with LDRize",
- function(){
- setHinttags(true);
- liberator.modules.hints.show("o");
- setHinttags(self.isEnableLDRizeCooperation() && self.isModHints);
- },{});
-
- replaceMap(liberator.modules.modes.NORMAL, "f",
- "Start QuickHint mode",
- function(f){
- setHinttags(self.isEnableLDRizeCooperation() && self.isModHints);
- f();
- });
-
- replaceMap(liberator.modules.modes.NORMAL, "F",
- "Start QuickHint mode, but open link in a new tab",
- function(f){
- setHinttags(self.isEnableLDRizeCooperation() && self.isModHints);
- f();
- });
+ });
- replaceMap(liberator.modules.modes.NORMAL, ";",
- "Start an extended hint mode",
- function(f){
- setHinttags(self.isEnableLDRizeCooperation() && self.isModHints);
- f();
- });
//Commands
liberator.modules.commands.addUserCommand(["pin"], "LDRize Pinned Links",
function(){
|