From: rabuzarus Date: Sat, 21 Apr 2018 12:05:40 +0000 (+0200) Subject: frio - fix image upload for prv messages X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4285cd5dc78f26cbcaab470215240f3300de2e66;p=friendica.git frio - fix image upload for prv messages --- diff --git a/view/theme/frio/js/filebrowser.js b/view/theme/frio/js/filebrowser.js index 92f1412911..270172072d 100644 --- a/view/theme/frio/js/filebrowser.js +++ b/view/theme/frio/js/filebrowser.js @@ -231,7 +231,6 @@ var FileBrowser = { $(".fbrowser .fbswitcher [data-mode=" + FileBrowser.type + "]").addClass("active"); // We need to add the AjaxUpload to the button FileBrowser.uploadButtons(); - }, // Load new content (e.g. change photo album) diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js index 2b60049f1d..56df75d7b6 100644 --- a/view/theme/frio/js/modal.js +++ b/view/theme/frio/js/modal.js @@ -152,6 +152,7 @@ Dialog._load = function(url) { var jsbrowser = function() { FileBrowser.init(nickname, type, hash); }; + loadScript("view/js/ajaxupload.js"); loadScript("view/theme/frio/js/filebrowser.js", jsbrowser); }; diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index a8787a6eb5..859df01613 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -446,8 +446,16 @@ function justifyPhotosAjax() { $('#photo-album-contents').justifiedGallery('norewind').on('jg.complete', function(e){ justifiedGalleryActive = false; }); } +// Load a js script to the html head. function loadScript(url, callback) { - // Adding the script tag to the head as suggested before + // Check if the script is already in the html head. + var oscript = $('head script[src="' + url + '"]'); + + // Delete the old script from head. + if (oscript.length > 0) { + oscript.remove(); + } + // Adding the script tag to the head as suggested before. var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; @@ -458,7 +466,7 @@ function loadScript(url, callback) { script.onreadystatechange = callback; script.onload = callback; - // Fire the loading + // Fire the loading. head.appendChild(script); }