* Not ideal, but if users don't specify the script path, we try to figure it out. * The script path is needed to load other languages
()
| 320 | * The script path is needed to load other languages |
| 321 | */ |
| 322 | determineScriptPath() { |
| 323 | let src = null; |
| 324 | if (script_src_url) { // did we get it when this loaded? |
| 325 | src = script_src_url; |
| 326 | } else { |
| 327 | let script_tag = document.getElementById('timeline-script-tag') |
| 328 | if (script_tag) { |
| 329 | src = script_tag.src |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | if (!src) { |
| 334 | let script_tags = document.getElementsByTagName('script'); |
| 335 | for (let index = script_tags.length - 1; index >= 0; index--) { |
| 336 | if (script_tags[index].src) { |
| 337 | src = script_tags[index].src |
| 338 | break // if we haven't found anything else, use the latest loaded script |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | if (src) { |
| 344 | // +1 to include the trailing slash or concatting for dynamic CSS load won't work. |
| 345 | return src.substr(0, src.lastIndexOf('/') + 1); |
| 346 | } |
| 347 | return ''; |
| 348 | } |
| 349 | |
| 350 | |
| 351 | setConfig(config) { |