зеркало из https://github.com/mozilla/ubiquity.git
Knuckled under Bug 560018.
This commit is contained in:
Родитель
6e39457da2
Коммит
8c7a5a4802
|
@ -107,32 +107,32 @@ Ubiquity.prototype = {
|
|||
// == Read Only Properties ==
|
||||
|
||||
// === {{{ Ubiquity#panel }}} ===
|
||||
get panel U_getPanel() this.__panel,
|
||||
get msgPanel U_getMsgPanel() this.__panel,
|
||||
get panel() this.__panel,
|
||||
get msgPanel() this.__panel,
|
||||
|
||||
// === {{{ Ubiquity#textBox }}} ===
|
||||
get textBox U_getTextBox() this.__textBox,
|
||||
get textBox() this.__textBox,
|
||||
|
||||
// === {{{ Ubiquity#cmdManager }}} ===
|
||||
get cmdManager U_getCmdManager() this.__cmdManager,
|
||||
get cmdManager() this.__cmdManager,
|
||||
|
||||
// === {{{ Ubiquity#lastKeyEvent }}} ===
|
||||
// The last captured key event on the {{{textBox}}}.
|
||||
get lastKeyEvent U_getLastKeyEvent() this.__lastKeyEvent,
|
||||
get lastKeyEvent() this.__lastKeyEvent,
|
||||
|
||||
// === {{{ Ubiquity#isWindowOpen }}} ===
|
||||
get isWindowOpen U_getIsWindowOpen()
|
||||
get isWindowOpen()
|
||||
this.__panel.state in this.__STATES_OPEN,
|
||||
__STATES_OPEN: {open: 1, showing: 1},
|
||||
|
||||
// === {{{ Ubiquity#inputDelay }}} ===
|
||||
// Delay between the user's last keyup and parsing in milliseconds.
|
||||
get inputDelay U_getInputDelay()
|
||||
get inputDelay()
|
||||
this.__prefs.get("extensions.ubiquity.inputDelay"),
|
||||
|
||||
// === {{{ Ubiquity#inputLimit }}} ===
|
||||
// Input length where Ubiquity starts to hesitate parsing. See #507.
|
||||
get inputLimit U_getInputLimit()
|
||||
get inputLimit()
|
||||
this.__prefs.get("extensions.ubiquity.inputLimit"),
|
||||
|
||||
__onmousemove: function U__onMouseMove(event) {
|
||||
|
|
|
@ -372,15 +372,15 @@ CommandManager.prototype = {
|
|||
if (hilitedSuggestion) this.__nlParser.strengthenMemory(hilitedSuggestion);
|
||||
},
|
||||
|
||||
get parser CM_parser() this.__nlParser,
|
||||
get lastInput CM_lastInput() this.__lastInput,
|
||||
get previewer CM_previewer() this.__previewer,
|
||||
get parser() this.__nlParser,
|
||||
get lastInput() this.__lastInput,
|
||||
get previewer() this.__previewer,
|
||||
|
||||
get maxSuggestions CM_maxSuggestions() CommandManager.maxSuggestions,
|
||||
get hasSuggestions CM_hasSuggestions() this.__activeQuery.hasResults,
|
||||
get suggestions CM_suggestions() this.__activeQuery.suggestionList,
|
||||
get hilitedSuggestion CM_hilitedSuggestion()
|
||||
get maxSuggestions() CommandManager.maxSuggestions,
|
||||
get hasSuggestions() this.__activeQuery.hasResults,
|
||||
get suggestions() this.__activeQuery.suggestionList,
|
||||
get hilitedSuggestion()
|
||||
this.__activeQuery.suggestionList[this.__hilitedIndex],
|
||||
get hilitedIndex CM_getHilitedIndex() this.__hilitedIndex,
|
||||
set hilitedIndex CM_setHilitedIndex(i) this.__hilitedIndex = i,
|
||||
get hilitedIndex() this.__hilitedIndex,
|
||||
set hilitedIndex(i) this.__hilitedIndex = i,
|
||||
};
|
||||
|
|
|
@ -77,12 +77,12 @@ var CmdUtils = {
|
|||
//
|
||||
// Ubiquity 0.1.x only supports parser version 1, while
|
||||
// Ubiquity 0.5.x supports parser versions 1 and 2.
|
||||
get parserVersion getParserVersion()
|
||||
get parserVersion()
|
||||
Utils.prefs.get("extensions.ubiquity.parserVersion", 1),
|
||||
|
||||
// === {{{ CmdUtils.maxSuggestions }}} ===
|
||||
// The current number of max suggestions.
|
||||
get maxSuggestions getMaxSuggestions() CommandManager.maxSuggestions,
|
||||
get maxSuggestions() CommandManager.maxSuggestions,
|
||||
};
|
||||
|
||||
for each (let f in this) if (typeof f === "function") CmdUtils[f.name] = f;
|
||||
|
|
|
@ -319,7 +319,7 @@ Feed.prototype = {
|
|||
// === {{{Feed#viewSourceUri}}} ===
|
||||
// Returns the {{{nsIURI}}} for the feed's source code. If the source
|
||||
// code only exists as cached data, this may be a data URI.
|
||||
get viewSourceUri Feed_getViewSourceUri() (
|
||||
get viewSourceUri() (
|
||||
this.canAutoUpdate
|
||||
? this.srcUri
|
||||
: Utils.uri("data:," + escape(this.getCode()))),
|
||||
|
@ -329,18 +329,18 @@ Feed.prototype = {
|
|||
// same as the {{{rel}}} attribute contained in a HTML page's
|
||||
// {{{<link>}}} tag, and determines what feed plugin is used to load
|
||||
// and process the feed. Read-only.
|
||||
get type Feed_getType()
|
||||
get type()
|
||||
this._annSvc.getPageAnnotation(this.uri, FEED_TYPE_ANNO, DEFAULT_FEED_TYPE),
|
||||
|
||||
// === {{{Feed#title}}} ===
|
||||
// The human-readable name for the feed. Read-only.
|
||||
get title Feed_getTitle()
|
||||
get title()
|
||||
this._annSvc.getPageAnnotation(this.uri, FEED_TITLE_ANNO, this.uri.spec),
|
||||
|
||||
// === {{{Feed#date}}} ===
|
||||
// Subscribed {{{Date}}} of the feed. {{{new Date(0)}}} for builtin feeds.
|
||||
// Read-only.
|
||||
get date Feed_getDate()
|
||||
get date()
|
||||
new Date(this._annSvc.getPageAnnotation(this.uri, FEED_DATE_ANNO, 0)),
|
||||
|
||||
// === {{{Feed#isBuiltIn}}} ===
|
||||
|
@ -348,19 +348,19 @@ Feed.prototype = {
|
|||
// as a built-in feed. See the documentation for
|
||||
// {{{FeedManager#addSubscribedFeed()}}} for more
|
||||
// information. Read-only.
|
||||
get isBuiltIn Feed_getIsBuiltIn()
|
||||
get isBuiltIn()
|
||||
this._annSvc.pageHasAnnotation(this.uri, FEED_BUILTIN_ANNO),
|
||||
|
||||
// === {{{Feed#isSubscribed}}} ===
|
||||
// Whether the feed is currently being subscribed to or not. Read-only.
|
||||
get isSubscribed Feed_getIsSubscribed()
|
||||
get isSubscribed()
|
||||
this._annSvc.pageHasAnnotation(this.uri, FEED_SUBSCRIBED_ANNO),
|
||||
|
||||
// === {{{Feed#canAutoUpdate}}} ===
|
||||
// Whether or not the latest version of the feed's source code should
|
||||
// be fetched from the network. See
|
||||
// {{{FeedManager#addSubscribedFeed()}}} for more information. Read-only.
|
||||
get canAutoUpdate Feed_getCanAutoUpdate()
|
||||
get canAutoUpdate()
|
||||
this._annSvc.getPageAnnotation(
|
||||
this.uri, FEED_AUTOUPDATE_ANNO, "") === "true",
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ Gettext.prototype.get_lang_refs = function () [];
|
|||
var LocalizationUtils = {
|
||||
GETTEXT: new Gettext(),
|
||||
|
||||
get loadedPo LU_loadedPo() loadedPo,
|
||||
get loadedPo() loadedPo,
|
||||
|
||||
isLocalizableLang: function LU_isLocalizableLang(langCode)
|
||||
DefaultLanguageCodes.indexOf(langCode) < 0,
|
||||
|
|
|
@ -107,13 +107,13 @@ ParserQuery.prototype = {
|
|||
},
|
||||
|
||||
// Read-only properties:
|
||||
get finished PQ_finished() {
|
||||
get finished() {
|
||||
for each (let req in this.requests)
|
||||
if ((req.readyState || 4) !== 4) return false;
|
||||
return true;
|
||||
},
|
||||
get hasResults PQ_hasResults() !!this._suggestionList.length,
|
||||
get suggestionList PQ_getSuggestionList() this._suggestionList,
|
||||
get hasResults() !!this._suggestionList.length,
|
||||
get suggestionList() this._suggestionList,
|
||||
|
||||
// The handler that makes this a listener for partiallyParsedSentences.
|
||||
onNewParseGenerated: function PQ_onNewParseGenerated() {
|
||||
|
@ -282,7 +282,7 @@ function ParsedSentence(
|
|||
this.frequencyMatchScore = 0;
|
||||
}
|
||||
ParsedSentence.prototype = {
|
||||
get completionText PS_getCompletionText() {
|
||||
get completionText() {
|
||||
// Returns plain text that we should set the input box to if user hits
|
||||
// the key to autocomplete to this sentence.
|
||||
var {matchedName: sentence, args} = this._verb;
|
||||
|
@ -304,7 +304,7 @@ ParsedSentence.prototype = {
|
|||
return sentence + " ";
|
||||
},
|
||||
// text formatted sentence for display in popup menu
|
||||
get displayText PS_getDisplayText() {
|
||||
get displayText() {
|
||||
var {matchedName: sentence, args} = this._verb;
|
||||
for (let x in (this.fromNounFirstSuggestion
|
||||
? this._argSuggs
|
||||
|
@ -318,7 +318,7 @@ ParsedSentence.prototype = {
|
|||
return sentence;
|
||||
},
|
||||
// html formatted sentence for display in suggestion list
|
||||
get displayHtml PS_getDisplayHtml() {
|
||||
get displayHtml() {
|
||||
var {escapeHtml} = Utils;
|
||||
var {matchedName, args} = this._verb;
|
||||
var html = '<span class="verb">' + escapeHtml(matchedName) + "</span> ";
|
||||
|
@ -343,9 +343,9 @@ ParsedSentence.prototype = {
|
|||
return html;
|
||||
},
|
||||
|
||||
get icon PS_getIcon() this._verb.cmd.icon,
|
||||
get previewUrl PS_getPreviewUrl() this._verb.cmd.previewUrl,
|
||||
get previewDelay PS_getPreviewDelay() this._verb.cmd.previewDelay,
|
||||
get icon() this._verb.cmd.icon,
|
||||
get previewUrl() this._verb.cmd.previewUrl,
|
||||
get previewDelay() this._verb.cmd.previewDelay,
|
||||
|
||||
execute: function PS_execute(context) {
|
||||
return this._verb.execute(context, this._argSuggs);
|
||||
|
@ -379,7 +379,7 @@ ParsedSentence.prototype = {
|
|||
return arg in this._argSuggs;
|
||||
},
|
||||
|
||||
get hasFilledArgs PS_hasFilledArgs() {
|
||||
get hasFilledArgs() {
|
||||
/* True if suggestion has at least one filled argument.
|
||||
False if verb has no arguments to fill, or if it has arguments but
|
||||
none of them are filled. */
|
||||
|
@ -452,7 +452,7 @@ ParsedSentence.prototype = {
|
|||
return newSentences;
|
||||
},
|
||||
|
||||
get score PS_getScore() {
|
||||
get score() {
|
||||
if (!this.argMatchScore) {
|
||||
// argument match score starts at 1 and increased for each
|
||||
// argument where a specific nountype (i.e. non-arbitrary-text)
|
||||
|
@ -684,7 +684,7 @@ PartiallyParsedSentence.prototype = {
|
|||
return alternates;
|
||||
},
|
||||
|
||||
get fromNounFirstSuggestion PPS_fromNounFirstSuggestion() !this._matchScore,
|
||||
get fromNounFirstSuggestion() !this._matchScore,
|
||||
};
|
||||
|
||||
function Verb(cmd, roleMap) {
|
||||
|
@ -748,9 +748,9 @@ function Verb(cmd, roleMap) {
|
|||
this.argCount = [0 for (_ in args)].length;
|
||||
}
|
||||
Verb.prototype = {
|
||||
get name V_name() this.cmd.names[0],
|
||||
get icon V_icon() this.cmd.icon,
|
||||
get disabled V_disabled() this.cmd.disabled,
|
||||
get name() this.cmd.names[0],
|
||||
get icon() this.cmd.icon,
|
||||
get disabled() this.cmd.disabled,
|
||||
|
||||
execute: function V_execute(context, argumentValues) {
|
||||
return (
|
||||
|
|
|
@ -136,7 +136,7 @@ var PrefKeysProto = {
|
|||
return this._lastKeysOk = true;
|
||||
},
|
||||
|
||||
get keyCombo PK_getKeyCombo() {
|
||||
get keyCombo() {
|
||||
var keyCode = gPrefs.getValue(this.KEYCODE_PREF,
|
||||
this.KEYCODE_DEFAULT);
|
||||
return [
|
||||
|
@ -147,7 +147,7 @@ var PrefKeysProto = {
|
|||
: ""];
|
||||
},
|
||||
|
||||
get keyComboText PK_getKeyComboText() this.keyCombo.join("+"),
|
||||
get keyComboText() this.keyCombo.join("+"),
|
||||
}
|
||||
|
||||
function isModifier(keyCode) keyCode in PrefKeys.MODIFIER2TEXT;
|
||||
|
|
|
@ -62,7 +62,7 @@ function PreviewBrowser(browser, defaultUrl) {
|
|||
}
|
||||
|
||||
PreviewBrowser.prototype = {
|
||||
get isActive PB_isActive() this.__isActive,
|
||||
get isActive() this.__isActive,
|
||||
|
||||
_onPreviewBrowserLoadUrl: function PB__onPreviewBrowserLoadUrl() {
|
||||
var cb = this.__previewBrowserUrlLoadedCallback;
|
||||
|
|
|
@ -203,9 +203,9 @@ var UbiquitySetup = {
|
|||
gWebJsModule = new WebJsModule(callback);
|
||||
},
|
||||
|
||||
get isResetScheduled getIsResetScheduled()
|
||||
get isResetScheduled()
|
||||
gPrefs.get(RESET_SCHEDULED_PREF, false),
|
||||
set isResetScheduled setIsResetScheduled(value)
|
||||
set isResetScheduled(value)
|
||||
gPrefs.set(RESET_SCHEDULED_PREF, value),
|
||||
|
||||
__removeExtinctStandardFeeds: function __rmExtinctStdFeeds(feedManager) {
|
||||
|
@ -317,13 +317,13 @@ var UbiquitySetup = {
|
|||
}
|
||||
},
|
||||
|
||||
get languageCode getLanguageCode()
|
||||
get languageCode()
|
||||
gPrefs.getValue("extensions.ubiquity.language", "en"),
|
||||
|
||||
get parserVersion getParserVersion()
|
||||
get parserVersion()
|
||||
gPrefs.getValue("extensions.ubiquity.parserVersion", 2),
|
||||
|
||||
get version getVersion()
|
||||
get version()
|
||||
Utils.ExtensionManager.getItemForID("ubiquity@labs.mozilla.com").version,
|
||||
};
|
||||
function DisabledCmdStorage(prefName) {
|
||||
|
|
|
@ -105,20 +105,20 @@ var SFP = Utils.extend(SkinFeedPlugin.prototype, {
|
|||
|
||||
// === {{{ SkinFeedPlugin.skins }}} ===
|
||||
// Installed {{{SkinFeed}}}s as array.
|
||||
get skins SFP_getSkins() [
|
||||
get skins() [
|
||||
feed for each (feed in this._feedManager.getSubscribedFeeds())
|
||||
if (feed.type === "ubiquity-skin")],
|
||||
|
||||
// === {{{ SkinFeedPlugin.customSkin }}} ===
|
||||
get customSkin SFP_getCurrentSkin()
|
||||
get customSkin()
|
||||
this._feedManager.getFeedForUrl(URL_CUSTOM),
|
||||
|
||||
// === {{{ SkinFeedPlugin.defaultSkin }}} ===
|
||||
get defaultSkin SFP_getCurrentSkin()
|
||||
get defaultSkin()
|
||||
this._feedManager.getFeedForUrl(URL_DEFAULT),
|
||||
|
||||
// === {{{ SkinFeedPlugin.currentSkin }}} ===
|
||||
get currentSkin SFP_getCurrentSkin() (
|
||||
get currentSkin() (
|
||||
this._feedManager.getFeedForUrl(Utils.prefs.get(PREF_SKIN, URL_DEFAULT)) ||
|
||||
this.defaultSkin),
|
||||
|
||||
|
@ -170,7 +170,7 @@ function SkinFeed(baseFeed, eventHub, msgService) Utils.extend({
|
|||
Utils.extend(SkinFeed.prototype, {
|
||||
// === {{{ SkinFeed#css }}} ===
|
||||
// CSS code of this skin. Settable if custom.
|
||||
get css SF_getCss() {
|
||||
get css() {
|
||||
var code = this._codeSource.getCode();
|
||||
if (this._codeSource.updated) this._dataCache = null;
|
||||
return code;
|
||||
|
@ -178,12 +178,12 @@ Utils.extend(SkinFeed.prototype, {
|
|||
|
||||
// === {{{ SkinFeed#dataUri }}} ===
|
||||
// Data URI object used to register this skin.
|
||||
get dataUri SF_getDataUri()
|
||||
get dataUri()
|
||||
Utils.uri("data:text/css,/*ubiquity-skin*/" + encodeURI(this.css)),
|
||||
|
||||
// === {{{ SkinFeed#metaData }}} ===
|
||||
// Contents of the meta data block ({{{ =skin= ~ =/skin= }}}).
|
||||
get metaData SF_getMetaData() {
|
||||
get metaData() {
|
||||
if (this._dataCache) return this._dataCache;
|
||||
var {css} = this, data = {name: this.title};
|
||||
var [, block] = /=skin=\s*([^]+)\s*=\/skin=/(css) || 0;
|
||||
|
|
|
@ -62,12 +62,12 @@ var Utils = {
|
|||
|
||||
// === {{{ Utils.currentChromeWindow }}} ===
|
||||
// A reference to the application chrome window that currently has focus.
|
||||
get currentChromeWindow getCurrentChromeWindow()
|
||||
get currentChromeWindow()
|
||||
Utils.WindowMediator.getMostRecentWindow(Utils.appWindowType),
|
||||
|
||||
// === {{{ Utils.chromeWindows }}} ===
|
||||
// An array of application chrome windows currently opened.
|
||||
get chromeWindows getChromeWindows() {
|
||||
get chromeWindows() {
|
||||
var wins = [];
|
||||
var enum = Utils.WindowMediator.getEnumerator(Utils.appWindowType);
|
||||
while (enum.hasMoreElements()) wins.push(enum.getNext());
|
||||
|
@ -76,12 +76,12 @@ var Utils = {
|
|||
|
||||
// === {{{ Utils.currentTab }}} ===
|
||||
// A reference to the focused tab as {{{Utils.BrowserTab}}}.
|
||||
get currentTab getCurrentTab()
|
||||
get currentTab()
|
||||
BrowserTab(Utils.currentChromeWindow.gBrowser.mCurrentTab),
|
||||
|
||||
// === {{{ Utils.currentTabs }}} ===
|
||||
// An array of tabs within the current chrome window.
|
||||
get currentTabs getCurrentTabs() gTabs.from(Utils.currentChromeWindow),
|
||||
get currentTabs() gTabs.from(Utils.currentChromeWindow),
|
||||
|
||||
__globalObject: this,
|
||||
};
|
||||
|
@ -785,7 +785,7 @@ extend(Sequence.prototype, {
|
|||
},
|
||||
__noSuchMethod__:
|
||||
function seq_pass(name, args) args[name].apply(this.toJSON(), args),
|
||||
get length seq_getLength() (this.end - this.lead) / this.step + 1 | 0,
|
||||
get length() (this.end - this.lead) / this.step + 1 | 0,
|
||||
toJSON: function seq_toJSON() [x for (x in this)],
|
||||
toString: function seq_toString()
|
||||
"[object Sequence(" + this.lead + "," + this.end + "," + this.step + ")]",
|
||||
|
@ -1055,20 +1055,20 @@ function BrowserTab(tabbrowser_tab) ({
|
|||
raw: tabbrowser_tab,
|
||||
});
|
||||
extend(BrowserTab.prototype, {
|
||||
get browser BT_getBrowser() this.raw.linkedBrowser,
|
||||
get tabbrowser BT_getTabbrowser() this.browser.getTabBrowser(),
|
||||
get uri BT_getUri() this.browser.currentURI,
|
||||
get title BT_getTitle() this.browser.contentTitle,
|
||||
get window BT_getWindow() this.browser.contentWindow,
|
||||
get document BT_getDocument() this.browser.contentDocument,
|
||||
get icon BT_getIcon() this.raw.image,
|
||||
get index BT_getIndex() {
|
||||
get browser() this.raw.linkedBrowser,
|
||||
get tabbrowser() this.browser.getTabBrowser(),
|
||||
get uri() this.browser.currentURI,
|
||||
get title() this.browser.contentTitle,
|
||||
get window() this.browser.contentWindow,
|
||||
get document() this.browser.contentDocument,
|
||||
get icon() this.raw.image,
|
||||
get index() {
|
||||
var {browser} = this, {mTabs} = browser.getTabBrowser();
|
||||
for (let i = 0, l = mTabs.length; i < l; ++i)
|
||||
if (mTabs[i].linkedBrowser === browser) return i;
|
||||
return -1;
|
||||
},
|
||||
get chromeWindow BT_getChromeWindow() {
|
||||
get chromeWindow() {
|
||||
var {tabbrowser} = this;
|
||||
for each (let win in Utils.chromeWindows)
|
||||
if (win.gBrowser === tabbrowser) return win;
|
||||
|
@ -1119,7 +1119,7 @@ var gTabs = Utils.tabs = {
|
|||
|
||||
// === {{{ Utils.tabs.length }}} ===
|
||||
// The total number of opened tabs.
|
||||
get length tabs_getLength() {
|
||||
get length() {
|
||||
var num = 0;
|
||||
for each (var win in Utils.chromeWindows) if ("gBrowser" in win)
|
||||
num += win.gBrowser.mTabs.length;
|
||||
|
|
Загрузка…
Ссылка в новой задаче