The Buttons Module features the following functions:
$.fn.blockstrap.buttons.access
(button, e)$.fn.blockstrap.buttons.add_contact_address
(button, e)$.fn.blockstrap.buttons.cancel
(button, mobile, menu, elements)$.fn.blockstrap.buttons.check_all_inactive
(button, e)$.fn.blockstrap.buttons.check_inactive
(button, e)$.fn.blockstrap.buttons.create_account
(button, e)$.fn.blockstrap.buttons.create_contact
(button, e)$.fn.blockstrap.buttons.create_credentials
(button, e)$.fn.blockstrap.buttons.edit
(button, e)$.fn.blockstrap.buttons.edit_object
(button, e)$.fn.blockstrap.buttons.hidden_toggler
(button, e)$.fn.blockstrap.buttons.import
(button, e)$.fn.blockstrap.buttons.import_file
(button, e)$.fn.blockstrap.buttons.login
(button, e)$.fn.blockstrap.buttons.logout
(button, e)$.fn.blockstrap.buttons.more_security
(button, e)$.fn.blockstrap.buttons.new_chain
(button, e)$.fn.blockstrap.buttons.page
(button, e)$.fn.blockstrap.buttons.print
(button, e)$.fn.blockstrap.buttons.process
(slug, content, filtered_data, button, effect, direction, reverse, mobile, menu, elements)$.fn.blockstrap.buttons.refresh
(button, e)$.fn.blockstrap.buttons.remove
(button, e)$.fn.blockstrap.buttons.reset
(button, e)$.fn.blockstrap.buttons.save_salt
(button, e)$.fn.blockstrap.buttons.save_wallet
(button, e)$.fn.blockstrap.buttons.see_all
(button, e)$.fn.blockstrap.buttons.send_money
(button, e)$.fn.blockstrap.buttons.setup
(button, e)$.fn.blockstrap.buttons.sign
(button, e)$.fn.blockstrap.buttons.submit_import
(button, e)$.fn.blockstrap.buttons.submit_payment
(button, e)$.fn.blockstrap.buttons.submit_verification
(button, e)$.fn.blockstrap.buttons.switch
(button, e)$.fn.blockstrap.buttons.toggle
(button, e)$.fn.blockstrap.buttons.verify
(button, e)
buttons.access
(button, e) - back to top
This function opens a modal window containing a QR code with the address for the corresponding HTML data attributes attached to the button, such as $(button).attr('data-key')
, which is used for the address and $(button).attr('data-chain')
that is used for the selected blockchain. The modal also provides a selection of actions that can then be performed on the account.
buttons.add_contact_address
(button, e) - back to top
This function opens a modal window containing a form that allows for new addresses to be added to existing contacts.
The data-key
HTML attribute is used from the button to ascertain which contact to update.
buttons.cancel
(button, mobile, menu, elements) - back to top
This function is used internally to close sidebars and navigation upon page transitions.
buttons.check_all_inactive
(button, e) - back to top
This function is used to trigger a loop that initiates a bs.buttons.check_inactive()
call upon each archived address that is visible within the SEE ALL ACCOUNTS
modal that becomes accessible upon recycling or switching account addresses.
buttons.check_inactive
(button, e) - back to top
This function is used to check the balance of an archived address, which is visible within the SEE ALL ACCOUNTS
modal that becomes accessible upon recycling or switching account addresses.
buttons.create_account
(button, e) - back to top
This function is used to activate the creation of a new account.
It uses the data-form
attribute of the clicked button
to find the form.
Each form-group
container within the form is then checked and used towards the compounding encryption.
The minimum required inputs include:
<input id="wallet_blockchain" />
<input id="wallet_name" />
<input id="wallet_password" />
Without these, it will not be able to call the required $.fn.blockstrap.accounts.new
function.
buttons.create_contact
(button, e) - back to top
This function is used to activate the creation of a new contact.
It uses the data-form
attribute of the clicked button
to find the form.
Each form-group
container within the form is then checked and used towards the contact creation.
The minimum required inputs include:
<input id="contact_name" />
<input id="contact_address" />
<input id="contact_blockchain" />
Without these, it will not be able to call the required $.fn.blockstrap.contacts.new
function.
buttons.create_credentials
(button, e) - back to top
This function opens the login-credentials-modal
if available.
buttons.edit
(button, e) - back to top
This function opens a modal window containing a form that allows you to edit contact details.
buttons.edit_object
(button, e) - back to top
This function is used in conjunction with buttons.edit
to perform the saving of edited information.
buttons.hidden_toggler
(button, e) - back to top
This function is used to toggle elements linked via HTML data attributes using either an ID $('#' + $(button).attr('data-id')).toggle(speed)
or a class $('.' + $(button).attr('data-class')).toggle(speed)
. The speed can also be set using $(button).attr('data-speed')
.
buttons.import
(button, e) - back to top
This function opens a modal window that provides instructions on importing device data.
buttons.import_file
(button, e) - back to top
This function open the file explorer dialog in order to import a backup file.
buttons.login
(button, e) - back to top
This function provides login functionality that utilizes internally stored your_username
and your_password
options to confirm if the user should be allowed further access.
buttons.logout
(button, e) - back to top
This function will logout the current user.
buttons.more_security
(button, e) - back to top
This function toggles hidden content display within the account creation modal window.
buttons.new_chain
(button, e) - back to top
This function opens a modal that allow for new blockchains to be added to an existing account.
buttons.page
(button, e) - back to top
This function is used to providing animated page transitions within the default theme.
buttons.print
(button, e) - back to top
This function is used to open a print-friendly window.
buttons.process
(slug, content, filtered_data, button, effect, direction, reverse_direxction, mobile, menu, elements) - back to top
This function is used in conjunction with buttons.page
to handle the injection of new content when switching pages.
buttons.refresh
(button, e) - back to top
This function is used to refresh specific content on the page using the following button
attributes:
- data-collection
- data-key
Currently, the only accepted collection is accounts
.
The corresponding key
is used as an account_id in order to update the details via an API call and then refresh the page content.
buttons.remove
(button, e) - back to top
This function is used to open a modal window the contains a form with the relevant information needed to perform $.fn.blockstrap.accounts.remove
.
The following button
data attributes are required:
- data-collection
- data-key
- data-confirm
- data-element
The data-collection
and data-key
are used to defined which item should be removed from localStorage, whilst the data-confirm
defines whether a confirmation modal should appear first. Upon successfuly removal, the data-element
will be used as an ID reference to findthe appropriate element within the DOM to remove.
buttons.reset
(button, e) - back to top
This function opens a confirmation modal asking if you want to reset your device, confirming which will then remove all Blockstrap related information from localStorage.
buttons.save_salt
(button, e) - back to top
This function opens a save file dialog to enable salts to be easily backed up.
buttons.save_wallet
(button, e) - back to top
This function opens a save file dialog to enable wallets to be easily backed up.
buttons.see_all
(button, e) - back to top
This function opens a modal window containing archived addresses belonging to the relevant account, which is selected via the $(button).attr('data-id')
HTML data attribute.
buttons.send_money
(button, e) - back to top
This function is used prior to $.fn.blockstrap.accounts.prepare
as a way to collect the required information. It uses the following button
data attributes:
- data-form-id
From which it then seeks the following inputs:
<input id="to" />
<input id="from" />
<input id="amount" />
buttons.set_credentials
(button, e) - back to top
This function opens a modal window with a form that allows you to set your user credentials.
It requires the following button
data attributes:
- data-form
- data-field-username
- data-field-password
- data-field-repeat
It uses the data-form
value to first define which form to then look for the three required fields.
buttons.setup
(button, e) - back to top
This function is a complete nightmare, and yet it is also central to the process and used for the most important task at hand, setting-up your device for the first time. It's a little like buttons.create_account
in its requirements for minimum input values (derived from data-form
).
However, it also allows you to define setup steps. Setup can consist of as many steps as added to the required steps.js
dependency. In themes/default/js/dependencies/steps.js
there are two steps, at which point the following button
data attributes also become important:
- data-steps
- data-step
The data-steps
should confirm the total number of setup steps whereas the `data-step should confirm the current step.
buttons.sign
(button, e) - back to top
This function opens a modal window allowing you to sign messages using private keys belonging to specific addresses.
buttons.submit_import
(button, e) - back to top
This function is used in conjunction with buttons.import
.
It searches the DOM for form#import-device-data #import-data
expectings its value to be a JSON string, where it will then attempt to add the relevant records to localStorage. Once parsed, the JSON object looks for the following fields:
nw_accounts
arraynw_blockstrap
objectnw_contacts
arraynw_keys
object
buttons.submit_payment
(button, e) - back to top
This function is used to process information prior to sending a payment and uses the following button
data attributes:
- data-form-id
- data-account-id
- data-to-blockchain
- data-to-address
- data-to-amount
The data-form-id
is used to define which form within the DOM to use to find the validating information proving ownwership of the account, where as the data-account-id
is used to define which account to send the payment from, and the other three fields then define what to send to where.
The critical functions is must parse include:
buttons.submit_verification
(button, e) - back to top
This function is used in conjunction with $.fn.blockstrap.accounts.verify
to ensure that the current user has ownership of the relevant account. It requires the following button
data attributes:
- data-form-id
- data-account-id
The data-form-id
is used to define which form within the DOM to use to find the validating information proving ownwership of the account, where as the data-account-id
is used to define which account needs verifying.
buttons.switch
(button, e) - back to top
This function opens a modal window allowing you to switch or recylce HD addresses.
buttons.toggle
(button, e) - back to top
This function is used to toggle UI elements within the ocntact creation modal window between an input form with a user icon floating to the right to a select box filled with current contacts and the ability to switch back to the manual input. If no contacts have yet been created and the button
is clicked, a new modal window will open informing the user that they do not yet have any contacts.
buttons.verify
(button, e) - back to top
The function opens a modal window that allows you to verify whether or not someone has successfully signed their message.