2020-04-01 00:46:27 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php include "layout/sidebar.php"; ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
$query = http_build_query(array_filter(array(
|
|
|
|
//'instance' => ($instance == true ? $instance : false) ,
|
|
|
|
'user' => (isset($tl['user']) == true ? $tl['user'] : false) ,
|
|
|
|
'mode' => $tl['mode'],
|
|
|
|
//'explicit' => ($nocookies == true ? $user_settings['explicit'] : false) ,
|
|
|
|
)));
|
|
|
|
?>
|
2020-05-06 16:48:21 +00:00
|
|
|
<div class="mobile" style="display:block; height:50px;"></div>
|
2020-04-01 00:46:27 +00:00
|
|
|
<script src="vendor/jquery.min.js"></script>
|
|
|
|
<script src="vendor/jqueryui.js"></script>
|
|
|
|
<script src="js/scripts.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
window.setInterval(function() {
|
|
|
|
$( ".post > .replies_container" ).each(function() {
|
|
|
|
var len = $(this).find('.reply').length;
|
|
|
|
if(len > 0){
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
var last = $(this).find('.reply').last().attr('id');
|
|
|
|
$.get("action.php?a=true&replies=" + id + "&since="+last, function(data) {
|
|
|
|
if (data !== ''){
|
|
|
|
$( ".post > #"+id+".replies_container" ).append(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}, 15000);
|
|
|
|
|
|
|
|
window.setInterval(function() {
|
|
|
|
var thread = getUrlParameter('thread');
|
|
|
|
if (typeof thread == 'undefined') {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$.get("action.php?a=true¬es=" + thread, function(data) {
|
|
|
|
$( ".post_notes" ).html(data);
|
|
|
|
});
|
|
|
|
}, 15000);
|
|
|
|
|
|
|
|
<?php if ($logedin): ?>
|
|
|
|
|
|
|
|
$('body').on('click', '.replyform', function(e) {
|
|
|
|
e.preventDefault;
|
2020-05-20 19:53:33 +00:00
|
|
|
$("#replyform").remove();
|
2020-04-01 00:46:27 +00:00
|
|
|
$(".element").removeClass("element_pad");
|
|
|
|
$(this).closest(".element").addClass("element_pad");
|
|
|
|
var id = $(this).parents().eq(1).attr('id');
|
2020-05-20 19:53:33 +00:00
|
|
|
var type = $(this).parents().eq(3).attr('mode').trim().replace(" ",".");
|
2020-04-01 00:46:27 +00:00
|
|
|
console.log(type);
|
|
|
|
$('#replyform').remove();
|
|
|
|
var data = JSON.parse(document.getElementById('data-' + id).innerHTML);
|
|
|
|
$.get("action.php?a=true&themefile=templates/replyform.txt", function(result) {
|
|
|
|
result = result.replace(":content:", data.mentions)
|
|
|
|
result = result.replace(":id:", data.id)
|
2020-05-20 19:53:33 +00:00
|
|
|
|
|
|
|
if(type == 'post'){
|
|
|
|
$('.'+type).find('#' + id+'.replies_container').prepend(result);
|
|
|
|
} else {
|
|
|
|
$('#' + id+'.'+type).after(result);
|
|
|
|
}
|
2020-04-01 00:46:27 +00:00
|
|
|
$('#replyform #' + data.scope).prop('selected', true);
|
|
|
|
$('#' + id).fadeIn(400);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.compose', function(e) {
|
|
|
|
$('#postform').toggle();
|
|
|
|
});
|
2020-04-13 16:30:51 +00:00
|
|
|
|
2020-04-23 01:25:00 +00:00
|
|
|
$('body').on('click', '.polloption:not(.fixed)', function(e) {
|
|
|
|
if (typeof $(this).parent().attr('multiple') == 'undefined'){
|
|
|
|
$('.polloption').removeClass('voted');
|
|
|
|
}
|
|
|
|
$(this).toggleClass('voted');
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.vote', function(e) {
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
var c = 0;
|
|
|
|
var choice = [];
|
|
|
|
$('#'+id+'.poll .polloption').each(function(a){
|
|
|
|
if ($(this).hasClass('voted')){
|
|
|
|
console.log(c);
|
|
|
|
choice.push(c);
|
|
|
|
}
|
|
|
|
c++;
|
|
|
|
});
|
|
|
|
var choices = choice.join(',');
|
|
|
|
console.log(choices);
|
|
|
|
$.get("action.php?a=true&vote="+id+"&choices="+choices, function(result) {
|
|
|
|
$('#'+id+'.poll').html(result);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-04-13 16:30:51 +00:00
|
|
|
$('body').on('click', '.searchform', function(e) {
|
|
|
|
$(this).prev().toggle();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.searchmobiletoggle', function(e) {
|
|
|
|
$('#usermenu').off('hover');
|
|
|
|
$('#usermenu').off('active');
|
|
|
|
$('#searchmobile').toggle();
|
|
|
|
});
|
2020-04-01 00:46:27 +00:00
|
|
|
|
|
|
|
$("body").on("keydown", "form", function (e) {
|
|
|
|
if (e.ctrlKey && e.keyCode === 13) {
|
|
|
|
$(this).find('input[type="submit"]').click();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-04-13 16:30:51 +00:00
|
|
|
$('.tlicon').click(function(){
|
|
|
|
$('.tlicon').each(function(a){
|
2020-04-01 00:46:27 +00:00
|
|
|
$( this ).removeClass('tiselected')
|
|
|
|
});
|
|
|
|
$( this ).addClass('tiselected');
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '#send', function() {
|
|
|
|
var form = $(this).closest('.form');
|
|
|
|
$(form).find(".status").html('<span id="loading" class="animate-spin fontello"></span>');
|
|
|
|
var status = $(form).find('textarea').val()
|
|
|
|
var sensitive = $(form).find('input[name=sensitive]').prop('checked');
|
|
|
|
var spoiler = $(form).find('input[name=spoiler]').val();
|
|
|
|
var scope = $(form).find('select[name=scope]').val();
|
|
|
|
var thread = $(form).find('input[name=thread]').val();
|
|
|
|
var IDs = [];
|
|
|
|
$(form).find(".uploadedImage").each(function(){ IDs.push(this.id); });
|
|
|
|
var uploaded = IDs.join("|");
|
|
|
|
$.post("action.php", {
|
|
|
|
status: status,
|
|
|
|
scope: scope,
|
|
|
|
thread: thread,
|
|
|
|
uploaded: uploaded,
|
|
|
|
spoiler: spoiler,
|
|
|
|
sensitive: sensitive
|
|
|
|
},
|
|
|
|
function(data) {
|
2020-04-10 01:16:32 +00:00
|
|
|
$(form).closest('.element').find(".picker").css("display","none");
|
2020-04-01 00:46:27 +00:00
|
|
|
if($(form).closest('.element').attr('id') == 'postform'){
|
|
|
|
$(form).find('textarea').val('');
|
|
|
|
$(form).find('.uploadBox').remove();
|
|
|
|
$(form).find('input[name=sensitive]').prop('checked', false);
|
|
|
|
$(form).find(".status").html('');
|
|
|
|
$(form).find('input[name=spoiler]').val('');
|
|
|
|
newPosts();
|
|
|
|
} else {
|
|
|
|
var parent = $(form).closest('.element').find('.post').first().attr('id');
|
|
|
|
$('#replyform').remove();
|
|
|
|
$('#'+parent+'.replies_container').append(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.quickreply', function(e) {
|
|
|
|
$(".notif.form").remove();
|
|
|
|
$(this).closest('.notif').after('<div class="notif form"><div class="notifContents"><input type="hidden" name="thread" value="'+$(this).attr('id')+'"><input type="hidden" name="mentions" value="'+$(this).attr('data-mentions')+'"><textarea style="width:100%; height100%; border: 1px solid #ddd;"></textarea><input type="submit" id="quicksend" value="Send"></div></div>');
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '#quicksend', function() {
|
|
|
|
|
|
|
|
var form = $('#quicksend').closest('.form');
|
|
|
|
var thread = $(form).find('input[name=thread]').val();
|
|
|
|
var mentions = $(form).find('input[name=mentions]').val();
|
|
|
|
var status = mentions + $(form).find('textarea').val();
|
|
|
|
$(".notif.form").html('<span id="loading" class="animate-spin fontello"></span>');
|
|
|
|
|
|
|
|
$.post("action.php", {
|
|
|
|
status: status,
|
|
|
|
thread: thread,
|
|
|
|
},
|
|
|
|
function(data) {
|
|
|
|
$(".notif.form").remove();
|
|
|
|
notificaton('Reply Sent!');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.badge', function() {
|
|
|
|
$('#notifications').toggle();
|
|
|
|
var notif = $('#hiddenside').children().first().attr('id');
|
|
|
|
localStorage.setItem("notif", notif);
|
|
|
|
$('#notifications').find('.container').children().removeClass('new');
|
|
|
|
$('.alert').css('display','none');
|
|
|
|
var title = document.title;
|
|
|
|
document.title = title.replace("(*)", "");
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.notif .ldr', function(e) {
|
|
|
|
$('#notifications').find('.container').children().removeClass('new');
|
|
|
|
$('#notifications').css('display','none');
|
|
|
|
$('.alert').css('display','none');
|
|
|
|
var title = document.title;
|
|
|
|
document.title = title.replace("(*)", "");
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.nloadmore', function() {
|
|
|
|
var n = $('#notifications').find('.container').children().last().attr('id');
|
|
|
|
$('#notifications').find('.container').children().last().after('<span id="loading" class="animate-spin fontello" style="color:black;"></span>');
|
|
|
|
$.get("action.php?a=true&max=true¬if=" + n, function(data) {
|
|
|
|
$('#loading').remove();
|
|
|
|
$('#notifications').find('.container').append(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
window.setInterval(function() {
|
|
|
|
var n = localStorage.getItem("notif");
|
|
|
|
var f = $("#notifications").find('.container').children().first().attr('id');
|
|
|
|
var nf;
|
|
|
|
if (n < f) {
|
|
|
|
nf = n;
|
|
|
|
//$("#notifications").html('');
|
|
|
|
} else {
|
|
|
|
nf = f;
|
|
|
|
}
|
|
|
|
$.get("action.php?a=true¬if=" + f, function(data) {
|
|
|
|
if (data) {
|
|
|
|
var title = document.getElementsByTagName("title")[0].innerHTML;
|
|
|
|
if (title.indexOf("(*)") < 0) {
|
|
|
|
document.getElementsByTagName("title")[0].innerHTML = "(*) " + title;
|
|
|
|
}
|
|
|
|
$('#notifications').find('.container').prepend(data);
|
|
|
|
var cnt = $('#notifications .container div.new').length;
|
|
|
|
var notif = $('#hiddenside').children().first().attr('id');
|
|
|
|
localStorage.setItem("notif", notif);
|
|
|
|
$.when($('#hiddenside').html('')).then(function() {
|
|
|
|
$('.alert').css('display','block');
|
|
|
|
$('#hiddenside').append(data);
|
|
|
|
$('#hiddenside').children().each(function(index) {
|
|
|
|
$(this).delay(4000 + (1000 * index)).fadeOut("slow");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}, 15000);
|
|
|
|
|
|
|
|
function notificaton(message){
|
|
|
|
var notif = "<div class='notif error' style='border-left:3px solid red; background-color:pink;'> <div class='notifContents'> <div style='flex: 0 0 60px; background-size:cover; border-radius:5px;'></div> <div style='flex: 1; padding-left:5px; padding-right:5px; word-break: break-all; overflow:hidden;'> <span>"+message+"</span> </div> </div> </div>";
|
|
|
|
$('#hiddenside').append(notif);
|
|
|
|
$('#hiddenside').children().each(function(index) {
|
|
|
|
$(this).delay(4000 + (1000 * index)).fadeOut("slow");
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
$('body').on('click', '.fav', function(e) {
|
|
|
|
e.preventDefault;
|
|
|
|
var id = $(this).parents().eq(1).attr('id');
|
|
|
|
$("#"+id+".post_buttons .fav").switchClass("fav","unfav",200);
|
|
|
|
$.get("action.php?a=true&mode=on&fav=" + id, function(data) {
|
|
|
|
if (data == 'error') {
|
|
|
|
$("#"+id+".post_buttons .unfav").switchClass("unfav","fav",200);
|
|
|
|
} else {
|
|
|
|
$("#"+id+".post_buttons .unfav").children().html(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.unfav', function(e) {
|
|
|
|
e.preventDefault;
|
|
|
|
var id = $(this).parents().eq(1).attr('id');
|
|
|
|
$("#"+id+".post_buttons .unfav").switchClass("unfav","fav",200);
|
|
|
|
$.get("action.php?a=true&mode=off&fav=" + id, function(data) {
|
|
|
|
if (data == 'error') {
|
|
|
|
$("#"+id+".post_buttons .fav").switchClass("fav","unfav",200);
|
|
|
|
} else {
|
|
|
|
$("#"+id+".post_buttons .fav").children().html(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.reblog', function(e) {
|
|
|
|
e.preventDefault;
|
|
|
|
var id = $(this).parents().eq(1).attr('id');
|
|
|
|
$("#"+id+".post_buttons .reblog").switchClass("reblog","unreblog",200);
|
|
|
|
$.get("action.php?a=true&mode=on&reblog=" + id, function(data) {
|
|
|
|
if (data == 'error') {
|
|
|
|
$("#"+id+".post_buttons .unreblog").switchClass("unreblog","reblog",200);
|
|
|
|
} else {
|
|
|
|
$("#"+id+".post_buttons .unreblog").children().html(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.unreblog', function(e) {
|
|
|
|
e.preventDefault;
|
|
|
|
var id = $(this).parents().eq(1).attr('id');
|
|
|
|
$("#"+id+".post_buttons .unreblog").switchClass("unreblog","reblog",200);
|
|
|
|
$.get("action.php?a=true&mode=off&reblog=" + id, function(data) {
|
|
|
|
if (data == 'error') {
|
|
|
|
$("#"+id+".post_buttons .reblog").switchClass("reblog","unreblog",200);
|
|
|
|
} else {
|
|
|
|
$("#"+id+".post_buttons .reblog").children().html(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.mute', function() {
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
$.get("action.php?a=true&mode=true&mute=" + id, function(data) {
|
|
|
|
$('#' + id + '.mute').switchClass("mute","unmute",200);
|
|
|
|
$('#' + id + '.unmute').html('Unmute');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.unmute', function() {
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
$.get("action.php?a=true&mode=off&mute=" + id, function(data) {
|
|
|
|
$('#' + id + '.unmute').switchClass("unmute","mute",200);
|
|
|
|
$('#' + id + '.mute').html('Mute');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.muteconv', function() {
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
$.get("action.php?a=true&mode=true&thread=true&mute=" + id, function(data) {
|
|
|
|
$('#' + id + '.muteconv').switchClass("muteconv","unmuteconv",200);
|
|
|
|
$('#' + id + '.unmuteconv').html('Unmute Thread');
|
|
|
|
console.log(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.unmuteconv', function() {
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
$.get("action.php?a=true&mode=off&thread=true&mute=" + id, function(data) {
|
|
|
|
$('#' + id + '.muteconv').switchClass("unmuteconv","muteconv",200);
|
|
|
|
$('#' + id + '.muteconv').html('Mute Thread');
|
|
|
|
console.log(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.menu', function(e) {
|
|
|
|
$(this).next('span').slideToggle('left');
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.delete', function(e) {
|
|
|
|
e.preventDefault;
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
var post = $('#'+id+'.post').parent();
|
|
|
|
var reply = $('#'+id+'.reply');
|
|
|
|
$.get("action.php?a=true&delete=" + id, function(data) {
|
|
|
|
if (data == '0') {
|
|
|
|
post.css('opacity','0.5');
|
|
|
|
reply.css('opacity','0.5');
|
|
|
|
} else {
|
|
|
|
$.when(post.fadeOut('slow')).then(function(){
|
|
|
|
post.remove();
|
|
|
|
reply.remove();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.delete', function(e) {
|
|
|
|
e.preventDefault;
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
$.get("action.php?a=true&bookmark=" + id, function(data) {
|
|
|
|
notificaton('Post bookmarked!');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.quote', function(e) {
|
|
|
|
e.preventDefault;
|
|
|
|
var id = $(this).closest('.post').attr('id');
|
|
|
|
console.log(id);
|
|
|
|
var url = $("#"+id+".post .original").attr("href");
|
|
|
|
console.log(url);
|
|
|
|
$("#postform").find('textarea').val("> "+url+"\n\n");
|
|
|
|
if ($("#postform").is(':visible')) {
|
|
|
|
location.hash = "#top";
|
|
|
|
} else {
|
|
|
|
$('#postform').toggle();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('body').on('click', '.delpic', function(e) {
|
|
|
|
var count = $(this).closest('#files').children().length;
|
|
|
|
if (count == 1){
|
|
|
|
$(this).closest('.uploadBox').remove();
|
|
|
|
} else {
|
|
|
|
count = count - 1;
|
|
|
|
$(this).parent().fadeOut();
|
|
|
|
$(this).parent().remove();
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2020-04-29 17:29:25 +00:00
|
|
|
document.onpaste = function (event) {
|
|
|
|
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
|
|
|
/*Make Sure Only One File is Copied*/
|
|
|
|
if (items.length != 1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var item = items[0];
|
|
|
|
/*Verify If The Copied Item is File*/
|
|
|
|
if (item.kind === 'file') {
|
|
|
|
var file = item.getAsFile();
|
|
|
|
var filename = file.name;
|
|
|
|
/*Get File Extension*/
|
|
|
|
var ext = filename.split('.').reverse()[0].toLowerCase();
|
|
|
|
/*Check Image File Extensions*/
|
|
|
|
if (jQuery.inArray(ext, ['jpg', 'png']) > -1) {
|
|
|
|
/*Create FormData Instance*/
|
|
|
|
var data = new FormData();
|
|
|
|
data.append('file', file);
|
|
|
|
/*Request Ajax With File*/
|
|
|
|
request_ajax_file('upload.php', data, file_uploaded);
|
|
|
|
} else {
|
|
|
|
alert('Invalid File');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2020-04-01 00:46:27 +00:00
|
|
|
|
2020-04-29 17:29:25 +00:00
|
|
|
function file_uploaded(data) {
|
|
|
|
if ($("#postform .uploadBox").length < 1){
|
|
|
|
$("#postform #status").before('<div class="uploadBox"><ul id="files" style="margin:0px;"></ul></div>');
|
|
|
|
$( function() {
|
|
|
|
$( "#files" ).sortable();
|
|
|
|
$( "#files" ).disableSelection();
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
var files = JSON.parse(data);
|
|
|
|
$.each(files, function( index, elem ) {
|
|
|
|
$("#files").append('<li class="uploadedImage" id="'+elem[0]+'" style="position:relative; background-image:url('+elem[1]+')"><div class="fontello delpic"></div></li>');
|
|
|
|
});
|
|
|
|
var nfiles = $("#postform .uploadBox").children().length;
|
|
|
|
$("#postform .status").html('');
|
|
|
|
}
|
2020-04-01 00:46:27 +00:00
|
|
|
|
2020-04-29 17:29:25 +00:00
|
|
|
/*Function to Make AJAX Request With File*/
|
|
|
|
function request_ajax_file(ajax_url, ajax_data, ajax_callback) {
|
|
|
|
$("#postform .status").html('<span id="loading" class="animate-spin fontello"></span>');
|
|
|
|
jQuery.ajax({
|
|
|
|
url: ajax_url,
|
|
|
|
data: ajax_data,
|
|
|
|
type: 'POST',
|
|
|
|
processData: false,
|
|
|
|
contentType: false,
|
|
|
|
success: function (response) {
|
|
|
|
if (typeof ajax_callback == 'function') {
|
|
|
|
ajax_callback(response);
|
|
|
|
} else if (typeof ajax_callback == 'string') {
|
|
|
|
if (ajax_callback != '') {
|
|
|
|
eval(ajax_callback + '(response)');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-04-01 00:46:27 +00:00
|
|
|
|
|
|
|
function upload_files() {
|
|
|
|
$("#postform .status").html('<span id="loading" class="animate-spin fontello"></span>');
|
|
|
|
var fileUpload = $("#files_input_field").get(0);
|
|
|
|
var files = fileUpload.files;
|
|
|
|
if (files.length == 0) return;
|
|
|
|
|
|
|
|
var data = new FormData();
|
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
|
|
data.append(files[i].name, files[i]);
|
|
|
|
}
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "upload.php",
|
|
|
|
contentType: false, //default: 'application/x-www-form-urlencoded; charset=UTF-8'
|
|
|
|
processData: false, //default: data, other DOMDocument
|
|
|
|
data: data, //Type: PlainObject or String or Array
|
|
|
|
success: function(data) {
|
|
|
|
if ($("#postform .uploadBox").length < 1){
|
|
|
|
$("#postform #status").before('<div class="uploadBox"><ul id="files" style="margin:0px;"></ul></div>');
|
|
|
|
$( function() {
|
|
|
|
$( "#files" ).sortable();
|
|
|
|
$( "#files" ).disableSelection();
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
var files = JSON.parse(data);
|
|
|
|
$.each(files, function( index, elem ) {
|
|
|
|
$("ul[id=files]").append('<li class="uploadedImage" id="'+elem[0]+'" style="position:relative; background-image:url('+elem[1]+')"><div class="fontello delpic"></div></li>');
|
|
|
|
});
|
|
|
|
var nfiles = $("#postform .uploadBox").children().length;
|
|
|
|
$("#postform .status").html('');
|
|
|
|
},
|
|
|
|
error: function(jqXHR,e) {
|
|
|
|
console.log(jqXHR);
|
|
|
|
alert("There was error uploading files! "+e);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function upload_files_reply() {
|
|
|
|
$("#replyform .status").html('<span id="loading" class="animate-spin fontello"></span>');
|
|
|
|
var fileUpload = $("#replyform #files_input_field").get(0);
|
|
|
|
var files = fileUpload.files;
|
|
|
|
if (files.length == 0) return;
|
|
|
|
|
|
|
|
var data = new FormData();
|
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
|
|
data.append(files[i].name, files[i]);
|
|
|
|
}
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "upload.php",
|
|
|
|
contentType: false, //default: 'application/x-www-form-urlencoded; charset=UTF-8'
|
|
|
|
processData: false, //default: data, other DOMDocument
|
|
|
|
data: data, //Type: PlainObject or String or Array
|
|
|
|
success: function(data) {
|
|
|
|
if ($("#replyform .uploadBox").length < 1){
|
|
|
|
$("#replyform #status").before('<div class="uploadBox"><ul id="files" style="margin:0px;"></ul></div>');
|
|
|
|
$( function() {
|
|
|
|
$( "#files" ).sortable();
|
|
|
|
$( "#files" ).disableSelection();
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
var files = JSON.parse(data);
|
|
|
|
$.each(files, function( index, elem ) {
|
|
|
|
$("#replyform #files").append('<li class="uploadedImage" id="'+elem[0]+'" style="position:relative; background-image:url('+elem[1]+')"><div class="fontello delpic"></div></li>');
|
|
|
|
});
|
|
|
|
var nfiles = $("#replyform .uploadBox").children().length;
|
|
|
|
$("#replyform .status").html('');
|
|
|
|
},
|
|
|
|
error: function() {
|
|
|
|
alert("There was error uploading files!");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|