Browse Source

Use CSS to define desktop notification image and use a PNG instead of ico.

pull/76/head
Simon Eisenmann 11 years ago
parent
commit
b55ae0f400
  1. 4
      src/styles/global/_base.scss
  2. 2
      static/css/main.min.css
  3. BIN
      static/img/notify.ico
  4. BIN
      static/img/notify.png
  5. 15
      static/js/services/desktopnotify.js

4
src/styles/global/_base.scss

@ -60,3 +60,7 @@ a { @@ -60,3 +60,7 @@ a {
.dialog-header-confirm {
background-color: $dialog-header-neutral;
}
.desktopnotify-icon {
background-image: url("../img/notify.png");
}

2
static/css/main.min.css vendored

File diff suppressed because one or more lines are too long

BIN
static/img/notify.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
static/img/notify.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

15
static/js/services/desktopnotify.js

@ -18,10 +18,21 @@ @@ -18,10 +18,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
define(['jquery', 'underscore', 'desktop-notify'], function($, _) {
define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) {
return ["$window", function($window) {
// Retrieve URL from CSS.
var defaultIconUrl = (function() {
var iconElement = $("<span>").addClass("desktopnotify-icon hidden");
iconElement.appendTo("body");
var url = iconElement.css('background-image');
url = /^url\((['"]?)(.*)\1\)$/.exec(url);
url = url ? url[2] : "";
iconElement.remove();
return url;
}());
var helper = notify;
var desktopNotify = function() {
@ -86,7 +97,7 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _) { @@ -86,7 +97,7 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _) {
var opts = {
body: body,
icon: "static/img/notify.ico",
icon: defaultIconUrl,
timeout: 7000
}
$.extend(opts, options);

Loading…
Cancel
Save