hooch 0.15.19 → 0.15.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf519f8dc13339d7f3191ae8d0ba2693bc8139bd
4
- data.tar.gz: b537c4353cf923c06643bf62cd4bf19c7f9042f3
3
+ metadata.gz: 1ca9354abfce060328803da0769ce657b16be3cd
4
+ data.tar.gz: b7b9b9853628e495df4e1f336e75dcb7e9e4fbe8
5
5
  SHA512:
6
- metadata.gz: 715a8ec269a420552690d315150ecb8921a41dad96765b0b39f1733366c3beacae5631fc955f58023259acb215e8a252b5528426e0477f186150840bf2c2ecc4
7
- data.tar.gz: 51aae35054190581fb617b7c22d63682c57033b18598ef7849f5b9ae23aa6490a89c8d35e945862c9c0579d80ded5fb93bfceb93067a9d6ead53b1423bfa93ad
6
+ metadata.gz: aa79421ea6735c1554e2b517ac870acb6a336c95c1db2705b1439b12b68ba3a08a0a326048e91f85adb9fe2c2c4be18ce01ab842300def96354a9146345f4cf2
7
+ data.tar.gz: bcae1df357b4f9cf2f7816a54f9347034b22c745c6de62650d8e0501e4dd2d61aecf3ab41346a5ff784ac83e63557a42edb730939cfd051871c512ec09cb317c
@@ -0,0 +1,39 @@
1
+ // This is a bit heavy for what it does, but should be super-easy to extend/enhance
2
+ if(typeof console == 'undefined'){
3
+ console = {log: function(msg){alert(msg)}}
4
+ }
5
+ var DebugLogger = Class.extend({
6
+ init: function($debug_settings){
7
+ if($debug_settings.data('logging_on')){
8
+ console.log('Debug logging turned on.')
9
+ this.logging_on = true;
10
+ this.logger_level = $debug_settings.data('logger_level') || 1;
11
+ this.allows = $debug_settings.data('logger_include');
12
+ } else {
13
+ this.logging_on = false;
14
+ }
15
+ },
16
+ log: function(msg, level, source){
17
+ if(level === undefined){
18
+ level = 0;
19
+ }
20
+ if(source === undefined || this.allows === undefined){
21
+ source_allowed = true;
22
+ }else{
23
+ source_allowed = this.allows[source];
24
+ }
25
+ if(this.logging_on && this.logger_level >= level && source_allowed){
26
+ console.log(msg)
27
+ }
28
+ }
29
+ })
30
+
31
+ debug_logger = {
32
+ log: function(){}
33
+ }
34
+ $(document).ready(function(){
35
+ if($('[data-debug_logger]')){
36
+ jqobj = $('[data-debug_logger]');
37
+ debug_logger = new DebugLogger(jqobj);
38
+ }
39
+ })
@@ -1,3 +1,6 @@
1
+ //= require simple_inheritance
2
+ //= require debug_logger
3
+
1
4
  Set.prototype.isSuperset = function(subset) {
2
5
  var this_set = this
3
6
  subset.forEach (function(elem) {
@@ -550,7 +553,7 @@ var initHooch = function(){
550
553
  tab_group.tab_triggers_by_id[new_tab.tab_id] = new_tab;
551
554
  })
552
555
  if(this.tab_triggers.length == 0){
553
- console.log("WARNING: hooch could not find any tab triggers for the tab set named '" + this.name + "'")
556
+ debug_logger.log("WARNING: hooch could not find any tab triggers for the tab set named '" + this.name + "'", 1, "hooch")
554
557
  }
555
558
  },
556
559
  getTabByPushState: function(state_value){
@@ -573,7 +576,7 @@ var initHooch = function(){
573
576
  if(default_tab_name){
574
577
  this.default_tab = this.tab_triggers_by_id[default_tab_name];
575
578
  if(!this.default_tab){
576
- console.log("WARNING: hooch could not find the tab " + default_tab_name + " for tab set " + this.name)
579
+ debug_logger.log("WARNING: hooch could not find the tab " + default_tab_name + " for tab set " + this.name, 1, "hooch")
577
580
  } else {
578
581
  this.default_tab.toggleTarget(this.state_behavior);
579
582
  }
@@ -982,7 +985,7 @@ var initHooch = function(){
982
985
  var form_selector = this.$fake_checkbox.data('form-selector')
983
986
  var $form = $(form_selector)
984
987
  if($form.length == 0){
985
- console.log("WARNING: hooch.FakeCheckbox could not find the form with the selector '" + form_selector + "'")
988
+ debug_logger.log("WARNING: hooch.FakeCheckbox could not find the form with the selector '" + form_selector + "'", 1, "hooch")
986
989
  }
987
990
  var toggleable_selector = this.$fake_checkbox.data('toggle-form')
988
991
  if(toggleable_selector == true || toggleable_selector == 'true'){
@@ -1999,13 +2002,13 @@ var initHooch = function(){
1999
2002
  this.element_type = $bound_element.get(0).nodeName.toLowerCase()
2000
2003
  this.key_name = $bound_element.data('bind-key')
2001
2004
  if(!this.key_name){
2002
- console.log("Warning! Hooch key binder couldn't find a key name to bind")
2005
+ debug_logger.log("Warning! Hooch key binder couldn't find a key name to bind", 1, "hooch")
2003
2006
  return
2004
2007
  }
2005
2008
  var key_binder = this
2006
2009
  var codes = $.grep(Object.keys(hooch.key_code_map), function(code){return (hooch.key_code_map[code] == key_binder.key_name)})
2007
2010
  if(codes.length < 1){
2008
- console.log('Warning! Hooch key binder could not find a key to bind for the key name ' + this.key_name)
2011
+ debug_logger.log('Warning! Hooch key binder could not find a key to bind for the key name ' + this.key_name, 1, "hooch")
2009
2012
  return
2010
2013
  }
2011
2014
  $(window).on('keyup', function(e){key_binder.do_it_now(e)} )
@@ -0,0 +1,63 @@
1
+ /* Simple JavaScript Inheritance
2
+ * By John Resig http://ejohn.org/
3
+ * MIT Licensed.
4
+ */
5
+ // Inspired by base2 and Prototype
6
+ (function(){
7
+ var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
8
+ // The base Class implementation (does nothing)
9
+ this.Class = function(){};
10
+
11
+ // Create a new Class that inherits from this class
12
+ Class.extend = function(prop) {
13
+ var _super = this.prototype;
14
+
15
+ // Instantiate a base class (but only create the instance,
16
+ // don't run the init constructor)
17
+ initializing = true;
18
+ var prototype = new this();
19
+ initializing = false;
20
+
21
+ // Copy the properties over onto the new prototype
22
+ for (var name in prop) {
23
+ // Check if we're overwriting an existing function
24
+ prototype[name] = typeof prop[name] == "function" &&
25
+ typeof _super[name] == "function" && fnTest.test(prop[name]) ?
26
+ (function(name, fn){
27
+ return function() {
28
+ var tmp = this._super;
29
+
30
+ // Add a new ._super() method that is the same method
31
+ // but on the super-class
32
+ this._super = _super[name];
33
+
34
+ // The method only need to be bound temporarily, so we
35
+ // remove it when we're done executing
36
+ var ret = fn.apply(this, arguments);
37
+ this._super = tmp;
38
+
39
+ return ret;
40
+ };
41
+ })(name, prop[name]) :
42
+ prop[name];
43
+ }
44
+
45
+ // The dummy class constructor
46
+ function Class() {
47
+ // All construction is actually done in the init method
48
+ if ( !initializing && this.init )
49
+ this.init.apply(this, arguments);
50
+ }
51
+
52
+ // Populate our constructed prototype object
53
+ Class.prototype = prototype;
54
+
55
+ // Enforce the constructor to be what we expect
56
+ Class.prototype.constructor = Class;
57
+
58
+ // And make this class extendable
59
+ Class.extend = arguments.callee;
60
+
61
+ return Class;
62
+ };
63
+ })();
data/lib/hooch/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hooch
2
- VERSION = "0.15.19"
2
+ VERSION = "0.15.20"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hooch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.19
4
+ version: 0.15.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-01 00:00:00.000000000 Z
11
+ date: 2018-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -143,7 +143,9 @@ files:
143
143
  - LICENSE.txt
144
144
  - README.md
145
145
  - Rakefile
146
+ - app/assets/javascripts/debug_logger.js
146
147
  - app/assets/javascripts/hooch.js
148
+ - app/assets/javascripts/simple_inheritence.hs
147
149
  - lib/hooch.rb
148
150
  - lib/hooch/hooch_helper.rb
149
151
  - lib/hooch/railtie.rb
@@ -168,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
170
  version: '0'
169
171
  requirements: []
170
172
  rubyforge_project:
171
- rubygems_version: 2.6.12
173
+ rubygems_version: 2.6.13
172
174
  signing_key:
173
175
  specification_version: 4
174
176
  summary: Tools for building a browser UI. Get the good stuff.