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) { Post.multiQuotedLoaded(request, status); } }); return false; } else { return true; } },
| type: 'get', complete: function (request, status) { Post.multiQuotedLoaded(request, status); } }); return false; } else { return true; } },
|
loadMultiQuotedAll: function() { if(use_xmlhttprequest == 1)
| loadMultiQuotedAll: function() { if(use_xmlhttprequest == 1)
|
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"))
|
Zeile 67 | Zeile 69 |
---|
}
var id = 'message';
|
}
var id = 'message';
|
if(typeof $('textarea').sceditor != 'undefined')
| if(typeof MyBBEditor !== 'undefined' && MyBBEditor !== null)
|
{
|
{
|
$('textarea').sceditor('instance').insert(json.message);
| MyBBEditor.insert(json.message);
|
} else
|
} else
|
{
| {
|
if($('#' + id).value) { $('#' + id).value += "\n";
| if($('#' + id).value) { $('#' + id).value += "\n";
|
Zeile 85 | Zeile 87 |
---|
}, clearMultiQuoted: function()
|
}, clearMultiQuoted: function()
|
{
| {
|
$('#multiquote_unloaded').hide(); Cookie.unset('multiquote'); }, removeAttachment: function(aid) {
|
$('#multiquote_unloaded').hide(); Cookie.unset('multiquote'); }, 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";
|
$("input[name=rem]").parents('form').append('<input type="submit" id="rem_submit" class="hidden" />'); $('#rem_submit').click();
| 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(); }); } } });
|
}
|
}
|
} });
| } });
|
return false;
|
return false;
|
},
| },
|
attachmentAction: function(aid,action)
|
attachmentAction: function(aid,action)
|
{
| {
|
document.input.attachmentaid.value = aid; document.input.attachmentact.value = 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;
|
} };
| } };
|