volt-semantic-ui 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -0
  3. data/Gemfile +0 -0
  4. data/LICENSE.txt +0 -0
  5. data/README.md +0 -0
  6. data/Rakefile +0 -0
  7. data/app/semanticui/assets/css/semantic.min.css +3 -3
  8. data/app/semanticui/assets/css/themes/basic/assets/fonts/icons.eot +0 -0
  9. data/app/semanticui/assets/css/themes/basic/assets/fonts/icons.svg +0 -0
  10. data/app/semanticui/assets/css/themes/basic/assets/fonts/icons.ttf +0 -0
  11. data/app/semanticui/assets/css/themes/basic/assets/fonts/icons.woff +0 -0
  12. data/app/semanticui/assets/css/themes/default/assets/fonts/icons.eot +0 -0
  13. data/app/semanticui/assets/css/themes/default/assets/fonts/icons.otf +0 -0
  14. data/app/semanticui/assets/css/themes/default/assets/fonts/icons.svg +526 -465
  15. data/app/semanticui/assets/css/themes/default/assets/fonts/icons.ttf +0 -0
  16. data/app/semanticui/assets/css/themes/default/assets/fonts/icons.woff +0 -0
  17. data/app/semanticui/assets/css/themes/default/assets/fonts/icons.woff2 +0 -0
  18. data/app/semanticui/assets/css/themes/default/assets/images/flags.png +0 -0
  19. data/app/semanticui/assets/js/components/accordion.css +256 -0
  20. data/app/semanticui/assets/js/components/accordion.js +578 -0
  21. data/app/semanticui/assets/js/components/accordion.min.css +10 -0
  22. data/app/semanticui/assets/js/components/accordion.min.js +11 -0
  23. data/app/semanticui/assets/js/components/ad.css +276 -0
  24. data/app/semanticui/assets/js/components/ad.min.css +10 -0
  25. data/app/semanticui/assets/js/components/api.js +871 -0
  26. data/app/semanticui/assets/js/components/api.min.js +11 -0
  27. data/app/semanticui/assets/js/components/breadcrumb.css +124 -0
  28. data/app/semanticui/assets/js/components/breadcrumb.min.css +10 -0
  29. data/app/semanticui/assets/js/components/button.css +2391 -0
  30. data/app/semanticui/assets/js/components/button.min.css +10 -0
  31. data/app/semanticui/assets/js/components/card.css +909 -0
  32. data/app/semanticui/assets/js/components/card.min.css +10 -0
  33. data/app/semanticui/assets/js/components/checkbox.css +513 -0
  34. data/app/semanticui/assets/js/components/checkbox.js +509 -0
  35. data/app/semanticui/assets/js/components/checkbox.min.css +10 -0
  36. data/app/semanticui/assets/js/components/checkbox.min.js +11 -0
  37. data/app/semanticui/assets/js/components/comment.css +259 -0
  38. data/app/semanticui/assets/js/components/comment.min.css +10 -0
  39. data/app/semanticui/assets/js/components/dimmer.css +186 -0
  40. data/app/semanticui/assets/js/components/dimmer.js +669 -0
  41. data/app/semanticui/assets/js/components/dimmer.min.css +10 -0
  42. data/app/semanticui/assets/js/components/dimmer.min.js +11 -0
  43. data/app/semanticui/assets/js/components/divider.css +241 -0
  44. data/app/semanticui/assets/js/components/divider.min.css +10 -0
  45. data/app/semanticui/assets/js/components/dropdown.css +1103 -0
  46. data/app/semanticui/assets/js/components/dropdown.js +1795 -0
  47. data/app/semanticui/assets/js/components/dropdown.min.css +10 -0
  48. data/app/semanticui/assets/js/components/dropdown.min.js +11 -0
  49. data/app/semanticui/assets/js/components/feed.css +276 -0
  50. data/app/semanticui/assets/js/components/feed.min.css +10 -0
  51. data/app/semanticui/assets/js/components/flag.css +1024 -0
  52. data/app/semanticui/assets/js/components/flag.min.css +10 -0
  53. data/app/semanticui/assets/js/components/form.css +891 -0
  54. data/app/semanticui/assets/js/components/form.js +1118 -0
  55. data/app/semanticui/assets/js/components/form.min.css +10 -0
  56. data/app/semanticui/assets/js/components/form.min.js +11 -0
  57. data/app/semanticui/assets/js/components/grid.css +1871 -0
  58. data/app/semanticui/assets/js/components/grid.min.css +10 -0
  59. data/app/semanticui/assets/js/components/header.css +596 -0
  60. data/app/semanticui/assets/js/components/header.min.css +10 -0
  61. data/app/semanticui/assets/js/components/icon.css +2467 -0
  62. data/app/semanticui/assets/js/components/icon.min.css +10 -0
  63. data/app/semanticui/assets/js/components/image.css +288 -0
  64. data/app/semanticui/assets/js/components/image.min.css +10 -0
  65. data/app/semanticui/assets/js/components/input.css +439 -0
  66. data/app/semanticui/assets/js/components/input.min.css +10 -0
  67. data/app/semanticui/assets/js/components/item.css +456 -0
  68. data/app/semanticui/assets/js/components/item.min.css +10 -0
  69. data/app/semanticui/assets/js/components/label.css +963 -0
  70. data/app/semanticui/assets/js/components/label.min.css +10 -0
  71. data/app/semanticui/assets/js/components/list.css +878 -0
  72. data/app/semanticui/assets/js/components/list.min.css +10 -0
  73. data/app/semanticui/assets/js/components/loader.css +284 -0
  74. data/app/semanticui/assets/js/components/loader.min.css +10 -0
  75. data/app/semanticui/assets/js/components/menu.css +1608 -0
  76. data/app/semanticui/assets/js/components/menu.min.css +10 -0
  77. data/app/semanticui/assets/js/components/message.css +421 -0
  78. data/app/semanticui/assets/js/components/message.min.css +10 -0
  79. data/app/semanticui/assets/js/components/modal.css +432 -0
  80. data/app/semanticui/assets/js/components/modal.js +860 -0
  81. data/app/semanticui/assets/js/components/modal.min.css +10 -0
  82. data/app/semanticui/assets/js/components/modal.min.js +11 -0
  83. data/app/semanticui/assets/js/components/nag.css +148 -0
  84. data/app/semanticui/assets/js/components/nag.js +477 -0
  85. data/app/semanticui/assets/js/components/nag.min.css +10 -0
  86. data/app/semanticui/assets/js/components/nag.min.js +11 -0
  87. data/app/semanticui/assets/js/components/popup.css +293 -0
  88. data/app/semanticui/assets/js/components/popup.js +1224 -0
  89. data/app/semanticui/assets/js/components/popup.min.css +10 -0
  90. data/app/semanticui/assets/js/components/popup.min.js +11 -0
  91. data/app/semanticui/assets/js/components/progress.css +461 -0
  92. data/app/semanticui/assets/js/components/progress.js +785 -0
  93. data/app/semanticui/assets/js/components/progress.min.css +10 -0
  94. data/app/semanticui/assets/js/components/progress.min.js +11 -0
  95. data/app/semanticui/assets/js/components/rail.css +124 -0
  96. data/app/semanticui/assets/js/components/rail.min.css +10 -0
  97. data/app/semanticui/assets/js/components/rating.css +251 -0
  98. data/app/semanticui/assets/js/components/rating.js +451 -0
  99. data/app/semanticui/assets/js/components/rating.min.css +10 -0
  100. data/app/semanticui/assets/js/components/rating.min.js +11 -0
  101. data/app/semanticui/assets/js/components/reset.css +429 -0
  102. data/app/semanticui/assets/js/components/reset.min.css +10 -0
  103. data/app/semanticui/assets/js/components/reveal.css +293 -0
  104. data/app/semanticui/assets/js/components/reveal.min.css +10 -0
  105. data/app/semanticui/assets/js/components/search.css +329 -0
  106. data/app/semanticui/assets/js/components/search.js +1096 -0
  107. data/app/semanticui/assets/js/components/search.min.css +10 -0
  108. data/app/semanticui/assets/js/components/search.min.js +11 -0
  109. data/app/semanticui/assets/js/components/segment.css +635 -0
  110. data/app/semanticui/assets/js/components/segment.min.css +10 -0
  111. data/app/semanticui/assets/js/components/shape.css +154 -0
  112. data/app/semanticui/assets/js/components/shape.js +830 -0
  113. data/app/semanticui/assets/js/components/shape.min.css +10 -0
  114. data/app/semanticui/assets/js/components/shape.min.js +11 -0
  115. data/app/semanticui/assets/js/components/sidebar.css +625 -0
  116. data/app/semanticui/assets/js/components/sidebar.js +1089 -0
  117. data/app/semanticui/assets/js/components/sidebar.min.css +10 -0
  118. data/app/semanticui/assets/js/components/sidebar.min.js +11 -0
  119. data/app/semanticui/assets/js/components/site.css +160 -0
  120. data/app/semanticui/assets/js/components/site.js +487 -0
  121. data/app/semanticui/assets/js/components/site.min.css +10 -0
  122. data/app/semanticui/assets/js/components/site.min.js +11 -0
  123. data/app/semanticui/assets/js/components/state.js +695 -0
  124. data/app/semanticui/assets/js/components/state.min.js +11 -0
  125. data/app/semanticui/assets/js/components/statistic.css +409 -0
  126. data/app/semanticui/assets/js/components/statistic.min.css +10 -0
  127. data/app/semanticui/assets/js/components/step.css +432 -0
  128. data/app/semanticui/assets/js/components/step.min.css +10 -0
  129. data/app/semanticui/assets/js/components/sticky.css +79 -0
  130. data/app/semanticui/assets/js/components/sticky.js +792 -0
  131. data/app/semanticui/assets/js/components/sticky.min.css +10 -0
  132. data/app/semanticui/assets/js/components/sticky.min.js +11 -0
  133. data/app/semanticui/assets/js/components/tab.css +92 -0
  134. data/app/semanticui/assets/js/components/tab.js +802 -0
  135. data/app/semanticui/assets/js/components/tab.min.css +10 -0
  136. data/app/semanticui/assets/js/components/tab.min.js +11 -0
  137. data/app/semanticui/assets/js/components/table.css +1000 -0
  138. data/app/semanticui/assets/js/components/table.min.css +10 -0
  139. data/app/semanticui/assets/js/components/transition.css +1990 -0
  140. data/app/semanticui/assets/js/components/transition.js +1038 -0
  141. data/app/semanticui/assets/js/components/transition.min.css +10 -0
  142. data/app/semanticui/assets/js/components/transition.min.js +11 -0
  143. data/app/semanticui/assets/js/components/video.css +125 -0
  144. data/app/semanticui/assets/js/components/video.js +540 -0
  145. data/app/semanticui/assets/js/components/video.min.css +10 -0
  146. data/app/semanticui/assets/js/components/video.min.js +11 -0
  147. data/app/semanticui/assets/js/components/visibility.js +1032 -0
  148. data/app/semanticui/assets/js/components/visibility.min.js +11 -0
  149. data/app/semanticui/assets/js/semantic.min.js +9 -9
  150. data/lib/volt/semanticui.rb +0 -0
  151. data/lib/volt/semanticui/version.rb +1 -1
  152. data/volt-semantic-ui-0.0.1.gem +0 -0
  153. data/volt-semanticui-0.0.1.gem +0 -0
  154. data/volt-semanticui.gemspec +0 -0
  155. metadata +141 -10
@@ -0,0 +1,10 @@
1
+ @import 'https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin';/*!
2
+ * # Semantic UI - Site
3
+ * http://github.com/semantic-org/semantic-ui/
4
+ *
5
+ *
6
+ * Copyright 2014 Contributors
7
+ * Released under the MIT license
8
+ * http://opensource.org/licenses/MIT
9
+ *
10
+ */body,html{height:100%}html{font-size:14px}body{margin:0;padding:0;min-width:320px;background:#f7f7f7;font-family:Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;font-size:14px;line-height:1.33;color:rgba(0,0,0,.8);font-smoothing:antialiased}h1,h2,h3,h4,h5{font-family:Lato,'Helvetica Neue',Arial,Helvetica,sans-serif;line-height:1.33em;margin:-webkit-calc(2rem - .165em) 0 1rem;margin:calc(2rem - .165em) 0 1rem;font-weight:700;padding:0}h1{min-height:1rem;font-size:2rem}h2{font-size:1.714rem}h3{font-size:1.28rem}h4{font-size:1.071rem}h5{font-size:1rem}h1:first-child,h2:first-child,h3:first-child,h4:first-child,h5:first-child{margin-top:0}h1:last-child,h2:last-child,h3:last-child,h4:last-child,h5:last-child{margin-bottom:0}p{margin:0 0 1em;line-height:1.33}p:first-child{margin-top:0}p:last-child{margin-bottom:0}a{color:#009fda;text-decoration:none}a:hover{color:#00b2f3}::-webkit-selection{background-color:#cce2ff;color:rgba(0,0,0,.8)}::-moz-selection{background-color:#cce2ff;color:rgba(0,0,0,.8)}::selection{background-color:#cce2ff;color:rgba(0,0,0,.8)}input::-webkit-selection,textarea::-webkit-selection{background-color:rgba(100,100,100,.4);color:rgba(0,0,0,.8)}input::-moz-selection,textarea::-moz-selection{background-color:rgba(100,100,100,.4);color:rgba(0,0,0,.8)}input::selection,textarea::selection{background-color:rgba(100,100,100,.4);color:rgba(0,0,0,.8)}
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * # Semantic UI 1.11.4 - Site
3
+ * http://github.com/semantic-org/semantic-ui/
4
+ *
5
+ *
6
+ * Copyright 2014 Contributors
7
+ * Released under the MIT license
8
+ * http://opensource.org/licenses/MIT
9
+ *
10
+ */
11
+ !function(e,n,o,i){e.site=e.fn.site=function(t){var s,r,a=(new Date).getTime(),c=[],u=arguments[0],l="string"==typeof u,m=[].slice.call(arguments,1),d=e.isPlainObject(t)?e.extend(!0,{},e.site.settings,t):e.extend({},e.site.settings),f=d.namespace,g=d.error,b="module-"+f,p=e(o),v=p,h=this,y=v.data(b);return s={initialize:function(){s.instantiate()},instantiate:function(){s.verbose("Storing instance of site",s),y=s,v.data(b,s)},normalize:function(){s.fix.console(),s.fix.requestAnimationFrame()},fix:{console:function(){s.debug("Normalizing window.console"),(console===i||console.log===i)&&(s.verbose("Console not available, normalizing events"),s.disable.console()),("undefined"==typeof console.group||"undefined"==typeof console.groupEnd||"undefined"==typeof console.groupCollapsed)&&(s.verbose("Console group not available, normalizing events"),n.console.group=function(){},n.console.groupEnd=function(){},n.console.groupCollapsed=function(){}),"undefined"==typeof console.markTimeline&&(s.verbose("Mark timeline not available, normalizing events"),n.console.markTimeline=function(){})},consoleClear:function(){s.debug("Disabling programmatic console clearing"),n.console.clear=function(){}},requestAnimationFrame:function(){s.debug("Normalizing requestAnimationFrame"),n.requestAnimationFrame===i&&(s.debug("RequestAnimationFrame not available, normailizing event"),n.requestAnimationFrame=n.requestAnimationFrame||n.mozRequestAnimationFrame||n.webkitRequestAnimationFrame||n.msRequestAnimationFrame||function(e){setTimeout(e,0)})}},moduleExists:function(n){return e.fn[n]!==i&&e.fn[n].settings!==i},enabled:{modules:function(n){var o=[];return n=n||d.modules,e.each(n,function(e,n){s.moduleExists(n)&&o.push(n)}),o}},disabled:{modules:function(n){var o=[];return n=n||d.modules,e.each(n,function(e,n){s.moduleExists(n)||o.push(n)}),o}},change:{setting:function(n,o,t,r){t="string"==typeof t?"all"===t?d.modules:[t]:t||d.modules,r=r!==i?r:!0,e.each(t,function(i,t){var a,c=s.moduleExists(t)?e.fn[t].settings.namespace||!1:!0;s.moduleExists(t)&&(s.verbose("Changing default setting",n,o,t),e.fn[t].settings[n]=o,r&&c&&(a=e(":data(module-"+c+")"),a.length>0&&(s.verbose("Modifying existing settings",a),a[t]("setting",n,o))))})},settings:function(n,o,t){o="string"==typeof o?[o]:o||d.modules,t=t!==i?t:!0,e.each(o,function(o,i){var r;s.moduleExists(i)&&(s.verbose("Changing default setting",n,i),e.extend(!0,e.fn[i].settings,n),t&&f&&(r=e(":data(module-"+f+")"),r.length>0&&(s.verbose("Modifying existing settings",r),r[i]("setting",n))))})}},enable:{console:function(){s.console(!0)},debug:function(e,n){e=e||d.modules,s.debug("Enabling debug for modules",e),s.change.setting("debug",!0,e,n)},verbose:function(e,n){e=e||d.modules,s.debug("Enabling verbose debug for modules",e),s.change.setting("verbose",!0,e,n)}},disable:{console:function(){s.console(!1)},debug:function(e,n){e=e||d.modules,s.debug("Disabling debug for modules",e),s.change.setting("debug",!1,e,n)},verbose:function(e,n){e=e||d.modules,s.debug("Disabling verbose debug for modules",e),s.change.setting("verbose",!1,e,n)}},console:function(e){if(e){if(y.cache.console===i)return void s.error(g.console);s.debug("Restoring console function"),n.console=y.cache.console}else s.debug("Disabling console function"),y.cache.console=n.console,n.console={clear:function(){},error:function(){},group:function(){},groupCollapsed:function(){},groupEnd:function(){},info:function(){},log:function(){},markTimeline:function(){},warn:function(){}}},destroy:function(){s.verbose("Destroying previous site for",v),v.removeData(b)},cache:{},setting:function(n,o){if(e.isPlainObject(n))e.extend(!0,d,n);else{if(o===i)return d[n];d[n]=o}},internal:function(n,o){if(e.isPlainObject(n))e.extend(!0,s,n);else{if(o===i)return s[n];s[n]=o}},debug:function(){d.debug&&(d.performance?s.performance.log(arguments):(s.debug=Function.prototype.bind.call(console.info,console,d.name+":"),s.debug.apply(console,arguments)))},verbose:function(){d.verbose&&d.debug&&(d.performance?s.performance.log(arguments):(s.verbose=Function.prototype.bind.call(console.info,console,d.name+":"),s.verbose.apply(console,arguments)))},error:function(){s.error=Function.prototype.bind.call(console.error,console,d.name+":"),s.error.apply(console,arguments)},performance:{log:function(e){var n,o,i;d.performance&&(n=(new Date).getTime(),i=a||n,o=n-i,a=n,c.push({Element:h,Name:e[0],Arguments:[].slice.call(e,1)||"","Execution Time":o})),clearTimeout(s.performance.timer),s.performance.timer=setTimeout(s.performance.display,100)},display:function(){var n=d.name+":",o=0;a=!1,clearTimeout(s.performance.timer),e.each(c,function(e,n){o+=n["Execution Time"]}),n+=" "+o+"ms",(console.group!==i||console.table!==i)&&c.length>0&&(console.groupCollapsed(n),console.table?console.table(c):e.each(c,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),c=[]}},invoke:function(n,o,t){var a,c,u,l=y;return o=o||m,t=h||t,"string"==typeof n&&l!==i&&(n=n.split(/[\. ]/),a=n.length-1,e.each(n,function(o,t){var r=o!=a?t+n[o+1].charAt(0).toUpperCase()+n[o+1].slice(1):n;if(e.isPlainObject(l[r])&&o!=a)l=l[r];else{if(l[r]!==i)return c=l[r],!1;if(!e.isPlainObject(l[t])||o==a)return l[t]!==i?(c=l[t],!1):(s.error(g.method,n),!1);l=l[t]}})),e.isFunction(c)?u=c.apply(t,o):c!==i&&(u=c),e.isArray(r)?r.push(u):r!==i?r=[r,u]:u!==i&&(r=u),c}},l?(y===i&&s.initialize(),s.invoke(u)):(y!==i&&s.destroy(),s.initialize()),r!==i?r:this},e.site.settings={name:"Site",namespace:"site",error:{console:"Console cannot be restored, most likely it was overwritten outside of module",method:"The method you called is not defined."},debug:!1,verbose:!0,performance:!0,modules:["accordion","api","checkbox","dimmer","dropdown","form","modal","nag","popup","rating","shape","sidebar","state","sticky","tab","transition","video","visit","visibility"],siteNamespace:"site",namespaceStub:{cache:{},config:{},sections:{},section:{},utilities:{}}},e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(n){return function(o){return!!e.data(o,n)}}):function(n,o,i){return!!e.data(n,i[3])}})}(jQuery,window,document);
@@ -0,0 +1,695 @@
1
+ /*!
2
+ * # Semantic UI 1.11.4 - State
3
+ * http://github.com/semantic-org/semantic-ui/
4
+ *
5
+ *
6
+ * Copyright 2014 Contributors
7
+ * Released under the MIT license
8
+ * http://opensource.org/licenses/MIT
9
+ *
10
+ */
11
+
12
+ ;(function ( $, window, document, undefined ) {
13
+
14
+ "use strict";
15
+
16
+ $.fn.state = function(parameters) {
17
+ var
18
+ $allModules = $(this),
19
+
20
+ moduleSelector = $allModules.selector || '',
21
+
22
+ hasTouch = ('ontouchstart' in document.documentElement),
23
+ time = new Date().getTime(),
24
+ performance = [],
25
+
26
+ query = arguments[0],
27
+ methodInvoked = (typeof query == 'string'),
28
+ queryArguments = [].slice.call(arguments, 1),
29
+
30
+ returnedValue
31
+ ;
32
+ $allModules
33
+ .each(function() {
34
+ var
35
+ settings = ( $.isPlainObject(parameters) )
36
+ ? $.extend(true, {}, $.fn.state.settings, parameters)
37
+ : $.extend({}, $.fn.state.settings),
38
+
39
+ error = settings.error,
40
+ metadata = settings.metadata,
41
+ className = settings.className,
42
+ namespace = settings.namespace,
43
+ states = settings.states,
44
+ text = settings.text,
45
+
46
+ eventNamespace = '.' + namespace,
47
+ moduleNamespace = namespace + '-module',
48
+
49
+ $module = $(this),
50
+
51
+ element = this,
52
+ instance = $module.data(moduleNamespace),
53
+
54
+ module
55
+ ;
56
+ module = {
57
+
58
+ initialize: function() {
59
+ module.verbose('Initializing module');
60
+
61
+ // allow module to guess desired state based on element
62
+ if(settings.automatic) {
63
+ module.add.defaults();
64
+ }
65
+
66
+ // bind events with delegated events
67
+ if(settings.context && moduleSelector !== '') {
68
+ $(settings.context)
69
+ .on(moduleSelector, 'mouseenter' + eventNamespace, module.change.text)
70
+ .on(moduleSelector, 'mouseleave' + eventNamespace, module.reset.text)
71
+ .on(moduleSelector, 'click' + eventNamespace, module.toggle.state)
72
+ ;
73
+ }
74
+ else {
75
+ $module
76
+ .on('mouseenter' + eventNamespace, module.change.text)
77
+ .on('mouseleave' + eventNamespace, module.reset.text)
78
+ .on('click' + eventNamespace, module.toggle.state)
79
+ ;
80
+ }
81
+ module.instantiate();
82
+ },
83
+
84
+ instantiate: function() {
85
+ module.verbose('Storing instance of module', module);
86
+ instance = module;
87
+ $module
88
+ .data(moduleNamespace, module)
89
+ ;
90
+ },
91
+
92
+ destroy: function() {
93
+ module.verbose('Destroying previous module', instance);
94
+ $module
95
+ .off(eventNamespace)
96
+ .removeData(moduleNamespace)
97
+ ;
98
+ },
99
+
100
+ refresh: function() {
101
+ module.verbose('Refreshing selector cache');
102
+ $module = $(element);
103
+ },
104
+
105
+ add: {
106
+ defaults: function() {
107
+ var
108
+ userStates = parameters && $.isPlainObject(parameters.states)
109
+ ? parameters.states
110
+ : {}
111
+ ;
112
+ $.each(settings.defaults, function(type, typeStates) {
113
+ if( module.is[type] !== undefined && module.is[type]() ) {
114
+ module.verbose('Adding default states', type, element);
115
+ $.extend(settings.states, typeStates, userStates);
116
+ }
117
+ });
118
+ }
119
+ },
120
+
121
+ is: {
122
+
123
+ active: function() {
124
+ return $module.hasClass(className.active);
125
+ },
126
+ loading: function() {
127
+ return $module.hasClass(className.loading);
128
+ },
129
+ inactive: function() {
130
+ return !( $module.hasClass(className.active) );
131
+ },
132
+ state: function(state) {
133
+ if(className[state] === undefined) {
134
+ return false;
135
+ }
136
+ return $module.hasClass( className[state] );
137
+ },
138
+
139
+ enabled: function() {
140
+ return !( $module.is(settings.filter.active) );
141
+ },
142
+ disabled: function() {
143
+ return ( $module.is(settings.filter.active) );
144
+ },
145
+ textEnabled: function() {
146
+ return !( $module.is(settings.filter.text) );
147
+ },
148
+
149
+ // definitions for automatic type detection
150
+ button: function() {
151
+ return $module.is('.button:not(a, .submit)');
152
+ },
153
+ input: function() {
154
+ return $module.is('input');
155
+ },
156
+ progress: function() {
157
+ return $module.is('.ui.progress');
158
+ }
159
+ },
160
+
161
+ allow: function(state) {
162
+ module.debug('Now allowing state', state);
163
+ states[state] = true;
164
+ },
165
+ disallow: function(state) {
166
+ module.debug('No longer allowing', state);
167
+ states[state] = false;
168
+ },
169
+
170
+ allows: function(state) {
171
+ return states[state] || false;
172
+ },
173
+
174
+ enable: function() {
175
+ $module.removeClass(className.disabled);
176
+ },
177
+
178
+ disable: function() {
179
+ $module.addClass(className.disabled);
180
+ },
181
+
182
+ setState: function(state) {
183
+ if(module.allows(state)) {
184
+ $module.addClass( className[state] );
185
+ }
186
+ },
187
+
188
+ removeState: function(state) {
189
+ if(module.allows(state)) {
190
+ $module.removeClass( className[state] );
191
+ }
192
+ },
193
+
194
+ toggle: {
195
+ state: function() {
196
+ var
197
+ apiRequest,
198
+ requestCancelled
199
+ ;
200
+ if( module.allows('active') && module.is.enabled() ) {
201
+ module.refresh();
202
+ if($.fn.api !== undefined) {
203
+ apiRequest = $module.api('get request');
204
+ requestCancelled = $module.api('was cancelled');
205
+ if( requestCancelled ) {
206
+ module.debug('API Request cancelled by beforesend');
207
+ settings.activateTest = function(){ return false; };
208
+ settings.deactivateTest = function(){ return false; };
209
+ }
210
+ else if(apiRequest) {
211
+ module.listenTo(apiRequest);
212
+ return;
213
+ }
214
+ }
215
+ module.change.state();
216
+ }
217
+ }
218
+ },
219
+
220
+ listenTo: function(apiRequest) {
221
+ module.debug('API request detected, waiting for state signal', apiRequest);
222
+ if(apiRequest) {
223
+ if(text.loading) {
224
+ module.update.text(text.loading);
225
+ }
226
+ $.when(apiRequest)
227
+ .then(function() {
228
+ if(apiRequest.state() == 'resolved') {
229
+ module.debug('API request succeeded');
230
+ settings.activateTest = function(){ return true; };
231
+ settings.deactivateTest = function(){ return true; };
232
+ }
233
+ else {
234
+ module.debug('API request failed');
235
+ settings.activateTest = function(){ return false; };
236
+ settings.deactivateTest = function(){ return false; };
237
+ }
238
+ module.change.state();
239
+ })
240
+ ;
241
+ }
242
+ },
243
+
244
+ // checks whether active/inactive state can be given
245
+ change: {
246
+
247
+ state: function() {
248
+ module.debug('Determining state change direction');
249
+ // inactive to active change
250
+ if( module.is.inactive() ) {
251
+ module.activate();
252
+ }
253
+ else {
254
+ module.deactivate();
255
+ }
256
+ if(settings.sync) {
257
+ module.sync();
258
+ }
259
+ settings.onChange.call(element);
260
+ },
261
+
262
+ text: function() {
263
+ if( module.is.textEnabled() ) {
264
+ if(module.is.disabled() ) {
265
+ module.verbose('Changing text to disabled text', text.hover);
266
+ module.update.text(text.disabled);
267
+ }
268
+ else if( module.is.active() ) {
269
+ if(text.hover) {
270
+ module.verbose('Changing text to hover text', text.hover);
271
+ module.update.text(text.hover);
272
+ }
273
+ else if(text.deactivate) {
274
+ module.verbose('Changing text to deactivating text', text.deactivate);
275
+ module.update.text(text.deactivate);
276
+ }
277
+ }
278
+ else {
279
+ if(text.hover) {
280
+ module.verbose('Changing text to hover text', text.hover);
281
+ module.update.text(text.hover);
282
+ }
283
+ else if(text.activate){
284
+ module.verbose('Changing text to activating text', text.activate);
285
+ module.update.text(text.activate);
286
+ }
287
+ }
288
+ }
289
+ }
290
+
291
+ },
292
+
293
+ activate: function() {
294
+ if( settings.activateTest.call(element) ) {
295
+ module.debug('Setting state to active');
296
+ $module
297
+ .addClass(className.active)
298
+ ;
299
+ module.update.text(text.active);
300
+ settings.onActivate.call(element);
301
+ }
302
+ },
303
+
304
+ deactivate: function() {
305
+ if( settings.deactivateTest.call(element) ) {
306
+ module.debug('Setting state to inactive');
307
+ $module
308
+ .removeClass(className.active)
309
+ ;
310
+ module.update.text(text.inactive);
311
+ settings.onDeactivate.call(element);
312
+ }
313
+ },
314
+
315
+ sync: function() {
316
+ module.verbose('Syncing other buttons to current state');
317
+ if( module.is.active() ) {
318
+ $allModules
319
+ .not($module)
320
+ .state('activate');
321
+ }
322
+ else {
323
+ $allModules
324
+ .not($module)
325
+ .state('deactivate')
326
+ ;
327
+ }
328
+ },
329
+
330
+ get: {
331
+ text: function() {
332
+ return (settings.selector.text)
333
+ ? $module.find(settings.selector.text).text()
334
+ : $module.html()
335
+ ;
336
+ },
337
+ textFor: function(state) {
338
+ return text[state] || false;
339
+ }
340
+ },
341
+
342
+ flash: {
343
+ text: function(text, duration, callback) {
344
+ var
345
+ previousText = module.get.text()
346
+ ;
347
+ module.debug('Flashing text message', text, duration);
348
+ text = text || settings.text.flash;
349
+ duration = duration || settings.flashDuration;
350
+ callback = callback || function() {};
351
+ module.update.text(text);
352
+ setTimeout(function(){
353
+ module.update.text(previousText);
354
+ callback.call(element);
355
+ }, duration);
356
+ }
357
+ },
358
+
359
+ reset: {
360
+ // on mouseout sets text to previous value
361
+ text: function() {
362
+ var
363
+ activeText = text.active || $module.data(metadata.storedText),
364
+ inactiveText = text.inactive || $module.data(metadata.storedText)
365
+ ;
366
+ if( module.is.textEnabled() ) {
367
+ if( module.is.active() && activeText) {
368
+ module.verbose('Resetting active text', activeText);
369
+ module.update.text(activeText);
370
+ }
371
+ else if(inactiveText) {
372
+ module.verbose('Resetting inactive text', activeText);
373
+ module.update.text(inactiveText);
374
+ }
375
+ }
376
+ }
377
+ },
378
+
379
+ update: {
380
+ text: function(text) {
381
+ var
382
+ currentText = module.get.text()
383
+ ;
384
+ if(text && text !== currentText) {
385
+ module.debug('Updating text', text);
386
+ if(settings.selector.text) {
387
+ $module
388
+ .data(metadata.storedText, text)
389
+ .find(settings.selector.text)
390
+ .text(text)
391
+ ;
392
+ }
393
+ else {
394
+ $module
395
+ .data(metadata.storedText, text)
396
+ .html(text)
397
+ ;
398
+ }
399
+ }
400
+ else {
401
+ module.debug('Text is already set, ignoring update', text);
402
+ }
403
+ }
404
+ },
405
+
406
+ setting: function(name, value) {
407
+ module.debug('Changing setting', name, value);
408
+ if( $.isPlainObject(name) ) {
409
+ $.extend(true, settings, name);
410
+ }
411
+ else if(value !== undefined) {
412
+ settings[name] = value;
413
+ }
414
+ else {
415
+ return settings[name];
416
+ }
417
+ },
418
+ internal: function(name, value) {
419
+ if( $.isPlainObject(name) ) {
420
+ $.extend(true, module, name);
421
+ }
422
+ else if(value !== undefined) {
423
+ module[name] = value;
424
+ }
425
+ else {
426
+ return module[name];
427
+ }
428
+ },
429
+ debug: function() {
430
+ if(settings.debug) {
431
+ if(settings.performance) {
432
+ module.performance.log(arguments);
433
+ }
434
+ else {
435
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
436
+ module.debug.apply(console, arguments);
437
+ }
438
+ }
439
+ },
440
+ verbose: function() {
441
+ if(settings.verbose && settings.debug) {
442
+ if(settings.performance) {
443
+ module.performance.log(arguments);
444
+ }
445
+ else {
446
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
447
+ module.verbose.apply(console, arguments);
448
+ }
449
+ }
450
+ },
451
+ error: function() {
452
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
453
+ module.error.apply(console, arguments);
454
+ },
455
+ performance: {
456
+ log: function(message) {
457
+ var
458
+ currentTime,
459
+ executionTime,
460
+ previousTime
461
+ ;
462
+ if(settings.performance) {
463
+ currentTime = new Date().getTime();
464
+ previousTime = time || currentTime;
465
+ executionTime = currentTime - previousTime;
466
+ time = currentTime;
467
+ performance.push({
468
+ 'Name' : message[0],
469
+ 'Arguments' : [].slice.call(message, 1) || '',
470
+ 'Element' : element,
471
+ 'Execution Time' : executionTime
472
+ });
473
+ }
474
+ clearTimeout(module.performance.timer);
475
+ module.performance.timer = setTimeout(module.performance.display, 100);
476
+ },
477
+ display: function() {
478
+ var
479
+ title = settings.name + ':',
480
+ totalTime = 0
481
+ ;
482
+ time = false;
483
+ clearTimeout(module.performance.timer);
484
+ $.each(performance, function(index, data) {
485
+ totalTime += data['Execution Time'];
486
+ });
487
+ title += ' ' + totalTime + 'ms';
488
+ if(moduleSelector) {
489
+ title += ' \'' + moduleSelector + '\'';
490
+ }
491
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
492
+ console.groupCollapsed(title);
493
+ if(console.table) {
494
+ console.table(performance);
495
+ }
496
+ else {
497
+ $.each(performance, function(index, data) {
498
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
499
+ });
500
+ }
501
+ console.groupEnd();
502
+ }
503
+ performance = [];
504
+ }
505
+ },
506
+ invoke: function(query, passedArguments, context) {
507
+ var
508
+ object = instance,
509
+ maxDepth,
510
+ found,
511
+ response
512
+ ;
513
+ passedArguments = passedArguments || queryArguments;
514
+ context = element || context;
515
+ if(typeof query == 'string' && object !== undefined) {
516
+ query = query.split(/[\. ]/);
517
+ maxDepth = query.length - 1;
518
+ $.each(query, function(depth, value) {
519
+ var camelCaseValue = (depth != maxDepth)
520
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
521
+ : query
522
+ ;
523
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
524
+ object = object[camelCaseValue];
525
+ }
526
+ else if( object[camelCaseValue] !== undefined ) {
527
+ found = object[camelCaseValue];
528
+ return false;
529
+ }
530
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
531
+ object = object[value];
532
+ }
533
+ else if( object[value] !== undefined ) {
534
+ found = object[value];
535
+ return false;
536
+ }
537
+ else {
538
+ module.error(error.method, query);
539
+ return false;
540
+ }
541
+ });
542
+ }
543
+ if ( $.isFunction( found ) ) {
544
+ response = found.apply(context, passedArguments);
545
+ }
546
+ else if(found !== undefined) {
547
+ response = found;
548
+ }
549
+ if($.isArray(returnedValue)) {
550
+ returnedValue.push(response);
551
+ }
552
+ else if(returnedValue !== undefined) {
553
+ returnedValue = [returnedValue, response];
554
+ }
555
+ else if(response !== undefined) {
556
+ returnedValue = response;
557
+ }
558
+ return found;
559
+ }
560
+ };
561
+
562
+ if(methodInvoked) {
563
+ if(instance === undefined) {
564
+ module.initialize();
565
+ }
566
+ module.invoke(query);
567
+ }
568
+ else {
569
+ if(instance !== undefined) {
570
+ instance.invoke('destroy');
571
+ }
572
+ module.initialize();
573
+ }
574
+ })
575
+ ;
576
+
577
+ return (returnedValue !== undefined)
578
+ ? returnedValue
579
+ : this
580
+ ;
581
+ };
582
+
583
+ $.fn.state.settings = {
584
+
585
+ // module info
586
+ name : 'State',
587
+
588
+ // debug output
589
+ debug : false,
590
+
591
+ // verbose debug output
592
+ verbose : true,
593
+
594
+ // namespace for events
595
+ namespace : 'state',
596
+
597
+ // debug data includes performance
598
+ performance : true,
599
+
600
+ // callback occurs on state change
601
+ onActivate : function() {},
602
+ onDeactivate : function() {},
603
+ onChange : function() {},
604
+
605
+ // state test functions
606
+ activateTest : function() { return true; },
607
+ deactivateTest : function() { return true; },
608
+
609
+ // whether to automatically map default states
610
+ automatic : true,
611
+
612
+ // activate / deactivate changes all elements instantiated at same time
613
+ sync : false,
614
+
615
+ // default flash text duration, used for temporarily changing text of an element
616
+ flashDuration : 1000,
617
+
618
+ // selector filter
619
+ filter : {
620
+ text : '.loading, .disabled',
621
+ active : '.disabled'
622
+ },
623
+
624
+ context : false,
625
+
626
+ // error
627
+ error: {
628
+ beforeSend : 'The before send function has cancelled state change',
629
+ method : 'The method you called is not defined.'
630
+ },
631
+
632
+ // metadata
633
+ metadata: {
634
+ promise : 'promise',
635
+ storedText : 'stored-text'
636
+ },
637
+
638
+ // change class on state
639
+ className: {
640
+ active : 'active',
641
+ disabled : 'disabled',
642
+ error : 'error',
643
+ loading : 'loading',
644
+ success : 'success',
645
+ warning : 'warning'
646
+ },
647
+
648
+ selector: {
649
+ // selector for text node
650
+ text: false
651
+ },
652
+
653
+ defaults : {
654
+ input: {
655
+ disabled : true,
656
+ loading : true,
657
+ active : true
658
+ },
659
+ button: {
660
+ disabled : true,
661
+ loading : true,
662
+ active : true,
663
+ },
664
+ progress: {
665
+ active : true,
666
+ success : true,
667
+ warning : true,
668
+ error : true
669
+ }
670
+ },
671
+
672
+ states : {
673
+ active : true,
674
+ disabled : true,
675
+ error : true,
676
+ loading : true,
677
+ success : true,
678
+ warning : true
679
+ },
680
+
681
+ text : {
682
+ disabled : false,
683
+ flash : false,
684
+ hover : false,
685
+ active : false,
686
+ inactive : false,
687
+ activate : false,
688
+ deactivate : false
689
+ }
690
+
691
+ };
692
+
693
+
694
+
695
+ })( jQuery, window , document );