Skip to content
This repository has been archived by the owner on Oct 18, 2018. It is now read-only.

Commit

Permalink
Merge pull request #111 from dglol/icon-fix
Browse files Browse the repository at this point in the history
Fixed invisible appearance in toolbar palette (#111)
  • Loading branch information
whimboo committed Mar 28, 2012
2 parents a4a88de + a96314d commit 522399d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
17 changes: 9 additions & 8 deletions extension/data/widget/widget.html
Expand Up @@ -2,31 +2,31 @@
<html>
<head>
<style type="text/css">
html {
body {
margin-top: 1px;
font-family: "Lucida Grande", "Segoe UI", Arial, sans-serif;
font-size: 11px;
color: inherit;
text-align: right;
}

p {
display: inline;
}

#data {
display: none;
#splash {
margin-left: 13px;
float: left;
}

#logger {
margin: 0.5px 0 0 2px;
width: 12px;
height: 12px;
border-radius: 6px;
display: inline-block;
vertical-align: top;
}

#data, #init, #logger {
display: none;
}

.warning {
color: #800;
}
Expand All @@ -41,6 +41,7 @@
</style>
</head>
<body>
<span id="splash">MemChaser</span>
<p id="init">Initializing MemChaser...</p>
<p id="data">
<span id="resident">
Expand Down
19 changes: 13 additions & 6 deletions extension/data/widget/widget.js
Expand Up @@ -2,7 +2,7 @@ const BYTE_TO_MEGABYTE = 1/1048576;

const GARBAGE_COLLECTOR_DURATION_WARNING = 100;

var bindEvents = function () {
var setup = function () {
let logger = document.getElementById("logger");
let tooltipElements = [].slice.call(document.querySelectorAll("[data-tooltip]"));

Expand All @@ -16,6 +16,12 @@ var bindEvents = function () {
self.port.emit("update_tooltip", this.dataset.tooltip);
};
});

// https://bugzilla.mozilla.org/show_bug.cgi?id=660857
// TODO: Remove this when bug 660857 is fixed; otherwise
// we have to resort to the following workaround:
document.getElementById("splash").style.display = "none";
document.getElementById("init").style.display = "inline";
};

/**
Expand All @@ -38,12 +44,13 @@ var getDuration = function (aEntry) {
/**
* Hide the initialization element and show real values
*/
var hideSplashText = function () {
var hideInitText = function () {
document.getElementById("init").style.display = "none";
document.getElementById("data").style.display = "inline";
document.getElementById("logger").style.display = "inline-block";

// Prevents execution of above DOM calls
hideSplashText = function () { return; }
hideInitText = function () { return; }
};

/**
Expand Down Expand Up @@ -75,7 +82,7 @@ self.port.on("logger_update", function (data) {
* Update the values of the specified collector
*/
var updateCollector = function (aType, aData) {
hideSplashText();
hideInitText();

let duration = getDuration(aData['current'][aType]);
let age;
Expand Down Expand Up @@ -117,7 +124,7 @@ self.port.on("update_garbage_collector", function (aData) {
});

self.port.on("update_memory", function (data) {
hideSplashText();
hideInitText();

// Update widget with current memory usage
["resident"].forEach(function (aType) {
Expand All @@ -128,4 +135,4 @@ self.port.on("update_memory", function (data) {
});
});

bindEvents();
setup();

0 comments on commit 522399d

Please sign in to comment.