diff options
| author | Stephen Blott | 2015-06-06 20:19:33 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-06-06 20:19:33 +0100 |
| commit | 616261ef8364cbd99765d651dfe8acd5ff55b453 (patch) | |
| tree | c7b75f7aa9a960132ba484935a4c1ed1cfb63a29 /pages | |
| parent | c20e5d44455be8ac885f0d7c42e05ec9857bd203 (diff) | |
| parent | cb900a255113b8304d8931f7c6294e20f7f9f36d (diff) | |
| download | vimium-616261ef8364cbd99765d651dfe8acd5ff55b453.tar.bz2 | |
Merge branch 'rework-completions'
Conflicts:
background_scripts/completion.coffee
background_scripts/completion_engines.coffee
Diffstat (limited to 'pages')
| -rw-r--r-- | pages/completion_engines.coffee | 35 | ||||
| -rw-r--r-- | pages/completion_engines.css | 15 | ||||
| -rw-r--r-- | pages/completion_engines.html | 32 | ||||
| -rw-r--r-- | pages/options.css | 2 | ||||
| -rw-r--r-- | pages/options.html | 5 |
5 files changed, 86 insertions, 3 deletions
diff --git a/pages/completion_engines.coffee b/pages/completion_engines.coffee new file mode 100644 index 00000000..790f2968 --- /dev/null +++ b/pages/completion_engines.coffee @@ -0,0 +1,35 @@ + +cleanUpRegexp = (re) -> + re.toString() + .replace /^\//, '' + .replace /\/$/, '' + .replace /\\\//g, "/" + +DomUtils.documentReady -> + html = [] + for engine in CompletionEngines[0...CompletionEngines.length-1] + engine = new engine + html.push "<h4>#{engine.constructor.name}</h4>\n" + html.push "<div class=\"engine\">" + if engine.example.explanation + html.push "<p>#{engine.example.explanation}</p>" + if engine.regexps + html.push "<p>" + html.push "Regular expression#{if 1 < engine.regexps.length then 's' else ''}:" + html.push "<pre>" + html.push "#{cleanUpRegexp re}\n" for re in engine.regexps + html.push "</pre>" + html.push "</p>" + if engine.example.searchUrl and engine.example.keyword + engine.example.description ||= engine.constructor.name + html.push "<p>" + html.push "Example:" + html.push "<pre>" + html.push "#{engine.example.keyword}: #{engine.example.searchUrl} #{engine.example.description}" + html.push "</pre>" + html.push "</p>" + html.push "</div>" + + document.getElementById("engineList").innerHTML = html.join "" + + diff --git a/pages/completion_engines.css b/pages/completion_engines.css new file mode 100644 index 00000000..3e3aab1f --- /dev/null +++ b/pages/completion_engines.css @@ -0,0 +1,15 @@ + +div#wrapper +{ + width: 730px; +} + +h4, h5 +{ + color: #777; +} + +div.engine +{ + margin-left: 20px; +} diff --git a/pages/completion_engines.html b/pages/completion_engines.html new file mode 100644 index 00000000..69158c78 --- /dev/null +++ b/pages/completion_engines.html @@ -0,0 +1,32 @@ +<html> + <head> + <title>Vimium Search Completion</title> + <!-- We re-use some styling from the options page, so that the look and feel here is similar --> + <link rel="stylesheet" type="text/css" href="options.css"> + <link rel="stylesheet" type="text/css" href="completion_engines.css"> + <script src="content_script_loader.js"></script> + <script type="text/javascript" src="../lib/settings.js"></script> + <script src="../background_scripts/completion_engines.js"></script> + <script src="completion_engines.js"></script> + </head> + + <body> + <div id="wrapper"> + <header>Vimium Search Completion</header> + <p> + Search completion is available for custom search engines whose search URL matches one of Vimium's + built-in completion engines; that is, the search URL matches one of the regular expressions below. + Search completion is not available for the default search engine. + </p> + <p> + Custom search engines can be configured on the <a href="options.html" target="_blank">options</a> + page. <br/> + Further information is available on the <a href="https://github.com/philc/vimium/wiki/Search-Completion">wiki</a>. + </p> + <header>Available Completion Engines</header> + <p> + <dl id="engineList"></dl> + </p> + </div> + </body> +</html> diff --git a/pages/options.css b/pages/options.css index 745b655c..75bbe159 100644 --- a/pages/options.css +++ b/pages/options.css @@ -114,7 +114,7 @@ input#scrollStepSize { } textarea#userDefinedLinkHintCss, textarea#keyMappings, textarea#searchEngines { width: 100%;; - min-height: 130px; + min-height: 140px; white-space: nowrap; } input#previousPatterns, input#nextPatterns { diff --git a/pages/options.html b/pages/options.html index 441bd9da..12a3ad21 100644 --- a/pages/options.html +++ b/pages/options.html @@ -43,7 +43,7 @@ unmap j unmapAll " this is a comment # this is also a comment</pre> - <a href="#" id="showCommands">Show available commands.</a> + <a href="#" id="showCommands">Show available commands</a>. </div> </div> <textarea id="keyMappings" type="text"></textarea> @@ -60,7 +60,8 @@ a: http://a.com/?q=%s b: http://b.com/?q=%s description " this is a comment # this is also a comment</pre> - %s is replaced with the search terms. + %s is replaced with the search terms. <br/> + For search completion, see <a href="completion_engines.html" target="_blank">here</a>. </div> </div> <textarea id="searchEngines"></textarea> |
