From 2fea92e31db28cb9fc1d0f3c336c7556ac5dc473 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 17 Dec 2008 11:30:56 -0500 Subject: [PATCH 001/143] Add :ha >file.ps --- common/content/buffer.js | 33 +++++++++++++++++-------- common/content/commands.js | 44 ++++++++++++++++++--------------- common/content/io.js | 3 +-- common/content/options.js | 37 +++++++++++++++++++++++++-- vimperator/content/bookmarks.js | 1 + 5 files changed, 84 insertions(+), 34 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index e6a15cd7..4a95beb5 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -483,21 +483,34 @@ function Buffer() //{{{ "Print current document", function (args) { - let aps = options.getPref("print.always_print_silent"); - let spp = options.getPref("print.show_print_progress"); + options.temporaryContext(function () { + if (args[0]) + { + if (args[0][0] != ">") + return liberator.echoerr("E488: Trailing characters"); + options.setPref("print.print_to_file", "true"); + options.setPref("print.print_to_filename", io.getFile(args[0].substr(1)).path); + liberator.echomsg("Printing to file: " + args[0].substr(1)); + } + else + { + liberator.echomsg("Sending to printer..."); + } - liberator.echomsg("Sending to printer..."); - options.setPref("print.always_print_silent", args.bang); - options.setPref("print.show_print_progress", !args.bang); + options.setPref("print.always_print_silent", args.bang); + options.setPref("print.show_print_progress", !args.bang); - getBrowser().contentWindow.print(); + getBrowser().contentWindow.print(); + }); - options.setPref("print.always_print_silent", aps); - options.setPref("print.show_print_progress", spp); - liberator.echomsg("Print job sent."); + if (args[0]) + liberator.echomsg("Printed: " + args[0].substr(1)); + else + liberator.echomsg("Print job sent."); }, { - argCount: "0", + argCount: "?", + literal: 0, bang: true }); diff --git a/common/content/commands.js b/common/content/commands.js index c5d7c3ae..67540eb9 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -758,9 +758,30 @@ function Commands() //{{{ if (completeOpt) { if (/^custom,/.test(completeOpt)) - completeFunc = completeOpt.substr(7); + { + completeFunc = function () + { + try + { + var completer = liberator.eval(completeOpt.substr(7)); + + if (!(completer instanceof Function)) + throw new TypeError("User-defined custom completer '" + completeOpt.substr(7) + "' is not a function"); + } + catch (e) + { + // FIXME: should be pushed to the MOW + liberator.echoerr("E117: Unknown function: " + completeOpt.substr(7)); + liberator.log(e); + return undefined; + } + return completer.apply(this, Array.slice(arguments)); + } + } else - completeFunc = "completion." + completeOptionMap[completeOpt]; + { + completeFunc = function () completion[completeOptionMap[completeOpt]].apply(this, Array.slice(arguments)); + } } if (!commands.addUserCommand( @@ -773,24 +794,7 @@ function Commands() //{{{ count: countOpt, completer: function (context, args) { if (completeFunc) - { - try - { - var completer = liberator.eval(completeFunc); - - if (!(completer instanceof Function)) - throw new TypeError("User-defined custom completer '" + completeFunc + "' is not a function"); - } - catch (e) - { - // FIXME: should be pushed to the MOW - liberator.echoerr("E117: Unknown function: " + completeFunc); - liberator.log(e); - return; - } - - completer.call(completion, context, args) - } + return completeFunc(context, args) }, replacementText: args.literalArg }, diff --git a/common/content/io.js b/common/content/io.js index d6bf284a..52fd0ed7 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -99,8 +99,7 @@ function IO() //{{{ return []; else // empty list item means the current directory - return list.replace(/,$/, "") - .split(",") + return list.replace(/,$/, "").split(",") .map(function (dir) dir == "" ? io.getCurrentDirectory().path : dir); } diff --git a/common/content/options.js b/common/content/options.js index 34828e18..54cc90a2 100644 --- a/common/content/options.js +++ b/common/content/options.js @@ -302,7 +302,9 @@ function Options() //{{{ const SAVED = "liberator.saved."; const prefService = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); - var optionHash = {}; + const optionHash = {}; + + const prefContexts = []; function optionObserver(key, event, option) { @@ -320,6 +322,13 @@ function Options() //{{{ function storePreference(name, value) { + if (prefContexts.length) + { + let val = loadPreference(name, null); + if (val != null) + prefContexts[prefContexts.length - 1][name] = val; + } + var type = prefService.getPrefType(name); switch (typeof value) { @@ -988,7 +997,31 @@ function Options() //{{{ this.setPref(name, !this.getPref(name)); else liberator.echoerr("E488: Trailing characters: " + name + "!"); - } + }, + + pushContext: function () + { + prefContexts.push({}); + }, + + popContext: function () + { + for (let [k, v] in Iterator(prefContexts.pop())) + storePreference(k, v); + }, + + temporaryContext: function (fn, self) + { + try + { + this.pushContext(); + return fn.call(self); + } + finally + { + this.popContext(); + } + }, }; //}}} }; //}}} diff --git a/vimperator/content/bookmarks.js b/vimperator/content/bookmarks.js index fbcd419f..53c37601 100644 --- a/vimperator/content/bookmarks.js +++ b/vimperator/content/bookmarks.js @@ -701,6 +701,7 @@ function History() //{{{ context.completions = [sh.getEntryAtIndex(i, false) for (i in util.range(sh.index, 0, true))]; context.keys = { text: function (item) item.URI.spec, description: "title" }; + liberator.dump(context.items); }, count: true, literal: 0 From b7e6103d56972ccec4305395ba3d707f0618f58a Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 17 Dec 2008 22:36:56 -0500 Subject: [PATCH 002/143] Add :silent command --- common/content/ui.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/content/ui.js b/common/content/ui.js index 89e5009a..dc2c314b 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -841,6 +841,17 @@ function CommandLine() //{{{ }, { argCount: "0" }); + commands.add(["sil[ent]"], + "Run a command silently", + function (args) + { + commandline.runSilently(function () liberator.execute(args[0])); + }, + { + completer: function (context) completion.ex(context), + literal: 0 + }); + /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ From cdcfb68e3b02af206c2bf971292abe2cab853433 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 17 Dec 2008 23:16:20 -0500 Subject: [PATCH 003/143] Add '' --- common/content/buffer.js | 34 ++++++++++++++++++++++++---------- common/content/liberator.js | 2 +- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 4a95beb5..af08876c 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -115,6 +115,7 @@ function Buffer() //{{{ else v = win.scrollMaxY / 100 * vertical; + marks.add("'", true); win.scrollTo(h, v); } @@ -1156,6 +1157,17 @@ function Buffer() //{{{ scrollToPercentiles(-1, percentage); }, + scrollToRatio: function (x, y) + { + scrollToPercentiles(x * 100, y * 100); + }, + + scrollTo: function (x, y) + { + marks.add("'", true); + content.scrollTo(x, y); + }, + scrollStart: function () { scrollToPercentiles(0, -1); @@ -1340,12 +1352,11 @@ function Marks() //{{{ function onPageLoad(event) { let win = event.originalTarget.defaultView; - for (let i = 0, length = pendingJumps.length; i < length; i++) + for (let [i, mark] in Iterator(pendingJumps)) { - let mark = pendingJumps[i]; if (win && win.location.href == mark.location) { - win.scrollTo(mark.position.x * win.scrollMaxX, mark.position.y * win.scrollMaxY); + buffer.scrollToRatio(mark.position.x, mark.position.y); pendingJumps.splice(i, 1); return; } @@ -1390,7 +1401,7 @@ function Marks() //{{{ } } - function isLocalMark(mark) /^[a-z]$/.test(mark); + function isLocalMark(mark) /^['"a-z]$/.test(mark); function isURLMark(mark) /^[A-Z0-9]$/.test(mark); function localMarkIter() @@ -1537,13 +1548,14 @@ function Marks() //{{{ return { // TODO: add support for frameset pages - add: function (mark) + add: function (mark, silent) { let win = window.content; if (win.document.body.localName.toLowerCase() == "frameset") { - liberator.echoerr("Marks support for frameset pages not implemented yet"); + if (!silent) + liberator.echoerr("Marks support for frameset pages not implemented yet"); return; } @@ -1554,7 +1566,8 @@ function Marks() //{{{ if (isURLMark(mark)) { urlMarks.set(mark, { location: win.location.href, position: position, tab: tabs.getTab() }); - liberator.log("Adding URL mark: " + markToString(mark, urlMarks.get(mark)), 5); + if (!silent) + liberator.log("Adding URL mark: " + markToString(mark, urlMarks.get(mark)), 5); } else if (isLocalMark(mark)) { @@ -1564,7 +1577,8 @@ function Marks() //{{{ localMarks.set(mark, []); let vals = { location: win.location.href, position: position }; localMarks.get(mark).push(vals); - liberator.log("Adding local mark: " + markToString(mark, vals), 5); + if (!silent) + liberator.log("Adding local mark: " + markToString(mark, vals), 5); } }, @@ -1621,7 +1635,7 @@ function Marks() //{{{ return; } liberator.log("Jumping to URL mark: " + markToString(mark, slice), 5); - win.scrollTo(slice.position.x * win.scrollMaxX, slice.position.y * win.scrollMaxY); + buffer.scrollToRatio(slice.position.x, slice.position.y); ok = true; } } @@ -1636,7 +1650,7 @@ function Marks() //{{{ if (win.location.href == lmark.location) { liberator.log("Jumping to local mark: " + markToString(mark, lmark), 5); - win.scrollTo(lmark.position.x * win.scrollMaxX, lmark.position.y * win.scrollMaxY); + buffer.scrollToRatio(lmark.position.x, lmark.position.y); ok = true; break; } diff --git a/common/content/liberator.js b/common/content/liberator.js index 6b009c12..bf7a14f2 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -952,7 +952,7 @@ const liberator = (function () //{{{ setTimeout(function () { let elem = buffer.evaluateXPath('//*[@class="tag" and text()="' + tag + '"]').snapshotItem(0); if (elem) - window.content.scrollTo(0, elem.getBoundingClientRect().top - 10); // 10px context + buffer.scrollTo(0, elem.getBoundingClientRect().top - 10); // 10px context else liberator.dump('no element: ' + '@class="tag" and text()="' + tag + '"\n' ); }, 500); From 26f362af57f9909edd85d75f0c31d08d9b5b2bcf Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 18 Dec 2008 00:16:49 -0500 Subject: [PATCH 004/143] Check asciidoc version on 'make doc' --- common/Makefile.common | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/Makefile.common b/common/Makefile.common index 110a1163..4cac38e4 100644 --- a/common/Makefile.common +++ b/common/Makefile.common @@ -63,7 +63,8 @@ info: @echo -e "jar files $(shell echo ${JAR_FILES} | sed 's/ /\\n /g' )" @echo "xpi files ${XPI_FILES}" -doc: ${DOC_FILES} +.PHONY: check-asciidoc +doc: check-asciidoc ${DOC_FILES} xpi: ${XPI} jar: ${JAR} @@ -104,6 +105,10 @@ $(JAR): doc #### doc +check-asciidoc: + @asciidoc --version | awk '{ exit $$2 !~ /^8\.2\./ }' || \ + echo >&2 "Warning: asciidoc versions other 8.2.x are unsupported" + ${DOC_FILES}: %.html: %.txt $(BASE)/Makefile.common locale/en-US/asciidoc.conf @echo "DOC $@" ${ASCIIDOC} --unsafe -a linkcss -a quirks! -a doctitle="$(shell basename $@)" -o $@ $< From e082160a21f7e447ef717d3ef61829301e01a8fe Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 18 Dec 2008 13:59:59 -0500 Subject: [PATCH 005/143] Don't anchor help completions. --- common/content/completion.js | 1 + 1 file changed, 1 insertion(+) diff --git a/common/content/completion.js b/common/content/completion.js index f008e7ff..bf4a9622 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1374,6 +1374,7 @@ function Completion() //{{{ help: function help(context) { context.title = ["Help"]; + context.anchored = false; context.generate = function () { let res = config.helpFiles.map(function (file) { From b18b1634fcda9c24a3466464ec462b756cb05134 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 18 Dec 2008 21:27:33 -0500 Subject: [PATCH 006/143] Kludge the stupid urlbar focus bug better --- common/content/events.js | 123 +++++++++++++++++++++------------------ common/content/modes.js | 10 +--- 2 files changed, 68 insertions(+), 65 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 3eadb398..401244ba 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -33,6 +33,7 @@ function AutoCommands() //{{{ /////////////////////////////////////////////////////////////////////////////{{{ var store = []; + var lastFocus = null; function matchAutoCmd(autoCmd, event, regex) { @@ -1086,65 +1087,77 @@ function Events() //{{{ if (win && win.top == content && liberator.has("tabs")) tabs.localStore.focusedFrame = win; - if (elem && elem.readOnly) - return; - - if (elem && ( - (elem instanceof HTMLInputElement && (elem.type.toLowerCase() == "text" || elem.type.toLowerCase() == "password")) || - (elem instanceof HTMLSelectElement) - )) + try { - this.wantsModeReset = false; - liberator.mode = modes.INSERT; - if (hasHTMLDocument(win)) - buffer.lastInputField = elem; - return; - } + if (elem && elem.readOnly) + return; - if (elem && elem instanceof HTMLTextAreaElement) - { - this.wantsModeReset = false; - if (options["insertmode"]) - modes.set(modes.INSERT, modes.TEXTAREA); - else if (elem.selectionEnd - elem.selectionStart > 0) - modes.set(modes.VISUAL, modes.TEXTAREA); - else - modes.main = modes.TEXTAREA; - if (hasHTMLDocument(win)) - buffer.lastInputField = elem; - return; - } - - if (config.name == "Muttator") - { - // we switch to -- MESSAGE -- mode for muttator, when the main HTML widget gets focus - if (hasHTMLDocument(win) || elem instanceof HTMLAnchorElement) + if ((elem instanceof HTMLInputElement && /^(text|password)$/.test(elem.type)) || + (elem instanceof HTMLSelectElement)) { - if (config.isComposeWindow) - { - liberator.dump("Compose editor got focus"); - modes.set(modes.INSERT, modes.TEXTAREA); - } - else if (liberator.mode != modes.MESSAGE) - liberator.mode = modes.MESSAGE; + this.wantsModeReset = false; + liberator.mode = modes.INSERT; + if (hasHTMLDocument(win)) + buffer.lastInputField = elem; return; } - } - if (liberator.mode == modes.INSERT || - liberator.mode == modes.TEXTAREA || - liberator.mode == modes.MESSAGE || - liberator.mode == modes.VISUAL) + if (elem instanceof HTMLTextAreaElement) + { + this.wantsModeReset = false; + if (options["insertmode"]) + modes.set(modes.INSERT, modes.TEXTAREA); + else if (elem.selectionEnd - elem.selectionStart > 0) + modes.set(modes.VISUAL, modes.TEXTAREA); + else + modes.main = modes.TEXTAREA; + if (hasHTMLDocument(win)) + buffer.lastInputField = elem; + return; + } + + if (config.name == "Muttator") + { + // we switch to -- MESSAGE -- mode for muttator, when the main HTML widget gets focus + if (hasHTMLDocument(win) || elem instanceof HTMLAnchorElement) + { + if (config.isComposeWindow) + { + liberator.dump("Compose editor got focus"); + modes.set(modes.INSERT, modes.TEXTAREA); + } + else if (liberator.mode != modes.MESSAGE) + liberator.mode = modes.MESSAGE; + return; + } + } + + urlbar = document.getElementById("urlbar"); + if (focus == null && urlbar && urlbar.inputField == lastFocus) + liberator.threadYield(true); + + if (liberator.mode & (modes.INSERT | modes.TEXTAREA | modes.MESSAGE | modes.VISUAL)) + { + if (0) // FIXME: currently this hack is disabled to make macros work + { + this.wantsModeReset = true; + setTimeout(function () { + if (events.wantsModeReset) + { + events.wantsModeReset = false; + modes.reset(); + } + }, 0); + } + else + { + modes.reset(); + } + } + } + finally { - // FIXME: currently this hack is disabled to make macros work - // this.wantsModeReset = true; - // setTimeout(function () { - // if (events.wantsModeReset) - // { - // events.wantsModeReset = false; - modes.reset(); - // } - // }, 0); + lastFocus = elem; } }, @@ -1198,7 +1211,6 @@ function Events() //{{{ catch (e) {} modes.reset(); - liberator.focusContent(true); break; case modes.VISUAL: @@ -1216,14 +1228,9 @@ function Events() //{{{ case modes.INSERT: if ((modes.extended & modes.TEXTAREA) && !options["insertmode"]) - { liberator.mode = modes.TEXTAREA; - } else - { modes.reset(); - liberator.focusContent(true); - } break; default: // HINTS, CUSTOM or COMMAND_LINE diff --git a/common/content/modes.js b/common/content/modes.js index de88c3be..b016048b 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -116,13 +116,7 @@ const modes = (function () //{{{ options.setPref("accessibility.browsewithcaret", false); statusline.updateUrl(); - // Kludge to prevent the input field losing focus on MS/Mac - setTimeout(function () { - let focus = document.commandDispatcher.focusedElement; - let urlbar = document.getElementById("urlbar"); - if (!urlbar || focus != urlbar.inputField) - liberator.focusContent(false); - }, 0); + liberator.focusContent(false); } } @@ -137,6 +131,8 @@ const modes = (function () //{{{ get all() mainModes.slice(), + get inputMode() main & (this.COMMAND_LINE | this.INPUT | this.TEXTAREA | this.COMPOSE), + addMode: function (name, extended, display) { let disp = name.replace("_", " ", "g"); this[name] = 1 << lastMode++; From f2f8cdbea3bee03a4ff4d55cf6e6538ac44c96bd Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 18 Dec 2008 21:41:56 -0500 Subject: [PATCH 007/143] Don't hide errors on bad URLs, they're useful feedback --- common/content/liberator.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/common/content/liberator.js b/common/content/liberator.js index 819bc3a3..9ce88e78 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -1090,11 +1090,7 @@ const liberator = (function () //{{{ switch (where) { case liberator.CURRENT_TAB: - try - { - getBrowser().loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, postdata); - } - catch (e) {} + getBrowser().loadURIWithFlags(url, Ci.nsIWebNavigation.LOAD_FLAGS_NONE, null, null, postdata); break; case liberator.NEW_BACKGROUND_TAB: @@ -1111,11 +1107,7 @@ const liberator = (function () //{{{ const wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); window.open(); whichwindow = wm.getMostRecentWindow("navigator:browser"); - try - { - whichwindow.loadURI(url, null, postdata); - } - catch (e) {} + whichwindow.loadURI(url, null, postdata); break; default: From 66bd21ec30a20bb6a3bbceeacdff7260c2b36aa4 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 18 Dec 2008 21:47:36 -0500 Subject: [PATCH 008/143] Default to opening multiple URLs in windows instead of tabs when !has("tabs") --- common/content/liberator.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/content/liberator.js b/common/content/liberator.js index 9ce88e78..242fde11 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -1099,6 +1099,7 @@ const liberator = (function () //{{{ return open(urls, liberator.NEW_WINDOW); let tab = getBrowser().addTab(url, null, null, postdata); + if (where == liberator.NEW_TAB) getBrowser().selectedTab = tab; break; @@ -1124,8 +1125,6 @@ const liberator = (function () //{{{ for (let [i, url] in Iterator(urls)) { open(url, where); - if (i == 0 && !liberator.has("tabs")) - break; where = liberator.NEW_BACKGROUND_TAB; } From e56a93a06040767844a746c0604513fecd33e795 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 19 Dec 2008 00:17:18 -0500 Subject: [PATCH 009/143] Start documenting CompletionContext --- common/content/completion.js | 129 ++++++++++++++++++++++++++++++++++- 1 file changed, 128 insertions(+), 1 deletion(-) diff --git a/common/content/completion.js b/common/content/completion.js index bf4a9622..1ce28900 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -26,6 +26,25 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** + * Creates a new completion context. + * + * @class A class to provide contexts for command completion. + * Manages the filtering and formatting of completions, and keeps + * track of the positions and quoting of replacement text. Allows for + * the creation of sub-contexts with different headers and quoting + * rules. + * + * @param {nsIEditor} editor The editor for which completion is + * intended. May be a {CompletionContext} when forking a context, + * or a {string} when creating a new one. + * @param {string} name The name of this context. Used when the + * context is forked. + * @param {number} offset The offset from the parent context. + * @author Kris Maglione + * @constructor + */ + function CompletionContext(editor, name, offset) //{{{ { if (!(this instanceof arguments.callee)) @@ -44,7 +63,11 @@ function CompletionContext(editor, name, offset) //{{{ else self.contexts[name] = this; + /** + * @property {CompletionContext} This context's parent. {null} when this is a top-level context. + */ self.parent = parent; + ["filters", "keys", "title", "quote"].forEach(function (key) self[key] = parent[key] && util.cloneObject(parent[key])); ["anchored", "compare", "editor", "_filter", "filterFunc", "keys", "_process", "top"].forEach(function (key) @@ -55,10 +78,20 @@ function CompletionContext(editor, name, offset) //{{{ self.offset = parent.offset; self.advance(offset); + /** + * @property {boolean} Specifies that this context is not finished + * generating results. + * @default false + */ self.incomplete = false; self.message = null; + /** + * @property {boolean} Specifies that this context is waiting for the + * user to press . Useful when fetching completions could be + * dangerous or slow, and the user has enabled autocomplete. + */ self.waitingForTab = false; - //delete self._filter; // FIXME? + delete self._generate; delete self._ignoreCase; if (self != this) @@ -76,6 +109,11 @@ function CompletionContext(editor, name, offset) //{{{ this.editor = editor; this.compare = function (a, b) String.localeCompare(a.text, b.text); + /** + * @property {function} The function used to filter the results. + * @default Selects all results which match every predicate in the + * {@link #filters} array. + */ this.filterFunc = function (items) { let self = this; @@ -83,6 +121,10 @@ function CompletionContext(editor, name, offset) //{{{ reduce(function (res, filter) res.filter(function (item) filter.call(self, item)), items); } + /** + * @property {Array} An array of predicates on which to filter the + * results. + */ this.filters = [function (item) { let text = Array.concat(this.getKey(item, "text")); for (let [i, str] in Iterator(text)) @@ -95,22 +137,73 @@ function CompletionContext(editor, name, offset) //{{{ } return false; }]; + /** + * @property {boolean} Specifies whether this context results must + * match the filter at the begining of the string. + * @default true + */ this.anchored = true; + /** + * @property {Object} A map of all contexts, keyed on their names. + * Names are assigned when a context is forked, with its specified + * name appended, after a '/', to its parent's name. + */ this.contexts = { name: this }; + /** + * @property {Object} A mapping of keys, for {@link #getKey}. Given + * { key: value }, getKey(item, key) will return values as such: + * if value is a string, it will return item.item[value]. If it's a + * function, it will return value(item.item). + */ this.keys = { text: 0, description: 1, icon: "icon" }; + /** + * @property {number} This context's offset from the begining of + * {@link #editor}'s value. + */ this.offset = offset || 0; + /** + * @property {function} A function which is called when any subcontext + * changes its completion list. Only called when + * {@link #updateAsync} is true. + */ this.onUpdate = function () true; + /** + * @property {CompletionContext} The top-level completion context. + */ this.top = this; this.__defineGetter__("incomplete", function () this.contextList.some(function (c) c.parent && c.incomplete)); this.__defineGetter__("waitingForTab", function () this.contextList.some(function (c) c.parent && c.waitingForTab)); this.reset(); } + /** + * @property {Object} A general-purpose store for functions which need to + * cache data between calls. + */ this.cache = {}; + /** + * @private + * @property {Object} A cache for return values of {@link #generate}. + */ this.itemCache = {}; + /** + * @property {string} A key detailing when the cached value of + * {@link #generate} may be used. Every call to + * {@link #generate} stores its result in {@link #itemCache}. + * When itemCache[key] exists, its value is returned, and + * {@link #generate} is not called again. + */ this.key = ""; + /** + * @property {string} A message to be shown before any results. + */ this.message = null; this.name = name || ""; + /** @private */ this._completions = []; // FIXME + /** + * Returns a key, as detailed in {@link #keys}. + * @function + */ this.getKey = function (item, key) (typeof self.keys[key] == "function") ? self.keys[key].call(this, item.item) : key in self.keys ? item.item[self.keys[key]] : item.item[key]; @@ -118,6 +211,14 @@ function CompletionContext(editor, name, offset) //{{{ CompletionContext.prototype = { // Temporary + /** + * @property {Object} + * + * An object describing the results from all sub-contexts. Results are + * adjusted so that all have the same starting offset. + * + * @deprecated + */ get allItems() { try @@ -372,6 +473,19 @@ CompletionContext.prototype = { return this._substrings = substrings; }, + /** + * Advances the context count characters. {@link #filter} is + * advanced to match. If {@link #quote} is non-null, its prefix and suffix + * are set to the null-string. + * + * This function is still imperfect for quoted strings. When + * {@link #quote} is non-null, it adjusts the count based on the quoted + * size of the count-character substring of the filter, which is + * accurate so long as unquoting and quoting a string will always map to + * the original quoted string, which is often not the case. + * + * @param {number} count The number of characters to advance the context. + */ advance: function advance(count) { delete this._ignoreCase; @@ -386,6 +500,12 @@ CompletionContext.prototype = { this._filter = this._filter.substr(count); }, + /** + * Gets a key from {@link #cache}, setting it to defVal if it + * doesn't already exists. + * @param {string} key + * @param defVal + */ getCache: function (key, defVal) { if (!(key in this.cache)) @@ -511,6 +631,13 @@ CompletionContext.prototype = { } }, + /** + * Wait for all subcontexts to complete. + * + * @param {boolean} interruptable When true, the call may be interrupted + * via . In this case, "Interrupted" may be thrown. + * @param {number} timeout The maximum time, in milliseconds, to wait. + */ wait: function wait(interruptable, timeout) { let end = Date.now() + timeout; From 4fc2a56ddcf774c025baa45ab5bd0509c7fb4a4f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 19:07:17 +1100 Subject: [PATCH 010/143] brace formatting fixes --- common/content/commands.js | 3 ++- common/content/completion.js | 3 ++- common/content/hints.js | 6 ++++-- common/content/mappings.js | 3 ++- common/content/modes.js | 5 +++-- common/content/style.js | 6 ++++-- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/common/content/commands.js b/common/content/commands.js index 67540eb9..73beca92 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -792,7 +792,8 @@ function Commands() //{{{ argCount: nargsOpt, bang: bangOpt, count: countOpt, - completer: function (context, args) { + completer: function (context, args) + { if (completeFunc) return completeFunc(context, args) }, diff --git a/common/content/completion.js b/common/content/completion.js index 1ce28900..f9ddee03 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1552,7 +1552,8 @@ function Completion() //{{{ }); completionService.stopSearch(); completionService.startSearch(context.filter, "", context.result, { - onSearchResult: function onSearchResult(search, result) { + onSearchResult: function onSearchResult(search, result) + { context.result = result; timer.tell(result); if (result.searchResult <= result.RESULT_SUCCESS) diff --git a/common/content/hints.js b/common/content/hints.js index ca55ac9a..55e8f043 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -581,12 +581,14 @@ function Hints() //{{{ mappings.add(myModes, [";"], "Start an extended hint mode", - function (count) { + function (count) + { extendedhintCount = count; commandline.input(";", function (arg) { setTimeout(function () hints.show(arg), 0) }, { promptHighlight: "Normal", - completer: function (context) { + completer: function (context) + { context.compare = function () 0; context.completions = [[k, v.prompt] for ([k, v] in Iterator(hintModes))]; }, diff --git a/common/content/mappings.js b/common/content/mappings.js index 13bb318a..7e35b115 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -190,7 +190,8 @@ function Mappings() //{{{ [["", ""], commands.OPTION_NOARG] ], literal: 1, - serial: function () { + serial: function () + { let noremap = this.name.indexOf("noremap") > -1; return [ { diff --git a/common/content/modes.js b/common/content/modes.js index b016048b..0159dd24 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -125,7 +125,7 @@ const modes = (function () //{{{ /////////////////////////////////////////////////////////////////////////////{{{ var self = { - NONE: 0, + NONE: 0, __iterator__: function () util.Array.iterator(this.all), @@ -133,7 +133,8 @@ const modes = (function () //{{{ get inputMode() main & (this.COMMAND_LINE | this.INPUT | this.TEXTAREA | this.COMPOSE), - addMode: function (name, extended, display) { + addMode: function (name, extended, display) + { let disp = name.replace("_", " ", "g"); this[name] = 1 << lastMode++; modeMap[name] = modeMap[this[name]] = { diff --git a/common/content/style.js b/common/content/style.js index ea4b5533..ca9f0f1c 100644 --- a/common/content/style.js +++ b/common/content/style.js @@ -504,7 +504,8 @@ liberator.registerObserver("load_commands", function () }, { bang: true, - completer: function (context, args) { + completer: function (context, args) + { let compl = []; if (args.completeArg == 0) { @@ -541,7 +542,8 @@ liberator.registerObserver("load_commands", function () commands.add(["dels[tyle]"], "Remove a user stylesheet", - function (args) { + function (args) + { styles.removeSheet(args["-name"], args[0], args.literalArg, args["-index"], false); }, { From 83dc3857e901d26edf32de150e9eadb8ccbf1df4 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 19:12:55 +1100 Subject: [PATCH 011/143] whitespace fix --- common/content/events.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 401244ba..0007de2f 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -242,8 +242,8 @@ function AutoCommands() //{{{ liberator.echomsg("Executing " + event + " Auto commands for \"*\"", 8); let lastPattern = null; - let url = args.url || ""; + for (let [,autoCmd] in Iterator(autoCmds)) { if (autoCmd.pattern.test(url)) @@ -252,22 +252,24 @@ function AutoCommands() //{{{ liberator.echomsg("Executing " + event + " Auto commands for \"" + autoCmd.pattern.source + "\"", 8); lastPattern = autoCmd.pattern; - liberator.echomsg("autocommand " + autoCmd.command, 9); + if (typeof autoCmd.command == "function") { try { autoCmd.command.call(autoCmd, args); } - catch(e) + catch (e) { liberator.reportError(e); liberator.echoerr(e); } } else + { liberator.execute(commands.replaceTokens(autoCmd.command, args)); + } } } } From 35d1a756d860fd0e290c5d9b35829060685b24f4 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 19:13:34 +1100 Subject: [PATCH 012/143] prefer let over var in liberator --- common/content/liberator.js | 85 +++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 37 deletions(-) diff --git a/common/content/liberator.js b/common/content/liberator.js index 242fde11..d11147c1 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -71,7 +71,7 @@ const liberator = (function () //{{{ let nError = 0; function loadModule(name, func) { - var message = "Loading module " + name + "..."; + let message = "Loading module " + name + "..."; try { liberator.log(message, 0); @@ -228,21 +228,23 @@ const liberator = (function () //{{{ "Open a " + config.name + " dialog", function (args) { - args = args[0]; + let arg = args[0]; try { - var dialogs = config.dialogs; + let dialogs = config.dialogs; + for (let i = 0; i < dialogs.length; i++) { - if (dialogs[i][0] == args) + if (dialogs[i][0] == arg) return dialogs[i][2](); } - liberator.echoerr(args ? "Dialog " + args.quote() + " not available" : "E474: Invalid argument"); + + liberator.echoerr("E475: Invalid argument: " + arg); } catch (e) { - liberator.echoerr("Error opening '" + args + "': " + e); + liberator.echoerr("Error opening '" + arg + "': " + e); } }, { @@ -321,7 +323,7 @@ const liberator = (function () //{{{ { try { - var cmd = liberator.eval(args.string); + let cmd = liberator.eval(args.string); liberator.execute(cmd); } catch (e) @@ -491,13 +493,13 @@ const liberator = (function () //{{{ } else { - var beforeTime = Date.now(); + let beforeTime = Date.now(); method(); if (special) return; - var afterTime = Date.now(); + let afterTime = Date.now(); if (afterTime - beforeTime >= 100) liberator.echo("Total time: " + ((afterTime - beforeTime) / 1000.0).toFixed(2) + " sec"); @@ -551,7 +553,7 @@ const liberator = (function () //{{{ // similar in his config function hideGUI() { - var guioptions = config.guioptions; + let guioptions = config.guioptions; for (let option in guioptions) { guioptions[option].forEach(function (elem) { @@ -629,7 +631,7 @@ const liberator = (function () //{{{ // liberator.dump("type: " + type + " mode: " + mode + "data: " + data + "\n"); for (let i = 0; i < callbacks.length; i++) { - var [thistype, thismode, thisfunc] = callbacks[i]; + let [thistype, thismode, thisfunc] = callbacks[i]; if (mode == thismode && type == thistype) return thisfunc.call(this, data); } @@ -803,19 +805,24 @@ const liberator = (function () //{{{ evalExpression: function (string) { string = string.toString().replace(/^\s*/, "").replace(/\s*$/, ""); - var matches = string.match(/^&(\w+)/); + let matches = string.match(/^&(\w+)/); + if (matches) { - var opt = this.options.get(matches[1]); + let opt = this.options.get(matches[1]); + if (!opt) { this.echoerr("E113: Unknown option: " + matches[1]); return; } - var type = opt.type; - var value = opt.getter(); + + let type = opt.type; + let value = opt.getter(); + if (type != "boolean" && type != "number") value = value.toString(); + return value; } @@ -823,7 +830,9 @@ const liberator = (function () //{{{ else if (matches = string.match(/^(['"])([^\1]*?[^\\]?)\1/)) { if (matches) + { return matches[2].toString(); + } else { this.echoerr("E115: Missing quote: " + string); @@ -837,7 +846,8 @@ const liberator = (function () //{{{ return parseInt(match[1], 10); } - var reference = this.variableReference(string); + let reference = this.variableReference(string); + if (!reference[0]) this.echoerr("E121: Undefined variable: " + string); else @@ -929,12 +939,12 @@ const liberator = (function () //{{{ help: function (topic) { - var where = (options["newtab"] && options.get("newtab").has("all", "help")) + let where = (options["newtab"] && options.get("newtab").has("all", "help")) ? liberator.NEW_TAB : liberator.CURRENT_TAB; if (!topic) { - var helpFile = options["helpfile"]; + let helpFile = options["helpfile"]; if (config.helpFiles.indexOf(helpFile) != -1) liberator.open("chrome://liberator/locale/" + helpFile, where); @@ -957,8 +967,8 @@ const liberator = (function () //{{{ }, 500); } - var items = completion.runCompleter("help", topic); - var partialMatch = -1; + let items = completion.runCompleter("help", topic); + let partialMatch = -1; for (let [i, item] in Iterator(items)) { @@ -1032,8 +1042,8 @@ const liberator = (function () //{{{ // TODO: add proper level constants log: function (msg, level) { - var verbose = 0; - if (typeof level != "number") // XXX + let verbose = 0; + if (level == undefined) level = 1; // options does not exist at the very beginning @@ -1046,7 +1056,7 @@ const liberator = (function () //{{{ if (typeof msg == "object") msg = util.objectToString(msg, false); - var consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService); + const consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService); consoleService.logStringMessage(config.name.toLowerCase() + ": " + msg); }, @@ -1183,8 +1193,8 @@ const liberator = (function () //{{{ const nsIAppStartup = Ci.nsIAppStartup; // notify all windows that an application quit has been requested. - var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); - var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool); + const os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); + const cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool); os.notifyObservers(cancelQuit, "quit-application-requested", null); // something aborted the quit process. @@ -1195,17 +1205,16 @@ const liberator = (function () //{{{ os.notifyObservers(null, "quit-application-granted", null); // enumerate all windows and call shutdown handlers - var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); - var windows = wm.getEnumerator(null); + const wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); + let windows = wm.getEnumerator(null); while (windows.hasMoreElements()) { - var win = windows.getNext(); + let win = windows.getNext(); if (("tryToClose" in win) && !win.tryToClose()) return; } - Cc["@mozilla.org/toolkit/app-startup;1"] - .getService(nsIAppStartup) - .quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit); + Cc["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup) + .quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit); }, // TODO: move to {muttator,vimperator,...}.js @@ -1357,7 +1366,7 @@ const liberator = (function () //{{{ if (!string) return [null, null, null]; - var matches = string.match(/^([bwtglsv]):(\w+)/); + let matches = string.match(/^([bwtglsv]):(\w+)/); if (matches) // Variable { // Other variables should be implemented @@ -1380,12 +1389,14 @@ const liberator = (function () //{{{ get windows() { - var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); - var wa = []; - var enumerator = wm.getEnumerator("navigator:browser"); + const wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); + let windows = []; + let enumerator = wm.getEnumerator("navigator:browser"); + while (enumerator.hasMoreElements()) - wa.push(enumerator.getNext()); - return wa; + windows.push(enumerator.getNext()); + + return windows; } }; //}}} From 67e5788fd56ba58c103e401f813f2ea4d7ba0948 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 19:14:38 +1100 Subject: [PATCH 013/143] prefer let over var in Hints --- common/content/hints.js | 58 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/common/content/hints.js b/common/content/hints.js index 55e8f043..25803f34 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -107,19 +107,19 @@ function Hints() //{{{ if (!win) win = window.content; - var doc = win.document; - var height = win.innerHeight; - var width = win.innerWidth; - var scrollX = doc.defaultView.scrollX; - var scrollY = doc.defaultView.scrollY; + let doc = win.document; + let height = win.innerHeight; + let width = win.innerWidth; + let scrollX = doc.defaultView.scrollX; + let scrollY = doc.defaultView.scrollY; - var baseNodeAbsolute = util.xmlToDom(, doc); + let baseNodeAbsolute = util.xmlToDom(, doc); - var elem, tagname, text, span, rect; - var res = buffer.evaluateXPath(hintMode.tags(), doc, null, true); + let elem, tagname, text, span, rect; + let res = buffer.evaluateXPath(hintMode.tags(), doc, null, true); - var fragment = util.xmlToDom(
, doc); - var start = pageHints.length; + let fragment = util.xmlToDom(
, doc); + let start = pageHints.length; for (let elem in res) { // TODO: for iframes, this calculation is wrong @@ -131,7 +131,7 @@ function Hints() //{{{ if (!rect) continue; - var computedStyle = doc.defaultView.getComputedStyle(elem, null); + let computedStyle = doc.defaultView.getComputedStyle(elem, null); if (computedStyle.getPropertyValue("visibility") != "visible" || computedStyle.getPropertyValue("display") == "none") continue; @@ -171,11 +171,11 @@ function Hints() //{{{ // TODO: make it aware of imgspans function showActiveHint(newID, oldID) { - var oldElem = validHints[oldID - 1]; + let oldElem = validHints[oldID - 1]; if (oldElem) setClass(oldElem, false); - var newElem = validHints[newID - 1]; + let newElem = validHints[newID - 1]; if (newElem) setClass(newElem, true); } @@ -274,7 +274,7 @@ function Hints() //{{{ function removeHints(timeout) { - var firstElem = validHints[0] || null; + let firstElem = validHints[0] || null; for (let [,{ doc: doc, start: start, end: end }] in Iterator(docs)) { @@ -329,9 +329,9 @@ function Hints() //{{{ } } - var timeout = followFirst || events.feedingKeys ? 0 : 500; - var activeIndex = (hintNumber ? hintNumber - 1 : 0); - var elem = validHints[activeIndex]; + let timeout = followFirst || events.feedingKeys ? 0 : 500; + let activeIndex = (hintNumber ? hintNumber - 1 : 0); + let elem = validHints[activeIndex]; removeHints(timeout); if (timeout == 0) @@ -369,7 +369,7 @@ function Hints() //{{{ function tokenize(pat, string) string.split(pat).map(String.toLowerCase); function containsMatcher(hintString) //{{{ { - var tokens = tokenize(/\s+/, hintString); + let tokens = tokenize(/\s+/, hintString); return function (linkText) { linkText = linkText.toLowerCase(); @@ -379,14 +379,14 @@ function Hints() //{{{ function wordStartsWithMatcher(hintString, allowWordOverleaping) //{{{ { - var hintStrings = tokenize(/\s+/, hintString); - var wordSplitRegex = RegExp(options["wordseparators"]); + let hintStrings = tokenize(/\s+/, hintString); + let wordSplitRegex = RegExp(options["wordseparators"]); // What the **** does this do? --Kris function charsAtBeginningOfWords(chars, words, allowWordOverleaping) { - var charIdx = 0; - var numMatchedWords = 0; + let charIdx = 0; + let numMatchedWords = 0; for (let [,word] in Iterator(words)) { if (word.length == 0) @@ -414,7 +414,7 @@ function Hints() //{{{ } // the current word matches same characters as the previous word - var prevCharIdx; + let prevCharIdx; if (wcIdx > 0) { prevCharIdx = charIdx; @@ -468,7 +468,7 @@ function Hints() //{{{ function stringsAtBeginningOfWords(strings, words, allowWordOverleaping) { - var strIdx = 0; + let strIdx = 0; for (let [,word] in Iterator(words)) { if (word.length == 0) @@ -505,7 +505,7 @@ function Hints() //{{{ } } //}}} - var hintMatching = options["hintmatching"]; + let hintMatching = options["hintmatching"]; switch (hintMatching) { case "contains" : return containsMatcher(hintString); @@ -655,8 +655,8 @@ function Hints() //{{{ onEvent: function (event) { - var key = events.toString(event); - var followFirst = false; + let key = events.toString(event); + let followFirst = false; // clear any timeout which might be active after pressing a number if (activeTimeout) @@ -677,7 +677,7 @@ function Hints() //{{{ if (hintNumber == 0) hintNumber = 1; - var oldID = hintNumber; + let oldID = hintNumber; if (key == "") { if (++hintNumber > validHints.length) @@ -721,7 +721,7 @@ function Hints() //{{{ { prevInput = "number"; - var oldHintNumber = hintNumber; + let oldHintNumber = hintNumber; if (hintNumber == 0 || usedTabKey) { usedTabKey = false; From 01a7ead528502b2f1245b22a35d5d3e3627dcaab Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 23:00:14 +1100 Subject: [PATCH 014/143] add missing semicolons --- common/content/commands.js | 8 ++++---- common/content/editor.js | 2 +- common/content/eval.js | 2 +- common/content/events.js | 4 ++-- common/content/find.js | 2 +- common/content/hints.js | 10 +++++----- common/content/io.js | 2 +- common/content/liberator-overlay.js | 2 +- common/content/liberator.js | 2 +- common/content/options.js | 6 +++--- common/content/style.js | 20 ++++++++++---------- common/content/tabs.js | 2 +- vimperator/content/bookmarks.js | 18 ++++++++++++------ vimperator/content/config.js | 2 +- 14 files changed, 44 insertions(+), 38 deletions(-) diff --git a/common/content/commands.js b/common/content/commands.js index 73beca92..75711744 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -120,7 +120,7 @@ Command.prototype = { if (matches && matches[2]) { commandline.inputMultiline(new RegExp("^" + matches[2] + "$", "m"), - function (args) { exec(matches[1] + "\n" + args) }); + function (args) { exec(matches[1] + "\n" + args); }); return; } } @@ -169,7 +169,7 @@ function Commands() //{{{ const quoteMap = { "\n": "n", "\t": "t" - } + }; function quote(q, list) { let re = RegExp("[" + list + "]", "g"); @@ -184,7 +184,7 @@ function Commands() //{{{ '"': quote('"', '\n\t"\\\\'), "'": quote("'", "\\\\'"), "": quote("", "\\\\ ") - } + }; const ArgType = new Struct("description", "parse"); const argTypes = [ @@ -555,7 +555,7 @@ function Commands() //{{{ if (complete) { if (argCount == "0" || args.length > 0 && (/[1?]/.test(argCount))) - complete.highlight(i, sub.length, "SPELLCHECK") + complete.highlight(i, sub.length, "SPELLCHECK"); } if (args.length == literal) diff --git a/common/content/editor.js b/common/content/editor.js index be1b3aba..6219a4ea 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -857,7 +857,7 @@ function Editor() //{{{ editor.selection.deleteFromDocument(); editor.insertText(val); } - }, this) + }, this); if (res == false) throw "Couldn't create temporary file"; } diff --git a/common/content/eval.js b/common/content/eval.js index 14f5fd95..daf0dba6 100644 --- a/common/content/eval.js +++ b/common/content/eval.js @@ -1,4 +1,4 @@ -try { __liberator_eval_result = eval(__liberator_eval_string) +try { __liberator_eval_result = eval(__liberator_eval_string); } catch (e) { diff --git a/common/content/events.js b/common/content/events.js index 0007de2f..4c1d9f8c 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -689,7 +689,7 @@ function Events() //{{{ commands.add(["macros"], "List all macros", - function (args) { completion.listCompleter("macro", args[0]) }, + function (args) { completion.listCompleter("macro", args[0]); }, { argCount: "?", completer: function (context) completion.macro(context) @@ -1283,7 +1283,7 @@ function Events() //{{{ { events.feedingKeys = false; if (lastMacro) - setTimeout(function () { liberator.echomsg("Canceled playback of macro '" + lastMacro + "'") }, 100); + setTimeout(function () { liberator.echomsg("Canceled playback of macro '" + lastMacro + "'"); }, 100); event.preventDefault(); event.stopPropagation(); return true; diff --git a/common/content/find.js b/common/content/find.js index 794476ac..41b15599 100644 --- a/common/content/find.js +++ b/common/content/find.js @@ -176,7 +176,7 @@ function Search() //{{{ return; } - var baseNode = + var baseNode = ; baseNode = util.xmlToDom(baseNode, window.content.document); var body = doc.body; diff --git a/common/content/hints.js b/common/content/hints.js index 25803f34..90c7e14f 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -237,7 +237,7 @@ function Hints() //{{{ hint[IMGSPAN] = imgspan; span.parentNode.appendChild(imgspan); } - setClass(imgspan, activeHint == hintnum) + setClass(imgspan, activeHint == hintnum); } span.setAttribute("number", hintnum); @@ -289,7 +289,7 @@ function Hints() //{{{ // animate the disappearance of the first hint if (timeout && firstElem) - setTimeout(function () { firstElem.removeAttributeNS(NS.uri, "highlight") }, timeout); + setTimeout(function () { firstElem.removeAttributeNS(NS.uri, "highlight"); }, timeout); } styles.removeSheet("hint-positions", null, null, null, true); @@ -374,7 +374,7 @@ function Hints() //{{{ { linkText = linkText.toLowerCase(); return tokens.every(function (token) linkText.indexOf(token) >= 0); - } + }; } //}}} function wordStartsWithMatcher(hintString, allowWordOverleaping) //{{{ @@ -502,7 +502,7 @@ function Hints() //{{{ return charsAtBeginningOfWords(hintStrings[0], words, allowWordOverleaping); else return stringsAtBeginningOfWords(hintStrings, words, allowWordOverleaping); - } + }; } //}}} let hintMatching = options["hintmatching"]; @@ -584,7 +584,7 @@ function Hints() //{{{ function (count) { extendedhintCount = count; - commandline.input(";", function (arg) { setTimeout(function () hints.show(arg), 0) }, + commandline.input(";", function (arg) { setTimeout(function () hints.show(arg), 0); }, { promptHighlight: "Normal", completer: function (context) diff --git a/common/content/io.js b/common/content/io.js index fd111d52..8a5e3d97 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -30,7 +30,7 @@ the terms of any one of the MPL, the GPL or the LGPL. plugins.contexts = {}; function Script(file) { - let self = plugins.contexts[file.path] + let self = plugins.contexts[file.path]; if (self) { if (self.onUnload) diff --git a/common/content/liberator-overlay.js b/common/content/liberator-overlay.js index 288559e2..9b0df22b 100644 --- a/common/content/liberator-overlay.js +++ b/common/content/liberator-overlay.js @@ -13,7 +13,7 @@ { try { - loader.loadSubScript(base + script, modules) + loader.loadSubScript(base + script, modules); return; } catch (e) diff --git a/common/content/liberator.js b/common/content/liberator.js index d11147c1..1e3d7037 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -109,7 +109,7 @@ const liberator = (function () //{{{ .forEach(function (elem) { if (elem) - elem.collapsed = (opts.indexOf(opt) == -1) + elem.collapsed = (opts.indexOf(opt) == -1); }); } } diff --git a/common/content/options.js b/common/content/options.js index 460490bb..6373dcb6 100644 --- a/common/content/options.js +++ b/common/content/options.js @@ -73,7 +73,7 @@ function Option(names, description, type, defaultValue, extraInfo) //{{{ } Option.prototype = { get globalvalue() options.store.get(this.name), - set globalvalue(val) { options.store.set(this.name, val) }, + set globalvalue(val) { options.store.set(this.name, val); }, parseValues: function (value) { @@ -164,8 +164,8 @@ Option.prototype = { if (this.checkHas) test = function (val) values.some(function (value) self.checkHas(value, val)); let values = this.values; - /* Return whether some argument matches */ - return Array.some(arguments, function (val) test(val)) + // return whether some argument matches + return Array.some(arguments, function (val) test(val)); }, hasName: function (name) this.names.indexOf(name) >= 0, diff --git a/common/content/style.js b/common/content/style.js index ca9f0f1c..62c14ef2 100644 --- a/common/content/style.js +++ b/common/content/style.js @@ -166,7 +166,7 @@ function Highlights(name, store, serial) return error; style.value = newStyle; highlight[style.class] = style; - } + }; this.selector = function (class) { @@ -200,7 +200,7 @@ function Highlights(name, store, serial) if (hl.value == hl.default) this.set(class); } - } + }; } function Styles(name, store, serial) @@ -264,7 +264,7 @@ function Styles(name, store, serial) names[name] = sheet; } return null; - } + }; this.findSheets = function (name, filter, css, index, system) { @@ -324,7 +324,7 @@ function Styles(name, store, serial) } } return matches.length; - } + }; this.registerSheet = function (uri, doCheckSyntax, reload) { @@ -336,14 +336,14 @@ function Styles(name, store, serial) uri = ios.newURI(uri, null, null); if (reload || !sss.sheetRegistered(uri, sss.USER_SHEET)) sss.loadAndRegisterSheet(uri, sss.USER_SHEET); - } + }; this.unregisterSheet = function (uri) { uri = ios.newURI(uri, null, null); if (sss.sheetRegistered(uri, sss.USER_SHEET)) sss.unregisterSheet(uri, sss.USER_SHEET); - } + }; // FIXME this.registerAgentSheet = function (uri) @@ -351,14 +351,14 @@ function Styles(name, store, serial) this.unregisterAgentSheet(uri); uri = ios.newURI(uri, null, null); sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET); - } + }; this.unregisterAgentSheet = function (uri) { uri = ios.newURI(uri, null, null); if (sss.sheetRegistered(uri, sss.AGENT_SHEET)) sss.unregisterSheet(uri, sss.AGENT_SHEET); - } + }; function wrapCSS(sheet) { @@ -425,7 +425,7 @@ function Styles(name, store, serial) if (errors.length) { let err = new Error("", errors[0].sourceName.replace(/^(chrome-data:text\/css,).*/, "$1..."), errors[0].lineNumber); - err.name = "CSSError" + err.name = "CSSError"; err.message = errors.reduce(function (msg, e) msg + "; " + e.lineNumber + ": " + e.errorMessage, errors.shift().errorMessage); err.echoerr = err.fileName + ":" + err.lineNumber + ": " + err.message; @@ -516,7 +516,7 @@ liberator.registerObserver("load_commands", function () } catch (e) {} context.anchored = false; - context.completions = compl.concat([[s, ""] for each (s in styles.sites)]) + context.completions = compl.concat([[s, ""] for each (s in styles.sites)]); } else if (args.completeArg == 1) { diff --git a/common/content/tabs.js b/common/content/tabs.js index 6fee2043..6cec525d 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -598,7 +598,7 @@ function Tabs() //{{{ function (args) { let count = args.count; - args = args[0] + args = args[0]; if (count < 1) count = 1; diff --git a/vimperator/content/bookmarks.js b/vimperator/content/bookmarks.js index 9dd6e9b1..8acac9f7 100644 --- a/vimperator/content/bookmarks.js +++ b/vimperator/content/bookmarks.js @@ -238,7 +238,7 @@ function Bookmarks() //{{{ var cache = storage.newObject("bookmark-cache", Cache, false); storage.addObserver("bookmark-cache", bookmarkObserver); liberator.registerObserver("shutdown", function () { - storage.removeObserver("bookmark-cache", bookmarkObserver) + storage.removeObserver("bookmark-cache", bookmarkObserver); }); liberator.registerObserver("enter", function () { @@ -358,7 +358,7 @@ function Bookmarks() //{{{ if (!args.bang) { context.completions = [[content.document.documentURI, "Current Location"]]; - return + return; } completion.bookmark(context, args["-tags"], { keyword: args["-keyword"], title: args["-title"] }); }, @@ -784,7 +784,7 @@ function History() //{{{ function (args) { history.list(args.join(" "), args.bang, args["-max"] || 1000); }, { bang: true, - completer: function (context) { context.quote = null, completion.history(context) }, + completer: function (context) { context.quote = null, completion.history(context); }, options: [[["-max", "-m"], options.OPTION_INT]] // completer: function (filter) completion.history(filter) }); @@ -823,7 +823,7 @@ function History() //{{{ url: node.uri, title: node.title, icon: node.icon ? node.icon.spec : DEFAULT_FAVICON - } + }; }); root.containerOpen = false; // close a container after using it! @@ -844,7 +844,10 @@ function History() //{{{ { let index = window.getWebNavigation().sessionHistory.index; if (index == 0) - return liberator.beep(); // really wanted? + { + liberator.beep(); // XXX: really wanted? + return; + } window.getWebNavigation().gotoIndex(0); }, @@ -853,7 +856,10 @@ function History() //{{{ { let index = window.getWebNavigation().sessionHistory.index; if (index == window.getWebNavigation().sessionHistory.count - 1) - return liberator.beep(); + { + liberator.beep(); + return; + } window.getWebNavigation().gotoIndex(max); }, diff --git a/vimperator/content/config.js b/vimperator/content/config.js index a11c8e2c..cc353a28 100644 --- a/vimperator/content/config.js +++ b/vimperator/content/config.js @@ -171,7 +171,7 @@ const config = { //{{{ + "}", true); delete img; - } + }; //////////////////////////////////////////////////////////////////////////////// ////////////////////// MAPPINGS //////////////////////////////////////////////// From 98cc66c5695f5ab71176e4adffb3a248a2d25c96 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 23:09:37 +1100 Subject: [PATCH 015/143] remove some ancient cruft --- common/content/events.js | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 4c1d9f8c..c477cb80 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1339,25 +1339,7 @@ function Events() //{{{ return false; } - // // FIXME: handle middle click in content area {{{ - // // alert(event.target.id); - // if (/*event.type == 'mousedown' && */event.button == 1 && event.target.id == 'content') - // { - // //echo("foo " + event.target.id); - // //if (document.commandDispatcher.focusedElement == command_line.inputField) - // { - // //alert(command_line.value.substring(0, command_line.selectionStart)); - // command_line.value = command_line.value.substring(0, command_line.selectionStart) + - // window.readFromClipboard() + - // command_line.value.substring(command_line.selectionEnd, command_line.value.length); - // alert(command_line.value); - // } - // //else - // // { - // // openURLs(window.readFromClipboard()); - // // } - // return true; - // } }}} + // TODO: handle middle click in content area if (key != "" && key != "") { From b08f9053b3c24b167e3ffcf1388a4d0e438a192e Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 23:12:06 +1100 Subject: [PATCH 016/143] declare variable in getMenuItems#addChildren() --- common/content/liberator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/liberator.js b/common/content/liberator.js index 1e3d7037..30283ee6 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -268,7 +268,7 @@ const liberator = (function () //{{{ } else { - path = parent; + let path = parent; if (item.localName == "menu") path += item.label + "."; addChildren(item, path); From b2799ebeddd4e4a14b10958179123e1259d8ec63 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 23:17:52 +1100 Subject: [PATCH 017/143] minor refactoring of "b" action --- common/content/tabs.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/content/tabs.js b/common/content/tabs.js index 6cec525d..4e8512f2 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -252,8 +252,9 @@ function Tabs() //{{{ function (count) { if (count != -1) - return tabs.switchTo(String(count)); - commandline.open(":", "buffer! ", modes.EX); + tabs.switchTo(String(count)); + else + commandline.open(":", "buffer! ", modes.EX); }, { flags: Mappings.flags.COUNT }); From d277dd5c1cfe9ef2265fdd02af4341879268efb2 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 23:24:31 +1100 Subject: [PATCH 018/143] minor refactoring of :dialog action --- common/content/liberator.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/content/liberator.js b/common/content/liberator.js index 30283ee6..2edaa653 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -232,12 +232,16 @@ const liberator = (function () //{{{ try { + // TODO: why are these sorts of properties arrays? --djk let dialogs = config.dialogs; - for (let i = 0; i < dialogs.length; i++) + for (let [,dialog] in Iterator(dialogs)) { - if (dialogs[i][0] == arg) - return dialogs[i][2](); + if (arg == dialog[0]) + { + dialog[2](); + return; + } } liberator.echoerr("E475: Invalid argument: " + arg); From 39d6542e80b6cd610c43209c68a16fad72207d7b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 23:50:12 +1100 Subject: [PATCH 019/143] minor refactoring of :command action --- common/content/commands.js | 42 ++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/common/content/commands.js b/common/content/commands.js index 75711744..7486d344 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -759,19 +759,20 @@ function Commands() //{{{ { if (/^custom,/.test(completeOpt)) { + completeOpt = completeOpt.substr(7); completeFunc = function () { try { - var completer = liberator.eval(completeOpt.substr(7)); + var completer = liberator.eval(completeOpt); if (!(completer instanceof Function)) - throw new TypeError("User-defined custom completer '" + completeOpt.substr(7) + "' is not a function"); + throw new TypeError("User-defined custom completer '" + completeOpt + "' is not a function"); } catch (e) { // FIXME: should be pushed to the MOW - liberator.echoerr("E117: Unknown function: " + completeOpt.substr(7)); + liberator.echoerr("E117: Unknown function: " + completeOpt); liberator.log(e); return undefined; } @@ -784,26 +785,23 @@ function Commands() //{{{ } } - if (!commands.addUserCommand( - [cmd], - "User defined command", - userCommand, - { - argCount: nargsOpt, - bang: bangOpt, - count: countOpt, - completer: function (context, args) - { - if (completeFunc) - return completeFunc(context, args) - }, - replacementText: args.literalArg - }, - args.bang) - ) - { + let added = commands.addUserCommand([cmd], + "User defined command", + userCommand, + { + argCount: nargsOpt, + bang: bangOpt, + count: countOpt, + completer: function (context, args) + { + if (completeFunc) + return completeFunc(context, args) + }, + replacementText: args.literalArg + }, args.bang); + + if (!added) liberator.echoerr("E174: Command already exists: add ! to replace it"); - } } else { From 89dc3c2078baeefd494f529cc4b11c40b40f6fbc Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 19 Dec 2008 23:59:25 +1100 Subject: [PATCH 020/143] trivial refactoring of :emenu and :chdir actions --- common/content/io.js | 20 ++++++++++---------- common/content/liberator.js | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/common/content/io.js b/common/content/io.js index 8a5e3d97..136b2b13 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -194,17 +194,17 @@ function IO() //{{{ "Change the current directory", function (args) { - args = args.literalArg; + let arg = args.literalArg; - if (!args) + if (!arg) { - args = "~"; + arg = "~"; } - else if (args == "-") + else if (arg == "-") { if (oldcwd) { - args = oldcwd.path; + arg = oldcwd.path; } else { @@ -213,14 +213,14 @@ function IO() //{{{ } } - args = io.expandPath(args); + arg = io.expandPath(arg); // go directly to an absolute path or look for a relative path // match in 'cdpath' // TODO: handle ../ and ./ paths - if (isAbsolutePath(args)) + if (isAbsolutePath(arg)) { - if (io.setCurrentDirectory(args)) + if (io.setCurrentDirectory(arg)) liberator.echomsg(io.getCurrentDirectory().path); } else @@ -230,7 +230,7 @@ function IO() //{{{ for (let [,dir] in Iterator(dirs)) { - dir = joinPaths(dir, args); + dir = joinPaths(dir, arg); if (dir.exists() && dir.isDirectory() && dir.isReadable()) { @@ -243,7 +243,7 @@ function IO() //{{{ if (!found) { - liberator.echoerr("E344: Can't find directory " + args.quote() + " in cdpath\n" + liberator.echoerr("E344: Can't find directory " + arg.quote() + " in cdpath\n" + "E472: Command failed"); } } diff --git a/common/content/liberator.js b/common/content/liberator.js index 2edaa653..e5c8cfa8 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -289,18 +289,18 @@ const liberator = (function () //{{{ "Execute the specified menu item from the command line", function (args) { - args = args.literalArg; + let arg = args.literalArg; let items = getMenuItems(); - if (!items.some(function (i) i.fullMenuPath == args)) + if (!items.some(function (i) i.fullMenuPath == arg)) { - liberator.echoerr("E334: Menu not found: " + args); + liberator.echoerr("E334: Menu not found: " + arg); return; } for (let [,item] in Iterator(items)) { - if (item.fullMenuPath == args) + if (item.fullMenuPath == arg) item.doCommand(); } }, From 9df54a457267d9f2c599cb9803f61fc87b83a460 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 20 Dec 2008 00:15:13 +1100 Subject: [PATCH 021/143] fix transposed defaults in showmode and shell help --- vimperator/locale/en-US/options.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vimperator/locale/en-US/options.txt b/vimperator/locale/en-US/options.txt index 71056576..2d017a69 100644 --- a/vimperator/locale/en-US/options.txt +++ b/vimperator/locale/en-US/options.txt @@ -614,7 +614,7 @@ ____ |\'shell'| |\'sh'| -||'shell' 'sh'|| string (default: on) +||'shell' 'sh'|| string (default: "-c", Win32: "/c") ____ Shell to use for executing :! and :run commands. ____ @@ -630,7 +630,7 @@ ____ |\'nosmd'| |\'noshowmode'| |\'smd'| |\'showmode'| -||'showmode' 'smd'|| boolean (default: "-c", Win32: "/c") +||'showmode' 'smd'|| boolean (default: on) ____ Show the current mode in the command-line. ____ From abf6bafaf7272415b7ca16ebd8c4347d14a21f82 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 20 Dec 2008 00:31:13 +1100 Subject: [PATCH 022/143] fix search highlighting when 'incsearch' is set - Algardas --- common/content/find.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/content/find.js b/common/content/find.js index 41b15599..923426f5 100644 --- a/common/content/find.js +++ b/common/content/find.js @@ -408,11 +408,10 @@ function Search() //{{{ if (!command) command = lastSearchPattern; + this.clear(); + if (!options["incsearch"] || !found) - { - this.clear(); this.find(command, backwards); - } lastSearchBackwards = backwards; //lastSearchPattern = command.replace(backwards ? /\?.*/ : /\/.*/, ""); // XXX From 6e9262ef6472b1aa2c2ce2c278d2f28e47680a6b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 20 Dec 2008 01:08:24 +1100 Subject: [PATCH 023/143] document :hardcopy >{filename}...since it was committed --- common/content/buffer.js | 18 +++++++++++------- vimperator/NEWS | 1 + vimperator/locale/en-US/print.txt | 6 ++++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 7527f7ad..0843ecb6 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -468,14 +468,18 @@ function Buffer() //{{{ "Print current document", function (args) { + let arg = args[0]; + + // FIXME: arg handling is a bit of a mess, check for filename + if (arg && (liberator.has("Win32") || arg[0] != ">")) + return liberator.echoerr("E488: Trailing characters"); + options.temporaryContext(function () { - if (args[0]) + if (arg) { - if (args[0][0] != ">") - return liberator.echoerr("E488: Trailing characters"); options.setPref("print.print_to_file", "true"); - options.setPref("print.print_to_filename", io.getFile(args[0].substr(1)).path); - liberator.echomsg("Printing to file: " + args[0].substr(1)); + options.setPref("print.print_to_filename", io.getFile(arg.substr(1)).path); + liberator.echomsg("Printing to file: " + arg.substr(1)); } else { @@ -488,8 +492,8 @@ function Buffer() //{{{ getBrowser().contentWindow.print(); }); - if (args[0]) - liberator.echomsg("Printed: " + args[0].substr(1)); + if (arg) + liberator.echomsg("Printed: " + arg.substr(1)); else liberator.echomsg("Print job sent."); }, diff --git a/vimperator/NEWS b/vimperator/NEWS index c850ec2b..f982feda 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -21,6 +21,7 @@ VimperatorLeave respectively * IMPORTANT: 'verbose' is now by default at 1, set to 0 to not show any status messages + * :hardcopy now supports output redirection to a file on Unix and MacUnix * add ";f" extended hint mode to focus a frame * add "r", "l", and "b" to 'guioptions' to toggle the scrollbars. * remove spaces and newlines when open urls starting with http:// or similar diff --git a/vimperator/locale/en-US/print.txt b/vimperator/locale/en-US/print.txt index aad69e18..397f9dbb 100644 --- a/vimperator/locale/en-US/print.txt +++ b/vimperator/locale/en-US/print.txt @@ -10,6 +10,12 @@ number of copies, orientation, etc. When used with [!], the dialog is skipped and the default printer used. ________________________________________________________________________________ + +||:ha[rdcopy][!] >{filename}|| + +________________________________________________________________________________ +As above, but write the output to {filename}. +________________________________________________________________________________ + section:Firefox{nbsp}printing{nbsp}dialogs[firefox-print-dialogs] The "Print Preview" and "Page Setup" dialogs can be opened via the :dialog command From 073383ef1225e5429f68f8dd11dd11c3b740e165 Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Fri, 19 Dec 2008 10:49:56 -0500 Subject: [PATCH 024/143] Allow empty defsearch. --- common/content/completion.js | 2 +- vimperator/content/bookmarks.js | 7 +++++++ vimperator/locale/en-US/options.txt | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/content/completion.js b/common/content/completion.js index f9ddee03..f7594214 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1645,7 +1645,7 @@ function Completion() //{{{ let engines = bookmarks.getSearchEngines(); context.title = ["Search Keywords"]; - context.completions = keywords.concat(engines); + context.completions = [ bookmarks.makeKeyword("", "No default search engine", null, "") ].concat( keywords.concat(engines) ); context.keys = { text: 0, description: 1, icon: 2 }; if (!space || noSuggest) diff --git a/vimperator/content/bookmarks.js b/vimperator/content/bookmarks.js index 8acac9f7..e887a580 100644 --- a/vimperator/content/bookmarks.js +++ b/vimperator/content/bookmarks.js @@ -589,6 +589,13 @@ function Bookmarks() //{{{ return process(resp); }, + // Allows for creation of anonymous keyword (e.g., for empty + // defsearch's) + makeKeyword: function makeKeyword(keyword, title, icon, url) + { + return new Keyword( keyword, title, icon, url ); + }, + // TODO: add filtering // format of returned array: // [keyword, helptext, url] diff --git a/vimperator/locale/en-US/options.txt b/vimperator/locale/en-US/options.txt index 2d017a69..22cdd8c7 100644 --- a/vimperator/locale/en-US/options.txt +++ b/vimperator/locale/en-US/options.txt @@ -247,6 +247,9 @@ This means, it you set 'defsearch' to "youtube", then [c]:open arnold schwarzenegger[c] will be exactly the same as [c]:open youtube arnold schwarzenegger[c]. Therefore, you need to add a keyword or search engine "youtube" first. + +If 'defsearch' is empty, then Firefox will always attempt to open the +raw [[arg]]. ____ From da5db4429e7a68c8c49614350bcec2a674d17e38 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 19 Dec 2008 12:29:13 -0500 Subject: [PATCH 025/143] Revert "Allow empty defsearch." This reverts commit 3cab7c16a0ef5e39f9aeeb8ea1ed9602a6a152f4. --- common/content/completion.js | 2 +- vimperator/content/bookmarks.js | 7 ------- vimperator/locale/en-US/options.txt | 3 --- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/common/content/completion.js b/common/content/completion.js index f7594214..f9ddee03 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1645,7 +1645,7 @@ function Completion() //{{{ let engines = bookmarks.getSearchEngines(); context.title = ["Search Keywords"]; - context.completions = [ bookmarks.makeKeyword("", "No default search engine", null, "") ].concat( keywords.concat(engines) ); + context.completions = keywords.concat(engines); context.keys = { text: 0, description: 1, icon: 2 }; if (!space || noSuggest) diff --git a/vimperator/content/bookmarks.js b/vimperator/content/bookmarks.js index e887a580..8acac9f7 100644 --- a/vimperator/content/bookmarks.js +++ b/vimperator/content/bookmarks.js @@ -589,13 +589,6 @@ function Bookmarks() //{{{ return process(resp); }, - // Allows for creation of anonymous keyword (e.g., for empty - // defsearch's) - makeKeyword: function makeKeyword(keyword, title, icon, url) - { - return new Keyword( keyword, title, icon, url ); - }, - // TODO: add filtering // format of returned array: // [keyword, helptext, url] diff --git a/vimperator/locale/en-US/options.txt b/vimperator/locale/en-US/options.txt index 22cdd8c7..2d017a69 100644 --- a/vimperator/locale/en-US/options.txt +++ b/vimperator/locale/en-US/options.txt @@ -247,9 +247,6 @@ This means, it you set 'defsearch' to "youtube", then [c]:open arnold schwarzenegger[c] will be exactly the same as [c]:open youtube arnold schwarzenegger[c]. Therefore, you need to add a keyword or search engine "youtube" first. - -If 'defsearch' is empty, then Firefox will always attempt to open the -raw [[arg]]. ____ From 669043da71e53298932eecd8978b9b1dca2a065c Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 19 Dec 2008 12:33:22 -0500 Subject: [PATCH 026/143] Add completion for empty 'defsearch' --- vimperator/content/bookmarks.js | 6 +++++- vimperator/locale/en-US/options.txt | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/vimperator/content/bookmarks.js b/vimperator/content/bookmarks.js index 8acac9f7..afb276e4 100644 --- a/vimperator/content/bookmarks.js +++ b/vimperator/content/bookmarks.js @@ -258,7 +258,11 @@ function Bookmarks() //{{{ "Set the default search engine", "string", "google", { - completer: function completer(context) completion.search(context, true), + completer: function completer(context) + { + completion.search(context, true) + context.completions = [["", "Don't perform searches by default"]].concat(context.completions); + }, validator: Option.validateCompleter }); diff --git a/vimperator/locale/en-US/options.txt b/vimperator/locale/en-US/options.txt index 2d017a69..22cdd8c7 100644 --- a/vimperator/locale/en-US/options.txt +++ b/vimperator/locale/en-US/options.txt @@ -247,6 +247,9 @@ This means, it you set 'defsearch' to "youtube", then [c]:open arnold schwarzenegger[c] will be exactly the same as [c]:open youtube arnold schwarzenegger[c]. Therefore, you need to add a keyword or search engine "youtube" first. + +If 'defsearch' is empty, then Firefox will always attempt to open the +raw [[arg]]. ____ From 057d66ce65f4bd9037960986a42d0993e791398f Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 19 Dec 2008 13:27:01 -0500 Subject: [PATCH 027/143] Document some more crap. --- common/content/buffer.js | 152 ++++++++++++++++++++++++++++++---- common/content/commands.js | 5 ++ common/content/completion.js | 5 ++ common/content/editor.js | 5 ++ common/content/events.js | 8 ++ common/content/find.js | 5 ++ common/content/hints.js | 5 ++ common/content/io.js | 7 +- common/content/liberator.js | 2 + common/content/mappings.js | 5 ++ common/content/modes.js | 2 + common/content/options.js | 5 ++ common/content/style.js | 155 ++++++++++++++++++++--------------- common/content/tabs.js | 2 + common/content/template.js | 3 + common/content/ui.js | 2 + common/content/util.js | 2 + 17 files changed, 285 insertions(+), 85 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 0843ecb6..81b75a68 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -26,8 +26,16 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + const Point = new Struct("x", "y"); +/** + * A class to manage the primary web content buffer. The name comes + * from vim's term, 'buffer', which signifies instances of open + * files. + * @instance buffer + */ function Buffer() //{{{ { //////////////////////////////////////////////////////////////////////////////// @@ -809,6 +817,10 @@ function Buffer() //{{{ return { + /** + * The alternative stylesheets for the current buffer. Only + * returns stylesheets for the 'screen' media type. + */ get alternateStyleSheets() { let stylesheets = window.getAllStyleSheets(window.content); @@ -818,9 +830,18 @@ function Buffer() //{{{ ); }, + /** + * @property {Object} A map of page info sections to their + * content generating functions. + */ get pageInfo() pageInfo, - // 0 if loading, 1 if loaded or 2 if load failed + /** + * Returns whether the buffer is loaded. Values may be: + * 0 - Loading. + * 1 - Fully loaded. + * 2 - Load failed. + */ get loaded() { if (window.content.document.pageIsFullyLoaded !== undefined) @@ -833,7 +854,10 @@ function Buffer() //{{{ window.content.document.pageIsFullyLoaded = value; }, - // used to keep track of the right field for "gi" + /** + * The last focused input field in the buffer. Used by the + * "gi" key binding. + */ get lastInputField() { if (window.content.document.lastInputField) @@ -846,6 +870,9 @@ function Buffer() //{{{ window.content.document.lastInputField = value; }, + /** + * The current top-level document's URL. + */ get URL() { return window.content.document.location.href; @@ -856,6 +883,10 @@ function Buffer() //{{{ return window.content.innerHeight; }, + /** + * The current browser's text zoom level, as a percentage with + * 100 as 'normal'. Only affects text size. + */ get textZoom() { return getBrowser().markupDocumentViewer.textZoom * 100; @@ -865,6 +896,11 @@ function Buffer() //{{{ setZoom(value, false); }, + /** + * The current browser's text zoom level, as a percentage with + * 100 as 'normal'. Affects text size, as well as image size + * and block size. + */ get fullZoom() { return getBrowser().markupDocumentViewer.fullZoom * 100; @@ -874,14 +910,37 @@ function Buffer() //{{{ setZoom(value, true); }, + /** + * The current document's title. + */ get title() { return window.content.document.title; }, + /** + * + * @param {string} option The section's value in 'pageinfo'. + * @param {string} title The heading for this section's + * output. + * @param {function} fn The function to generate this + * section's output. + */ addPageInfoSection: addPageInfoSection, - // returns an XPathResult object + /** + * Evaluates an XPath expression in the current or provided + * document. It provides the xhtml and liberator XML + * namespaces. The result may be used as an iterator. + * + * @param {string} expression The XPath expression to evaluate. + * @param {Document} doc The document to evaluate the expression in. + * @default The current document. + * @param {Node} elem The context element. + * @default doc + * @param {boolean} asIterator Whether to return the results as an XPath + * iterator. + */ evaluateXPath: function (expression, doc, elem, asIterator) { if (!doc) @@ -892,15 +951,10 @@ function Buffer() //{{{ let result = doc.evaluate(expression, elem, function lookupNamespaceURI(prefix) { - switch (prefix) - { - case "xhtml": - return "http://www.w3.org/1999/xhtml"; - case "liberator": - return NS.uri; - default: - return null; - } + return { + xhtml: "http://www.w3.org/1999/xhtml", + liberator: NS.uri + }[prefix] || null; }, asIterator ? XPathResult.ORDERED_NODE_ITERATOR_TYPE : XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null @@ -913,9 +967,13 @@ function Buffer() //{{{ return result; }, - // in contrast to vim, returns the selection if one is made, - // otherwise tries to guess the current word under the text cursor - // NOTE: might change the selection + /** + * Returns the currently selected word. If the selection is + * null, it tries to guess the word that the caret is + * positioned in. + * + * NOTE: might change the selection + */ // FIXME: getSelection() doesn't always preserve line endings, see: // https://www.mozdev.org/bugs/show_bug.cgi?id=19303 getCurrentWord: function () @@ -937,8 +995,13 @@ function Buffer() //{{{ return String(selection); }, - // more advanced than a simple elem.focus() as it also works for iframes - // and image maps + /** + * Focuses the given element. In contrast to a simple + * elem.focus() call, this function works for iframes and + * image maps. + * + * @param {Node} elem The element to focus. + */ // TODO: merge with followLink()? focusElement: function (elem) { @@ -963,6 +1026,17 @@ function Buffer() //{{{ elem.dispatchEvent(evt); }, + /** + * Try to guess links the like of "next" and "prev". Though it + * has a singularly horrendous name, it turns out to be quite + * useful. + * + * @param {string} rel The relationship to look for. Looks for + * links with matching @rel or @rev attributes, and, + * failing that, looks for an option named rel + + * "pattern", and finds the last link matching that + * RegExp. + */ followDocumentRelationship: function (rel) { let regexps = options.get(rel + "pattern").values @@ -1019,7 +1093,13 @@ function Buffer() //{{{ liberator.beep(); }, - // artificially "clicks" a link in order to open it + /** + * Fakes a click on a link. + * + * @param {Node} elem The element to click. + * @param {number} where Where to open the link. See + * {@link liberator.open}. + */ followLink: function (elem, where) { let doc = elem.ownerDocument; @@ -1067,6 +1147,9 @@ function Buffer() //{{{ }); }, + /** + * The current document's selection controller. + */ get selectionController() getBrowser().docShell .QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsISelectionDisplay) @@ -1091,11 +1174,19 @@ function Buffer() //{{{ } }, + /** + * Scrolls to the bottom of the current buffer. + */ scrollBottom: function () { scrollToPercentiles(-1, 100); }, + /** + * Scrolls the window laterally cols columns. + * + * @param {number} cols The number of columns to scroll. + */ scrollColumns: function (cols) { let win = findScrollableWindow(); @@ -1107,11 +1198,19 @@ function Buffer() //{{{ win.scrollBy(COL_WIDTH * cols, 0); }, + /** + * Scrolls the buffer to its rightmost position. + */ scrollEnd: function () { scrollToPercentiles(100, -1); }, + /** + * Scrolls the buffer vertically lines rows. + * + * @param {number} lines The number of lines to scroll. + */ scrollLines: function (lines) { let win = findScrollableWindow(); @@ -1119,6 +1218,11 @@ function Buffer() //{{{ win.scrollByLines(lines); }, + /** + * Scrolls the buffer vertically pages pages. + * + * @param {number} pages The number of pages to scroll. + */ scrollPages: function (pages) { let win = findScrollableWindow(); @@ -1140,6 +1244,9 @@ function Buffer() //{{{ win.scrollBy(0, win.innerHeight / 2 * direction); }, + /** + * Scrolls the current buffer vertically to percentage + */ scrollToPercentile: function (percentage) { scrollToPercentiles(-1, percentage); @@ -1156,11 +1263,17 @@ function Buffer() //{{{ content.scrollTo(x, y); }, + /** + * Scrolls the current buffer laterally to its leftmost. + */ scrollStart: function () { scrollToPercentiles(0, -1); }, + /** + * Scrolls the current buffer vertically to its top. + */ scrollTop: function () { scrollToPercentiles(-1, 0); @@ -1322,6 +1435,9 @@ function Buffer() //{{{ //}}} }; //}}} +/** + * @instance marks + */ function Marks() //{{{ { //////////////////////////////////////////////////////////////////////////////// diff --git a/common/content/commands.js b/common/content/commands.js index 7486d344..d357918d 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -26,6 +26,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + // Do NOT create instances of this class yourself, use the helper method // commands.add() instead function Command(specs, description, action, extraInfo) //{{{ @@ -147,6 +149,9 @@ Command.prototype = { }; //}}} +/** + * @instance commands + */ function Commands() //{{{ { //////////////////////////////////////////////////////////////////////////////// diff --git a/common/content/completion.js b/common/content/completion.js index f9ddee03..2c119f95 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -26,6 +26,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + /** * Creates a new completion context. * @@ -647,6 +649,9 @@ CompletionContext.prototype = { } }; //}}} +/** + * @instance completion + */ function Completion() //{{{ { //////////////////////////////////////////////////////////////////////////////// diff --git a/common/content/editor.js b/common/content/editor.js index 6219a4ea..5c9ffedb 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -26,9 +26,14 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + // command names taken from: // http://developer.mozilla.org/en/docs/Editor_Embedding_Guide +/** + * @instance editor + */ function Editor() //{{{ { //////////////////////////////////////////////////////////////////////////////// diff --git a/common/content/events.js b/common/content/events.js index c477cb80..3009eee6 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -26,6 +26,11 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + +/** + * @instance autocommands + */ function AutoCommands() //{{{ { //////////////////////////////////////////////////////////////////////////////// @@ -277,6 +282,9 @@ function AutoCommands() //{{{ //}}} }; //}}} +/** + * @instance events + */ function Events() //{{{ { //////////////////////////////////////////////////////////////////////////////// diff --git a/common/content/find.js b/common/content/find.js index 923426f5..72c77388 100644 --- a/common/content/find.js +++ b/common/content/find.js @@ -26,6 +26,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + // TODO: proper backwards search - implement our own component? // : implement our own highlighter? // : frameset pages @@ -37,6 +39,9 @@ the terms of any one of the MPL, the GPL or the LGPL. // : incremental searches shouldn't permanently update search modifiers // make sure you only create this object when the "liberator" object is ready +/** + * @instance search + */ function Search() //{{{ { //////////////////////////////////////////////////////////////////////////////// diff --git a/common/content/hints.js b/common/content/hints.js index 90c7e14f..38f36436 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -26,6 +26,11 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + +/** + * @instance hints + */ function Hints() //{{{ { //////////////////////////////////////////////////////////////////////////////// diff --git a/common/content/io.js b/common/content/io.js index 136b2b13..ba62b137 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -27,6 +27,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + plugins.contexts = {}; function Script(file) { @@ -52,6 +54,9 @@ function Script(file) Script.prototype = plugins; // TODO: why are we passing around strings rather than file objects? +/** + * @instance io + */ function IO() //{{{ { //////////////////////////////////////////////////////////////////////////////// @@ -838,7 +843,7 @@ lookup: } else if (/\.css$/.test(filename)) { - storage.styles.registerSheet(uri.spec, !silent, true); + storage.styles.registerSheet(uri.spec, true); } else { diff --git a/common/content/liberator.js b/common/content/liberator.js index e5c8cfa8..015adf07 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -26,6 +26,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + const Cc = Components.classes; const Ci = Components.interfaces; const Cr = Components.results; diff --git a/common/content/mappings.js b/common/content/mappings.js index 7e35b115..d409ba79 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -26,6 +26,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + // Do NOT create instances of this class yourself, use the helper method // mappings.add() instead function Map(modes, cmds, description, action, extraInfo) //{{{ @@ -76,6 +78,9 @@ Map.prototype = { }; //}}} +/** + * @instance mappings + */ function Mappings() //{{{ { //////////////////////////////////////////////////////////////////////////////// diff --git a/common/content/modes.js b/common/content/modes.js index 0159dd24..e79a67f4 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -26,6 +26,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + const modes = (function () //{{{ { //////////////////////////////////////////////////////////////////////////////// diff --git a/common/content/options.js b/common/content/options.js index 6373dcb6..a1844a5f 100644 --- a/common/content/options.js +++ b/common/content/options.js @@ -26,6 +26,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + // do NOT create instances of this class yourself, use the helper method // options.add() instead function Option(names, description, type, defaultValue, extraInfo) //{{{ @@ -293,6 +295,9 @@ Option.validateCompleter = function (values) function (value) res.some(function (item) item[0] == value)); }; //}}} +/** + * @instance options + */ function Options() //{{{ { //////////////////////////////////////////////////////////////////////////////// diff --git a/common/content/style.js b/common/content/style.js index 62c14ef2..d2ef4d57 100644 --- a/common/content/style.js +++ b/common/content/style.js @@ -6,6 +6,19 @@ it under any or all of those licenseses. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + +/** + * @constant + * @property {string} The default highlighting rules. They have the + * form: + * rule ::= selector space css + * selector ::= group + * | group "," css-selector + * | group "," css-selector "," scope + * group ::= groupname + * | groupname css-selector + */ // Highlights.prototype.CSS = .toString(); +/** + * A class to manage highlighting rules. The parameters are the + * standard paramaters for any {@link Storage} object. + * + * @author Kris Maglione + */ function Highlights(name, store, serial) { var self = this; @@ -161,25 +180,35 @@ function Highlights(name, store, serial) .replace(";!important;", ";", "g"); // Seeming Spidermonkey bug css = style.selector + " { " + css + " }"; - let error = styles.addSheet(style.selector, style.filter, css, true, force); + let error = styles.addSheet(style.selector, style.filter, css, true); if (error) return error; style.value = newStyle; highlight[style.class] = style; }; + /** + * Gets a CSS selector given a highlight group. + */ this.selector = function (class) { let [, hl, rest] = class.match(/^(\w*)(.*)/); return "[liberator|highlight~=" + hl + "]" + rest }; + /** + * Clears all highlighting rules. Rules with default values are + * reset. + */ this.clear = function () { for (let [k, v] in Iterator(highlight)) this.set(k, null, true); }; + /** + * Reloads the values in {@link #CSS}. + */ this.reload = function () { this.CSS.replace(/\{((?:.|\n)*?)\}/g, function (_, _1) _1.replace(/\n\s*/g, " ")) @@ -203,6 +232,13 @@ function Highlights(name, store, serial) }; } +/** + * Manages named and unnamed user stylesheets, which apply to both + * chrome and content pages. The parameters are the standard + * paramaters for any {@link Storage} object. + * + * @author Kris Maglione + */ function Styles(name, store, serial) { /* Can't reference liberator or Components inside Styles -- @@ -233,7 +269,20 @@ function Styles(name, store, serial) this.__defineGetter__("systemNames", function () Iterator(systemNames)); this.__defineGetter__("userNames", function () Iterator(userNames)); - this.addSheet = function (name, filter, css, system, force) + /** + * Add a new stylesheet. + * + * @param {string} name The name given to the stylesheet by + * which it may be later referenced. + * @param {string} filter The sites to which this sheet will + * apply. Can be a domain name or a URL. Any URL ending in + * "*" is matched as a prefix. + * @param {string} css The CSS to be applied. + * @param {boolean} system Declares whether this is a system or + * user sheet. System sheets are used internally by + * @liberator. + */ + this.addSheet = function (name, filter, css, system) { let sheets = system ? systemSheets : userSheets; let names = system ? systemNames : userNames; @@ -249,7 +298,7 @@ function Styles(name, store, serial) sheet.ref = []; try { - this.registerSheet(cssUri(wrapCSS(sheet)), !force); + this.registerSheet(cssUri(wrapCSS(sheet))); this.registerAgentSheet(cssUri(wrapCSS(sheet))) } catch (e) @@ -266,6 +315,10 @@ function Styles(name, store, serial) return null; }; + /** + * Find sheets matching the parameters. See {@link #addSheet} + * for parameters. + */ this.findSheets = function (name, filter, css, index, system) { let sheets = system ? systemSheets : userSheets; @@ -284,6 +337,12 @@ function Styles(name, store, serial) return matches.map(function (i) sheets[i]); }; + /** + * Remove a stylesheet. See {@link #addSheet} for parameters. + * In cases where filter is supplied, the given filters + * are removed from matching sheets. If any remain, the sheet is + * left in place. + */ this.removeSheet = function (name, filter, css, index, system) { let self = this; @@ -326,11 +385,15 @@ function Styles(name, store, serial) return matches.length; }; - this.registerSheet = function (uri, doCheckSyntax, reload) + /** + * Register a user stylesheet at the given URI. + * + * @param {string} uri The UrI of the sheet to register. + * @param {boolean} reload Whether to reload any sheets that are + * already registered. + */ + this.registerSheet = function (uri, reload) { - //dump (uri + "\n\n"); - if (doCheckSyntax) - checkSyntax(uri); if (reload) this.unregisterSheet(uri); uri = ios.newURI(uri, null, null); @@ -338,6 +401,9 @@ function Styles(name, store, serial) sss.loadAndRegisterSheet(uri, sss.USER_SHEET); }; + /** + * Unregister a sheet at the given URI. + */ this.unregisterSheet = function (uri) { uri = ios.newURI(uri, null, null); @@ -346,6 +412,10 @@ function Styles(name, store, serial) }; // FIXME + /** + * Register an agent stylesheet. + * @deprecated + */ this.registerAgentSheet = function (uri) { this.unregisterAgentSheet(uri); @@ -353,6 +423,10 @@ function Styles(name, store, serial) sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET); }; + /** + * Unregister an agent stylesheet. + * @deprecated + */ this.unregisterAgentSheet = function (uri) { uri = ios.newURI(uri, null, null); @@ -373,65 +447,6 @@ function Styles(name, store, serial) .join(", "); return namespace + "@-moz-document " + selectors + "{\n" + css + "\n}\n"; } - - let queryinterface = XPCOMUtils.generateQI([Ci.nsIConsoleListener]); - /* What happens if more than one thread tries to use this? */ - let testDoc = document.implementation.createDocument(XHTML, "doc", null); - function checkSyntax(uri) - { - let errors = []; - let listener = { - QueryInterface: queryinterface, - observe: function (message) - { - try - { - message = message.QueryInterface(Ci.nsIScriptError); - if (message.sourceName == uri) - errors.push(message); - } - catch (e) {} - } - }; - - try - { - consoleService.registerListener(listener); - if (testDoc.documentElement.firstChild) - testDoc.documentElement.removeChild(testDoc.documentElement.firstChild); - testDoc.documentElement.appendChild(util.xmlToDom( - , testDoc)); - - while (true) - { - try - { - // Throws NS_ERROR_DOM_INVALID_ACCESS_ERR if not finished loading - testDoc.styleSheets[0].cssRules.length; - break; - } - catch (e) - { - if (e.name != "NS_ERROR_DOM_INVALID_ACCESS_ERR") - return [e.toString()]; - sleep(10); - } - } - } - finally - { - consoleService.unregisterListener(listener); - } - if (errors.length) - { - let err = new Error("", errors[0].sourceName.replace(/^(chrome-data:text\/css,).*/, "$1..."), errors[0].lineNumber); - err.name = "CSSError"; - err.message = errors.reduce(function (msg, e) msg + "; " + e.lineNumber + ": " + e.errorMessage, - errors.shift().errorMessage); - err.echoerr = err.fileName + ":" + err.lineNumber + ": " + err.message; - throw err; - } - } } let (array = util.Array) { @@ -440,8 +455,16 @@ let (array = util.Array) }; } +/** + * @property {Styles} + */ const styles = storage.newObject("styles", Styles, false); + +/** + * @property {Highlights} + */ const highlight = storage.newObject("highlight", Highlights, false); + highlight.CSS = Highlights.prototype.CSS; highlight.reload(); diff --git a/common/content/tabs.js b/common/content/tabs.js index 4e8512f2..fd3c6a24 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -26,6 +26,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + // TODO: many methods do not work with Thunderbird correctly yet function Tabs() //{{{ diff --git a/common/content/template.js b/common/content/template.js index 7b937537..0f7a08a3 100644 --- a/common/content/template.js +++ b/common/content/template.js @@ -1,3 +1,6 @@ + +/** @scope modules */ + const template = { add: function add(a, b) a + b, join: function join(c) function (a, b) a + c + b, diff --git a/common/content/ui.js b/common/content/ui.js index 56fd1852..f046cce6 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -26,6 +26,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + /* * This class is used for prompting of user input and echoing of messages * diff --git a/common/content/util.js b/common/content/util.js index d6499e57..3d3995f4 100644 --- a/common/content/util.js +++ b/common/content/util.js @@ -26,6 +26,8 @@ the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. }}} ***** END LICENSE BLOCK *****/ +/** @scope modules */ + const XHTML = "http://www.w3.org/1999/xhtml"; const NS = Namespace("liberator", "http://vimperator.org/namespaces/liberator"); default xml namespace = XHTML; From c51e3e4707e7c9065817fef5ccf42fff247516c8 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 19 Dec 2008 14:57:34 -0500 Subject: [PATCH 028/143] Make sure that the hint number is in the viewport --- common/content/events.js | 81 ++++++++++++++++++++-------------------- common/content/hints.js | 4 +- common/content/util.js | 9 +++++ 3 files changed, 51 insertions(+), 43 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 3009eee6..c1432bbe 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1201,52 +1201,51 @@ function Events() //{{{ // global escape handler, is called in ALL modes onEscape: function () { - if (!modes.passNextKey) + if (modes.passNextKey) + return; + if (modes.passAllKeys) { - if (modes.passAllKeys) - { - modes.passAllKeys = false; - return; - } + modes.passAllKeys = false; + return; + } - switch (liberator.mode) - { - case modes.NORMAL: - // clear any selection made - let selection = window.content.getSelection(); - try - { // a simple if (selection) does not seem to work - selection.collapseToStart(); - } - catch (e) {} + switch (liberator.mode) + { + case modes.NORMAL: + // clear any selection made + let selection = window.content.getSelection(); + try + { // a simple if (selection) does not seem to work + selection.collapseToStart(); + } + catch (e) {} + modes.reset(); + break; + + case modes.VISUAL: + if (modes.extended & modes.TEXTAREA) + liberator.mode = modes.TEXTAREA; + else if (modes.extended & modes.CARET) + liberator.mode = modes.CARET; + break; + + case modes.CARET: + // setting this option will trigger an observer which will + // care about all other details like setting the NORMAL mode + options.setPref("accessibility.browsewithcaret", false); + break; + + case modes.INSERT: + if ((modes.extended & modes.TEXTAREA) && !options["insertmode"]) + liberator.mode = modes.TEXTAREA; + else modes.reset(); - break; + break; - case modes.VISUAL: - if (modes.extended & modes.TEXTAREA) - liberator.mode = modes.TEXTAREA; - else if (modes.extended & modes.CARET) - liberator.mode = modes.CARET; - break; - - case modes.CARET: - // setting this option will trigger an observer which will - // care about all other details like setting the NORMAL mode - options.setPref("accessibility.browsewithcaret", false); - break; - - case modes.INSERT: - if ((modes.extended & modes.TEXTAREA) && !options["insertmode"]) - liberator.mode = modes.TEXTAREA; - else - modes.reset(); - break; - - default: // HINTS, CUSTOM or COMMAND_LINE - modes.reset(); - break; - } + default: // HINTS, CUSTOM or COMMAND_LINE + modes.reset(); + break; } }, diff --git a/common/content/hints.js b/common/content/hints.js index 38f36436..511e1894 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -154,8 +154,8 @@ function Hints() //{{{ text = elem.textContent.toLowerCase(); span = baseNodeAbsolute.cloneNode(true); - span.style.left = (rect.left + scrollX) + "px"; - span.style.top = (rect.top + scrollY) + "px"; + span.style.left = Math.max((rect.left + scrollX), scrollX) + "px"; + span.style.top = Math.max((rect.top + scrollY), scrollY) + "px"; fragment.appendChild(span); pageHints.push([elem, text, span, null, elem.style.backgroundColor, elem.style.color]); diff --git a/common/content/util.js b/common/content/util.js index 3d3995f4..cf5bdcb3 100644 --- a/common/content/util.js +++ b/common/content/util.js @@ -311,6 +311,15 @@ const util = { //{{{ identity: function identity(k) k, + intersection: function (r1, r2) ({ + get width() this.right - this.left, + get height() this.bottom - this.top, + left: Math.max(r1.left, r2.left), + right: Math.min(r1.right, r2.right), + top: Math.max(r1.top, r2.top), + bottom: Math.min(r1.bottom, r2.bottom) + }), + map: function map(obj, fn) { let ary = []; From 20265324bcf50bfc2983fc093703753e59e22c6a Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 19 Dec 2008 15:00:52 -0500 Subject: [PATCH 029/143] Fix ;f --- common/content/hints.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/hints.js b/common/content/hints.js index 511e1894..283e153b 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -66,7 +66,7 @@ function Hints() //{{{ const hintModes = { ";": Mode("Focus hint", function (elem) buffer.focusElement(elem), extended), a: Mode("Save hint with prompt", function (elem) buffer.saveLink(elem, false)), - f: Mode("Focus frame", function (elem) elem.ownerDocument.defaultView.focus(), function () "//body | //html|body"), + f: Mode("Focus frame", function (elem) elem.ownerDocument.defaultView.focus(), function () "//body | //xhtml:body"), s: Mode("Save hint", function (elem) buffer.saveLink(elem, true)), o: Mode("Follow hint", function (elem) buffer.followLink(elem, liberator.CURRENT_TAB)), t: Mode("Follow hint in a new tab", function (elem) buffer.followLink(elem, liberator.NEW_TAB)), From 2c6015837f218bec1b9c41e0e780488f9d8314e6 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 19 Dec 2008 15:12:38 -0500 Subject: [PATCH 030/143] Fix g<, sort-of. Fix some commandline.echo quirks, as well. --- common/content/ui.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/content/ui.js b/common/content/ui.js index f046cce6..bd5a8dfa 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -568,10 +568,10 @@ function CommandLine() //{{{ * after interpolated data. */ XML.ignoreWhitespace = typeof str != "xml"; - let output = util.xmlToDom(
{template.maybeXML(str)}
, doc); + lastMowOutput =
{template.maybeXML(str)}
; + let output = util.xmlToDom(lastMowOutput, doc); XML.ignoreWhitespace = true; - lastMowOutput = output; // FIXME: need to make sure an open MOW is closed when commands // that don't generate output are executed @@ -778,8 +778,7 @@ function CommandLine() //{{{ function () { if (lastMowOutput) - commandline.echo(lastMowOutput, - commandline.HL_NORMAL, commandline.FORCE_MULTILINE); + echoMultiline(lastMowOutput, commandline.HL_NORMAL); else liberator.beep(); }); @@ -997,7 +996,10 @@ function CommandLine() //{{{ let action = echoLine; if (!single && (!outputContainer.collapsed || messageBox.value == lastEcho)) + { + highlightGroup += " Message"; action = echoMultiline; + } if ((flags & this.FORCE_MULTILINE) || (/\n/.test(str) || typeof str == "xml") && !(flags & this.FORCE_SINGLELINE)) action = echoMultiline; From 313136a1f8ad8066ea5261e2baf12d7334b9d09d Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 24 Dec 2008 13:22:54 -0500 Subject: [PATCH 031/143] Cleanup io.js with relation to path separators --- common/content/completion.js | 2 +- common/content/io.js | 33 ++++++++++++++------------------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/common/content/completion.js b/common/content/completion.js index 60dc0af6..34ed8c5c 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1393,7 +1393,7 @@ function Completion() //{{{ // TODO: use path for the description? io.getRuntimeDirectories("colors").forEach(function (dir) { context.fork(dir.path, 0, null, function (context) { - context.filter = dir.path + io.pathSeparator + context.filter; + context.filter = dir.path + IO.PATH_SEP + context.filter; completion.file(context); context.title = ["Color Scheme"]; context.quote = ["", function (text) text.replace(/\.vimp$/, ""), ""]; diff --git a/common/content/io.js b/common/content/io.js index de7eb73e..8a5ea056 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -104,12 +104,7 @@ function IO() //{{{ .map(function (dir) dir == "" ? io.getCurrentDirectory().path : dir); } - function replacePathSep(path) - { - if (WINDOWS) - return path.replace("/", "\\"); - return path; - } + function replacePathSep(path) path.replace("/", IO.PATH_SEP, "g"); function joinPaths(head, tail) { @@ -272,7 +267,7 @@ function IO() //{{{ function (args) { // TODO: "E172: Only one file name allowed" - let filename = args[0] || "~/" + (WINDOWS ? "_" : ".") + EXTENSION_NAME + "rc"; + let filename = args[0] || io.getRCFile(null, true).path; let file = io.getFile(filename); if (file.exists() && !args.bang) @@ -404,8 +399,6 @@ function IO() //{{{ sourcing: null, - pathSeparator: WINDOWS ? "\\" : "/", - expandPath: IO.expandPath, // TODO: there seems to be no way, short of a new component, to change @@ -456,7 +449,7 @@ function IO() //{{{ return dirs; }, - getRCFile: function (dir) + getRCFile: function (dir, always) { dir = dir || "~"; @@ -470,8 +463,9 @@ function IO() //{{{ return rcFile1; else if (rcFile2.exists() && rcFile2.isFile()) return rcFile2; - else - return null; + else if (always) + return rcFile1; + return null; }, // return a nsILocalFile for path where you can call isDirectory(), etc. on @@ -921,15 +915,19 @@ lookup: }; //}}} -IO.__defineGetter__("runtimePath", function () service["environment"].get(config.name.toUpperCase() + "_RUNTIME") || +IO.PATH_SEP = (function () { + let file = services.create("file"); + file.append("foo"); + return file.path[0]; +})(); + +IO.__defineGetter__("runtimePath", function () services.get("environment").get(config.name.toUpperCase() + "_RUNTIME") || "~/" + (liberator.has("Win32") ? "" : ".") + config.name.toLowerCase()); IO.expandPath = function (path, relative) { // TODO: proper pathname separator translation like Vim - this should be done elsewhere const WINDOWS = liberator.has("Win32"); - if (WINDOWS) - path = path.replace("/", "\\", "g"); // expand any $ENV vars - this is naive but so is Vim and we like to be compatible // TODO: Vim does not expand variables set to an empty string (and documents it). @@ -959,10 +957,7 @@ IO.expandPath = function (path, relative) // TODO: Vim expands paths twice, once before checking for ~, once // after, but doesn't document it. Is this just a bug? --Kris path = expand(path); - - // FIXME: Should we be doing this here? I think it should be done - // by the arg parser or nowhere. --Kris - return path.replace("\\ ", " ", "g"); + return path.replace("/", IO.PATH_SEP, "g"); }; // vim: set fdm=marker sw=4 ts=4 et: From 91d824b4a60747bfff7afc9bd9063034a27a7014 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 24 Dec 2008 14:21:20 -0500 Subject: [PATCH 032/143] Fix io.js --- common/content/io.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/content/io.js b/common/content/io.js index 02e17856..b87e1e6f 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -941,7 +941,8 @@ IO.expandPath = function (path, relative) path = expand(path); // expand ~ - if (!relative && (WINDOWS ? /^~(?:$|[\\\/])/ : /^~(?:$|\/)/).test(path)) + // Yuck. + if (!relative && RegExp("~(?:$|[/" + util.escapeRegex(IO.PATH_SEP) + "])").test(path)) { // Try $HOME first, on all systems let home = services.get("environment").get("HOME"); From d9b07c2ff6dde17ad17a66d2e5772ce8a3f9ca5e Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 15 Jan 2009 18:03:04 +1100 Subject: [PATCH 033/143] Set MY_VIMPERATORRC when sourcing the RC file on startup. --- common/content/liberator.js | 11 ++++++++--- vimperator/NEWS | 2 +- vimperator/locale/en-US/starting.txt | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/common/content/liberator.js b/common/content/liberator.js index dd5d396c..864472f0 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -1284,11 +1284,13 @@ const liberator = (function () //{{{ // TODO: we should have some class where all this guioptions stuff fits well hideGUI(); - // finally, read a ~/.vimperatorrc and plugin/**.{vimp,js} + // finally, read the RC file and source plugins // make sourcing asynchronous, otherwise commands that open new tabs won't work setTimeout(function () { - let init = services.get("environment").get(config.name.toUpperCase() + "_INIT"); + let extensionName = config.name.toUpperCase(); + let init = services.get("environment").get(extensionName + "_INIT"); + if (init) liberator.execute(init); else @@ -1296,7 +1298,10 @@ const liberator = (function () //{{{ let rcFile = io.getRCFile("~"); if (rcFile) + { io.source(rcFile.path, true); + services.get("environment").set("MY_" + extensionName + "RC", rcFile.path); + } else liberator.log("No user RC file found", 3); } @@ -1313,7 +1318,7 @@ const liberator = (function () //{{{ // after sourcing the initialization files, this function will set // all gui options to their default values, if they have not been - // set before by any rc file + // set before by any RC file for (let option in options) { if (option.setter) diff --git a/vimperator/NEWS b/vimperator/NEWS index dc72df66..200d56e0 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -22,7 +22,7 @@ * IMPORTANT: $VIMPERATOR_HOME is no longer used. * Added ~/.vimperator/info/{profile}/, similar to viminfo - * added $VIMPERATOR_RUNTIME, $VIMPERATOR_INIT + * add $VIMPERATOR_RUNTIME, $VIMPERATOR_INIT and $MY_VIMPERATORRC * :hardcopy now supports output redirection to a file on Unix and MacUnix * add ";f" extended hint mode to focus a frame * add "r", "l", and "b" to 'guioptions' to toggle the scrollbars. diff --git a/vimperator/locale/en-US/starting.txt b/vimperator/locale/en-US/starting.txt index 0e6d060d..5bbe7b97 100644 --- a/vimperator/locale/en-US/starting.txt +++ b/vimperator/locale/en-US/starting.txt @@ -14,8 +14,9 @@ At startup, Vimperator completes the following tasks in order. .. |$VIMPERATOR_INIT| _$VIMPERATOR_INIT_ -- May contain a single ex command (e.g., "[c]:source {file}[c]"). - .. [a]\~/_vimperatorrc[a] -- Windows only. If this file exists, its - contents are executed. + .. [a]\~/_vimperatorrc[a] -- Windows only. If this file exists, its + contents are executed and + _$MY_VIMPERATORRC_ set to its path. .. [a]\~/.vimperatorrc[a] -- If this file exists, its contents are executed. From 5e811785c2f816c6c04f838cc86f9892d17bb60e Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 15 Jan 2009 22:33:53 +1100 Subject: [PATCH 034/143] Mention the new :silent command in NEWS. --- vimperator/NEWS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vimperator/NEWS b/vimperator/NEWS index 200d56e0..2ddc16d3 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -21,7 +21,8 @@ * IMPORTANT: 'verbose' is now by default at 1, set to 0 to not show any status messages * IMPORTANT: $VIMPERATOR_HOME is no longer used. - * Added ~/.vimperator/info/{profile}/, similar to viminfo + * add :silent + * add ~/.vimperator/info/{profile}/, similar to viminfo * add $VIMPERATOR_RUNTIME, $VIMPERATOR_INIT and $MY_VIMPERATORRC * :hardcopy now supports output redirection to a file on Unix and MacUnix * add ";f" extended hint mode to focus a frame From 53f33e056143fa49a8909c6f34a10baded102930 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 17 Jan 2009 23:43:29 -0500 Subject: [PATCH 035/143] Allow ` as local mark --- common/content/buffer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index e23d4f9b..5c1631de 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1565,7 +1565,7 @@ function Marks() //{{{ } } - function isLocalMark(mark) /^['"a-z]$/.test(mark); + function isLocalMark(mark) /^['`a-z]$/.test(mark); function isURLMark(mark) /^[A-Z0-9]$/.test(mark); function localMarkIter() From eb4c5488b91b662f438df1acba9539176b404fcd Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 5 Feb 2009 11:51:44 +1100 Subject: [PATCH 036/143] Move the MY_VIMPERATORRC NEWS item to the 2.1 section. --- vimperator/NEWS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vimperator/NEWS b/vimperator/NEWS index 41428e93..65fb3371 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -1,6 +1,7 @@ 2009-XX-XX: * version 2.1 (probably) * add :silent + * add $MY_VIMPERATORRC 2008-XX-XX: * version 2.0 (probably) @@ -27,7 +28,7 @@ * [count] now goes to the [count]th next tab rather than the [count]th tab. * add ~/.vimperator/info/{profile}/, similar to viminfo - * add $VIMPERATOR_RUNTIME, $VIMPERATOR_INIT and $MY_VIMPERATORRC + * add $VIMPERATOR_RUNTIME, $VIMPERATOR_INIT * :hardcopy now supports output redirection to a file on Unix and MacUnix * add ";f" extended hint mode to focus a frame * add "r", "l", and "b" to 'guioptions' to toggle the scrollbars. From 62bc7fb9b56cebbbfc161e5decb330df7f61ef74 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 28 Feb 2009 22:17:59 +1100 Subject: [PATCH 037/143] Add "w" and "W" Normal mode mappings. These work just like o/O and t/T but for new windows. --- vimperator/NEWS | 2 ++ vimperator/content/config.js | 8 ++++++++ vimperator/locale/en-US/browsing.txt | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/vimperator/NEWS b/vimperator/NEWS index ccda9cde..851be046 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -2,6 +2,8 @@ * version 2.1 (probably) * add :silent * add $MY_VIMPERATORRC + * add ' and " local marks + * add "w" and "W" Normal mode mappings for symmetry with o/O and t/T 2008-XX-XX: * version 2.0 (probably) diff --git a/vimperator/content/config.js b/vimperator/content/config.js index 1a37841a..0e8aa67c 100644 --- a/vimperator/content/config.js +++ b/vimperator/content/config.js @@ -210,6 +210,14 @@ const config = { //{{{ "Open one or more URLs in a new tab, based on current location", function () { commandline.open(":", "tabopen " + buffer.URL, modes.EX); }); + mappings.add([modes.NORMAL], ["w"], + "Open one or more URLs in a new window", + function () { commandline.open(":", "winopen ", modes.EX); }); + + mappings.add([modes.NORMAL], ["W"], + "Open one or more URLs in a new window, based on current location", + function () { commandline.open(":", "winopen " + buffer.URL, modes.EX); }); + mappings.add([modes.NORMAL], [""], "Increment last number in URL", function (count) { incrementURL(count > 1 ? count : 1); }, diff --git a/vimperator/locale/en-US/browsing.txt b/vimperator/locale/en-US/browsing.txt index 9b44fa8a..b8cd0b45 100644 --- a/vimperator/locale/en-US/browsing.txt +++ b/vimperator/locale/en-US/browsing.txt @@ -102,11 +102,20 @@ ________________________________________________________________________________ |:winopen| |:wopen| |:winedit| ||:wino[pen][!] [a][arg1][a], [a][arg2][a], ...|| + +||w|| ________________________________________________________________________________ Just like [c]:tabopen[c] but opens the resulting web page(s) in a new window. ________________________________________________________________________________ +|W| + +||W|| +________________________________________________________________________________ +Open one or more URLs in a new window based on current location. Works like +[m]w[m] but preselects current URL in the [c]:winopen[c] query. +________________________________________________________________________________ + + || |p| + ||p|| ________________________________________________________________________________ From 13da8c45191205627e1ae006aa54d1dc9e7407e0 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 11 Mar 2009 01:02:12 +1100 Subject: [PATCH 038/143] Add new :messclear command to clear the message history. --- common/content/ui.js | 10 ++++++++++ vimperator/NEWS | 1 + vimperator/locale/en-US/index.txt | 1 + vimperator/locale/en-US/message.txt | 7 +++++++ 4 files changed, 19 insertions(+) diff --git a/common/content/ui.js b/common/content/ui.js index b358aacd..a79f37e1 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -58,6 +58,11 @@ function CommandLine() //{{{ get length() this._messages.length, + clear: function clear() + { + this._messages = []; + }, + add: function add(message) { if (!message) @@ -975,6 +980,11 @@ function CommandLine() //{{{ }, { argCount: "0" }); + commands.add(["messc[lear]"], + "Clear the message history", + function () { messageHistory.clear(); }, + { argCount: "0" }); + commands.add(["sil[ent]"], "Run a command silently", function (args) diff --git a/vimperator/NEWS b/vimperator/NEWS index 851be046..63124c28 100644 --- a/vimperator/NEWS +++ b/vimperator/NEWS @@ -4,6 +4,7 @@ * add $MY_VIMPERATORRC * add ' and " local marks * add "w" and "W" Normal mode mappings for symmetry with o/O and t/T + * add :messclear 2008-XX-XX: * version 2.0 (probably) diff --git a/vimperator/locale/en-US/index.txt b/vimperator/locale/en-US/index.txt index 5a6a2fbb..9651529c 100644 --- a/vimperator/locale/en-US/index.txt +++ b/vimperator/locale/en-US/index.txt @@ -203,6 +203,7 @@ section:Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:mark[c]|| Mark current location within the web page + ||[c]:marks[c]|| Show all location marks of current web page + ||[c]:messages[c]|| Display previously given messages + +||[c]:messclear[c]|| Clear the message history + ||[c]:mkvimperatorrc[c]|| Write current key mappings and changed options to the config file + ||[c]:nohlsearch[c]|| Remove the search highlighting + ||[c]:noremap[c]|| Map a key sequence without remapping keys + diff --git a/vimperator/locale/en-US/message.txt b/vimperator/locale/en-US/message.txt index 99c1d723..f7c18f9b 100644 --- a/vimperator/locale/en-US/message.txt +++ b/vimperator/locale/en-US/message.txt @@ -12,6 +12,13 @@ Display previously given messages. ________________________________________________________________________________ +|:messc| |:messclear| + +||:messc[lear]|| +________________________________________________________________________________ +Clear the message history. +________________________________________________________________________________ + + |g<| + ||g<|| ________________________________________________________________________________ From 431743b907b6d8092d6a250b028c19e18f7f0870 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 19 Mar 2009 00:06:45 +1100 Subject: [PATCH 039/143] Fix removal of duplicates from getAlbums() return value. --- xulmus/content/player.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index bcce7090..90f43460 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -189,7 +189,7 @@ function getAlbums(artist) i++; } - return util.Array.uniq(albumArray); + return util.Array.uniq(albumArray.map(String)); } function getTracks(artist,album) From 5329080b24d1daa82ed640f6f8932c1a58efceca Mon Sep 17 00:00:00 2001 From: kenneslin Date: Thu, 19 Mar 2009 03:07:16 +0530 Subject: [PATCH 040/143] Added some media mappings, edited the getAlbums() function, renamed :playmedia to :filter and context titles in autocompletions --- common/content/completion.js | 9 ++++ xulmus/content/player.js | 93 +++++++++++++++++++++++++++--------- 2 files changed, 80 insertions(+), 22 deletions(-) diff --git a/common/content/completion.js b/common/content/completion.js index 3135db74..2a82a54c 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1393,11 +1393,20 @@ function Completion() //{{{ song: function song(context, args) { if (args.completeArg == 0) + { + context.title = ["Artists"]; context.completions = getArtists(); + } else if (args.completeArg == 1) + { + context.title = ["Albums by "+args[0]]; context.completions = getAlbums(args[0]); + } else if (args.completeArg == 2) + { + context.title = ["Tracks from "+args[1]+" by "+args[0]]; context.completions = getTracks(args[0],args[1]); + } }, buffer: function buffer(context) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 90f43460..10611bf4 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -51,10 +51,10 @@ function Player() // {{{ }); mappings.add([modes.PLAYER], - ["l"], "Play Media", + ["f"], "Filter Library", function () { - commandline.open(":", "playmedia ", modes.EX); + commandline.open(":", "filter ", modes.EX); }); mappings.add([modes.PLAYER], @@ -88,12 +88,52 @@ function Player() // {{{ } }); - /////////////////////////////////////////////////////////////////////////////}}} + mappings.add([modes.PLAYER], + ["h"], "Seek -10s", + function () + { + if (gMM.playbackControl.position >= 10000) + gMM.playbackControl.position = gMM.playbackControl.position - 10000; + else + gMM.playbackControl.position = 0; + }); + + mappings.add([modes.PLAYER], + ["l"], "Seek +10s", + function () + { + if ((gMM.playbackControl.duration - gMM.playbackControl.position) >= 10000) + gMM.playbackControl.position = gMM.playbackControl.position + 10000; + else + gMM.playbackControl.position = gMM.playbackControl.duration; + }); + + mappings.add([modes.PLAYER], + ["H"], "Seek -1m", + function () + { + if (gMM.playbackControl.position >= 60000) + gMM.playbackControl.position = gMM.playbackControl.position - 60000; + else + gMM.playbackControl.position = 0; + }); + + mappings.add([modes.PLAYER], + ["L"], "Seek +1m", + function () + { + if ((gMM.playbackControl.duration - gMM.playbackControl.position) >= 60000) + gMM.playbackControl.position = gMM.playbackControl.position + 60000; + else + gMM.playbackControl.position = gMM.playbackControl.duration; + }); + + ////////////////// ///////////////////////////////////////////////////////////}}} ////////////////////// COMMANDS //////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - commands.add(["playmedia"], - "Play Media", + commands.add(["f[ilter]"], + "Filter Tracks", function (args) { //Store the old view @@ -105,20 +145,17 @@ function Player() // {{{ .createInstance(Ci.sbIMutablePropertyArray); //args - if (args.length == 1) + switch (args.length) { - customProps.appendProperty(SBProperties.artistName,args[0].toString()); - } - else if (args.length == 2) - { - customProps.appendProperty(SBProperties.artistName,args[0].toString()); - customProps.appendProperty(SBProperties.albumName,args[1].toString()); - } - else if (args.length == 3) - { - customProps.appendProperty(SBProperties.artistName,args[0].toString()); - customProps.appendProperty(SBProperties.albumName,args[1].toString()); - customProps.appendProperty(SBProperties.trackName,args[2].toString()); + case 3: + customProps.appendProperty(SBProperties.trackName,args[2].toString()); + case 2: + customProps.appendProperty(SBProperties.albumName,args[1].toString()); + case 3: + customProps.appendProperty(SBProperties.artistName,args[0].toString()); + break; + default: + break; } sqncr.playView(mainView, mainView.getIndexForItem(library.getItemsByProperties(customProps).queryElementAt(0,Ci.sbIMediaItem))); @@ -127,7 +164,7 @@ function Player() // {{{ completer: function (context, args) completion.song(context, args) }); - /////////////////////////////////////////////////////////////////////////////}}} + /////////////////////////////////////////////////////////////////////////////}} } ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ @@ -179,17 +216,29 @@ function getArtistsArray() function getAlbums(artist) { var list = LibraryUtils.mainLibrary; - var albumArray = []; + var albumArray = [], returnArray = []; var items = list.getItemsByProperty(SBProperties.artistName, artist).enumerate(); - var i = 0; + var i = 0, j = 0; + while (items.hasMoreElements()) { album = items.getNext().getProperty(SBProperties.albumName); albumArray[i] = [album, album]; + + if (i == 0) + { + returnArray[j] = albumArray[i]; + j++; + } + else if (albumArray[i-1].toString() != albumArray[i].toString()) + { + returnArray[i] = albumArray[i]; + j++; + } i++; } - return util.Array.uniq(albumArray.map(String)); + return returnArray; } function getTracks(artist,album) From a4d178ea18cedd359cbdfe9b0c3fa731b446ce07 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 19 Mar 2009 13:20:23 +1100 Subject: [PATCH 041/143] Fix :filter {artist}. --- xulmus/content/player.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 10611bf4..a897f589 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -151,7 +151,7 @@ function Player() // {{{ customProps.appendProperty(SBProperties.trackName,args[2].toString()); case 2: customProps.appendProperty(SBProperties.albumName,args[1].toString()); - case 3: + case 1: customProps.appendProperty(SBProperties.artistName,args[0].toString()); break; default: From 122657730a3be2b42eda7748ccdf8a1b6804cce5 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 20 Mar 2009 00:44:08 +1100 Subject: [PATCH 042/143] Add initial rough version of player.html help file. --- xulmus/TODO | 1 + xulmus/content/config.js | 4 +++- xulmus/locale/en-US/asciidoc.conf | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xulmus/TODO b/xulmus/TODO index dba2a80b..f03bffc7 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -4,3 +4,4 @@ Priority list: BUGS: FEATURES: +9 Xulmus logo diff --git a/xulmus/content/config.js b/xulmus/content/config.js index a83bfb74..27c6eb87 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -117,7 +117,7 @@ const config = { //{{{ //TODO : Write intro.html and tutorial.html // they are sorted by relevance, not alphabetically - //helpFiles: [ "intro.html" ], + helpFiles: [ "player.html" ], /* "intro.html", "tutorial.html", "starting.html", "browsing.html", "buffer.html", "cmdline.html", "insert.html", "options.html", "pattern.html", "tabs.html", "hints.html", "map.html", "eval.html", @@ -134,6 +134,8 @@ const config = { //{{{ init: function () { + options["helpfile"] = "player.html"; + //Adding a mode for Player //modes.addMode("PLAYER"); // Player mode for songbird diff --git a/xulmus/locale/en-US/asciidoc.conf b/xulmus/locale/en-US/asciidoc.conf index 4bcc4288..4187121a 100755 --- a/xulmus/locale/en-US/asciidoc.conf +++ b/xulmus/locale/en-US/asciidoc.conf @@ -13,7 +13,7 @@ email=stubenschrott@gmx.net - + {doctitle} @@ -23,8 +23,8 @@ email=stubenschrott@gmx.net [replacements] -LOGO=
-HEADER=
+LOGO=
+HEADER=
\[count\]=[count] \[!\]=[!] From 56ee77ba4f32e5868cd4c7dd756c9a2906610ea8 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 20 Mar 2009 00:48:41 +1100 Subject: [PATCH 043/143] Whitespace formatting fixes. --- common/content/completion.js | 6 +++--- xulmus/content/player.js | 33 ++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/common/content/completion.js b/common/content/completion.js index 2a82a54c..f1a31114 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1399,13 +1399,13 @@ function Completion() //{{{ } else if (args.completeArg == 1) { - context.title = ["Albums by "+args[0]]; + context.title = ["Albums by " + args[0]]; context.completions = getAlbums(args[0]); } else if (args.completeArg == 2) { - context.title = ["Tracks from "+args[1]+" by "+args[0]]; - context.completions = getTracks(args[0],args[1]); + context.title = ["Tracks from " + args[1] + " by " + args[0]]; + context.completions = getTracks(args[0], args[1]); } }, diff --git a/xulmus/content/player.js b/xulmus/content/player.js index a897f589..3ac85dba 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -94,7 +94,7 @@ function Player() // {{{ { if (gMM.playbackControl.position >= 10000) gMM.playbackControl.position = gMM.playbackControl.position - 10000; - else + else gMM.playbackControl.position = 0; }); @@ -107,14 +107,14 @@ function Player() // {{{ else gMM.playbackControl.position = gMM.playbackControl.duration; }); - + mappings.add([modes.PLAYER], ["H"], "Seek -1m", function () { if (gMM.playbackControl.position >= 60000) gMM.playbackControl.position = gMM.playbackControl.position - 60000; - else + else gMM.playbackControl.position = 0; }); @@ -148,17 +148,17 @@ function Player() // {{{ switch (args.length) { case 3: - customProps.appendProperty(SBProperties.trackName,args[2].toString()); + customProps.appendProperty(SBProperties.trackName, args[2].toString()); case 2: - customProps.appendProperty(SBProperties.albumName,args[1].toString()); + customProps.appendProperty(SBProperties.albumName, args[1].toString()); case 1: - customProps.appendProperty(SBProperties.artistName,args[0].toString()); + customProps.appendProperty(SBProperties.artistName, args[0].toString()); break; default: break; } - sqncr.playView(mainView, mainView.getIndexForItem(library.getItemsByProperties(customProps).queryElementAt(0,Ci.sbIMediaItem))); + sqncr.playView(mainView, mainView.getIndexForItem(library.getItemsByProperties(customProps).queryElementAt(0, Ci.sbIMediaItem))); }, { completer: function (context, args) completion.song(context, args) @@ -198,9 +198,10 @@ function getArtistsArray() var artistArray = []; var i = 0; // Count the number of media items for each distinct artist - while (artists.hasMore()) { + while (artists.hasMore()) + { artist = artists.getNext(); - artistArray[i] = [artist,artist]; + artistArray[i] = [artist, artist]; list.enumerateItemsByProperty(SBProperties.artistName, artist, listener, @@ -219,9 +220,10 @@ function getAlbums(artist) var albumArray = [], returnArray = []; var items = list.getItemsByProperty(SBProperties.artistName, artist).enumerate(); var i = 0, j = 0; - - while (items.hasMoreElements()) { + + while (items.hasMoreElements()) + { album = items.getNext().getProperty(SBProperties.albumName); albumArray[i] = [album, album]; @@ -241,7 +243,7 @@ function getAlbums(artist) return returnArray; } -function getTracks(artist,album) +function getTracks(artist, album) { var list = LibraryUtils.mainLibrary; var tracksArray = []; @@ -249,11 +251,12 @@ function getTracks(artist,album) .createInstance(Ci.sbIMutablePropertyArray); var i = 0; - pa.appendProperty(SBProperties.artistName,artist.toString()); - pa.appendProperty(SBProperties.albumName,album.toString()); + pa.appendProperty(SBProperties.artistName, artist.toString()); + pa.appendProperty(SBProperties.albumName, album.toString()); var items = list.getItemsByProperties(pa).enumerate(); - while (items.hasMoreElements()) { + while (items.hasMoreElements()) + { track = items.getNext().getProperty(SBProperties.trackName); tracksArray[i] = [track, track]; i++; From b68b0e2f5519863b293e6e2949f0bd567507650d Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Thu, 19 Mar 2009 20:14:13 +0530 Subject: [PATCH 044/143] Removed extra media page and content pane from install.rdf --- xulmus/install.rdf | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/xulmus/install.rdf b/xulmus/install.rdf index 68e17ae6..7dccc3a8 100755 --- a/xulmus/install.rdf +++ b/xulmus/install.rdf @@ -7,16 +7,7 @@ xulmus@vimperator.org 0.1 Prathyush Thota - - - VIM for SongBird brothers. - - - - - - - + Makes Songbird behave like Vim and CMus. songbird@songbirdnest.com @@ -24,35 +15,5 @@ 1.1.0pre - - - - - - - - - xulmus - chrome://xulmus/content/pane.xul - chrome://xulmus/skin/pane-icon.png - 200 - 100 - servicepane - true - - - - - - - - - xulmus - chrome://xulmus/content/media-page.xul - - - From 1ea343d5f815ac98f154210ae0decb2ef65d1451 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 20 Mar 2009 02:31:30 +1100 Subject: [PATCH 045/143] Move some inline functionality to slots of player. --- xulmus/content/player.js | 188 +++++++++++++++++++++------------------ 1 file changed, 101 insertions(+), 87 deletions(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 3ac85dba..f949d86e 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -11,122 +11,70 @@ function Player() // {{{ // Get the focus to the visible playlist first //window._SBShowMainLibrary(); + // FIXME: need to test that we're playing - why is gMM.playbackControl.status always null? + // interval (seconds) + function seek(interval, direction) + { + interval = interval * 1000; + + let min = 0; + let max = gMM.playbackControl.duration; + let position = gMM.playbackControl.position + (direction ? interval : -interval); + + gMM.playbackControl.position = Math.min(Math.max(position, min), max) + } + /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// MAPPINGS //////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ mappings.add([modes.PLAYER], ["x"], "Play Track", - function () - { - gMM.sequencer.play(); - }); + function () { player.play(); }); mappings.add([modes.PLAYER], ["z"], "Previous Track", - function () - { - gSongbirdWindowController.doCommand("cmd_control_previous"); - }); + function () { player.previous(); }); mappings.add([modes.PLAYER], ["c"], "Pause/Unpause Track", - function () - { - gSongbirdWindowController.doCommand("cmd_control_playpause"); - }); + function () { player.togglePlayPause(); }); mappings.add([modes.PLAYER], ["b"], "Next Track", - function () - { - gSongbirdWindowController.doCommand("cmd_control_next"); - }); + function () { player.next(); }); mappings.add([modes.PLAYER], ["v"], "Stop Track", - function () - { - gMM.sequencer.stop(); - }); + function () { player.stop(); }); mappings.add([modes.PLAYER], ["f"], "Filter Library", - function () - { - commandline.open(":", "filter ", modes.EX); - }); + function () { commandline.open(":", "filter ", modes.EX); }); mappings.add([modes.PLAYER], ["s"], "Toggle Shuffle", - function () - { - if (gMM.sequencer.mode != gMM.sequencer.MODE_SHUFFLE) - gMM.sequencer.mode = gMM.sequencer.MODE_SHUFFLE; - else - gMM.sequencer.mode = gMM.sequencer.MODE_FORWARD; - }); + function () { player.toggleShuffle(); }); mappings.add([modes.PLAYER], ["r"], "Toggle Repeat", - function () - { - switch (gMM.sequencer.repeatMode) - { - case gMM.sequencer.MODE_REPEAT_NONE: - gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ONE; - break; - case gMM.sequencer.MODE_REPEAT_ONE: - gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ALL; - break; - case gMM.sequencer.MODE_REPEAT_ALL: - gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE; - break; - default: - gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE; - break; - } - }); + function () { player.toggleRepeat(); }); mappings.add([modes.PLAYER], - ["h"], "Seek -10s", - function () - { - if (gMM.playbackControl.position >= 10000) - gMM.playbackControl.position = gMM.playbackControl.position - 10000; - else - gMM.playbackControl.position = 0; - }); + ["h"], "Seek -10s", + function () { player.seekBackward(10); }); mappings.add([modes.PLAYER], - ["l"], "Seek +10s", - function () - { - if ((gMM.playbackControl.duration - gMM.playbackControl.position) >= 10000) - gMM.playbackControl.position = gMM.playbackControl.position + 10000; - else - gMM.playbackControl.position = gMM.playbackControl.duration; - }); + ["l"], "Seek +10s", + function () { player.seekForward(10); }); mappings.add([modes.PLAYER], - ["H"], "Seek -1m", - function () - { - if (gMM.playbackControl.position >= 60000) - gMM.playbackControl.position = gMM.playbackControl.position - 60000; - else - gMM.playbackControl.position = 0; - }); + ["H"], "Seek -1m", + function () { player.seekBackward(60); }); mappings.add([modes.PLAYER], - ["L"], "Seek +1m", - function () - { - if ((gMM.playbackControl.duration - gMM.playbackControl.position) >= 60000) - gMM.playbackControl.position = gMM.playbackControl.position + 60000; - else - gMM.playbackControl.position = gMM.playbackControl.duration; - }); + ["L"], "Seek +1m", + function () { player.seekForward(60); }); ////////////////// ///////////////////////////////////////////////////////////}}} ////////////////////// COMMANDS //////////////////////////////////////////////// @@ -137,11 +85,11 @@ function Player() // {{{ function (args) { //Store the old view - //var prev_view = gMM.status.view; - var library = LibraryUtils.mainLibrary; - var mainView = library.createView(); - var sqncr = gMM.sequencer; - var customProps = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"] + //let prev_view = gMM.status.view; + let library = LibraryUtils.mainLibrary; + let mainView = library.createView(); + let sqncr = gMM.sequencer; + let customProps = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"] .createInstance(Ci.sbIMutablePropertyArray); //args @@ -164,10 +112,76 @@ function Player() // {{{ completer: function (context, args) completion.song(context, args) }); - /////////////////////////////////////////////////////////////////////////////}} } + /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ + return { + + play: function play() + { + gMM.sequencer.play(); + }, + + stop: function stop() + { + gMM.sequencer.stop(); + }, + + next: function next() + { + gSongbirdWindowController.doCommand("cmd_control_next"); + }, + + previous: function previous() + { + gSongbirdWindowController.doCommand("cmd_control_previous"); + }, + + togglePlayPause: function togglePlayPause() + { + gSongbirdWindowController.doCommand("cmd_control_playpause"); + }, + + toggleShuffle: function toggleShuffle() + { + if (gMM.sequencer.mode != gMM.sequencer.MODE_SHUFFLE) + gMM.sequencer.mode = gMM.sequencer.MODE_SHUFFLE; + else + gMM.sequencer.mode = gMM.sequencer.MODE_FORWARD; + }, + + // FIXME: not really toggling - good enough for now. + toggleRepeat: function toggleRepeat() + { + switch (gMM.sequencer.repeatMode) + { + case gMM.sequencer.MODE_REPEAT_NONE: + gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ONE; + break; + case gMM.sequencer.MODE_REPEAT_ONE: + gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_ALL; + break; + case gMM.sequencer.MODE_REPEAT_ALL: + gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE; + break; + default: + gMM.sequencer.repeatMode = gMM.sequencer.MODE_REPEAT_NONE; + break; + } + }, + + seekForward: function seekForward(interval) + { + seek(interval, true); + }, + + seekBackward: function seekBackward(interval) + { + seek(interval, false); + }, + + }; //}}} } // }}} From 43412fbaff7d2930c40a1f996d4e7ac0bb32daa6 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 20 Mar 2009 02:37:53 +1100 Subject: [PATCH 046/143] Fix argCount for :filter - it requires an argument. --- xulmus/content/player.js | 1 + 1 file changed, 1 insertion(+) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index f949d86e..246ba040 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -109,6 +109,7 @@ function Player() // {{{ sqncr.playView(mainView, mainView.getIndexForItem(library.getItemsByProperties(customProps).queryElementAt(0, Ci.sbIMediaItem))); }, { + argCount: "+", completer: function (context, args) completion.song(context, args) }); From d0cb38691ee6081b0070019c0eea0b0276bfdd4d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 20 Mar 2009 03:05:56 +1100 Subject: [PATCH 047/143] Add :player{play,pause,next,prev,stop} commands. --- xulmus/content/player.js | 33 +++++++++--- xulmus/locale/en-US/player.txt | 99 ++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 6 deletions(-) create mode 100644 xulmus/locale/en-US/player.txt diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 246ba040..30e3b29f 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -29,23 +29,23 @@ function Player() // {{{ /////////////////////////////////////////////////////////////////////////////{{{ mappings.add([modes.PLAYER], - ["x"], "Play Track", + ["x"], "Play track", function () { player.play(); }); mappings.add([modes.PLAYER], - ["z"], "Previous Track", + ["z"], "Previous track", function () { player.previous(); }); mappings.add([modes.PLAYER], - ["c"], "Pause/Unpause Track", + ["c"], "Pause/Unpause track", function () { player.togglePlayPause(); }); mappings.add([modes.PLAYER], - ["b"], "Next Track", + ["b"], "Next track", function () { player.next(); }); mappings.add([modes.PLAYER], - ["v"], "Stop Track", + ["v"], "Stop track", function () { player.stop(); }); mappings.add([modes.PLAYER], @@ -81,7 +81,7 @@ function Player() // {{{ /////////////////////////////////////////////////////////////////////////////{{{ commands.add(["f[ilter]"], - "Filter Tracks", + "Filter and play tracks", function (args) { //Store the old view @@ -113,6 +113,27 @@ function Player() // {{{ completer: function (context, args) completion.song(context, args) }); + // TODO: better of as a single command, or cmus compatible E.g. :player-next? --djk + commands.add(["playern[ext]"], + "Play next track", + function () { player.next(); }); + + commands.add(["playerpr[ev]"], + "Play previous track", + function () { player.previous(); }); + + commands.add(["players[top]"], + "Stop track", + function () { player.stop(); }); + + commands.add(["playerp[lay]"], + "Play track", + function () { player.play(); }); + + commands.add(["playerpa[use]"], + "Pause/unpause track", + function () { player.togglePlayPause(); }); + /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt new file mode 100644 index 00000000..57b9f43e --- /dev/null +++ b/xulmus/locale/en-US/player.txt @@ -0,0 +1,99 @@ +HEADER + +|player-mode| |player| + + +The following features apply to Player mode which is activated when the media +tab has focus. + +|x| |:playerp| |:playerplay| +||:playerp[lay]|| + +||x|| +________________________________________________________________________________ +Play the current track. +________________________________________________________________________________ + +|z| |:playerpr| |:playerprev| +||:playerpr[ev]|| + +||z|| +________________________________________________________________________________ +Play the previous track. +________________________________________________________________________________ + + +|b| |:playern| |:playernext| +||:playern[ext]|| + +||b|| +________________________________________________________________________________ +Play the next track. +________________________________________________________________________________ + + +|c| |:playerpa| |:playerpause| +||:playerpa[use]|| + +||c|| +________________________________________________________________________________ +Pause/unpause the current track. +________________________________________________________________________________ + + +|v| |:players| |:playerstop| +||:players[top]|| + +||v|| +________________________________________________________________________________ +Stop playing the current track. +________________________________________________________________________________ + + +|x| +||x|| +________________________________________________________________________________ +Toggle shuffle mode. +________________________________________________________________________________ + + +|r| +||r|| +________________________________________________________________________________ +Toggle repeat mode. +________________________________________________________________________________ + + +|h| +||h|| +________________________________________________________________________________ +Seek +10s. +________________________________________________________________________________ + + +|l| +||l|| +________________________________________________________________________________ +Seek -10s. +________________________________________________________________________________ + + +|H| +||H|| +________________________________________________________________________________ +Seek +1m. +________________________________________________________________________________ + + +|L| +||L|| +________________________________________________________________________________ +Seek -1m. +________________________________________________________________________________ + + +|f| |:f| |:filter| +||:f[ilter] [a][artist][a] [a]{album}[a] [a]{track}[a]|| + +||f|| +________________________________________________________________________________ +Filter and play tracks. If only [a][artist][a] is specified then all tracks for +that artist are played in album order. If {album} is also specified then all +tracks for that album are played. A specific track can be specified with +{track}. +________________________________________________________________________________ + +// vim: set filetype=asciidoc: From 0d9c86a547727f52a752e2ca359f557d74cfc6f0 Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Fri, 20 Mar 2009 01:19:02 +0530 Subject: [PATCH 048/143] Added increase/decrease commands --- xulmus/content/player.js | 32 ++++++++++++++++++++++++++++---- xulmus/locale/en-US/player.txt | 14 ++++++++++++++ 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 30e3b29f..f54b39ea 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -16,12 +16,13 @@ function Player() // {{{ function seek(interval, direction) { interval = interval * 1000; - + let min = 0; let max = gMM.playbackControl.duration; + let position = gMM.playbackControl.position + (direction ? interval : -interval); - gMM.playbackControl.position = Math.min(Math.max(position, min), max) + gMM.playbackControl.position = Math.min(Math.max(position, min), max); } /////////////////////////////////////////////////////////////////////////////}}} @@ -75,6 +76,14 @@ function Player() // {{{ mappings.add([modes.PLAYER], ["L"], "Seek +1m", function () { player.seekForward(60); }); + + mappings.add([modes.PLAYER], + ["=","+"], "Increase Volume by 10%", + function () { player.increaseVolume(); }); + + mappings.add([modes.PLAYER], + ["-"], "Decrease Volume by 10%", + function () { player.decreaseVolume(); }); ////////////////// ///////////////////////////////////////////////////////////}}} ////////////////////// COMMANDS //////////////////////////////////////////////// @@ -195,14 +204,29 @@ function Player() // {{{ seekForward: function seekForward(interval) { - seek(interval, true); + if (gMM.playbackControl) + seek(interval, true); }, seekBackward: function seekBackward(interval) { - seek(interval, false); + if (gMM.playbackControl) + seek(interval, false); }, + //FIXME: 10% ? + increaseVolume: function increaseVolume() + { + gMM.volumeControl.volume = gMM.volumeControl.volume * 1.1; + }, + + decreaseVolume: function decreaseVolume() + { + if (gMM.volumeControl.volume == 0) + gMM.volumeControl.volume = 0.1; + else + gMM.volumeControl.volume = gMM.volumeControl.volume * 0.9; + }, }; //}}} } // }}} diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 57b9f43e..8afaf1cc 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -86,6 +86,20 @@ Seek -1m. ________________________________________________________________________________ +|+| |=| +||+|| + +||=|| +________________________________________________________________________________ +Increase volume by 10%. +________________________________________________________________________________ + +|-| +||-|| +________________________________________________________________________________ +Decrease volume by 10%. +________________________________________________________________________________ + + |f| |:f| |:filter| ||:f[ilter] [a][artist][a] [a]{album}[a] [a]{track}[a]|| + ||f|| From 032f7c098167753fabddd302013f3cfeb02ab324 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 20 Mar 2009 13:37:52 +1100 Subject: [PATCH 049/143] Add count support to l, L, h and H mappings. --- xulmus/content/player.js | 20 ++++++++++++-------- xulmus/locale/en-US/player.txt | 6 +++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index f54b39ea..a54def75 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -16,7 +16,7 @@ function Player() // {{{ function seek(interval, direction) { interval = interval * 1000; - + let min = 0; let max = gMM.playbackControl.duration; @@ -63,22 +63,26 @@ function Player() // {{{ mappings.add([modes.PLAYER], ["h"], "Seek -10s", - function () { player.seekBackward(10); }); + function (count) { player.seekBackward(count * 10); }, + { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], ["l"], "Seek +10s", - function () { player.seekForward(10); }); + function (count) { player.seekForward(count * 10); }, + { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], ["H"], "Seek -1m", - function () { player.seekBackward(60); }); + function (count) { player.seekBackward(count * 60); }, + { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], ["L"], "Seek +1m", - function () { player.seekForward(60); }); - + function (count) { player.seekForward(count * 60); }, + { flags: Mappings.flags.COUNT }); + mappings.add([modes.PLAYER], - ["=","+"], "Increase Volume by 10%", + ["=", "+"], "Increase Volume by 10%", function () { player.increaseVolume(); }); mappings.add([modes.PLAYER], @@ -226,7 +230,7 @@ function Player() // {{{ gMM.volumeControl.volume = 0.1; else gMM.volumeControl.volume = gMM.volumeControl.volume * 0.9; - }, + } }; //}}} } // }}} diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 8afaf1cc..14768329 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -66,21 +66,21 @@ ________________________________________________________________________________ |l| -||l|| +||[count]l|| ________________________________________________________________________________ Seek -10s. ________________________________________________________________________________ |H| -||H|| +||[count]H|| ________________________________________________________________________________ Seek +1m. ________________________________________________________________________________ |L| -||L|| +||[count]L|| ________________________________________________________________________________ Seek -1m. ________________________________________________________________________________ From da38811c04b5115e546b05a9d4e9f9d33a849388 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 20 Mar 2009 13:53:05 +1100 Subject: [PATCH 050/143] Add / and ? Player mode commands to TODO. --- xulmus/TODO | 1 + xulmus/content/player.js | 1 + 2 files changed, 2 insertions(+) diff --git a/xulmus/TODO b/xulmus/TODO index f03bffc7..1d54f9f2 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -5,3 +5,4 @@ BUGS: FEATURES: 9 Xulmus logo +9 / and ? possibly reusing "Jump to" functionality directly. diff --git a/xulmus/content/player.js b/xulmus/content/player.js index a54def75..941d9139 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -93,6 +93,7 @@ function Player() // {{{ ////////////////////// COMMANDS //////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ + // TODO: presumably this will eventually just filter the library view like cmus? --djk commands.add(["f[ilter]"], "Filter and play tracks", function (args) From 5d652b78e614a7a3cf13c413e962f0d907990787 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 20 Mar 2009 14:04:00 +1100 Subject: [PATCH 051/143] Update xulmus logo. --- xulmus/TODO | 1 - xulmus/content/xulmus.png | Bin 2226 -> 1081 bytes xulmus/content/xulmus.svg | 6 +++--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/xulmus/TODO b/xulmus/TODO index 1d54f9f2..c23341ef 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -4,5 +4,4 @@ Priority list: BUGS: FEATURES: -9 Xulmus logo 9 / and ? possibly reusing "Jump to" functionality directly. diff --git a/xulmus/content/xulmus.png b/xulmus/content/xulmus.png index 52ff0c8d68884c764a979fac72c1b2ee38753a66..f1b04d4f901d8144716b822feac785b613608427 100755 GIT binary patch delta 1060 zcmV+<1l#+v5xEGEB!3`dNK#Dz0D2|>0Dy!50Qvv`0D$NK0Cg|`0P0`>06Lfe02gqa zx=}m;000DMK}|sb0I`mI`%#ks0004VQb$4nuFf3k00006VoOIv0RI600RN!9r;`8x z010qNS#tmY4#WTe4#WYKD-Ig~00WRoL_t(|+U=ZKNEJ~W#(&4OsK5tlkqUe0Nh2_b zqS6+keY0rKB6}!^%+QMJp`v}Ef~>$6+Ft5KGuuNVO0a?`f+R@7hl*CBjk46+cevk$ zVYuead#;W7{ou#Bv)q|;&iwDp`Ogg3afA>;1d02{`w#fEUZRC*r!Ej8{24N!ZqOM~ z2nC{OyCis~Pk+K3SOJHHS-%nvhG*cSFiA&T1c`~QL?pC5Q=ikYH@pBB!#QvlOoC_O z5?E)czCGYdI2NX|56!l#;BEHJBZXFUfw%&Wgqd(H-0fPnfd{?c@P8_N3G2F(!X<$F5!wjB{g@rNVJqBGoJO{h6ba=okeb$EKEQ?(8 zj(V15TH4nTma}>JZQ!)IG(X^vB12(iFIm|P@53~9cppx0@?jg^u>2He-e;DbE$!{L-@-ggxOmIM3&8X=p|}|CXKbAY4P=!#fPn3Z50K6jt^E(NGPa zasX}y`_Ef(JL4^F=Ma1WSMf646;9`}r7TV6zQAYW=vEzwc??3sAehSo(bg%Y2~6UW znW&8BSTu{5?p$?M^kc*nW`%~(EgX}P_G)DP?|)5fuWy9)sc)fn+o*3H6Sq>1sm*=Y zF_20d)k7PpI;XEG zw11)-Bbs}L`}uj9>kRdg)5XjhZ@6w{gf8FN%&;$dw)qRr+mWDZ)U!35La5KLw!ups@ zeJCu4wJ~gWbL*SNjM?+{2q8pt=)Jkv6VS0~8r^t} zJ+$KzYJWNki z_X%6LAMttLR5t(TGKD(&+d|P&fq2;ozIlzaVBAjxUKe~G0Vg@ZSNBtRmNaiq7aghV egb+fASnwMq-@Lwybc4bG00002AQi>*rxDjmA*(R0=w)UKg_wivv==(?(Ocg?6d9tCpYsvXU?2+ zW}b6r=A4;bnHd!-j5Q{VwE-0>z$iJQq~(%K(qp3`zru-!YDOFk>vx8%4PrcDFOS7bjlG;+V zR!L_chm6xC%^ZgAX_DS3NypnZk}+A*TuEmY@J*0(w)3_OSKlz~YmqcZ(xef}nI>tT zq-piC4FEI4XT{$GPXkL6TKWMlcb>F!9z?ufoCZ-1QKzGO_FCcI=%MsijcIASvP9|!*H zpI`8PCNJKV^>)NL(HnC{hEWrNBhIs^paaW~!x0UCI|&={gm#0|miqSxavU*n#;H-= z3LnHi;KB^ue~8+(Mf54a2Cuujgd=wPm@ETYyiUL(U}ePL1pEScPll}dz@fO$IXY)V z{ePWN_`||Ez{}46tyJAAADcel;u4P7Nm#kw#Xwxq0(?5FPa|?f7rw(4-X1*S!gk@+J9bUh&gd;u=Os|K-<$pctU}b}s%NUA;c9)s;Wz>%Z2fW-L(e|gx z({tKxH?w^i^j~`Uz7+jhFYmUD$kWW8Cu|7--kxi5z)myUT)>kF4_YQmnoL+OAvjyT zaH*H;a_Tpv_-f%!GdnzTlk(A=`o0nPF0fG2IcD}Ogy;bM>@n%MzK_Y)$mrG&^7;A%pY`GlF( zJ4xLWeNG0WJLPcQggr?UVY!Hrmw!)7=*Z!@)(}~$pCdtfMuafqEha3*i6bV<^3O-x zpkW~IxGSa~jXobF>;u0*h?Z;NP(l661@#GTBRF9vA@Szg?qh z*#H)Kc}v;}9YtFJ2s3FZn3+l1M@Un(=ddO8qtVuA%rN9+#mrtH82F>S~IKXp5qYkJxOmO966m!I8K{M*pm&~*P7X3Nw)w$0)8Or!@zF|ClBp} z*=8wl9`JfX4sE1Z54;Un>Sw*1oW6t*MQ^3t9`R?u*MM6kEhhX`mQnPGzy+Q%X}LugJ!Ja{u&#g!ZbE3F`^KPjhsAov<_;HO`D(PAg%C?@7sc zHHUv1!RfQ~K0tJ;RFKfVXf%`AW|n^q%x{q-vs_nB(m3J0fPdmtM}lo;*5fx_E(3ba zY^%!|LUZ~;Lh5EqlGc&59{3dS9pFpAy9u+(Bw#zRwIDZ^q&Y4DE+XvX4iWN?4<Cy>BH1MO}mo zA`e@^!GxsC2!H9Foo4o8i7pNsb5yh*Ls(^BJlkC+5V|7y@g`$+>y9fV-$c(KXMR>3%S#0n=Csy$+bhCt{Hol8+3AO|HkHjX4>m}MGS|yec?&{@TL9bBZxY2*IB4LEvzB>sH zc^2XF=<6c>Uc$Y=Uf?P-e)pPMTj7L7yfps`_-wq~N=zaAtC1@RPT2=M0({eq-LIvg o6;5naXCKWK8Uj_+T%jTGf7Z@+-VOKA`~Uy|07*qoM6N<$f|I2%d;kCd diff --git a/xulmus/content/xulmus.svg b/xulmus/content/xulmus.svg index 7e2983ed..c8e3603d 100755 --- a/xulmus/content/xulmus.svg +++ b/xulmus/content/xulmus.svg @@ -15,9 +15,9 @@ inkscape:version="0.46" version="1.0" sodipodi:docbase="/home/maxauthority/code/vimperator" - sodipodi:docname="vimperator.svg" + sodipodi:docname="xulmus.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" - inkscape:export-filename="/home/maxauthority/code/vimperator/vimperator.png" + inkscape:export-filename="/home/maxauthority/code/vimperator/xulmus.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> vimperator_ + y="29.896835">xulmus_ Date: Fri, 20 Mar 2009 16:04:23 +1100 Subject: [PATCH 052/143] Define missing window#BrowserStop and window#toJavascriptConsole. --- common/content/buffer.js | 16 ++-------------- xulmus/content/config.js | 12 +++++++++++- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 8534f4ee..15b09ae0 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -215,13 +215,7 @@ function Buffer() //{{{ mappings.add(myModes, [""], "Stop loading", - function () - { - if(config.name == "Xulmus") - getBrowser().mCurrentBrowser.stop(); - else - window.BrowserStop(); - }); + function () { window.BrowserStop(); }); // scrolling mappings.add(myModes, ["j", "", ""], @@ -603,13 +597,7 @@ function Buffer() //{{{ commands.add(["st[op]"], "Stop loading", - function () - { - if (config.name == "Xulmus") - getBrowser().mCurrentBrowser.stop(); - else - window.BrowserStop(); - }, + function () { window.BrowserStop(); }, { argCount: "0" }); commands.add(["vie[wsource]"], diff --git a/xulmus/content/config.js b/xulmus/content/config.js index 27c6eb87..e4a28018 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -182,6 +182,7 @@ const config = { //{{{ liberator.loadModule("hints", Hints); // Load the Player module liberator.loadModule("player", Player); + //////////////////////////////////////////////////////////////////////////////// ////////////////////// STYLES ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ @@ -489,8 +490,17 @@ const config = { //{{{ options.add(["urlseparator"], "Set the separator regexp used to separate multiple URL args", "string", ",\\s"); + //}}} + + // TODO: mention this to SB devs, they seem keen to provide these + // functions to make porting from FF as simple as possible. + window.toJavaScriptConsole = function () { + toOpenWindowByType("global:console", "chrome://global/content/console.xul"); + } + window.BrowserStop = function () { + getBrowser().mCurrentBrowser.stop(); + } } - //}}} }; //}}} // vim: set fdm=marker sw=4 ts=4 et: From 070332d1527f49e0493f6a9e4ca1426807d13220 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 20 Mar 2009 17:31:54 +1100 Subject: [PATCH 053/143] Add TODO. --- xulmus/TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/xulmus/TODO b/xulmus/TODO index c23341ef..6f60c324 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -5,3 +5,4 @@ BUGS: FEATURES: 9 / and ? possibly reusing "Jump to" functionality directly. +7 extended hint mode for opening links in FF From 1423c78b021672ba7e25eb6957c14b6442c354a8 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 20 Mar 2009 18:49:17 +1100 Subject: [PATCH 054/143] Fix count handling of seek commands. --- xulmus/content/player.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 941d9139..e6d80ca3 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -63,22 +63,22 @@ function Player() // {{{ mappings.add([modes.PLAYER], ["h"], "Seek -10s", - function (count) { player.seekBackward(count * 10); }, + function (count) { player.seekBackward(Math.max(1, count) * 10); }, { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], ["l"], "Seek +10s", - function (count) { player.seekForward(count * 10); }, + function (count) { player.seekForward(Math.max(1, count) * 10); }, { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], ["H"], "Seek -1m", - function (count) { player.seekBackward(count * 60); }, + function (count) { player.seekBackward(Math.max(1, count) * 60); }, { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], ["L"], "Seek +1m", - function (count) { player.seekForward(count * 60); }, + function (count) { player.seekForward(Math.max(1, count) * 60); }, { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], From 32292c9823f5324d5f7b9c297265809fa69defd5 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 21 Mar 2009 03:08:12 +1100 Subject: [PATCH 055/143] Add new :volume command. --- xulmus/TODO | 1 + xulmus/content/player.js | 53 ++++++++++++++++++++++++++-------- xulmus/locale/en-US/player.txt | 31 +++++++++++++++----- 3 files changed, 66 insertions(+), 19 deletions(-) diff --git a/xulmus/TODO b/xulmus/TODO index 6f60c324..109039ee 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -2,6 +2,7 @@ Priority list: 1-9 as in Vim (9 = required for next release, 5 = would be nice, 1 = probably not) BUGS: +- SB doesn't support tab-undo yet so :undo and "u" etc don't work FEATURES: 9 / and ? possibly reusing "Jump to" functionality directly. diff --git a/xulmus/content/player.js b/xulmus/content/player.js index e6d80ca3..92322f93 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -11,10 +11,13 @@ function Player() // {{{ // Get the focus to the visible playlist first //window._SBShowMainLibrary(); - // FIXME: need to test that we're playing - why is gMM.playbackControl.status always null? + // FIXME: need to test that we're playing - gMM.status.state // interval (seconds) function seek(interval, direction) { + if (!gMM.playbackControl) + return; + interval = interval * 1000; let min = 0; @@ -127,7 +130,15 @@ function Player() // {{{ completer: function (context, args) completion.song(context, args) }); - // TODO: better of as a single command, or cmus compatible E.g. :player-next? --djk + // TODO: better off as a single command, or cmus compatible E.g. :player-next? --djk + commands.add(["playerp[lay]"], + "Play track", + function () { player.play(); }); + + commands.add(["playerpa[use]"], + "Pause/unpause track", + function () { player.togglePlayPause(); }); + commands.add(["playern[ext]"], "Play next track", function () { player.next(); }); @@ -140,13 +151,26 @@ function Player() // {{{ "Stop track", function () { player.stop(); }); - commands.add(["playerp[lay]"], - "Play track", - function () { player.play(); }); + commands.add(["vol[ume]"], + "Set the volume", + function (args) + { + let arg = args[0]; - commands.add(["playerpa[use]"], - "Pause/unpause track", - function () { player.togglePlayPause(); }); + if (!/^[+-]?\d+$/.test(arg)) + { + liberator.echoerr("E488: Trailing characters"); + return; + } + + let level = parseInt(arg, 10) / 100; + + if (/^[+-]/.test(arg)) + level = player.volume + level; + + player.volume = Math.min(Math.max(level, 0), 1); + }, + { argCount: 1 }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// @@ -154,6 +178,13 @@ function Player() // {{{ return { + // TODO: check bounds and round, 0 - 1 or 0 - 100? + get volume() gMM.volumeControl.volume, + set volume(value) + { + gMM.volumeControl.volume = value; + }, + play: function play() { gMM.sequencer.play(); @@ -209,14 +240,12 @@ function Player() // {{{ seekForward: function seekForward(interval) { - if (gMM.playbackControl) - seek(interval, true); + seek(interval, true); }, seekBackward: function seekBackward(interval) { - if (gMM.playbackControl) - seek(interval, false); + seek(interval, false); }, //FIXME: 10% ? diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 14768329..3f9d4e97 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -5,6 +5,8 @@ HEADER The following features apply to Player mode which is activated when the media tab has focus. +section:Playing{nbsp}tracks[playing-tracks] + |x| |:playerp| |:playerplay| ||:playerp[lay]|| + ||x|| @@ -57,6 +59,20 @@ ________________________________________________________________________________ Toggle repeat mode. ________________________________________________________________________________ +section:Filtering{nbsp}the{nbsp}library[filter,filtering] + +|f| |:f| |:filter| +||:f[ilter] [a][artist][a] [a]{album}[a] [a]{track}[a]|| + +||f|| +________________________________________________________________________________ +Filter and play tracks. If only [a][artist][a] is specified then all tracks for +that artist are played in album order. If {album} is also specified then all +tracks for that album are played. A specific track can be specified with +{track}. +________________________________________________________________________________ + + +section:Seeking{nbsp}to{nbsp}a{nbsp}track{nbsp}position[seeking] |h| ||h|| @@ -86,6 +102,8 @@ Seek -1m. ________________________________________________________________________________ +section:Adjusting{nbsp}the{nbsp}volume[volume] + |+| |=| ||+|| + ||=|| @@ -93,6 +111,7 @@ ________________________________________________________________________________ Increase volume by 10%. ________________________________________________________________________________ + |-| ||-|| ________________________________________________________________________________ @@ -100,14 +119,12 @@ Decrease volume by 10%. ________________________________________________________________________________ -|f| |:f| |:filter| -||:f[ilter] [a][artist][a] [a]{album}[a] [a]{track}[a]|| + -||f|| +|:vol| |:volume| +||:vol[ume][!] [a][value][a]|| + +||:vol[ume][!] +{value} | -{value}|| + ________________________________________________________________________________ -Filter and play tracks. If only [a][artist][a] is specified then all tracks for -that artist are played in album order. If {album} is also specified then all -tracks for that album are played. A specific track can be specified with -{track}. +Set the player volume. [a][value][a] can be an absolute value between 0 and +100% or a relative value if prefixed with "-" or "+". ________________________________________________________________________________ // vim: set filetype=asciidoc: From ca4efd13df1f0552b1a19da54abc2343b61cfed1 Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sat, 21 Mar 2009 13:18:47 +0530 Subject: [PATCH 056/143] Fixed play() to play first track of the visible view. --- xulmus/content/player.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 92322f93..beac81f1 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -187,7 +187,7 @@ function Player() // {{{ play: function play() { - gMM.sequencer.play(); + gMM.sequencer.playView(SBGetBrowser().currentMediaListView, 0); }, stop: function stop() From 0126043a6846a4d98246ea0e3f147084288080a4 Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sun, 22 Mar 2009 01:35:55 +0530 Subject: [PATCH 057/143] Added :Filter command for filtering the view, searchTracks() for searching inside a visible view and focusTrack(). --- xulmus/content/player.js | 71 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index beac81f1..2a028246 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -28,6 +28,11 @@ function Player() // {{{ gMM.playbackControl.position = Math.min(Math.max(position, min), max); } + function focusTrack(mediaItem) + { + SBGetBrowser().mediaTab.mediaPage.highlightItem(_SBGetCurrentView().getIndexForItem(mediaItem)); + } + /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// MAPPINGS //////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ @@ -55,6 +60,10 @@ function Player() // {{{ mappings.add([modes.PLAYER], ["f"], "Filter Library", function () { commandline.open(":", "filter ", modes.EX); }); + + mappings.add([modes.PLAYER], + ["F"], "Loads current view filtered by the keywords", + function () { commandline.open(":", "Filter ", modes.EX); }); mappings.add([modes.PLAYER], ["s"], "Toggle Shuffle", @@ -124,12 +133,34 @@ function Player() // {{{ } sqncr.playView(mainView, mainView.getIndexForItem(library.getItemsByProperties(customProps).queryElementAt(0, Ci.sbIMediaItem))); + player.focusPlayingTrack(); }, { argCount: "+", completer: function (context, args) completion.song(context, args) }); + commands.add(["F[ilter]"], + "Filter tracks based on keywords {artist/album/track}", + function (args) + { + let library = LibraryUtils.mainLibrary; + let myView = LibraryUtils.createStandardMediaListView(LibraryUtils.mainLibrary, args.string); + if (myView.length == 0) + liberator.echoerr("No Tracks matching the keywords"); + else + { + SBGetBrowser().loadMediaList(LibraryUtils.mainLibrary, null, null, myView, + "chrome://songbird/content/mediapages/filtersPage.xul"); + //TODO: make this focusTrack work ? + focusTrack(myView.getItemByIndex(0)); + } + }, + { + argCount: "+", + // completer: function (context, args) completion.tracks(context, args); + }); + // TODO: better off as a single command, or cmus compatible E.g. :player-next? --djk commands.add(["playerp[lay]"], "Play track", @@ -188,6 +219,7 @@ function Player() // {{{ play: function play() { gMM.sequencer.playView(SBGetBrowser().currentMediaListView, 0); + focusTrack(gMM.sequencer.currentItem); }, stop: function stop() @@ -208,6 +240,7 @@ function Player() // {{{ togglePlayPause: function togglePlayPause() { gSongbirdWindowController.doCommand("cmd_control_playpause"); + SBGetBrowser().mediaTab.mediaPage.highlightItem(_SBGetCurrentView().getIndexForItem(gMM.sequencer.currentItem)); }, toggleShuffle: function toggleShuffle() @@ -260,7 +293,45 @@ function Player() // {{{ gMM.volumeControl.volume = 0.1; else gMM.volumeControl.volume = gMM.volumeControl.volume * 0.9; + }, + + focusPlayingTrack :function focusPlayingTrack() + { + focusTrack(gMM.sequencer.currentItem); + }, + + listTracks: function listTracks(view) + { + //let myView = LibraryUtils.createStandardMediaListView(LibraryUtils.mainLibrary, args); + let length = view.length; + let tracksList = []; + + for (var i=0; i < length; i++) + { + var mediaItem = view.getItemByIndex(i); + var trackName = mediaItem.getProperty(SBProperties.trackName); + var albumName = mediaItem.getProperty(SBProperties.albumName); + var artistName = mediaItem.getProperty(SBProperties.artistName); + + tracksList[i] = [ trackName, "Album : "+albumName+" Artist : "+artistName ]; + } + return tracksList; + }, + //TODO: Use this for implementing "/" and "?". -ken + searchTracks: function searchTracks(args) + { + let currentView = _SBGetCurrentView(); + let mediaItemList = currentView.mediaList; + let search = _getSearchString(currentView); + let searchString = ""; + if (search != "") + searchString = args + " " + search; + else + searchString = args; + let myView = LibraryUtils.createStandardMediaListView(mediaItemList, searchString); + focusTrack(myView.getItemByIndex(0)); } + }; //}}} } // }}} From 310d807746c6f88c38efd5279c7a5f8147eaa591 Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sun, 22 Mar 2009 02:18:40 +0530 Subject: [PATCH 058/143] Added entry for :Filter in help page --- xulmus/TODO | 1 + xulmus/locale/en-US/player.txt | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/xulmus/TODO b/xulmus/TODO index 109039ee..16d5bc28 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -7,3 +7,4 @@ BUGS: FEATURES: 9 / and ? possibly reusing "Jump to" functionality directly. 7 extended hint mode for opening links in FF +5 Check for default extensions and add commands for them. Ex. Last.fm, Seeqpod e.t.c diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 3f9d4e97..ed7ecb01 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -72,6 +72,15 @@ tracks for that album are played. A specific track can be specified with ________________________________________________________________________________ +|F| |:F| |:Filter| +||:F[ilter] {keywords}|| + +||F|| +________________________________________________________________________________ +Filter and show the tracks as a view. The tracks are filtered by the {keywords} +provided as arguments. This text search applies over the default filter properties, +namely: Genre, Artist, and Album. +________________________________________________________________________________ + section:Seeking{nbsp}to{nbsp}a{nbsp}track{nbsp}position[seeking] |h| From a51cf072c9b145f6b00bd226f72ecbf395fef2de Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sun, 22 Mar 2009 05:42:51 +0530 Subject: [PATCH 059/143] Added TODO --- xulmus/TODO | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xulmus/TODO b/xulmus/TODO index 16d5bc28..c40dc405 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -6,5 +6,6 @@ BUGS: FEATURES: 9 / and ? possibly reusing "Jump to" functionality directly. -7 extended hint mode for opening links in FF +8 Playlist/SmartPlaylist operations. +7 extended hint mode for opening links in FF. 5 Check for default extensions and add commands for them. Ex. Last.fm, Seeqpod e.t.c From 2cfd2ee5bae4f139b69372993c7b572e94291c54 Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sun, 22 Mar 2009 06:38:07 +0530 Subject: [PATCH 060/143] Modified play() for playing selected tracks in the view --- xulmus/content/player.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 2a028246..5fe543cb 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -218,8 +218,18 @@ function Player() // {{{ play: function play() { - gMM.sequencer.playView(SBGetBrowser().currentMediaListView, 0); - focusTrack(gMM.sequencer.currentItem); + //Check if there is any selection in place, else play first item of the visible view. + if (_SBGetCurrentView().selection.count != 0) + { + //Play the selection. + gMM.sequencer.playView(_SBGetCurrentView(),_SBGetCurrentView().getIndexForItem(_SBGetCurrentView().selection.currentMediaItem)); + focusTrack(gMM.sequencer.currentItem); + } + else + { + gMM.sequencer.playView(SBGetBrowser().currentMediaListView, 0); + focusTrack(gMM.sequencer.currentItem); + } }, stop: function stop() From 2216878c9dfd3b4a9a40068cda54c5a26175aea5 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 21 Mar 2009 15:02:09 +1100 Subject: [PATCH 061/143] Use green for the Xulmus logo's tilde. --- xulmus/content/xulmus.png | Bin 1081 -> 1082 bytes xulmus/content/xulmus.svg | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/xulmus/content/xulmus.png b/xulmus/content/xulmus.png index f1b04d4f901d8144716b822feac785b613608427..e907ad058435d6df35e595fb1f49da6610a74e5a 100755 GIT binary patch delta 908 zcmV;719SYj2)YQ6lo63hL_t(|+U=ZKNEJ~W#>b_Rr7M3zO0a?`f+R@7hl*CBjk46+ zce>xDVYuead#+vc`@xTMXSp-yocZ6G^Pd^6;|L*y@DuZo_wS3+dWjY$R$U-O@H3=O z-Jmm~5DG-mc8T{)pMcr00uBwbekB|PPs4>ll8%@V5))gANML)WKBr(Wcpff-v*Avd z2+zR9u+D!{eY?XIa12agADV4f!JF)x2MVq50&zJU0W;tlxXZO{Jr8;fToy%bD23hl zc@FFdGhNHg59<-!V_{$Y;0*@2n|822%~RGNejtA4!MqK(!7K0~8~``NdN_~kMGFP2 z>pHldLAU{Kf%$MR9A+sH_cI8K;8ylc1N$)zrt^PnEG&!>?=a}%;91y}rNaYW8D(ua z#BKf@j4lg_XTP zG*o}X#~gs0!T!@$+|D>l+c^lI!IivBcY)KmYza$~xzCTXadfK=#9RiUVIa)mfoSWL z(0C?sNla8maV(n2OLvaCD*Q2GGP6QM;1-U_NP9N2{?{h9*C)jK)VEN(ZPd4piCYQB z)aJhHXfDfEXxRzGqc8!UglkzQaDFgqSWbUwWO-hQ^?AoKCBp5tRbManEssgtbRaH( zW8rJKiu3Y0J)TL7my0Y9!AY*|nt(bCXNFjx%dYJtMX=q?t*=SmcEhQT{|QUrd+p&k zc#YFn6$^OlA=n4cW~jc_x+ zG{pLtOnnF}gS8QCcXR8T%8c3c!wZgS>-k+1(B=_oU-(?1C4>+{2q8px=)Jkf)~7vmO6`x^#fwV7cReYq|_;R%4x5 zF3-jE1a+UVh5Heo_f2Kcdgr7M3TO0a?`f+R@7hl*CBjk46+ zcevk$VYuead#;W7{ou#Bv)q|;&iwDp`Ogg3afA>;1d02{`w#fEUZRC*r!Ej8{24N! zZqOM~2nC{OyCis~Pr@8n0f&WIzY-3HXW*hRNk?1+iHWU5B(yzKpVP26yZ{%&IdB(D zf@k3pSZ9B!zCGYdI2NX|56!l#;BEHJBZXFUfw%&Wgqd(H-0fPnfd{?c@G5)^2f{6|9?s`_exZJZQ!)IG(X^vB12(iFIm|P@53~9cppx0@?jg^u>2He-e;Db zE$!fSv&*yDvXhu8#mYwh*TtnZ(I}FeYo)xPUR`vqX zPz`^dasX}y`_Ef(JL4^F=Ma1WSMf646;9`}r7TV6zQAYW=vEzwc??3sAehSo(bg%Y z2~6UWnW&8BSTu{5?p$?M^kc*nW`%~(EgX}P_G)DP?@es4Z-n)!Z=rVEsBaw;w^EL& z&3)G~T$ZEIvJ;5MU?MyP*Rf3G{BYE;oZ5fL^85(v^MPe*jN5IizFr<$9+S4|KwJpN z!MAWV=M`{z0+SdomslQ#lU>_20d)k7Pp zI;XEGw4xg$ntO)(`FWY^4E2%I#mpLSxNc>HF5lVAurGSH`3uhEAigQgeaabd6nuZ} zS!VNTMRV($PXEL+$6rsLTICtBkeT3lSmIe$!az*odfrQ_NoY>+mWDZ)U!35La5KLw z!ups@eJCu4wJ~gWbL*SNjM?_)?)Igb+dqAw+cOy}8&E(6MP6 z-FS^Xwdw*Pgb+dqA%qY@2qA$KzY zJWNki_X%6LAMttLR5t(TGKD(&+d|P&fq2;ozIlzaVBAjxUKe~G0Vg@ZSNBtRmNaiq h7pd!n5JHGp@EaxHyuOQcgTep+002ovPDHLkV1hB1#wGv& diff --git a/xulmus/content/xulmus.svg b/xulmus/content/xulmus.svg index c8e3603d..9fa8c7b3 100755 --- a/xulmus/content/xulmus.svg +++ b/xulmus/content/xulmus.svg @@ -76,7 +76,7 @@ y="29.896835">xulmus_ Date: Sun, 22 Mar 2009 16:08:18 +1100 Subject: [PATCH 062/143] Normalise case of player command and mapping descriptions. --- xulmus/content/config.js | 1 + xulmus/content/player.js | 53 +++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/xulmus/content/config.js b/xulmus/content/config.js index e4a28018..35bd1353 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -497,6 +497,7 @@ const config = { //{{{ window.toJavaScriptConsole = function () { toOpenWindowByType("global:console", "chrome://global/content/console.xul"); } + window.BrowserStop = function () { getBrowser().mCurrentBrowser.stop(); } diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 5fe543cb..d96414db 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -1,4 +1,4 @@ -//Import Artist List as this can be huge +// Import Artist List as this can be huge var artists = getArtistsArray(); @@ -46,7 +46,7 @@ function Player() // {{{ function () { player.previous(); }); mappings.add([modes.PLAYER], - ["c"], "Pause/Unpause track", + ["c"], "Pause/unpause track", function () { player.togglePlayPause(); }); mappings.add([modes.PLAYER], @@ -58,19 +58,19 @@ function Player() // {{{ function () { player.stop(); }); mappings.add([modes.PLAYER], - ["f"], "Filter Library", + ["f"], "Filter library", function () { commandline.open(":", "filter ", modes.EX); }); - + mappings.add([modes.PLAYER], ["F"], "Loads current view filtered by the keywords", function () { commandline.open(":", "Filter ", modes.EX); }); mappings.add([modes.PLAYER], - ["s"], "Toggle Shuffle", + ["s"], "Toggle shuffle", function () { player.toggleShuffle(); }); mappings.add([modes.PLAYER], - ["r"], "Toggle Repeat", + ["r"], "Toggle repeat", function () { player.toggleRepeat(); }); mappings.add([modes.PLAYER], @@ -94,11 +94,11 @@ function Player() // {{{ { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], - ["=", "+"], "Increase Volume by 10%", + ["=", "+"], "Increase volume by 10%", function () { player.increaseVolume(); }); mappings.add([modes.PLAYER], - ["-"], "Decrease Volume by 10%", + ["-"], "Decrease volume by 10%", function () { player.decreaseVolume(); }); ////////////////// ///////////////////////////////////////////////////////////}}} @@ -110,15 +110,15 @@ function Player() // {{{ "Filter and play tracks", function (args) { - //Store the old view - //let prev_view = gMM.status.view; + // Store the old view + // let prev_view = gMM.status.view; let library = LibraryUtils.mainLibrary; let mainView = library.createView(); let sqncr = gMM.sequencer; let customProps = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"] .createInstance(Ci.sbIMutablePropertyArray); - //args + // args switch (args.length) { case 3: @@ -152,16 +152,16 @@ function Player() // {{{ { SBGetBrowser().loadMediaList(LibraryUtils.mainLibrary, null, null, myView, "chrome://songbird/content/mediapages/filtersPage.xul"); - //TODO: make this focusTrack work ? - focusTrack(myView.getItemByIndex(0)); + // TODO: make this focusTrack work ? + focusTrack(myView.getItemByIndex(0)); } }, { argCount: "+", - // completer: function (context, args) completion.tracks(context, args); + //completer: function (context, args) completion.tracks(context, args); }); - // TODO: better off as a single command, or cmus compatible E.g. :player-next? --djk + // TODO: better off as a single command (:player play) or cmus compatible (:player-play)? --djk commands.add(["playerp[lay]"], "Play track", function () { player.play(); }); @@ -201,7 +201,7 @@ function Player() // {{{ player.volume = Math.min(Math.max(level, 0), 1); }, - { argCount: 1 }); + { argCount: "1" }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// @@ -218,18 +218,18 @@ function Player() // {{{ play: function play() { - //Check if there is any selection in place, else play first item of the visible view. + // Check if there is any selection in place, else play first item of the visible view. if (_SBGetCurrentView().selection.count != 0) { - //Play the selection. - gMM.sequencer.playView(_SBGetCurrentView(),_SBGetCurrentView().getIndexForItem(_SBGetCurrentView().selection.currentMediaItem)); + // Play the selection. + gMM.sequencer.playView(_SBGetCurrentView(), _SBGetCurrentView().getIndexForItem(_SBGetCurrentView().selection.currentMediaItem)); focusTrack(gMM.sequencer.currentItem); } else { gMM.sequencer.playView(SBGetBrowser().currentMediaListView, 0); focusTrack(gMM.sequencer.currentItem); - } + } }, stop: function stop() @@ -291,7 +291,7 @@ function Player() // {{{ seek(interval, false); }, - //FIXME: 10% ? + // FIXME: 10% ? increaseVolume: function increaseVolume() { gMM.volumeControl.volume = gMM.volumeControl.volume * 1.1; @@ -316,28 +316,31 @@ function Player() // {{{ let length = view.length; let tracksList = []; - for (var i=0; i < length; i++) + for (var i = 0; i < length; i++) { var mediaItem = view.getItemByIndex(i); var trackName = mediaItem.getProperty(SBProperties.trackName); var albumName = mediaItem.getProperty(SBProperties.albumName); var artistName = mediaItem.getProperty(SBProperties.artistName); - tracksList[i] = [ trackName, "Album : "+albumName+" Artist : "+artistName ]; + tracksList[i] = [trackName, "Album : " + albumName + " Artist : " + artistName]; } + return tracksList; }, - //TODO: Use this for implementing "/" and "?". -ken + // TODO: Use this for implementing "/" and "?". -ken searchTracks: function searchTracks(args) { let currentView = _SBGetCurrentView(); let mediaItemList = currentView.mediaList; let search = _getSearchString(currentView); let searchString = ""; + if (search != "") searchString = args + " " + search; else - searchString = args; + searchString = args; + let myView = LibraryUtils.createStandardMediaListView(mediaItemList, searchString); focusTrack(myView.getItemByIndex(0)); } From 77d57431330b1f73c0125276809d46e982096fb1 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 22 Mar 2009 16:47:22 +1100 Subject: [PATCH 063/143] Add some broken commands to TODO#BUGS. --- xulmus/TODO | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xulmus/TODO b/xulmus/TODO index c40dc405..1a85e4cd 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -2,10 +2,14 @@ Priority list: 1-9 as in Vim (9 = required for next release, 5 = would be nice, 1 = probably not) BUGS: -- SB doesn't support tab-undo yet so :undo and "u" etc don't work +- broken commands: + - SB doesn't support tab-undo yet so :undo and "u" etc don't work + - :tabduplicate + - :back/H, :forward,L FEATURES: 9 / and ? possibly reusing "Jump to" functionality directly. 8 Playlist/SmartPlaylist operations. 7 extended hint mode for opening links in FF. 5 Check for default extensions and add commands for them. Ex. Last.fm, Seeqpod e.t.c + Wouldn't these be provided as Xulmus plugins like Vimperator does? --djk From 74dde82355c22b131bb0937da6d3b0f9a486e1f5 Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Mon, 23 Mar 2009 04:49:35 +0530 Subject: [PATCH 064/143] Added getPlaylist() and playPlaylist() functions --- xulmus/content/player.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index d96414db..76208183 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -343,6 +343,40 @@ function Player() // {{{ let myView = LibraryUtils.createStandardMediaListView(mediaItemList, searchString); focusTrack(myView.getItemByIndex(0)); + }, + + getPlaylists: function getPlaylists() + { + var libraryManager = Components.classes["@songbirdnest.com/Songbird/library/Manager;1"] + .getService(Components.interfaces.sbILibraryManager); + var mainLibrary = libraryManager.mainLibrary; + var playlists = [mainLibrary]; + var playlistsArray = []; + var listener = + { + onEnumerationBegin: function() { }, + onEnumerationEnd: function() { }, + onEnumeratedItem: function(list, item) + { + if (playlistsArray.indexOf(item.name)==-1) + { + playlists.push(item); + playlistsArray.push(item.name); + } + return Components.interfaces.sbIMediaListEnumerationListener.CONTINUE; + } + }; + mainLibrary.enumerateItemsByProperty("http://songbirdnest.com/data/1.0#isList", "1", listener ); + return playlists; + }, + + // Play track at 'row' in 'playlist' + playPlaylist: function playPlaylist(playlist,row) + { + var gMM = Components.classes["@songbirdnest.com/Songbird/Mediacore/Manager;1"] + .getService(Components.interfaces.sbIMediacoreManager); + gMM.sequencer.playView(playlist.createView(),row); + } }; From f82ca27c6e09204ce90b39bf75a7d120ca4da3cd Mon Sep 17 00:00:00 2001 From: Daniel Bainton Date: Mon, 23 Mar 2009 11:30:01 +0200 Subject: [PATCH 065/143] Update maxVersion of vimperator to latest Minefield --- vimperator/install.rdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vimperator/install.rdf b/vimperator/install.rdf index e709b06d..0d203952 100644 --- a/vimperator/install.rdf +++ b/vimperator/install.rdf @@ -20,7 +20,7 @@ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 3.0 - 3.2a1pre + 3.6a1pre From b4b62fc8360a51d000313fc18be2ac5ad645bfa9 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Mon, 23 Mar 2009 12:36:05 +0000 Subject: [PATCH 066/143] Fix #141 by not splitting URLs on quoted commas. Added a new function util.splitLiteral(str, RegExp). --- common/content/util.js | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/common/content/util.js b/common/content/util.js index ad41bd18..8ea3d22a 100644 --- a/common/content/util.js +++ b/common/content/util.js @@ -249,6 +249,40 @@ const util = { //{{{ return delimiter + str.replace(/([\\'"])/g, "\\$1").replace("\n", "\\n", "g").replace("\t", "\\t", "g") + delimiter; }, + /** + * Split a string on literal occurances of a marker. + * + * Specifically this ignores occurences preceded by a backslash, or + * contained within 'single' or "double" quotes. + * + * It assumes backslash escaping on strings, and will thus not count quotes + * that are preceded by a backslash or within other quotes as starting or + * ending quoted sections of the string. + * + * @param {string} str + * @param {RegExp} marker + */ + splitLiteral: function splitLiteral(str, marker) + { + let results = []; + let resep = RegExp(/^(([^\\'"]|\\.|'([^\\']|\\.)*'|"([^\\"]|\\.)*")*?)/.source + marker.source); + let cont = true; + + while (cont) + { + cont = false; + str = str.replace(resep, function (match, before) + { + results.push(before); + cont = true; + return ""; + }); + } + + results.push(str); + return results; + }, + /** * Converts bytes to a pretty printed data size string. * @@ -618,7 +652,7 @@ const util = { //{{{ */ stringToURLArray: function stringToURLArray(str) { - let urls = str.split(RegExp("\\s*" + options["urlseparator"] + "\\s*")); + let urls = util.splitLiteral(str, RegExp("\\s*" + options["urlseparator"] + "\\s*")); return urls.map(function (url) { try From 53b5a54a1f5ea96d4e013ddaec41ec410291deb3 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Mon, 23 Mar 2009 14:41:41 +0000 Subject: [PATCH 067/143] Fix #198, Unicode escape next and previous pattern --- common/content/buffer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 458daa21..4cd9fdeb 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -146,13 +146,13 @@ function Buffer() //{{{ getter: function () window.fullScreen }); - options.add(["nextpattern"], + options.add(["nextpattern"], // \u00BB is » (>> in a single char) "Patterns to use when guessing the 'next' page in a document sequence", - "stringlist", "\\bnext\\b,^>$,^(>>|»)$,^(>|»),(>|»)$,\\bmore\\b"); + "stringlist", "\\bnext\\b,^>$,^(>>|\u00BB)$,^(>|\u00BB),(>|\u00BB)$,\\bmore\\b"); - options.add(["previouspattern"], + options.add(["previouspattern"], // \u00AB is « (<< in a single char) "Patterns to use when guessing the 'previous' page in a document sequence", - "stringlist", "\\bprev|previous\\b,^<$,^(<<|«)$,^(<|«),(<|«)$"); + "stringlist", "\\bprev|previous\\b,^<$,^(<<|\u00AB)$,^(<|\u00AB),(<|\u00AB)$"); options.add(["pageinfo", "pa"], "Desired info on :pa[geinfo]", "charlist", "gfm", { From 77f277ddcc15960b6e35de76e07076322a21e06e Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Tue, 24 Mar 2009 04:18:43 +0530 Subject: [PATCH 068/143] Added :load [playlist], command for loading specified playlist (autocompleted) --- common/content/completion.js | 15 +++++++++++++++ xulmus/content/player.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/common/content/completion.js b/common/content/completion.js index 5592ec36..d90b6bd4 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1409,6 +1409,21 @@ function Completion() //{{{ } }, + playlist: function playlist(context, args) + { + let playlists = Player().getPlaylists(); + let length = playlists.length; + let playlistNames = []; + + for (var i=0; i < length; i++) + { + playlistNames[i] = [playlists[i].name.toString(),playlists[i].name]; + } + + context.title = ["Playlists"]; + context.completions = playlistNames; + }, + buffer: function buffer(context) { filter = context.filter.toLowerCase(); diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 76208183..448055b1 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -203,6 +203,37 @@ function Player() // {{{ }, { argCount: "1" }); + commands.add(["load"], + "Load a playlist", + function (args) + { + + if (args.length != 0) + { + //load the selected playlist/smart playlist + let playlists = player.getPlaylists(); + let length = playlists.length; + let playlistNames = []; + + for (var i=0; i < length; i++) + { + playlistNames[i] = playlists[i].name.toLowerCase(); + } + + let playlist = args.string.replace("\\",""); + SBGetBrowser().loadMediaList(playlists[playlistNames.indexOf(playlist.toLowerCase())]); + focusTrack(_SBGetCurrentView().getItemByIndex(0)); + } + else + { + //load main library if there are no args + _SBShowMainLibrary(); + } + }, + { + //args: + completer: function(context, args) completion.playlist(context, args) + }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ From 086f9d7971531fdfeff604446dd4387d36b4ebaf Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 23 Mar 2009 12:11:46 +1100 Subject: [PATCH 069/143] Formatting fixes. --- xulmus/content/player.js | 41 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 448055b1..8687d91d 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -347,12 +347,12 @@ function Player() // {{{ let length = view.length; let tracksList = []; - for (var i = 0; i < length; i++) + for (let i = 0; i < length; i++) { - var mediaItem = view.getItemByIndex(i); - var trackName = mediaItem.getProperty(SBProperties.trackName); - var albumName = mediaItem.getProperty(SBProperties.albumName); - var artistName = mediaItem.getProperty(SBProperties.artistName); + let mediaItem = view.getItemByIndex(i); + let trackName = mediaItem.getProperty(SBProperties.trackName); + let albumName = mediaItem.getProperty(SBProperties.albumName); + let artistName = mediaItem.getProperty(SBProperties.artistName); tracksList[i] = [trackName, "Album : " + albumName + " Artist : " + artistName]; } @@ -378,18 +378,17 @@ function Player() // {{{ getPlaylists: function getPlaylists() { - var libraryManager = Components.classes["@songbirdnest.com/Songbird/library/Manager;1"] - .getService(Components.interfaces.sbILibraryManager); - var mainLibrary = libraryManager.mainLibrary; - var playlists = [mainLibrary]; - var playlistsArray = []; - var listener = - { + let libraryManager = Components.classes["@songbirdnest.com/Songbird/library/Manager;1"] + .getService(Components.interfaces.sbILibraryManager); + let mainLibrary = libraryManager.mainLibrary; + let playlists = [mainLibrary]; + let playlistsArray = []; + let listener = { onEnumerationBegin: function() { }, onEnumerationEnd: function() { }, - onEnumeratedItem: function(list, item) + onEnumeratedItem: function(list, item) { - if (playlistsArray.indexOf(item.name)==-1) + if (playlistsArray.indexOf(item.name) == -1) { playlists.push(item); playlistsArray.push(item.name); @@ -397,19 +396,17 @@ function Player() // {{{ return Components.interfaces.sbIMediaListEnumerationListener.CONTINUE; } }; - mainLibrary.enumerateItemsByProperty("http://songbirdnest.com/data/1.0#isList", "1", listener ); - return playlists; + mainLibrary.enumerateItemsByProperty("http://songbirdnest.com/data/1.0#isList", "1", listener ); + return playlists; }, // Play track at 'row' in 'playlist' - playPlaylist: function playPlaylist(playlist,row) + playPlaylist: function playPlaylist(playlist, row) { - var gMM = Components.classes["@songbirdnest.com/Songbird/Mediacore/Manager;1"] - .getService(Components.interfaces.sbIMediacoreManager); - gMM.sequencer.playView(playlist.createView(),row); - + let gMM = Components.classes["@songbirdnest.com/Songbird/Mediacore/Manager;1"] + .getService(Components.interfaces.sbIMediacoreManager); + gMM.sequencer.playView(playlist.createView(), row); } - }; //}}} } // }}} From 663cd581a1cd30507802cf1455d8aaca835dd882 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 24 Mar 2009 15:00:18 +1100 Subject: [PATCH 070/143] Fix and document :load. --- common/content/completion.js | 14 ++-------- xulmus/content/player.js | 51 +++++++++++++++++----------------- xulmus/locale/en-US/player.txt | 9 ++++++ 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/common/content/completion.js b/common/content/completion.js index d90b6bd4..7596362f 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1411,17 +1411,9 @@ function Completion() //{{{ playlist: function playlist(context, args) { - let playlists = Player().getPlaylists(); - let length = playlists.length; - let playlistNames = []; - - for (var i=0; i < length; i++) - { - playlistNames[i] = [playlists[i].name.toString(),playlists[i].name]; - } - - context.title = ["Playlists"]; - context.completions = playlistNames; + context.title = ["Playlist", "Type"]; + context.keys = { text: "name", description: "type" }; + context.completions = player.getPlaylists(); }, buffer: function buffer(context) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 8687d91d..d5b083b7 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -207,33 +207,37 @@ function Player() // {{{ "Load a playlist", function (args) { - - if (args.length != 0) - { - //load the selected playlist/smart playlist - let playlists = player.getPlaylists(); - let length = playlists.length; - let playlistNames = []; + let arg = args.literalArg; - for (var i=0; i < length; i++) + if (arg) + { + // load the selected playlist/smart playlist + let playlists = player.getPlaylists(); + + for ([i, list] in Iterator(playlists)) { - playlistNames[i] = playlists[i].name.toLowerCase(); + if (util.compareIgnoreCase(arg, list.name) == 0) + { + SBGetBrowser().loadMediaList(playlists[i]); + focusTrack(_SBGetCurrentView().getItemByIndex(0)); + return; + } } - - let playlist = args.string.replace("\\",""); - SBGetBrowser().loadMediaList(playlists[playlistNames.indexOf(playlist.toLowerCase())]); - focusTrack(_SBGetCurrentView().getItemByIndex(0)); + + liberator.echoerr("E475: Invalid argument: " + arg); } else { - //load main library if there are no args + // load main library if there are no args _SBShowMainLibrary(); } }, { - //args: - completer: function(context, args) completion.playlist(context, args) + argCount: "?", + completer: function(context, args) completion.playlist(context, args), + literal: 0 }); + /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ @@ -378,33 +382,30 @@ function Player() // {{{ getPlaylists: function getPlaylists() { - let libraryManager = Components.classes["@songbirdnest.com/Songbird/library/Manager;1"] - .getService(Components.interfaces.sbILibraryManager); - let mainLibrary = libraryManager.mainLibrary; + let mainLibrary = LibraryUtils.mainLibrary; let playlists = [mainLibrary]; - let playlistsArray = []; let listener = { onEnumerationBegin: function() { }, onEnumerationEnd: function() { }, onEnumeratedItem: function(list, item) { - if (playlistsArray.indexOf(item.name) == -1) + // FIXME: why are there null items and duplicates? + if (!playlists.some(function (list) list.name == item.name) && item.name != null) { playlists.push(item); - playlistsArray.push(item.name); } return Components.interfaces.sbIMediaListEnumerationListener.CONTINUE; } }; - mainLibrary.enumerateItemsByProperty("http://songbirdnest.com/data/1.0#isList", "1", listener ); + + mainLibrary.enumerateItemsByProperty("http://songbirdnest.com/data/1.0#isList", "1", listener); + return playlists; }, // Play track at 'row' in 'playlist' playPlaylist: function playPlaylist(playlist, row) { - let gMM = Components.classes["@songbirdnest.com/Songbird/Mediacore/Manager;1"] - .getService(Components.interfaces.sbIMediacoreManager); gMM.sequencer.playView(playlist.createView(), row); } }; diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index ed7ecb01..f4baae92 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -136,4 +136,13 @@ Set the player volume. [a][value][a] can be an absolute value between 0 and 100% or a relative value if prefixed with "-" or "+". ________________________________________________________________________________ +section:Managing{nbsp}playlists[playlists] + +|:load| +||:load [a][playlist][a]|| + +________________________________________________________________________________ +Load [a][playlist][a]. If no playlist is specified then the main library view +is loaded. +________________________________________________________________________________ + // vim: set filetype=asciidoc: From b6cb5785adbef0cb7bef5d74d7b36176e6679a74 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 24 Mar 2009 15:02:56 +1100 Subject: [PATCH 071/143] Fix :help :back/:forward formatting. --- vimperator/locale/en-US/browsing.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vimperator/locale/en-US/browsing.txt b/vimperator/locale/en-US/browsing.txt index 9b44fa8a..c2a7dbba 100644 --- a/vimperator/locale/en-US/browsing.txt +++ b/vimperator/locale/en-US/browsing.txt @@ -160,7 +160,7 @@ ________________________________________________________________________________ section:Navigating[navigating] |H| || |CTRL-O| |:ba| |:back| -||:[count]ba[ck] [url]|| + +||:[count]ba[ck] [a][url][a]|| + ||:ba[ck]!|| + ||CTRL-o|| ________________________________________________________________________________ @@ -171,7 +171,7 @@ ________________________________________________________________________________ |L| || |CTRL-i| |:fo| |:fw| |:forward| -||:[count]fo[rward] [url]|| + +||:[count]fo[rward] [a][url][a]|| + ||:fo[rward]!|| + ||CTRL-i|| ________________________________________________________________________________ From 827f450a549a08ce4570b1e3f2445aa59e2c3a04 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 24 Mar 2009 15:48:36 +1100 Subject: [PATCH 072/143] Add a :seek command. --- xulmus/content/player.js | 78 ++++++++++++++++++++++++++-------- xulmus/locale/en-US/player.txt | 36 ++++++++++------ 2 files changed, 84 insertions(+), 30 deletions(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index d5b083b7..6a5e6397 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -11,21 +11,11 @@ function Player() // {{{ // Get the focus to the visible playlist first //window._SBShowMainLibrary(); - // FIXME: need to test that we're playing - gMM.status.state - // interval (seconds) + // interval (milliseconds) function seek(interval, direction) { - if (!gMM.playbackControl) - return; - - interval = interval * 1000; - - let min = 0; - let max = gMM.playbackControl.duration; - - let position = gMM.playbackControl.position + (direction ? interval : -interval); - - gMM.playbackControl.position = Math.min(Math.max(position, min), max); + let position = gMM.playbackControl ? gMM.playbackControl.position : 0; + player.seekTo(position + (direction ? interval : -interval)); } function focusTrack(mediaItem) @@ -75,22 +65,22 @@ function Player() // {{{ mappings.add([modes.PLAYER], ["h"], "Seek -10s", - function (count) { player.seekBackward(Math.max(1, count) * 10); }, + function (count) { player.seekBackward(Math.max(1, count) * 10000); }, { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], ["l"], "Seek +10s", - function (count) { player.seekForward(Math.max(1, count) * 10); }, + function (count) { player.seekForward(Math.max(1, count) * 10000); }, { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], ["H"], "Seek -1m", - function (count) { player.seekBackward(Math.max(1, count) * 60); }, + function (count) { player.seekBackward(Math.max(1, count) * 60000); }, { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], ["L"], "Seek +1m", - function (count) { player.seekForward(Math.max(1, count) * 60); }, + function (count) { player.seekForward(Math.max(1, count) * 60000); }, { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], @@ -141,7 +131,7 @@ function Player() // {{{ }); commands.add(["F[ilter]"], - "Filter tracks based on keywords {artist/album/track}", + "Filter tracks based on keywords {genre/artist/album/track}", function (args) { let library = LibraryUtils.mainLibrary; @@ -182,6 +172,44 @@ function Player() // {{{ "Stop track", function () { player.stop(); }); + commands.add(["see[k]"], + "Seek to a track position", + function (args) + { + let arg = args[0]; + + // intentionally supports 999:99:99 + if (!/^[+-]?(\d+[smh]?|(\d+:\d\d:|\d+:)?\d{2})$/.test(arg)) + { + liberator.echoerr("E475: Invalid argument: " + arg); + return; + } + + function ms(t, m) Math.abs(parseInt(t, 10) * { s: 1000, m: 60000, h: 3600000 }[m]) + + if (/:/.test(arg)) + { + let [seconds, minutes, hours] = arg.split(":").reverse(); + hours = hours || 0; + var value = ms(seconds, "s") + ms(minutes, "m") + ms(hours, "h"); + } + else + { + if (!/[smh]/.test(arg.substr(-1))) + arg += "s"; // default to seconds + + value = ms(arg.substring(arg, arg.length - 1), arg.substr(-1)); + } + + if (/^[-+]/.test(arg)) + arg[0] == "-" ? player.seekBackward(value) : player.seekForward(value) + else + player.seekTo(value) + + }, + { argCount: "1" }); + + // TODO: maybe :vol! could toggle mute on/off? --djk commands.add(["vol[ume]"], "Set the volume", function (args) @@ -251,6 +279,7 @@ function Player() // {{{ gMM.volumeControl.volume = value; }, + // FIXME: can't be called from non-media tabs since 840e78 play: function play() { // Check if there is any selection in place, else play first item of the visible view. @@ -326,7 +355,19 @@ function Player() // {{{ seek(interval, false); }, + seekTo: function seekTo(position) + { + if (!gMM.playbackControl) + this.play(); + + let min = 0; + let max = gMM.playbackControl.duration - 5000; // TODO: 5s buffer like cmus desirable? + + gMM.playbackControl.position = Math.min(Math.max(position, min), max); + }, + // FIXME: 10% ? + // I think just general increments of say 0.05 might be better --djk increaseVolume: function increaseVolume() { gMM.volumeControl.volume = gMM.volumeControl.volume * 1.1; @@ -363,6 +404,7 @@ function Player() // {{{ return tracksList; }, + // TODO: Use this for implementing "/" and "?". -ken searchTracks: function searchTracks(args) { diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index f4baae92..8344db4c 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -62,29 +62,29 @@ ________________________________________________________________________________ section:Filtering{nbsp}the{nbsp}library[filter,filtering] |f| |:f| |:filter| -||:f[ilter] [a][artist][a] [a]{album}[a] [a]{track}[a]|| + +||:f[ilter] {artist} [a][album][a] [a][track][a]|| + ||f|| ________________________________________________________________________________ -Filter and play tracks. If only [a][artist][a] is specified then all tracks for -that artist are played in album order. If {album} is also specified then all +Filter and play tracks. If only {artist} is specified then all tracks for that +artist are played in album order. If [a][album][a] is also specified then all tracks for that album are played. A specific track can be specified with -{track}. +[a][track][a]. ________________________________________________________________________________ |F| |:F| |:Filter| -||:F[ilter] {keywords}|| + +||:F[ilter] {keywords}|| + ||F|| ________________________________________________________________________________ Filter and show the tracks as a view. The tracks are filtered by the {keywords} -provided as arguments. This text search applies over the default filter properties, -namely: Genre, Artist, and Album. +provided as arguments. This text search applies over the default filter +properties, namely: Genre, Artist, Album and Track. ________________________________________________________________________________ section:Seeking{nbsp}to{nbsp}a{nbsp}track{nbsp}position[seeking] |h| -||h|| +||[count]h|| ________________________________________________________________________________ Seek +10s. ________________________________________________________________________________ @@ -111,6 +111,18 @@ Seek -1m. ________________________________________________________________________________ +|:see]| |:seek| +||:see[k] {[HH:]MM:SS]}|| + +||:see[k] +{time[hms]} | -{time[hms]}|| + +________________________________________________________________________________ +Seek to an absolute or relative position in a track. The position can be given +in seconds (s), minutes (m), or hours (h). If the unit is not specified then +seconds is assumed. The position is absolute unless the value is prefixed with +"-" or "+". + +Positions may also be specified in [a][HH:]MM:SS[a] format. +________________________________________________________________________________ + section:Adjusting{nbsp}the{nbsp}volume[volume] |+| |=| @@ -129,11 +141,11 @@ ________________________________________________________________________________ |:vol| |:volume| -||:vol[ume][!] [a][value][a]|| + -||:vol[ume][!] +{value} | -{value}|| + +||:vol[ume] {value}|| + +||:vol[ume] +{value} | -{value}|| + ________________________________________________________________________________ -Set the player volume. [a][value][a] can be an absolute value between 0 and -100% or a relative value if prefixed with "-" or "+". +Set the player volume. {value} can be an absolute value between 0 and 100% or a +relative value if prefixed with "-" or "+". ________________________________________________________________________________ section:Managing{nbsp}playlists[playlists] From a442aa0798a660cc9282b23dfb91ae9883599d88 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 01:26:16 +1100 Subject: [PATCH 073/143] Add "i" mapping to select the current track. --- xulmus/content/player.js | 4 ++++ xulmus/locale/en-US/player.txt | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 6a5e6397..1a95e81a 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -55,6 +55,10 @@ function Player() // {{{ ["F"], "Loads current view filtered by the keywords", function () { commandline.open(":", "Filter ", modes.EX); }); + mappings.add([modes.PLAYER], + ["i"], "Select current track", + function () { gSongbirdWindowController.doCommand("cmd_find_current_track"); }); + mappings.add([modes.PLAYER], ["s"], "Toggle shuffle", function () { player.toggleShuffle(); }); diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 8344db4c..023faea9 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -59,6 +59,13 @@ ________________________________________________________________________________ Toggle repeat mode. ________________________________________________________________________________ + +|i| +||i|| +________________________________________________________________________________ +Select the currently playing track. +________________________________________________________________________________ + section:Filtering{nbsp}the{nbsp}library[filter,filtering] |f| |:f| |:filter| From b62527f8e6cbca9942d718b7e82743550829dfa3 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 01:52:14 +1100 Subject: [PATCH 074/143] Add "p" to 'guioptions' to show/hide the player controls. Enable for now until the status bar is improved. --- xulmus/content/config.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xulmus/content/config.js b/xulmus/content/config.js index 35bd1353..45bb0c51 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -33,12 +33,13 @@ const config = { //{{{ //mainWindowID: "mainplayer", /*** optional options, there are checked for existence and a fallback provided ***/ features: ["bookmarks", "hints", "marks", "history", "quickmarks", "session", "tabs", "windows", "player"], - defaults: { guioptions: "rb" }, + defaults: { guioptions: "mprb" }, // FIXME: "m" seems to be defaulting to on anyway guioptions: { - m: ["Menubar", ["main-menubar"]], - T: ["Toolbar", ["nav-bar"]], - B: ["Bookmark bar", ["PersonalToolbar"]] + m: ["Menubar", ["main-menubar"]], + T: ["Toolbar", ["nav-bar"]], + B: ["Bookmark bar", ["PersonalToolbar"]], // FIXME: used/relevant? + p: ["Player controls", ["player_wrapper"]] }, //get visualbellWindow() getBrowser().mPanelContainer, From 4bfb4b7515f164feae70915fbf30a7b9e109292c Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 02:13:14 +1100 Subject: [PATCH 075/143] Add / mappings for seeking. These are the same as "h" and "l". --- xulmus/content/player.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 1a95e81a..1984ad56 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -68,12 +68,12 @@ function Player() // {{{ function () { player.toggleRepeat(); }); mappings.add([modes.PLAYER], - ["h"], "Seek -10s", + ["h", ""], "Seek -10s", function (count) { player.seekBackward(Math.max(1, count) * 10000); }, { flags: Mappings.flags.COUNT }); mappings.add([modes.PLAYER], - ["l"], "Seek +10s", + ["l", ""], "Seek +10s", function (count) { player.seekForward(Math.max(1, count) * 10000); }, { flags: Mappings.flags.COUNT }); From ed502d5d61e661ed6bd14af15f308bcc4e9a6c5f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 02:21:24 +1100 Subject: [PATCH 076/143] Document player mode /. --- xulmus/locale/en-US/player.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 023faea9..8053d3c5 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -90,14 +90,14 @@ ________________________________________________________________________________ section:Seeking{nbsp}to{nbsp}a{nbsp}track{nbsp}position[seeking] -|h| +|| |h| ||[count]h|| ________________________________________________________________________________ Seek +10s. ________________________________________________________________________________ -|l| +|| |l| ||[count]l|| ________________________________________________________________________________ Seek -10s. From 349c442eb558858f21ed6b8d7b869facb4d59a08 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 02:32:19 +1100 Subject: [PATCH 077/143] Fix 'showtabline'. --- common/content/tabs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/content/tabs.js b/common/content/tabs.js index 6c4eb16d..0b19514f 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -689,9 +689,10 @@ function Tabs() //{{{ { let tabStrip = null; + // FIXME: why is this app specific conditional code here? if (config.hostApplication == "Firefox") tabStrip = getBrowser().mStrip.getElementsByClassName("tabbrowser-tabs")[0]; - else if (config.hostApplication == "Thunderbird") + else if (/^(Thunderbird|Songbird)$/.test(config.hostApplication)) tabStrip = getBrowser().mStrip; return tabStrip; From 98406ff211bfac968975b1acddc28792d82fb3f7 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 04:03:10 +1100 Subject: [PATCH 078/143] Fix :dialog entries. --- xulmus/content/config.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/xulmus/content/config.js b/xulmus/content/config.js index 45bb0c51..5eed716e 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -63,45 +63,58 @@ const config = { //{{{ ["XulmusLeavePre", "Triggered before exiting Xulmus, just before destroying each module"], ["XulmusLeave", "Triggered before exiting Xulmus"]], + // TODO: remove those which don't make sense, can't be provided. dialogs: [ ["about", "About Songbird", - function () { window.openDialog("chrome://browser/content/aboutDialog.xul", "_blank", "chrome,dialog,modal,centerscreen"); }], + function () { window.openDialog("chrome://songbird/content/xul/about.xul", "_blank", "chrome,dialog,modal,centerscreen"); }], + /* ["addbookmark", "Add bookmark for the current page", function () { PlacesCommandHook.bookmarkCurrentPage(true, PlacesUtils.bookmarksRootId); }], + */ ["addons", "Manage Add-ons", - function () { window.BrowserOpenAddonsMgr(); }], + function () { SBOpenPreferences("paneAddons"); }], + /* ["bookmarks", "List your bookmarks", function () { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }], + */ ["checkupdates", "Check for updates", function () { window.checkForUpdates(); }], ["cleardata", "Clear private data", - function () { Cc[GLUE_CID].getService(Ci.nsIBrowserGlue).sanitize(window || null); }], + function () { Sanitizer.showUI(); }], ["cookies", "List your cookies", function () { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }], ["console", "JavaScript console", function () { window.toJavaScriptConsole(); }], + /* ["customizetoolbar", "Customize the Toolbar", function () { window.BrowserCustomizeToolbar(); }], + */ ["dominspector", "DOM Inspector", function () { try { window.inspectDOMDocument(content.document); } catch (e) { liberator.echoerr("DOM Inspector extension not installed"); } }], ["downloads", "Manage Downloads", function () { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }], + /* ["history", "List your history", function () { window.openDialog("chrome://browser/content/history/history-panel.xul", "History", "dialog,centerscreen,width=600,height=600"); }], ["import", "Import Preferences, Bookmarks, History, etc. from other browsers", function () { window.BrowserImport(); }], + */ ["openfile", "Open the file selector dialog", - function () { window.BrowserOpenFileWindow(); }], + function () { SBFileOpen(); }], + /* ["pageinfo", "Show information about the current page", function () { window.BrowserPageInfo(); }], + */ ["pagesource", "View page source", function () { window.BrowserViewSourceOfDocument(content.document); }], ["places", "Places Organizer: Manage your bookmarks and history", function () { PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_BOOKMARKS); }], ["preferences", "Show Firefox preferences dialog", function () { window.openPreferences(); }], + /* ["printpreview", "Preview the page before printing", function () { PrintUtils.printPreview(onEnterPrintPreview, onExitPrintPreview); }], + */ ["printsetup", "Setup the page size and orientation before printing", function () { PrintUtils.showPageSetup(); }], ["print", "Show print dialog", @@ -382,6 +395,8 @@ const config = { //{{{ }, { argCount: "0" }); + // TODO: service/content pane and right sidebar manipulation commands? --djk + /* // TODO: move sidebar commands to ui.js? commands.add(["sbcl[ose]"], "Close the sidebar window", @@ -423,6 +438,7 @@ const config = { //{{{ completer: function (context) completion.sidebar(context), literal: 0 }); + */ commands.add(["winc[lose]", "wc[lose]"], "Close window", From 8c495eb7ba53565c925432013fbe98b14f23ab01 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 04:13:15 +1100 Subject: [PATCH 079/143] Add Player mode :pmap commands. --- common/content/mappings.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/content/mappings.js b/common/content/mappings.js index 0f222d64..697396bb 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -257,8 +257,11 @@ function Mappings() //{{{ addMapCommands("", [modes.NORMAL], ""); addMapCommands("c", [modes.COMMAND_LINE], "command line"); addMapCommands("i", [modes.INSERT, modes.TEXTAREA], "insert"); + // FIXME if (liberator.has("mail")) addMapCommands("m", [modes.MESSAGE], "message"); + if (liberator.has("player")) + addMapCommands("p", [modes.PLAYER], "player"); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// From 16eb0a11484be077b5f9b13f5fc0329353dd3059 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 12:44:00 +1100 Subject: [PATCH 080/143] Fix typo in LocationChange autocomd description. --- vimperator/content/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vimperator/content/config.js b/vimperator/content/config.js index 1a37841a..ab6b0193 100644 --- a/vimperator/content/config.js +++ b/vimperator/content/config.js @@ -49,7 +49,7 @@ const config = { //{{{ ["DOMLoad", "Triggered when a page's DOM content has fully loaded"], ["DownloadPost", "Triggered when a download has completed"], ["Fullscreen", "Triggered when the browser's fullscreen state changes"], - ["LocationChange", "Triggered when changing tabs or when naviagtion to a new location"], + ["LocationChange", "Triggered when changing tabs or when navigation to a new location"], ["PageLoadPre", "Triggered after a page load is initiated"], ["PageLoad", "Triggered when a page gets (re)loaded/opened"], ["ShellCmdPost", "Triggered after executing a shell command with :!cmd"], From c6e675bbdd6cc13db34f4d2b74c3a9e6e0e9507b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 12:45:46 +1100 Subject: [PATCH 081/143] Fix typo in LocationChange autocomd description. --- xulmus/content/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xulmus/content/config.js b/xulmus/content/config.js index 5eed716e..220b3a8c 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -55,7 +55,7 @@ const config = { //{{{ ["DOMLoad", "Triggered when a page's DOM content has fully loaded"], ["DownloadPost", "Triggered when a download has completed"], ["Fullscreen", "Triggered when the browser's fullscreen state changes"], - ["LocationChange", "Triggered when changing tabs or when naviagtion to a new location"], + ["LocationChange", "Triggered when changing tabs or when navigation to a new location"], ["PageLoadPre", "Triggered after a page load is initiated"], ["PageLoad", "Triggered when a page gets (re)loaded/opened"], ["ShellCmdPost", "Triggered after executing a shell command with :!cmd"], From d6238f84a43b848b86bca5ba55b465fad9bdba73 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 25 Mar 2009 01:58:39 +0000 Subject: [PATCH 082/143] Treat strings containing / as URLs In lieu of getting proper hostname detection, allow localhost/ and other similar URLs to work. --- common/content/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/content/util.js b/common/content/util.js index 8ea3d22a..24a167e2 100644 --- a/common/content/util.js +++ b/common/content/util.js @@ -675,7 +675,7 @@ const util = { //{{{ // Ok, not a valid proto. If it looks like URL-ish (foo.com/bar), // let Gecko figure it out. - if (/[.]/.test(url) && !/\s/.test(url) || /^[\w-.]+:\d+(?:\/|$)/.test(url)) + if (/[.\/]/.test(url) && !/\s/.test(url) || /^[\w-.]+:\d+(?:\/|$)/.test(url)) return url; // TODO: it would be clearer if the appropriate call to From d3642a67fa6106b2598b220c86880cf33877d659 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 15:31:24 +1100 Subject: [PATCH 083/143] Whitespace fixes. --- xulmus/content/bookmarks.js | 140 ++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/xulmus/content/bookmarks.js b/xulmus/content/bookmarks.js index 1e0ca0a0..03345b2a 100755 --- a/xulmus/content/bookmarks.js +++ b/xulmus/content/bookmarks.js @@ -57,7 +57,7 @@ function Bookmarks() //{{{ /////////////////////////////////////////////////////////////////////////////{{{ const historyService = PlacesUtils.history; //Cc["@mozilla.org/browser/global-history;1"].getService(Ci.nsIGlobalHistory); - const bookmarksService = PlacesUtils.bookmarks //Cc["@songbirdnest.com/servicepane/bookmarks;1"].getService(Ci.sbIBookmarks); + const bookmarksService = PlacesUtils.bookmarks //Cc["@songbirdnest.com/servicepane/bookmarks;1"].getService(Ci.sbIBookmarks); const taggingService = PlacesUtils.tagging //Cc["@mozilla.org/browser/tagging-service;1"].getService(Ci.nsITaggingService); const faviconService = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService); @@ -571,14 +571,14 @@ function Bookmarks() //{{{ getSuggestions: function getSuggestions(engineName, query, callback) { const responseType = "application/x-suggestions+json"; - + let engine = services.get("browserSearch").getEngineByAlias(engineName); - + if (engine && engine.supportsResponseType(responseType)) var queryURI = engine.getSubmission(query, responseType).uri.spec; if (!queryURI) return []; - + function process(resp) { let results = []; @@ -594,7 +594,7 @@ function Bookmarks() //{{{ } let resp = util.httpGet(queryURI, callback && process); - + if (!callback) return process(resp); }, @@ -620,74 +620,74 @@ function Bookmarks() //{{{ // we need to make sure our custom alias have been set, even if the user // did not :open once before this.getSearchEngines(); - - function getShortcutOrURI(aURL, aPostDataRef) - { - var shortcutURL = null; - var keyword = aURL; - var param = ""; - var searchService = Cc['@mozilla.org/browser/search-service;1'].getService(Ci.nsIBrowserSearchService); - var offset = aURL.indexOf(" "); - if (offset > 0) - { - keyword = aURL.substr(0, offset); - param = aURL.substr(offset + 1); - } - if (!aPostDataRef) - { - aPostDataRef = {}; + + function getShortcutOrURI(aURL, aPostDataRef) + { + var shortcutURL = null; + var keyword = aURL; + var param = ""; + var searchService = Cc['@mozilla.org/browser/search-service;1'].getService(Ci.nsIBrowserSearchService); + var offset = aURL.indexOf(" "); + if (offset > 0) + { + keyword = aURL.substr(0, offset); + param = aURL.substr(offset + 1); } - var engine = searchService.getEngineByAlias(keyword); - if (engine) - { - var submission = engine.getSubmission(param, null); - aPostDataRef.value = submission.postData; - return submission.uri.spec; - } - [shortcutURL, aPostDataRef.value] = PlacesUtils.getURLAndPostDataForKeyword(keyword); - if (!shortcutURL) - { - return aURL; - } - var postData = ""; - if (aPostDataRef.value) - { - postData = unescape(aPostDataRef.value); - } - if (/%s/i.test(shortcutURL) || /%s/i.test(postData)) - { - var charset = ""; - const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/; - var matches = shortcutURL.match(re); - if (matches) - { - [, shortcutURL, charset] = matches; - } - else - { - try - { - charset = PlacesUtils.history.getCharsetForURI(makeURI(shortcutURL)); - } catch (e) { } - } - var encodedParam = ""; - if (charset) - { - encodedParam = escape(convertFromUnicode(charset, param)); - } else { - encodedParam = encodeURIComponent(param); - } - shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param); - if (/%s/i.test(postData)) - { - aPostDataRef.value = getPostDataStream(postData, param, encodedParam, "application/x-www-form-urlencoded"); - } - } else if (param) { - aPostDataRef.value = null; - return aURL; + if (!aPostDataRef) + { + aPostDataRef = {}; } - return shortcutURL; + var engine = searchService.getEngineByAlias(keyword); + if (engine) + { + var submission = engine.getSubmission(param, null); + aPostDataRef.value = submission.postData; + return submission.uri.spec; + } + [shortcutURL, aPostDataRef.value] = PlacesUtils.getURLAndPostDataForKeyword(keyword); + if (!shortcutURL) + { + return aURL; + } + var postData = ""; + if (aPostDataRef.value) + { + postData = unescape(aPostDataRef.value); + } + if (/%s/i.test(shortcutURL) || /%s/i.test(postData)) + { + var charset = ""; + const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/; + var matches = shortcutURL.match(re); + if (matches) + { + [, shortcutURL, charset] = matches; + } + else + { + try + { + charset = PlacesUtils.history.getCharsetForURI(makeURI(shortcutURL)); + } catch (e) { } + } + var encodedParam = ""; + if (charset) + { + encodedParam = escape(convertFromUnicode(charset, param)); + } else { + encodedParam = encodeURIComponent(param); + } + shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param); + if (/%s/i.test(postData)) + { + aPostDataRef.value = getPostDataStream(postData, param, encodedParam, "application/x-www-form-urlencoded"); + } + } else if (param) { + aPostDataRef.value = null; + return aURL; + } + return shortcutURL; } url = getShortcutOrURI(searchString, aPostDataRef); if (url == searchString) From a3594e5ec371aadd870b6787f2a2b978953427cc Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 17:54:00 +1100 Subject: [PATCH 084/143] Use showtabline=2 as the default. --- xulmus/content/config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xulmus/content/config.js b/xulmus/content/config.js index 220b3a8c..bb60f14e 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -465,6 +465,8 @@ const config = { //{{{ ////////////////////// OPTIONS ///////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ + options.get("showtabline").value = 2; + options.add(["online"], "Set the 'work offline' option", "boolean", true, From c5d201fdb1942210d1a1b1fc0929e10c34bf929d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 18:14:22 +1100 Subject: [PATCH 085/143] Reset the defaultValue for 'showtabline' as well. --- xulmus/content/config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xulmus/content/config.js b/xulmus/content/config.js index bb60f14e..ddce2519 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -465,7 +465,8 @@ const config = { //{{{ ////////////////////// OPTIONS ///////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - options.get("showtabline").value = 2; + let stal = options.get("showtabline"); + stal.value = stal.defaultValue = 2; options.add(["online"], "Set the 'work offline' option", From e21436d0dbac74abddfbb5e1d8d47dcd83ec5e2d Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 19:15:45 +1100 Subject: [PATCH 086/143] Remove "B" from 'guioptions' as SB doesn't have a bookmarks bar. --- xulmus/content/config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xulmus/content/config.js b/xulmus/content/config.js index ddce2519..ebf4345a 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -33,12 +33,11 @@ const config = { //{{{ //mainWindowID: "mainplayer", /*** optional options, there are checked for existence and a fallback provided ***/ features: ["bookmarks", "hints", "marks", "history", "quickmarks", "session", "tabs", "windows", "player"], - defaults: { guioptions: "mprb" }, // FIXME: "m" seems to be defaulting to on anyway + defaults: { guioptions: "mprb" }, guioptions: { m: ["Menubar", ["main-menubar"]], T: ["Toolbar", ["nav-bar"]], - B: ["Bookmark bar", ["PersonalToolbar"]], // FIXME: used/relevant? p: ["Player controls", ["player_wrapper"]] }, From 3979d4b5ebf2742cfcb90c707dbd933e70a28083 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 19:21:14 +1100 Subject: [PATCH 087/143] Add several player related autocommands. TrackChangePre, TrackChange, ViewChangePre, ViewChange, StreamStart, StreamPause, StreamEnd and StreamStop --- xulmus/content/player.js | 59 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 1984ad56..7e419cf6 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -23,6 +23,51 @@ function Player() // {{{ SBGetBrowser().mediaTab.mediaPage.highlightItem(_SBGetCurrentView().getIndexForItem(mediaItem)); } + var mediaCoreListener = { + onMediacoreEvent: function (event) + { + switch (event.type) + { + case Ci.sbIMediacoreEvent.BEFORE_TRACK_CHANGE: + liberator.log("Before track changed: " + event.data); + autocommands.trigger("TrackChangePre", { track: event.data }); + break; + case Ci.sbIMediacoreEvent.TRACK_CHANGE: + autocommands.trigger("TrackChange", { track: event.data }); + break; + case Ci.sbIMediacoreEvent.BEFORE_VIEW_CHANGE: + liberator.log("Before view changed: " + event.data); + autocommands.trigger("ViewChangePre", { view: event.data }); + break; + case Ci.sbIMediacoreEvent.VIEW_CHANGE: + liberator.log("View changed: " + event.data); + autocommands.trigger("ViewChange", { view: event.data }); + break; + case Ci.sbIMediacoreEvent.STREAM_START: + liberator.log("Track started: " + event.data); + autocommands.trigger("StreamStart", {}); + break; + case Ci.sbIMediacoreEvent.STREAM_PAUSE: + liberator.log("Track paused: " + event.data); + autocommands.trigger("StreamPause", {}); + break; + case Ci.sbIMediacoreEvent.STREAM_END: + liberator.log("Track ended: " + event.data); + autocommands.trigger("StreamEnd", {}); + break; + case Ci.sbIMediacoreEvent.STREAM_STOP: + liberator.log("Track stopped: " + event.data); + autocommands.trigger("StreamStop", {}); + break; + } + } + }; + + gMM.addListener(mediaCoreListener); + liberator.registerObserver("shutdown", function () { + gMM.removeListener(mediaCoreListener); + }); + /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// MAPPINGS //////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ @@ -139,19 +184,21 @@ function Player() // {{{ function (args) { let library = LibraryUtils.mainLibrary; - let myView = LibraryUtils.createStandardMediaListView(LibraryUtils.mainLibrary, args.string); - if (myView.length == 0) + let view = LibraryUtils.createStandardMediaListView(LibraryUtils.mainLibrary, args.literalArg); + + if (view.length == 0) liberator.echoerr("No Tracks matching the keywords"); else { - SBGetBrowser().loadMediaList(LibraryUtils.mainLibrary, null, null, myView, - "chrome://songbird/content/mediapages/filtersPage.xul"); + SBGetBrowser().loadMediaList(LibraryUtils.mainLibrary, null, null, view, + "chrome://songbird/content/mediapages/filtersPage.xul"); // TODO: make this focusTrack work ? - focusTrack(myView.getItemByIndex(0)); + focusTrack(view.getItemByIndex(0)); } }, { - argCount: "+", + argCount: "1", + literal: 0 //completer: function (context, args) completion.tracks(context, args); }); From 49f3984ba0e3d5f870b3eca52a38a52e0fd4b746 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 19:55:50 +1100 Subject: [PATCH 088/143] Add new autocommands to config and update the help file. --- xulmus/content/config.js | 16 ++++++++++++---- xulmus/locale/en-US/autocommands.txt | 18 ++++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/xulmus/content/config.js b/xulmus/content/config.js index ebf4345a..31034b2f 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -58,9 +58,17 @@ const config = { //{{{ ["PageLoadPre", "Triggered after a page load is initiated"], ["PageLoad", "Triggered when a page gets (re)loaded/opened"], ["ShellCmdPost", "Triggered after executing a shell command with :!cmd"], - ["XulmusEnter", "Triggered after Xulmus starts"], - ["XulmusLeavePre", "Triggered before exiting Xulmus, just before destroying each module"], - ["XulmusLeave", "Triggered before exiting Xulmus"]], + ["TrackChangePre", "Triggered before a playing track is changed"], + ["TrackChange", "Triggered after a playing track has changed"], + ["ViewChangePre", "Triggered before a sequencer view is changed"], + ["ViewChange", "Triggered after a sequencer view is changed"], + ["StreamStart", "Triggered after a stream has started"], + ["StreamPause", "Triggered after a stream has paused"], + ["StreamEnd", "Triggered after a stream has ended"], + ["StreamStop", "Triggered after a stream has stopped"], + ["XulmusEnter", "Triggered after Songbird starts"], + ["XulmusLeavePre", "Triggered before exiting Songbird, just before destroying each module"], + ["XulmusLeave", "Triggered before exiting Songbird"]], // TODO: remove those which don't make sense, can't be provided. dialogs: [ @@ -130,7 +138,7 @@ const config = { //{{{ //TODO : Write intro.html and tutorial.html // they are sorted by relevance, not alphabetically - helpFiles: [ "player.html" ], + helpFiles: [ "player.html", "autocommands.html" ], /* "intro.html", "tutorial.html", "starting.html", "browsing.html", "buffer.html", "cmdline.html", "insert.html", "options.html", "pattern.html", "tabs.html", "hints.html", "map.html", "eval.html", diff --git a/xulmus/locale/en-US/autocommands.txt b/xulmus/locale/en-US/autocommands.txt index 36104b56..ab936a04 100755 --- a/xulmus/locale/en-US/autocommands.txt +++ b/xulmus/locale/en-US/autocommands.txt @@ -12,7 +12,7 @@ Execute commands automatically on events. [c]:au[tocmd][c] {event} {pat} {cmd} -Add {cmd} to the list of commands Vimperator will execute on {event} for a URL matching {pat}: +Add {cmd} to the list of commands Xulmus will execute on {event} for a URL matching {pat}: * [c]:autocmd[!][c] {events} {pat}: list/remove autocommands filtered by {events} and {pat} * [c]:autocmd[!][c] {events}: list/remove autocommands matching {events} @@ -31,9 +31,17 @@ Available {events}: *PageLoadPre* Triggered after a page load is initiated *PageLoad* Triggered when a page gets (re)loaded/opened *ShellCmdPost* Triggered after executing a shell command with [c]:![c]#{cmd} -*VimperatorEnter* Triggered after Firefox starts -*VimperatorLeavePre* Triggered before exiting Firefox, just before destroying each module -*VimperatorLeave* Triggered before exiting Firefox +*TrackChangePre* Triggered before a playing track is changed +*TrackChange* Triggered after a playing track has changed +*ViewChangePre* Triggered before a sequencer view is changed +*ViewChange* Triggered after a sequencer view is changed +*StreamStart* Triggered after a stream has started +*StreamPause* Triggered after a stream has paused +*StreamEnd* Triggered after a stream has ended +*StreamStop* Triggered after a stream has stopped +*XulmusEnter* Triggered after Songbird starts +*XulmusLeavePre* Triggered before exiting Songbird, just before destroying each module +*XulmusLeave* Triggered before exiting Songbird -------------------------------------------------------------- {pat} is a regular expression, use .* if you want to match all URLs. @@ -53,6 +61,8 @@ The following keywords are available where relevant: ** The target destination of a download. Only for *DownloadPost*. ** The new fullscreen state. Only for *Fullscreen*. ** The color scheme name. Only for *ColorScheme*. +** The new sequencer view. Only for *ViewChangePre* and *ViewChange*. +** The new media track. Only for *TrackChangePre* and *TrackChange*. -------------------------------------------------------------- ________________________________________________________________________________ From ace07cef56839f95c138a5faacda00c03140a8b2 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 20:13:08 +1100 Subject: [PATCH 089/143] Update options.txt for Xulmus. --- xulmus/content/config.js | 2 +- xulmus/locale/en-US/autocommands.txt | 2 +- xulmus/locale/en-US/options.txt | 68 ++++++++++++++-------------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/xulmus/content/config.js b/xulmus/content/config.js index 31034b2f..89590b57 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -138,7 +138,7 @@ const config = { //{{{ //TODO : Write intro.html and tutorial.html // they are sorted by relevance, not alphabetically - helpFiles: [ "player.html", "autocommands.html" ], + helpFiles: [ "player.html", "options.html", "autocommands.html" ], /* "intro.html", "tutorial.html", "starting.html", "browsing.html", "buffer.html", "cmdline.html", "insert.html", "options.html", "pattern.html", "tabs.html", "hints.html", "map.html", "eval.html", diff --git a/xulmus/locale/en-US/autocommands.txt b/xulmus/locale/en-US/autocommands.txt index ab936a04..c2af4a9a 100755 --- a/xulmus/locale/en-US/autocommands.txt +++ b/xulmus/locale/en-US/autocommands.txt @@ -26,7 +26,7 @@ Available {events}: *ColorScheme* Triggered after a color scheme has been loaded *DOMLoad* Triggered when a page's DOM content has fully loaded *DownloadPost* Triggered when a download has completed -*Fullscreen* Triggered when the browser's fullscreen state changes +*Fullscreen* Triggered when the player's fullscreen state changes *LocationChange* Triggered when changing tabs or when navigating to a new location *PageLoadPre* Triggered after a page load is initiated *PageLoad* Triggered when a page gets (re)loaded/opened diff --git a/xulmus/locale/en-US/options.txt b/xulmus/locale/en-US/options.txt index a16aa9f6..9ad5f1de 100755 --- a/xulmus/locale/en-US/options.txt +++ b/xulmus/locale/en-US/options.txt @@ -2,7 +2,7 @@ HEADER |options| + -Vimperator has a number of internal variables and switches which can be set to +Xulmus has a number of internal variables and switches which can be set to achieve special effects. These options come in 5 forms: `------------`----------------------------------------- *boolean* can only be on or off @@ -155,35 +155,35 @@ Environment variables are expanded for path options like 'cdpath' and 'runtimepath'. The variable notation is _$VAR_ (terminated by a non-word character) or _$\\{VAR}_. _%VAR%_ is also supported on Windows. -section:Setting{nbsp}Firefox{nbsp}options[firefox-options,preferences] +section:Setting{nbsp}Songbird{nbsp}options[songbird-options,preferences] -Firefox options can be viewed and set with the following commands: +Songbird options can be viewed and set with the following commands: |:prefs| |:preferences| ||:pref[erences]|| ________________________________________________________________________________ -Show the Firefox preferences dialog. You can change the browser preferences -from this dialog. Be aware that not all Firefox preferences work, because -Vimperator overrides some key bindings and changes Firefox's GUI. +Show the Songbird preferences dialog. You can change the player preferences +from this dialog. Be aware that not all Songbird preferences work, because +Xulmus overrides some key bindings and changes Songbird's GUI. ________________________________________________________________________________ |:prefs!| |:preferences!| ||:pref[erences]!|| ________________________________________________________________________________ -Opens about:config in the current tab where you can change advanced Firefox +Opens about:config in the current tab where you can change advanced Songbird preferences. ________________________________________________________________________________ |:set!| |:set-!| ||:se[t]! {preference}={value}|| + ________________________________________________________________________________ -Change any Firefox {preference} (those in the about:config window). You can also -reset/delete those preferences with [c]:set! {preference}&[c]. +Change any Songbird {preference} (those in the about:config window). You can +also reset/delete those preferences with [c]:set! {preference}&[c]. ________________________________________________________________________________ |overridden-preferences| + -Vimperator sets several Firefox preferences at startup. If this is undesirable, +Xulmus sets several Songbird preferences at startup. If this is undesirable, they can be changed to a different value in your RC file using [c]:set! {preference}={value}[c] @@ -231,7 +231,7 @@ Items which are completed at the [c]:[tab]open[c] prompt. Available items: `---`-------------------------------------------------------------------------------- *s* Search engines and keyword URLs *f* Local files -*l* Firefox location bar entries (bookmarks and history sorted in an intelligent way) +*l* Songbird location bar entries (bookmarks and history sorted in an intelligent way) *b* Bookmarks *S* Suggest engines ------------------------------------------------------------------------------------- @@ -253,7 +253,7 @@ schwarzenegger[c] will be exactly the same as [c]:open youtube arnold schwarzenegger[c]. Therefore, you need to add a keyword or search engine "youtube" first. -If 'defsearch' is empty, then Firefox will always attempt to open the +If 'defsearch' is empty, then Songbird will always attempt to open the raw [a][arg][a]. ____ @@ -265,7 +265,7 @@ Set the external text editor. Sets the editor to run when [m][m] is pressed in INSERT and TEXTAREA modes. -Warning: Vimperator will not behave correctly if the editor forks its own +Warning: Xulmus will not behave correctly if the editor forks its own process, such as with gvim without the -f argument. ____ @@ -331,7 +331,7 @@ Show or hide certain GUI elements like the menu or toolbar. Supported characters `---`----------- *m* Menubar *T* Toolbar -*B* Bookmark bar +*p* Player controls *n* Tab number *N* Tab number over image *b* Bottom scrollbar @@ -439,8 +439,8 @@ ____ ||'insertmode' 'im'|| boolean (default: on) ____ Use Insert mode as the default for text areas. -Makes Vimperator work in a way that Insert mode is the default mode for text areas. -Useful if you want to use Vimperator as a modeless editor, keeping the known Firefox interface for editing text areas. +Makes Xulmus work in a way that Insert mode is the default mode for text areas. +Useful if you want to use Xulmus as a modeless editor, keeping the known Songbird interface for editing text areas. ____ @@ -471,9 +471,9 @@ ____ ||'loadplugins' 'lpl'|| boolean (default on) ____ Load plugin scripts when starting up. When on, yet unloaded plugins are -automatically loaded after the vimperatorrc file has been sourced. To +automatically loaded after the xulmusrc file has been sourced. To load plugins earlier, use the [c]:loadplugins[c] command within the -vimperatorrc. +xulmusrc. ____ @@ -555,12 +555,12 @@ they always open in a new tab. Possible values: .---`------------------------------------------------------------------------------------------------ *0* Force to open in the current tab (Warning: this can stop some web sites from working correctly!) *1* Always open in a new tab -*2* Open in a new window if it has a specific requested size (default in Firefox) +*2* Open in a new window if it has a specific requested size (default in Songbird) *3* Always open in a new window *4* Open in the same tab unless it has a specific requested size ----------------------------------------------------------------------------------------------------- -Note: This option does not change the popup blocker of Firefox in any way. +Note: This option does not change the popup blocker of Songbird in any way. ____ @@ -570,7 +570,7 @@ ____ Speed up first time history/bookmark completion History access can be quite slow for a large history. -Vimperator maintains a cache to speed it up significantly on subsequent access. +Xulmus maintains a cache to speed it up significantly on subsequent access. In order to also speed up first time access, it is cached at startup, if this option is set (recommended). ____ @@ -587,23 +587,23 @@ link elements are those defined by 'hinttags'. ____ -|$VIMPERATOR_RUNTIME| +|$XULMUS_RUNTIME| |\'rtp'| |\'runtimepath'| ||'runtimepath' 'rtp'|| stringlist ____ -(default: _$VIMPERATOR_RUNTIME_ or Unix, Mac: "\~/.vimperator", Windows: "\~/vimperator") +(default: _$XULMUS_RUNTIME_ or Unix, Mac: "\~/.xulmus", Windows: "\~/xulmus") List of directories searched for runtime files: + colors/ + macros/ + plugin/ + -Example: [c]:set runtimepath=\~/myvimperator,\~/.vimperator[c] + -This will search for plugins in both "\~/myvimperator/plugin" and -"\~/.vimperator/plugin" +Example: [c]:set runtimepath=\~/myxulmus,\~/.xulmus[c] + +This will search for plugins in both "\~/myxulmus/plugin" and +"\~/.xulmus/plugin" -On startup, if the environment variable _$VIMPERATOR_RUNTIME_ does not -exist, Vimperator will set it to match this value. +On startup, if the environment variable _$XULMUS_RUNTIME_ does not +exist, Xulmus will set it to match this value. ____ @@ -690,13 +690,13 @@ ____ |\'titlestring'| -||'titlestring'|| string (default: "Vimperator") +||'titlestring'|| string (default: "Xulmus") ____ -Change the title of the browser window. -Vimperator changes the browser title from "Title of web page - Mozilla Firefox" to -"Title of web page - Vimperator". + +Change the title of the player window. +Xulmus changes the player title from "Songbird" to +"Title of tab - Xulmus". + If you don't like that, you can restore it with: -[c]:set titlestring=Mozilla\ Firefox[c]. +[c]:set titlestring=Songbird[c]. ____ @@ -725,7 +725,7 @@ ____ ||'verbose' 'vbs'|| number (default: 1) ____ Define which info messages are displayed. -When bigger than zero, Vimperator will give messages about what it is doing. +When bigger than zero, Xulmus will give messages about what it is doing. These can be viewed at any time with the [c]:messages[c] command. The highest value is 15, being the most verbose mode. From 3fad7406d201be3c2d3ebe49eda73cbc4ce0386f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 25 Mar 2009 23:24:45 +1100 Subject: [PATCH 090/143] Use a green tilde for the Xulmus icon. --- xulmus/skin/icon.png | Bin 514 -> 465 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/xulmus/skin/icon.png b/xulmus/skin/icon.png index e821ed66aa94c38f809f64142d69b2252bb7a622..3d16d3fc225a8046756f9e96ba0f839557abc2af 100755 GIT binary patch delta 379 zcmV->0fhd71knSKUw;D`3>G>-+7N>P00B`+L_t(o!|m3wOB_)U$MMe|Vn8COWw5i* zLIM^Bn;2rFjR=N-kjCn;F@J!awHAVvL?oqufMRbUXklY3L;{8su@E!}Nj#fDmgCMW zc)KUE-{vi|!<*lmc{4mpo*3^ii+}imo+f^as9~nn0{UZJkADE04SWXi8(Vo~Ac^%Q z&O*dQ>VF50@D1I0mt!&noT4ji%Tb1p2iQt9u zA+k`zSgSX$WbnC8eNPvC`aYcF5WnIMj1(zg8&?>>rzpd5v}5kfMZjvxwiC9cyo0~O z1$G-u%1hi}sC1Q+ubw@OVmR6`O%)qBz+2p=M8D1u^E}%5ezexJfGK=z5FEZldEVnQ z*1|r3`3wT~(*jCLO4?52K~z(#^J?ywJnmtVJQz6J4v!L0X?F=a{(Gv2vXT_@E-ZQ8 Z+yP*`Kx7U@%8vj5002ovPDHLkV1gaNt>gdz delta 429 zcmV;e0aE_a1A+vQUw;A{5;H0^PrpF`00DwYL_t(o!|l{PYgADXhw&QSW z*X{V6BF+^5H{mTlVMpENIF|xGVq4m7W_eCx%OHB-d8A z8GN8z$}9wqSAF)er(XU-;FljU@3dx$RGtw<0nRNHOufWpJVM@$$;a9?Rna6 z)E#^ezT-ugNq_kRtJq)VRwfSFQ2Lqo$qr^g_Qy*QXdW`S0_hu<)*uNCTvQDT;e;@co*h)LoA zu{r&o5mOZ>BwiEi#QdMb<0-M&A!x1G->O=`ed1_`Z6=5~OWY$q5KF`>Vyx-lhAQ|C X4wHD0h+54g00000NkvXXu0mjfsISS& From 683d569eb286be62582f3f9ad149fb8f3500c74c Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 26 Mar 2009 00:25:59 +1100 Subject: [PATCH 091/143] Remove the unwanted SB margin from the command line. --- common/skin/liberator.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/skin/liberator.css b/common/skin/liberator.css index 48c22c33..a5857cd5 100644 --- a/common/skin/liberator.css +++ b/common/skin/liberator.css @@ -141,13 +141,17 @@ statusbarpanel { } #liberator-commandline-prompt { + background-color: inherit; margin: 0px; padding: 0px; - background-color: inherit; } #liberator-commandline-command { background-color: inherit; color: inherit; + margin: 0px; +} +#liberator-message { + margin: 0px; } #sidebar { From a5b6ec3478758bbed5f636c8d9d8f33638c718c6 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 26 Mar 2009 01:04:02 +1100 Subject: [PATCH 092/143] Refactor player#togglePlayPause. --- xulmus/TODO | 2 ++ xulmus/content/bookmarks.js | 3 ++- xulmus/content/player.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/xulmus/TODO b/xulmus/TODO index 1a85e4cd..1585a2fe 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -6,6 +6,8 @@ BUGS: - SB doesn't support tab-undo yet so :undo and "u" etc don't work - :tabduplicate - :back/H, :forward,L + - :open songbird-internal-search searchString + Is this workable anyway? --djk FEATURES: 9 / and ? possibly reusing "Jump to" functionality directly. diff --git a/xulmus/content/bookmarks.js b/xulmus/content/bookmarks.js index 03345b2a..9f73121f 100755 --- a/xulmus/content/bookmarks.js +++ b/xulmus/content/bookmarks.js @@ -621,7 +621,6 @@ function Bookmarks() //{{{ // did not :open once before this.getSearchEngines(); - function getShortcutOrURI(aURL, aPostDataRef) { var shortcutURL = null; @@ -689,7 +688,9 @@ function Bookmarks() //{{{ } return shortcutURL; } + url = getShortcutOrURI(searchString, aPostDataRef); + if (url == searchString) url = null; diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 7e419cf6..670d93b1 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -365,7 +365,7 @@ function Player() // {{{ togglePlayPause: function togglePlayPause() { gSongbirdWindowController.doCommand("cmd_control_playpause"); - SBGetBrowser().mediaTab.mediaPage.highlightItem(_SBGetCurrentView().getIndexForItem(gMM.sequencer.currentItem)); + focusTrack(gMM.sequencer.currentItem); }, toggleShuffle: function toggleShuffle() From bda0c5bda592560fb131c832259be3ab6edfb3e1 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Thu, 26 Mar 2009 02:48:55 +0000 Subject: [PATCH 093/143] Fix #180. User can no-longer interrupt macros. Buffers any keystrokes recieved during a macro expansion and plays them after it has finished. --- common/content/events.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 5e1b7e02..3c58afc2 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -898,6 +898,7 @@ function Events() //{{{ let wasFeeding = this.feedingKeys; this.feedingKeys = true; + this.duringFeed = this.duringFeed || ""; let wasSilent = commandline.silent; if (silent) commandline.silent = silent; @@ -993,6 +994,15 @@ function Events() //{{{ this.feedingKeys = wasFeeding; if (silent) commandline.silent = wasSilent; + + if (this.duringFeed != "") + { + //Create a scalar constant for closure. + let duringFeed = this.duringFeed; + this.duringFeed = ""; + + setTimeout(function () events.feedkeys(duringFeed, false, false, true), 0); + } } return i == keys.length; }, @@ -1370,9 +1380,9 @@ function Events() //{{{ // we can differentiate between a recorded // interrupting whatever it's started and a real // interrupting our playback. - if (events.feedingKeys) + if (events.feedingKeys && !event.isMacro) { - if (key == "" && !event.isMacro) + if (key == "") { events.feedingKeys = false; if (modes.isReplaying) @@ -1384,6 +1394,13 @@ function Events() //{{{ event.stopPropagation(); return true; } + else + { + events.duringFeed += key; + event.preventDefault(); + event.stopPropagation(); + return true; + } } let stop = true; // set to false if we should NOT consume this event but let Firefox handle it From 4282b07d77372c549efd6ec8209d7a6be2aaacdb Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Thu, 26 Mar 2009 03:11:17 +0000 Subject: [PATCH 094/143] Fix uploading of files by relative path name. Use io.getFile(path).path instead of just path in order to create an absolute path. --- common/content/buffer.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 4cd9fdeb..a9cb4831 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1021,7 +1021,16 @@ function Buffer() //{{{ } else if (elemTagName == "input" && elem.getAttribute('type').toLowerCase() == "file") { - commandline.input("Upload file: ", function (file) elem.value = file, {completer: completion.file, default: elem.value}); + commandline.input("Upload file: ", function (path) + { + let file = io.getFile(path); + + if (!file.exists()) + return liberator.beep(); + + elem.value = file.path; + } + , {completer: completion.file, default: elem.value}); return; } @@ -1131,7 +1140,16 @@ function Buffer() //{{{ } else if (localName == "input" && elem.getAttribute('type').toLowerCase() == "file") { - commandline.input("Upload file: ", function (file) elem.value = file, {completer: completion.file, default: elem.value}); + commandline.input("Upload file: ", function (path) + { + let file = io.getFile(path); + + if (!file.exists()) + return liberator.beep(); + + elem.value = file.path; + } + , {completer: completion.file, default: elem.value}); return; } From 702f8f9a3eceeb9729f95ac6a793c45c72eed85e Mon Sep 17 00:00:00 2001 From: Daniel Bainton Date: Thu, 26 Mar 2009 09:34:10 +0200 Subject: [PATCH 095/143] Doc fixes (thanks Xie&Tian) --- vimperator/AUTHORS | 2 +- vimperator/locale/en-US/browsing.txt | 2 +- vimperator/locale/en-US/buffer.txt | 26 +++++++++++++------------- vimperator/locale/en-US/eval.txt | 2 +- vimperator/locale/en-US/gui.txt | 4 ++-- vimperator/locale/en-US/index.txt | 8 ++++---- vimperator/locale/en-US/map.txt | 2 +- vimperator/locale/en-US/marks.txt | 4 ++-- vimperator/locale/en-US/options.txt | 10 +++++----- vimperator/locale/en-US/repeat.txt | 2 +- vimperator/locale/en-US/tutorial.txt | 2 +- vimperator/locale/en-US/various.txt | 6 +++--- 12 files changed, 35 insertions(+), 35 deletions(-) diff --git a/vimperator/AUTHORS b/vimperator/AUTHORS index 7f809a95..d2ec10d5 100644 --- a/vimperator/AUTHORS +++ b/vimperator/AUTHORS @@ -19,7 +19,7 @@ Inactive/former developers: Patches (in no special order): * Ruud Grosmann ('followhints' option) - * Xie&Tian (multibyte support for hints) + * Xie&Tian (multibyte support for hints, doc fixes) * Juergen Descher * Kazuo (count support for ctrl-^) * Daniel Schaffrath (;b support) diff --git a/vimperator/locale/en-US/browsing.txt b/vimperator/locale/en-US/browsing.txt index c2a7dbba..95a4cbe4 100644 --- a/vimperator/locale/en-US/browsing.txt +++ b/vimperator/locale/en-US/browsing.txt @@ -51,7 +51,7 @@ Each token is analyzed and in this order: to set a custom name, you can change it with [c]:dialog searchengines[c]. 3. Opened with the default search engine or keyword (specified with the 'defsearch' option) if the first word is no search engine ([c]:open linus - torvalds[c] opens a Google search for linux torvalds). + torvalds[c] opens a Google search for linus torvalds). 4. Passed directly to Firefox in all other cases ([c]:open www.osnews.com, www.slashdot.org[c] opens OSNews in the current, and Slashdot in a new background tab). diff --git a/vimperator/locale/en-US/buffer.txt b/vimperator/locale/en-US/buffer.txt index 95d6bab0..0fe91f6e 100644 --- a/vimperator/locale/en-US/buffer.txt +++ b/vimperator/locale/en-US/buffer.txt @@ -123,6 +123,16 @@ set). ________________________________________________________________________________ +|| |l| + +||[count]l|| +________________________________________________________________________________ +Scroll document to the right. If [count] is specified then move [count] times +as much to the right. + +If the document cannot scroll more, a beep is emitted (unless 'visualbell' is +set). +________________________________________________________________________________ + + || + ||[count]|| ________________________________________________________________________________ @@ -141,16 +151,6 @@ first set to this value. ________________________________________________________________________________ -|| |l| + -||[count]l|| -________________________________________________________________________________ -Scroll document to the right. If [count] is specified then move [count] times -as much to the right. + -If the document cannot scroll more, a beep is emitted (unless 'visualbell' is -set). -________________________________________________________________________________ - - || || || + ||[count]|| ________________________________________________________________________________ @@ -235,7 +235,7 @@ default zoom levels are 30%, 50%, 67%, 80%, 90%, 100%, 110%, 120%, 133%, 150%, The available zoom range can be changed by setting the \'http://kb.mozillazine.org/Zoom.minPercent[zoom.minPercent]' and -\'http://kb.mozillazine.org/Zoom.minPercent[zoom.maxPercent]' Firefox +\'http://kb.mozillazine.org/Zoom.maxPercent[zoom.maxPercent]' Firefox preferences. The zoom levels can be changed using the \'http://kb.mozillazine.org/Toolkit.zoomManager.zoomValues[toolkit.ZoomManager.zoomLevels]' preference. @@ -274,7 +274,7 @@ ________________________________________________________________________________ |zz| + ||[count]zz|| ________________________________________________________________________________ -Set text zoom value of current web page. Zoom value can be between 30 and 300%. +Set text zoom value of current web page. Zoom value can be between 30% and 300%. If it is omitted, text zoom is reset to 100%. ________________________________________________________________________________ @@ -320,7 +320,7 @@ ________________________________________________________________________________ ||:zo[om][!] +{value} | -{value}|| + ________________________________________________________________________________ Set zoom value of current web page. [a][value][a] can be an absolute value -between 30 and 300% or a relative value if prefixed with "-" or "+". If +between 30% and 300% or a relative value if prefixed with "-" or "+". If [a][value][a] is omitted, zoom is reset to 100%. Normally this command operates on the text zoom, if used with [!] it operates diff --git a/vimperator/locale/en-US/eval.txt b/vimperator/locale/en-US/eval.txt index 17c71dda..bbc0d5ba 100644 --- a/vimperator/locale/en-US/eval.txt +++ b/vimperator/locale/en-US/eval.txt @@ -70,7 +70,7 @@ ________________________________________________________________________________ ________________________________________________________________________________ Sets or lists a variable. Sets the variable {var-name} to the value of the expression {expr1}. If no expression is given, the value of the variable is -displayed.Without arguments, displays a list of all variables. +displayed. Without arguments, displays a list of all variables. ________________________________________________________________________________ diff --git a/vimperator/locale/en-US/gui.txt b/vimperator/locale/en-US/gui.txt index 4da826c5..bec1f78b 100644 --- a/vimperator/locale/en-US/gui.txt +++ b/vimperator/locale/en-US/gui.txt @@ -20,7 +20,7 @@ ________________________________________________________________________________ |:addo| |:addons| + ||:addo[ns]|| ________________________________________________________________________________ -Show available Browser Extensions and Themes. +Show available browser Extensions and Themes. You can add/remove/disable browser extensions from this dialog. Be aware that not all Firefox extensions work, because Vimperator overrides some key bindings and changes Firefox's GUI. @@ -34,7 +34,7 @@ Open a Firefox dialog. Available dialogs: `------------------`----------------------------------- -*about* About Firefox +*about* About Mozilla Firefox *addbookmark* Add bookmark for the current page *addons* Manage Add-ons *bookmarks* List your bookmarks diff --git a/vimperator/locale/en-US/index.txt b/vimperator/locale/en-US/index.txt index 5a6a2fbb..085792e3 100644 --- a/vimperator/locale/en-US/index.txt +++ b/vimperator/locale/en-US/index.txt @@ -170,7 +170,7 @@ section:Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:delmarks[c]|| Delete the specified marks + ||[c]:delqmarks[c]|| Delete the specified QuickMarks + ||[c]:delstyle[c]|| Delete any matching styles + -||[c]:dialog[c]|| Open a undefined dialog + +||[c]:dialog[c]|| Open a Firefox dialog + ||[c]:doautoall[c]|| Apply the autocommands matching the specified URL to all buffers + ||[c]:doautocmd[c]|| Apply the autocommands matching the specified URL to the current buffer + ||[c]:downloads[c]|| Show progress of current downloads + @@ -217,11 +217,11 @@ section:Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:qmark[c]|| Mark a URL with a letter for quick access + ||[c]:qmarks[c]|| Show all QuickMarks + ||[c]:quit[c]|| Quit current tab + -||[c]:quitall[c]|| Quit undefined + +||[c]:quitall[c]|| Quit Vimperator + ||[c]:redraw[c]|| Redraw the screen + ||[c]:reload[c]|| Reload current page + ||[c]:reloadall[c]|| Reload all tab pages + -||[c]:restart[c]|| Force undefined to restart + +||[c]:restart[c]|| Force the browser to restart + ||[c]:runtime[c]|| Source the specified file from each directory in 'runtimepath' + ||[c]:saveas[c]|| Save current document to disk + ||[c]:sbclose[c]|| Close the sidebar window + @@ -261,7 +261,7 @@ section:Options[option-index] ||'activate'|| Define when tabs are automatically activated + ||'cdpath'|| List of directories searched when executing [c]:cd[c] + -||'complete'|| Items which are completed at the [c]:[tab]open prompt[c] + +||'complete'|| Items which are completed at the [c]:[tab]open[c] prompt + ||'defsearch'|| Set the default search engine + ||'editor'|| Set the external text editor + ||'errorbells'|| Ring the bell when an error message is displayed + diff --git a/vimperator/locale/en-US/map.txt b/vimperator/locale/en-US/map.txt index 6dce047a..b1073ffe 100644 --- a/vimperator/locale/en-US/map.txt +++ b/vimperator/locale/en-US/map.txt @@ -346,7 +346,7 @@ Custom completion Custom completion can be provided by specifying the "custom,{func}" argument to -complete. The {func} is called with two arguments, a completion context, and an object describing the command's arguments. It should set the context's -\'completions' property, or return an object, with \'start' and \'items' +\'completions' property, or return an object, with \'items' and \'start' properties, describing the completions and where the replacement is to start. *start* is the index into the word being completed at which the returned values diff --git a/vimperator/locale/en-US/marks.txt b/vimperator/locale/en-US/marks.txt index 837268be..7a6e1239 100644 --- a/vimperator/locale/en-US/marks.txt +++ b/vimperator/locale/en-US/marks.txt @@ -80,7 +80,7 @@ section:History[history] ||[count]|| ________________________________________________________________________________ Go to an older position in the jump list. The jump list is just the browser -history for now. +history for now. If [count] is specified go back [count] pages. ________________________________________________________________________________ @@ -88,7 +88,7 @@ ________________________________________________________________________________ ||[count]|| ________________________________________________________________________________ Go to a newer position in the jump list. The jump list is just the browser -history for now. +history for now. If [count] is specified go forward [count] pages. ________________________________________________________________________________ diff --git a/vimperator/locale/en-US/options.txt b/vimperator/locale/en-US/options.txt index bf042502..c434cb79 100644 --- a/vimperator/locale/en-US/options.txt +++ b/vimperator/locale/en-US/options.txt @@ -252,7 +252,7 @@ Sets the default search engine. The default search engine name is used in the [c]:[tab]open [arg][c] command if [a][arg][a] neither looks like a URL or like a specified search engine/keyword. -This means, it you set 'defsearch' to "youtube", then [c]:open arnold +This means, if you set 'defsearch' to "youtube", then [c]:open arnold schwarzenegger[c] will be exactly the same as [c]:open youtube arnold schwarzenegger[c]. Therefore, you need to add a keyword or search engine "youtube" first. @@ -472,7 +472,7 @@ ____ |\'nolpl'| |\'lpl'| |\'noloadplugins'| |\'loadplugins'| -||'loadplugins' 'lpl'|| boolean (default on) +||'loadplugins' 'lpl'|| boolean (default: on) ____ Load plugin scripts when starting up. When on, yet unloaded plugins are automatically loaded after the vimperatorrc file has been sourced. To @@ -527,7 +527,7 @@ ____ |\'noonline'| |\'online'| -||'online'|| boolean (default on) +||'online'|| boolean (default: on) ____ Show and set the \'work offline' behavior. ____ @@ -571,7 +571,7 @@ ____ |\'nopreload'| |\'preload'| ||'preload' 'nopreload'|| boolean (default: on) ____ -Speed up first time history/bookmark completion +Speed up first time history/bookmark completion. History access can be quite slow for a large history. Vimperator maintains a cache to speed it up significantly on subsequent access. @@ -751,7 +751,7 @@ ____ |\'wildcase'| |\'wic'| ||'wildcase' 'wic'|| string (default: "smart") ____ -Defines how completions are matched with regard to character case. +Defines how completions are matched with regard to character case. Possible values: `---------------`------------------------ "smart" Case is significant when capital letters are typed diff --git a/vimperator/locale/en-US/repeat.txt b/vimperator/locale/en-US/repeat.txt index 975cbea7..8d1adb3a 100644 --- a/vimperator/locale/en-US/repeat.txt +++ b/vimperator/locale/en-US/repeat.txt @@ -132,7 +132,7 @@ section:Profiling[profile,profiling] |:time| ||:[count]time[!] {code|:command}|| + ________________________________________________________________________________ -Profile a piece of code or a command. Run {code} [count] times (default 1) +Profile a piece of code or a command. Run {code} [count] times (default: 1) and returns the elapsed time. {code} is always passed to JavaScript's eval(), which might be slow, so take the results with a grain of salt. diff --git a/vimperator/locale/en-US/tutorial.txt b/vimperator/locale/en-US/tutorial.txt index 21b5e285..f85af34f 100644 --- a/vimperator/locale/en-US/tutorial.txt +++ b/vimperator/locale/en-US/tutorial.txt @@ -57,7 +57,7 @@ Similarly, help on configurable options is available with [c]:help '{option_name}'[c]. (Note the single quotes around the option name as in Vim.) Information on all available options is, predictably, [c]:help options[c]. -and you can find out about the [m]gt[m] and [m]gT[m] mapping with +And you can find out about the [m]gt[m] and [m]gT[m] mapping with \{nbsp}[c]:help gt[c] + \{nbsp}[c]:help gT[c] diff --git a/vimperator/locale/en-US/various.txt b/vimperator/locale/en-US/various.txt index 79d485dc..7110495f 100644 --- a/vimperator/locale/en-US/various.txt +++ b/vimperator/locale/en-US/various.txt @@ -11,9 +11,9 @@ ________________________________________________________________________________ || |CTRL-L| |:redr| |:redraw| + ||:redr[aw]|| -____ +________________________________________________________________________________ Redraws the screen. Useful to update the screen halfway executing a script or function. -____ +________________________________________________________________________________ |:norm| |:normal| ||:norm[al][!] {commands}|| + @@ -54,7 +54,7 @@ ________________________________________________________________________________ Open help window. The default page, as specified by 'helpfile' is shown unless [a][subject][a] is specified. If you need help for a specific topic, try [c]:help overview[c]. -____________________________________________________________________________ +________________________________________________________________________________ |:exu| |:exusage| + From 59c1eaa4c80d8650954fa56dd3b646d3a703bedd Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 26 Mar 2009 21:54:28 +1100 Subject: [PATCH 096/143] Add a :mediaview command to change media views. --- common/content/completion.js | 8 +++ xulmus/TODO | 1 + xulmus/content/player.js | 122 +++++++++++++++++++++++++---------- 3 files changed, 96 insertions(+), 35 deletions(-) diff --git a/common/content/completion.js b/common/content/completion.js index 7596362f..0494759b 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1664,6 +1664,14 @@ function Completion() //{{{ context.completions = marks.all; }, + mediaView: function mediaView(context) + { + context.title = ["Media View", "URL"]; + context.anchored = false; + context.keys = { text: "contentTitle", description: "contentUrl" }; + context.completions = player.getMediaPages(); + }, + menuItem: function menuItem(context) { context.title = ["Menu Path", "Label"]; diff --git a/xulmus/TODO b/xulmus/TODO index 1585a2fe..867a6947 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -8,6 +8,7 @@ BUGS: - :back/H, :forward,L - :open songbird-internal-search searchString Is this workable anyway? --djk + - is off by one when alternating with the media tab FEATURES: 9 / and ? possibly reusing "Jump to" functionality directly. diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 670d93b1..e3710cf4 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -11,6 +11,9 @@ function Player() // {{{ // Get the focus to the visible playlist first //window._SBShowMainLibrary(); + const pageService = Components.classes["@songbirdnest.com/Songbird/MediaPageManager;1"] + .getService(Components.interfaces.sbIMediaPageManager); + // interval (milliseconds) function seek(interval, direction) { @@ -202,6 +205,41 @@ function Player() // {{{ //completer: function (context, args) completion.tracks(context, args); }); + commands.add(["load"], + "Load a playlist", + function (args) + { + let arg = args.literalArg; + + if (arg) + { + // load the selected playlist/smart playlist + let playlists = player.getPlaylists(); + + for ([i, list] in Iterator(playlists)) + { + if (util.compareIgnoreCase(arg, list.name) == 0) + { + SBGetBrowser().loadMediaList(playlists[i]); + focusTrack(_SBGetCurrentView().getItemByIndex(0)); + return; + } + } + + liberator.echoerr("E475: Invalid argument: " + arg); + } + else + { + // load main library if there are no args + _SBShowMainLibrary(); + } + }, + { + argCount: "?", + completer: function(context, args) completion.playlist(context, args), + literal: 0 + }); + // TODO: better off as a single command (:player play) or cmus compatible (:player-play)? --djk commands.add(["playerp[lay]"], "Play track", @@ -260,6 +298,41 @@ function Player() // {{{ }, { argCount: "1" }); + commands.add(["mediav[iew]"], + "Change the current media view", + function (args) + { + // FIXME: is this a SB restriction? --djk + if (!gBrowser.currentMediaPage) + { + liberator.echoerr("Exxx: Can only set the media view from the media tab"); // XXX + return; + } + + let arg = args[0]; + + if (arg) + { + let pages = player.getMediaPages(); + + for ([,page] in Iterator(pages)) + { + if (util.compareIgnoreCase(arg, page.contentTitle) == 0) + { + player.loadMediaPage(page, gBrowser.currentMediaListView.mediaList, gBrowser.currentMediaListView); + return; + } + } + + liberator.echoerr("E475: Invalid argument: " + arg); + } + }, + { + argCount: "1", + completer: function (context) completion.mediaView(context), + literal: 0 + }); + // TODO: maybe :vol! could toggle mute on/off? --djk commands.add(["vol[ume]"], "Set the volume", @@ -282,41 +355,6 @@ function Player() // {{{ }, { argCount: "1" }); - commands.add(["load"], - "Load a playlist", - function (args) - { - let arg = args.literalArg; - - if (arg) - { - // load the selected playlist/smart playlist - let playlists = player.getPlaylists(); - - for ([i, list] in Iterator(playlists)) - { - if (util.compareIgnoreCase(arg, list.name) == 0) - { - SBGetBrowser().loadMediaList(playlists[i]); - focusTrack(_SBGetCurrentView().getItemByIndex(0)); - return; - } - } - - liberator.echoerr("E475: Invalid argument: " + arg); - } - else - { - // load main library if there are no args - _SBShowMainLibrary(); - } - }, - { - argCount: "?", - completer: function(context, args) completion.playlist(context, args), - literal: 0 - }); - /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ @@ -408,6 +446,7 @@ function Player() // {{{ seekTo: function seekTo(position) { + // FIXME: if not playing if (!gMM.playbackControl) this.play(); @@ -500,6 +539,19 @@ function Player() // {{{ playPlaylist: function playPlaylist(playlist, row) { gMM.sequencer.playView(playlist.createView(), row); + }, + + getMediaPages: function getMediaPages() + { + let list = gBrowser.currentMediaPage.mediaListView.mediaList; + let pages = pageService.getAvailablePages(list); + return ArrayConverter.JSArray(pages).map(function (page) page.QueryInterface(Components.interfaces.sbIMediaPageInfo)); + }, + + loadMediaPage: function loadMediaList(page, list, view) + { + pageService.setPage(list, page); + gBrowser.loadMediaList(list, null, null, view, null); } }; //}}} From 1a034069db5c93c8f261fcaf4bcd3b8cf555f231 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 27 Mar 2009 01:40:36 +1100 Subject: [PATCH 097/143] Document :mediaview. --- xulmus/TODO | 1 + xulmus/locale/en-US/player.txt | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/xulmus/TODO b/xulmus/TODO index 867a6947..638bf7c8 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -9,6 +9,7 @@ BUGS: - :open songbird-internal-search searchString Is this workable anyway? --djk - is off by one when alternating with the media tab + - numbered tabs FEATURES: 9 / and ? possibly reusing "Jump to" functionality directly. diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 8053d3c5..40160fef 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -164,4 +164,13 @@ Load [a][playlist][a]. If no playlist is specified then the main library view is loaded. ________________________________________________________________________________ +section:Changing{nbsp}media{nbsp}views[media-view,view] + +|:mediav| |:mediaview| +||:mediav[iew] {view}|| + +________________________________________________________________________________ +Change the media view to {view}. This can only be run when the media tab is the +current tab. +________________________________________________________________________________ + // vim: set filetype=asciidoc: From 26fec12cade6cf62a3e30b8d51fbb8c1b20c6018 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 27 Mar 2009 13:31:31 +1100 Subject: [PATCH 098/143] Fix #204. Fixes #204 (statusbar should follow "site identification button" color codes). --- common/content/events.js | 11 +++++++---- common/content/style.js | 7 ++++--- common/content/ui.js | 4 +++- vimperator/locale/en-US/styling.txt | 1 + 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 3c58afc2..51d1ecb8 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1684,13 +1684,16 @@ function Events() //{{{ } }, // for notifying the user about secure web pages - onSecurityChange: function (webProgress, aRequest, aState) + onSecurityChange: function (webProgress, request, state) { - if (aState & Ci.nsIWebProgressListener.STATE_IS_INSECURE) + // TODO: do something useful with STATE_SECURE_MED and STATE_SECURE_LOW + if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE) statusline.setClass("insecure"); - else if (aState & Ci.nsIWebProgressListener.STATE_IS_BROKEN) + else if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN) statusline.setClass("broken"); - else if (aState & Ci.nsIWebProgressListener.STATE_IS_SECURE) + else if (state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL) + statusline.setClass("extended"); + else if (state & Ci.nsIWebProgressListener.STATE_SECURE_HIGH) statusline.setClass("secure"); }, onStatusChange: function (webProgress, request, status, message) diff --git a/common/content/style.js b/common/content/style.js index d994dbd6..24a05657 100644 --- a/common/content/style.js +++ b/common/content/style.js @@ -71,9 +71,10 @@ Highlights.prototype.CSS = Date: Sun, 15 Mar 2009 13:03:17 +0100 Subject: [PATCH 099/143] Fix muttator for new nighlies --- common/content/liberator.js | 7 ++++++- muttator/install.rdf | 2 +- vimperator/Donors | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/common/content/liberator.js b/common/content/liberator.js index c0798fae..9c0b2279 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -1225,7 +1225,12 @@ const liberator = (function () //{{{ config.features.push(getPlatformFeature()); config.defaults = config.defaults || {}; config.guioptions = config.guioptions || {}; - config.browserModes = config.browserModes || [modes.NORMAL]; + + // -> we can't use this, since config.browserModes might already be defined as a getter-only + // TODO: also change the other config.* defaults? + // config.browserModes = config.browserModes || [modes.NORMAL]; + if (!config.browserModes) + config.browserModes = [modes.NORMAL]; config.mailModes = config.mailModes || [modes.NORMAL]; // TODO: suitable defaults? //config.mainWidget diff --git a/muttator/install.rdf b/muttator/install.rdf index 3785bda0..81010653 100644 --- a/muttator/install.rdf +++ b/muttator/install.rdf @@ -20,7 +20,7 @@ {3550f703-e582-4d05-9a08-453d09bdfdc6} 3.0b2pre - 3.0b2 + 3.0b3 diff --git a/vimperator/Donors b/vimperator/Donors index e94055cb..7bb5b379 100644 --- a/vimperator/Donors +++ b/vimperator/Donors @@ -2,6 +2,10 @@ Continuous donations: * Daniel Bainton (web hosting) 2009: +* Fabien Benetou +* Arvin Moezzi +* Calogero Lo Leggio +* Sapan Bhatia * Gavin Sinclair * Stephen Borchert * Convolution From c342cdd7c963fa37052c4f770b5b6d143e0cac26 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Fri, 27 Mar 2009 11:43:45 +0100 Subject: [PATCH 100/143] updated donors --- vimperator/Donors | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vimperator/Donors b/vimperator/Donors index 7bb5b379..6dd5baac 100644 --- a/vimperator/Donors +++ b/vimperator/Donors @@ -2,6 +2,9 @@ Continuous donations: * Daniel Bainton (web hosting) 2009: +* Christoph Petzold +* Bjoern Steinbrink +* Erlend Hamberg * Fabien Benetou * Arvin Moezzi * Calogero Lo Leggio From f06f1d776e28254a9e962512fc04246165450085 Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Fri, 27 Mar 2009 23:32:03 +0530 Subject: [PATCH 101/143] Added SearchView - '/', 'n' & 'N' --- common/content/modes.js | 2 ++ xulmus/content/player.js | 73 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 70 insertions(+), 5 deletions(-) diff --git a/common/content/modes.js b/common/content/modes.js index f0d71735..0ae21289 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -277,6 +277,8 @@ const modes = (function () //{{{ self.addMode("OUTPUT_MULTILINE", true); self.addMode("SEARCH_FORWARD", true); self.addMode("SEARCH_BACKWARD", true); + self.addMode("SEARCH_VIEW_FORWARD", true); + self.addMode("SEARCH_VIEW_BACKWARD", true); self.addMode("MENU", true); // a popupmenu is active self.addMode("LINE", true); // linewise visual mode self.addMode("PROMPT", true); diff --git a/xulmus/content/player.js b/xulmus/content/player.js index e3710cf4..e6198d7f 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -8,11 +8,20 @@ function Player() // {{{ ////////////////////// PRIVATE SECTION ///////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ + let lastSearchString = ""; + let lastSearchIndex = 0; + let lastSearchView = _SBGetCurrentView(); + // Get the focus to the visible playlist first //window._SBShowMainLibrary(); const pageService = Components.classes["@songbirdnest.com/Songbird/MediaPageManager;1"] .getService(Components.interfaces.sbIMediaPageManager); + // Register Callbacks for searching. + + liberator.registerCallback("change", modes.SEARCH_VIEW_FORWARD, function (command) { player.searchView(command);}); + liberator.registerCallback("submit", modes.SEARCH_VIEW_FORWARD, function (command) { player.searchView(command);}); + //liberator.registerCallback("cancel", modes.SEARCH_VIEW_FORWARD, function (command) { player.searchView(command);}); // interval (milliseconds) function seek(interval, direction) @@ -143,6 +152,18 @@ function Player() // {{{ ["-"], "Decrease volume by 10%", function () { player.decreaseVolume(); }); + mappings.add([modes.PLAYER], + ["/"], "Search View", + function (args) { commandline.open("/", "", modes.SEARCH_VIEW_FORWARD); }); + + mappings.add([modes.PLAYER], + ["n"], "Find Next", + function () { player.searchViewAgain(false);}); + + mappings.add([modes.PLAYER], + ["N"], "Find Previous", + function () { player.searchViewAgain(true);}); + ////////////////// ///////////////////////////////////////////////////////////}}} ////////////////////// COMMANDS //////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ @@ -495,22 +516,64 @@ function Player() // {{{ return tracksList; }, - // TODO: Use this for implementing "/" and "?". -ken - searchTracks: function searchTracks(args) + searchView: function searchView (args) { let currentView = _SBGetCurrentView(); let mediaItemList = currentView.mediaList; let search = _getSearchString(currentView); let searchString = ""; + let index = 0; if (search != "") searchString = args + " " + search; else searchString = args; - - let myView = LibraryUtils.createStandardMediaListView(mediaItemList, searchString); - focusTrack(myView.getItemByIndex(0)); + + lastSearchString = searchString; + + let mySearchView = LibraryUtils.createStandardMediaListView(mediaItemList, searchString); + + if (mySearchView.length) + { + lastSearchView = mySearchView; + focusTrack(mySearchView.getItemByIndex(index)); + } + else + { + liberator.echoerr("E486 Pattern not found: "+searchString, commandline.FORCE_SINGLELINE); + } }, + + //FIXME: commandline.echo should work --ken + searchViewAgain: function searchViewAgain(reverse) + { + if (reverse) + { + if (lastSearchIndex == 0) + { + //commandline.echo("Search hit TOP, continuing at BOTTOM", + // commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES | commandline.FORCE_SINGLELINE); + lastSearchIndex = lastSearchView.length - 1; + } + else + lastSearchIndex = lastSearchIndex - 1; + } + else + { + if (lastSearchIndex == (lastSearchView.length -1)) + { + //commandline.echo("Search hit BOTTOM, continuing at TOP", + // commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES | commandline.FORCE_SINGLELINE); + lastSearchIndex = 0; + } + else + lastSearchIndex = lastSearchIndex + 1; + } + + //FIXME: Implement for "?" --ken + commandline.echo("/" + lastSearchString, null, commandline.FORCE_SINGLELINE); + focusTrack(lastSearchView.getItemByIndex(lastSearchIndex)); + }, getPlaylists: function getPlaylists() { From 909485a96c7eaa9eb8694f17aada23d3541bfa6d Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sat, 28 Mar 2009 00:09:53 +0530 Subject: [PATCH 102/143] Documented search operations and fixed typo in :seek --- xulmus/locale/en-US/player.txt | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 40160fef..d2c536a3 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -118,7 +118,7 @@ Seek -1m. ________________________________________________________________________________ -|:see]| |:seek| +|:see| |:seek| ||:see[k] {[HH:]MM:SS]}|| + ||:see[k] +{time[hms]} | -{time[hms]}|| + ________________________________________________________________________________ @@ -141,7 +141,7 @@ ________________________________________________________________________________ |-| -||-|| +||-|| + ________________________________________________________________________________ Decrease volume by 10%. ________________________________________________________________________________ @@ -173,4 +173,26 @@ Change the media view to {view}. This can only be run when the media tab is the current tab. ________________________________________________________________________________ +section:Search{nbsp}commands[search] + +|/| +||/{pattern}|| + +________________________________________________________________________________ +Search for the first occurence of {pattern} in the visisble view. +________________________________________________________________________________ + +|n| +||n|| + +________________________________________________________________________________ +Find next. Repeats the last search. If the search hits BOTTOM of the view, it +continues from TOP. +________________________________________________________________________________ + +|N| +||N|| + +________________________________________________________________________________ +Find previous. Repeats the last search in the opposite direction. If the search +hits TOP of the view, it continues from BOTTTOM. +________________________________________________________________________________ + // vim: set filetype=asciidoc: From 187f7229e22bb66ca42eaffa7d40080520e317cf Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sat, 28 Mar 2009 00:18:27 +0530 Subject: [PATCH 103/143] Updated TODO --- xulmus/TODO | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xulmus/TODO b/xulmus/TODO index 638bf7c8..16d91ee8 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -12,8 +12,8 @@ BUGS: - numbered tabs FEATURES: -9 / and ? possibly reusing "Jump to" functionality directly. -8 Playlist/SmartPlaylist operations. +9 '?' - Reusing '/'. +8 Playlist/SmartPlaylist operations & meta-data operations. 7 extended hint mode for opening links in FF. 5 Check for default extensions and add commands for them. Ex. Last.fm, Seeqpod e.t.c Wouldn't these be provided as Xulmus plugins like Vimperator does? --djk From 2b1010251b6a9e258f316410fa329b6498747a60 Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sat, 28 Mar 2009 01:14:08 +0530 Subject: [PATCH 104/143] Added mappings for changing rating of current mediaItem --- xulmus/content/player.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index e6198d7f..2da8215b 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -164,6 +164,32 @@ function Player() // {{{ ["N"], "Find Previous", function () { player.searchViewAgain(true);}); + //FIXME: Better way to do this ? --ken + mappings.add([modes.PLAYER], + [""], "Rate the current media item 0", + function () { player.rateMediaItem(0); }); + + mappings.add([modes.PLAYER], + [""], "Rate the current media item 1", + function () { player.rateMediaItem(1); }); + + mappings.add([modes.PLAYER], + [""], "Rate the current media item 2", + function () { player.rateMediaItem(2); }); + + mappings.add([modes.PLAYER], + [""], "Rate the current media item 3", + function () { player.rateMediaItem(3); }); + + mappings.add([modes.PLAYER], + [""], "Rate the current media item 4", + function () { player.rateMediaItem(4); }); + + mappings.add([modes.PLAYER], + [""], "Rate the current media item 5", + function () { player.rateMediaItem(5); }); + + ////////////////// ///////////////////////////////////////////////////////////}}} ////////////////////// COMMANDS //////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ @@ -414,11 +440,13 @@ function Player() // {{{ next: function next() { gSongbirdWindowController.doCommand("cmd_control_next"); + gSongbirdWindowController.doCommand("cmd_find_current_track"); }, previous: function previous() { gSongbirdWindowController.doCommand("cmd_control_previous"); + gSongbirdWindowController.doCommand("cmd_find_current_track"); }, togglePlayPause: function togglePlayPause() @@ -615,6 +643,12 @@ function Player() // {{{ { pageService.setPage(list, page); gBrowser.loadMediaList(list, null, null, view, null); + }, + + rateMediaItem: function rateMediaItem(rating) + { + if (gMM.sequencer.currentItem) + gMM.sequencer.currentItem.setProperty(SBProperties.rating, rating); } }; //}}} From 7c9767822843bc52671532492df7870eb4d0dc5a Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sat, 28 Mar 2009 02:43:40 +0530 Subject: [PATCH 105/143] Fixed typo in player.txt --- xulmus/locale/en-US/player.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index d2c536a3..0a807c64 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -178,7 +178,7 @@ section:Search{nbsp}commands[search] |/| ||/{pattern}|| + ________________________________________________________________________________ -Search for the first occurence of {pattern} in the visisble view. +Search for the first occurence of {pattern} in the visible media view. ________________________________________________________________________________ |n| From ec6cfad1e0c6ff3741553e7e697008e78082ac6b Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sat, 28 Mar 2009 03:14:41 +0530 Subject: [PATCH 106/143] Fixed SearchViewAgain --- xulmus/content/player.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 2da8215b..4b22e0a2 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -564,6 +564,7 @@ function Player() // {{{ if (mySearchView.length) { lastSearchView = mySearchView; + lastSearchIndex = 0; focusTrack(mySearchView.getItemByIndex(index)); } else @@ -601,6 +602,7 @@ function Player() // {{{ //FIXME: Implement for "?" --ken commandline.echo("/" + lastSearchString, null, commandline.FORCE_SINGLELINE); focusTrack(lastSearchView.getItemByIndex(lastSearchIndex)); + }, getPlaylists: function getPlaylists() From d3a5d3d229bcd7846ec05774eaa6b05f66c0589c Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sat, 28 Mar 2009 05:02:59 +0530 Subject: [PATCH 107/143] Refactor player.js & Changed the install maxVersion to 1.2.0pre --- common/content/completion.js | 6 +- xulmus/content/player.js | 200 ++++++++++++++++++----------------- xulmus/install.rdf | 2 +- 3 files changed, 107 insertions(+), 101 deletions(-) diff --git a/common/content/completion.js b/common/content/completion.js index 0494759b..c5ee7a1a 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -1395,17 +1395,17 @@ function Completion() //{{{ if (args.completeArg == 0) { context.title = ["Artists"]; - context.completions = getArtists(); + context.completions = player.getArtists(); } else if (args.completeArg == 1) { context.title = ["Albums by " + args[0]]; - context.completions = getAlbums(args[0]); + context.completions = player.getAlbums(args[0]); } else if (args.completeArg == 2) { context.title = ["Tracks from " + args[1] + " by " + args[0]]; - context.completions = getTracks(args[0], args[1]); + context.completions = player.getTracks(args[0], args[1]); } }, diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 4b22e0a2..2d8b3c0d 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -1,6 +1,6 @@ // Import Artist List as this can be huge -var artists = getArtistsArray(); + function Player() // {{{ { @@ -11,10 +11,53 @@ function Player() // {{{ let lastSearchString = ""; let lastSearchIndex = 0; let lastSearchView = _SBGetCurrentView(); - + // Get the focus to the visible playlist first //window._SBShowMainLibrary(); + + + function getArtistsArray() + { + var list = LibraryUtils.mainLibrary; + // Create an enumeration listener to count each item + var listener = { + count: 0, + onEnumerationBegin: function (aMediaList) { + this.count = 0; + }, + onEnumeratedItem: function (aMediaList, aMediaItem) { + this.count++; + }, + onEnumerationEnd: function (aMediaList, aStatusCode) {} + }; + + var artistCounts = {}; + var artists = list.getDistinctValuesForProperty(SBProperties.artistName); + var artist; + var artistArray = []; + var i = 0; + // Count the number of media items for each distinct artist + while (artists.hasMore()) + { + artist = artists.getNext(); + artistArray[i] = [artist, artist]; + list.enumerateItemsByProperty(SBProperties.artistName, + artist, + listener, + Ci.sbIMediaList.ENUMERATIONTYPE_LOCKING); + artistCounts[artist] = listener.count; + i++; + } + + //liberator.dump("Count : "+artistCounts.toSource()); + return artistArray; + } + + // Get the artist names before hand. + + let artists = getArtistsArray(); + const pageService = Components.classes["@songbirdnest.com/Songbird/MediaPageManager;1"] .getService(Components.interfaces.sbIMediaPageManager); // Register Callbacks for searching. @@ -550,7 +593,6 @@ function Player() // {{{ let mediaItemList = currentView.mediaList; let search = _getSearchString(currentView); let searchString = ""; - let index = 0; if (search != "") searchString = args + " " + search; @@ -565,7 +607,7 @@ function Player() // {{{ { lastSearchView = mySearchView; lastSearchIndex = 0; - focusTrack(mySearchView.getItemByIndex(index)); + focusTrack(mySearchView.getItemByIndex(lastSearchIndex)); } else { @@ -651,103 +693,67 @@ function Player() // {{{ { if (gMM.sequencer.currentItem) gMM.sequencer.currentItem.setProperty(SBProperties.rating, rating); + }, + + getArtists: function getArtists() + { + return artists; + }, + + getAlbums: function getAlbums(artist) + { + var list = LibraryUtils.mainLibrary; + var albumArray = [], returnArray = []; + var items = list.getItemsByProperty(SBProperties.artistName, artist).enumerate(); + var i = 0, j = 0; + + + while (items.hasMoreElements()) + { + album = items.getNext().getProperty(SBProperties.albumName); + albumArray[i] = [album, album]; + + if (i == 0) + { + returnArray[j] = albumArray[i]; + j++; + } + else if (albumArray[i-1].toString() != albumArray[i].toString()) + { + returnArray[i] = albumArray[i]; + j++; + } + i++; + } + + return returnArray; + }, + + getTracks: function getTracks(artist, album) + { + var list = LibraryUtils.mainLibrary; + var tracksArray = []; + var pa = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"] + .createInstance(Ci.sbIMutablePropertyArray); + var i = 0; + + pa.appendProperty(SBProperties.artistName, artist.toString()); + pa.appendProperty(SBProperties.albumName, album.toString()); + var items = list.getItemsByProperties(pa).enumerate(); + + while (items.hasMoreElements()) + { + track = items.getNext().getProperty(SBProperties.trackName); + tracksArray[i] = [track, track]; + i++; + } + + return tracksArray; } + }; //}}} } // }}} -function getArtists() -{ - return this.artists; -} - -function getArtistsArray() -{ - var list = LibraryUtils.mainLibrary; - - // Create an enumeration listener to count each item - var listener = { - count: 0, - onEnumerationBegin: function (aMediaList) { - this.count = 0; - }, - onEnumeratedItem: function (aMediaList, aMediaItem) { - this.count++; - }, - onEnumerationEnd: function (aMediaList, aStatusCode) {} - }; - - var artistCounts = {}; - var artists = list.getDistinctValuesForProperty(SBProperties.artistName); - var artist; - var artistArray = []; - var i = 0; - // Count the number of media items for each distinct artist - while (artists.hasMore()) - { - artist = artists.getNext(); - artistArray[i] = [artist, artist]; - list.enumerateItemsByProperty(SBProperties.artistName, - artist, - listener, - Ci.sbIMediaList.ENUMERATIONTYPE_LOCKING); - artistCounts[artist] = listener.count; - i++; - } - - //liberator.dump("Count : "+artistCounts.toSource()); - return artistArray; -} - -function getAlbums(artist) -{ - var list = LibraryUtils.mainLibrary; - var albumArray = [], returnArray = []; - var items = list.getItemsByProperty(SBProperties.artistName, artist).enumerate(); - var i = 0, j = 0; - - - while (items.hasMoreElements()) - { - album = items.getNext().getProperty(SBProperties.albumName); - albumArray[i] = [album, album]; - - if (i == 0) - { - returnArray[j] = albumArray[i]; - j++; - } - else if (albumArray[i-1].toString() != albumArray[i].toString()) - { - returnArray[i] = albumArray[i]; - j++; - } - i++; - } - - return returnArray; -} - -function getTracks(artist, album) -{ - var list = LibraryUtils.mainLibrary; - var tracksArray = []; - var pa = Cc["@songbirdnest.com/Songbird/Properties/MutablePropertyArray;1"] - .createInstance(Ci.sbIMutablePropertyArray); - var i = 0; - - pa.appendProperty(SBProperties.artistName, artist.toString()); - pa.appendProperty(SBProperties.albumName, album.toString()); - var items = list.getItemsByProperties(pa).enumerate(); - - while (items.hasMoreElements()) - { - track = items.getNext().getProperty(SBProperties.trackName); - tracksArray[i] = [track, track]; - i++; - } - - return tracksArray; -} // vim: set fdm=marker sw=4 ts=4 et: diff --git a/xulmus/install.rdf b/xulmus/install.rdf index 7dccc3a8..3851c0af 100755 --- a/xulmus/install.rdf +++ b/xulmus/install.rdf @@ -12,7 +12,7 @@ songbird@songbirdnest.com 0.8.0pre - 1.1.0pre + 1.2.0pre From 2c352c285b41c330b603ac5c7ff4fa98d9e8022e Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 28 Mar 2009 02:13:18 +1100 Subject: [PATCH 108/143] Update help files for Xulmus. --- xulmus/content/config.js | 22 +++++++--------- xulmus/locale/en-US/browsing.txt | 24 ++++++++--------- xulmus/locale/en-US/buffer.txt | 4 +-- xulmus/locale/en-US/developer.txt | 2 +- xulmus/locale/en-US/eval.txt | 4 +-- xulmus/locale/en-US/gui.txt | 43 +++++++------------------------ xulmus/locale/en-US/hints.txt | 2 +- xulmus/locale/en-US/index.txt | 41 +++++++++++++++++++++++++---- xulmus/locale/en-US/intro.txt | 43 ++++++++++++++----------------- xulmus/locale/en-US/map.txt | 8 +++--- xulmus/locale/en-US/marks.txt | 4 +-- xulmus/locale/en-US/message.txt | 2 +- xulmus/locale/en-US/pattern.txt | 4 +-- xulmus/locale/en-US/print.txt | 2 +- xulmus/locale/en-US/repeat.txt | 10 +++---- xulmus/locale/en-US/starting.txt | 10 +++---- xulmus/locale/en-US/styling.txt | 4 +-- xulmus/locale/en-US/tabs.txt | 31 +++++++++++----------- xulmus/locale/en-US/various.txt | 4 +-- 19 files changed, 133 insertions(+), 131 deletions(-) diff --git a/xulmus/content/config.js b/xulmus/content/config.js index 89590b57..248b6a6e 100755 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -116,7 +116,7 @@ const config = { //{{{ function () { window.BrowserViewSourceOfDocument(content.document); }], ["places", "Places Organizer: Manage your bookmarks and history", function () { PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_BOOKMARKS); }], - ["preferences", "Show Firefox preferences dialog", + ["preferences", "Show Songbird preferences dialog", function () { window.openPreferences(); }], /* ["printpreview", "Preview the page before printing", @@ -138,14 +138,14 @@ const config = { //{{{ //TODO : Write intro.html and tutorial.html // they are sorted by relevance, not alphabetically - helpFiles: [ "player.html", "options.html", "autocommands.html" ], - /* "intro.html", "tutorial.html", "starting.html", "browsing.html", - "buffer.html", "cmdline.html", "insert.html", "options.html", - "pattern.html", "tabs.html", "hints.html", "map.html", "eval.html", - "marks.html", "repeat.html", "autocommands.html", "print.html", - "gui.html", "styling.html", "message.html", "developer.html", - "various.html", "index.html", "version.html" - ], */ + helpFiles: [ + "intro.html", /*"tutorial.html",*/ "starting.html", "player.html", + "browsing.html", "buffer.html", "cmdline.html", "insert.html", + "options.html", "pattern.html", "tabs.html", "hints.html", "map.html", + "eval.html", "marks.html", "repeat.html", "autocommands.html", + "print.html", "gui.html", "styling.html", "message.html", + "developer.html", "various.html", "index.html", "version.html" + ], scripts: [ "bookmarks.js", @@ -155,8 +155,6 @@ const config = { //{{{ init: function () { - options["helpfile"] = "player.html"; - //Adding a mode for Player //modes.addMode("PLAYER"); // Player mode for songbird @@ -375,7 +373,7 @@ const config = { //{{{ "Show " + config.hostApplication + " preferences", function (args) { - if (args.bang) // open Firefox settings GUI dialog + if (args.bang) // open Songbird settings GUI dialog { liberator.open("about:config", (options["newtab"] && options.get("newtab").has("all", "prefs")) diff --git a/xulmus/locale/en-US/browsing.txt b/xulmus/locale/en-US/browsing.txt index 9b44fa8a..ddbe2add 100755 --- a/xulmus/locale/en-US/browsing.txt +++ b/xulmus/locale/en-US/browsing.txt @@ -2,15 +2,15 @@ HEADER |surfing| |browsing| + -Vimperator overrides nearly all Firefox keys in order to make browsing more +Xulmus overrides nearly all Songbird keys in order to make browsing more pleasant for Vim users. On the rare occasions when you want to pass a keystroke -to Firefox, or to the web page, and have it retain its original meaning you +to Songbird, or to the web page, and have it retain its original meaning you have 2 possibilities: |pass-through| || |CTRL-Z| + ||CTRL-Z|| ________________________________________________________________________________ -Disable all Vimperator keys except [m][m] and pass them to the next event +Disable all Xulmus keys except [m][m] and pass them to the next event handler. This is especially useful, if JavaScript controlled forms like the RichEdit form fields of Gmail don't work anymore. To exit this mode, press [m][m]. If you also need to pass [m][m] in this mode to the web page, @@ -21,10 +21,10 @@ ________________________________________________________________________________ ||CTRL-V|| ________________________________________________________________________________ If you only need to pass a single key to a JavaScript form field or another -extension prefix the key with [m][m]. Also works to unshadow Firefox -shortcuts like [m][m] which are otherwise hidden in Vimperator. When -Vimperator mode is temporarily disabled with [m][m], [m][m] will pass -the next key to Vimperator instead of the web page. +extension prefix the key with [m][m]. Also works to unshadow Songbird +shortcuts like [m][m] which are otherwise hidden in Xulmus. When +Xulmus mode is temporarily disabled with [m][m], [m][m] will pass +the next key to Xulmus instead of the web page. ________________________________________________________________________________ section:Opening{nbsp}web{nbsp}pages[opening] @@ -52,7 +52,7 @@ Each token is analyzed and in this order: 3. Opened with the default search engine or keyword (specified with the 'defsearch' option) if the first word is no search engine ([c]:open linus torvalds[c] opens a Google search for linux torvalds). -4. Passed directly to Firefox in all other cases ([c]:open www.osnews.com, +4. Passed directly to Songbird in all other cases ([c]:open www.osnews.com, www.slashdot.org[c] opens OSNews in the current, and Slashdot in a new background tab). @@ -286,7 +286,7 @@ section:Quitting[quitting,save-session] ||:q[uit]|| ________________________________________________________________________________ Quit current tab. If this is the last tab in the window, close the window. If -this was the last window, close Vimperator. When quitting Vimperator, the +this was the last window, close Xulmus. When quitting Xulmus, the session is not stored. ________________________________________________________________________________ @@ -294,7 +294,7 @@ ________________________________________________________________________________ |:qa| |:qall| |:quita| |:quitall| + ||:quita[ll]|| ________________________________________________________________________________ -Quit Vimperator. Quit Vimperator, no matter how many tabs/windows are open. +Quit Xulmus. Quit Xulmus, no matter how many tabs/windows are open. The session is not stored. ________________________________________________________________________________ @@ -310,7 +310,7 @@ ________________________________________________________________________________ ||:wqa[ll]|| + ||:xa[ll]|| ________________________________________________________________________________ -Save the session and quit. Quit Vimperator, no matter how many tabs/windows +Save the session and quit. Quit Xulmus, no matter how many tabs/windows are open. The session is stored. [c]:wq[c] is different from Vim, as it closes the window instead of just one tab by popular demand. Complain on the mailing list, if you want to change that. @@ -327,7 +327,7 @@ ________________________________________________________________________________ |ZZ| ||ZZ|| ________________________________________________________________________________ -Quit and save the session. Quit Vimperator, no matter how many tabs/windows +Quit and save the session. Quit Xulmus, no matter how many tabs/windows are open. The session is stored. Works like [c]:xall[c]. ________________________________________________________________________________ diff --git a/xulmus/locale/en-US/buffer.txt b/xulmus/locale/en-US/buffer.txt index 91022f27..50bc589a 100755 --- a/xulmus/locale/en-US/buffer.txt +++ b/xulmus/locale/en-US/buffer.txt @@ -2,7 +2,7 @@ HEADER |buffer| |document| + -Vimperator holds exactly one buffer object for each tab. It is usually an +Xulmus holds exactly one buffer object for each tab. It is usually an (X)HTML document with advanced features. section:Buffer{nbsp}information[buffer-information] @@ -234,7 +234,7 @@ default zoom levels are 30%, 50%, 67%, 80%, 90%, 100%, 110%, 120%, 133%, 150%, 170%, 200%, 240%, 300%. The available zoom range can be changed by setting the \'zoom.minPercent' and -\'zoom.maxPercent' Firefox preferences. The zoom levels can be changed using +\'zoom.maxPercent' Songbird preferences. The zoom levels can be changed using the \'toolkit.ZoomManager.zoomLevels' preference. Note: \'toolkit.ZoomManager.zoomLevels' is specified as a list of values diff --git a/xulmus/locale/en-US/developer.txt b/xulmus/locale/en-US/developer.txt index cf875d82..7401a2f1 100755 --- a/xulmus/locale/en-US/developer.txt +++ b/xulmus/locale/en-US/developer.txt @@ -60,7 +60,7 @@ Some notes about the code above: automatically marked up as an argument. There are also some additional asciidoc commands specifically for writing -Vimperator documentation: +Xulmus documentation: - *$$section:Writing{nbsp}documentation[writing-docs,documentation]$$* Creates a new section like _Writing Documentation_ in this help file with 2 tags. diff --git a/xulmus/locale/en-US/eval.txt b/xulmus/locale/en-US/eval.txt index 17c71dda..accb6fce 100755 --- a/xulmus/locale/en-US/eval.txt +++ b/xulmus/locale/en-US/eval.txt @@ -53,10 +53,10 @@ passing the argument to `eval()`. is found, and interpret them with the JavaScript _eval()_ function. The special version [c]:javascript![c] opens the JavaScript console of -Firefox. +Songbird. [m][m] completion is available for [c]:javascript {cmd}[c] (but not -yet for the [c]:js <Sidebar menu. Add-ons, Preferences and Downloads are -also available in the sidebar. -________________________________________________________________________________ - // vim: set filetype=asciidoc: diff --git a/xulmus/locale/en-US/hints.txt b/xulmus/locale/en-US/hints.txt index ef3200bb..aba281d5 100755 --- a/xulmus/locale/en-US/hints.txt +++ b/xulmus/locale/en-US/hints.txt @@ -25,7 +25,7 @@ ________________________________________________________________________________ Start QuickHint mode, but open link in a new tab. Like normal QuickHint mode (activated with [m]f[m]) but opens the link in a new tab. The new tab will be loaded in background according to the -\'browser.tabs.loadInBackground' Firefox preference. +\'browser.tabs.loadInBackground' Songbird preference. ________________________________________________________________________________ diff --git a/xulmus/locale/en-US/index.txt b/xulmus/locale/en-US/index.txt index 5a6a2fbb..ce56d602 100755 --- a/xulmus/locale/en-US/index.txt +++ b/xulmus/locale/en-US/index.txt @@ -4,6 +4,25 @@ HEADER This file contains a list of all available commands. +section:Player{nbsp}mode[player-index] + +||[m]x[m]|| Play the current track + +||[m]z[m]|| Play the previous track + +||[m]b[m]|| Play the next track + +||[m]c[m]|| Pause/unpause the current track + +||[m]v[m]|| Stop playing the current track + +||[m]t[m]|| Toggle shuffle mode + +||[m]r[m]|| Toggle repeat mode + +||[m]i[m]|| Select the currently playing track + +||[m]f[m]|| Filter and play tracks + +||[m]F[m]|| Filter and show the tracks as a view + +||[m]h[m]|| Seek -10s + +||[m]l[m]|| Seek +10s + +||[m]H[m]|| Seek -1m + +||[m]L[m]|| Seek +1m + +||[m]+[m]|| Increase volume by 10% + +||[m]-[m]|| Decrease volume by 10% + + section:Insert{nbsp}mode[insert-index] ||[m][m]|| Launch the external editor + @@ -24,7 +43,7 @@ section:Normal{nbsp}mode[normal-index] ||[m][m]|| Scroll window upwards in the buffer + ||[m][m]|| Pass through next key + ||[m][m]|| Decrement last number in URL + -||[m][m]|| Temporarily ignore all Vimperator key bindings + +||[m][m]|| Temporarily ignore all Xulmus key bindings + ||[m][m]|| Focus content + @@ -141,6 +160,18 @@ section:Command-line{nbsp}editing[ex-edit-index] section:Ex{nbsp}commands[ex-cmd-index,:index] +||[c]:playerplay[c]|| Play the current track + +||[c]:playerprev[c]|| Play the previous track + +||[c]:playernext[c]|| Play the next track + +||[c]:playerpause[c]|| Pause/unpause the current track + +||[c]:playerstop[c]|| Stop playing the current track + +||[c]:filter[c]|| Filter and play tracks + +||[c]:Filter[c]|| Filter and show the tracks as a view + +||[c]:seek[c]|| Seek to an absolute or relative position in a track + +||[c]:volume[c]|| Set the player volume + +||[c]:load[c]|| Load a playlist + +||[c]:mediaview[c]|| Change the media view + + ||[c]:![c]|| Run a command + ||[c]:abbreviate[c]|| Abbreviate a key sequence + ||[c]:abclear[c]|| Remove all abbreviations + @@ -184,7 +215,7 @@ section:Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:forward[c]|| Go forward in the browser history + ||[c]:hardcopy[c]|| Print current document + ||[c]:help[c]|| Display help + -||[c]:highlight[c]|| Style Vimperator + +||[c]:highlight[c]|| Style Xulmus + ||[c]:history[c]|| Show recently visited URLs + ||[c]:iabbrev[c]|| Abbreviate a key sequence in Insert mode + ||[c]:iabclear[c]|| Remove all abbreviations in Insert mode + @@ -203,7 +234,7 @@ section:Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:mark[c]|| Mark current location within the web page + ||[c]:marks[c]|| Show all location marks of current web page + ||[c]:messages[c]|| Display previously given messages + -||[c]:mkvimperatorrc[c]|| Write current key mappings and changed options to the config file + +||[c]:mkxulmusrc[c]|| Write current key mappings and changed options to the config file + ||[c]:nohlsearch[c]|| Remove the search highlighting + ||[c]:noremap[c]|| Map a key sequence without remapping keys + ||[c]:normal[c]|| Execute Normal mode commands + @@ -212,7 +243,7 @@ section:Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:pageinfo[c]|| Show various page information + ||[c]:pagestyle[c]|| Select the author style sheet to apply + ||[c]:play[c]|| Replay a recorded macro + -||[c]:preferences[c]|| Show Firefox preferences dialog + +||[c]:preferences[c]|| Show Songbird preferences dialog + ||[c]:pwd[c]|| Print the current directory name + ||[c]:qmark[c]|| Mark a URL with a letter for quick access + ||[c]:qmarks[c]|| Show all QuickMarks + @@ -230,7 +261,7 @@ section:Ex{nbsp}commands[ex-cmd-index,:index] ||[c]:setglobal[c]|| Set global option + ||[c]:setlocal[c]|| Set local option + ||[c]:sidebar[c]|| Open the sidebar window + -||[c]:style[c]|| Style Vimperator and web sites + +||[c]:style[c]|| Style Xulmus and web sites + ||[c]:source[c]|| Read Ex commands from a file + ||[c]:stop[c]|| Stop loading + ||[c]:tab[c]|| Execute a command and tell it to output in a new tab + diff --git a/xulmus/locale/en-US/intro.txt b/xulmus/locale/en-US/intro.txt index 98c9a70d..4692276f 100755 --- a/xulmus/locale/en-US/intro.txt +++ b/xulmus/locale/en-US/intro.txt @@ -1,31 +1,25 @@ LOGO -+++
+++ -*First there was a Navigator, then there was an Explorer. -Later it was time for a Konqueror. Now it's time for an Imperator, the -VIMperator :)* -+++
+++ - section:Introduction[intro] -http://vimperator.org[Vimperator] is a free browser add-on for Firefox, -which makes it look and behave like the http://www.vim.org[Vim] -text editor. It has similar key bindings, and you could call it a modal -web browser, as key bindings differ according to which mode you are in. +http://vimperator.org/Xulmus[Xulmus] is a free media player add-on for +Songbird, which combines the best features of the +http://cmus.sourceforge.net[cmus] music player and the http://www.vim.org[Vim] +text editor. |warning| + Warning: -To provide the most authentic Vim experience, the Firefox menubar and toolbar -are hidden. + -If you really need them, type: [c]:set guioptions+=mT[c] to get them back. + -If you don't like Vimperator at all, you can uninstall it by typing +To provide the most authentic cmus/Vim experience, the Songbird toolbar +is hidden. + +If you really need it, type: [c]:set guioptions+=T[c] to get it back. + +If you don't like Xulmus at all, you can uninstall it by typing [c]:addons[c] and remove/disable it. + If you like it but can't remember the shortcuts, then press [m]F1[m] or [c]:help[c] to get this help window back. |author| |donation| + -Vimperator was written by mailto:stubenschrott@gmx.net[Martin Stubenschrott]. -If you appreciate my work on Vimperator and want to encourage me working on it +Xulmus was written by mailto:prathyushthota@gmail.com[Prathyush Thota]. +If you appreciate my work on Xulmus and want to encourage me working on it more, you can either send me greetings, patches or make a donation: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -38,14 +32,15 @@ more, you can either send me greetings, patches or make a donation: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Of course as a believer in free open source software, only make a donation -if you really like Vimperator and the money doesn't hurt -- otherwise just use +if you really like Xulmus and the money doesn't hurt -- otherwise just use it, recommend it and like it :) section:Help{nbsp}topics[overview] -- help:Tutorial[tutorial.html]: A quick-start tutorial for new users. -- help:Initialization[starting.html]: How Vimperator starts up, where it reads +//- help:Tutorial[tutorial.html]: A quick-start tutorial for new users. +- help:Initialization[starting.html]: How Xulmus starts up, where it reads the config file... +- help:Player[player.html]: Interacting with the media player. - help:Browsing[browsing.html]: Basic mappings and commands needed for a browsing session (how to open a web page or go back in history). - help:Buffer{nbsp}commands[buffer.html]: Operations on the current document @@ -65,8 +60,8 @@ section:Help{nbsp}topics[overview] - help:Autocommands[autocommands.html]: Automatically executing code on certain events. - help:Print[print.html]: Printing pages. -- help:GUI[gui.html]: Accessing Firefox menus, dialogs and the sidebar. -- help:Styling[styling.html]: Changing the styling of content pages and Vimperator itself. +- help:GUI[gui.html]: Accessing Songbird menus, dialogs and the sidebar. +- help:Styling[styling.html]: Changing the styling of content pages and Xulmus itself. - help:Messages[message.html]: A description of messages and error messages. - help:Developer{nbsp}information[developer.html]: How to write docs or plugins. @@ -87,11 +82,11 @@ section:Features[features] * Advanced completion of bookmark and history URLs (searching also in title, not only URL) * Vim-like statusline with a wget-like progress bar * Minimal GUI (easily hide useless menubar and toolbar with [c]:set guioptions=[c]) -* Ability to [c]:source[c] JavaScript files, and to use a [a]~/.vimperatorrc[a] file - with syntax highlighting if you install scripts/vimperator.vim +* Ability to [c]:source[c] JavaScript files, and to use a [a]~/.xulmusrc[a] file + with syntax highlighting if you install scripts/xulmus.vim * Easy quick searches ([c]:open foo[c] will search for "foo" in google, [c]:open ebay terminator[c] will search for "terminator" on ebay) - with support for Firefox keyword bookmarks and search engines + with support for Songbird keyword bookmarks and search engines * Count supported for many commands ([m]3[m] will go back 3 pages) * Beep on errors * Marks support ([m]ma[m] to set mark a on a web page, [m]'a[m] to go there) diff --git a/xulmus/locale/en-US/map.txt b/xulmus/locale/en-US/map.txt index 4e9af03a..1fd2621c 100755 --- a/xulmus/locale/en-US/map.txt +++ b/xulmus/locale/en-US/map.txt @@ -172,7 +172,7 @@ ________________________________________________________________________________ section:Abbreviations[abbreviations] -Vimperator can automatically replace words identified as abbreviations, +Xulmus can automatically replace words identified as abbreviations, which may be used to save typing or to correct commonly misspelled words. An abbreviation can be one of three types that are defined by the types of constituent characters. Whitespace and quotes are non-keyword @@ -319,7 +319,7 @@ Completion can be enabled by specifying one of the following arguments to the *buffer* buffers *color* color schemes *command* Ex commands -*dialog* Firefox dialogs +*dialog* Songbird dialogs *dir* directories *environment* environment variables *event* autocommand events @@ -330,8 +330,8 @@ Completion can be enabled by specifying one of the following arguments to the *macro* named macros *mapping* user mappings *menu* menu items -*option* Vimperator options -*preference* Firefox preferences +*option* Xulmus options +*preference* Songbird preferences *search* search engines and keywords *shellcmd* shell commands *sidebar* sidebar panels diff --git a/xulmus/locale/en-US/marks.txt b/xulmus/locale/en-US/marks.txt index 837268be..d1a7a5b5 100755 --- a/xulmus/locale/en-US/marks.txt +++ b/xulmus/locale/en-US/marks.txt @@ -2,14 +2,14 @@ HEADER |different-marks| |marks| + -Vimperator supports a number of different marks: +Xulmus supports a number of different marks: - Bookmarks which allow you to mark a web page as one of your favorites for easy access. - QuickMarks allow you to define up to 62 (a-zA-Z0-9) web sites (or groups of web sites) which you visit most often. - Local marks to store the position within a web page. -- History is also a special type of marks, as Vimperator automatically +- History is also a special type of marks, as Xulmus automatically remembers sites which you have visited in the past. section:Bookmarks[bookmarks] diff --git a/xulmus/locale/en-US/message.txt b/xulmus/locale/en-US/message.txt index 99c1d723..04270207 100755 --- a/xulmus/locale/en-US/message.txt +++ b/xulmus/locale/en-US/message.txt @@ -2,7 +2,7 @@ HEADER |message-history| + -Vimperator stores all info and error messages in a message history. The type of +Xulmus stores all info and error messages in a message history. The type of info messages output can be controlled by the 'verbose' option. |:mes| |:messages| + diff --git a/xulmus/locale/en-US/pattern.txt b/xulmus/locale/en-US/pattern.txt index 6462a897..0009d6ff 100755 --- a/xulmus/locale/en-US/pattern.txt +++ b/xulmus/locale/en-US/pattern.txt @@ -2,9 +2,9 @@ HEADER |text-search-commands| + -Vimperator provides a Vim-like interface to Firefox's standard text search +Xulmus provides a Vim-like interface to Songbird's standard text search functionality. There is no support for using regular expressions in search -commands as Firefox does not provide native regexp support. It is unlikely that +commands as Songbird does not provide native regexp support. It is unlikely that this will ever be available. |/| + diff --git a/xulmus/locale/en-US/print.txt b/xulmus/locale/en-US/print.txt index 8cf3d180..9002f9b9 100755 --- a/xulmus/locale/en-US/print.txt +++ b/xulmus/locale/en-US/print.txt @@ -18,7 +18,7 @@ As above, but write the output to {filename}. Note: Not available on Windows. ________________________________________________________________________________ -section:Firefox{nbsp}printing{nbsp}dialogs[firefox-print-dialogs] +section:Songbird{nbsp}printing{nbsp}dialogs[songbird-print-dialogs] The "Print Preview" and "Page Setup" dialogs can be opened via the [c]:dialog[c] command diff --git a/xulmus/locale/en-US/repeat.txt b/xulmus/locale/en-US/repeat.txt index 2817c980..493d6b26 100755 --- a/xulmus/locale/en-US/repeat.txt +++ b/xulmus/locale/en-US/repeat.txt @@ -2,7 +2,7 @@ HEADER |repeat| + -Vimperator can repeat a number of commands and record macros. +Xulmus can repeat a number of commands and record macros. section:Macros[macros,complex-repeat] @@ -52,7 +52,7 @@ ____________________________________________________________________________ ||[count].|| ____________________________________________________________________________ Repeat the last keyboard mapping [count] times. Note that, unlike in Vim, this -does not apply solely to editing commands, mainly because Vimperator doesn't +does not apply solely to editing commands, mainly because Xulmus doesn't have them. ____________________________________________________________________________ @@ -99,7 +99,7 @@ Load all unloaded plugins immediately. Because plugins are automatically loaded after vimperatorrc is sourced, this command must be placed early in the vimperatorrc file if vimperatorrc also includes commands that are implemented by plugins. Additionally, this command allows for sourcing -new plugins without restarting Vimperator. +new plugins without restarting Xulmus. ________________________________________________________________________________ @@ -123,7 +123,7 @@ ________________________________________________________________________________ |:fini| |:finish| ||:fini[sh]|| + ________________________________________________________________________________ -Stop sourcing a script file. This can only be called from within a Vimperator +Stop sourcing a script file. This can only be called from within a Xulmus script file. ________________________________________________________________________________ @@ -136,7 +136,7 @@ Profile a piece of code or a command. Run {code} [count] times (default 1) and returns the elapsed time. {code} is always passed to JavaScript's eval(), which might be slow, so take the results with a grain of salt. -If {code} starts with a [c]:[c], it is executed as a Vimperator command. +If {code} starts with a [c]:[c], it is executed as a Xulmus command. Use the special version with [!] if you just want to run any command multiple times without showing profiling statistics. diff --git a/xulmus/locale/en-US/starting.txt b/xulmus/locale/en-US/starting.txt index df384fd0..552c6ce2 100755 --- a/xulmus/locale/en-US/starting.txt +++ b/xulmus/locale/en-US/starting.txt @@ -1,13 +1,13 @@ HEADER -Vimperator does not yet read any command-line options. When it does, they will +Xulmus does not yet read any command-line options. When it does, they will be documented here. section:Initialization[initialization,startup] -At startup, Vimperator completes the following tasks in order. +At startup, Xulmus completes the following tasks in order. -1. Vimperator can perform user initialization commands. When +1. Xulmus can perform user initialization commands. When one of the following is successfully located, it is executed, and no further locations are tried. @@ -31,7 +31,7 @@ command). The user's ~ (i.e., "home") directory is determined as follows: * On Unix and Mac, the environment variable _$HOME_ is used. -* On Windows, Vimperator checks for the existence of _%HOME%_, then +* On Windows, Xulmus checks for the existence of _%HOME%_, then _%USERPROFILE%_, and then _%HOMEDRIVE%%HOMEPATH%_. It uses the first one it finds. @@ -54,7 +54,7 @@ section:Restarting[restarting] |:res| |:restart| + ||:res[tart]|| ________________________________________________________________________________ -Force the browser to restart. Useful when installing extensions. +Force Xulmus to restart. Useful when installing extensions. ________________________________________________________________________________ // vim: set filetype=asciidoc: diff --git a/xulmus/locale/en-US/styling.txt b/xulmus/locale/en-US/styling.txt index a4ba91a2..213ec61c 100755 --- a/xulmus/locale/en-US/styling.txt +++ b/xulmus/locale/en-US/styling.txt @@ -2,7 +2,7 @@ HEADER |styling| + -Vimperator allows you to style both the browser and any web pages you view. All +Vimperator allows you to style both the player and any web pages you view. All styling is specified via CSS. Although you may style any user interface element via the [c]:style[c] command, most Vimperator elements can be styled with the [c]:highlight[c] command, for convenience. @@ -102,7 +102,7 @@ ________________________________________________________________________________ |:sty| |:style| + ||:sty[le][!] [-name={name}] [-append] {filter} [{css}]|| + ________________________________________________________________________________ -Add CSS styles to the browser or to web pages. {filter} is a comma +Add CSS styles to the player or to web pages. {filter} is a comma separated list of URLs to match. URLs ending with *\** are matched as prefixes, URLs not containing any *:* or */* characters are matched as domains. If {name} (short option: [c]-n[c]) is provided, any diff --git a/xulmus/locale/en-US/tabs.txt b/xulmus/locale/en-US/tabs.txt index 9ccded72..6b267edb 100755 --- a/xulmus/locale/en-US/tabs.txt +++ b/xulmus/locale/en-US/tabs.txt @@ -199,20 +199,21 @@ Like [m]d[m] but selects the tab to the left of the deleted tab. ________________________________________________________________________________ -|u| |:u| |:undo| -||:[count]u[ndo] [a][url][a]|| + -||[count]u|| -________________________________________________________________________________ -Undo closing of a tab. If a count is given, don't undo the last but the -[count]th last closed tab. With [a][url][a] restores the tab matching the URL. -________________________________________________________________________________ - - -|:undoa| |:undoall| + -||:undoa[ll]|| -________________________________________________________________________________ -Undo closing of all closed tabs. Firefox stores up to 10 closed tabs, even -after a browser restart. -________________________________________________________________________________ +// FIXME: No undo in Songbird for now. +//|u| |:u| |:undo| +//||:[count]u[ndo] [a][url][a]|| + +//||[count]u|| +//________________________________________________________________________________ +//Undo closing of a tab. If a count is given, don't undo the last but the +//[count]th last closed tab. With [a][url][a] restores the tab matching the URL. +//________________________________________________________________________________ +// +// +//|:undoa| |:undoall| + +//||:undoa[ll]|| +//________________________________________________________________________________ +//Undo closing of all closed tabs. Songbird stores up to 10 closed tabs, even +//after a browser restart. +//________________________________________________________________________________ // vim: set filetype=asciidoc: diff --git a/xulmus/locale/en-US/various.txt b/xulmus/locale/en-US/various.txt index 79d485dc..65e315b9 100755 --- a/xulmus/locale/en-US/various.txt +++ b/xulmus/locale/en-US/various.txt @@ -34,14 +34,14 @@ Run a command. Runs {cmd} through system() and displays its output. Any \'!' in backslash before the \'!', then that backslash is removed. Warning: Input redirection (< foo) not done, also do not run commands which -require stdin or it will hang Firefox! +require stdin or it will hang Songbird! ________________________________________________________________________________ |:ve| |:version| + ||:ve[rsion][!]|| ________________________________________________________________________________ -Show version information. You can show the Firefox version page with +Show version information. You can show the Songbird version page with [c]:version![c]. ________________________________________________________________________________ From 6c598b757452f6194a85afa9ff9479e9967fec7b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 28 Mar 2009 02:16:10 +1100 Subject: [PATCH 109/143] Add TODO regarding missing multi-window functionality. --- xulmus/TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/xulmus/TODO b/xulmus/TODO index 16d91ee8..f07206ab 100644 --- a/xulmus/TODO +++ b/xulmus/TODO @@ -10,6 +10,7 @@ BUGS: Is this workable anyway? --djk - is off by one when alternating with the media tab - numbered tabs + - :winopen FEATURES: 9 '?' - Reusing '/'. From 887855ed01e69fffb5250e7a587c64c3f7f3e46f Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 28 Mar 2009 12:18:28 +1100 Subject: [PATCH 110/143] Fix typo in "/" help text. --- xulmus/locale/en-US/player.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 0a807c64..415c61bb 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -178,7 +178,7 @@ section:Search{nbsp}commands[search] |/| ||/{pattern}|| + ________________________________________________________________________________ -Search for the first occurence of {pattern} in the visible media view. +Search for the first occurrence of {pattern} in the visible media view. ________________________________________________________________________________ |n| From 0f311e09e3837de341a07b31c17e5f84bdf62b09 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 28 Mar 2009 12:23:22 +1100 Subject: [PATCH 111/143] Whitespace fixes. --- xulmus/content/player.js | 44 +++++++++++++++------------------- xulmus/locale/en-US/player.txt | 4 ++-- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index 2d8b3c0d..a65e644b 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -1,7 +1,5 @@ // Import Artist List as this can be huge - - function Player() // {{{ { //////////////////////////////////////////////////////////////////////////////// @@ -11,11 +9,10 @@ function Player() // {{{ let lastSearchString = ""; let lastSearchIndex = 0; let lastSearchView = _SBGetCurrentView(); - + // Get the focus to the visible playlist first //window._SBShowMainLibrary(); - - + function getArtistsArray() { var list = LibraryUtils.mainLibrary; @@ -49,7 +46,7 @@ function Player() // {{{ artistCounts[artist] = listener.count; i++; } - + //liberator.dump("Count : "+artistCounts.toSource()); return artistArray; } @@ -57,7 +54,7 @@ function Player() // {{{ // Get the artist names before hand. let artists = getArtistsArray(); - + const pageService = Components.classes["@songbirdnest.com/Songbird/MediaPageManager;1"] .getService(Components.interfaces.sbIMediaPageManager); // Register Callbacks for searching. @@ -202,7 +199,7 @@ function Player() // {{{ mappings.add([modes.PLAYER], ["n"], "Find Next", function () { player.searchViewAgain(false);}); - + mappings.add([modes.PLAYER], ["N"], "Find Previous", function () { player.searchViewAgain(true);}); @@ -211,7 +208,7 @@ function Player() // {{{ mappings.add([modes.PLAYER], [""], "Rate the current media item 0", function () { player.rateMediaItem(0); }); - + mappings.add([modes.PLAYER], [""], "Rate the current media item 1", function () { player.rateMediaItem(1); }); @@ -231,8 +228,7 @@ function Player() // {{{ mappings.add([modes.PLAYER], [""], "Rate the current media item 5", function () { player.rateMediaItem(5); }); - - + ////////////////// ///////////////////////////////////////////////////////////}}} ////////////////////// COMMANDS //////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ @@ -326,7 +322,7 @@ function Player() // {{{ }, { argCount: "?", - completer: function(context, args) completion.playlist(context, args), + completer: function (context, args) completion.playlist(context, args), literal: 0 }); @@ -598,11 +594,11 @@ function Player() // {{{ searchString = args + " " + search; else searchString = args; - + lastSearchString = searchString; - + let mySearchView = LibraryUtils.createStandardMediaListView(mediaItemList, searchString); - + if (mySearchView.length) { lastSearchView = mySearchView; @@ -614,7 +610,7 @@ function Player() // {{{ liberator.echoerr("E486 Pattern not found: "+searchString, commandline.FORCE_SINGLELINE); } }, - + //FIXME: commandline.echo should work --ken searchViewAgain: function searchViewAgain(reverse) { @@ -644,17 +640,17 @@ function Player() // {{{ //FIXME: Implement for "?" --ken commandline.echo("/" + lastSearchString, null, commandline.FORCE_SINGLELINE); focusTrack(lastSearchView.getItemByIndex(lastSearchIndex)); - - }, + + }, getPlaylists: function getPlaylists() { let mainLibrary = LibraryUtils.mainLibrary; let playlists = [mainLibrary]; let listener = { - onEnumerationBegin: function() { }, - onEnumerationEnd: function() { }, - onEnumeratedItem: function(list, item) + onEnumerationBegin: function () { }, + onEnumerationEnd: function () { }, + onEnumeratedItem: function (list, item) { // FIXME: why are there null items and duplicates? if (!playlists.some(function (list) list.name == item.name) && item.name != null) @@ -692,7 +688,7 @@ function Player() // {{{ rateMediaItem: function rateMediaItem(rating) { if (gMM.sequencer.currentItem) - gMM.sequencer.currentItem.setProperty(SBProperties.rating, rating); + gMM.sequencer.currentItem.setProperty(SBProperties.rating, rating); }, getArtists: function getArtists() @@ -707,7 +703,6 @@ function Player() // {{{ var items = list.getItemsByProperty(SBProperties.artistName, artist).enumerate(); var i = 0, j = 0; - while (items.hasMoreElements()) { album = items.getNext().getProperty(SBProperties.albumName); @@ -750,10 +745,9 @@ function Player() // {{{ return tracksArray; } - + }; //}}} } // }}} - // vim: set fdm=marker sw=4 ts=4 et: diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 415c61bb..f12fafe6 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -184,14 +184,14 @@ ________________________________________________________________________________ |n| ||n|| + ________________________________________________________________________________ -Find next. Repeats the last search. If the search hits BOTTOM of the view, it +Find next. Repeats the last search. If the search hits BOTTOM of the view, it continues from TOP. ________________________________________________________________________________ |N| ||N|| + ________________________________________________________________________________ -Find previous. Repeats the last search in the opposite direction. If the search +Find previous. Repeats the last search in the opposite direction. If the search hits TOP of the view, it continues from BOTTTOM. ________________________________________________________________________________ From 0863ef897e597f1ee7328d656e902f83fb363bbb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 28 Mar 2009 16:49:26 +1100 Subject: [PATCH 112/143] Document mappings which change the track rating. --- xulmus/content/player.js | 40 ++++++++++------------------------ xulmus/locale/en-US/index.txt | 13 +++++++++++ xulmus/locale/en-US/player.txt | 29 +++++++++++++++++++----- 3 files changed, 49 insertions(+), 33 deletions(-) diff --git a/xulmus/content/player.js b/xulmus/content/player.js index a65e644b..52656a4c 100755 --- a/xulmus/content/player.js +++ b/xulmus/content/player.js @@ -193,41 +193,25 @@ function Player() // {{{ function () { player.decreaseVolume(); }); mappings.add([modes.PLAYER], - ["/"], "Search View", + ["/"], "Search forward for a track", function (args) { commandline.open("/", "", modes.SEARCH_VIEW_FORWARD); }); mappings.add([modes.PLAYER], - ["n"], "Find Next", + ["n"], "Find the next track", function () { player.searchViewAgain(false);}); mappings.add([modes.PLAYER], - ["N"], "Find Previous", + ["N"], "Find the previous track", function () { player.searchViewAgain(true);}); - //FIXME: Better way to do this ? --ken - mappings.add([modes.PLAYER], - [""], "Rate the current media item 0", - function () { player.rateMediaItem(0); }); - - mappings.add([modes.PLAYER], - [""], "Rate the current media item 1", - function () { player.rateMediaItem(1); }); - - mappings.add([modes.PLAYER], - [""], "Rate the current media item 2", - function () { player.rateMediaItem(2); }); - - mappings.add([modes.PLAYER], - [""], "Rate the current media item 3", - function () { player.rateMediaItem(3); }); - - mappings.add([modes.PLAYER], - [""], "Rate the current media item 4", - function () { player.rateMediaItem(4); }); - - mappings.add([modes.PLAYER], - [""], "Rate the current media item 5", - function () { player.rateMediaItem(5); }); + for (let i in util.range(0, 6)) + { + let (rating = i) { + mappings.add([modes.PLAYER], + [""], "Rate the current media item " + rating, + function () { player.rateMediaItem(rating); }); + } + } ////////////////// ///////////////////////////////////////////////////////////}}} ////////////////////// COMMANDS //////////////////////////////////////////////// @@ -627,7 +611,7 @@ function Player() // {{{ } else { - if (lastSearchIndex == (lastSearchView.length -1)) + if (lastSearchIndex == (lastSearchView.length - 1)) { //commandline.echo("Search hit BOTTOM, continuing at TOP", // commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES | commandline.FORCE_SINGLELINE); diff --git a/xulmus/locale/en-US/index.txt b/xulmus/locale/en-US/index.txt index ce56d602..c7fabf5b 100755 --- a/xulmus/locale/en-US/index.txt +++ b/xulmus/locale/en-US/index.txt @@ -23,6 +23,19 @@ section:Player{nbsp}mode[player-index] ||[m]+[m]|| Increase volume by 10% + ||[m]-[m]|| Decrease volume by 10% + +||[m]/[m]|| Search forward for a track + +//||[m]?[m]|| Search backward for a track + +||[m]n[m]|| Find the next track + +||[m]N[m]|| Find the previous track + + +// TODO: better formatting +|||| Rate the current track with 0 stars + +|||| Rate the current track with 1 stars + +|||| Rate the current track with 2 stars + +|||| Rate the current track with 3 stars + +|||| Rate the current track with 4 stars + +|||| Rate the current track with 5 stars + + section:Insert{nbsp}mode[insert-index] ||[m][m]|| Launch the external editor + diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index f12fafe6..55a8039e 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -178,21 +178,40 @@ section:Search{nbsp}commands[search] |/| ||/{pattern}|| + ________________________________________________________________________________ -Search for the first occurrence of {pattern} in the visible media view. +Search forward for a track matching {pattern} in the visible media view. ________________________________________________________________________________ +//|?| +//||?{pattern}|| + +//________________________________________________________________________________ +//Search backwards for a track matching {pattern} in the visible media view. +//________________________________________________________________________________ + |n| ||n|| + ________________________________________________________________________________ -Find next. Repeats the last search. If the search hits BOTTOM of the view, it -continues from TOP. +Find the next track. Repeats the last search. If the search hits BOTTOM of the +view, it continues from TOP. ________________________________________________________________________________ |N| ||N|| + ________________________________________________________________________________ -Find previous. Repeats the last search in the opposite direction. If the search -hits TOP of the view, it continues from BOTTTOM. +Find the previous track. Repeats the last search in the opposite direction. If +the search hits TOP of the view, it continues from BOTTTOM. +________________________________________________________________________________ + +section:Rating{nbsp}track[rating] + +|| || || || || || +|||| + +|||| + +|||| + +|||| + +|||| + +|||| + +________________________________________________________________________________ +Rate the current track with N stars. ________________________________________________________________________________ // vim: set filetype=asciidoc: From 4fc5a26888ab47c1c2ebcd197b9021e2cdb9ac95 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 28 Mar 2009 20:30:40 +1100 Subject: [PATCH 113/143] Fix typo. --- xulmus/locale/en-US/player.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xulmus/locale/en-US/player.txt b/xulmus/locale/en-US/player.txt index 55a8039e..ab9d5a0f 100644 --- a/xulmus/locale/en-US/player.txt +++ b/xulmus/locale/en-US/player.txt @@ -201,7 +201,7 @@ Find the previous track. Repeats the last search in the opposite direction. If the search hits TOP of the view, it continues from BOTTTOM. ________________________________________________________________________________ -section:Rating{nbsp}track[rating] +section:Rating{nbsp}tracks[rating] || || || || || || |||| + From de38813fce7d53d663e0a7609803bf6dd9d179f9 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 28 Mar 2009 20:34:24 +1100 Subject: [PATCH 114/143] cmus -> CMus in help references. --- xulmus/locale/en-US/intro.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xulmus/locale/en-US/intro.txt b/xulmus/locale/en-US/intro.txt index 4692276f..490f00c9 100755 --- a/xulmus/locale/en-US/intro.txt +++ b/xulmus/locale/en-US/intro.txt @@ -4,12 +4,12 @@ section:Introduction[intro] http://vimperator.org/Xulmus[Xulmus] is a free media player add-on for Songbird, which combines the best features of the -http://cmus.sourceforge.net[cmus] music player and the http://www.vim.org[Vim] +http://cmus.sourceforge.net[CMus] music player and the http://www.vim.org[Vim] text editor. |warning| + Warning: -To provide the most authentic cmus/Vim experience, the Songbird toolbar +To provide the most authentic CMus/Vim experience, the Songbird toolbar is hidden. + If you really need it, type: [c]:set guioptions+=T[c] to get it back. + If you don't like Xulmus at all, you can uninstall it by typing From 58dd4c2e77c017de66c19f536932385b631c32b9 Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sat, 28 Mar 2009 16:27:18 +0530 Subject: [PATCH 115/143] Fixed Initialization section in Help --- xulmus/locale/en-US/starting.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xulmus/locale/en-US/starting.txt b/xulmus/locale/en-US/starting.txt index 552c6ce2..b32bddbd 100755 --- a/xulmus/locale/en-US/starting.txt +++ b/xulmus/locale/en-US/starting.txt @@ -11,12 +11,12 @@ At startup, Xulmus completes the following tasks in order. one of the following is successfully located, it is executed, and no further locations are tried. - a. |$VIMPERATOR_INIT| - _$VIMPERATOR_INIT_ -- May contain a single Ex command (e.g., + a. |$XULMUS_INIT| + _$XULMUS_INIT_ -- May contain a single Ex command (e.g., "[c]:source {file}[c]"). - b. [a]\~/_vimperatorrc[a] -- Windows only. If this file exists, its contents + b. [a]\~/_xulmusrc[a] -- Windows only. If this file exists, its contents are executed. - c. [a]\~/.vimperatorrc[a] -- If this file exists, its contents are executed. + c. [a]\~/.xulmusrc[a] -- If this file exists, its contents are executed. 2. If 'exrc' is set, then any RC file in the current directory is also sourced. @@ -37,12 +37,12 @@ it finds. section:Saving{nbsp}settings[save-settings] -|:mkv| |:mkvimperatorrc| -||:mkv[imperatorrc][!] [a][file][a]|| + +|:mkx| |:mkxulmusrc| +||:mkx[ulmusrc][!] [a][file][a]|| + ________________________________________________________________________________ Write current key mappings and changed options to [a][file][a]. If no -[a][file][a] is specified then _~/.vimperatorrc_ is written unless this file -already exists. The special version [c]:mkvimperatorrc![c] will overwrite +[a][file][a] is specified then _~/.xulmusrc_ is written unless this file +already exists. The special version [c]:mkxulmusrc![c] will overwrite [a][file][a] if it exists. Warning: this differs from Vim's behavior which defaults to writing the file From d06e27ca57e8b262e27166c00f6527473f4cd35f Mon Sep 17 00:00:00 2001 From: Prathyush Thota Date: Sat, 28 Mar 2009 21:27:14 +0530 Subject: [PATCH 116/143] Version 0.1 & NEWS --- xulmus/Makefile | 2 +- xulmus/NEWS | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/xulmus/Makefile b/xulmus/Makefile index b161489d..118bb65e 100755 --- a/xulmus/Makefile +++ b/xulmus/Makefile @@ -1,6 +1,6 @@ #### configuration -VERSION = 0.1pre +VERSION = 0.1 NAME = xulmus include ../common/Makefile.common diff --git a/xulmus/NEWS b/xulmus/NEWS index 9260c32d..2f613fd3 100755 --- a/xulmus/NEWS +++ b/xulmus/NEWS @@ -1,2 +1,3 @@ -2009-XX-XX: - * version 0.1 (probably) +2009-03-28: + * version 0.1 + * first public release From 09c653062c9cc1d170917903e8227d15ef58f5ed Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Sat, 28 Mar 2009 23:10:10 +0100 Subject: [PATCH 117/143] Remove text shadow, should fix tabs on mac os --- common/content/bindings.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/content/bindings.xml b/common/content/bindings.xml index 09693199..d2fd0254 100644 --- a/common/content/bindings.xml +++ b/common/content/bindings.xml @@ -47,11 +47,9 @@ - - From 5ab1771e3c00fa4861d7f933f6efeedd47829880 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Sat, 28 Mar 2009 23:38:33 +0100 Subject: [PATCH 118/143] changed my email address --- License.txt | 2 +- common/content/buffer.js | 2 +- common/content/commands.js | 2 +- common/content/completion.js | 2 +- common/content/editor.js | 2 +- common/content/events.js | 2 +- common/content/find.js | 2 +- common/content/help.css | 2 +- common/content/hints.js | 2 +- common/content/io.js | 2 +- common/content/liberator.js | 2 +- common/content/liberator.xul | 2 +- common/content/mappings.js | 2 +- common/content/modes.js | 2 +- common/content/options.js | 2 +- common/content/tabs.js | 2 +- common/content/template.js | 2 +- common/content/ui.js | 2 +- common/content/util.js | 2 +- common/skin/liberator.css | 2 +- muttator/AUTHORS | 2 +- muttator/License.txt | 2 +- muttator/content/compose/compose.xul | 2 +- muttator/content/compose/liberator.xul | 120 ++++++++++++++++++++++++- muttator/content/config.js | 2 +- muttator/content/mail.js | 2 +- muttator/content/muttator.xul | 2 +- muttator/locale/en-US/asciidoc.conf | 2 +- muttator/locale/en-US/intro.txt | 2 +- vimperator/AUTHORS | 2 +- vimperator/Makefile | 2 +- vimperator/content/bookmarks.js | 2 +- vimperator/content/config.js | 2 +- vimperator/content/vimperator.xul | 2 +- vimperator/locale/en-US/asciidoc.conf | 2 +- vimperator/locale/en-US/intro.txt | 2 +- 36 files changed, 154 insertions(+), 36 deletions(-) mode change 120000 => 100644 muttator/content/compose/liberator.xul diff --git a/License.txt b/License.txt index 7efdb050..39f969f2 100644 --- a/License.txt +++ b/License.txt @@ -10,7 +10,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/buffer.js b/common/content/buffer.js index a9cb4831..237e2930 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/commands.js b/common/content/commands.js index d6417a23..6cc8ab97 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/completion.js b/common/content/completion.js index 5c8e9d2d..16e1d1a4 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/editor.js b/common/content/editor.js index 59d1c9dd..073e88cf 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/events.js b/common/content/events.js index 51d1ecb8..8d5dfe29 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/find.js b/common/content/find.js index 90a73868..89ebcb1f 100644 --- a/common/content/find.js +++ b/common/content/find.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/help.css b/common/content/help.css index 67bdba86..c8107467 100644 --- a/common/content/help.css +++ b/common/content/help.css @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/hints.js b/common/content/hints.js index 5e27d0c4..c263ae30 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/io.js b/common/content/io.js index ffebc794..bc0d1a15 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Code based on venkman Alternatively, the contents of this file may be used under the terms of diff --git a/common/content/liberator.js b/common/content/liberator.js index 9c0b2279..188bb145 100644 --- a/common/content/liberator.js +++ b/common/content/liberator.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/liberator.xul b/common/content/liberator.xul index e7609f52..d26700a7 100644 --- a/common/content/liberator.xul +++ b/common/content/liberator.xul @@ -13,7 +13,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/mappings.js b/common/content/mappings.js index 0f222d64..26864c2b 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/modes.js b/common/content/modes.js index b00ec691..5166e3e8 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/options.js b/common/content/options.js index 1442ce23..fb9bbeae 100644 --- a/common/content/options.js +++ b/common/content/options.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/tabs.js b/common/content/tabs.js index 3d44fbcb..d990a346 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/template.js b/common/content/template.js index ea6cf3a1..9f4df824 100644 --- a/common/content/template.js +++ b/common/content/template.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/ui.js b/common/content/ui.js index 56abd03b..4048bcb8 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/content/util.js b/common/content/util.js index 24a167e2..ce1705d4 100644 --- a/common/content/util.js +++ b/common/content/util.js @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/common/skin/liberator.css b/common/skin/liberator.css index 677adbef..c4475f59 100644 --- a/common/skin/liberator.css +++ b/common/skin/liberator.css @@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/muttator/AUTHORS b/muttator/AUTHORS index cdad350d..763ced8e 100644 --- a/muttator/AUTHORS +++ b/muttator/AUTHORS @@ -1,5 +1,5 @@ Main developer/Project founder: - * Martin Stubenschrott (stubenschrott@gmx.net) + * Martin Stubenschrott (stubenschrott@vimperator.org) Developers: * Daniel Bainton (dpb .AT. driftaway .DOT. org) diff --git a/muttator/License.txt b/muttator/License.txt index 7efdb050..39f969f2 100644 --- a/muttator/License.txt +++ b/muttator/License.txt @@ -10,7 +10,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/muttator/content/compose/compose.xul b/muttator/content/compose/compose.xul index f7466a7a..a0db3f57 100644 --- a/muttator/content/compose/compose.xul +++ b/muttator/content/compose/compose.xul @@ -13,7 +13,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Copyright (c) 2006-2009 by Martin Stubenschrott +Copyright (c) 2006-2009 by Martin Stubenschrott Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/muttator/content/compose/liberator.xul b/muttator/content/compose/liberator.xul deleted file mode 120000 index e6fca064..00000000 --- a/muttator/content/compose/liberator.xul +++ /dev/null @@ -1 +0,0 @@ -../../../common/content/liberator.xul \ No newline at end of file diff --git a/muttator/content/compose/liberator.xul b/muttator/content/compose/liberator.xul new file mode 100644 index 00000000..d26700a7 --- /dev/null +++ b/muttator/content/compose/liberator.xul @@ -0,0 +1,119 @@ + + + + + + +]> + + + +