diff -r 000000000000 -r 6474c204b198 toolkit/content/widgets/notification.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolkit/content/widgets/notification.xml Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,500 @@ + + + + + +%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; + + + + + + + + + + + + + = 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"); + 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); + buttonElem.setAttribute("accesskey", button.accessKey); + 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); + 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", "closebutton"); + + + document.getAnonymousElementByAttribute(this, "anonid", "button"); + + + document.getAnonymousElementByAttribute(this, "anonid", "menupopup"); + + + +