From ee26f90b63fc2af1b163e4af18862541f3f4a952 Mon Sep 17 00:00:00 2001 From: seaweedchan Date: Sat, 4 May 2013 05:04:01 -0700 Subject: [PATCH] Use => --- builds/4chan-X.js | 11 +++++------ builds/4chan-X.user.js | 11 +++++------ builds/crx/script.js | 13 ++++++------- src/General/lib/notification.class | 7 ++----- 4 files changed, 18 insertions(+), 24 deletions(-) diff --git a/builds/4chan-X.js b/builds/4chan-X.js index b6d609ac0..1fe73dc33 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -111,6 +111,7 @@ __slice = [].slice, __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; }, + __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; }; Config = { @@ -1360,12 +1361,10 @@ })(); Notification = (function() { - var add, close; - function Notification(type, content, timeout) { this.timeout = timeout; - this.add = add.bind(this); - this.close = close.bind(this); + this.close = __bind(this.close, this); + this.add = __bind(this.add, this); this.el = $.el('div', { innerHTML: '×
' }); @@ -1383,7 +1382,7 @@ return this.el.className = "notification " + type; }; - add = function() { + Notification.prototype.add = function() { if (d.hidden) { $.on(d, 'visibilitychange', this.add); return; @@ -1397,7 +1396,7 @@ } }; - close = function() { + Notification.prototype.close = function() { return $.rm(this.el); }; diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 66bb3966d..e1aa81e5e 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -111,6 +111,7 @@ __slice = [].slice, __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; }, + __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; }; Config = { @@ -1356,12 +1357,10 @@ })(); Notification = (function() { - var add, close; - function Notification(type, content, timeout) { this.timeout = timeout; - this.add = add.bind(this); - this.close = close.bind(this); + this.close = __bind(this.close, this); + this.add = __bind(this.add, this); this.el = $.el('div', { innerHTML: '×
' }); @@ -1379,7 +1378,7 @@ return this.el.className = "notification " + type; }; - add = function() { + Notification.prototype.add = function() { if (d.hidden) { $.on(d, 'visibilitychange', this.add); return; @@ -1393,7 +1392,7 @@ } }; - close = function() { + Notification.prototype.close = function() { return $.rm(this.el); }; diff --git a/builds/crx/script.js b/builds/crx/script.js index 5a5080f6d..7371964ef 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -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; }, __slice = [].slice, __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 = { main: { @@ -1358,12 +1359,10 @@ })(); Notification = (function() { - var add, close; - function Notification(type, content, timeout) { this.timeout = timeout; - this.add = add.bind(this); - this.close = close.bind(this); + this.close = __bind(this.close, this); + this.add = __bind(this.add, this); this.el = $.el('div', { innerHTML: '×
' }); @@ -1381,7 +1380,7 @@ return this.el.className = "notification " + type; }; - add = function() { + Notification.prototype.add = function() { if (d.hidden) { $.on(d, 'visibilitychange', this.add); return; @@ -1395,7 +1394,7 @@ } }; - close = function() { + Notification.prototype.close = function() { return $.rm(this.el); }; diff --git a/src/General/lib/notification.class b/src/General/lib/notification.class index 1542fef62..c12251290 100644 --- a/src/General/lib/notification.class +++ b/src/General/lib/notification.class @@ -1,8 +1,5 @@ class Notification constructor: (type, content, @timeout) -> - @add = add.bind @ - @close = close.bind @ - @el = $.el 'div', innerHTML: '×
' @el.style.opacity = 0 @@ -17,7 +14,7 @@ class Notification setType: (type) -> @el.className = "notification #{type}" - add = -> + add: => if d.hidden $.on d, 'visibilitychange', @add return @@ -27,5 +24,5 @@ class Notification @el.style.opacity = 1 setTimeout @close, @timeout * $.SECOND if @timeout - close = -> + close: => $.rm @el \ No newline at end of file