|
115 | 115 | if ($(media).data('root-path') !== undefined) { |
116 | 116 | // remove trailing slashes if there are any |
117 | 117 | this.rootPath = $(media).data('root-path').replace(/\/+$/, ""); |
| 118 | + this.scriptPath = this.rootPath; |
118 | 119 | } |
119 | 120 | else { |
120 | 121 | this.rootPath = this.getRootWebSitePath(); |
| 122 | + this.scriptPath = this.getScriptPath(); |
121 | 123 | } |
122 | 124 |
|
123 | 125 | // Volume |
|
461 | 463 | return webFolderFullPath; |
462 | 464 | }; |
463 | 465 |
|
| 466 | + AblePlayer.prototype.getScriptPath = function() { |
| 467 | + |
| 468 | + // returns path to Able Player JavaScript file |
| 469 | + var scripts= document.getElementsByTagName('script'); |
| 470 | + var path= scripts[scripts.length-1].src.split('?')[0]; // remove any ?query |
| 471 | + var ableDir= path.split('/').slice(0, -1).join('/')+'/'; // remove last filename part of path |
| 472 | + return ableDir; |
| 473 | + }; |
| 474 | + |
464 | 475 | AblePlayer.prototype.setIconColor = function() { |
465 | 476 |
|
466 | 477 | // determine the best color choice (white or black) for icons, |
|
11925 | 11936 | }; |
11926 | 11937 |
|
11927 | 11938 | AblePlayer.prototype.getTranslationText = function() { |
11928 | | - |
11929 | 11939 | // determine language, then get labels and prompts from corresponding translation var |
11930 | 11940 | var deferred, thisObj, lang, thisObj, msg, translationFile; |
11931 | 11941 |
|
|
11958 | 11968 | } |
11959 | 11969 | } |
11960 | 11970 |
|
11961 | | - translationFile = '../translations/' + this.lang + '.js'; |
| 11971 | + // this.scriptPath is location of AblePlayer JavaScript file (default: /build) |
| 11972 | + translationFile = this.scriptPath + '../translations/' + this.lang + '.js'; |
11962 | 11973 | this.importTranslationFile(translationFile).then(function(result) { |
11963 | 11974 | thisObj.tt = eval(thisObj.lang); |
11964 | 11975 | deferred.resolve(); |
|
0 commit comments