growlyflash 0.2.10 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c64e6ffb171a8cbf9c295021cbf58134b9f93204
4
- data.tar.gz: 3a17bc8ae29aaa098ba321a314ecdc825fdb2627
3
+ metadata.gz: e58668dcd8da28c9ef6a2825d642358ca399b285
4
+ data.tar.gz: 61cb763f5328fce65817562112b4858d1394319d
5
5
  SHA512:
6
- metadata.gz: bdcc13123355665ad37f429c7135b11bade7946f03ce6bcbba84d1137e5b6427afc1bf948fe3e0ccf6f01c7d69f773861df35865ead639605b846a329090bf21
7
- data.tar.gz: 734717e92a9021ca82ef46aaebecdf184f4d60ad86beb6e7b123de12977a3729facc1d63f643ebd1a5c73d211ec373763963e53e3e8a362836bc42007fafd071
6
+ metadata.gz: 62c3b1fbc6998b6f0d971f8b748620a4203ffc2f0978192a07cea3a97253f83ae536dedd5e6190aa0a85686950e1d10e3428876ad420e117504837f5179283fc
7
+ data.tar.gz: 73b325ace30ee62de527c7e5dd57a218f5c829784a9f66ed6254dc8c07b9066594bdd97764836896dfe63c96ba41cb468a9b192b259e9e605bbccf8d1f0b7727
data/README.md CHANGED
@@ -1,86 +1,93 @@
1
1
  # Growlyflash
2
2
 
3
- The growlyflash gem turns boring [ActionDispatch::Flash](http://api.rubyonrails.org/v3.2.14/?q=ActionDispatch::Flash) messages in your Rails 3 app to asynchronous Growl-like notifications with [Bootstrap Alert](http://getbootstrap.com/2.3.2/components.html#alerts) markup.
3
+ The growlyflash gem turns boring [ActionDispatch::Flash](http://api.rubyonrails.org/?q=ActionDispatch::Flash) messages in your Rails app to asynchronous Growl-like notifications with [Bootstrap Alert](http://getbootstrap.com/components/#alerts) markup.
4
4
 
5
5
  With XHR requests it places flash hash to the `X-Messages` HTTP header or inline in javascript.
6
6
 
7
- Based on rewritten in coffeescript [Bootstrap Growl](https://github.com/ifightcrime/bootstrap-growl) plugin and inspired by [Bootstrap Flash Messages](https://github.com/RobinBrouwer/bootstrap_flash_messages)
7
+ Based on rewritten in coffeescript [Bootstrap Growl](https://github.com/ifightcrime/bootstrap-growl) plugin and inspired by [Bootstrap Flash Messages](https://github.com/RobinBrouwer/bootstrap_flash_messages)
8
+
9
+ ## Update from versions below 0.5.0
10
+
11
+ Warning! Current version breaks integration from older releases, so, if you want to update, you should check installation and customization steps again.
8
12
 
9
13
  ## Installation
10
14
 
11
15
  Add this line to your application's Gemfile:
12
- ````ruby
13
- gem 'growlyflash'
14
- ````
15
- And then execute:
16
- ````
17
- $ bundle
18
- ````
19
- For non-XHR requests append the following before other javascripts inside `<head>`:
20
- ````erb
16
+
17
+ ```ruby
18
+ gem 'growlyflash', '~> 0.5.0'
19
+ ```
20
+
21
+ To use text flash messages as growl notifications with XHR request, just add this `after_filter` to your controllers (usually `application_controller.rb`):
22
+
23
+ ```ruby
24
+ after_filter :flash_to_headers, if: :is_xhr_request?
25
+ ```
26
+
27
+ To make notifications also available with non-XHR requests, insert the following line into your layout template inside `<head>` tag before any other javascript:
28
+
29
+ ```erb
21
30
  <%= growlyflash_static_notices %>
22
- ````
23
- And require glowlyflash in `app/assets/javascripts/application.js`
24
- ````js
25
- //= require growlyflash/growlyflash
26
- ````
31
+ ```
32
+
33
+ Require one of the following Growlyflash javascripts depending on your Bootstrap version in `app/assets/javascripts/application.js`:
34
+
35
+ ```js
36
+ // for Bootstrap 3
37
+ //= require growlyflash
38
+
39
+ // for Bootstrap 2
40
+ //= require growlyflash.bs2
41
+ ```
42
+
43
+ Finally, import Growlyflash style in `app/assets/stylesheets/application.css.scss` after importing Bootstrap styles:
44
+
45
+ ```scss
46
+ @import "growlyflash";
47
+ ```
27
48
 
28
49
  ## Customize
29
50
 
30
51
  If you want to change default options, you can override them somewhere in your coffee/js:
31
- ````coffee
32
- $.bootstrapGrowl.defaults = $.extend on, $.bootstrapGrowl.defaults,
33
- # Box width (number or css-like string, etc. "auto")
34
- width: 250
35
-
36
- # Auto-dismiss timeout. Set it to 0 if you want to disable auto-dismiss
37
- delay: 4000
38
-
39
- # Spacing between boxes in stack
40
- spacing: 10
41
-
42
- # Appends boxes to a specific container
43
- target: 'body'
44
-
45
- # Show close button
46
- dismiss: true
47
-
48
- # Default class suffix for alert boxes.
49
- type: null
50
-
51
- # Use the following mapping (Flash key => Bootstrap Alert)
52
- type_mapping:
53
- warning: null
54
- error : 'error'
55
- notice : 'info'
56
- success: 'success'
57
-
58
- # Horizontal aligning (left, right or center)
59
- align: 'right'
60
-
61
- # Margin from the closest side
62
- alignAmount: 20
63
-
64
- # Offset from window bounds
65
- offset:
66
- from: 'top'
67
- amount: 20
68
- ````
52
+
53
+ ```coffee
54
+ Growlyflash.defaults = $.extend on, Growlyflash.defaults,
55
+ align: 'right' # horizontal aligning (left, right or center)
56
+ delay: 4000 # auto-dismiss timeout (0 to disable auto-dismiss)
57
+ dismiss: yes # allow to show close button
58
+ spacing: 10 # spacing between alerts
59
+ target: 'body' # selector to target element where to place alerts
60
+ type: null # bootstrap alert class by default
61
+ class: ['alert', 'growlyflash', 'fade']
62
+ ```
63
+
64
+ Also you can override few style variables before the `@import` directive (or just manually override styles ([look at _growlyflash.scss](app/assets/stylesheets/_growlyflash.scss)):
65
+
66
+ ```scss
67
+ $growlyflash-top: 20px !default;
68
+ $growlyflash-side: 20px !default;
69
+ $growlyflash-width: auto !default;
70
+ $growlyflash-zindex: 9999 !default;
71
+
72
+ @import "growlyflash";
73
+ ```
69
74
 
70
75
  Insert the following if you want to close alert boxes by clicking on themselves.
71
- Also it doesn't steel focus from toggled elements like dropdowns and works fine with touch devices,
72
- so I advise to use it:
73
- ````coffee
76
+ Also it doesn't steel focus from toggled elements like dropdowns and works fine with touch devices, so I advise to use it:
77
+
78
+ ```coffee
74
79
  jQuery ->
75
- # ...
76
- $(document).on 'click.alert.data-api', '[data-dismiss="alert"]', (e) ->
80
+ $(document).on 'click.alert.data-api', '[data-dismiss="alert"]', (e) ->
77
81
  e.stopPropagation()
82
+ off
78
83
 
79
- $(document).on 'touchstart click', ".bootstrap-growl", (e) ->
84
+ $(document).on 'touchstart click', ".bootstrap-growl", (e) ->
80
85
  e.stopPropagation()
81
86
  $('[data-dismiss="alert"]', @).click()
82
87
  off
83
- ````
88
+ ```
89
+
90
+ Also
84
91
 
85
92
  ## Contributing
86
93
 
@@ -0,0 +1,7 @@
1
+ #= require ./growlyflash
2
+
3
+ Growlyflash.KEY_MAPPING =
4
+ warning: null
5
+ error: 'error'
6
+ notice: 'info'
7
+ success: 'success'
@@ -0,0 +1,5 @@
1
+ #= require ./growlyflash/alert
2
+ #= require ./growlyflash/listener
3
+
4
+ jQuery ->
5
+ Growlyflash.listen_on this
@@ -0,0 +1,56 @@
1
+ class Growlyflash
2
+ window.Growlyflash ?= Growlyflash
3
+
4
+ Growlyflash.defaults =
5
+ align: 'right' # horizontal aligning (left, right or center)
6
+ delay: 4000 # auto-dismiss timeout (0 to disable auto-dismiss)
7
+ dismiss: yes # allow to show close button
8
+ spacing: 10 # spacing between alerts
9
+ target: 'body' # selector to target element where to place alerts
10
+ type: null # bootstrap alert class by default
11
+ class: ['alert', 'growlyflash', 'fade']
12
+
13
+ Growlyflash.KEY_MAPPING =
14
+ alert: 'warning'
15
+ error: 'danger'
16
+ notice: 'info'
17
+ success: 'success'
18
+
19
+ class Growlyflash.FlashStruct
20
+ shown: no
21
+ constructor: (@msg, @key) -> @type = Growlyflash.KEY_MAPPING[@key]
22
+ growl: -> $.growlyflash this
23
+ is_equal: (other) -> (@key is other.key) and (@msg is other.msg)
24
+ isnt_equal: (other) -> not @is_equal other
25
+
26
+ class Growlyflash.Alert
27
+ constructor: (@flash, options) ->
28
+ {@align, @delay, @dismiss, @msg, @spacing, @target, @type, @class} = options
29
+
30
+ @el = ($ '<div>', class: @_classes().join(' '), html: "#{@_dismiss()}#{@msg}").appendTo(@target)
31
+ @el.css(@_calc_position()).toggleClass('in')
32
+ @el.delay(@delay).fadeOut(-> ($ @).remove()) if @delay > 0
33
+
34
+ _classes: ->
35
+ @class.concat ("alert-#{type}" for type in [@type] when type?), ["growlyflash-#{@align}"]
36
+
37
+ _dismiss: ->
38
+ return "" unless @dismiss?
39
+ """<a class="close" data-dismiss="alert" href="#">&times;</a>"""
40
+
41
+ _calc_offset: ->
42
+ amount = parseInt(@el.css 'top')
43
+ (@el.siblings '.growlyflash').each (_, el) =>
44
+ amount = Math.max(amount, parseInt(($ el).css 'top') + ($ el).outerHeight() + @spacing)
45
+ amount
46
+
47
+ _calc_position: ->
48
+ styles = {}
49
+ styles.top = "#{@_calc_offset()}px"
50
+ styles.marginLeft = "-#{@el.outerWidth() / 2}px" if @align is 'center'
51
+ styles
52
+
53
+ $.growlyflash = (flash, options = {}) ->
54
+ settings = $.extend(on, {}, Growlyflash.defaults, msg: flash.msg, type: flash.type, options)
55
+ alert = new Growlyflash.Alert(flash, settings)
56
+ if flash instanceof Growlyflash.FlashStruct then flash else alert
@@ -0,0 +1,41 @@
1
+ class Growlyflash.Listener
2
+ HEADER = 'X-Message'
3
+ EVENTS = 'ajax:complete ajaxComplete'
4
+
5
+ # Alerts stack
6
+ class Stack extends Array
7
+ constructor: (items...) ->
8
+ @splice 0, 0, items...
9
+ has_uniq_in: (alerts, counter = 0) ->
10
+ return true unless @length > 0
11
+ recent = @slice -alerts.length
12
+ counter++ for id, item of alerts when recent[id].isnt_equal? item
13
+ counter > 0
14
+ push_all: (alerts) ->
15
+ @push alert.growl() for alert in alerts
16
+ this
17
+ push_once: (alerts) ->
18
+ @push_all alerts if @has_uniq_in alerts
19
+ @purge()
20
+ purge: ->
21
+ setTimeout (=> @splice 0), 100
22
+
23
+ process = (alerts = {}) ->
24
+ new Growlyflash.FlashStruct(msg, type) for type, msg of alerts when msg?
25
+
26
+ process_from_header = (source) ->
27
+ return [] unless source?
28
+ process $.parseJSON(decodeURIComponent source)
29
+
30
+ constructor: (context) ->
31
+ @stack ?= new Stack()
32
+ @process_static() if window.flashes?
33
+ ($ context).on EVENTS, (_, xhr) =>
34
+ @stack.push_once process_from_header(xhr.getResponseHeader HEADER)
35
+ return
36
+ process_static: ->
37
+ @stack.push_all process(window.flashes)
38
+ delete window.flashes
39
+
40
+ Growlyflash.listen_on = (context) ->
41
+ @listener ?= new @Listener(context)
@@ -0,0 +1,23 @@
1
+ $growlyflash-top: 20px !default;
2
+ $growlyflash-side: 20px !default;
3
+ $growlyflash-width: auto !default;
4
+ $growlyflash-zindex: 9999 !default;
5
+
6
+ .alert.growlyflash {
7
+ position: absolute;
8
+ margin: 0;
9
+ top: $growlyflash-top;
10
+ width: $growlyflash-width;
11
+ z-index: $growlyflash-zindex;
12
+
13
+ &.growlyflash-left {
14
+ left: $growlyflash-side; }
15
+ &.growlyflash-right {
16
+ right: $growlyflash-side; }
17
+ &.growlyflash-center {
18
+ left: 50%; }
19
+ }
20
+
21
+ body > .alert.growlyflash {
22
+ position: fixed;
23
+ }
@@ -1,20 +1,20 @@
1
1
  # encoding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'growlyflash/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "growlyflash"
8
- spec.version = Growlyflash::VERSION
7
+ spec.version = "0.5.0"
9
8
  spec.authors = ["Tõnis Simo"]
10
9
  spec.email = ["anton.estum@gmail.com"]
11
- spec.homepage = "https://github.com/tonissimo/growlyflash"
10
+ spec.homepage = "https://github.com/estum/growlyflash"
12
11
  spec.summary = %q{Tiny gem which provides growl-styled flash messages for Ruby on Rails with Bootstrap.}
13
12
  spec.description = %q{Tiny gem which provides growl-styled flash messages for Ruby on Rails with Bootstrap. For XHR requests flash messages are transfering in 'X-Messages' headers, otherwise they are storing in js variables.}
14
-
13
+ spec.license = "MIT"
14
+
15
15
  spec.files = `git ls-files`.split($/)
16
- spec.require_paths = %w(lib vendor)
16
+ spec.require_paths = %w[app lib]
17
17
 
18
18
  spec.add_dependency "railties", ">= 3.2", "< 5.0"
19
19
  spec.add_dependency 'coffee-rails', ">= 3.2.1"
20
- end
20
+ end
@@ -1,36 +1,4 @@
1
1
  # encoding: utf-8
2
2
 
3
- require "growlyflash/version"
4
- require "uri"
5
-
6
- module Growlyflash
7
- module XMessageHeaders
8
- def flash_to_headers
9
- xmessage = URI.escape(Hash[flash].to_json) # URI escape to fix strange things with headers encoding
10
- response.headers['X-Message'] = xmessage
11
- flash.discard # discard flash to prevent it appear again after refreshing page
12
- end
13
-
14
- private
15
- def is_xhr_request?
16
- request.xhr?
17
- end
18
- end
19
-
20
- module NoticeHelpers
21
- def growlyflash_static_notices
22
- return nil unless flash.any?
23
- javascript_tag "window.flashes = #{raw(Hash[flash].except!(:timedout, 'timedout').to_json)};", defer: 'defer'
24
- end
25
- end
26
-
27
- class Engine < ::Rails::Engine
28
- initializer :growlyflash_xmessage_headers do |config|
29
- ActionController::Base.class_eval do
30
- include XMessageHeaders
31
- helper NoticeHelpers
32
- after_filter :flash_to_headers, if: :is_xhr_request?
33
- end
34
- end
35
- end
36
- end
3
+ require 'growlyflash/controller_additions'
4
+ require 'growlyflash/engine' if defined?(Rails)
@@ -0,0 +1,33 @@
1
+ require 'active_support/concern'
2
+
3
+ module Growlyflash
4
+ module ControllerAdditions
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ helper_method :growlyflash_static_notices
9
+ end
10
+
11
+ private
12
+ def is_xhr_request?
13
+ request.xhr?
14
+ end
15
+
16
+ def flash_to_headers
17
+ _text_flashes = text_flashes
18
+ response.headers['X-Message'] = URI.escape(_text_flashes.to_json)
19
+
20
+ # discard flash to prevent it appear again after refreshing page
21
+ _text_flashes.each_key {|k| flash.discard(k) }
22
+ end
23
+
24
+ def growlyflash_static_notices
25
+ return nil unless flash.any?
26
+ view_context.javascript_tag "window.flashes = #{text_flashes.except!(:timedout, 'timedout').to_json.html_safe};", defer: 'defer'
27
+ end
28
+
29
+ def text_flashes
30
+ flash.to_hash.select {|k, v| v.is_a? String }
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,7 @@
1
+ module Growlyflash
2
+ class Engine < ::Rails::Engine
3
+ ActiveSupport.on_load :action_controller do
4
+ include Growlyflash::ControllerAdditions
5
+ end
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: growlyflash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tõnis Simo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-25 00:00:00.000000000 Z
11
+ date: 2014-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -57,19 +57,24 @@ files:
57
57
  - Gemfile
58
58
  - README.md
59
59
  - Rakefile
60
+ - app/assets/javascripts/growlyflash.bs2.js.coffee
61
+ - app/assets/javascripts/growlyflash.js.coffee
62
+ - app/assets/javascripts/growlyflash/alert.coffee
63
+ - app/assets/javascripts/growlyflash/listener.coffee
64
+ - app/assets/stylesheets/_growlyflash.scss
60
65
  - growlyflash.gemspec
61
66
  - lib/growlyflash.rb
62
- - lib/growlyflash/version.rb
63
- - vendor/assets/javascripts/growlyflash/bootstrap-growl.js.coffee
64
- - vendor/assets/javascripts/growlyflash/growlyflash.js.coffee
65
- homepage: https://github.com/tonissimo/growlyflash
66
- licenses: []
67
+ - lib/growlyflash/controller_additions.rb
68
+ - lib/growlyflash/engine.rb
69
+ homepage: https://github.com/estum/growlyflash
70
+ licenses:
71
+ - MIT
67
72
  metadata: {}
68
73
  post_install_message:
69
74
  rdoc_options: []
70
75
  require_paths:
76
+ - app
71
77
  - lib
72
- - vendor
73
78
  required_ruby_version: !ruby/object:Gem::Requirement
74
79
  requirements:
75
80
  - - ">="
@@ -1,3 +0,0 @@
1
- module Growlyflash
2
- VERSION = "0.2.10"
3
- end
@@ -1,95 +0,0 @@
1
- # https://github.com/ifightcrime/bootstrap-growl
2
-
3
- do ($ = jQuery) ->
4
- old = $.bootstrapGrowl
5
-
6
- alert_classes_add = (list...) ->
7
- ['bootstrap-growl', 'alert'].concat("alert-#{type}" for type in list when type?)
8
-
9
- css_metrics_val = (val) ->
10
- str = "#{val ? 0}"
11
- str += "px" if /\d$/.test str
12
- str
13
-
14
- $.bootstrapGrowl = (message, options) ->
15
- {width, delay, spacing, target, align, alignAmount, dismiss, type, offset} = $.extend({}, $.bootstrapGrowl.defaults, options)
16
- width = css_metrics_val width
17
- alignAmount = css_metrics_val alignAmount
18
-
19
- box_alert = $ """
20
- <div class="#{alert_classes_add(type).join(" ")}">
21
- #{'<a class="close" data-dismiss="alert" href="#">&times;</a>' if dismiss}
22
- #{message}
23
- </div>
24
- """
25
-
26
- # calculate any 'stack-up'
27
- $(".bootstrap-growl").each ->
28
- height = $(@).outerHeight()
29
- _from = parseInt $(@).css offset.from
30
- offset.amount = Math.max offset.amount, _from + height + spacing
31
-
32
- box_alert.css offset.from, css_metrics_val(offset.amount)
33
- box_alert.css
34
- position: (if target is 'body' then 'fixed' else 'absolute')
35
- width: width
36
- display: 'none'
37
- zIndex: 9999
38
- margin: 0
39
-
40
- $(target).append box_alert
41
- box_alert.css switch align
42
- when "center" then left: '50%', marginLeft: "-#{box_alert.outerWidth() / 2}px"
43
- when "left" then left: alignAmount
44
- else right: alignAmount
45
-
46
- box_alert.fadeIn()
47
- # Only remove after delay if delay is more than 0
48
- box_alert.delay(delay).fadeOut(-> $(@).remove()) if delay > 0
49
-
50
- return this
51
-
52
-
53
- $.bootstrapGrowl.defaults =
54
- # Width of the box (number or css-like string, etc. "auto")
55
- width: 250
56
-
57
- # Auto-dismiss timeout. Set it to 0 if you want to disable auto-dismiss
58
- delay: 4000
59
-
60
- # Spacing between boxes in stack
61
- spacing: 10
62
-
63
- # Appends boxes to a specific container
64
- target: 'body'
65
-
66
- # Show close button
67
- dismiss: true
68
-
69
- # Default class suffix for alert boxes.
70
- type: null
71
-
72
- # Use the following mapping (Flash key => Bootstrap Alert)
73
- type_mapping:
74
- warning: null
75
- error : 'error'
76
- notice : 'info'
77
- success: 'success'
78
-
79
- # Horizontal aligning (left, right or center)
80
- align: 'right'
81
-
82
- # Margin from the closest side
83
- alignAmount: 20
84
-
85
- # Offset from window bounds
86
- offset:
87
- from: 'top'
88
- amount: 20
89
-
90
-
91
- $.bootstrapGrowl.noConflict = ->
92
- $.bootstrapGrowl = old
93
- return this
94
-
95
- return this
@@ -1,62 +0,0 @@
1
- #= require growlyflash/bootstrap-growl
2
-
3
- root = window ? this
4
-
5
- class Growlyflash
6
- constructor: (@context) ->
7
- @flash_log = []
8
- if window.flashes?
9
- @growl window.flashes
10
- delete window.flashes
11
- # we have to bind both of ajax-complete events
12
- # sometimes one of them takes messages and they are skipping
13
- # but in mostly, they produce duplicates :(
14
- $(@context).on 'ajax:complete ajaxComplete', @ajax_complete
15
-
16
- growl: (flashes) ->
17
- for type, msg of flashes when msg?
18
- @log type: type, msg: msg
19
- $.bootstrapGrowl msg, type: $.bootstrapGrowl.defaults.type_mapping[type]
20
-
21
- log: (xmessage) -> @flash_log.push(xmessage)
22
- log_isnt_empty: -> @flash_log.length > 0
23
- purge_log: -> @flash_log = []
24
-
25
- messages: (flashes) ->
26
- { type:type, msg:msg } for type, msg of flashes
27
-
28
- ajax_complete: (e, response, settings) =>
29
- flashes = @get_x_message.call response
30
- if flashes?
31
- messages = @messages flashes
32
- # Reduce duplicates (because binded twice)
33
- @reduce_duplicates messages, =>
34
- @growl flashes
35
- # To prevent reducing similar messages on
36
- # the next event, log should flushes after
37
- window.setTimeout =>
38
- do @purge_log
39
- , 100
40
- true
41
-
42
- # Parse encoded messages
43
- get_x_message: ->
44
- encoded = @getResponseHeader 'X-Message'
45
- decoded = decodeURIComponent encoded
46
- $.parseJSON decoded if decoded?
47
-
48
- reduce_duplicates: (messages, callback) ->
49
- if @log_isnt_empty()
50
- return @purge_log() unless @get_log_matches messages
51
- do callback
52
-
53
- get_log_matches: (messages) ->
54
- last_log = @flash_log.slice -messages.length
55
- not_matches = 0
56
- not_matches++ for id, f of messages when (last_log[id].type isnt f.type) and (last_log[id].msg isnt f.msg)
57
- not_matches > 0
58
-
59
- root.Growlyflash = Growlyflash
60
-
61
- $ ->
62
- root.growly = new Growlyflash document unless root.growly