kea-rails 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kea-rails/version.rb +1 -1
  3. data/vendor/assets/components/Keypress/LICENSE +191 -0
  4. data/vendor/assets/components/Keypress/README.md +78 -0
  5. data/vendor/assets/components/Keypress/bower.json +28 -0
  6. data/vendor/assets/components/Keypress/keypress-2.1.0.min.js +33 -0
  7. data/vendor/assets/components/Keypress/keypress.coffee +921 -0
  8. data/vendor/assets/components/Keypress/keypress.js +1132 -0
  9. data/vendor/assets/components/Keypress/package.json +15 -0
  10. data/vendor/assets/components/attachejs/attache-jquery.js +47 -0
  11. data/vendor/assets/components/attachejs/attache-knockout.js +56 -0
  12. data/vendor/assets/components/attachejs/attache.css +10 -0
  13. data/vendor/assets/components/attachejs/attache.js +589 -0
  14. data/vendor/assets/components/attachejs/bower.json +36 -0
  15. data/vendor/assets/components/humane-js/bower.json +8 -0
  16. data/vendor/assets/components/humane-js/changelog.md +165 -0
  17. data/vendor/assets/components/humane-js/humane.js +238 -0
  18. data/vendor/assets/components/humane-js/humane.min.js +11 -0
  19. data/vendor/assets/components/humane-js/index.html +190 -0
  20. data/vendor/assets/components/humane-js/package.json +25 -0
  21. data/vendor/assets/components/humane-js/readme.md +85 -0
  22. data/vendor/assets/components/humane-js/test/issue23.html +11 -0
  23. data/vendor/assets/components/humane-js/test/issue36.html +9 -0
  24. data/vendor/assets/components/humane-js/test/issue38.html +15 -0
  25. data/vendor/assets/components/humane-js/test/issue49.html +9 -0
  26. data/vendor/assets/components/humane-js/theme-src/bigbox.styl +65 -0
  27. data/vendor/assets/components/humane-js/theme-src/boldlight.styl +64 -0
  28. data/vendor/assets/components/humane-js/theme-src/jackedup.styl +69 -0
  29. data/vendor/assets/components/humane-js/theme-src/libnotify.styl +61 -0
  30. data/vendor/assets/components/humane-js/theme-src/original.styl +51 -0
  31. data/vendor/assets/components/humane-js/themes/bigbox.css +123 -0
  32. data/vendor/assets/components/humane-js/themes/boldlight.css +122 -0
  33. data/vendor/assets/components/humane-js/themes/flatty.css +94 -0
  34. data/vendor/assets/components/humane-js/themes/jackedup.css +123 -0
  35. data/vendor/assets/components/humane-js/themes/libnotify.css +115 -0
  36. data/vendor/assets/components/humane-js/themes/original.css +72 -0
  37. data/vendor/assets/components/knockout-sortable/README.md +129 -0
  38. data/vendor/assets/components/knockout-sortable/bower.json +15 -0
  39. data/vendor/assets/components/knockout-sortable/build/knockout-sortable.js +358 -0
  40. data/vendor/assets/components/knockout-sortable/build/knockout-sortable.min.js +2 -0
  41. data/vendor/assets/components/uri.js/README.md +437 -0
  42. data/vendor/assets/components/uri.js/URI.jquery.json +38 -0
  43. data/vendor/assets/components/uri.js/about-uris.html +156 -0
  44. data/vendor/assets/components/uri.js/build.html +66 -0
  45. data/vendor/assets/components/uri.js/build.js +78 -0
  46. data/vendor/assets/components/uri.js/component.json +15 -0
  47. data/vendor/assets/components/uri.js/contribute.md +11 -0
  48. data/vendor/assets/components/uri.js/docs.html +1280 -0
  49. data/vendor/assets/components/uri.js/index.html +173 -0
  50. data/vendor/assets/components/uri.js/jquery-1.10.2.min.js +6 -0
  51. data/vendor/assets/components/uri.js/jquery-1.7.2.min.js +4 -0
  52. data/vendor/assets/components/uri.js/jquery-1.8.2.min.js +2 -0
  53. data/vendor/assets/components/uri.js/jquery-1.9.1.min.js +5 -0
  54. data/vendor/assets/components/uri.js/jquery-uri-plugin.html +203 -0
  55. data/vendor/assets/components/uri.js/package.json +75 -0
  56. data/vendor/assets/components/uri.js/prettify/lang-apollo.js +2 -0
  57. data/vendor/assets/components/uri.js/prettify/lang-clj.js +18 -0
  58. data/vendor/assets/components/uri.js/prettify/lang-css.js +2 -0
  59. data/vendor/assets/components/uri.js/prettify/lang-go.js +1 -0
  60. data/vendor/assets/components/uri.js/prettify/lang-hs.js +2 -0
  61. data/vendor/assets/components/uri.js/prettify/lang-lisp.js +3 -0
  62. data/vendor/assets/components/uri.js/prettify/lang-lua.js +2 -0
  63. data/vendor/assets/components/uri.js/prettify/lang-ml.js +2 -0
  64. data/vendor/assets/components/uri.js/prettify/lang-n.js +4 -0
  65. data/vendor/assets/components/uri.js/prettify/lang-proto.js +1 -0
  66. data/vendor/assets/components/uri.js/prettify/lang-scala.js +2 -0
  67. data/vendor/assets/components/uri.js/prettify/lang-sql.js +2 -0
  68. data/vendor/assets/components/uri.js/prettify/lang-tex.js +1 -0
  69. data/vendor/assets/components/uri.js/prettify/lang-vb.js +2 -0
  70. data/vendor/assets/components/uri.js/prettify/lang-vhdl.js +3 -0
  71. data/vendor/assets/components/uri.js/prettify/lang-wiki.js +2 -0
  72. data/vendor/assets/components/uri.js/prettify/lang-xq.js +3 -0
  73. data/vendor/assets/components/uri.js/prettify/lang-yaml.js +2 -0
  74. data/vendor/assets/components/uri.js/prettify/prettify.css +1 -0
  75. data/vendor/assets/components/uri.js/prettify/prettify.js +28 -0
  76. data/vendor/assets/components/uri.js/prettify/prettify.sunburst.css +52 -0
  77. data/vendor/assets/components/uri.js/screen.css +167 -0
  78. data/vendor/assets/components/uri.js/screen.js +39 -0
  79. data/vendor/assets/components/uri.js/src/IPv6.js +185 -0
  80. data/vendor/assets/components/uri.js/src/SecondLevelDomains.js +220 -0
  81. data/vendor/assets/components/uri.js/src/URI.fragmentQuery.js +103 -0
  82. data/vendor/assets/components/uri.js/src/URI.fragmentURI.js +96 -0
  83. data/vendor/assets/components/uri.js/src/URI.js +1938 -0
  84. data/vendor/assets/components/uri.js/src/URI.min.js +81 -0
  85. data/vendor/assets/components/uri.js/src/URITemplate.js +494 -0
  86. data/vendor/assets/components/uri.js/src/jquery.URI.js +232 -0
  87. data/vendor/assets/components/uri.js/src/jquery.URI.min.js +7 -0
  88. data/vendor/assets/components/uri.js/src/punycode.js +508 -0
  89. data/vendor/assets/components/uri.js/test/index.html +26 -0
  90. data/vendor/assets/components/uri.js/test/pre_libs.js +4 -0
  91. data/vendor/assets/components/uri.js/test/qunit/qunit-composite.css +13 -0
  92. data/vendor/assets/components/uri.js/test/qunit/qunit-composite.js +167 -0
  93. data/vendor/assets/components/uri.js/test/qunit/qunit.css +244 -0
  94. data/vendor/assets/components/uri.js/test/qunit/qunit.js +2212 -0
  95. data/vendor/assets/components/uri.js/test/test.URI.html +26 -0
  96. data/vendor/assets/components/uri.js/test/test.fragmentQuery.html +31 -0
  97. data/vendor/assets/components/uri.js/test/test.fragmentURI.html +31 -0
  98. data/vendor/assets/components/uri.js/test/test.jQuery-1.10.html +31 -0
  99. data/vendor/assets/components/uri.js/test/test.jQuery-1.7.html +31 -0
  100. data/vendor/assets/components/uri.js/test/test.jQuery-1.8.html +31 -0
  101. data/vendor/assets/components/uri.js/test/test.jQuery-1.9.html +31 -0
  102. data/vendor/assets/components/uri.js/test/test.js +1409 -0
  103. data/vendor/assets/components/uri.js/test/test_fragmentQuery.js +57 -0
  104. data/vendor/assets/components/uri.js/test/test_fragmentURI.js +59 -0
  105. data/vendor/assets/components/uri.js/test/test_jim.js +143 -0
  106. data/vendor/assets/components/uri.js/test/test_jquery.js +138 -0
  107. data/vendor/assets/components/uri.js/test/test_template.js +385 -0
  108. data/vendor/assets/components/uri.js/test/urls.js +1236 -0
  109. data/vendor/assets/components/uri.js/uri-template.html +234 -0
  110. data/vendor/assets/components/uri.js/utils/SLDs.php +37 -0
  111. data/vendor/assets/components/uri.js/utils/sld.js +101 -0
  112. data/vendor/assets/components/veiljs/bower.json +36 -0
  113. data/vendor/assets/components/veiljs/veil-jquery.js +47 -0
  114. data/vendor/assets/components/veiljs/veil-knockout.js +55 -0
  115. data/vendor/assets/components/veiljs/veil.js +465 -0
  116. data/vendor/assets/javascripts/fuse.js +472 -0
  117. data/vendor/assets/javascripts/jquery-ui.js +3844 -0
  118. data/vendor/assets/javascripts/knockout-3.2.0-debug.js +5299 -0
  119. data/vendor/assets/javascripts/moment.js +1902 -0
  120. data/vendor/assets/javascripts/pikaday.js +896 -0
  121. data/vendor/assets/stylesheets/pikaday.css +171 -0
  122. metadata +120 -1
@@ -0,0 +1,165 @@
1
+
2
+ 3.2.2 / 2014-12-09
3
+ ==================
4
+
5
+ * mod; User timeoutAfterMove of currentMsg [EloHg]
6
+
7
+ 3.2.1 / 2014-11-02
8
+ ==================
9
+
10
+ * mod; readme
11
+ * mod; switch to package.json scripts
12
+ * add; semi's to protect js bundling issues
13
+
14
+ 3.2.0 / 2014-03-22
15
+ ==================
16
+
17
+ * add; new theme called Flatty [msurguy]
18
+ * add; requirejs test
19
+ * fix; broken theme link
20
+ * fix; version tag in bower configuration
21
+
22
+ 3.1.0 / 2013-05-25
23
+ ==================
24
+
25
+ * removed; forceNew opt, not used
26
+ * fixed; try catch for ie8 filter issue when gradient filter used
27
+ * fixed; prevent accessing property of null/undefined objects
28
+ * fixed; appendChild of null error GH #36
29
+ * added; component.json
30
+ * added new param: timeoutAfterMove : bool. Adds additional timeout after user action before closing
31
+
32
+ 3.0.6 / 2013-01-04
33
+ ==================
34
+
35
+ * updated; modified styles for themes
36
+ * fixed; timeout of 0 not working GH #35
37
+ * fixed; font typo in jackedup.css
38
+ * added; note about amd and commonjs to readme
39
+ * added; ability to set container element when creating new humane instance
40
+
41
+ 3.0.5 / 2012-09-03
42
+ ==================
43
+
44
+ * fixed; loading humane lib after dom ready GH #30
45
+
46
+ 3.0.4 / 2012-07-21
47
+ ==================
48
+
49
+ * updated; build process
50
+ * updated; attribution, sample
51
+ * added; support Asynchronous Module Definition [tahu]
52
+ * added; make spawn actions chainable
53
+
54
+ 3.0.3 / 2012-07-06
55
+ ==================
56
+
57
+ * fixed; queued notification overwrites previous [JensRoland]
58
+ * fixed; height declaration in themes [FileTrek]
59
+
60
+ 3.0.1 / 2012-06-04
61
+ ==================
62
+
63
+ * updated; humane location in index
64
+ * fixed; notification not showing up in ie8 onload GH #23
65
+
66
+ 3.0.0 / 2012-05-07
67
+ ==================
68
+
69
+ * updated; documentation
70
+ * removed; info, success, error (use spawn instead)
71
+ * fixed; js error when no cb on remove
72
+ * fixed; flicker bug in ie9
73
+ * fixed; demo page not working in ie7,8
74
+ * added; unique instance support
75
+ * added; spawn support
76
+ * added; options per notification
77
+ * added; custom class support
78
+
79
+ 2.8.1 / 2012-04-24
80
+ ==================
81
+
82
+ * added; callback to remove function GH #22
83
+
84
+ 2.8.0 / 2012-02-21
85
+ ==================
86
+
87
+ * added; custom notifier support GH #19
88
+
89
+ 2.7.2 / 2012-02-10
90
+ ==================
91
+
92
+ * fixed; IE 7/8 display issue
93
+ * updated; docs page
94
+
95
+ 2.7.1 / 2012-01-26
96
+ ==================
97
+
98
+ * fixed; display:none humane when not in use Fixes #18
99
+ * added; exposed remove()
100
+
101
+ 2.7.0 / 2012-01-12
102
+ ==================
103
+
104
+ * updated; improved support for iOS 4+, Android 2+
105
+
106
+ 2.6.0 / 2012-01-02
107
+ ==================
108
+
109
+ * added; event support
110
+ * fixed; bug w/ transEnd firing multiple times
111
+
112
+ 2.5.0 / 2011-12-23
113
+ ==================
114
+
115
+ * removed; forceNew (breaking change), hacky solution that didn't work very well
116
+ * updated; code cleanup and refactor
117
+ * updated; using transitionend for end events instead of timeout
118
+ * added; waitForMove by type
119
+
120
+ 2.2.8 / 2011-12-22
121
+ ==================
122
+
123
+ * added; timeout and clickToClose by type
124
+
125
+ 2.2.7 / 2011-12-10
126
+ ==================
127
+
128
+ * added; ability to set the timeout to 0 (no timeout)
129
+
130
+ 2.2.6 / 2011-12-08
131
+ ==================
132
+
133
+ * added; 'original' theme
134
+
135
+ 2.2.5 / 2011-12-02
136
+ ==================
137
+
138
+ * added; click to close option
139
+
140
+ 2.2.0 / 2011-12-02
141
+ ==================
142
+
143
+ * added; callback support @OiNutter
144
+ * fixed; jackedup to support IE<9
145
+
146
+ 2.1.1 / 2011-11-28
147
+ ==================
148
+
149
+ * fixed; restore original class after completion
150
+ * added; jackedup theme
151
+ * fixed; some IE fixes
152
+
153
+ 2.1.0 / 2011-11-28
154
+ ==================
155
+
156
+ * added; stylus support, updated themes
157
+ * added; bigbox theme
158
+ * added; message types (log, info, error, success)
159
+
160
+ 2.0.0 / 2011-07-12
161
+ ==================
162
+
163
+ * mobile support for iOS / Android
164
+ * ie z-index fix
165
+ * switched to z-index instead of visibility
@@ -0,0 +1,238 @@
1
+ /**
2
+ * humane.js
3
+ * Humanized Messages for Notifications
4
+ * @author Marc Harter (@wavded)
5
+ * @example
6
+ * humane.log('hello world');
7
+ * @license MIT
8
+ * See more usage examples at: http://wavded.github.com/humane-js/
9
+ */
10
+
11
+ ;!function (name, context, definition) {
12
+ if (typeof module !== 'undefined') module.exports = definition(name, context)
13
+ else if (typeof define === 'function' && typeof define.amd === 'object') define(definition)
14
+ else context[name] = definition(name, context)
15
+ }('humane', this, function (name, context) {
16
+ var win = window
17
+ var doc = document
18
+
19
+ var ENV = {
20
+ on: function (el, type, cb) {
21
+ 'addEventListener' in win ? el.addEventListener(type,cb,false) : el.attachEvent('on'+type,cb)
22
+ },
23
+ off: function (el, type, cb) {
24
+ 'removeEventListener' in win ? el.removeEventListener(type,cb,false) : el.detachEvent('on'+type,cb)
25
+ },
26
+ bind: function (fn, ctx) {
27
+ return function () { fn.apply(ctx,arguments) }
28
+ },
29
+ isArray: Array.isArray || function (obj) { return Object.prototype.toString.call(obj) === '[object Array]' },
30
+ config: function (preferred, fallback) {
31
+ return preferred != null ? preferred : fallback
32
+ },
33
+ transSupport: false,
34
+ useFilter: /msie [678]/i.test(navigator.userAgent), // sniff, sniff
35
+ _checkTransition: function () {
36
+ var el = doc.createElement('div')
37
+ var vendors = { webkit: 'webkit', Moz: '', O: 'o', ms: 'MS' }
38
+
39
+ for (var vendor in vendors)
40
+ if (vendor + 'Transition' in el.style) {
41
+ this.vendorPrefix = vendors[vendor]
42
+ this.transSupport = true
43
+ }
44
+ }
45
+ }
46
+ ENV._checkTransition()
47
+
48
+ var Humane = function (o) {
49
+ o || (o = {})
50
+ this.queue = []
51
+ this.baseCls = o.baseCls || 'humane'
52
+ this.addnCls = o.addnCls || ''
53
+ this.timeout = 'timeout' in o ? o.timeout : 2500
54
+ this.waitForMove = o.waitForMove || false
55
+ this.clickToClose = o.clickToClose || false
56
+ this.timeoutAfterMove = o.timeoutAfterMove || false
57
+ this.container = o.container
58
+
59
+ try { this._setupEl() } // attempt to setup elements
60
+ catch (e) {
61
+ ENV.on(win,'load',ENV.bind(this._setupEl, this)) // dom wasn't ready, wait till ready
62
+ }
63
+ }
64
+
65
+ Humane.prototype = {
66
+ constructor: Humane,
67
+ _setupEl: function () {
68
+ var el = doc.createElement('div')
69
+ el.style.display = 'none'
70
+ if (!this.container){
71
+ if(doc.body) this.container = doc.body;
72
+ else throw 'document.body is null'
73
+ }
74
+ this.container.appendChild(el)
75
+ this.el = el
76
+ this.removeEvent = ENV.bind(function(){
77
+ var timeoutAfterMove = ENV.config(this.currentMsg.timeoutAfterMove,this.timeoutAfterMove)
78
+ if (!timeoutAfterMove){
79
+ this.remove()
80
+ } else {
81
+ setTimeout(ENV.bind(this.remove,this),timeoutAfterMove)
82
+ }
83
+ },this)
84
+
85
+ this.transEvent = ENV.bind(this._afterAnimation,this)
86
+ this._run()
87
+ },
88
+ _afterTimeout: function () {
89
+ if (!ENV.config(this.currentMsg.waitForMove,this.waitForMove)) this.remove()
90
+
91
+ else if (!this.removeEventsSet) {
92
+ ENV.on(doc.body,'mousemove',this.removeEvent)
93
+ ENV.on(doc.body,'click',this.removeEvent)
94
+ ENV.on(doc.body,'keypress',this.removeEvent)
95
+ ENV.on(doc.body,'touchstart',this.removeEvent)
96
+ this.removeEventsSet = true
97
+ }
98
+ },
99
+ _run: function () {
100
+ if (this._animating || !this.queue.length || !this.el) return
101
+
102
+ this._animating = true
103
+ if (this.currentTimer) {
104
+ clearTimeout(this.currentTimer)
105
+ this.currentTimer = null
106
+ }
107
+
108
+ var msg = this.queue.shift()
109
+ var clickToClose = ENV.config(msg.clickToClose,this.clickToClose)
110
+
111
+ if (clickToClose) {
112
+ ENV.on(this.el,'click',this.removeEvent)
113
+ ENV.on(this.el,'touchstart',this.removeEvent)
114
+ }
115
+
116
+ var timeout = ENV.config(msg.timeout,this.timeout)
117
+
118
+ if (timeout > 0)
119
+ this.currentTimer = setTimeout(ENV.bind(this._afterTimeout,this), timeout)
120
+
121
+ if (ENV.isArray(msg.html)) msg.html = '<ul><li>'+msg.html.join('<li>')+'</ul>'
122
+
123
+ this.el.innerHTML = msg.html
124
+ this.currentMsg = msg
125
+ this.el.className = this.baseCls
126
+ if (ENV.transSupport) {
127
+ this.el.style.display = 'block'
128
+ setTimeout(ENV.bind(this._showMsg,this),50)
129
+ } else {
130
+ this._showMsg()
131
+ }
132
+
133
+ },
134
+ _setOpacity: function (opacity) {
135
+ if (ENV.useFilter){
136
+ try{
137
+ this.el.filters.item('DXImageTransform.Microsoft.Alpha').Opacity = opacity*100
138
+ } catch(err){}
139
+ } else {
140
+ this.el.style.opacity = String(opacity)
141
+ }
142
+ },
143
+ _showMsg: function () {
144
+ var addnCls = ENV.config(this.currentMsg.addnCls,this.addnCls)
145
+ if (ENV.transSupport) {
146
+ this.el.className = this.baseCls+' '+addnCls+' '+this.baseCls+'-animate'
147
+ }
148
+ else {
149
+ var opacity = 0
150
+ this.el.className = this.baseCls+' '+addnCls+' '+this.baseCls+'-js-animate'
151
+ this._setOpacity(0) // reset value so hover states work
152
+ this.el.style.display = 'block'
153
+
154
+ var self = this
155
+ var interval = setInterval(function(){
156
+ if (opacity < 1) {
157
+ opacity += 0.1
158
+ if (opacity > 1) opacity = 1
159
+ self._setOpacity(opacity)
160
+ }
161
+ else clearInterval(interval)
162
+ }, 30)
163
+ }
164
+ },
165
+ _hideMsg: function () {
166
+ var addnCls = ENV.config(this.currentMsg.addnCls,this.addnCls)
167
+ if (ENV.transSupport) {
168
+ this.el.className = this.baseCls+' '+addnCls
169
+ ENV.on(this.el,ENV.vendorPrefix ? ENV.vendorPrefix+'TransitionEnd' : 'transitionend',this.transEvent)
170
+ }
171
+ else {
172
+ var opacity = 1
173
+ var self = this
174
+ var interval = setInterval(function(){
175
+ if(opacity > 0) {
176
+ opacity -= 0.1
177
+ if (opacity < 0) opacity = 0
178
+ self._setOpacity(opacity);
179
+ }
180
+ else {
181
+ self.el.className = self.baseCls+' '+addnCls
182
+ clearInterval(interval)
183
+ self._afterAnimation()
184
+ }
185
+ }, 30)
186
+ }
187
+ },
188
+ _afterAnimation: function () {
189
+ if (ENV.transSupport) ENV.off(this.el,ENV.vendorPrefix ? ENV.vendorPrefix+'TransitionEnd' : 'transitionend',this.transEvent)
190
+
191
+ if (this.currentMsg.cb) this.currentMsg.cb()
192
+ this.el.style.display = 'none'
193
+
194
+ this._animating = false
195
+ this._run()
196
+ },
197
+ remove: function (e) {
198
+ var cb = typeof e == 'function' ? e : null
199
+
200
+ ENV.off(doc.body,'mousemove',this.removeEvent)
201
+ ENV.off(doc.body,'click',this.removeEvent)
202
+ ENV.off(doc.body,'keypress',this.removeEvent)
203
+ ENV.off(doc.body,'touchstart',this.removeEvent)
204
+ ENV.off(this.el,'click',this.removeEvent)
205
+ ENV.off(this.el,'touchstart',this.removeEvent)
206
+ this.removeEventsSet = false
207
+
208
+ if (cb && this.currentMsg) this.currentMsg.cb = cb
209
+ if (this._animating) this._hideMsg()
210
+ else if (cb) cb()
211
+ },
212
+ log: function (html, o, cb, defaults) {
213
+ var msg = {}
214
+ if (defaults)
215
+ for (var opt in defaults)
216
+ msg[opt] = defaults[opt]
217
+
218
+ if (typeof o == 'function') cb = o
219
+ else if (o)
220
+ for (var opt in o) msg[opt] = o[opt]
221
+
222
+ msg.html = html
223
+ if (cb) msg.cb = cb
224
+ this.queue.push(msg)
225
+ this._run()
226
+ return this
227
+ },
228
+ spawn: function (defaults) {
229
+ var self = this
230
+ return function (html, o, cb) {
231
+ self.log.call(self,html,o,cb,defaults)
232
+ return self
233
+ }
234
+ },
235
+ create: function (o) { return new Humane(o) }
236
+ }
237
+ return new Humane()
238
+ });
@@ -0,0 +1,11 @@
1
+ ;
2
+ /**
3
+ * humane.js
4
+ * Humanized Messages for Notifications
5
+ * @author Marc Harter (@wavded)
6
+ * @example
7
+ * humane.log('hello world');
8
+ * @license MIT
9
+ * See more usage examples at: http://wavded.github.com/humane-js/
10
+ */
11
+ !function(name,context,definition){if(typeof module!=="undefined")module.exports=definition(name,context);else if(typeof define==="function"&&typeof define.amd==="object")define(definition);else context[name]=definition(name,context)}("humane",this,function(name,context){var win=window;var doc=document;var ENV={on:function(el,type,cb){"addEventListener"in win?el.addEventListener(type,cb,false):el.attachEvent("on"+type,cb)},off:function(el,type,cb){"removeEventListener"in win?el.removeEventListener(type,cb,false):el.detachEvent("on"+type,cb)},bind:function(fn,ctx){return function(){fn.apply(ctx,arguments)}},isArray:Array.isArray||function(obj){return Object.prototype.toString.call(obj)==="[object Array]"},config:function(preferred,fallback){return preferred!=null?preferred:fallback},transSupport:false,useFilter:/msie [678]/i.test(navigator.userAgent),_checkTransition:function(){var el=doc.createElement("div");var vendors={webkit:"webkit",Moz:"",O:"o",ms:"MS"};for(var vendor in vendors)if(vendor+"Transition"in el.style){this.vendorPrefix=vendors[vendor];this.transSupport=true}}};ENV._checkTransition();var Humane=function(o){o||(o={});this.queue=[];this.baseCls=o.baseCls||"humane";this.addnCls=o.addnCls||"";this.timeout="timeout"in o?o.timeout:2500;this.waitForMove=o.waitForMove||false;this.clickToClose=o.clickToClose||false;this.timeoutAfterMove=o.timeoutAfterMove||false;this.container=o.container;try{this._setupEl()}catch(e){ENV.on(win,"load",ENV.bind(this._setupEl,this))}};Humane.prototype={constructor:Humane,_setupEl:function(){var el=doc.createElement("div");el.style.display="none";if(!this.container){if(doc.body)this.container=doc.body;else throw"document.body is null"}this.container.appendChild(el);this.el=el;this.removeEvent=ENV.bind(function(){var timeoutAfterMove=ENV.config(this.currentMsg.timeoutAfterMove,this.timeoutAfterMove);if(!timeoutAfterMove){this.remove()}else{setTimeout(ENV.bind(this.remove,this),timeoutAfterMove)}},this);this.transEvent=ENV.bind(this._afterAnimation,this);this._run()},_afterTimeout:function(){if(!ENV.config(this.currentMsg.waitForMove,this.waitForMove))this.remove();else if(!this.removeEventsSet){ENV.on(doc.body,"mousemove",this.removeEvent);ENV.on(doc.body,"click",this.removeEvent);ENV.on(doc.body,"keypress",this.removeEvent);ENV.on(doc.body,"touchstart",this.removeEvent);this.removeEventsSet=true}},_run:function(){if(this._animating||!this.queue.length||!this.el)return;this._animating=true;if(this.currentTimer){clearTimeout(this.currentTimer);this.currentTimer=null}var msg=this.queue.shift();var clickToClose=ENV.config(msg.clickToClose,this.clickToClose);if(clickToClose){ENV.on(this.el,"click",this.removeEvent);ENV.on(this.el,"touchstart",this.removeEvent)}var timeout=ENV.config(msg.timeout,this.timeout);if(timeout>0)this.currentTimer=setTimeout(ENV.bind(this._afterTimeout,this),timeout);if(ENV.isArray(msg.html))msg.html="<ul><li>"+msg.html.join("<li>")+"</ul>";this.el.innerHTML=msg.html;this.currentMsg=msg;this.el.className=this.baseCls;if(ENV.transSupport){this.el.style.display="block";setTimeout(ENV.bind(this._showMsg,this),50)}else{this._showMsg()}},_setOpacity:function(opacity){if(ENV.useFilter){try{this.el.filters.item("DXImageTransform.Microsoft.Alpha").Opacity=opacity*100}catch(err){}}else{this.el.style.opacity=String(opacity)}},_showMsg:function(){var addnCls=ENV.config(this.currentMsg.addnCls,this.addnCls);if(ENV.transSupport){this.el.className=this.baseCls+" "+addnCls+" "+this.baseCls+"-animate"}else{var opacity=0;this.el.className=this.baseCls+" "+addnCls+" "+this.baseCls+"-js-animate";this._setOpacity(0);this.el.style.display="block";var self=this;var interval=setInterval(function(){if(opacity<1){opacity+=.1;if(opacity>1)opacity=1;self._setOpacity(opacity)}else clearInterval(interval)},30)}},_hideMsg:function(){var addnCls=ENV.config(this.currentMsg.addnCls,this.addnCls);if(ENV.transSupport){this.el.className=this.baseCls+" "+addnCls;ENV.on(this.el,ENV.vendorPrefix?ENV.vendorPrefix+"TransitionEnd":"transitionend",this.transEvent)}else{var opacity=1;var self=this;var interval=setInterval(function(){if(opacity>0){opacity-=.1;if(opacity<0)opacity=0;self._setOpacity(opacity)}else{self.el.className=self.baseCls+" "+addnCls;clearInterval(interval);self._afterAnimation()}},30)}},_afterAnimation:function(){if(ENV.transSupport)ENV.off(this.el,ENV.vendorPrefix?ENV.vendorPrefix+"TransitionEnd":"transitionend",this.transEvent);if(this.currentMsg.cb)this.currentMsg.cb();this.el.style.display="none";this._animating=false;this._run()},remove:function(e){var cb=typeof e=="function"?e:null;ENV.off(doc.body,"mousemove",this.removeEvent);ENV.off(doc.body,"click",this.removeEvent);ENV.off(doc.body,"keypress",this.removeEvent);ENV.off(doc.body,"touchstart",this.removeEvent);ENV.off(this.el,"click",this.removeEvent);ENV.off(this.el,"touchstart",this.removeEvent);this.removeEventsSet=false;if(cb&&this.currentMsg)this.currentMsg.cb=cb;if(this._animating)this._hideMsg();else if(cb)cb()},log:function(html,o,cb,defaults){var msg={};if(defaults)for(var opt in defaults)msg[opt]=defaults[opt];if(typeof o=="function")cb=o;else if(o)for(var opt in o)msg[opt]=o[opt];msg.html=html;if(cb)msg.cb=cb;this.queue.push(msg);this._run();return this},spawn:function(defaults){var self=this;return function(html,o,cb){self.log.call(self,html,o,cb,defaults);return self}},create:function(o){return new Humane(o)}};return new Humane});
@@ -0,0 +1,190 @@
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
+ <link rel='stylesheet' href='themes/flatty.css'/>
70
+
71
+ <script src='humane.js'></script>
72
+ </head>
73
+ <body>
74
+ <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>
75
+
76
+ <h1>humane.js</h1>
77
+ <p>
78
+ <strong>A simple, modern, framework-independent, well-tested, unobtrusive, notification system.</strong>
79
+ <br/>Utilizes CSS transitions when available, falls back to JS animation when not. Includes mobile support.
80
+ </p>
81
+ <h3>Select a theme:
82
+ <select onchange='humane.baseCls="humane-"+this.options[this.selectedIndex].value'>
83
+ <option selected>libnotify</option>
84
+ <option>bigbox</option>
85
+ <option>boldlight</option>
86
+ <option>jackedup</option>
87
+ <option>original</option>
88
+ <option>flatty</option>
89
+ </select>
90
+ </h3>
91
+ <p>Click a code sample below to see it in action:</p>
92
+
93
+ <pre>humane.log("Welcome Back")</pre>
94
+ <pre>humane.log("Record <b>392</b> has been updated")</pre>
95
+ <pre>humane.log(["List","of","Items"])</pre>
96
+ <pre>humane.log("Callback when finished", function(){ document.body.style.backgroundColor="#a66000" })</pre>
97
+ <pre>humane.log("Options can be passed", { timeout: 4000, clickToClose: true, addnCls: 'humane-error' })</pre>
98
+
99
+ <h3>Options</h3>
100
+ <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>
101
+ <pre>humane.timeout = 5000 // default: 2500</pre>
102
+ <blockquote>
103
+ <p>Sets the delay before a message fades out (set to <b>0</b> for no timeout).</p>
104
+ </blockquote>
105
+ <pre>humane.waitForMove = true // default: false</pre>
106
+ <blockquote>
107
+ <p>Wait for mouse, keyboard, or touch action to be taken before clearing message (after timeout)</p>
108
+ </blockquote>
109
+ <pre>humane.clickToClose = true // default: false</pre>
110
+ <blockquote>
111
+ <p>Click or touch the notification to close</p>
112
+ </blockquote>
113
+ <pre>humane.timeoutAfterMove = 2000 // default: 0</pre>
114
+ <blockquote>
115
+ <p>Delay before notification disappears (useful in conjunction with waitForMove)</p>
116
+ </blockquote>
117
+ <pre>humane.addnCls = 'humane-info' // default: ''</pre>
118
+ <blockquote>
119
+ <p>Specify an additional class to apply when notifying (nice when you only want to change just a little bit of the style)</p>
120
+ </blockquote>
121
+ <h3>Create instances with humane.create</h3>
122
+ <p>Create a completely new instance of humane using <b>humane.create()</b>.</p>
123
+ <pre>
124
+ var notify = humane.create({ timeout: 4000, baseCls: 'humane-bigbox' })
125
+ notify.log('Custom Notifier')</pre>
126
+
127
+ <p>There are a options that can also be applied when creating an instance:</p>
128
+ <pre>humane.baseCls = 'humane' // default: 'humane'</pre>
129
+ <blockquote>
130
+ <p>Specify an base class</p>
131
+ </blockquote>
132
+
133
+ <h3>Spawn notifiers with humane.spawn</h3>
134
+ <p>Create a custom notifier using <b>humane.spawn()</b>.</p>
135
+ <pre>
136
+ humane.info = humane.spawn({ addnCls: 'humane-libnotify-info', timeout: 1000 })
137
+ humane.info('Info Themed Notifier')</pre>
138
+ <pre>
139
+ humane.error = humane.spawn({ addnCls: 'humane-libnotify-error', timeout: 1000 })
140
+ humane.error('Error Themed Notifier')</pre>
141
+
142
+ <h3>Force remove current notification</h3>
143
+ <pre>humane.remove(function(){ alert('removed') })</pre>
144
+ <blockquote>
145
+ <p>Force remove current notification, takes an optional callback fired when finished (note each instance has its own remove)</p>
146
+ </blockquote>
147
+
148
+ <h3>Go crazy</h3>
149
+ <p>With all this power, you are bound to go CRAZY! Click the sample below to go crazy:</p>
150
+ <pre>
151
+ var bigbox = humane.create({baseCls: 'humane-bigbox', timeout: 1000})
152
+ bigbox.error = bigbox.spawn({addnCls: 'humane-bigbox-error'})
153
+ bigbox.log('Oh!').error('No!')
154
+
155
+ var libnotify = humane.create({baseCls: 'humane-libnotify', addnCls: 'humane-libnotify-info'})
156
+ libnotify.log('Notified')
157
+
158
+ var jacked = humane.create({baseCls: 'humane-jackedup', addnCls: 'humane-jackedup-success'})
159
+ jacked.log("What's up here!")</pre>
160
+
161
+ <h3>Browser Support</h3>
162
+ <p>Uses CSS Transitions where available otherwise falls back to JS animation, degrades gracefully.</p>
163
+ <ul>
164
+ <li>Internet Explorer 7+</li>
165
+ <li>Firefox 3+</li>
166
+ <li>Chrome 9+</li>
167
+ <li>Safari 3+</li>
168
+ <li>Opera 10+</li>
169
+ <li>iOS 4+</li>
170
+ <li>Android 2+</li>
171
+ </ul>
172
+
173
+ <h3>Create A Custom Theme</h3>
174
+ <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>
175
+
176
+
177
+ <h3>Download and Usage</h3>
178
+ <p>Visit <a href='http://github.com/wavded/humane-js'>github page</a> to download and get more details.</p>
179
+
180
+ <script>
181
+ humane.baseCls = 'humane-libnotify'
182
+ var pretags = document.getElementsByTagName('pre')
183
+ for (var i = 0; i < pretags.length; i++) { (function(el){
184
+ el.onclick = function () {
185
+ eval(el.innerHTML)
186
+ }
187
+ }(pretags[i])) }
188
+ </script>
189
+ </body>
190
+ </html>
@@ -0,0 +1,25 @@
1
+ {
2
+ "author": "Marc Harter <@wavded> (wavded.com)",
3
+ "name": "humane-js",
4
+ "description": "A simple, modern, browser notification system",
5
+ "version": "3.2.2",
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
+ "scripts": {
13
+ "watch": "stylus -u nib -w theme-src/*.styl -o themes/",
14
+ "minify": "uglifyjs --comments --preamble=\";\" humane.js > humane.min.js",
15
+ "serve": "python -m SimpleHTTPServer"
16
+ },
17
+ "engines": {},
18
+ "dependencies": {},
19
+ "devDependencies": {
20
+ "canvas": "1.0.2",
21
+ "nib": "^1.0.3",
22
+ "stylus": "^0.47.3",
23
+ "uglify-js": "^2.4.15"
24
+ }
25
+ }