humane-rails 5.0.1 → 5.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmI0NzAwYjFlOTU3ZGUwOGM5MzlhZjMxYjExOTRmMzQ4NTBmM2MwZQ==
4
+ MDg2ZTMxNGQ4YjI0Yzc5NWQ5NzU5YWUyZjFiMTU3YjQyNTBjZjI1Yw==
5
5
  data.tar.gz: !binary |-
6
- YjU5NmQwYWY3OTc0MDQxNmRkMWVlOTcyY2M0MmE3MzViZTY2NGY1Zg==
6
+ YjhjNTM1MzM1MjQ3NzkwMDc2NDU0ZGE5M2NkOWRiMDk0YjU2Y2U0Ng==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDlkMTU2MWJkNmUxNDJiOGQ5Mjk5NmY0NjJlODkwM2VjMTg2YzFiNzY4M2Rh
10
- MDBjZjliNmE1M2NmNDUzNTNlMzgzNDI3ZTU1NmVhMzY0MDhlZmY1YjdiNTI1
11
- YTg2YWZmYzhkYTVkYTRlN2Y5M2M4NjAxMTI4NGFjMzc3YTczMzk=
9
+ NTY0YmNiNzQ3OGI1NTg2OGFkOTI0YTg4NzMwZDdiODljNzA5Njg4YTc1ODMz
10
+ MWVmMDczNjM3ZTA1MjRiMWE1ZjdmNGQxZGYzZTlkMjRjODEwNjBkNTg4MTZi
11
+ YTMzMjJhNzRiY2YwZjg4NGM0MDgyZjMzOWMwZjhhMWI4N2RmNzA=
12
12
  data.tar.gz: !binary |-
13
- NTRkYWQ3Njk3ODc1OGM4Y2Y2MzZmZDY4NTQ3ZTQzODBkMjFlNTdmNGI0NDNh
14
- MmRiMTI1ZTY4ZTk4YmM1YTc1Y2VhOGQ3ZWEyOWZhNmU4ZGZlYTgzODA0Mjhh
15
- ZTNhYTg5OTBmNzBlN2I0MDg2ODI0YjY3OGNkMTZmZWM4NDNjMzc=
13
+ M2NjNmI2MjhjMWNlZjAyZDBlYjZhMDQ5ZmMzNDk5ZDk0OGZiNjVmMWNmMTZl
14
+ ZDhmNGEyYWI1OWUwNDQxOGI5MjQxZmExNjYwZmQ0MzNjNDI5NDYzMDBhNmNl
15
+ YThlY2YwZGZiZDAyYThjNTUyMmUwMDQ0ZGRiZTNmMmJmN2UwYWU=
data/humane-rails.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.description = %q{A gemified version of Marc Harter's humane-js.}
13
13
  s.license = "MIT"
14
14
 
15
- s.files = Dir["{app,lib}/**/*", "Rakefile", "README.md", "humane-rails.gemspec"]
15
+ s.files = Dir["{app,lib,vendor}/**/*", "humane-rails.gemspec", "Rakefile", "README.md"]
16
16
  s.test_files = Dir["spec/**/*"]
17
17
 
18
18
  s.add_dependency "rails", ">= 3.1.0"
@@ -1,3 +1,3 @@
1
1
  module HumaneRails
2
- VERSION = "5.0.1"
2
+ VERSION = "5.0.2"
3
3
  end
@@ -0,0 +1,7 @@
1
+ project=humane
2
+
3
+ watch:
4
+ @node_modules/.bin/stylus -u nib -w theme-src/*.styl -o themes/
5
+
6
+ build:
7
+ @node_modules/.bin/uglifyjs humane.js -m -c -v > humane.min.js
@@ -0,0 +1,145 @@
1
+
2
+ 3.1.0 / 2013-05-25
3
+ ==================
4
+
5
+ * removed; forceNew opt, not used
6
+ * fixed; try catch for ie8 filter issue when gradient filter used
7
+ * fixed; prevent accessing property of null/undefined objects
8
+ * fixed; appendChild of null error GH #36
9
+ * added; component.json
10
+ * added new param: timeoutAfterMove : bool. Adds additional timeout after user action before closing
11
+
12
+ 3.0.6 / 2013-01-04
13
+ ==================
14
+
15
+ * updated; modified styles for themes
16
+ * fixed; timeout of 0 not working GH #35
17
+ * fixed; font typo in jackedup.css
18
+ * added; note about amd and commonjs to readme
19
+ * added; ability to set container element when creating new humane instance
20
+
21
+ 3.0.5 / 2012-09-03
22
+ ==================
23
+
24
+ * fixed; loading humane lib after dom ready GH #30
25
+
26
+ 3.0.4 / 2012-07-21
27
+ ==================
28
+
29
+ * updated; build process
30
+ * updated; attribution, sample
31
+ * added; support Asynchronous Module Definition [tahu]
32
+ * added; make spawn actions chainable
33
+
34
+ 3.0.3 / 2012-07-06
35
+ ==================
36
+
37
+ * fixed; queued notification overwrites previous [JensRoland]
38
+ * fixed; height declaration in themes [FileTrek]
39
+
40
+ 3.0.1 / 2012-06-04
41
+ ==================
42
+
43
+ * updated; humane location in index
44
+ * fixed; notification not showing up in ie8 onload GH #23
45
+
46
+ 3.0.0 / 2012-05-07
47
+ ==================
48
+
49
+ * updated; documentation
50
+ * removed; info, success, error (use spawn instead)
51
+ * fixed; js error when no cb on remove
52
+ * fixed; flicker bug in ie9
53
+ * fixed; demo page not working in ie7,8
54
+ * added; unique instance support
55
+ * added; spawn support
56
+ * added; options per notification
57
+ * added; custom class support
58
+
59
+ 2.8.1 / 2012-04-24
60
+ ==================
61
+
62
+ * added; callback to remove function GH #22
63
+
64
+ 2.8.0 / 2012-02-21
65
+ ==================
66
+
67
+ * added; custom notifier support GH #19
68
+
69
+ 2.7.2 / 2012-02-10
70
+ ==================
71
+
72
+ * fixed; IE 7/8 display issue
73
+ * updated; docs page
74
+
75
+ 2.7.1 / 2012-01-26
76
+ ==================
77
+
78
+ * fixed; display:none humane when not in use Fixes #18
79
+ * added; exposed remove()
80
+
81
+ 2.7.0 / 2012-01-12
82
+ ==================
83
+
84
+ * updated; improved support for iOS 4+, Android 2+
85
+
86
+ 2.6.0 / 2012-01-02
87
+ ==================
88
+
89
+ * added; event support
90
+ * fixed; bug w/ transEnd firing multiple times
91
+
92
+ 2.5.0 / 2011-12-23
93
+ ==================
94
+
95
+ * removed; forceNew (breaking change), hacky solution that didn't work very well
96
+ * updated; code cleanup and refactor
97
+ * updated; using transitionend for end events instead of timeout
98
+ * added; waitForMove by type
99
+
100
+ 2.2.8 / 2011-12-22
101
+ ==================
102
+
103
+ * added; timeout and clickToClose by type
104
+
105
+ 2.2.7 / 2011-12-10
106
+ ==================
107
+
108
+ * added; ability to set the timeout to 0 (no timeout)
109
+
110
+ 2.2.6 / 2011-12-08
111
+ ==================
112
+
113
+ * added; 'original' theme
114
+
115
+ 2.2.5 / 2011-12-02
116
+ ==================
117
+
118
+ * added; click to close option
119
+
120
+ 2.2.0 / 2011-12-02
121
+ ==================
122
+
123
+ * added; callback support @OiNutter
124
+ * fixed; jackedup to support IE<9
125
+
126
+ 2.1.1 / 2011-11-28
127
+ ==================
128
+
129
+ * fixed; restore original class after completion
130
+ * added; jackedup theme
131
+ * fixed; some IE fixes
132
+
133
+ 2.1.0 / 2011-11-28
134
+ ==================
135
+
136
+ * added; stylus support, updated themes
137
+ * added; bigbox theme
138
+ * added; message types (log, info, error, success)
139
+
140
+ 2.0.0 / 2011-07-12
141
+ ==================
142
+
143
+ * mobile support for iOS / Android
144
+ * ie z-index fix
145
+ * switched to z-index instead of visibility
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "humane-js",
3
+ "version": "3.0.6",
4
+ "author": "Marc Harter <@wavded> (wavded.com)",
5
+ "description": "A simple, modern, browser notification system",
6
+ "keywords": [ "notification", "alert" ]
7
+ }
@@ -0,0 +1,229 @@
1
+ /**
2
+ * humane.js
3
+ * Humanized Messages for Notifications
4
+ * @author Marc Harter (@wavded)
5
+ * @example
6
+ * humane.log('hello world');
7
+ * See more usage examples at: http://wavded.github.com/humane-js/
8
+ */
9
+
10
+ ;!function (name, context, definition) {
11
+ if (typeof module !== 'undefined') module.exports = definition(name, context)
12
+ else if (typeof define === 'function' && typeof define.amd === 'object') define(definition)
13
+ else context[name] = definition(name, context)
14
+ }('humane', this, function (name, context) {
15
+ var win = window
16
+ var doc = document
17
+
18
+ var ENV = {
19
+ on: function (el, type, cb) {
20
+ 'addEventListener' in win ? el.addEventListener(type,cb,false) : el.attachEvent('on'+type,cb)
21
+ },
22
+ off: function (el, type, cb) {
23
+ 'removeEventListener' in win ? el.removeEventListener(type,cb,false) : el.detachEvent('on'+type,cb)
24
+ },
25
+ bind: function (fn, ctx) {
26
+ return function () { fn.apply(ctx,arguments) }
27
+ },
28
+ isArray: Array.isArray || function (obj) { return Object.prototype.toString.call(obj) === '[object Array]' },
29
+ config: function (preferred, fallback) {
30
+ return preferred != null ? preferred : fallback
31
+ },
32
+ transSupport: false,
33
+ useFilter: /msie [678]/i.test(navigator.userAgent), // sniff, sniff
34
+ _checkTransition: function () {
35
+ var el = doc.createElement('div')
36
+ var vendors = { webkit: 'webkit', Moz: '', O: 'o', ms: 'MS' }
37
+
38
+ for (var vendor in vendors)
39
+ if (vendor + 'Transition' in el.style) {
40
+ this.vendorPrefix = vendors[vendor]
41
+ this.transSupport = true
42
+ }
43
+ }
44
+ }
45
+ ENV._checkTransition()
46
+
47
+ var Humane = function (o) {
48
+ o || (o = {})
49
+ this.queue = []
50
+ this.baseCls = o.baseCls || 'humane'
51
+ this.addnCls = o.addnCls || ''
52
+ this.timeout = 'timeout' in o ? o.timeout : 2500
53
+ this.waitForMove = o.waitForMove || false
54
+ this.clickToClose = o.clickToClose || false
55
+ this.timeoutAfterMove = o.timeoutAfterMove || false
56
+ this.container = o.container
57
+
58
+ try { this._setupEl() } // attempt to setup elements
59
+ catch (e) {
60
+ ENV.on(win,'load',ENV.bind(this._setupEl, this)) // dom wasn't ready, wait till ready
61
+ }
62
+ }
63
+
64
+ Humane.prototype = {
65
+ constructor: Humane,
66
+ _setupEl: function () {
67
+ var el = doc.createElement('div')
68
+ el.style.display = 'none'
69
+ if (!this.container){
70
+ if(doc.body) this.container = doc.body;
71
+ else throw 'document.body is null'
72
+ }
73
+ this.container.appendChild(el)
74
+ this.el = el
75
+ this.removeEvent = ENV.bind(function(){ if (!this.timeoutAfterMove){this.remove()} else {setTimeout(ENV.bind(this.remove,this),this.timeout);}},this)
76
+ this.transEvent = ENV.bind(this._afterAnimation,this)
77
+ this._run()
78
+ },
79
+ _afterTimeout: function () {
80
+ if (!ENV.config(this.currentMsg.waitForMove,this.waitForMove)) this.remove()
81
+
82
+ else if (!this.removeEventsSet) {
83
+ ENV.on(doc.body,'mousemove',this.removeEvent)
84
+ ENV.on(doc.body,'click',this.removeEvent)
85
+ ENV.on(doc.body,'keypress',this.removeEvent)
86
+ ENV.on(doc.body,'touchstart',this.removeEvent)
87
+ this.removeEventsSet = true
88
+ }
89
+ },
90
+ _run: function () {
91
+ if (this._animating || !this.queue.length || !this.el) return
92
+
93
+ this._animating = true
94
+ if (this.currentTimer) {
95
+ clearTimeout(this.currentTimer)
96
+ this.currentTimer = null
97
+ }
98
+
99
+ var msg = this.queue.shift()
100
+ var clickToClose = ENV.config(msg.clickToClose,this.clickToClose)
101
+
102
+ if (clickToClose) {
103
+ ENV.on(this.el,'click',this.removeEvent)
104
+ ENV.on(this.el,'touchstart',this.removeEvent)
105
+ }
106
+
107
+ var timeout = ENV.config(msg.timeout,this.timeout)
108
+
109
+ if (timeout > 0)
110
+ this.currentTimer = setTimeout(ENV.bind(this._afterTimeout,this), timeout)
111
+
112
+ if (ENV.isArray(msg.html)) msg.html = '<ul><li>'+msg.html.join('<li>')+'</ul>'
113
+
114
+ this.el.innerHTML = msg.html
115
+ this.currentMsg = msg
116
+ this.el.className = this.baseCls
117
+ if (ENV.transSupport) {
118
+ this.el.style.display = 'block'
119
+ setTimeout(ENV.bind(this._showMsg,this),50)
120
+ } else {
121
+ this._showMsg()
122
+ }
123
+
124
+ },
125
+ _setOpacity: function (opacity) {
126
+ if (ENV.useFilter){
127
+ try{
128
+ this.el.filters.item('DXImageTransform.Microsoft.Alpha').Opacity = opacity*100
129
+ } catch(err){}
130
+ } else {
131
+ this.el.style.opacity = String(opacity)
132
+ }
133
+ },
134
+ _showMsg: function () {
135
+ var addnCls = ENV.config(this.currentMsg.addnCls,this.addnCls)
136
+ if (ENV.transSupport) {
137
+ this.el.className = this.baseCls+' '+addnCls+' '+this.baseCls+'-animate'
138
+ }
139
+ else {
140
+ var opacity = 0
141
+ this.el.className = this.baseCls+' '+addnCls+' '+this.baseCls+'-js-animate'
142
+ this._setOpacity(0) // reset value so hover states work
143
+ this.el.style.display = 'block'
144
+
145
+ var self = this
146
+ var interval = setInterval(function(){
147
+ if (opacity < 1) {
148
+ opacity += 0.1
149
+ if (opacity > 1) opacity = 1
150
+ self._setOpacity(opacity)
151
+ }
152
+ else clearInterval(interval)
153
+ }, 30)
154
+ }
155
+ },
156
+ _hideMsg: function () {
157
+ var addnCls = ENV.config(this.currentMsg.addnCls,this.addnCls)
158
+ if (ENV.transSupport) {
159
+ this.el.className = this.baseCls+' '+addnCls
160
+ ENV.on(this.el,ENV.vendorPrefix ? ENV.vendorPrefix+'TransitionEnd' : 'transitionend',this.transEvent)
161
+ }
162
+ else {
163
+ var opacity = 1
164
+ var self = this
165
+ var interval = setInterval(function(){
166
+ if(opacity > 0) {
167
+ opacity -= 0.1
168
+ if (opacity < 0) opacity = 0
169
+ self._setOpacity(opacity);
170
+ }
171
+ else {
172
+ self.el.className = self.baseCls+' '+addnCls
173
+ clearInterval(interval)
174
+ self._afterAnimation()
175
+ }
176
+ }, 30)
177
+ }
178
+ },
179
+ _afterAnimation: function () {
180
+ if (ENV.transSupport) ENV.off(this.el,ENV.vendorPrefix ? ENV.vendorPrefix+'TransitionEnd' : 'transitionend',this.transEvent)
181
+
182
+ if (this.currentMsg.cb) this.currentMsg.cb()
183
+ this.el.style.display = 'none'
184
+
185
+ this._animating = false
186
+ this._run()
187
+ },
188
+ remove: function (e) {
189
+ var cb = typeof e == 'function' ? e : null
190
+
191
+ ENV.off(doc.body,'mousemove',this.removeEvent)
192
+ ENV.off(doc.body,'click',this.removeEvent)
193
+ ENV.off(doc.body,'keypress',this.removeEvent)
194
+ ENV.off(doc.body,'touchstart',this.removeEvent)
195
+ ENV.off(this.el,'click',this.removeEvent)
196
+ ENV.off(this.el,'touchstart',this.removeEvent)
197
+ this.removeEventsSet = false
198
+
199
+ if (cb && this.currentMsg) this.currentMsg.cb = cb
200
+ if (this._animating) this._hideMsg()
201
+ else if (cb) cb()
202
+ },
203
+ log: function (html, o, cb, defaults) {
204
+ var msg = {}
205
+ if (defaults)
206
+ for (var opt in defaults)
207
+ msg[opt] = defaults[opt]
208
+
209
+ if (typeof o == 'function') cb = o
210
+ else if (o)
211
+ for (var opt in o) msg[opt] = o[opt]
212
+
213
+ msg.html = html
214
+ if (cb) msg.cb = cb
215
+ this.queue.push(msg)
216
+ this._run()
217
+ return this
218
+ },
219
+ spawn: function (defaults) {
220
+ var self = this
221
+ return function (html, o, cb) {
222
+ self.log.call(self,html,o,cb,defaults)
223
+ return self
224
+ }
225
+ },
226
+ create: function (o) { return new Humane(o) }
227
+ }
228
+ return new Humane()
229
+ })
@@ -0,0 +1 @@
1
+ !function(t,e,i){"undefined"!=typeof module?module.exports=i(t,e):"function"==typeof define&&"object"==typeof define.amd?define(i):e[t]=i(t,e)}("humane",this,function(){var t=window,e=document,i={on:function(e,i,n){"addEventListener"in t?e.addEventListener(i,n,!1):e.attachEvent("on"+i,n)},off:function(e,i,n){"removeEventListener"in t?e.removeEventListener(i,n,!1):e.detachEvent("on"+i,n)},bind:function(t,e){return function(){t.apply(e,arguments)}},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},config:function(t,e){return null!=t?t:e},transSupport:!1,useFilter:/msie [678]/i.test(navigator.userAgent),_checkTransition:function(){var t=e.createElement("div"),i={webkit:"webkit",Moz:"",O:"o",ms:"MS"};for(var n in i)n+"Transition"in t.style&&(this.vendorPrefix=i[n],this.transSupport=!0)}};i._checkTransition();var n=function(e){e||(e={}),this.queue=[],this.baseCls=e.baseCls||"humane",this.addnCls=e.addnCls||"",this.timeout="timeout"in e?e.timeout:2500,this.waitForMove=e.waitForMove||!1,this.clickToClose=e.clickToClose||!1,this.timeoutAfterMove=e.timeoutAfterMove||!1,this.container=e.container;try{this._setupEl()}catch(n){i.on(t,"load",i.bind(this._setupEl,this))}};return n.prototype={constructor:n,_setupEl:function(){var t=e.createElement("div");if(t.style.display="none",!this.container){if(!e.body)throw"document.body is null";this.container=e.body}this.container.appendChild(t),this.el=t,this.removeEvent=i.bind(function(){this.timeoutAfterMove?setTimeout(i.bind(this.remove,this),this.timeout):this.remove()},this),this.transEvent=i.bind(this._afterAnimation,this),this._run()},_afterTimeout:function(){i.config(this.currentMsg.waitForMove,this.waitForMove)?this.removeEventsSet||(i.on(e.body,"mousemove",this.removeEvent),i.on(e.body,"click",this.removeEvent),i.on(e.body,"keypress",this.removeEvent),i.on(e.body,"touchstart",this.removeEvent),this.removeEventsSet=!0):this.remove()},_run:function(){if(!this._animating&&this.queue.length&&this.el){this._animating=!0,this.currentTimer&&(clearTimeout(this.currentTimer),this.currentTimer=null);var t=this.queue.shift(),e=i.config(t.clickToClose,this.clickToClose);e&&(i.on(this.el,"click",this.removeEvent),i.on(this.el,"touchstart",this.removeEvent));var n=i.config(t.timeout,this.timeout);n>0&&(this.currentTimer=setTimeout(i.bind(this._afterTimeout,this),n)),i.isArray(t.html)&&(t.html="<ul><li>"+t.html.join("<li>")+"</ul>"),this.el.innerHTML=t.html,this.currentMsg=t,this.el.className=this.baseCls,i.transSupport?(this.el.style.display="block",setTimeout(i.bind(this._showMsg,this),50)):this._showMsg()}},_setOpacity:function(t){if(i.useFilter)try{this.el.filters.item("DXImageTransform.Microsoft.Alpha").Opacity=100*t}catch(e){}else this.el.style.opacity=String(t)},_showMsg:function(){var t=i.config(this.currentMsg.addnCls,this.addnCls);if(i.transSupport)this.el.className=this.baseCls+" "+t+" "+this.baseCls+"-animate";else{var e=0;this.el.className=this.baseCls+" "+t+" "+this.baseCls+"-js-animate",this._setOpacity(0),this.el.style.display="block";var n=this,s=setInterval(function(){1>e?(e+=.1,e>1&&(e=1),n._setOpacity(e)):clearInterval(s)},30)}},_hideMsg:function(){var t=i.config(this.currentMsg.addnCls,this.addnCls);if(i.transSupport)this.el.className=this.baseCls+" "+t,i.on(this.el,i.vendorPrefix?i.vendorPrefix+"TransitionEnd":"transitionend",this.transEvent);else var e=1,n=this,s=setInterval(function(){e>0?(e-=.1,0>e&&(e=0),n._setOpacity(e)):(n.el.className=n.baseCls+" "+t,clearInterval(s),n._afterAnimation())},30)},_afterAnimation:function(){i.transSupport&&i.off(this.el,i.vendorPrefix?i.vendorPrefix+"TransitionEnd":"transitionend",this.transEvent),this.currentMsg.cb&&this.currentMsg.cb(),this.el.style.display="none",this._animating=!1,this._run()},remove:function(t){var n="function"==typeof t?t:null;i.off(e.body,"mousemove",this.removeEvent),i.off(e.body,"click",this.removeEvent),i.off(e.body,"keypress",this.removeEvent),i.off(e.body,"touchstart",this.removeEvent),i.off(this.el,"click",this.removeEvent),i.off(this.el,"touchstart",this.removeEvent),this.removeEventsSet=!1,n&&this.currentMsg&&(this.currentMsg.cb=n),this._animating?this._hideMsg():n&&n()},log:function(t,e,i,n){var s={};if(n)for(var o in n)s[o]=n[o];if("function"==typeof e)i=e;else if(e)for(var o in e)s[o]=e[o];return s.html=t,i&&(s.cb=i),this.queue.push(s),this._run(),this},spawn:function(t){var e=this;return function(i,n,s){return e.log.call(e,i,n,s,t),e}},create:function(t){return new n(t)}},new n});
@@ -0,0 +1,187 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>humane.js</title>
5
+ <meta http-equiv="X-UA-Compatible" content="IE=Edge">
6
+ <meta charset='utf-8'>
7
+ <link href='http://fonts.googleapis.com/css?family=Ubuntu&v2' rel='stylesheet' type='text/css'>
8
+ <link href='http://fonts.googleapis.com/css?family=Ubuntu+Mono' rel='stylesheet' type='text/css'>
9
+ <link href='http://fonts.googleapis.com/css?family=Cabin+Sketch:700&v2' rel='stylesheet' type='text/css'>
10
+ <style>
11
+ body {
12
+ font-family: Ubuntu, sans-serif;
13
+ padding: 80px;
14
+ background-color: #60D6A7;
15
+ }
16
+ h1,h3 {
17
+ font-family: 'Cabin Sketch', serif;
18
+ text-shadow: -1px 0px 1px #aaa;
19
+ }
20
+ h1 {
21
+ font-size: 4em;
22
+ margin: 0
23
+ }
24
+ h3 {
25
+ font-size: 2em;
26
+ margin: 0
27
+ }
28
+ select {
29
+ font-size: 0.8em;
30
+ }
31
+ a {
32
+ text-decoration: none;
33
+ color: #a13;
34
+ font-weight: bold;
35
+ }
36
+ a:hover {
37
+ text-decoration: underline;
38
+ }
39
+ pre {
40
+ font-family: "Ubuntu Mono";
41
+ font-size: 0.9em;
42
+ width: 75%;
43
+ background-color: #007143;
44
+ border-radius: 6px;
45
+ padding: 5px 10px;
46
+ color: #fff;
47
+ cursor: pointer;
48
+ text-shadow: -1px 1px 1px #333;
49
+ box-shadow: 0px 8px 8px -8px #333;
50
+ -moz-transition: all 0.3s ease-out;
51
+ -webkit-transition: all 0.3s ease-out;
52
+ -ms-transition: all 0.3s ease-out;
53
+ -o-transition: all 0.3s ease-out;
54
+ transition: all 0.3s ease-out;
55
+ }
56
+ pre:hover {
57
+ background-color: #00ae68;
58
+ }
59
+ blockquote {
60
+ font-size: 0.8em
61
+ }
62
+ </style>
63
+ <meta http-equiv="X-UA-Compatible" content="IE=Edge">
64
+ <link rel='stylesheet' href='themes/bigbox.css'/>
65
+ <link rel='stylesheet' href='themes/boldlight.css'/>
66
+ <link rel='stylesheet' href='themes/jackedup.css'/>
67
+ <link rel='stylesheet' href='themes/libnotify.css'/>
68
+ <link rel='stylesheet' href='themes/original.css'/>
69
+ <script src='humane.js'></script>
70
+ </head>
71
+ <body>
72
+ <a href="http://github.com/wavded/humane-js"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
73
+
74
+ <h1>humane.js</h1>
75
+ <p>
76
+ <strong>A simple, modern, framework-independent, well-tested, unobtrusive, notification system.</strong>
77
+ <br/>Utilizes CSS transitions when available, falls back to JS animation when not. Includes mobile support.
78
+ </p>
79
+ <h3>Select a theme:
80
+ <select onchange='humane.baseCls="humane-"+this.options[this.selectedIndex].value'>
81
+ <option selected>libnotify</option>
82
+ <option>bigbox</option>
83
+ <option>boldlight</option>
84
+ <option>jackedup</option>
85
+ <option>original</option>
86
+ </select>
87
+ </h3>
88
+ <p>Click a code sample below to see it in action:</p>
89
+
90
+ <pre>humane.log("Welcome Back")</pre>
91
+ <pre>humane.log("Record <b>392</b> has been updated")</pre>
92
+ <pre>humane.log(["List","of","Items"])</pre>
93
+ <pre>humane.log("Callback when finished", function(){ document.body.style.backgroundColor="#a66000" })</pre>
94
+ <pre>humane.log("Options can be passed", { timeout: 4000, clickToClose: true, addnCls: 'humane-error' })</pre>
95
+
96
+ <h3>Options</h3>
97
+ <p>Options can be specified in a variety of ways. Either by the entire instance as shown below, or per notification, as shown above:</p>
98
+ <pre>humane.timeout = 5000 // default: 2500</pre>
99
+ <blockquote>
100
+ <p>Sets the delay before a message fades out (set to <b>0</b> for no timeout).</p>
101
+ </blockquote>
102
+ <pre>humane.waitForMove = true // default: false</pre>
103
+ <blockquote>
104
+ <p>Wait for mouse, keyboard, or touch action to be taken before clearing message (after timeout)</p>
105
+ </blockquote>
106
+ <pre>humane.clickToClose = true // default: false</pre>
107
+ <blockquote>
108
+ <p>Click or touch the notification to close</p>
109
+ </blockquote>
110
+ <pre>humane.timeoutAfterMove = 2000 // default: 0</pre>
111
+ <blockquote>
112
+ <p>Delay before notification disappears (useful in conjunction with waitForMove)</p>
113
+ </blockquote>
114
+ <pre>humane.addnCls = 'humane-info' // default: ''</pre>
115
+ <blockquote>
116
+ <p>Specify an additional class to apply when notifying (nice when you only want to change just a little bit of the style)</p>
117
+ </blockquote>
118
+ <h3>Create instances with humane.create</h3>
119
+ <p>Create a completely new instance of humane using <b>humane.create()</b>.</p>
120
+ <pre>
121
+ var notify = humane.create({ timeout: 4000, baseCls: 'humane-bigbox' })
122
+ notify.log('Custom Notifier')</pre>
123
+
124
+ <p>There are a options that can also be applied when creating an instance:</p>
125
+ <pre>humane.baseCls = 'humane' // default: 'humane'</pre>
126
+ <blockquote>
127
+ <p>Specify an base class</p>
128
+ </blockquote>
129
+
130
+ <h3>Spawn notifiers with humane.spawn</h3>
131
+ <p>Create a custom notifier using <b>humane.spawn()</b>.</p>
132
+ <pre>
133
+ humane.info = humane.spawn({ addnCls: 'humane-libnotify-info', timeout: 1000 })
134
+ humane.info('Info Themed Notifier')</pre>
135
+ <pre>
136
+ humane.error = humane.spawn({ addnCls: 'humane-libnotify-error', timeout: 1000 })
137
+ humane.error('Error Themed Notifier')</pre>
138
+
139
+ <h3>Force remove current notification</h3>
140
+ <pre>humane.remove(function(){ alert('removed') })</pre>
141
+ <blockquote>
142
+ <p>Force remove current notification, takes an optional callback fired when finished (note each instance has its own remove)</p>
143
+ </blockquote>
144
+
145
+ <h3>Go crazy</h3>
146
+ <p>With all this power, you are bound to go CRAZY! Click the sample below to go crazy:</p>
147
+ <pre>
148
+ var bigbox = humane.create({baseCls: 'humane-bigbox', timeout: 1000})
149
+ bigbox.error = bigbox.spawn({addnCls: 'humane-bigbox-error'})
150
+ bigbox.log('Oh!').error('No!')
151
+
152
+ var libnotify = humane.create({baseCls: 'humane-libnotify', addnCls: 'humane-libnotify-info'})
153
+ libnotify.log('Notified')
154
+
155
+ var jacked = humane.create({baseCls: 'humane-jackedup', addnCls: 'humane-jackedup-success'})
156
+ jacked.log("What's up here!")</pre>
157
+
158
+ <h3>Browser Support</h3>
159
+ <p>Uses CSS Transitions where available otherwise falls back to JS animation, degrades gracefully.</p>
160
+ <ul>
161
+ <li>Internet Explorer 7+</li>
162
+ <li>Firefox 3+</li>
163
+ <li>Chrome 9+</li>
164
+ <li>Safari 3+</li>
165
+ <li>Opera 10+</li>
166
+ <li>iOS 4+</li>
167
+ <li>Android 2+</li>
168
+ </ul>
169
+
170
+ <h3>Create A Custom Theme</h3>
171
+ <p>Humane is easily themable using <a href="http://learnboost.github.com/stylus">Stylus</a>. There are currently a few <a href='https://github.com/wavded/humane-js/wiki/Themes'>themes</a>, but I hope this grows. Send me a pull request and update the wiki with your favorite look and feel.</p>
172
+
173
+
174
+ <h3>Download and Usage</h3>
175
+ <p>Visit <a href='http://github.com/wavded/humane-js'>github page</a> to download and get more details.</p>
176
+
177
+ <script>
178
+ humane.baseCls = 'humane-libnotify'
179
+ var pretags = document.getElementsByTagName('pre')
180
+ for (var i = 0; i < pretags.length; i++) { (function(el){
181
+ el.onclick = function () {
182
+ eval(el.innerHTML)
183
+ }
184
+ }(pretags[i])) }
185
+ </script>
186
+ </body>
187
+ </html>
@@ -0,0 +1,20 @@
1
+ {
2
+ "author": "Marc Harter <@wavded> (wavded.com)",
3
+ "name": "humane-js",
4
+ "description": "A simple, modern, browser notification system",
5
+ "version": "3.1.0",
6
+ "homepage": "http://wavded.github.com/humane-js/",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git://github.com/wavded/humane-js.git"
10
+ },
11
+ "main": "humane.js",
12
+ "engines": {},
13
+ "dependencies": {},
14
+ "devDependencies": {
15
+ "uglify-js": "2.3.6",
16
+ "nib": "0.9.1",
17
+ "stylus": "0.32.1",
18
+ "canvas": "1.0.2"
19
+ }
20
+ }