240921 Paste Upload and Default Visibility
This commit is contained in:
parent
7cdfd4e99e
commit
82e7743091
@ -59,6 +59,10 @@ if (isset($_POST['action']) && $_POST['action'] == "settings"){
|
|||||||
$user_settings['emoji'] = intval($value);
|
$user_settings['emoji'] = intval($value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "defscope":
|
||||||
|
$user_settings['defscope'] = intval($value);
|
||||||
|
break;
|
||||||
|
|
||||||
case "text":
|
case "text":
|
||||||
$user_settings['text'] = ($value == "on" ? "on" : "off");
|
$user_settings['text'] = ($value == "on" ? "on" : "off");
|
||||||
break;
|
break;
|
||||||
@ -71,6 +75,7 @@ if (isset($_POST['action']) && $_POST['action'] == "settings"){
|
|||||||
$user_settings['replies'] = ($value == "on" ? "on" : "off");
|
$user_settings['replies'] = ($value == "on" ? "on" : "off");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case "reblog":
|
case "reblog":
|
||||||
$user_settings['reblog'] = ($value == "on" ? "on" : "off");
|
$user_settings['reblog'] = ($value == "on" ? "on" : "off");
|
||||||
break;
|
break;
|
||||||
|
@ -393,31 +393,50 @@ $query = http_build_query(array_filter(array(
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
document.onpaste = function (event) {
|
/* paste to upload */
|
||||||
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
document.onpaste = function(event){
|
||||||
/*Make Sure Only One File is Copied*/
|
|
||||||
if (items.length != 1) {
|
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
||||||
return;
|
|
||||||
|
for (var i = 0 ; i < items.length ; i++) {
|
||||||
|
|
||||||
|
var item = items[i];
|
||||||
|
|
||||||
|
if (item.type.indexOf("image") != -1) {
|
||||||
|
|
||||||
|
var file = item.getAsFile();
|
||||||
|
console.log(file);
|
||||||
|
upload_file_with_ajax(file,file_uploaded);
|
||||||
}
|
}
|
||||||
var item = items[0];
|
}
|
||||||
/*Verify If The Copied Item is File*/
|
}
|
||||||
if (item.kind === 'file') {
|
|
||||||
var file = item.getAsFile();
|
function upload_file_with_ajax(file, ajax_callback){
|
||||||
var filename = file.name;
|
$("#postform .status").html('<span id="loading" class="animate-spin fontello"></span>');
|
||||||
/*Get File Extension*/
|
var formData = new FormData();
|
||||||
var ext = filename.split('.').reverse()[0].toLowerCase();
|
formData.append('file', file);
|
||||||
/*Check Image File Extensions*/
|
|
||||||
if (jQuery.inArray(ext, ['jpg', 'png']) > -1) {
|
$.ajax('./upload.php' , {
|
||||||
/*Create FormData Instance*/
|
|
||||||
var data = new FormData();
|
type: 'POST',
|
||||||
data.append('file', file);
|
contentType: false,
|
||||||
/*Request Ajax With File*/
|
processData: false,
|
||||||
request_ajax_file('upload.php', data, file_uploaded);
|
data: formData,
|
||||||
} else {
|
error: function() {
|
||||||
alert('Invalid File');
|
console.log("error");
|
||||||
|
},
|
||||||
|
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 file_uploaded(data) {
|
function file_uploaded(data) {
|
||||||
if ($("#postform .uploadBox").length < 1){
|
if ($("#postform .uploadBox").length < 1){
|
||||||
@ -435,26 +454,7 @@ $query = http_build_query(array_filter(array(
|
|||||||
$("#postform .status").html('');
|
$("#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() {
|
function upload_files() {
|
||||||
$("#postform .status").html('<span id="loading" class="animate-spin fontello"></span>');
|
$("#postform .status").html('<span id="loading" class="animate-spin fontello"></span>');
|
||||||
|
@ -245,10 +245,10 @@ endif; ?>
|
|||||||
</span>
|
</span>
|
||||||
<span style='float:right;' class="scope">
|
<span style='float:right;' class="scope">
|
||||||
<select name='scope' id='scope'>
|
<select name='scope' id='scope'>
|
||||||
<option value="1"> Public</option>
|
<option value="1" <?php echo ($user_settings['defscope'] == '1' ? "selected" : ""); ?>> Public</option>
|
||||||
<option value="2"> Unlisted</option>
|
<option value="2" <?php echo ($user_settings['defscope'] == '2' ? "selected" : ""); ?>> Unlisted</option>
|
||||||
<option value="3"> Private</option>
|
<option value="3" <?php echo ($user_settings['defscope'] == '3' ? "selected" : ""); ?>> Private</option>
|
||||||
<option value="4"> Direct</option>
|
<option value="4" <?php echo ($user_settings['defscope'] == '4' ? "selected" : ""); ?>> Direct</option>
|
||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,6 +44,17 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Timeline</legend>
|
<legend>Timeline</legend>
|
||||||
<?php if ($logedin): ?>
|
<?php if ($logedin): ?>
|
||||||
|
|
||||||
|
<h2>Default post vsibility</h2>
|
||||||
|
<div class="setting">
|
||||||
|
<select name='defscope' id='scope'>
|
||||||
|
<option value="1" <?php echo ($user_settings['defscope'] == '1' ? "selected" : ""); ?>> Public</option>
|
||||||
|
<option value="2" <?php echo ($user_settings['defscope'] == '2' ? "selected" : ""); ?>> Unlisted</option>
|
||||||
|
<option value="3" <?php echo ($user_settings['defscope'] == '3' ? "selected" : ""); ?>> Private</option>
|
||||||
|
<option value="4" <?php echo ($user_settings['defscope'] == '4' ? "selected" : ""); ?>> Direct</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2>Show replies</h2>
|
<h2>Show replies</h2>
|
||||||
<div class='setting'>
|
<div class='setting'>
|
||||||
<select name="replies">
|
<select name="replies">
|
||||||
|
Loading…
Reference in New Issue
Block a user