- // get nickname & filebrowser type from the modal content
- var nickname = $("#fb-nickname").attr("value");
- var type = $("#fb-type").attr("value");
-
- // try to fetch the hash form the url
- var match = url.match(/fbrowser\/[a-z]+\/\?mode=none(.*)/);
- if (match===null) return; //not fbrowser
- var hash = match[1];
-
- // initialize the filebrowser
- var jsbrowser = function() {
- FileBrowser.init(nickname, type, hash);
- };
- loadScript("view/theme/frio/js/filebrowser.js", jsbrowser);
+ // Get nickname & filebrowser type from the modal content.
+ let filebrowser = document.getElementById('filebrowser');
+
+ // Try to fetch the hash form the url.
+ let match = url.match(/fbrowser\/[a-z]+\/.*(#.*)/);
+ if (!filebrowser || match === null) {
+ return; //not fbrowser
+ }
+
+ // Initialize the filebrowser.
+ loadScript("view/js/ajaxupload.js");
+ loadScript("view/theme/frio/js/filebrowser.js", function() {
+ FileBrowser.init(filebrowser.dataset.nickname, filebrowser.dataset.type, match[1]);
+ });