nickname : "",\r
type : "",\r
event: "",\r
+ folder: "",\r
id : null,\r
\r
init: function(nickname, type, hash) {\r
var destination = h.split("-")[0];\r
FileBrowser.id = h.split("-")[1];\r
FileBrowser.event = FileBrowser.event + "." + destination;\r
- if (destination == "comment") {\r
+ if (destination === "comment") {\r
// Get the comment textimput field\r
var commentElm = document.getElementById("comment-edit-text-" + FileBrowser.id);\r
}\r
};\r
\r
- console.log("FileBrowser:", nickname, type,FileBrowser.event, FileBrowser.id );\r
+ console.log("FileBrowser: " + nickname, type, FileBrowser.event, FileBrowser.id);\r
\r
FileBrowser.postLoad();\r
\r
- $(".error a.close").on("click", function(e) {\r
+ $(".error .close").on("click", function(e) {\r
e.preventDefault();\r
$(".error").addClass("hidden");\r
});\r
$(".fbrowser").on("click", ".folders a, .path a", function(e) {\r
e.preventDefault();\r
var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=none";\r
+ FileBrowser.folder = this.dataset.folder;\r
\r
FileBrowser.loadContent(url);\r
});\r
e.preventDefault();\r
\r
var embed = "";\r
- if (FileBrowser.type == "image") {\r
- embed = "[url="+this.dataset.link+"][img]"+this.dataset.img+"[/img][/url]";\r
+ if (FileBrowser.type === "image") {\r
+ embed = "[url=" + this.dataset.link + "][img]" + this.dataset.img + "[/img][/url]";\r
}\r
- if (FileBrowser.type == "file") {\r
+ if (FileBrowser.type === "file") {\r
// attachment links are "baseurl/attach/id"; we need id\r
- embed = "[attachment]"+this.dataset.link.split("/").pop()+"[/attachment]";\r
+ embed = "[attachment]" + this.dataset.link.split("/").pop() + "[/attachment]";\r
}\r
\r
// Delete prefilled Text of the comment input\r
// work as expected (we need a way to wait until commentOpenUI would be finished).\r
// As for now we insert pieces of this function here\r
if ((commentElm !== null) && (typeof commentElm !== "undefined")) {\r
- if (commentElm.value == "") {\r
+ if (commentElm.value === "") {\r
$("#comment-edit-text-" + FileBrowser.id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty");\r
$("#comment-edit-submit-wrapper-" + FileBrowser.id).show();\r
$("#comment-edit-text-" + FileBrowser.id).attr('tabindex','9');\r
}\r
\r
}\r
+\r
console.log(FileBrowser.event, this.dataset.filename, embed, FileBrowser.id);\r
+\r
parent.$("body").trigger(FileBrowser.event, [\r
this.dataset.filename,\r
embed,\r
FileBrowser.id,\r
- this.dataset.img,\r
+ this.dataset.img\r
]);\r
\r
// Close model\r
// Initialize the AjaxUpload for the upload buttons\r
uploadButtons: function() {\r
if ($("#upload-image").length) {\r
+ // To get the albumname we need to convert it from hex\r
+ var albumname = hex2bin(FileBrowser.folder);\r
+ //AjaxUpload for images\r
var image_uploader = new window.AjaxUpload(\r
'upload-image',\r
- { action: 'wall_upload/'+FileBrowser.nickname+'?response=json',\r
+ { action: 'wall_upload/' + FileBrowser.nickname + '?response=json&album=' + albumname,\r
name: 'userfile',\r
responseType: 'json',\r
- onSubmit: function(file,ext) {\r
+ onSubmit: function(file, ext) {\r
$(".fbrowser-content").hide();\r
$(".fbrowser .profile-rotator-wrapper").show();\r
$(".error").addClass('hidden');\r
},\r
onComplete: function(file,response) {\r
- if (response['error']!= undefined) {\r
+ if (response['error'] != undefined) {\r
$(".error span").html(response['error']);\r
$(".error").removeClass('hidden');\r
$(".fbrowser .profile-rotator-wrapper").hide();\r
// location = baseurl + "/fbrowser/image/?mode=none"+location['hash'];\r
// location.reload(true);\r
\r
- var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none"\r
+ var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + FileBrowser.folder + "?mode=none";\r
// load new content to fbrowser window\r
FileBrowser.loadContent(url);\r
}\r
}\r
\r
if ($("#upload-file").length) {\r
+ //AjaxUpload for files\r
var file_uploader = new window.AjaxUpload(\r
'upload-file',\r
- { action: 'wall_attach/'+FileBrowser.nickname+'?response=json',\r
+ { action: 'wall_attach/' + FileBrowser.nickname + '?response=json',\r
name: 'userfile',\r
- onSubmit: function(file,ext) {\r
+ onSubmit: function(file, ext) {\r
$(".fbrowser-content").hide();\r
$(".fbrowser .profile-rotator-wrapper").show();\r
$(".error").addClass('hidden');\r
// location = baseurl + "/fbrowser/file/?mode=none"+location['hash'];\r
// location.reload(true);\r
\r
- var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none"\r
+ var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none";\r
// Load new content to fbrowser window\r
- FileBrowser.loadContent(url)\r
+ FileBrowser.loadContent(url);\r
}\r
}\r
);\r
}\r
},\r
\r
+ // Stuff which should be executed if ne content was loaded\r
postLoad: function() {\r
FileBrowser.initGallery();\r
$(".fbrowser .fbswitcher .btn").removeClass("active");\r
\r
},\r
\r
+ // Load new content (e.g. change photo album)\r
loadContent: function(url) {\r
$(".fbrowser-content").hide();\r
$(".fbrowser .profile-rotator-wrapper").show();\r
\r
// load new content to fbrowser window\r
- $(".fbrowser").load(url, function(responseText, textStatus){\r
+ $(".fbrowser").load(url, function(responseText, textStatus) {\r
$(".profile-rotator-wrapper").hide();\r
if (textStatus === 'success') {\r
$(".fbrowser_content").show();\r
});\r
},\r
\r
+ // Initialize justified Gallery\r
initGallery: function() {\r
$(".fbrowser.image .fbrowser-content-container").justifiedGallery({\r
'rowHeight': 80,\r
- 'margins': 3,\r
+ 'margins': 4,\r
'border': 0\r
});\r
}\r