-
Notifications
You must be signed in to change notification settings - Fork 13
Usage
griffincox edited this page Feb 14, 2019
·
18 revisions
If you do not create a custom plugin, you can manually initialize Peteshow using the commands below.
Adds the menu to the top left of your page. Press backtick `
to toggle the menu.
Using the default rules, fills out inputs, checkboxes, selects, and radio buttons. While the menu is open, press f
to call this method.
Does the same as above, but also submits the form. Press q
to call this method.
It also has several other methods exposed:
Methods | Description |
---|---|
submitForm() |
Submits the form on the page, can be customized |
destroy() |
Removes the Peteshow menu from the dom |
hide() |
Hides the Peteshow menu |
show() |
Shows the Peteshow menu |
formatDate(format, Date) |
Returns a string with the specified format |
randomChars(length, chars) |
Returns a string made up of specific characters |
randomDate(format) |
Returns a random date string |
randomEmail() |
Returns a random email, customized using init options |
randomLetters(length) |
Returns random letters |
randomNumber(length) |
Returns a random number, you can pass an optional prefix |
randomNumberRange(min,max) |
Returns a number between min and max
|
To access the stored values used in the reuse option, use Peteshow.storage
:
Methods | Description |
---|---|
storage.clear() |
Clears saved fields from cookies and localstorage |
storage.get() |
Prints out the saved fields used in the reuse option |
storage.set(hash) |
Sets either cookie or localstorage with saved fields |
Pressing backtick `
will toggle the Peteshow menu.
Once the Peteshow menu is opened, the following keybindings are available:
Keybinding | Description |
---|---|
f |
Fills out forms |
q |
Fills out forms then submits |
h |
Hides the Peteshow menu (refresh to bring it back) |
r |
Clears the stored fields |
Peteshow can be customized by creating a custom plugin. Here are the default options:
options = {
emailPrefix : 'test-',
emailDomain : 'example.com',
form : '',
blur : false,
cookies : false,
rules : {},
ignore : [],
filter : [],
force : {},
reuse : {},
commands : '',
special : function(){},
events : function(){},
}
$(function() {
Peteshow.init(options)
})