%notificationDTD; ]> 1 2 3 4 5 6 7 8 9 10 null null null false if (val) this.setAttribute('notificationshidden', true); else this.removeAttribute('notificationshidden'); return val; n != closedNotification); ]]> = 0; n--) { if (aValue == notifications[n].getAttribute("value")) return notifications[n]; } return null; ]]> this.PRIORITY_CRITICAL_BLOCK) throw "Invalid notification priority " + aPriority; // check for where the notification should be inserted according to // priority. If two are equal, the existing one appears on top. var notifications = this.allNotifications; var insertPos = null; for (var n = notifications.length - 1; n >= 0; n--) { if (notifications[n].priority < aPriority) break; insertPos = notifications[n]; } const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; var newitem = document.createElementNS(XULNS, "notification"); // Can't use instanceof in case this was created from a different document: let labelIsDocFragment = aLabel && typeof aLabel == "object" && aLabel.nodeType && aLabel.nodeType == aLabel.DOCUMENT_FRAGMENT_NODE; if (!labelIsDocFragment) newitem.setAttribute("label", aLabel); newitem.setAttribute("value", aValue); if (aImage) newitem.setAttribute("image", aImage); newitem.eventCallback = aEventCallback; if (aButtons) { // The notification-button-default class is added to the button // with isDefault set to true. If there is no such button, it is // added to the first button (unless that button has isDefault // set to false). There cannot be multiple default buttons. var defaultElem; for (var b = 0; b < aButtons.length; b++) { var button = aButtons[b]; var buttonElem = document.createElementNS(XULNS, "button"); buttonElem.setAttribute("label", button.label); if (typeof button.accessKey == "string") buttonElem.setAttribute("accesskey", button.accessKey); if (typeof button.type == "string") { buttonElem.setAttribute("type", button.type); if ((button.type == "menu-button" || button.type == "menu") && "popup" in button) { buttonElem.appendChild(button.popup); delete button.popup; } if (typeof button.anchor == "string") buttonElem.setAttribute("anchor", button.anchor); } buttonElem.classList.add("notification-button"); if (button.isDefault || b == 0 && !("isDefault" in button)) defaultElem = buttonElem; newitem.appendChild(buttonElem); buttonElem.buttonInfo = button; } if (defaultElem) defaultElem.classList.add("notification-button-default"); } newitem.setAttribute("priority", aPriority); if (aPriority >= this.PRIORITY_CRITICAL_LOW) newitem.setAttribute("type", "critical"); else if (aPriority <= this.PRIORITY_INFO_HIGH) newitem.setAttribute("type", "info"); else newitem.setAttribute("type", "warning"); if (!insertPos) { newitem.style.position = "fixed"; newitem.style.top = "100%"; newitem.style.marginTop = "-15px"; newitem.style.opacity = "0"; } this.insertBefore(newitem, insertPos); // Can only insert the document fragment after the item has been created because // otherwise the XBL structure isn't there yet: if (labelIsDocFragment) { document.getAnonymousElementByAttribute(newitem, "anonid", "messageText") .appendChild(aLabel); } if (!insertPos) this._showNotification(newitem, true); // Fire event for accessibility APIs var event = document.createEvent("Events"); event.initEvent("AlertActive", true, true); newitem.dispatchEvent(event); return newitem; ]]> = 0; n--) { if (aImmediate) this._removeNotificationElement(notifications[n]); else this.removeNotification(notifications[n]); } this.currentNotification = null; // Must clear up any currently animating notification if (aImmediate) this._finishAnimation(); ]]> = 0; n--) { var notification = notifications[n]; if (notification.persistence) notification.persistence--; else if (Date.now() > notification.timeout) this.removeNotification(notification); } ]]> = 0) ? notifications[idx] : null; if (skipAnimation) { this._removeNotificationElement(this._closedNotification); this._closedNotification = null; this._setBlockingState(this.currentNotification); return; } aNotification.style.marginTop = -height + "px"; aNotification.style.opacity = 0; } this._animating = true; ]]> 0 &learnMore; document.getAnonymousElementByAttribute(this, "anonid", "checkbox"); document.getAnonymousElementByAttribute(this, "anonid", "closebutton"); document.getAnonymousElementByAttribute(this, "anonid", "button"); document.getAnonymousElementByAttribute(this, "anonid", "menupopup");