frio - fix image upload for prv messages

This commit is contained in:
rabuzarus 2018-04-21 14:05:40 +02:00
parent c57f0bcce6
commit 4285cd5dc7
3 changed files with 11 additions and 3 deletions

View file

@ -231,7 +231,6 @@ var FileBrowser = {
$(".fbrowser .fbswitcher [data-mode=" + FileBrowser.type + "]").addClass("active"); $(".fbrowser .fbswitcher [data-mode=" + FileBrowser.type + "]").addClass("active");
// We need to add the AjaxUpload to the button // We need to add the AjaxUpload to the button
FileBrowser.uploadButtons(); FileBrowser.uploadButtons();
}, },
// Load new content (e.g. change photo album) // Load new content (e.g. change photo album)

View file

@ -152,6 +152,7 @@ Dialog._load = function(url) {
var jsbrowser = function() { var jsbrowser = function() {
FileBrowser.init(nickname, type, hash); FileBrowser.init(nickname, type, hash);
}; };
loadScript("view/js/ajaxupload.js");
loadScript("view/theme/frio/js/filebrowser.js", jsbrowser); loadScript("view/theme/frio/js/filebrowser.js", jsbrowser);
}; };

View file

@ -446,8 +446,16 @@ function justifyPhotosAjax() {
$('#photo-album-contents').justifiedGallery('norewind').on('jg.complete', function(e){ justifiedGalleryActive = false; }); $('#photo-album-contents').justifiedGallery('norewind').on('jg.complete', function(e){ justifiedGalleryActive = false; });
} }
// Load a js script to the html head.
function loadScript(url, callback) { 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 head = document.getElementsByTagName('head')[0];
var script = document.createElement('script'); var script = document.createElement('script');
script.type = 'text/javascript'; script.type = 'text/javascript';
@ -458,7 +466,7 @@ function loadScript(url, callback) {
script.onreadystatechange = callback; script.onreadystatechange = callback;
script.onload = callback; script.onload = callback;
// Fire the loading // Fire the loading.
head.appendChild(script); head.appendChild(script);
} }