Gmail-like client-side drafts and bit more. Plugin developed to save html forms data to LocalStorage to restore them after browser crashes, tabs closings and other disasters.

Overview

Sisyphus Build Status

Plugin developed to save html forms data to LocalStorage to restore them after browser crashes, tabs closings and other disasters.

Description and sample are available at http://sisyphus-js.herokuapp.com/

Smashing Magazine article: http://coding.smashingmagazine.com/2011/12/05/sisyphus-js-client-side-drafts-and-more/

How to contribute

  1. Fork the repository
  2. Install dependencies with npm install
  3. Run ./node_modules/karma/bin/karma start (or $ npm install -g karma-cli and karma start)
  4. Make your changes
  5. Write some specs and make sure that you did not break existing ones
  6. Check that your code style matches jQuery Core Style Guidelines
  7. Send a pull request

Author: Alexander Kaupanin

Comments
  • sisyphus , dynamic rows not saved

    sisyphus , dynamic rows not saved

    I have i page where i ma using to create dynamic rows using jQuery. I also use this library "sisyphus.js" and "sisyphus.min.js" and "jquery-1.7.min.js". I am not able to preserve my dynamically rows in my form.

    I paste code here.

        <script type="text/javascript" src="jquery-1.7.min.js"></script>
        <script src="sisyphus.js" language="javascript"></script>
    
        <script language="javascript" >
            jQuery('#form1').sisyphus();
            jQuery('form').sisyphus({timeout: 5});
        </script>
    
        <script type="text/javascript">
            $(document).ready(function(){       
    
                $('.del').live('click',function(){
                    $(this).parent().parent().remove();
                });
    
                $('.add').live('click',function(){
                    $(this).val('Delete');
                    $(this).attr('class','del');
                    var appendTxt = "<tr><td><select  name='ptype[]' ><option value='1' >ONE</option><option value='2' >TWO</option></select></td><td><select name='product[]' ><option value='3' >ONE333</option><option value='4' >TWO444</option></select></td><td><input type='text' name='dsc[]' /></td><td><input type='text' name='qty[]' /></td></td><td><input type='button' class='add' value='Add More' /></td></tr>";
                    $("tr:last").after(appendTxt);          
                });        
            });
        </script>
    
        <style>
    
        .add{
           border-top: 1px solid #96d1f8;
           background: #65a9d7;
           background: -webkit-gradient(linear, left top, left bottom, from(#3e779d), to(#65a9d7));
           background: -webkit-linear-gradient(top, #3e779d, #65a9d7);
           background: -moz-linear-gradient(top, #3e779d, #65a9d7);
           background: -ms-linear-gradient(top, #3e779d, #65a9d7);
           background: -o-linear-gradient(top, #3e779d, #65a9d7);
           padding: 2px 4px;
           -webkit-border-radius: 40px;
           -moz-border-radius: 40px;
           border-radius: 40px;
           -webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
           -moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
           box-shadow: rgba(0,0,0,1) 0 1px 0;
           text-shadow: rgba(0,0,0,.4) 0 1px 0;
           color: white;
           font-size: 11px;
           font-family: Georgia, serif;
           text-decoration: none;
           vertical-align: middle;
           }
        .add:hover {
           border-top-color: #28597a;
           background: #28597a;
           color: #ccc;
           }
        .add:active {
           border-top-color: #1b435e;
           background: #1b435e;
           }
    
    
         .del{
            border-top: 1px solid #96d1f8;
           background: #65a9d7;
           background: -webkit-gradient(linear, left top, left bottom, from(#3e779d), to(#65a9d7));
           background: -webkit-linear-gradient(top, #3e779d, #65a9d7);
           background: -moz-linear-gradient(top, #3e779d, #65a9d7);
           background: -ms-linear-gradient(top, #3e779d, #65a9d7);
           background: -o-linear-gradient(top, #3e779d, #65a9d7);
           padding: 2px 4px;
           -webkit-border-radius: 40px;
           -moz-border-radius: 40px;
           border-radius: 40px;
           -webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
           -moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
           box-shadow: rgba(0,0,0,1) 0 1px 0;
           text-shadow: rgba(0,0,0,.4) 0 1px 0;
           color: white;
           font-size: 11px;
           font-family: Georgia, serif;
           text-decoration: none;
           vertical-align: middle;
           }
        .del:hover {
           border-top-color: #28597a;
           background: #28597a;
           color: #ccc;
           }
        .del:active {
           border-top-color: #1b435e;
           background: #1b435e;
           }
        </style>
    
        <form name="form1" id="form1" action="" >
        <table id="options-table">
          <tr>
            <td>Type</td>
            <td>Product</td>
            <td>Desc</td>
            <td>Qty</td>                        
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><select  name="ptype[]" >
                <option value="1" >ONE</option>
                <option value="2" >TWO</option>
              </select></td>
            <td><select name="product[]" >
                <option value="3" >ONE333</option>
                <option value="4" >TWO444</option>
              </select></td>
            <td><input type="text"   name="dsc[]" /></td>
            <td><input type="text"   name="qty[]" /></td>          
            <td><input type="button" class="add" value="Add More" /></td>
          </tr>  
          </tr>
        </table>
        </form>
    
    opened by ureshpatel5 13
  • Can't make textareas to work

    Can't make textareas to work

    Hi,

    I installed the plugin, by just including the minimized version in the end of my scripts. I use bootstrap 2.3, with some of other scripts... modals, tooltips, popovers, etc. Also use select2 version 2.x.

    It works with input fields and checkboxes, but not with selects and textareas. So I started to take scripts out to check If could be a compatibility issue. Found that select2 has a incompatibity, cause it worked without it... but what I couldn't find a solution are the textareas and they are the most important for me.

    They have id's and names. I tried to take control tags out and also coping the example HTML. Didn't work. Tried in IE, Chrome and Firefox.

    Is there any known issues with bootstrap 2.3 ? Like the order of script loading or something ?

    Cheers

    opened by pedrocury 11
  • How to save from a Listbox?

    How to save from a Listbox?

    Hi,

    I have a webpage were it saves the contents of two textboxes:

    FirstName LastName

    Into the ListBox.

    Using jQuery statement:

    $listbox.append($('').attr('value', $textbox.val()).text(self.FullName));

    I tried replacing "Form" with option and select did not work.

    I looked at http://sisyphus-js.herokuapp.com/#interaction and it looks like it is possible but for some reason it is not working for me.

    //Save All of Form Data to HTML5 Local Storage <-- This works, but it is also hard coded html $(function () { $("form").sisyphus(); });

    //Save All names from Listbox to HTML5 Local Storage  <-- Does not work, option is generated at runtime with jQuery.
    $(function () { $("option").sisyphus(); });
    

    Does having it generated in the DOM have any effect?

    Thanks, Brian Davis

    opened by kbdavis07 8
  • manuallyReleaseData not working

    manuallyReleaseData not working

    I've got a three-page checkout process (each has it's own submit button) followed by a thank you page. My goal is to keep the data saved on the three pages, but release it once the transaction is finished and the thank you page is loaded. The data is being saved correctly, but it's not being released on the final step.

    On the checkout pages I've got: $( function() { $( "form" ).sisyphus( { autoRelease: false } ); } );

    On the thank you page I've got: $( function() { $("form").sisyphus().manuallyReleaseData(); } );

    I'm a complete javascript newbie. Thanks in advance for any help on this.

    opened by fingerprn 6
  • No errors, no fields values restored

    No errors, no fields values restored

    Hi,

    Thank you for the great plugin (will contribute once get it working).

    An installation note would be great so people avoid simple mistakes.

    I've included the script at the bottom of my Tweeter Bootstrap 3 under all other JS includes like jQuery, added code initiating the plugin with 0 second timeout and nothing happens. There is no error messages nor it's saving the form's state in Chrome (Firefox seem to have been doing it anyway when refresh pages).

    The page in question: smartinsurance.webcoder.eu

    TESTED ON: Mac OS X: 10.8.5 (12F45) Safari (latest) Chrome (latest) Firefox (latest)

    opened by davss 6
  • AutoRelase / manuallyReleaseData

    AutoRelase / manuallyReleaseData

    Hi all, I´m new to Sisyphus and jQuery. I have integrated it to my site. My Form is checked by PHP for mistake, the data is written to MYSQL and the user is redirected to a confirmation site. Now my question. I have added following code to my form site ...

    $( function() { $( "#formdata" ).sisyphus({ autoRelease: false }); } );

    Input is correct, checked by PHP and user is redirected. How can I clear the data now from the new site ...

    I tried $('#formdata').sisyphus.manuallyReleaseData(); but seems not to be workin. Any help for a newbie is apreciated.

    opened by Ahnungsloser 6
  • Security of

    Security of "password" inputs

    Shouldn't Sisyphus always ignore password inputs?

    If the value of password fields is stored in LocalStorage then any other script on the page could grab this data, and hijack the user's credentials as they're filling out a form.

    opened by brendanfalkowski 6
  • Sisyphus stores each radio button as a new key value pair

    Sisyphus stores each radio button as a new key value pair

    Hi,

    I'm using sisyphus for to build an accessibility checklist which is basically a massive form and I would like to save the form data on each key press.

    You can see what I'm getting at here... https://storage.googleapis.com/a11ypal.com/index.html

    When I select a radio button (pass, fail or not applicable) sisyphus saves the following to local storage.

    [id=wcagChecklist][name=Accessibility_assessment_tool][id=wcagChecklist_fail_1][name=result_1]

    Compared to what is stored in the local storage on the demo page.

    sample_formsample_formsample_form_color

    Does sisyphus convert the attributes of a form input to a string before saving to the local storage?

    The problem is that every selection I make gets stored as a new kay value pair in local storage instead of the just updating the value. So if I select 'not applicable' and then select 'passed' when I refresh 'not applicable' is selected. Local storage seems to show both key value pairs have been stored. Hope that is making sense!

    I can't work out what I'm doing wrong with it, each button has a unique id but shares the same name as the other buttons in the fieldset grouping.

    My js file includes the following...

    $(function() { var form = $("#wcagChecklist"); $(form).sisyphus({ onSave:function() { $('#dataPersisted').show().delay(700).fadeOut()}, onRestore: function() { $('#dataRestored').show().delay(700).fadeOut()}, onRelease: function() { $('#dataReleased').show().delay(700).fadeOut()} } )});

    And this is a sample of the html...

    <fieldset class='resultsRadioBtns wcagAResultsRadioBtns' data-number="1">
    <legend class="sr-only">Result radio buttons for 1.1.1 – Non-text Content</legend>
    <input  tabindex="0" id="wcagChecklist_pass_1" class="passedButton passed wcagAPassed visible" type="radio" name="result_1" value="Passed" aria-checked="false" data-number="1">
    <label for="wcagChecklist_pass_1">
    <span>Pass <i class="fa fa-thumbs-o-up" aria-hidden="true"></i></span>
    </label>
    <input tabindex="0" id="wcagChecklist_fail_1" class="failed wcagAFailed visible" type="radio" name="result_1" value="Failed" aria-checked="false" data-number="1">
    <label for="wcagChecklist_fail_1">
    <span>Fail <i class="fa fa-thumbs-o-down" aria-hidden="true"></i></span>
    </label>
    <input  tabindex="0" id="wcagChecklist_na_1" class="notApplicable visible wcagANotApplicable" type="radio" name="result_1" value="Not applicable" aria-checked="false" data-number="1">
    <label for="wcagChecklist_na_1">
    <span>Not applicable <i class="fa fa-ban" aria-hidden="true"></i></span>
    </label>
    <div class="form-group">
    <label for="comments_1">Comments</label>
    <textarea class="form-control bottomSpace commentFocus" id="comments_1" rows="3" data-ng-model="aComment1"></textarea>
    </div>
    </fieldset>
    

    Please help!

    Chris

    opened by nedgip 5
  • Ajax loaded forms are reinit after being released

    Ajax loaded forms are reinit after being released

    When I release ajax loaded form manually and load this form for 2nd time, it doesn't work anymore. It's because these forms, are still marked as started.

    opened by s7anley 5
  • Add support for plugins that trigger a change event

    Add support for plugins that trigger a change event

    Plugins like jQuery UI, or Select2 trigger a change event and are never saved through the oninput binding. This adds support for that.

    Tests run in Chrome, Safari 6, IE 8 & 9.

    opened by nicinabox 5
  • Unbind a form when using ajax

    Unbind a form when using ajax

    Hello! I want to unbind a form from sisyphus because the site I'm coding uses ajax in a lot of places. What is happening:

    1 - I'm binding sisyphus to form self.sisyphus = $('form').sisyphus();

    2 - The form is sent by ajax so in the ajax call I use: self.sisyphus.manuallyReleaseData();

    The tricky part is here, because the method is called, but after this, saveDataTimeout is called again, so the form is sent again!

    What should I do?

    opened by diofeher 5
  • Thoughts on moving from Local Storage to Indexed DB?

    Thoughts on moving from Local Storage to Indexed DB?

    opened by ademidun 0
  • Wordpress Nonce Issue

    Wordpress Nonce Issue

    Hey, I'm running into an issue using Wordpress with the plugin Caldera Forms. I use sisyphus to allow users to come back to fill out forms later in case they couldn't finish it the first time. The issue is, it seems to be persisting the nonce from the original session which blocks submission unless you clear all the data. Any ideas as to how I could avoid this issue. Not sure if it's specific to Caldera forms setup or if it's a wordpress issue. Thanks!

    • Reggie
    opened by regiside 1
  • How to restore dynamically added inputs

    How to restore dynamically added inputs

    I dynamically create a new grid row on several forms when the user clicks an ‘Add Row’ button. All of the data in those new rows gets correctly saved to localStorage. My problem is they don’t get restored if the user doesn’t save the page before, e.g., crashing. When the user returns, the ‘new’ dynamically added controls are no longer in the document, so those values are ignored during restore.

    I’m just now getting started on figuring out how to ‘re-insert’ those nodes to the document when restoring.

    I’m posting here in the hopes that someone has experience to share that would give me a head start.

    opened by agloa 1
  • Multiple CKEditor instances in one form not playing nice with Sisyphus

    Multiple CKEditor instances in one form not playing nice with Sisyphus

    Hi creator of Sisyphus,

    We're trying to incorporate your tool in our webforms, and it works most of the time. The one time it does not work is when there are several instances of CKEditor on the page. IS this a known bug and if so, will there be some action taken on that?

    Maybe you have a working example of Sisyphus with several CKEditors? We think the script does not take into account this possibility. Any ideas or solutions?

    Love to hear from you, thanks up front for your time.

    Kind regards,

    Sebastiaan Naafs - van Dijk

    opened by sebgmc 0
An arbitrary size Bit-Vector implementation in JavaScript

BitSet.js BitSet.js is an infinite Bit-Array (aka bit vector, bit string, bit set) implementation in JavaScript. That means that if you invert a bit v

Robert Eisele 207 Dec 9, 2022
SPOILER ALERT! A happy little bit of javascript to hide spoilers on your site.

SPOILER ALERT! Don't spoil it! Hide copy and images with a bit of SVG blur. Taste on mouseover. Eat on click. Do you publish spoilers? Do you wish you

Joshua Hull 473 Sep 27, 2022
SiJago - GraphQL Client for Browser and Node.js

SiJago is GraphQL Client for Browser and Node.js, You can write request GraphQL schema using JavaScript Object Style, Why i create this tools, Because for reducing typo when writing GraphQL schema using HTTP client like Axios, Fetch or GraphQL client using Apollo and also to simplify calling the GraphQL schema easy to understand for human.

Restu Wahyu Saputra 7 Mar 13, 2022
🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API

Huge thanks to for sponsoring me! Ky is a tiny and elegant HTTP client based on the browser Fetch API Ky targets modern browsers and Deno. For older b

Sindre Sorhus 8.5k Jan 2, 2023
API routes are great for APIs, but for small projects where you have to access server data or hide application logic, you can just call a server function from the client.

API routes are great for APIs, but for small projects where you have to access server data or hide application logic, you can just call a server function from the client.

null 3 Mar 6, 2022
A lightweight jQuery plugin for collapsing and expanding long blocks of text with "Read more" and "Close" links.

Readmore.js V3 alpha I am deprecating the 2.x version of Readmore.js. A new version is coming soon! Check it out and help me test it! Readmore.js A sm

Jed Foster 1.5k Nov 30, 2022
The perfect library for adding search, sort, filters and flexibility to tables, lists and various HTML elements. Built to be invisible and work on existing HTML.

List.js Perfect library for adding search, sort, filters and flexibility to tables, lists and various HTML elements. Built to be invisible and work on

Jonny Strömberg 10.9k Jan 1, 2023
This is a facebook messenger clone.You can comminicate to other at realtime

?? facebook-messenger This is a facebook messenger clone.You can comminicate to other at realtime ?? ⚡ LIVE To check out the live demo of this app ABO

null 22 Sep 11, 2022
wasteof-client is an npm package for wasteof.money

wasteof-client is an npm package for wasteof.money

Oren Lindsey 2 Jun 16, 2022
A responsive image polyfill for , srcset, sizes, and more

Picturefill A responsive image polyfill. Authors: See Authors.txt License: MIT Picturefill has three versions: Version 1 mimics the Picture element pa

Scott Jehl 10k Dec 31, 2022
A high-performance, dependency-free library for animated filtering, sorting, insertion, removal and more

MixItUp 3 MixItUp is a high-performance, dependency-free library for animated DOM manipulation, giving you the power to filter, sort, add and remove D

Patrick Kunka 4.5k Dec 24, 2022
Creates a URL slug as you type a page title (like Django slugify())

jQuery Slugify Update Please have a look at Madflow's implementation of jQuery Slugify. It's a more mature and active project. In theory, you should b

Patrick McElhaney 87 Jun 28, 2022
It's open source alternative to services like: integrately, ifttt, zapier, n8n

ozyifttt It's open source alternative to services like: integrately, ifttt, zapier, n8n Currently, it's support: telegram, github, jira You can add to

null 6 Oct 28, 2022
Browser fingerprinting library with the highest accuracy and stability.

FingerprintJS is a browser fingerprinting library that queries browser attributes and computes a hashed visitor identifier from them. Unlike cookies a

FingerprintJS 18.1k Dec 31, 2022
a browser detector

Bowser A small, fast and rich-API browser/platform/engine detector for both browser and node. Small. Use plain ES5-version which is ~4.8kB gzipped. Op

Denis Demchenko 5.2k Jan 2, 2023
A Featureful File Browser for Cockpit

Cockpit Navigator A Featureful File System Browser for Cockpit - remotely browse, manage, edit, upload, and download files on your server through your

45Drives 226 Dec 27, 2022
This is a Todo app build with JS, HTML/CSS , Webpack

todo-list Todo List app Additional description about the project and its features. Built With HTML5 CSS3 Webpack JavaScript Live Demo Live Demo Link G

houssam hichami 6 May 22, 2022
Generate HTML redirections from json file

Generate HTML redirections from json file

Andrew Luca 3 Jan 6, 2022
Compiler for parsing custom HTML 🤖

RiN Compiler Compiler for parsing custom HTML ?? Installation Features Usage Basic compilation Advanced compiling Tags Widgets App Widgets Functional

Chalana Nethsara 4 Apr 3, 2022