wellcometrust / timeline

Interactive timeline
Other
97 stars 25 forks source link

We've uncovered a display problem with the timelines function on both websites. They've stopped working on Chrome, Safari, and FF, but still work fine on MS Edge #12

Open prince-acs opened 5 years ago

prince-acs commented 5 years ago

http://www.lfffoundation.com/article/timeline/id/78

http://www.makepublic.uk/campaign-timeline/8

Can you have a look at what might be happening here?

tomcrane commented 5 years ago

Hi @prince-acs

Both of these examples are calling a function getParameterByName when they initialise the timeline. The Wellcome examples do this too. In your examples, this function is missing - it's not part of the timeline codebase. On the Wellcome site this function is part of a utils script package, and is bundled into https://wellcomelibrary.org/mergedscript/1e06f900/TimelineMergedScript.js.

Here's the code for this function - it extracts query string params:

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.search);
    if (results == null)
        return "";
    else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
}