hooch 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/hooch.js +109 -1
- data/lib/hooch/hooch_helper.rb +8 -0
- data/lib/hooch/railtie.rb +0 -1
- data/lib/hooch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c92813e77c493bb42d1d5c0bc0800ee1d8e1834
|
4
|
+
data.tar.gz: a058ced5416ddd9b7a6e14fa5575ff000f6e51fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 333e657decbee392ddf437eae2ea5defcd912c2011d3b1b454f5834819b30009083c950b53bdbd5594a66413b474a24c3174ae957e81d6558e746a031581f341
|
7
|
+
data.tar.gz: d256173242f5a45f00733e45c619394924fc53ae938face381007c6f27825124cde94b45bc332f97d48dc5b5473cdef59c10c516f8ff0bad18978e94630470cf
|
@@ -1088,6 +1088,114 @@ var initHooch = function(){
|
|
1088
1088
|
replaceWith: function($jq_obj){
|
1089
1089
|
this.$sort_element.replaceWith($jq_obj)
|
1090
1090
|
}
|
1091
|
+
}),
|
1092
|
+
key_code_map: { // borrowed from jresig: https://github.com/jeresig/jquery.hotkeys
|
1093
|
+
"backspace": 8,
|
1094
|
+
"tab": 9,
|
1095
|
+
"return": 10,
|
1096
|
+
"return": 13,
|
1097
|
+
"shift": 16,
|
1098
|
+
"ctrl": 17,
|
1099
|
+
"alt": 18,
|
1100
|
+
"pause": 19,
|
1101
|
+
"capslock": 20,
|
1102
|
+
"esc": 27,
|
1103
|
+
"space": 32,
|
1104
|
+
"pageup": 33,
|
1105
|
+
"pagedown": 34,
|
1106
|
+
"end": 35,
|
1107
|
+
"home": 36,
|
1108
|
+
"left": 37,
|
1109
|
+
"up": 38,
|
1110
|
+
"right": 39,
|
1111
|
+
"down": 40,
|
1112
|
+
"insert": 45,
|
1113
|
+
"del": 46,
|
1114
|
+
";": 59,
|
1115
|
+
"=": 61,
|
1116
|
+
"0": 96,
|
1117
|
+
"1": 97,
|
1118
|
+
"2": 98,
|
1119
|
+
"3": 99,
|
1120
|
+
"4": 100,
|
1121
|
+
"5": 101,
|
1122
|
+
"6": 102,
|
1123
|
+
"7": 103,
|
1124
|
+
"8": 104,
|
1125
|
+
"9": 105,
|
1126
|
+
"*": 106,
|
1127
|
+
"+": 107,
|
1128
|
+
"-": 109,
|
1129
|
+
".": 110,
|
1130
|
+
"/": 111,
|
1131
|
+
"f1": 112,
|
1132
|
+
"f2": 113,
|
1133
|
+
"f3": 114,
|
1134
|
+
"f4": 115,
|
1135
|
+
"f5": 116,
|
1136
|
+
"f6": 117,
|
1137
|
+
"f7": 118,
|
1138
|
+
"f8": 119,
|
1139
|
+
"f9": 120,
|
1140
|
+
"f10": 121,
|
1141
|
+
"f11": 122,
|
1142
|
+
"f12": 123,
|
1143
|
+
"numlock": 144,
|
1144
|
+
"scroll": 145,
|
1145
|
+
"-": 173,
|
1146
|
+
";": 186,
|
1147
|
+
"=": 187,
|
1148
|
+
",": 188,
|
1149
|
+
"-": 189,
|
1150
|
+
".": 190,
|
1151
|
+
"/": 191,
|
1152
|
+
"`": 192,
|
1153
|
+
"[": 219,
|
1154
|
+
"\\": 220,
|
1155
|
+
"]": 221,
|
1156
|
+
"'": 222
|
1157
|
+
},
|
1158
|
+
BindKey: Class.extend({
|
1159
|
+
init: function($bound_element){
|
1160
|
+
this.$bound_element = $bound_element
|
1161
|
+
this.element_type = $bound_element.get(0).nodeName.toLowerCase()
|
1162
|
+
this.key_name = $bound_element.data('bind-key')
|
1163
|
+
if(!this.key_name){
|
1164
|
+
console.log("Warning! Hooch key binder couldn't find a key name to bind")
|
1165
|
+
return
|
1166
|
+
}
|
1167
|
+
this.key_code = hooch.key_code_map[this.key_name]
|
1168
|
+
if(!this.key_code){
|
1169
|
+
console.log('Warning! Hooch key binder could not find a key to bind for the key name ' + this.key_name)
|
1170
|
+
return
|
1171
|
+
}
|
1172
|
+
var key_binder = this
|
1173
|
+
$(window).on('keyup', function(e){key_binder.do_it_now(e)} )
|
1174
|
+
},
|
1175
|
+
do_it_now: function(e){
|
1176
|
+
if(this.key_code == e.keyCode){
|
1177
|
+
e.preventDefault
|
1178
|
+
switch(this.element_type){
|
1179
|
+
case 'a':
|
1180
|
+
if(this.$bound_element.data('ajax-target')){
|
1181
|
+
this.$bound_element.click()
|
1182
|
+
} else {
|
1183
|
+
window.location = this.$bound_element.attr('href')
|
1184
|
+
}
|
1185
|
+
break;
|
1186
|
+
case 'form':
|
1187
|
+
this.$bound_element.submit()
|
1188
|
+
break;
|
1189
|
+
case 'input':
|
1190
|
+
if('submit' == $this.$bound_element.prop('type')){
|
1191
|
+
this.$bound_element.click()
|
1192
|
+
}
|
1193
|
+
default:
|
1194
|
+
break;
|
1195
|
+
}
|
1196
|
+
return false
|
1197
|
+
}
|
1198
|
+
}
|
1091
1199
|
})
|
1092
1200
|
};
|
1093
1201
|
hooch.SortPlaceholder = hooch.SortElement.extend({
|
@@ -1213,7 +1321,7 @@ var initHooch = function(){
|
|
1213
1321
|
['hover_overflow','hidey_button','submit-proxy','click-proxy','field-filler','revealer',
|
1214
1322
|
'checkbox-hidden-proxy','prevent-double-submit','prevent-double-link-click', 'tab-group',
|
1215
1323
|
'hover-reveal', 'emptier', 'remover', 'checkbox-proxy', 'fake-select', 'select-action-changer',
|
1216
|
-
'sorter'],'hooch');
|
1324
|
+
'sorter','bind-key'],'hooch');
|
1217
1325
|
window.any_time_manager.load();
|
1218
1326
|
};
|
1219
1327
|
hooch.pauseEvent = function(e){
|
data/lib/hooch/hooch_helper.rb
CHANGED
@@ -167,5 +167,13 @@ module Hooch
|
|
167
167
|
def prevent_double_click_hash
|
168
168
|
{"data-prevent-double-click" => true}
|
169
169
|
end
|
170
|
+
|
171
|
+
def bind_key(key_name)
|
172
|
+
{"data-bind-key" => key_name}
|
173
|
+
end
|
174
|
+
|
175
|
+
def bind_key_attrs(key_name)
|
176
|
+
"data-bind-key=#{key_name}"
|
177
|
+
end
|
170
178
|
end
|
171
179
|
end
|
data/lib/hooch/railtie.rb
CHANGED
data/lib/hooch/version.rb
CHANGED
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.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Draut
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|