peteshow 0.7.6 → 0.7.7
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 +15 -0
- data/dist/peteshow.js +42 -23
- data/dist/peteshow.min.js +2 -2
- data/lib/assets/javascripts/peteshow.js +42 -23
- data/lib/assets/javascripts/peteshow.min.js +2 -2
- data/package.json +1 -1
- data/peteshow.gemspec +3 -3
- data/src/peteshow-core.js +40 -21
- data/src/peteshow-helpers.js +1 -1
- data/src/peteshow.js +1 -1
- data/tests/index.html +5 -3
- data/tests/suite/core.js +23 -13
- data/tests/suite/helpers.js +14 -13
- data/tests/suite/keybindings.js +46 -4
- data/tests/suite/localstorage.js +6 -0
- data/tests/suite/options.js +43 -0
- metadata +7 -8
- data/vendor/peteshow.plugin.js +0 -33
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZDk5OTgzMzQwM2M2OTZiZWRhZWE4NjI5OTliM2YwMTBiYzZhMWIwZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OGNjNGJlODBiYzAyODRkODVkMDM1OTM1OTY0NDNjZTViZDYyYmUyOQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZGQyY2IxOWMxN2QzNWY0ODlmMTAyOWMxMmNkMWNkZmFlOTQzOWE2NzMzNGFk
|
10
|
+
MDhiMGNlNmVkZTE3NGU1MzExODU2NGFiMWNkMjdlNTg3MTJjNGM4YzJmZmQy
|
11
|
+
YTQ1NmQzZTI3ZDM4YzBkZjQ3MDE2YzY3M2U0NzJkYzQ3YTEyN2Q=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDgyODdkNjc0YWJhMTQ4MzFkMDc2M2UyZWNjYjFkNDJjNTQ3OGZhZmEyNjNi
|
14
|
+
Y2IwNzBmYzdkZTU2MjRmZDVjZWRlNzE0OGE3ZjZhODkwYTdkMjg0Yjk4ZWVk
|
15
|
+
OWJhYTQ2MTkyYWVkNDZmMDkzNWEzMzZjYmQxZGFiMjY2ZWNhN2E=
|
data/dist/peteshow.js
CHANGED
@@ -961,7 +961,7 @@ var Peteshow = {};
|
|
961
961
|
Peteshow.defaults = {
|
962
962
|
emailPrefix : 'test-',
|
963
963
|
emailDomain : 'example.com',
|
964
|
-
form : '
|
964
|
+
form : '',
|
965
965
|
blur : false,
|
966
966
|
|
967
967
|
rules : {},
|
@@ -1019,7 +1019,7 @@ if (typeof define == 'function'){
|
|
1019
1019
|
}
|
1020
1020
|
|
1021
1021
|
Peteshow.randomDate = function(format) {
|
1022
|
-
if(typeof format === 'undefined' || format === null) format = 'mm
|
1022
|
+
if(typeof format === 'undefined' || format === null) format = 'yy-mm-dd'
|
1023
1023
|
|
1024
1024
|
var start = new Date(1942, 1, 1),
|
1025
1025
|
end = new Date(1970, 1, 1)
|
@@ -1055,7 +1055,7 @@ if (typeof define == 'function'){
|
|
1055
1055
|
'input[type=email], input[name*=email]' : Peteshow.randomEmail(),
|
1056
1056
|
'input[name*=number], input[type=number]' : Peteshow.randomNumber(8),
|
1057
1057
|
'input[class*=number], input[class*=decimal]' : Peteshow.randomNumber(8),
|
1058
|
-
'input[
|
1058
|
+
'input[type=date]' : Peteshow.randomDate(),
|
1059
1059
|
'input[name*=phone]' : Faker.PhoneNumber.phoneNumberFormat(5),
|
1060
1060
|
'input[name*=first_name]' : Faker.Name.firstName(),
|
1061
1061
|
'input[name*=last_name]' : Faker.Name.lastName(),
|
@@ -1088,10 +1088,31 @@ if (typeof define == 'function'){
|
|
1088
1088
|
|
1089
1089
|
$('body').append($div)
|
1090
1090
|
|
1091
|
-
|
1091
|
+
initCommands()
|
1092
1092
|
}
|
1093
1093
|
|
1094
|
-
Peteshow.
|
1094
|
+
Peteshow.destroy = function() {
|
1095
|
+
Peteshow.hide()
|
1096
|
+
$div.remove();
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
Peteshow.hide = function() {
|
1100
|
+
$div.hide()
|
1101
|
+
$div.removeClass('active')
|
1102
|
+
}
|
1103
|
+
|
1104
|
+
Peteshow.toggle = function() {
|
1105
|
+
$tools.toggle()
|
1106
|
+
$div.toggleClass('active')
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
Peteshow.show = function() {
|
1110
|
+
$div.show()
|
1111
|
+
$tools.show()
|
1112
|
+
if(!$div.hasClass('active')) $div.addClass('active')
|
1113
|
+
}
|
1114
|
+
|
1115
|
+
handleKeypress = function(e) {
|
1095
1116
|
var key = (typeof e.which == 'number') ? e.which : e.keyCode,
|
1096
1117
|
code = String.fromCharCode(e.keyCode)
|
1097
1118
|
|
@@ -1102,8 +1123,7 @@ if (typeof define == 'function'){
|
|
1102
1123
|
if(e.metaKey) return
|
1103
1124
|
|
1104
1125
|
if(e.keyCode == 192) { // `
|
1105
|
-
|
1106
|
-
$div.toggleClass('active')
|
1126
|
+
Peteshow.toggle()
|
1107
1127
|
}
|
1108
1128
|
|
1109
1129
|
var action = $("[data-command='"+code+"']"),
|
@@ -1112,7 +1132,7 @@ if (typeof define == 'function'){
|
|
1112
1132
|
if(action.length > 0 && visible) action.click()
|
1113
1133
|
}
|
1114
1134
|
|
1115
|
-
|
1135
|
+
initCommands = function() {
|
1116
1136
|
var base = "<li><a data-command='F' href='#' id='fill-out-forms'>Fill Out Forms</a></li>"
|
1117
1137
|
base += "<li><a data-command='Q' href='#' id='fill-out-forms-and-submit'>Fill Out and Submit</a></li>"
|
1118
1138
|
base += outputLocalStorage()
|
@@ -1120,16 +1140,16 @@ if (typeof define == 'function'){
|
|
1120
1140
|
|
1121
1141
|
$div.find($commands).html(_options.commands + base)
|
1122
1142
|
|
1123
|
-
|
1143
|
+
bindEvents()
|
1124
1144
|
}
|
1125
1145
|
|
1126
|
-
|
1146
|
+
bindEvents = function() {
|
1127
1147
|
var commands = [
|
1128
|
-
[ $toggle, function() {
|
1148
|
+
[ $toggle, function() { Peteshow.toggle } ],
|
1129
1149
|
[ $('#fill-out-forms'), function() { Peteshow.fillOutForms() } ],
|
1130
1150
|
[ $('#fill-out-forms-and-submit'), function() { Peteshow.fillOutForms(); Peteshow.submitForm() } ],
|
1131
|
-
[ $('#clear-localstorage'), function() { clearLocalStorage() } ],
|
1132
|
-
[ $('#hide-peteshow'), function() {
|
1151
|
+
[ $('#clear-localstorage'), function() { Peteshow.clearLocalStorage() } ],
|
1152
|
+
[ $('#hide-peteshow'), function() { Peteshow.hide() } ]
|
1133
1153
|
]
|
1134
1154
|
|
1135
1155
|
$.each(commands, function() {
|
@@ -1146,7 +1166,7 @@ if (typeof define == 'function'){
|
|
1146
1166
|
|
1147
1167
|
Peteshow.submitForm = function() {
|
1148
1168
|
$(_options.form).submit()
|
1149
|
-
$('.simple_form').
|
1169
|
+
$('form[name*=registration], .simple_form').submit()
|
1150
1170
|
$('form').last().submit()
|
1151
1171
|
};
|
1152
1172
|
|
@@ -1172,7 +1192,7 @@ if (typeof define == 'function'){
|
|
1172
1192
|
// apply rules
|
1173
1193
|
var rules = $.extend(true, getDefaultRules(), _options.rules || {})
|
1174
1194
|
reused = {},
|
1175
|
-
ls = getLocalStorage(),
|
1195
|
+
ls = Peteshow.getLocalStorage(),
|
1176
1196
|
local = (ls != null || ls != undefined) ? ls : {}
|
1177
1197
|
|
1178
1198
|
// apply value to rule element, if visible and not in ignore list
|
@@ -1211,7 +1231,7 @@ if (typeof define == 'function'){
|
|
1211
1231
|
|
1212
1232
|
// apply localstorage rule values if they exist and on the right page
|
1213
1233
|
if(localStorage.peteshow != undefined || localStorage.peteshow != null) {
|
1214
|
-
$.each(getLocalStorage(), function(element,v) {
|
1234
|
+
$.each(Peteshow.getLocalStorage(), function(element,v) {
|
1215
1235
|
var url = _options.reuse[element]
|
1216
1236
|
|
1217
1237
|
if(window.location.href.indexOf(url) > -1)
|
@@ -1219,7 +1239,7 @@ if (typeof define == 'function'){
|
|
1219
1239
|
})
|
1220
1240
|
|
1221
1241
|
// reinit menu
|
1222
|
-
|
1242
|
+
initCommands()
|
1223
1243
|
}
|
1224
1244
|
}
|
1225
1245
|
|
@@ -1228,7 +1248,7 @@ if (typeof define == 'function'){
|
|
1228
1248
|
if(localStorage.peteshow != undefined || localStorage.peteshow != null) {
|
1229
1249
|
base += "<li class='list'>"
|
1230
1250
|
base += "<div class='inner'>"
|
1231
|
-
$.each(getLocalStorage(), function(k,v) {
|
1251
|
+
$.each(Peteshow.getLocalStorage(), function(k,v) {
|
1232
1252
|
base += '<div>' + k + '<span>' + v + '</span></div>'
|
1233
1253
|
})
|
1234
1254
|
base += "</div>"
|
@@ -1239,13 +1259,13 @@ if (typeof define == 'function'){
|
|
1239
1259
|
return base
|
1240
1260
|
}
|
1241
1261
|
|
1242
|
-
getLocalStorage = function() {
|
1262
|
+
Peteshow.getLocalStorage = function() {
|
1243
1263
|
return JSON.parse(localStorage.getItem('peteshow'))
|
1244
1264
|
}
|
1245
1265
|
|
1246
|
-
clearLocalStorage = function() {
|
1266
|
+
Peteshow.clearLocalStorage = function() {
|
1247
1267
|
localStorage.removeItem('peteshow')
|
1248
|
-
|
1268
|
+
initCommands()
|
1249
1269
|
}
|
1250
1270
|
|
1251
1271
|
randomSelectValue = function(i,select) {
|
@@ -1284,6 +1304,5 @@ if (typeof define == 'function'){
|
|
1284
1304
|
})
|
1285
1305
|
}
|
1286
1306
|
|
1287
|
-
$(document).keydown(
|
1288
|
-
|
1307
|
+
$(document).keydown(handleKeypress);
|
1289
1308
|
}(jQuery)
|