Zeile 1 | Zeile 1 |
---|
var Post = { init: function() {
|
var Post = { init: function() {
|
$(document).ready(function(){
| $(function() { Post.initAttachments();
|
}); },
| }); },
|
Zeile 14 | Zeile 16 |
---|
$.ajax( { url: 'xmlhttp.php?action=get_multiquoted&tid='+tid,
|
$.ajax( { url: 'xmlhttp.php?action=get_multiquoted&tid='+tid,
|
type: 'get', complete: function (request, status)
| type: 'get', complete: function (request, status)
|
{ Post.multiQuotedLoaded(request, status); }
| { Post.multiQuotedLoaded(request, status); }
|
Zeile 53 | Zeile 55 |
---|
multiQuotedLoaded: function(request) {
|
multiQuotedLoaded: function(request) {
|
var json = $.parseJSON(request.responseText);
| var json = JSON.parse(request.responseText);
|
if(typeof response == 'object') { if(json.hasOwnProperty("errors"))
|
if(typeof response == 'object') { if(json.hasOwnProperty("errors"))
|
{
| {
|
$.each(json.errors, function(i, message) {
|
$.each(json.errors, function(i, message) {
|
$.jGrowl(lang.post_fetch_error + ' ' + message);
| $.jGrowl(lang.post_fetch_error + ' ' + message, {theme:'jgrowl_error'});
|
}); return false; }
|
}); return false; }
|
}
| }
|
var id = 'message';
|
var id = 'message';
|
if(typeof $('textarea').sceditor != 'undefined') { $('textarea').sceditor('instance').insert(json.message);
| if(typeof MyBBEditor !== 'undefined' && MyBBEditor !== null) { MyBBEditor.insert(json.message);
|
} else { if($('#' + id).value)
|
} else { if($('#' + id).value)
|
{
| {
|
$('#' + id).value += "\n"; } $('#' + id).val($('#' + id).val() + json.message);
| $('#' + id).value += "\n"; } $('#' + id).val($('#' + id).val() + json.message);
|
Zeile 92 | Zeile 94 |
---|
removeAttachment: function(aid) {
|
removeAttachment: function(aid) {
|
$.prompt(removeattach_confirm, {
| MyBB.prompt(removeattach_confirm, {
|
buttons:[ {title: yes_confirm, value: true}, {title: no_confirm, value: false}
| buttons:[ {title: yes_confirm, value: true}, {title: no_confirm, value: false}
|
Zeile 103 | Zeile 105 |
---|
document.input.attachmentaid.value = aid; document.input.attachmentact.value = "remove";
|
document.input.attachmentaid.value = aid; document.input.attachmentact.value = "remove";
|
$("form#editpost").submit();
| var form = $('input[name^=\'rem\']').parents('form');
if(use_xmlhttprequest != 1) { form.append('<input type="submit" id="rem_submit" class="hidden" />'); $('#rem_submit').trigger('click'); return false; }
$.ajax({ type: 'POST', url: form.attr('action') + '&ajax=1', data: form.serialize(), success: function(data) { if(data.hasOwnProperty("errors")) { $.each(data.errors, function(i, message) { $.jGrowl(lang.post_fetch_error + ' ' + message, {theme:'jgrowl_error'}); }); return false; } else if (data.success) { $('#attachment_'+aid).hide(500, function() { var instance = MyBBEditor; if(typeof MyBBEditor === 'undefined') { instance = $('#message').sceditor('instance'); }
if(instance.sourceMode()) { instance.setSourceEditorValue(instance.getSourceEditorValue(false).split('[attachment=' + aid + ']').join('')); } else { instance.setWysiwygEditorValue(instance.getWysiwygEditorValue(false).split('[attachment=' + aid + ']').join('')); }
$(this).remove(); }); } document.input.attachmentaid.value = ''; document.input.attachmentact.value = ''; } });
|
}
|
}
|
else { document.input.attachmentaid.value = 0; document.input.attachmentact.value = ""; } } });
| } });
|
return false;
|
return false;
|
},
| },
|
attachmentAction: function(aid,action) { document.input.attachmentaid.value = aid; document.input.attachmentact.value = action;
|
attachmentAction: function(aid,action) { document.input.attachmentaid.value = aid; document.input.attachmentact.value = action;
|
| },
initAttachments: function() { $('form').on('submit', Post.checkAttachments); },
checkAttachments: function() { var files = $("input[type='file']"); var file = files.get(0); if (!file) { return true; }
if (file.files.length > php_max_file_uploads && php_max_file_uploads != 0) { alert(lang.attachment_too_many_files.replace('{1}', php_max_file_uploads)); file.value=""; return false; }
var totalSize = 0; files.each(function() { for (var i = 0; i < this.files.length; i++) { totalSize += this.files[i].size; } });
if (totalSize > php_max_upload_size && php_max_upload_size > 0) { var php_max_upload_size_pretty = Math.round(php_max_upload_size / 1e4) / 1e2; alert(lang.attachment_too_big_upload.replace('{1}', php_max_upload_size_pretty)); file.value=""; return false; }
return true;
|
} };
| } };
|