290420 New theme, personal settings and bugfixes
This commit is contained in:
@ -382,68 +382,68 @@ $query = http_build_query(array_filter(array(
|
||||
});
|
||||
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
};
|
||||
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');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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();
|
||||
} );
|
||||
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('');
|
||||
}
|
||||
|
||||
/*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)');
|
||||
}
|
||||
}
|
||||
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('');
|
||||
}
|
||||
|
||||
/*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)');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function upload_files() {
|
||||
$("#postform .status").html('<span id="loading" class="animate-spin fontello"></span>');
|
||||
|
Reference in New Issue
Block a user