FileBrowser.id = h.split("-")[1];\r
FileBrowser.event = FileBrowser.event + "." + destination;\r
if (destination == "comment") {\r
- // get the comment textimput field\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
\r
- // We need to add the AjaxUpload to the button\r
- FileBrowser.uploadButtons();\r
+ FileBrowser.postLoad();\r
\r
$(".error a.close").on("click", function(e) {\r
e.preventDefault();\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
- $(".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
- $(".profile-rotator-wrapper").hide();\r
- if (textStatus === 'success') {\r
- $(".fbrowser_content").show();\r
- // We need to add the AjaxUpload to the button\r
- FileBrowser.uploadButtons();\r
- }\r
- });\r
- \r
+\r
+ FileBrowser.loadContent(url);\r
});\r
\r
- //embed on click\r
+ //Embed on click\r
$(".fbrowser").on('click', ".photo-album-photo-link", function(e) {\r
e.preventDefault();\r
\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
}\r
this.dataset.img,\r
]);\r
\r
- // close model\r
+ // Close model\r
$('#modal').modal('hide');\r
- // update autosize for this textarea\r
+ // Update autosize for this textarea\r
autosize.update($(".text-autosize"));\r
});\r
+\r
+ // EventListener for switching between image and file mode\r
+ $(".fbrowser").on('click', ".fbswitcher .btn", function(e) {\r
+ e.preventDefault();\r
+ FileBrowser.type = this.getAttribute("data-mode");\r
+ $(".fbrowser").removeClass().addClass("fbrowser " + FileBrowser.type);\r
+ url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none";\r
+\r
+ FileBrowser.loadContent(url);\r
+ });\r
},\r
\r
+ // Initialize the AjaxUpload for the upload buttons\r
uploadButtons: function() {\r
if ($("#upload-image").length) {\r
var image_uploader = new window.AjaxUpload(\r
return;\r
}\r
\r
- $(".profile-rotator-wrapper").hide();\r
- $(".fbrowser_content").show();\r
-\r
// location = baseurl + "/fbrowser/image/?mode=none"+location['hash'];\r
// location.reload(true);\r
\r
var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none"\r
// load new content to fbrowser window\r
- $(".fbrowser").load(url);\r
+ FileBrowser.loadContent(url);\r
}\r
}\r
);\r
return;\r
}\r
\r
- $(".profile-rotator-wrapper").hide();\r
- $(".fbrowser_content").show();\r
-\r
// location = baseurl + "/fbrowser/file/?mode=none"+location['hash'];\r
// location.reload(true);\r
\r
var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none"\r
- // load new content to fbrowser window\r
- $(".fbrowser").load(url);\r
+ // Load new content to fbrowser window\r
+ FileBrowser.loadContent(url)\r
}\r
}\r
);\r
}\r
+ },\r
+\r
+ postLoad: function() {\r
+ $(".fbrowser .fbswitcher .btn").removeClass("active");\r
+ $(".fbrowser .fbswitcher [data-mode=" + FileBrowser.type + "]").addClass("active");\r
+ // We need to add the AjaxUpload to the button\r
+ FileBrowser.uploadButtons();\r
+ },\r
+\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
+ $(".profile-rotator-wrapper").hide();\r
+ if (textStatus === 'success') {\r
+ $(".fbrowser_content").show();\r
+ FileBrowser.postLoad();\r
+ }\r
+ });\r
}\r
};\r
<span></span> <a href="#" class='close'>X</a>
</div>
- <div class="path">
- {{foreach $path as $p}}<a href="#" data-folder="{{$p.0}}">{{$p.1}}</a>{{/foreach}}
- </div>
+ <ol class="path breadcrumb">
+ {{foreach $path as $p}}<li><a href="#" data-folder="{{$p.0}}">{{$p.1}}</a></li>{{/foreach}}
+ <div class="fbswitcher btn-group btn-group-xs pull-right">
+ <button type="button" class="btn btn-default" data-mode="image"><i class="fa fa-picture-o" aria-hidden="true"></i></button>
+ <button type="button" class="btn btn-default" data-mode="file"><i class="fa fa-file-o" aria-hidden="true"></i></button>
+ </div>
+ </ol>
- {{if $folders }}
- <div class="folders">
- <ul>
- {{foreach $folders as $f}}<li><a href="#" data-folder="{{$f.0}}">{{$f.1}}</a></li>{{/foreach}}
- </ul>
- </div>
- {{/if}}
+ <div class="media">
+ {{if $folders }}
+ <div class="folders media-left">
+ <ul>
+ {{foreach $folders as $f}}<li><a href="#" data-folder="{{$f.0}}">{{$f.1}}</a></li>{{/foreach}}
+ </ul>
+ </div>
+ {{/if}}
- <div class="list">
- {{foreach $files as $f}}
- <div class="photo-album-image-wrapper">
- <a href="#" class="photo-album-photo-link" data-link="{{$f.0}}" data-filename="{{$f.1}}" data-img="{{$f.2}}">
- <img src="{{$f.2}}">
- <p>{{$f.1}}</p>
- </a>
+ <div class="list {{$type}} media-body">
+ {{foreach $files as $f}}
+ <div class="photo-album-image-wrapper">
+ <a href="#" class="photo-album-photo-link" data-link="{{$f.0}}" data-filename="{{$f.1}}" data-img="{{$f.2}}">
+ <img src="{{$f.2}}">
+ <p>{{$f.1}}</p>
+ </a>
+ </div>
+ {{/foreach}}
</div>
- {{/foreach}}
</div>
<div class="upload">
</div>
</div>
<div class="profile-rotator-wrapper" style="display: none;">
- <i class="fa fa-circle-o-notch fa-spin"></i>
+ <i class="fa fa-circle-o-notch fa-spin" aria-hidden="true"></i>
</div>
</div>