This commit is contained in:
seaweedchan 2013-05-04 05:04:01 -07:00
parent 2b439207e4
commit ee26f90b63
4 changed files with 18 additions and 24 deletions

View File

@ -111,6 +111,7 @@
__slice = [].slice, __slice = [].slice,
__hasProp = {}.hasOwnProperty, __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
Config = { Config = {
@ -1360,12 +1361,10 @@
})(); })();
Notification = (function() { Notification = (function() {
var add, close;
function Notification(type, content, timeout) { function Notification(type, content, timeout) {
this.timeout = timeout; this.timeout = timeout;
this.add = add.bind(this); this.close = __bind(this.close, this);
this.close = close.bind(this); this.add = __bind(this.add, this);
this.el = $.el('div', { this.el = $.el('div', {
innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>' innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>'
}); });
@ -1383,7 +1382,7 @@
return this.el.className = "notification " + type; return this.el.className = "notification " + type;
}; };
add = function() { Notification.prototype.add = function() {
if (d.hidden) { if (d.hidden) {
$.on(d, 'visibilitychange', this.add); $.on(d, 'visibilitychange', this.add);
return; return;
@ -1397,7 +1396,7 @@
} }
}; };
close = function() { Notification.prototype.close = function() {
return $.rm(this.el); return $.rm(this.el);
}; };

View File

@ -111,6 +111,7 @@
__slice = [].slice, __slice = [].slice,
__hasProp = {}.hasOwnProperty, __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
Config = { Config = {
@ -1356,12 +1357,10 @@
})(); })();
Notification = (function() { Notification = (function() {
var add, close;
function Notification(type, content, timeout) { function Notification(type, content, timeout) {
this.timeout = timeout; this.timeout = timeout;
this.add = add.bind(this); this.close = __bind(this.close, this);
this.close = close.bind(this); this.add = __bind(this.add, this);
this.el = $.el('div', { this.el = $.el('div', {
innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>' innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>'
}); });
@ -1379,7 +1378,7 @@
return this.el.className = "notification " + type; return this.el.className = "notification " + type;
}; };
add = function() { Notification.prototype.add = function() {
if (d.hidden) { if (d.hidden) {
$.on(d, 'visibilitychange', this.add); $.on(d, 'visibilitychange', this.add);
return; return;
@ -1393,7 +1392,7 @@
} }
}; };
close = function() { Notification.prototype.close = function() {
return $.rm(this.el); return $.rm(this.el);
}; };

View File

@ -92,7 +92,8 @@
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
__slice = [].slice, __slice = [].slice,
__hasProp = {}.hasOwnProperty, __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
Config = { Config = {
main: { main: {
@ -1358,12 +1359,10 @@
})(); })();
Notification = (function() { Notification = (function() {
var add, close;
function Notification(type, content, timeout) { function Notification(type, content, timeout) {
this.timeout = timeout; this.timeout = timeout;
this.add = add.bind(this); this.close = __bind(this.close, this);
this.close = close.bind(this); this.add = __bind(this.add, this);
this.el = $.el('div', { this.el = $.el('div', {
innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>' innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>'
}); });
@ -1381,7 +1380,7 @@
return this.el.className = "notification " + type; return this.el.className = "notification " + type;
}; };
add = function() { Notification.prototype.add = function() {
if (d.hidden) { if (d.hidden) {
$.on(d, 'visibilitychange', this.add); $.on(d, 'visibilitychange', this.add);
return; return;
@ -1395,7 +1394,7 @@
} }
}; };
close = function() { Notification.prototype.close = function() {
return $.rm(this.el); return $.rm(this.el);
}; };

View File

@ -1,8 +1,5 @@
class Notification class Notification
constructor: (type, content, @timeout) -> constructor: (type, content, @timeout) ->
@add = add.bind @
@close = close.bind @
@el = $.el 'div', @el = $.el 'div',
innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>' innerHTML: '<a href=javascript:; class=close title=Close>×</a><div class=message></div>'
@el.style.opacity = 0 @el.style.opacity = 0
@ -17,7 +14,7 @@ class Notification
setType: (type) -> setType: (type) ->
@el.className = "notification #{type}" @el.className = "notification #{type}"
add = -> add: =>
if d.hidden if d.hidden
$.on d, 'visibilitychange', @add $.on d, 'visibilitychange', @add
return return
@ -27,5 +24,5 @@ class Notification
@el.style.opacity = 1 @el.style.opacity = 1
setTimeout @close, @timeout * $.SECOND if @timeout setTimeout @close, @timeout * $.SECOND if @timeout
close = -> close: =>
$.rm @el $.rm @el