Skip to content

Latest commit

 

History

History

buttons

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Buttons Module

Buttons Functions & Variables

The Buttons Module features the following functions:


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.

- back to top


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.

- back to top


buttons.cancel(button, mobile, menu, elements) - back to top

This function is used internally to close sidebars and navigation upon page transitions.

- back to top


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.

- back to top


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.

- back to top


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.

- back to top


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.

- back to top


buttons.create_credentials(button, e) - back to top

This function opens the login-credentials-modal if available.

- back to top


buttons.edit(button, e) - back to top

This function opens a modal window containing a form that allows you to edit contact details.

- back to top


buttons.edit_object(button, e) - back to top

This function is used in conjunction with buttons.edit to perform the saving of edited information.

- back to top


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').

- back to top


buttons.import(button, e) - back to top

This function opens a modal window that provides instructions on importing device data.

- back to top


buttons.import_file(button, e) - back to top

This function open the file explorer dialog in order to import a backup file.

- back to top


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.

- back to top


buttons.logout(button, e) - back to top

This function will logout the current user.

- back to top


buttons.more_security(button, e) - back to top

This function toggles hidden content display within the account creation modal window.

- back to top


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.

- back to top


buttons.page(button, e) - back to top

This function is used to providing animated page transitions within the default theme.

- back to top


buttons.print(button, e) - back to top

This function is used to open a print-friendly window.

- back to top


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.

- back to top


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.

- back to top


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.

- back to top


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.

- back to top


buttons.save_salt(button, e) - back to top

This function opens a save file dialog to enable salts to be easily backed up.

- back to top


buttons.save_wallet(button, e) - back to top

This function opens a save file dialog to enable wallets to be easily backed up.

- back to top


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.

- back to top


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" />

- back to top


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.

- back to top


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.

- back to top


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.

- back to top


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 array
  • nw_blockstrap object
  • nw_contacts array
  • nw_keys object

- back to top


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:

- back to top


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.

- back to top


buttons.switch(button, e) - back to top

This function opens a modal window allowing you to switch or recylce HD addresses.

- back to top


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.

- back to top


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.

- back to top


Related Articles
  1. Back to Modules
  2. Accounts
  3. API
  4. Buttons
  5. Contacts
  6. Blockchains
  7. Data
  8. Filters
  9. Forms
  10. HTML
  11. Multisig
  12. Security
  13. Styles
  14. Templates
  15. Widgets
  16. Table of Contents