filebrowser fixs, use it in comment textareas
move filebrowser js to single file document filebrowser usage replace "onclick" for comment style buttons with data-* and move logic to main.js use filebrowser to insert images in comments
This commit is contained in:
parent
70b7de39a7
commit
52f9465578
10 changed files with 210 additions and 108 deletions
|
@ -4,28 +4,36 @@
|
|||
-->
|
||||
|
||||
<script type="text/javascript" src="{{$baseurl}}/js/ajaxupload.js" ></script>
|
||||
|
||||
<script type="text/javascript" src="{{$baseurl}}/js/filebrowser.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
FileBrowser.init("{{$nickname}}", "{{$type}}");
|
||||
});
|
||||
</script>
|
||||
<div class="fbrowser {{$type}}">
|
||||
|
||||
<div class="path">
|
||||
{{foreach $path as $p}}<a href="{{$p.0}}">{{$p.1}}</a>{{/foreach}}
|
||||
</div>
|
||||
|
||||
{{if $folders }}
|
||||
<div class="folders">
|
||||
<ul>
|
||||
{{foreach $folders as $f}}<li><a href="{{$baseurl}}/fbrowser/{{$type}}/{{$f.0}}">{{$f.1}}</a></li>{{/foreach}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{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">
|
||||
{{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>
|
||||
<div class="photo-album-image-wrapper-end"></div>
|
||||
{{/foreach}}
|
||||
|
||||
<div class="upload">
|
||||
<button id="upload-{{$type}}"><img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait|escape:'html'}}" style="display: none;" /> {{"Upload"|t}}</button>
|
||||
|
@ -33,54 +41,6 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
$(".photo-album-photo-link").on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
{{if $type == "image"}}
|
||||
var embed = "[url="+this.dataset.link+"][img]"+this.dataset.img+"[/img][/url]";
|
||||
{{/if}}
|
||||
{{if $type == "file"}}
|
||||
var embed = "[url="+this.dataset.link+"][img]"+this.dataset.img+"[/img] "+this.dataset.filename+"[/url]";
|
||||
{{/if}}
|
||||
console.log(this.dataset.filename, embed, parent.$("body"));
|
||||
parent.$("body").trigger("fbrowser.{{$type}}", [
|
||||
this.dataset.filename,
|
||||
embed,
|
||||
]);
|
||||
|
||||
});
|
||||
|
||||
if ($("#upload-image").length)
|
||||
var image_uploader = new window.AjaxUpload(
|
||||
'upload-image',
|
||||
{ action: 'wall_upload/{{$nickname}}',
|
||||
name: 'userfile',
|
||||
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
|
||||
onComplete: function(file,response) {
|
||||
location = baseurl + "/fbrowser/image/?mode=minimal";
|
||||
location.reload(true);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if ($("#upload-file").length)
|
||||
var file_uploader = new window.AjaxUpload(
|
||||
'upload-file',
|
||||
{ action: 'wall_attach/{{$nickname}}',
|
||||
name: 'userfile',
|
||||
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
|
||||
onComplete: function(file,response) {
|
||||
location = baseurl + "/fbrowser/file/?mode=minimal";
|
||||
location.reload(true); }
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -142,11 +142,11 @@ function enableOnUser(){
|
|||
**/
|
||||
|
||||
/* callback */
|
||||
$('body').on('fbrowser.image', function(e, filename, embedcode) {
|
||||
$('body').on('fbrowser.image', function(e, filename, embedcode, id) {
|
||||
$.colorbox.close();
|
||||
addeditortext(embedcode);
|
||||
});
|
||||
$('body').on('fbrowser.file', function(e, filename, embedcode) {
|
||||
$('body').on('fbrowser.file', function(e, filename, embedcode, id) {
|
||||
$.colorbox.close();
|
||||
addeditortext(embedcode);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue