1 // Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
2 // Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
3 // Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
5 // This work is licensed for reuse under an MIT license. Details are
6 // given in the LICENSE.txt file included with this file.
12 Components.utils.import("resource://dactyl/bootstrap.jsm");
13 defineModule("config", {
14 exports: ["ConfigBase", "Config", "config"],
15 require: ["services", "storage", "util", "template"],
19 var ConfigBase = Class("ConfigBase", {
21 * Called on dactyl startup to allow for any arbitrary application-specific
22 * initialization code. Must call superclass's init function.
24 init: function init() {
25 this.features.push = deprecated("set.add", function push(feature) set.add(this, feature));
26 if (util.haveGecko("2b"))
27 set.add(this.features, "Gecko2");
29 this.timeout(function () {
30 services["dactyl:"].pages.dtd = function () [null,
32 (["dactyl." + k, v] for ([k, v] in iter(config.dtd))),
33 (["dactyl." + s, config[s]] for each (s in config.dtdStrings)))
34 .map(function ([k, v]) ["<!ENTITY ", k, " '", String.replace(v || "null", /'/g, "'"), "'>"].join(""))
39 loadStyles: function loadStyles() {
40 const { highlight } = require("highlight");
41 highlight.styleableChrome = this.styleableChrome;
42 highlight.loadCSS(this.CSS);
43 highlight.loadCSS(this.helpCSS);
44 if (!util.haveGecko("2b"))
45 highlight.loadCSS(<![CDATA[
46 !TabNumber font-weight: bold; margin: 0px; padding-right: .8ex;
51 text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px;
56 get addonID() this.name + "@dactyl.googlecode.com",
57 addon: Class.memoize(function () {
60 addon = (JSMLoader.bootstrap || {}).addon;
61 if (addon && !addon.getResourceURI) {
62 util.reportError(Error(_("addon.unavailable")));
66 while (addon && !addon.getResourceURI);
69 addon = require("addons").AddonManager.getAddonByID(this.addonID);
74 * The current application locale.
76 appLocale: Class.memoize(function () services.chromeRegistry.getSelectedLocale("global")),
79 * The current dactyl locale.
81 locale: Class.memoize(function () this.bestLocale(this.locales)),
84 * The current application locale.
86 locales: Class.memoize(function () {
87 // TODO: Merge with completion.file code.
88 function getDir(str) str.match(/^(?:.*[\/\\])?/)[0];
90 let uri = "resource://dactyl-locale/";
91 let jar = io.isJarURL(uri);
93 let prefix = getDir(jar.JAREntry);
94 var res = iter(s.slice(prefix.length).replace(/\/.*/, "") for (s in io.listJar(jar.JARFile, prefix)))
98 res = array(f.leafName
99 // Fails on FF3: for (f in util.getFile(uri).iterDirectory())
100 for (f in values(util.getFile(uri).readDirectory()))
101 if (f.isDirectory())).array;
104 function exists(pkg) {
106 services["resource:"].getSubstitution(pkg);
114 return array.uniq([this.appLocale, this.appLocale.replace(/-.*/, "")]
115 .filter(function (locale) exists("dactyl-locale-" + locale))
120 * Returns the best locale match to the current locale from a list
121 * of available locales.
123 * @param {[string]} list A list of available locales
126 bestLocale: function (list) {
127 let langs = set(list);
128 return values([this.appLocale, this.appLocale.replace(/-.*/, ""),
129 "en", "en-US", iter(langs).next()])
130 .nth(function (l) set.has(langs, l), 0);
133 haveHg: Class.memoize(function () {
134 if (/pre$/.test(this.addon.version)) {
135 let uri = this.addon.getResourceURI("../.hg");
136 if (uri instanceof Ci.nsIFileURL &&
137 uri.QueryInterface(Ci.nsIFileURL).file.exists() &&
139 return ["hg", "-R", uri.file.parent.path];
144 branch: Class.memoize(function () {
146 return io.system(this.haveHg.concat(["branch"])).output;
147 return (/pre-hg\d+-(\S*)/.exec(this.version) || [])[1];
150 /** @property {string} The Dactyl version string. */
151 version: Class.memoize(function () {
152 if (/pre$/.test(this.addon.version)) {
153 let uri = this.addon.getResourceURI("../.hg");
154 if (uri instanceof Ci.nsIFileURL &&
155 uri.QueryInterface(Ci.nsIFileURL).file.exists() &&
156 io.pathSearch("hg")) {
157 return io.system(["hg", "-R", uri.file.parent.path,
159 "--template=hg{rev}-" + this.branch + " ({date|isodate})"]).output;
162 let version = this.addon.version;
163 if ("@DATE@" !== "@" + "DATE@")
164 version += " (created: @DATE@)";
168 get fileExt() this.name.slice(0, -5),
171 get name() config.name,
172 get home() "http://dactyl.sourceforge.net/",
173 get apphome() this.home + this.name,
174 code: "http://code.google.com/p/dactyl/",
175 get issues() this.home + "bug/" + this.name,
176 get plugins() "http://dactyl.sf.net/" + this.name + "/plugins",
177 get faq() this.home + this.name + "/faq",
179 "list.mailto": Class.memoize(function () config.name + "@googlegroups.com"),
180 "list.href": Class.memoize(function () "http://groups.google.com/group/" + config.name),
182 "hg.latest": Class.memoize(function () this.code + "source/browse/"), // XXX
183 "irc": "irc://irc.oftc.net/#pentadactyl",
187 "xmlns.dactyl": "http://vimperator.org/namespaces/liberator",
188 "xmlns.html": "http://www.w3.org/1999/xhtml",
189 "xmlns.xul": "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
191 "tag.command-line": '<link topic="command-line">command line</link>',
192 "tag.status-line": '<link topic="status-line">status line</link>',
205 helpStyles: /^(Help|StatusLine|REPL)|^(Boolean|Indicator|MoreMsg|Number|Object|Logo|Key(word)?|String)$/,
206 styleHelp: function styleHelp() {
207 if (!this.helpStyled) {
208 const { highlight } = require("highlight");
209 for (let k in keys(highlight.loaded))
210 if (this.helpStyles.test(k))
211 highlight.loaded[k] = true;
216 Local: function Local(dactyl, modules, window) ({
217 init: function init() {
219 let append = <e4x xmlns={XUL} xmlns:dactyl={NS}>
220 <menupopup id="viewSidebarMenu"/>
221 <broadcasterset id="mainBroadcasterSet"/>
223 for each (let [id, [name, key, uri]] in Iterator(this.sidebars)) {
224 append.XUL::menupopup[0].* +=
225 <menuitem observes={"pentadactyl-" + id + "Sidebar"} label={name} accesskey={key} xmlns={XUL}/>
226 append.XUL::broadcasterset[0].* +=
227 <broadcaster id={"pentadactyl-" + id + "Sidebar"}
228 autoCheck="false" type="checkbox" group="sidebar"
229 sidebartitle={name} sidebarurl={uri}
230 oncommand="toggleSidebar(this.id || this.observes);" xmlns={XUL}/>
233 util.overlayWindow(window, { append: append.elements() });
236 browser: Class.memoize(function () window.gBrowser),
237 tabbrowser: Class.memoize(function () window.gBrowser),
239 get browserModes() [modules.modes.NORMAL],
242 * @property {string} The ID of the application's main XUL window.
244 mainWindowId: window.document.documentElement.id,
247 * @property {number} The height (px) that is available to the output
250 get outputHeight() this.browser.mPanelContainer.boxObject.height,
252 tabStrip: Class.memoize(function () window.document.getElementById("TabsToolbar") || this.tabbrowser.mTabContainer),
256 * @property {Object} A mapping of names and descriptions
257 * of the autocommands available in this application. Primarily used
258 * for completion results.
263 * @property {Object} A map of :command-complete option values to completer
267 abbreviation: "abbreviation",
268 altstyle: "alternateStyleSheet",
269 bookmark: "bookmark",
272 color: "colorScheme",
276 environment: "environment",
277 event: "autocmdEvent",
278 extension: "extension",
281 highlight: "highlightGroup",
283 javascript: "javascript",
285 mapping: "userMapping",
289 preference: "preference",
293 shellcmd: "shellCommand",
296 usercommand: "userCommand"
300 * @property {Object} Application specific defaults for option values. The
301 * property names must be the options' canonical names, and the values
302 * must be strings as entered via :set.
304 defaults: { guioptions: "rb" },
308 * @property {Object} A map of dialogs available via the
309 * :dialog command. Property names map dialog names to an array
311 * [0] description - A description of the dialog, used in
312 * command completion results for :dialog.
313 * [1] action - The function executed by :dialog.
318 * @property {set} A list of features available in this
319 * application. Used extensively in feature test macros. Use
320 * dactyl.has(feature) to check for a feature's presence
326 * @property {string} The file extension used for command script files.
327 * This is the name string sans "dactyl".
329 get fileExtension() this.name.slice(0, -6),
333 hasTabbrowser: false,
336 * @property {string} The name of the application that hosts the
337 * extension. E.g., "Firefox" or "XULRunner".
342 * @property {[[]]} An array of application specific mode specifications.
343 * The values of each mode are passed to modes.addMode during
349 * @property {string} The name of the extension.
355 * @property {[string]} A list of extra scripts in the dactyl or
356 * application namespaces which should be loaded before dactyl
364 * @property {string} The leaf name of any temp files created by
365 * {@link io.createTempFile}.
367 get tempFile() this.name + ".tmp",
371 * @property {string} The default highlighting rules.
372 * See {@link Highlights#loadCSS} for details.
374 CSS: UTF8(String.replace(<><![CDATA[
377 Function color: navy;
380 Object color: maroon;
381 String color: green; white-space: pre;
383 Key font-weight: bold;
388 FontFixed font-family: monospace !important;
389 FontCode font-size: 9pt; font-family: -mox-fixed, monospace !important;
390 FontProportional font-size: 10pt; font-family: "Droid Sans", "Helvetica LT Std", Helvetica, "DejaVu Sans", Verdana, sans-serif !important;
392 // Hack to give these groups slightly higher precedence
393 // than their unadorned variants.
394 CmdCmdLine;[dactyl|highlight]>* 
 StatusCmdLine;[dactyl|highlight]>*
395 CmdNormal;[dactyl|highlight] 
 StatusNormal;[dactyl|highlight]
396 CmdErrorMsg;[dactyl|highlight] 
 StatusErrorMsg;[dactyl|highlight]
397 CmdInfoMsg;[dactyl|highlight] 
 StatusInfoMsg;[dactyl|highlight]
398 CmdModeMsg;[dactyl|highlight] 
 StatusModeMsg;[dactyl|highlight]
399 CmdMoreMsg;[dactyl|highlight] 
 StatusMoreMsg;[dactyl|highlight]
400 CmdQuestion;[dactyl|highlight] 
 StatusQuestion;[dactyl|highlight]
401 CmdWarningMsg;[dactyl|highlight] 
 StatusWarningMsg;[dactyl|highlight]
403 Normal color: black !important; background: white !important; font-weight: normal !important;
404 StatusNormal color: inherit !important; background: transparent !important;
405 ErrorMsg color: white !important; background: red !important; font-weight: bold !important;
406 InfoMsg color: black !important; background: white !important;
407 StatusInfoMsg color: inherit !important; background: transparent !important;
408 LineNr color: orange !important; background: white !important;
409 ModeMsg color: black !important; background: white !important;
410 StatusModeMsg color: inherit !important; background: transparent !important; padding-right: 1em;
411 MoreMsg color: green !important; background: white !important;
412 StatusMoreMsg background: transparent !important;
413 Message white-space: pre-wrap !important; min-width: 100%; width: 100%; padding-left: 4em; text-indent: -4em; display: block;
414 Message String white-space: pre-wrap;
415 NonText color: blue; background: transparent !important;
416 *Preview color: gray;
417 Question color: green !important; background: white !important; font-weight: bold !important;
418 StatusQuestion color: green !important; background: transparent !important;
419 WarningMsg color: red !important; background: white !important;
420 StatusWarningMsg color: red !important; background: transparent !important;
422 CmdLine;>*;;FontFixed padding: 1px !important;
423 CmdPrompt;.dactyl-commandline-prompt
424 CmdInput;.dactyl-commandline-command
425 CmdOutput white-space: pre;
429 CompGroup:not(:first-of-type) margin-top: .5em;
430 CompGroup:last-of-type padding-bottom: 1.5ex;
432 CompTitle color: magenta; background: white; font-weight: bold;
433 CompTitle>* padding: 0 .5ex;
434 CompTitleSep height: 1px; background: magenta; background: -moz-linear-gradient(60deg, magenta, white);
436 CompMsg font-style: italic; margin-left: 16px;
439 CompItem:nth-child(2n+1) background: rgba(0, 0, 0, .04);
440 CompItem[selected] background: yellow;
441 CompItem>* padding: 0 .5ex;
443 CompIcon width: 16px; min-width: 16px; display: inline-block; margin-right: .5ex;
444 CompIcon>img max-width: 16px; max-height: 16px; vertical-align: middle;
446 CompResult width: 36%; padding-right: 1%; overflow: hidden;
447 CompDesc color: gray; width: 62%; padding-left: 1em;
449 CompLess text-align: center; height: 0; line-height: .5ex; padding-top: 1ex;
450 CompLess::after content: "⌃";
452 CompMore text-align: center; height: .5ex; line-height: .5ex; margin-bottom: -.5ex;
453 CompMore::after content: "⌄";
456 EditorEditing;;* background: #bbb !important; -moz-user-input: none !important; -moz-user-modify: read-only !important;
457 EditorError;;* background: red !important;
458 EditorBlink1;;* background: yellow !important;
461 REPL overflow: auto; max-height: 40em;
463 REPL-E white-space: pre-wrap;
464 REPL-P white-space: pre-wrap; margin-bottom: 1em;
470 UsageItem:nth-of-type(2n) background: rgba(0, 0, 0, .04);
472 Indicator color: blue; width: 1.5em; text-align: center;
473 Filter font-weight: bold;
478 Link position: relative; padding-right: 2em;
479 Link:not(:hover)>LinkInfo opacity: 0; left: 0; width: 1px; height: 1px; overflow: hidden;
486 background: rgba(255, 255, 255, .8);
490 StatusLine;;;FontFixed {
491 -moz-appearance: none !important;
493 background: transparent !important;
494 border: 0px !important;
495 padding-right: 0px !important;
496 min-height: 18px !important;
497 text-shadow: none !important;
499 StatusLineNormal;[dactyl|highlight] color: white !important; background: black !important;
500 StatusLineBroken;[dactyl|highlight] color: black !important; background: #FFa0a0 !important; /* light-red */
501 StatusLineSecure;[dactyl|highlight] color: black !important; background: #a0a0FF !important; /* light-blue */
502 StatusLineExtended;[dactyl|highlight] color: black !important; background: #a0FFa0 !important; /* light-green */
504 TabClose;.tab-close-button
505 TabIcon;.tab-icon min-width: 16px;
507 TabNumber font-weight: bold; margin: 0px; padding-right: .8ex; cursor: default;
511 margin: 0 2px 0 -18px !important;
515 text-shadow: black -1px 0 1px, black 0 1px 1px, black 1px 0 1px, black 0 -1px 1px;
518 Title color: magenta; font-weight: bold;
519 URL text-decoration: none; color: green; background: inherit;
520 URL:hover text-decoration: underline; cursor: pointer;
521 URLExtra color: gray;
524 background-color: red;
534 Bell background-color: black !important;
537 font: bold 10px "Droid Sans Mono", monospace !important;
540 outline: 1px solid rgba(0, 0, 0, .5);
541 background: rgba(255, 248, 231, .8);
544 Hint[active];;* background: rgba(255, 253, 208, .8);
545 Hint::after;;* content: attr(text) !important;
546 HintElem;;* background-color: yellow !important; color: black !important;
547 HintActive;;* background-color: #88FF00 !important; color: black !important;
548 HintImage;;* opacity: .5 !important;
550 Button display: inline-block; font-weight: bold; cursor: pointer; color: black; text-decoration: none;
551 Button:hover text-decoration: underline;
552 Button[collapsed] visibility: collapse; width: 0;
553 Button::before content: "["; color: gray; text-decoration: none !important;
554 Button::after content: "]"; color: gray; text-decoration: none !important;
555 Button:not([collapsed]) ~ Button:not([collapsed])::before content: "/[";
559 DownloadCell display: table-cell; padding: 0 1ex;
561 Downloads display: table; margin: 0; padding: 0;
562 DownloadHead;;;CompTitle display: table-row;
563 DownloadHead>*;;;DownloadCell
565 Download display: table-row;
566 Download:not([active]) color: gray;
568 Download>*;;;DownloadCell
573 DownloadProgressTotal
578 DownloadTitle>Link>a max-width: 48ex; overflow: hidden; display: inline-block;
580 AddonCell display: table-cell; padding: 0 1ex;
582 Addons display: table; margin: 0; padding: 0;
583 AddonHead;;;CompTitle display: table-row;
584 AddonHead>*;;;AddonCell
586 Addon display: table-row;
591 AddonName max-width: 48ex; overflow: hidden;
596 ]]></>, /
/g, "\n")),
598 helpCSS: UTF8(<><![CDATA[
600 InlineHelpLink font-size: inherit !important; font-family: inherit !important;
602 Help;;;FontProportional line-height: 1.4em;
604 HelpInclude margin: 2em 0;
606 HelpArg;;;FontCode color: #6A97D4;
607 HelpOptionalArg;;;FontCode color: #6A97D4;
609 HelpBody display: block; margin: 1em auto; max-width: 100ex; padding-bottom: 1em; margin-bottom: 4em; border-bottom-width: 1px;
610 HelpBorder;*;dactyl://help/* border-color: silver; border-width: 0px; border-style: solid;
611 HelpCode;;;FontCode display: block; white-space: pre; margin-left: 2em;
612 HelpTT;html|tt;dactyl://help/*;FontCode
614 HelpDefault;;;FontCode display: inline-block; margin: -1px 1ex 0 0; white-space: pre; vertical-align: text-top;
616 HelpDescription display: block; clear: right;
617 HelpDescription[short] clear: none;
618 HelpEm;html|em;dactyl://help/* font-weight: bold; font-style: normal;
620 HelpEx;;;FontCode display: inline-block; color: #527BBD;
622 HelpExample display: block; margin: 1em 0;
623 HelpExample::before content: "Example: "; font-weight: bold;
625 HelpInfo display: block; width: 20em; margin-left: auto;
626 HelpInfoLabel display: inline-block; width: 6em; color: magenta; font-weight: bold; vertical-align: text-top;
627 HelpInfoValue display: inline-block; width: 14em; text-decoration: none; vertical-align: text-top;
629 HelpItem display: block; margin: 1em 1em 1em 10em; clear: both;
631 HelpKey;;;FontCode color: #102663;
632 HelpKeyword font-weight: bold; color: navy;
634 HelpLink;html|a;dactyl://help/* text-decoration: none !important;
635 HelpLink[href]:hover text-decoration: underline !important;
636 HelpLink[href^="mailto:"]::after content: "✉"; padding-left: .2em;
637 HelpLink[rel=external] {
638 /* Thanks, Wikipedia */
639 background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAFVBMVEVmmcwzmcyZzP8AZswAZv////////9E6giVAAAAB3RSTlP///////8AGksDRgAAADhJREFUGFcly0ESAEAEA0Ei6/9P3sEcVB8kmrwFyni0bOeyyDpy9JTLEaOhQq7Ongf5FeMhHS/4AVnsAZubxDVmAAAAAElFTkSuQmCC) no-repeat scroll right center;
645 HelpTOC>ol ol margin-left: -1em;
647 HelpOrderedList;ol;dactyl://help/* margin: 1em 0;
648 HelpOrderedList1;ol[level="1"],ol;dactyl://help/* list-style: outside decimal; display: block;
649 HelpOrderedList2;ol[level="2"],ol ol;dactyl://help/* list-style: outside upper-alpha;
650 HelpOrderedList3;ol[level="3"],ol ol ol;dactyl://help/* list-style: outside lower-roman;
651 HelpOrderedList4;ol[level="4"],ol ol ol ol;dactyl://help/* list-style: outside decimal;
653 HelpList;html|ul;dactyl://help/* display: block; list-style-position: outside; margin: 1em 0;
654 HelpListItem;html|li;dactyl://help/* display: list-item;
657 HelpNote color: red; font-weight: bold;
659 HelpOpt;;;FontCode color: #106326;
660 HelpOptInfo;;;FontCode display: block; margin-bottom: 1ex; padding-left: 4em;
662 HelpParagraph;html|p;dactyl://help/* display: block; margin: 1em 0em;
663 HelpParagraph:first-child margin-top: 0;
664 HelpParagraph:last-child margin-bottom: 0;
665 HelpSpec;;;FontCode display: block; margin-left: -10em; float: left; clear: left; color: #527BBD; margin-right: 1em;
667 HelpString;;;FontCode color: green; font-weight: normal;
668 HelpString::before content: '"';
669 HelpString::after content: '"';
670 HelpString[delim]::before content: attr(delim);
671 HelpString[delim]::after content: attr(delim);
673 HelpNews position: relative;
674 HelpNewsOld opacity: .7;
675 HelpNewsNew font-style: italic;
676 HelpNewsTag font-style: normal; position: absolute; left: 100%; padding-left: 1em; color: #527BBD; opacity: .6; white-space: pre;
678 HelpHead;html|h1,html|h2,html|h3,html|h4;dactyl://help/* {
683 HelpHead1;html|h1;dactyl://help/* {
685 padding-bottom: .2ex;
686 border-bottom-width: 1px;
689 HelpHead2;html|h2;dactyl://help/* {
691 padding-bottom: .2ex;
692 border-bottom-width: 1px;
695 HelpHead3;html|h3;dactyl://help/* {
697 padding-bottom: .2ex;
700 HelpHead4;html|h4;dactyl://help/* {
704 HelpTab;html|dl;dactyl://help/* {
708 border-bottom-width: 1px;
709 border-top-width: 1px;
713 HelpTabColumn;html|column;dactyl://help/* display: table-column;
714 HelpTabColumn:first-child width: 25%;
715 HelpTabTitle;html|dt;dactyl://help/*;FontCode display: table-cell; padding: .1ex 1ex; font-weight: bold;
716 HelpTabDescription;html|dd;dactyl://help/* display: table-cell; padding: .3ex 1em; text-indent: -1em; border-width: 0px;
717 HelpTabDescription>*;;dactyl://help/* text-indent: 0;
718 HelpTabRow;html|dl>html|tr;dactyl://help/* display: table-row;
720 HelpTag;;;FontCode display: inline-block; color: #527BBD; margin-left: 1ex; font-weight: normal;
721 HelpTags display: block; float: right; clear: right;
722 HelpTopic;;;FontCode color: #102663;
723 HelpType;;;FontCode margin-right: 2ex;
725 HelpWarning color: red; font-weight: bold;
727 HelpXML;;;FontCode color: #C5F779; background-color: #444444; font-family: Terminus, Fixed, monospace;
728 HelpXMLBlock { white-space: pre; color: #C5F779; background-color: #444444;
729 border: 1px dashed #aaaaaa;
732 font-family: Terminus, Fixed, monospace;
734 HelpXMLAttribute color: #C5F779;
735 HelpXMLAttribute::after color: #E5E5E5; content: "=";
736 HelpXMLComment color: #444444;
737 HelpXMLComment::before content: "<!--";
738 HelpXMLComment::after content: "-->";
739 HelpXMLProcessing color: #C5F779;
740 HelpXMLProcessing::before color: #444444; content: "<?";
741 HelpXMLProcessing::after color: #444444; content: "?>";
742 HelpXMLString color: #C5F779; white-space: pre;
743 HelpXMLString::before content: '"';
744 HelpXMLString::after content: '"';
745 HelpXMLNamespace color: #FFF796;
746 HelpXMLNamespace::after color: #777777; content: ":";
747 HelpXMLTagStart color: #FFF796; white-space: normal; display: inline-block; text-indent: -1.5em; padding-left: 1.5em;
748 HelpXMLTagEnd color: #71BEBE;
749 HelpXMLText color: #E5E5E5;
755 JSMLoader.loadSubScript("resource://dactyl-local-content/config.js", this);
757 config.INIT = update(Object.create(config.INIT), config.INIT, {
758 init: function init(dactyl, modules, window) {
759 init.superapply(this, arguments);
761 let img = window.Image();
762 img.src = this.logo || "resource://dactyl-local-content/logo.png";
763 img.onload = util.wrapCallback(function () {
764 const { highlight } = require("highlight");
765 highlight.loadCSS(<>{"!Logo {"}
766 display: inline-block;
767 background: url({img.src});
768 width: {img.width}px;
769 height: {img.height}px;
775 load: function load(dactyl, modules, window) {
776 load.superapply(this, arguments);
778 this.timeout(function () {
779 if (this.branch && this.branch !== "default" &&
780 modules.yes_i_know_i_should_not_report_errors_in_these_branches_thanks.indexOf(this.branch) === -1)
781 dactyl.warn(_("warn.notDefaultBranch", config.appName, this.branch));
788 } catch(e){ if (typeof e === "string") e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
790 // vim: set fdm=marker sw=4 sts=4 et ft=javascript: