Some JS errors are occurring when the module is first installed.

GET http://local.d8-sandbox.com/sites/all/libraries/jquery.tocify.js/src/javascripts/jquery.tocify.js?v=1.9.0 404 (Not Found)

drupal.js?v=8.1.1:67 Uncaught TypeError: $(...).tocify is not a function

Looks like the js library is referencing the path:

/sites/all/libraries/jquery.tocify.js/src/javascripts/jquery.tocify.js: {}

I think this needs to be
tocify/jquery.tocify.js: {}

With the jquery.tocify.js file added to the module.

Comments

kevinhowbrook created an issue. See original summary.

Xtal’s picture

Issue summary: View changes
Xtal’s picture

Issue summary: View changes
Xtal’s picture

Xtal’s picture

Status: Active » Needs review
Xtal’s picture

StatusFileSize
new35.7 KB

Incorrect js in patch.

sanduhrs’s picture

I'd prefer to not have the tocify.js in the module.
Same goes for the D7 version of the module.

A more welcome solution would be to
* have hook_requirements implemented and warn the user of the requirement
* have a drush command to download the library (drush dl-tocify)

How far is libraries module in regard to external js libraries btw?

sanduhrs’s picture

Status: Needs review » Needs work
andrew_tspkh’s picture

Assigned: Xtal » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.57 KB

Hi there!
I've fixed this problem. The patch is attached.
Review, please.

sanduhrs’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new3.37 KB

Thanks for your contribution!

* Adjusted the README a bit
* Removed the Tocify default styles, as they break the theme
* Switched to the new array syntax

New patch attached.

sanduhrs’s picture

Title: Tocify is not a function » Move library files to standard library folder and add hook_requirements

Changed the title a bit.

  • sanduhrs committed 85393b8 on 8.x-2.x
    Issue #2738633 by Xtal, sanduhrs, justin.: Move library files to...
sanduhrs’s picture

Version: 8.x-1.x-dev » 8.x-2.0
Status: Reviewed & tested by the community » Fixed

Released, thanks!

sanduhrs’s picture

Version: 8.x-2.0 » 8.x-2.x-dev

Status: Fixed » Closed (fixed)

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