Hello,
I think you should use hook_library() instead of drupal_add_js for external library and remove master branch from git.

Comments

henk’s picture

StatusFileSize
new1.2 KB

something like this

BrockBoland’s picture

Patch is a start but the module needs to call drupal_add_library().

BrockBoland’s picture

Actually, this will need the Libraries module. I'm reading up on the API now. I'll post it here as a patch for review before committing, since that will be a pretty important change for existing sites using the module.

BrockBoland’s picture

Status: Active » Needs review
StatusFileSize
new6.81 KB

I'd love to get another set of eyes on this patch before I commit it, mostly because it adds a new dependency so existing sites will need to be careful about updating the module.

This patch adds dependence on the Libraries module, so that sisyphus and jStorage must be downloaded to sites/all/libraries instead of going into the module directory, which means site admins no longer need to re-download or shuffle around those JS files when updating the module. It also (hopefully) makes it a bit easier to instruct site admins on using the Sisyphus fork that supports CKEditor, as described in #1597716-3: Compatibility with CKEditor.

While I was in there, I improved performance a bit. The sisyphus, jStorage, and jnotify javascript files are no longer added to every page in hook_init(): they are only added to the page on forms that are configured to use storage. Similarly, the jnotify JS and CSS are only added if the user notifications have been enabled.

Finally, I added a README file with updated installation instructions.

BrockBoland’s picture

Status: Needs review » Fixed

Checked with compujohnny and got his blessing on this, so it has been added to 7.x-1.x:

http://drupalcode.org/project/form_save_state.git/commit/588d107
http://drupalcode.org/project/form_save_state.git/commit/fea2a0d

mariacha1’s picture

Status: Fixed » Needs review
StatusFileSize
new333 bytes

So sorry to open this up again, but there was one little bug I found just a bit too late.

The function "libraries_load" is introduced in Libraries version 7.2. If you happen to still have 7.1 installed, the patch as it stands will give a fatal error.

I'm attaching a patch to apply to the latest dev checkin at hash 754de6b01c5aeb0f4d5cfee237888f6351e49ba7

BrockBoland’s picture

Status: Needs review » Fixed

Whoops, thanks for catching that! I had to change it to 2.x: if using something like "7.x" for the version, you need to include the whole version, like "7.x-1.5." Since it just needs to be the 2.x branch, I just used that: 2.x. More here: https://drupal.org/node/542202

Corrected in http://drupalcode.org/project/form_save_state.git/commit/d21015d

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

hello