Skip to content

klml/hashsplit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 

Repository files navigation

hashsplit

hashsplit is JS plugin to use various values from URL fragment identifier (hash) #foo , #foo/bar or #foo=bar&city=springfield

It uses the values from the hash with DOM-Id in a specific way:

  • forms (inputs, selects) are filled (works only with pseudogets &name=value or /name=value )
    • checkbox get checked on 'true' or any string, but unchecked with 'false' or '' (empty string) only.
  • links (a) get a click (e.g. you want to link on a page with an active fancybox)

Demo

usage

    <script src="https://cdn.jsdelivr.net/gh/klml/hashsplit@master/hashsplit.js" type="text/javascript"></script>
    <script>
    document.addEventListener('readystatechange', event => { 
        hashsplit(); // activate hashspilt
        updateHash(); // get changed input values back to hash
    })
    </script>

inspiration

Initial JS from Cristian Sanchez on stackoverflow.com. accounts.google.com is using the function 'InputHolder.prototype.prefill' doing similar the same as this function 'HashSplit'.

Any ideas for:

  • img

similar usage

version

todo:

  • this
  • hooks
  • alert

About

hashsplit is a JS plugin to use values from URL fragment identifier (hash) #foo , #foo/bar or #foo=bar&city=springfield.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors