[11:30:33] Hi [11:31:31] what should me set in a wiki for {{int:Lang}} to show the language set by user instead of just MediaWiki:Lang ? [11:31:55] eg. here: https://wikisource.org/wiki/User:Ankry/x [11:32:58] s/me/be/ [11:33:22] like it works on Commons [15:07:37] i have defined in extension.json file [15:07:41] "ResourceModules": { [15:07:41] "ext.STLviewer": { [15:07:41] "scripts": [ [15:07:41] "three.min.js", [15:07:41] "Detector.js", [15:07:42] "STLLoader.js", [15:07:42] "stlviewer.js" [15:07:43] ] [15:07:43] } [15:07:44] }, [15:07:44] "ResourceFileModulePaths": { [15:07:45] "localBasePath": "modules", [15:07:45] "remoteExtPath": "STLviewer/modules" [15:07:46] }, [15:08:25] but when i load the module using $out->AddModules('ext.STLviewer'), the module loads according to the page source, but the scripts wont load [15:08:43] scripts are in the modules folder [15:09:01] Anything in your browser console? [15:09:11] Tried debug? [15:11:28] after loading scripts, i try to call function inside a script using $out->addHtml(ResourceLoader::makeInlineScript('initScene('.$filename.')')); [15:11:38] but the console says initscene is not defined [15:14:33] from what i understand, i should be able to toggle the debug mode on when adding ?debug=true to the url [15:14:33] but it doesnt display any more errors on console either [15:14:46] It shouldn't be minifying stuff [15:15:06] (the $filename parameter is wrong, this should be actually the url of the file, but that doesnt matter at the moment i dont think) [15:16:03] what shouldnt be minfying? [15:16:13] when you use debug mode [15:17:13] but it is? [15:17:29] sorry, i dont understand atm what you mean [15:18:50] https://www.mediawiki.org/wiki/ResourceLoader/Developing_with_ResourceLoader#Debugging [15:22:08] Harri: if you defined the 'initScene' function as just "function initScene(whatever){…}", it's not actually global. ResourceLoader wraps all modules in anonymous functions (as a side-effect of how they're loaded) [15:22:51] Harri: you need to explicitly attach functions and variables that you want to be global to the `window` object. e.g., `window.initScene = initScene;` (after defining the function) [15:23:05] Harri: or better yet, change your code so that you don't need the inline script, and don't need the global. [15:40:27] by changing my code, do you mean [15:40:38] changis js so the initscene would autoload [15:40:39] = [15:40:41] ?` [15:43:07] yeah, possibly [15:46:06] i cant do that since i need the full url of the file as a parameter for the function [16:19:48] okay, my module is registered and but not 'ready' [16:20:05] what is the status? [16:20:43] because, from what i udnerstand, the initscene($filename) is the problem, because its trying to load that file, but it needs the full url, not only name [16:20:59] so, whats the best way to get the full url of the file [16:21:28] i would imagine something to do with $this->displayImg [16:32:13] $this->displayImg->getURL(); [16:33:04] shows initScene(/images/4/42/file.stl) on page source [16:43:46] hmm, it now gives me Unexpected token }error [16:44:05] using code $out->addHtml(ResourceLoader::makeInlineScript('initScene('.$full_url.');')); [16:44:48] and line 138 being } );
the file still wouldnt show, but atm i doesnt seem to be wiki-related problem [22:01:58] okay, so if after defining the function initScene(file), i have to add window.initScene = initScene; for it to work? [22:02:25] do i have to do that for all the functions or just the initScene (the initscene calls functions inside it