Bastiaan van der Plaat

A nice site filled with rubbish

CoffeeScript Input Saver

This is a simple CoffeeScript that selects all the inputs and selects

for element in document.querySelectorAll 'input, select'
    if localStorage[element.name]?
        element.value = localStorage[element.name]
    else
        localStorage[element.name] = element.value
    element.addEventListener 'change', ->
        localStorage[this.name] = this.value

and then listens for changes and saves it to localStorage.