Vergleich jscripts/thread.js - 1.8.9 - 1.8.30

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1Zeile 1
var Thread = {
init: function()
{

var Thread = {
init: function()
{

		$(document).ready(function(){

		$(function(){

			Thread.quickEdit();
Thread.initQuickReply();
Thread.initMultiQuote();

			Thread.quickEdit();
Thread.initQuickReply();
Thread.initMultiQuote();

			



			// Set spinner image
$('#quickreply_spinner img').attr('src', spinner_image);
});

			// Set spinner image
$('#quickreply_spinner img').attr('src', spinner_image);
});

Zeile 40Zeile 40
		var new_post_ids = new Array();
var quoted = Cookie.get("multiquote");
var is_new = true;

		var new_post_ids = new Array();
var quoted = Cookie.get("multiquote");
var is_new = true;

		if(quoted)








		var deleted = false;
if($("#pid" + pid).next("div.post").hasClass('deleted_post'))
{
$.jGrowl(lang.post_deleted_error, {theme:'jgrowl_error'});
deleted = true;
}

if(quoted && !deleted)

		{
var post_ids = quoted.split("|");

$.each(post_ids, function(key, post_id) {
if(post_id != pid && post_id != '')

		{
var post_ids = quoted.split("|");

$.each(post_ids, function(key, post_id) {
if(post_id != pid && post_id != '')

				{

				{

					new_post_ids[new_post_ids.length] = post_id;

					new_post_ids[new_post_ids.length] = post_id;

				}

				}

				else if(post_id == pid)
{
is_new = false;
}
});

				else if(post_id == pid)
{
is_new = false;
}
});

		}


		}


		var mquote_a = $("#multiquote_"+pid).closest('a')

		var mquote_a = $("#multiquote_"+pid).closest('a')

		if(is_new == true)

		if(is_new == true && !deleted)

		{
new_post_ids[new_post_ids.length] = pid;
mquote_a.removeClass('postbit_multiquote').addClass('postbit_multiquote_on');

		{
new_post_ids[new_post_ids.length] = pid;
mquote_a.removeClass('postbit_multiquote').addClass('postbit_multiquote_on');

Zeile 66Zeile 73
		{
mquote_a.removeClass('postbit_multiquote_on').addClass('postbit_multiquote');
}

		{
mquote_a.removeClass('postbit_multiquote_on').addClass('postbit_multiquote');
}

		



		var mquote_quick = $('#quickreply_multiquote');
if(mquote_quick.length)
{
if(new_post_ids.length)
{
mquote_quick.show();

		var mquote_quick = $('#quickreply_multiquote');
if(mquote_quick.length)
{
if(new_post_ids.length)
{
mquote_quick.show();

			}

			}

			else
{
mquote_quick.hide();
}
}
Cookie.set("multiquote", new_post_ids.join("|"));

			else
{
mquote_quick.hide();
}
}
Cookie.set("multiquote", new_post_ids.join("|"));

	},


	},


	loadMultiQuoted: function()
{
if(use_xmlhttprequest == 1)

	loadMultiQuoted: function()
{
if(use_xmlhttprequest == 1)

Zeile 89Zeile 96
			// Spinner!
var mquote_spinner = $('#quickreply_spinner');
mquote_spinner.show();

			// Spinner!
var mquote_spinner = $('#quickreply_spinner');
mquote_spinner.show();





			$.ajax(
{
url: 'xmlhttp.php?action=get_multiquoted&load_all=1',

			$.ajax(
{
url: 'xmlhttp.php?action=get_multiquoted&load_all=1',

Zeile 97Zeile 104
				complete: function (request, status)
{
Thread.multiQuotedLoaded(request, status);

				complete: function (request, status)
{
Thread.multiQuotedLoaded(request, status);

					



					// Get rid of spinner
mquote_spinner.hide();
}
});

return false;

					// Get rid of spinner
mquote_spinner.hide();
}
});

return false;

		}
else
{

		}
else
{

			return true;
}
},

multiQuotedLoaded: function(request)
{

			return true;
}
},

multiQuotedLoaded: function(request)
{

		var json = $.parseJSON(request.responseText);

		var json = JSON.parse(request.responseText);

		if(typeof json == 'object')

		if(typeof json == 'object')

		{

		{

			if(json.hasOwnProperty("errors"))
{
$.each(json.errors, function(i, message)

			if(json.hasOwnProperty("errors"))
{
$.each(json.errors, function(i, message)

Zeile 123Zeile 130
					$.jGrowl(lang.post_fetch_error + ' ' + message, {theme:'jgrowl_error'});
});
return false;

					$.jGrowl(lang.post_fetch_error + ' ' + message, {theme:'jgrowl_error'});
});
return false;

			}

			}

		}


		}


		if(typeof $('textarea').sceditor != 'undefined')

		if(typeof MyBBEditor !== 'undefined' && MyBBEditor !== null)

		{

		{

			$('textarea').sceditor('instance').insert(json.message);

			MyBBEditor.insert(json.message);

		}
else
{

		}
else
{

Zeile 141Zeile 148
		}

Thread.clearMultiQuoted();

		}

Thread.clearMultiQuoted();

		$('#quickreply_multiquote').hide();

		$('#quickreply_multiquote').hide();

		$('#quoted_ids').val('all');


		$('#quoted_ids').val('all');


		$('#message').focus();

		$('#message').trigger('focus');

	},

clearMultiQuoted: function()

	},

clearMultiQuoted: function()

Zeile 158Zeile 165
			$.each(post_ids, function(key, post_id) {
var mquote_a = $("#multiquote_"+post_id).closest('a');
if(mquote_a.length)

			$.each(post_ids, function(key, post_id) {
var mquote_a = $("#multiquote_"+post_id).closest('a');
if(mquote_a.length)

				{

				{

					mquote_a.removeClass('postbit_multiquote_on').addClass('postbit_multiquote');
}
});

					mquote_a.removeClass('postbit_multiquote_on').addClass('postbit_multiquote');
}
});

Zeile 184Zeile 191
				rows: 12,
submit: lang.save_changes,
cancel: lang.cancel_edit,

				rows: 12,
submit: lang.save_changes,
cancel: lang.cancel_edit,

 
				placeholder: "",

				event: "edit" + pid, // Triggered by the event "edit_[pid]",
onblur: "ignore",
dataType: "json",
submitdata: function (values, settings)

				event: "edit" + pid, // Triggered by the event "edit_[pid]",
onblur: "ignore",
dataType: "json",
submitdata: function (values, settings)

				{
id = $(this).attr('id');
pid = id.replace( /[^\d.]/g, '');


				{
id = $(this).attr('id');
pid = id.replace( /[^\d.]/g, '');
$("#quickedit_" + pid + "_editreason_original").val($("#quickedit_" + pid + "_editreason").val());

					return {
editreason: $("#quickedit_" + pid + "_editreason").val()
}

					return {
editreason: $("#quickedit_" + pid + "_editreason").val()
}

Zeile 199Zeile 208
				{
id = $(this).attr('id');
pid = id.replace( /[^\d.]/g, '');

				{
id = $(this).attr('id');
pid = id.replace( /[^\d.]/g, '');

					
var json = $.parseJSON(values);


var json = JSON.parse(values);

					if(typeof json == 'object')
{
if(json.hasOwnProperty("errors"))

					if(typeof json == 'object')
{
if(json.hasOwnProperty("errors"))

Zeile 208Zeile 217
							$(".jGrowl").jGrowl("close");

$.each(json.errors, function(i, message)

							$(".jGrowl").jGrowl("close");

$.each(json.errors, function(i, message)

							{

							{

								$.jGrowl(lang.quick_edit_update_error + ' ' + message, {theme:'jgrowl_error'});
});
$(this).html($('#pid_' + pid + '_temp').html());
}
else if(json.hasOwnProperty("moderation_post"))

								$.jGrowl(lang.quick_edit_update_error + ' ' + message, {theme:'jgrowl_error'});
});
$(this).html($('#pid_' + pid + '_temp').html());
}
else if(json.hasOwnProperty("moderation_post"))

						{
$(".jGrowl").jGrowl("close");


						{
$(".jGrowl").jGrowl("close");


							$(this).html(json.message);

// No more posts on this page? (testing for "1" as the last post would be removed here)

							$(this).html(json.message);

// No more posts on this page? (testing for "1" as the last post would be removed here)

Zeile 224Zeile 233
							{
alert(json.moderation_post);
window.location = json.url;

							{
alert(json.moderation_post);
window.location = json.url;

							}

							}

							else
{
$.jGrowl(json.moderation_post, {theme:'jgrowl_success'});

							else
{
$.jGrowl(json.moderation_post, {theme:'jgrowl_success'});

Zeile 232Zeile 241
							}
}
else if(json.hasOwnProperty("moderation_thread"))

							}
}
else if(json.hasOwnProperty("moderation_thread"))

						{

						{

							$(".jGrowl").jGrowl("close");

							$(".jGrowl").jGrowl("close");





							$(this).html(json.message);

							$(this).html(json.message);

							



							alert(json.moderation_thread);

							alert(json.moderation_thread);

							



							// Redirect user to forum
window.location = json.url;

							// Redirect user to forum
window.location = json.url;

						}	

						}

						else
{
// Change html content

						else
{
// Change html content

Zeile 259Zeile 268
				}
});
});

				}
});
});





		$('.quick_edit_button').each(function()
{
$(this).on("click", function(e)

		$('.quick_edit_button').each(function()
{
$(this).on("click", function(e)

Zeile 269Zeile 278
				// Take pid out of the id attribute
id = $(this).attr('id');
pid = id.replace( /[^\d.]/g, '');

				// Take pid out of the id attribute
id = $(this).attr('id');
pid = id.replace( /[^\d.]/g, '');

 
				if($("#pid" + pid).next("div.post").hasClass('deleted_post'))
{
$.jGrowl(lang.post_deleted_error, {theme:'jgrowl_error'});
return false;
}


// Create a copy of the post
if($('#pid_' + pid + '_temp').length == 0)
{
$('#pid_' + pid).clone().attr('id','pid_' + pid + '_temp').appendTo("body").hide();


// Create a copy of the post
if($('#pid_' + pid + '_temp').length == 0)
{
$('#pid_' + pid).clone().attr('id','pid_' + pid + '_temp').appendTo("body").hide();

				}


				}


				// Trigger the edit event
$('#pid_' + pid).trigger("edit" + pid);


				// Trigger the edit event
$('#pid_' + pid).trigger("edit" + pid);


Zeile 283Zeile 297
				$('#pid_' + pid + ' textarea').attr('id', 'quickedit_' + pid);
if(allowEditReason == 1 && $('#quickedit_' + pid + '_editreason').length == 0)
{

				$('#pid_' + pid + ' textarea').attr('id', 'quickedit_' + pid);
if(allowEditReason == 1 && $('#quickedit_' + pid + '_editreason').length == 0)
{

					$('#quickedit_' + pid).after('<label for="editreason">' + lang.editreason + ':</label> <input type="text" class="textbox" style="margin: 6px 0;" name="editreason" size="40" maxlength="150" id="quickedit_' + pid + '_editreason" /><br />');



					edit_el = $('#editreason_' + pid + '_original').clone().attr('id','editreason_' + pid);
edit_el.children('#quickedit_' + pid + '_editreason_original').attr('id','quickedit_' + pid + '_editreason');
edit_el.insertAfter('#quickedit_' + pid).show();

				}
});
});

				}
});
});

Zeile 292Zeile 308
	},

initQuickReply: function()

	},

initQuickReply: function()

	{

	{

		if($('#quick_reply_form').length && use_xmlhttprequest == 1)
{
// Bind closing event to our popup menu

		if($('#quick_reply_form').length && use_xmlhttprequest == 1)
{
// Bind closing event to our popup menu

			$('#quick_reply_submit').bind('click', function(e) {

			$('#quick_reply_submit').on('click', function(e) {

				return Thread.quickReply(e);
});

				return Thread.quickReply(e);
});

		}
},


		}
},


	quickReply: function(e)
{
e.stopPropagation();

	quickReply: function(e)
{
e.stopPropagation();

Zeile 313Zeile 329

this.quick_replying = 1;
var post_body = $('#quick_reply_form').serialize();


this.quick_replying = 1;
var post_body = $('#quick_reply_form').serialize();

		



		// Spinner!
var qreply_spinner = $('#quickreply_spinner');
qreply_spinner.show();

		// Spinner!
var qreply_spinner = $('#quickreply_spinner');
qreply_spinner.show();

Zeile 327Zeile 343
        	complete: function (request, status)
{
Thread.quickReplyDone(request, status);

        	complete: function (request, status)
{
Thread.quickReplyDone(request, status);

				



				// Get rid of spinner
qreply_spinner.hide();
}

				// Get rid of spinner
qreply_spinner.hide();
}

Zeile 335Zeile 351

return false;
},


return false;
},





	quickReplyDone: function(request, status)
{
this.quick_replying = 0;


	quickReplyDone: function(request, status)
{
this.quick_replying = 0;


		var json = $.parseJSON(request.responseText);

		var json = JSON.parse(request.responseText);

		if(typeof json == 'object')
{
if(json.hasOwnProperty("errors"))

		if(typeof json == 'object')
{
if(json.hasOwnProperty("errors"))

			{

			{

				$(".jGrowl").jGrowl("close");

$.each(json.errors, function(i, message)

				$(".jGrowl").jGrowl("close");

$.each(json.errors, function(i, message)

Zeile 362Zeile 378
			{
json.data = json.data.replace(/^<captcha>(.*)<\/captcha>/, '');


			{
json.data = json.data.replace(/^<captcha>(.*)<\/captcha>/, '');


				if(cap[1] == "reload")
{
Recaptcha.reload();
}
else if($("#captcha_img").length)

				if($("#captcha_img").length)





				{
if(cap[1])
{
imghash = cap[1];
$('#imagehash').val(imghash);
if(cap[3])

				{
if(cap[1])
{
imghash = cap[1];
$('#imagehash').val(imghash);
if(cap[3])

						{

						{

							$('#imagestring').attr('type', 'hidden').val(cap[3]);
// hide the captcha
$('#captcha_trow').hide();

							$('#imagestring').attr('type', 'hidden').val(cap[3]);
// hide the captcha
$('#captcha_trow').hide();

Zeile 388Zeile 400
				}
}
}

				}
}
}

		



		if(json.hasOwnProperty("errors"))
return false;


		if(json.hasOwnProperty("errors"))
return false;


Zeile 398Zeile 410
			var post = document.createElement("div");

$('#posts').append(json.data);

			var post = document.createElement("div");

$('#posts').append(json.data);

			



			if (typeof inlineModeration != "undefined") // Guests don't have this object defined
$("#inlinemod_" + pid).on('change', inlineModeration.checkItem);

			if (typeof inlineModeration != "undefined") // Guests don't have this object defined
$("#inlinemod_" + pid).on('change', inlineModeration.checkItem);

				



			Thread.quickEdit("#pid_" + pid);

// Eval javascript

			Thread.quickEdit("#pid_" + pid);

// Eval javascript

Zeile 442Zeile 454

deletePost: function(pid)
{


deletePost: function(pid)
{

		$.prompt(quickdelete_confirm, {

		MyBB.prompt(quickdelete_confirm, {

			buttons:[
{title: yes_confirm, value: true},
{title: no_confirm, value: false}

			buttons:[
{title: yes_confirm, value: true},
{title: no_confirm, value: false}

Zeile 456Zeile 468
						type: 'post',
complete: function (request, status)
{

						type: 'post',
complete: function (request, status)
{

							var json = $.parseJSON(request.responseText);

							var json = JSON.parse(request.responseText);

							if(json.hasOwnProperty("errors"))
{
$.each(json.errors, function(i, message)

							if(json.hasOwnProperty("errors"))
{
$.each(json.errors, function(i, message)

Zeile 471Zeile 483
								{
// Change CSS class of div 'post_[pid]'
$("#post_"+pid).addClass("unapproved_post deleted_post");

								{
// Change CSS class of div 'post_[pid]'
$("#post_"+pid).addClass("unapproved_post deleted_post");

 
									if(json.first == 1)
{
$("#quick_reply_form, .thread_tools, .new_reply_button, .inline_rating").hide();
$("#moderator_options_selector option.option_mirage").attr("disabled","disabled");
$("#moderator_options_selector option[value='softdeletethread']").val("restorethread").text(lang.restore_thread);
}





									$("#quick_delete_" + pid).hide();
$("#quick_restore_" + pid).show();

$.jGrowl(lang.quick_delete_success, {theme:'jgrowl_success'});

									$.jGrowl(lang.quick_delete_success, {theme:'jgrowl_success'});




								}
else if(json.data == 2)
{
// Actually deleted
$('#post_'+pid).slideToggle("slow");

								}
else if(json.data == 2)
{
// Actually deleted
$('#post_'+pid).slideToggle("slow");

									



									$.jGrowl(lang.quick_delete_success, {theme:'jgrowl_success'});

									$.jGrowl(lang.quick_delete_success, {theme:'jgrowl_success'});

								} else if(json.data == 3) 
{

								} else if(json.data == 3)
{

									// deleted thread --> redirect

									// deleted thread --> redirect

									
if(!json.hasOwnProperty("url"))


if(!json.hasOwnProperty("url"))

									{
$.jGrowl(lang.unknown_error, {theme:'jgrowl_error'});
}

									{
$.jGrowl(lang.unknown_error, {theme:'jgrowl_error'});
}

									



									// set timeout for redirect

									// set timeout for redirect

									window.setTimeout(function() 

									window.setTimeout(function()

									{
window.location = json.url;
}, 3000);

									{
window.location = json.url;
}, 3000);

									



									// print success message
$.jGrowl(lang.quick_delete_thread_success, {theme:'jgrowl_success'});

									// print success message
$.jGrowl(lang.quick_delete_thread_success, {theme:'jgrowl_success'});

								}
}
else
{
$.jGrowl(lang.unknown_error, {theme:'jgrowl_error'});
}

								}
}
else
{
$.jGrowl(lang.unknown_error, {theme:'jgrowl_error'});
}

						}
});
}
}
});

						}
});
}
}
});

		



		return false;
},


		return false;
},






	restorePost: function(pid)
{

	restorePost: function(pid)
{

		$.prompt(quickrestore_confirm, {

		MyBB.prompt(quickrestore_confirm, {

			buttons:[
{title: yes_confirm, value: true},
{title: no_confirm, value: false}

			buttons:[
{title: yes_confirm, value: true},
{title: no_confirm, value: false}

Zeile 532Zeile 547
						type: 'post',
complete: function (request, status)
{

						type: 'post',
complete: function (request, status)
{

							var json = $.parseJSON(request.responseText);

							var json = JSON.parse(request.responseText);

							if(json.hasOwnProperty("errors"))
{
$.each(json.errors, function(i, message)

							if(json.hasOwnProperty("errors"))
{
$.each(json.errors, function(i, message)

Zeile 544Zeile 559
							{
// Change CSS class of div 'post_[pid]'
$("#post_"+pid).removeClass("unapproved_post deleted_post");

							{
// Change CSS class of div 'post_[pid]'
$("#post_"+pid).removeClass("unapproved_post deleted_post");


$("#quick_delete_" + pid).show();
$("#quick_restore_" + pid).hide();




								if(json.first == 1)
{
$("#quick_reply_form, .thread_tools, .new_reply_button, .inline_rating").show();
$("#moderator_options_selector option.option_mirage").prop("disabled", false);
$("#moderator_options_selector option[value='restorethread']").val("softdeletethread").text(lang.softdelete_thread);
}


$.jGrowl(lang.quick_restore_success, {theme:'jgrowl_success'});
}


$.jGrowl(lang.quick_restore_success, {theme:'jgrowl_success'});
}

Zeile 559Zeile 577
				}
}
});

				}
}
});

		



		return false;
},


		return false;
},