Skip to content

Compressed JS timeline-embed.js will not find the correct path  #40

Open

Description

@Metacowboy

If your WP JS files are compressed minified, loaded at the end with plugins like auto optimise

timeline-embed.js will fail to find the correct path to load timeline.js and timeline.css

timeline-embed.js
minor change at line 478 could help

if(typeof embed_path == 'undefined') {
// REPLACE WITH YOUR BASEPATH IF YOU WANT OTHERWISE IT WILL TRY AND FIGURE IT OUT
var _tmp_script_path = getEmbedScriptPath("timeline-embed.js");
if(!_tmp_script_path){
var _tmp_script_path = timeline_config.script_path;
}
var embed_path = _tmp_script_path.substr(0,_tmp_script_path.lastIndexOf('js/'));
}

Activity

  1. JoeGermuska commented on Sep 7, 2017

    @JoeGermuska
    Member

    Are you saying that you want to load timeline.js and timeline.css from somewhere other than the installed plugin directory?

    If you do want to load the JS/CSS from the plugin directory, but the problem is that Timeline's strategy for deriving that location is failing, there's a prescribed way to give the embed code a clue about where to find those files: by making the embed_path explicit in the page.

    var embed_path = `url root to which js/timeline.js and css/timeline.css can be appended`;
    

    It's a bit of a hack, but it's also an exceedingly rare issue. But we could change the shortcode renderer to set the embed_path specifically:

    http://github.com/NUKnightLab/TimelineJS-Wordpress-Plugin/blob/master/knightlab-timeline.php#L72-L92

    by adding a line something like:

    var embed_path: "' . $script_path .'"; after the definition of timeline_config

    If that's your situation, would you be game to put that in your local copy of knightlab-timeline.php and see if I'm right? It would be a lot easier than us constructing a test environment that matches your situation.

    If you're saying that your copies of timeline.js and timeline.css aren't even at the plugin-installed location, then I'm not sure how we could write our plugin to adapt to the variety of ways people can go off-script, but I'd be open to suggestions, or better, a pull request!

  2. JoeGermuska commented on Sep 23, 2020

    @JoeGermuska
    Member

    This came up today in another support request.

    It seems safe, to me, to simply set this value in the plugin, since the plugin knows where the related files are, and compressed/accelerated files will probably become more common.

    Considering this an "accepted" enhancement request, to be implemented when time/resources allow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions