зеркало из https://github.com/mozilla/lightbeam.git
Merge pull request #584 from fmarier/issue579
infobar: pull the version number from package.json (fix #579)
This commit is contained in:
Коммит
91fdf3b9b2
|
@ -143,12 +143,18 @@ function onLoad(connections) {
|
||||||
console.debug('aggregate::onLoad end, took %s ms', Date.now() - startTime);
|
console.debug('aggregate::onLoad end, took %s ms', Date.now() - startTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateUIFromMetadata(metadata) {
|
||||||
|
console.debug("in aggregate metadata");
|
||||||
|
global.updateUIFromMetadata(metadata);
|
||||||
|
}
|
||||||
|
|
||||||
function updateUIFromPrefs(prefs) {
|
function updateUIFromPrefs(prefs) {
|
||||||
console.debug("in aggregate prefs");
|
console.debug("in aggregate prefs");
|
||||||
global.updateUIFromPrefs(prefs);
|
global.updateUIFromPrefs(prefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
aggregate.on('load', onLoad);
|
aggregate.on('load', onLoad);
|
||||||
|
aggregate.on("updateUIFromMetadata", updateUIFromMetadata);
|
||||||
aggregate.on("updateUIFromPrefs", updateUIFromPrefs);
|
aggregate.on("updateUIFromPrefs", updateUIFromPrefs);
|
||||||
|
|
||||||
// Constants for indexes of properties in array format
|
// Constants for indexes of properties in array format
|
||||||
|
|
|
@ -30,8 +30,14 @@ self.port.on('init', function () {
|
||||||
global.aggregate.emit('load', global.allConnections);
|
global.aggregate.emit('load', global.allConnections);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
self.port.on("updateUIFromMetadata", function (metadata) {
|
||||||
|
console.debug("Got add-on metadata", metadata);
|
||||||
|
global.aggregate.emit("updateUIFromMetadata", metadata);
|
||||||
|
});
|
||||||
|
|
||||||
self.port.on("updateUIFromPrefs", function (prefs) {
|
self.port.on("updateUIFromPrefs", function (prefs) {
|
||||||
console.debug("Got set prefs", prefs);
|
console.debug("Got set prefs", prefs);
|
||||||
global.aggregate.emit("updateUIFromPrefs", prefs);
|
global.aggregate.emit("updateUIFromPrefs", prefs);
|
||||||
});
|
});
|
||||||
|
|
||||||
})(this);
|
})(this);
|
||||||
|
|
|
@ -204,7 +204,7 @@
|
||||||
<div class="graph-view-help">
|
<div class="graph-view-help">
|
||||||
<header class="large-header"><img src="image/lightbeam_icon_about.png" /> About Lightbeam</header>
|
<header class="large-header"><img src="image/lightbeam_icon_about.png" /> About Lightbeam</header>
|
||||||
<div>
|
<div>
|
||||||
<div class="grey-label all-cap-header">Version</div> 1.0<br />
|
<div class="grey-label all-cap-header">Version</div> <span id="version-number"></span><br />
|
||||||
<div class="grey-label all-cap-header">By</div> Mozilla Foundation<br />
|
<div class="grey-label all-cap-header">By</div> Mozilla Foundation<br />
|
||||||
</div>
|
</div>
|
||||||
<section>
|
<section>
|
||||||
|
|
|
@ -479,6 +479,10 @@ global.singularOrPluralNoun = function singularOrPluralNoun(num, str) {
|
||||||
return (num > 1) ? str + "s" : str;
|
return (num > 1) ? str + "s" : str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function updateUIFromMetadata(event) {
|
||||||
|
document.querySelector('#version-number').textContent = event.version;
|
||||||
|
}
|
||||||
|
|
||||||
function updateUIFromPrefs(event) {
|
function updateUIFromPrefs(event) {
|
||||||
if ("contributeData" in event && event.contributeData) {
|
if ("contributeData" in event && event.contributeData) {
|
||||||
var toggleBtn = document.querySelector(".share-btn");
|
var toggleBtn = document.querySelector(".share-btn");
|
||||||
|
@ -510,5 +514,6 @@ function updateUIFromPrefs(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
|
global.updateUIFromMetadata = updateUIFromMetadata;
|
||||||
global.updateUIFromPrefs = updateUIFromPrefs;
|
global.updateUIFromPrefs = updateUIFromPrefs;
|
||||||
})(this);
|
})(this);
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
/* global require, exports, console */
|
/* global require, exports, console */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const {
|
const self = require("sdk/self");
|
||||||
data
|
const data = self.data;
|
||||||
} = require("sdk/self");
|
|
||||||
const tabs = require('sdk/tabs');
|
const tabs = require('sdk/tabs');
|
||||||
const {
|
const {
|
||||||
isPrivate
|
isPrivate
|
||||||
|
@ -187,6 +186,7 @@ function attachToLightbeamPage(worker) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUIReady() {
|
function onUIReady() {
|
||||||
|
worker.port.emit("updateUIFromMetadata", { version: self.version });
|
||||||
worker.port.emit("updateUIFromPrefs", prefs);
|
worker.port.emit("updateUIFromPrefs", prefs);
|
||||||
worker.port.emit("passStoredConnections", getAllConnections());
|
worker.port.emit("passStoredConnections", getAllConnections());
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче