32 const Cc = Components.classes;
33 const Ci = Components.interfaces;
34 const Cr = Components.results;
35 const Ce = Components.Exception;
36 const Cu = Components.utils;
46 let attr =
node.getAttribute(
"badges");
48 return attr.split(/\s+/);
72 throw "Badge ID is a mandatory parameter";
73 if (
id && /\s/.
test(
id))
74 throw "Spaces are not allowed in badge ID";
84 return this.
node.getAttribute(
"badge_" + this.
id +
"_label");
87 this.
node.setAttribute(
"badge_" + this.
id +
"_label",
value);
95 return this.
node.getAttribute(
"badge_" + this.
id +
"_image");
98 this.
node.setAttribute(
"badge_" + this.
id +
"_image",
value);
111 return (badges.indexOf(
this.id) >= 0);
115 let currentIndex = badges.indexOf(this.
id);
117 if (currentIndex < 0)
121 if (currentIndex >= 0) {
122 badges.splice(currentIndex, 1);
123 this.
node.setAttribute(
"badges", badges.length ? badges.join(
" ") :
null);
135 this.insertBefore(
null);
142 insertBefore:
function(
id) {
143 if (
id && /\s/.
test(
id))
144 throw "No spaces allowed in badge ID";
148 let currentIndex = badges.indexOf(this.
id);
149 if (currentIndex >= 0)
150 badges.splice(currentIndex, 1);
152 let newIndex = (
id ? badges.indexOf(
id) : -1);
154 newIndex = badges.length;
155 badges.splice(newIndex, 0, this.
id);
157 this.
node.setAttribute(
"badges", badges.join(
" "));
168 this.visible =
false;
169 this.
node.removeAttribute(
"badge_" + this.
id +
"_label");
170 this.
node.removeAttribute(
"badge_" + this.
id +
"_image");
194 getBadge:
function(
node, badgeID) {
199 }
else if (/\x00/.
test(badgeID)) {
201 throw "No NUL characters allowed in badge ID";
216 getAllBadges:
function(
node) {
function ServicePaneBadge(node, id)
var badgeIndex
counter used to generate unique IDs for badges where no ID is supplied.
function getBadgesForNode(node)
Helper function to retrieve visible badges for a service pane node.
this _contentSandbox label
this _dialogInput val(dateText)
__defineGetter__("Application", function(){delete this.Application;return this.Application=Cc["@mozilla.org/fuel/application;1"].getService(Ci.fuelIApplication);})