From 9bb1feb3ce45af50f518c6de1e90aa3072650c3b Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 28 Oct 2009 17:00:07 -0400 Subject: [PATCH 01/10] Fix broken donate button. --- common/content/help.xsl | 2 +- common/content/tabs.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/content/help.xsl b/common/content/help.xsl index fbab61fc..41f53329 100644 --- a/common/content/help.xsl +++ b/common/content/help.xsl @@ -164,7 +164,7 @@
- +
diff --git a/common/content/tabs.js b/common/content/tabs.js index 34b15d98..4e54cd23 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -671,7 +671,7 @@ function Tabs() //{{{ context.anchored = false; context.compare = CompletionContext.Sort.unsorted; context.filters = [CompletionContext.Filter.textDescription]; - context.keys = { text: function ([i, item]) (i + 1) + ": " + item.state.entries[item.state.index - 1].url, description: "[1].title", icon: "[1].image" }; + context.keys = { text: function ([i, { state: s }]) (i + 1) + ": " + s.entries[s.index - 1].url, description: "[1].title", icon: "[1].image" }; context.completions = Iterator(tabs.closedTabs); }, count: true, From f6a3d42ab5f55ab360c7f34e04d18027a18e6292 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 28 Oct 2009 17:02:41 -0400 Subject: [PATCH 02/10] Update help status line parser. --- common/content/ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/content/ui.js b/common/content/ui.js index 70363bd8..6bdaecd6 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -2174,8 +2174,8 @@ function StatusLine() //{{{ } else { - url = url.replace(RegExp("^chrome://liberator/locale/(\\S+\\.html)#(.*)"), function (m, n1, n2) n1 + " " + decodeURIComponent(n2) + " [Help]"); - url = url.replace(RegExp("^chrome://liberator/locale/(\\S+\\.html)"), "$1 [Help]"); + url = url.replace(RegExp("^liberator://help/(\\S+)#(.*)"), function (m, n1, n2) n1 + " " + decodeURIComponent(n2) + " [Help]") + .replace(RegExp("^liberator://help/(\\S+)"), "$1 [Help]"); } // when session information is available, add [+] when we can go From 1350701eecfe6845e1041169cb04fe83869a3fe5 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 28 Oct 2009 17:38:06 -0400 Subject: [PATCH 03/10] Update util.generateHelp. --- common/content/util.js | 74 +++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 44 deletions(-) diff --git a/common/content/util.js b/common/content/util.js index 38152b1a..07530b7c 100644 --- a/common/content/util.js +++ b/common/content/util.js @@ -276,60 +276,46 @@ const util = { //{{{ /** * Generates an Asciidoc help entry. * - * @param {Command|Mapping|Option} obj A liberator Command, - * Mapping or Option object - * @param {string} extraHelp Extra help text beyond the description. + * @param {Command|Map|Option} obj A liberator Command, + * Map or Option object + * @param {XMLList} extraHelp Extra help text beyond the description. * @returns {string} */ generateHelp: function generateHelp(obj, extraHelp) { - let start = "", end = ""; + let spec = util.identity; + let tag = util.identity; if (obj instanceof Command) - start = ":"; + tag = spec = function (cmd) <>:{cmd}; + else if (obj instanceof Map && obj.count) + spec = function (map) <>count{map}; else if (obj instanceof Option) - start = end = "'"; - - let ret = ""; - let longHelp = false; - if ((obj.help && obj.description) && (obj.help.length + obj.description.length) > 50) - longHelp = true; - - // the tags which are printed on the top right - for (let j = obj.names.length - 1; j >= 0; j--) - ret += "|" + start + obj.names[j] + end + "| "; - - if (longHelp) - ret += "+"; - - ret += "\n"; - - // the usage information - let usage = obj.names[0]; - if (obj.specs) // for :commands - usage = obj.specs[0]; - - usage = usage.replace(/{/, "\\\\{").replace(/}/, "\\\\}"); - usage = usage.replace(/'/, "\\'").replace(/`/, "\\`"); - ret += "||" + start + usage + end + "||"; - if (usage.length > 15) - ret += " +"; - - ret += "\n________________________________________________________________________________\n"; - - // the actual help text - if (obj.description) { - ret += obj.description + "."; // the help description - if (extraHelp) - ret += " +\n" + extraHelp; + spec = function (opt) {opt}; + tag = function (opt) <>'{opt}'; } - else - ret += "Sorry, no help available"; - // add more space between entries - ret += "\n________________________________________________________________________________\n\n\n"; + // E4X has its warts. + let br = <> + ; - return ret; + default xml namespace = ""; + XML.prettyPrinting = false; + XML.ignoreWhitespace = false; + + return <> + + + {template.map(obj.names, tag, " ")} + {spec((obj.specs || obj.names)[0])}{ + !obj.type ? "" : <> + {obj.type} + {obj.defaultValue}} + { + obj.description ? br+

{obj.description.replace(/\.?$/, ".")}

: "" }{ + extraHelp ? br+extraHelp : "" }{ + !(extraHelp || obj.description) ? br+

Sorry, no help available.

: "" } +
+
.toXMLString(); }, /** From 9bb01ce7ef2a503ab6b8641498c71ae83b297183 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 29 Oct 2009 20:30:24 -0400 Subject: [PATCH 04/10] Change Storage#newObject signature. --- common/content/bookmarks.js | 2 +- common/content/browser.js | 2 +- common/content/style.js | 4 ++-- common/content/ui.js | 2 +- common/modules/storage.jsm | 14 +++++++------- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index 8b5f7574..3b8b7e94 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -249,7 +249,7 @@ function Bookmarks() //{{{ statusline.updateUrl(); }; - var cache = storage.newObject("bookmark-cache", Cache, false); + var cache = storage.newObject("bookmark-cache", Cache, { store: false }); storage.addObserver("bookmark-cache", bookmarkObserver, window); /////////////////////////////////////////////////////////////////////////////}}} diff --git a/common/content/browser.js b/common/content/browser.js index bb64c16b..445606b4 100644 --- a/common/content/browser.js +++ b/common/content/browser.js @@ -99,7 +99,7 @@ function Browser() //{{{ } } }).init(); - }, false); + }, { store: false }); storage.addObserver("private-mode", function (key, event, value) { autocommands.trigger("PrivateMode", { state: value }); diff --git a/common/content/style.js b/common/content/style.js index 60eb410b..0fc4779b 100644 --- a/common/content/style.js +++ b/common/content/style.js @@ -581,12 +581,12 @@ let (array = util.Array) /** * @property {Styles} */ -const styles = storage.newObject("styles", Styles, false); +const styles = storage.newObject("styles", Styles, { store: false }); /** * @property {Highlights} */ -const highlight = storage.newObject("highlight", Highlights, false); +const highlight = storage.newObject("highlight", Highlights, { store: false }); if (highlight.CSS != Highlights.prototype.CSS) { diff --git a/common/content/ui.js b/common/content/ui.js index 6bdaecd6..cb43c4b2 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -56,7 +56,7 @@ function CommandLine() //{{{ } } }).init(); - }, false); + }, { store: false }); storage.addObserver("sanitize", function (key, event, value) { autocommands.trigger("Sanitize", {}); diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm index 47fad206..e26efa2e 100644 --- a/common/modules/storage.jsm +++ b/common/modules/storage.jsm @@ -306,14 +306,14 @@ var timers = {}; var storage = { alwaysReload: {}, - newObject: function newObject(key, constructor, store, type, options, reload) + newObject: function newObject(key, constructor, params) { - if (!(key in keys) || reload || this.alwaysReload[key]) + if (!(key in keys) || params.reload || this.alwaysReload[key]) { - if (key in this && !(reload || this.alwaysReload[key])) + if (key in this && !(params.reload || this.alwaysReload[key])) throw Error(); - let load = function () loadPref(key, store, type || Object); - keys[key] = new constructor(key, store, load, options || {}); + let load = function () loadPref(key, params.store, params.type || Object); + keys[key] = new constructor(key, params.store, load, params); timers[key] = new Timer(1000, 10000, function () storage.save(key)); this.__defineGetter__(key, function () keys[key]); } @@ -322,12 +322,12 @@ var storage = { newMap: function newMap(key, store, options) { - return this.newObject(key, ObjectStore, store, null, options); + return this.newObject(key, ObjectStore, store, options); }, newArray: function newArray(key, store, options) { - return this.newObject(key, ArrayStore, store, Array, options); + return this.newObject(key, ArrayStore, store, { type: Array, __proto__: options }); }, addObserver: function addObserver(key, callback, ref) From 2ffbe6005e3701ab473df1b6615ce9e8e3bd429c Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 29 Oct 2009 22:28:21 -0400 Subject: [PATCH 05/10] Fixes issue #119. Update issue #119 This should be fixed, but I'm fairly convinced that it shouldn't occur in the first place, and a new problem may well occur in its place. Which version of Firefox are you using, and which other extensions? --- common/content/ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/content/ui.js b/common/content/ui.js index cb43c4b2..caa46a88 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -2184,9 +2184,9 @@ function StatusLine() //{{{ if (window.getWebNavigation) { let sh = window.getWebNavigation().sessionHistory; - if (sh.index > 0) + if (sh && sh.index > 0) modified += "+"; - if (sh.index < sh.count -1) + if (sh && sh.index < sh.count -1) modified += "-"; } if (liberator.has("bookmarks")) From 7449d40f73157f2c3e861311c9b5a1ad99d8b4f5 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 30 Oct 2009 02:04:15 -0400 Subject: [PATCH 06/10] Add TOC to help pages. --- common/content/help.xsl | 46 ++++++++++++++++++++++++++++++++++++++++- common/content/style.js | 13 +++++++----- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/common/content/help.xsl b/common/content/help.xsl index 41f53329..270d1674 100644 --- a/common/content/help.xsl +++ b/common/content/help.xsl @@ -32,6 +32,47 @@ + + + + + +

Contents

+ + + +
+
+ + + + + + + + + + + + +
  • + + + + + + + + + + +
  • +
    +
    +
    +
    + @@ -145,8 +186,11 @@ + + + - + diff --git a/common/content/style.js b/common/content/style.js index 0fc4779b..d006ce02 100644 --- a/common/content/style.js +++ b/common/content/style.js @@ -154,9 +154,9 @@ Highlights.prototype.CSS = html|a text-decoration: none; HelpLink:hover text-decoration: underline; - HelpList,liberator|ul display: block; list-style: outside disc; - HelpOrderedList,liberator|*>html:ol display: block; list-style: outside decimal; - HelpListItem,liberator|li display: list-item; margin-left: 1.5em; + HelpList display: block; list-style: outside disc; + HelpOrderedList display: block; list-style: outside decimal; + HelpListItem,liberator|li display: list-item; HelpNote,liberator|note display: block; margin: 1em 0em; HelpNote::before content: "Note: "; color: red; font-weight: bold; @@ -175,6 +175,9 @@ Highlights.prototype.CSS = ol ol margin-left: -1em; + HelpTab,liberator|dl display: table; width: 100%; margin: 1em 0; border-bottom-width: 1px; border-top-width: 1px; padding: .5ex 0; table-layout: fixed; HelpTabColumn,liberator|column display: table-column; HelpTabColumn:first-child width: 25%; @@ -304,7 +307,7 @@ function Highlights(name, store) .split("\n").filter(function (s) /\S/.test(s)) .forEach(function (style) { - style = Highlight.apply(Highlight, Array.slice(style.match(/^\s*([^,\s]+)(?:,([^,\s]+)?)?(?:,([^,\s]+))?\s*(.*)$/), 1)); + style = Highlight.apply(Highlight, Array.slice(style.match(/^\s*((?:[^,\s]|\s\S)+)(?:,((?:[^,\s]|\s\S)+)?)?(?:,((?:[^,\s]|\s\S)+))?\s*(.*)$/), 1)); if (/^[>+ ]/.test(style.selector)) style.selector = self.selector(style.class) + style.selector; @@ -785,7 +788,7 @@ liberator.registerObserver("load_commands", function () { args.completeArg = args.completeArg > 1 ? -1 : 0; if (args.completeArg == 0) - context.completions = [[v.class, ""] for (v in highlight)]; + context.completions = [[v.class, v.value] for (v in highlight)]; else if (args.completeArg == 1) { let hl = highlight.get(args[0]); From 43b9d560fab74a70de833041c2b77899b28a80f6 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 30 Oct 2009 07:53:37 -0400 Subject: [PATCH 07/10] Add fold markers (that I don't use) to style.xsl; minor cleanup. --- common/content/help.xsl | 152 +++++++++++++++++++++++----------------- 1 file changed, 88 insertions(+), 64 deletions(-) diff --git a/common/content/help.xsl b/common/content/help.xsl index 270d1674..989ab016 100644 --- a/common/content/help.xsl +++ b/common/content/help.xsl @@ -1,15 +1,28 @@ + + + + + + + + + + + + @@ -28,30 +41,17 @@ - - - + - - - - - -

    Contents

    - - - -
    -
    - + + local-name() = $tag and preceding-sibling::*[local-name() = $lasttag][position() = 1 and . = $context]]"/> @@ -72,39 +72,20 @@ - - + - - - - - - - - + + +

    Contents

    + + + + +
    - - - - - - - - - - - - - - - - - - - + @@ -134,17 +115,13 @@ - - - Boolean - - - Number - - - String - - + + + Boolean + Number + String + + @@ -152,19 +129,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + - + # + @@ -186,6 +185,9 @@ + + + @@ -200,10 +202,25 @@
    + + + + + + + + + + + + + + +
    @@ -214,9 +231,14 @@
    - + + + + + + + + @@ -262,6 +284,8 @@ + + @@ -272,4 +296,4 @@ - + From a5ff8c93dea82376cb2c654b922f5d1302411445 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 30 Oct 2009 23:23:32 +1100 Subject: [PATCH 08/10] Clean up Vimperator's TODO list. --- vimperator/TODO | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/vimperator/TODO b/vimperator/TODO index e83cdd62..67188bc1 100644 --- a/vimperator/TODO +++ b/vimperator/TODO @@ -2,27 +2,18 @@ Priority list: 1-9 as in Vim (9 = required for next release, 5 = would be nice, 1 = probably not) ARCHITECTURE: -- modular help system - - I made a quick attempt at parameterizing it using attributes but it - breaks Asciidoc formatting in certain unpredictable (to me at least) - contexts. --djk - - move as much as possible to common/* -- decide on how to document Arrays in our jsdoc(ish) documentation. Is there - even a documentation tool that can parse our source sensibly? -- update build system to generate config specific components from templates in - common/components/* and copy others - - a739cdeab8f1648fd771f17d8a4885533032376f attempt at linking didn't work. +- decide on how to document Arrays in our jsdoc(ish) documentation. Host docs + on the website - is there even a documentation tool that can parse our source + sensibly? BUGS: - add window resize support to hints - searching backwards incrementally does not work i.e. with 'incsearch' set -- Motion keys (j/k/h/l/^F/^B/...) don't scroll scrollable block elements. - - insert abbreviations broken on - :sidebar improvements (:sidebar! Downloads while downloads is open should refocus the sidebar) - ;s saves the page rather than the image - RC file is sourced once per window -- :undo seems to be effected by whether the tabstrip state +- :undo seems to be effected by the tabstrip state (recent CVS regressions): - visual caret mode is broken, requires a manual page focus first anyway or @@ -78,7 +69,7 @@ FEATURES: Total time: 0.25 sec --Kris -8 allow for multiple ex commands separated with | (see #107) +8 allow for multiple ex commands separated with | (see #24) 8 / should work as in vim (i.e., save page positions as well as locations in the history list). 7 use ctrl-n/p in insert mode for word completion @@ -92,13 +83,12 @@ FEATURES: 7 The output of the pageinfo-command should contain the security-information of ssl-encrypted sites 7 Add :every command 6 :mksession -6 support private mode (and :set [no]private): http://ehsanakhgari.org/blog/2008-11-08/prepare-your-add-private-browsing 6 add [count] support to :b* and :tab* commands where missing 6 registers Here, unlike Vim, y and "*y would be equivalent. That is, the pasteboard would always be the default register. --Ted 6 check/correct spellings in insert mode with some mappings -6 add more autocommands (TabClose, TabOpen, TabChanged any more?) +6 add more autocommands (TabClose, TabOpen, TabChanged etc) 6 jump to the next heading with ]h, next image ]i, previous textbox [t and so on 6 :grep support (needs location list) 6 pipe selected text/link/website to an external command From 161001c216cf25136527007d4447554b8801cea2 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 30 Oct 2009 20:48:45 -0400 Subject: [PATCH 09/10] Add Google Code upload target to common Makefile. --HG-- extra : rebase_source : 91c07685dbb35a9cc2740d56c43a0b1d5c6a6f77 --- common/Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/common/Makefile b/common/Makefile index e3d9e534..19c27d84 100644 --- a/common/Makefile +++ b/common/Makefile @@ -4,6 +4,7 @@ TOP = $(shell pwd) OS = $(shell uname -s) BUILD_DATE = $(shell date "+%Y/%m/%d %H:%M:%S") BASE = $(TOP)/../common +GOOGLE_PROJ = vimperator-labs LOCALEDIR = locale DOC_FILES = $(wildcard $(LOCALEDIR)/*/*.xml) @@ -56,6 +57,7 @@ help: @echo " make jar - build a JAR ($(JAR))" @echo " make xpi - build an XPI ($(XPI_NAME))" @echo " make release - updates update.rdf (this is not for you)" + @echo " make release - uploads to Google Code (this is not for you)" @echo " make clean - clean up" @echo " make distclean - clean up more" @echo @@ -72,6 +74,19 @@ jar: $(JAR) release: $(XPI) $(RDF) +# This is not for you! +dist: $(XPI) + [ -n "$(featured)" ] && labels="$$labels,Featured"; \ + proj=$$(echo -n $(NAME) | sed 's/\(.\).*/\1/' | tr a-z A-Z); \ + proj="$$proj$$(echo $(NAME) | sed 's/.//')"; \ + [ -z "$$description" ] && description="$$proj $(VERSION) Release"; \ + \ + labels=$$(echo -n "$$labels,Project-$$proj" | sed 's/^,*//g'); \ + \ + googlecode_upload -s "$$description" -l "$$labels" \ + -p "$(GOOGLE_PROJ)" -u "$(GOOGLE_USER)" -w "$(GOOGLE_PASS)" \ + -- "$(XPI)" + $(RDF): $(RDF_IN) Makefile @echo "Preparing release..." $(SED) -e "s,###VERSION###,$(VERSION),g" \ From a9034d8559535b01a25cbabfd7148817364d569a Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 31 Oct 2009 13:20:01 -0400 Subject: [PATCH 10/10] Fix broken highlight groups. --HG-- extra : rebase_source : 64e041fcdc00122ae86be1e2d97d84f101a62eae --- common/content/style.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/common/content/style.js b/common/content/style.js index d006ce02..1c09ab2c 100644 --- a/common/content/style.js +++ b/common/content/style.js @@ -9,7 +9,7 @@ * @constant * @property {string} The default highlighting rules. They have the * form: - * rule ::= selector space css + * rule ::= selector space space+ css * selector ::= group * | group "," css-selector * | group "," css-selector "," scope @@ -44,21 +44,21 @@ Highlights.prototype.CSS = * padding: 0 .5ex; - CompMsg font-style: italic; margin-left: 16px; + CompGroup:not(:first-of-type) margin-top: .5em; + CompTitle color: magenta; background: white; font-weight: bold; + CompTitle>* padding: 0 .5ex; + CompMsg font-style: italic; margin-left: 16px; CompItem - CompItem[selected] background: yellow; - CompItem>* padding: 0 .5ex; - CompIcon width: 16px; min-width: 16px; display: inline-block; margin-right: .5ex; - CompIcon>img max-width: 16px; max-height: 16px; vertical-align: middle; - CompResult width: 45%; overflow: hidden; - CompDesc color: gray; width: 50%; - CompLess text-align: center; height: 0; line-height: .5ex; padding-top: 1ex; - CompLess::after content: "\2303" /* Unicode up arrowhead */ - CompMore text-align: center; height: .5ex; line-height: .5ex; margin-bottom: -.5ex; - CompMore::after content: "\2304" /* Unicode down arrowhead */ + CompItem[selected] background: yellow; + CompItem>* padding: 0 .5ex; + CompIcon width: 16px; min-width: 16px; display: inline-block; margin-right: .5ex; + CompIcon>img max-width: 16px; max-height: 16px; vertical-align: middle; + CompResult width: 45%; overflow: hidden; + CompDesc color: gray; width: 50%; + CompLess text-align: center; height: 0; line-height: .5ex; padding-top: 1ex; + CompLess::after content: "\2303" /* Unicode up arrowhead */ + CompMore text-align: center; height: .5ex; line-height: .5ex; margin-bottom: -.5ex; + CompMore::after content: "\2304" /* Unicode down arrowhead */ Gradient height: 1px; margin-bottom: -1px; margin-top: -1px; GradientLeft background-color: magenta; @@ -73,10 +73,10 @@ Highlights.prototype.CSS =