]> git.mxchange.org Git - friendica.git/blobdiff - js/filebrowser.js
Move js/ folder under view/
[friendica.git] / js / filebrowser.js
diff --git a/js/filebrowser.js b/js/filebrowser.js
deleted file mode 100644 (file)
index 78cee0e..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/**\r
- * Filebrowser - Friendica Communications Server\r
- *\r
- * Copyright (c) 2010-2015 the Friendica Project\r
- *\r
- * This program is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU Affero General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This code handle user interaction for image/file upload/browser dialog.\r
- * Is loaded from filebrowser_plain.tpl\r
- *\r
- * To load filebrowser in colorbox, call\r
- *\r
- *      Dialog.doImageBrowser(eventname, id);\r
- *\r
- * or\r
- *\r
- *      Dialog.doFileBrowser(eventname, id);\r
- *\r
- * where:\r
- *\r
- *             eventname: event name to catch return value\r
- *             id: id returned to event handler\r
- *\r
- * When user select an item, an event in fired in parent page, on body element\r
- * The event is named\r
- *\r
- *             fbrowser.<type>.[<eventname>]\r
- *\r
- * <type> will be one of "image" or "file", and the event handler will\r
- * get the following params:\r
- *\r
- *             filemane: filename of item choosed by user\r
- *             embed: bbcode to embed element into posts\r
- *             id: id from caller code\r
- *\r
- * example:\r
- *\r
- *             // open dialog for select an image for a textarea with id "myeditor"\r
- *             var id="myeditor";\r
- *             Dialog.doImageBrowser("example", id);\r
- *\r
- *             // setup event handler to get user selection\r
- *             $("body").on("fbrowser.image.example", function(event, filename, bbcode, id) {\r
- *                     // close colorbox\r
- *                     $.colorbox.close();\r
- *                     // replace textxarea text with bbcode\r
- *                     $(id).value = bbcode;\r
- *             });\r
- **/\r
-\r
-var FileBrowser = {\r
-       nickname : "",\r
-       type : "",\r
-       event: "",\r
-       id : null,\r
-\r
-       init: function(nickname, type) {\r
-               FileBrowser.nickname = nickname;\r
-               FileBrowser.type = type;\r
-               FileBrowser.event = "fbrowser."+type;\r
-               if (location['hash']!=="") {\r
-                       var h = location['hash'].replace("#","");\r
-                       FileBrowser.event = FileBrowser.event + "." + h.split("-")[0];\r
-                       FileBrowser.id = h.split("-")[1];\r
-               }\r
-\r
-               console.log("FileBrowser:", nickname, type,FileBrowser.event, FileBrowser.id );\r
-\r
-               $(".error a.close").on("click", function(e) {\r
-                       e.preventDefault();\r
-                       $(".error").addClass("hidden");\r
-               });\r
-\r
-               $(".folders a, .path a").on("click", function(e){\r
-                       e.preventDefault();\r
-                       var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=minimal" + location['hash'];\r
-                       location.href = url;\r
-               });\r
-\r
-               $(".photo-album-photo-link").on('click', function(e){\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
-                       }\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
-                       }\r
-                       console.log(FileBrowser.event, this.dataset.filename, embed, FileBrowser.id);\r
-                       parent.$("body").trigger(FileBrowser.event, [\r
-                               this.dataset.filename,\r
-                               embed,\r
-                               FileBrowser.id\r
-                       ]);\r
-\r
-               });\r
-\r
-               if ($("#upload-image").length)\r
-                       var image_uploader = new window.AjaxUpload(\r
-                               'upload-image',\r
-                               { action: 'wall_upload/'+FileBrowser.nickname+'?response=json',\r
-                                       name: 'userfile',\r
-                                       responseType: 'json',\r
-                                       onSubmit: function(file,ext) { $('#profile-rotator').show(); $(".error").addClass('hidden'); },\r
-                                       onComplete: function(file,response) {\r
-                                               if (response['error']!= undefined) {\r
-                                                       $(".error span").html(response['error']);\r
-                                                       $(".error").removeClass('hidden');\r
-                                                       $('#profile-rotator').hide();\r
-                                                       return;\r
-                                               }\r
-                                               location = baseurl + "/fbrowser/image/?mode=minimal"+location['hash'];\r
-                                               location.reload(true);\r
-                                       }\r
-                               }\r
-                       );\r
-\r
-               if ($("#upload-file").length)\r
-                       var file_uploader = new window.AjaxUpload(\r
-                               'upload-file',\r
-                               { action: 'wall_attach/'+FileBrowser.nickname+'?response=json',\r
-                                       name: 'userfile',\r
-                                       onSubmit: function(file,ext) { $('#profile-rotator').show(); $(".error").addClass('hidden'); },\r
-                                       onComplete: function(file,response) {\r
-                                               if (response['error']!= undefined) {\r
-                                                       $(".error span").html(response['error']);\r
-                                                       $(".error").removeClass('hidden');\r
-                                                       $('#profile-rotator').hide();\r
-                                                       return;\r
-                                               }\r
-                                               location = baseurl + "/fbrowser/file/?mode=minimal"+location['hash'];\r
-                                               location.reload(true);\r
-                                       }\r
-                               }\r
-               );\r
-       }\r
-};\r
-\r