MyBB Community Forums

Full Version: error all jscript in my forum
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
hello.
i have a problem in my forum,.
i dont know what happen but it's something like an error with the jscript.
because my shoutbox is only showing "Loading.." and my Overview's Auto Loading is not working it gives me error..
my "Edit" tool in threads, the "Quick Edit" gives me error..

please tell me what to do, i didn't change any of the jscript in my forum.
Thank you
URL?? Test account?? Very little we can do otherwise.
Site: www.newgamerszone.com
Test Account:
Username: MyBB1
Password: ******

Thank you
Thank you for the fast response..
i hope you know the solution for this problem..
You've included jQuery and it's conflicting with the MyBB javascript. After jQuery is included, add this:

jQuery.noConflict();

and in any jQuery code you've added, change any $ to jQuery
where can i find that ??
Where can i add that line sir?
is it in all the jscript i've uploaded??

myshoutbox.js and overview.js?
sir, here's the entire jscript code of myshoutbox.js
// MyShoutbox for MyBB
// (c) Pirata Nervo, www.consoleworld.net
//
// Based off:
// SpiceFuse AJAX ShoutBox for MyBB
// (c) Asad Niazi, www.spicefuse.com!
//
// Code is copyrighted and does not belong to public domain.
// Copying or reusing in different forms/softwares isn't allowed.
// 
//
//

var ShoutBox = {
	
	refreshInterval: 60,
	lastID: 0,
	totalEntries: 0,
	firstRun: 1,
	MaxEntries: 5,
	DataStore: new Array(),
	lang: ['Shouting...', 'Shout Now!', 'Loading...', 'Flood check! Please try again in <interval> seconds.', 'Couldn\'t shout or perform action. Please try again!', 'Sending message...', 'Send!'],


	showShouts: function() {
		setTimeout("ShoutBox.showShouts();", ShoutBox.refreshInterval * 1000);
		if (typeof Ajax == 'object') {
			new Ajax.Request('xmlhttp.php?action=show_shouts&last_id='+ShoutBox.lastID, {method: 'get', onComplete: function(request) { ShoutBox.shoutsLoaded(request); } });
		}
	},

	shoutsLoaded: function(request) {
		
		var theHTML = "";
		var curData = "";
		var data = request.responseText.split('^--^');
		var theID = parseInt(data[0]);
		var theEntries = parseInt(data[1]);

		if (theID <= ShoutBox.lastID) {
			return;
		}

		// add to data store now...
		curData = data[2].split("\r\n");

		// only 1 message?
		if (curData.length == 1) 
		{
			length = ShoutBox.DataStore.length;
			ShoutBox.DataStore[ length ] = curData[0];
		} 
		else 
		{
			// hush, lots of em
			var collectData = "";
			var length = 0;
			for (var i = curData.length; i >= 0; i--) 
			{
				if (curData[i] != "" && curData[i] != undefined) {
					length = ShoutBox.DataStore.length;
					ShoutBox.DataStore[ length ] = curData[i];
				}	
			}
		}

		ShoutBox.lastID = theID;
		ShoutBox.totalEntries += theEntries;

		if (ShoutBox.firstRun == 1) {
			theHTML = data[2];
			ShoutBox.firstRun = 0;
		} else {

			// the data is more than the limit? hard luck here then... just get it from datastore
			if ((theEntries + ShoutBox.totalEntries) > ShoutBox.MaxEntries) {
				for (var j=0, i = ShoutBox.DataStore.length-1; j < ShoutBox.MaxEntries; i--, j++) {
					theHTML += ShoutBox.DataStore[i];
				}

				ShoutBox.totalEntries = ShoutBox.MaxEntries;

			} else {
				theHTML = data[2] + $("shoutbox_data").innerHTML;
			}

		}

		$("shoutbox_data").innerHTML = theHTML;

		// clean up DataStore
		ShoutBox.cleanDataStore();
	},
	
	pvtAdd: function(uid) {
		var msg = $("shout_data").value;
		$("shout_data").value = '/pvt ' + uid + ' ' + msg;
	},
	
	colorAdd: function(color) {
		var msg = $("shout_data").value;
		
		$("shout_data").value = '[color=#' + color + ']' + msg + '[/color]';
	},
	
	mycodeAdd: function(code) {
		var msg = $("shout_data").value;
		
		switch (code)
		{
			case 'S':
				$("shout_data").value = '[s]' + msg + '[/s]';
			break;
			case 'B':
				$("shout_data").value = '[b]' + msg + '[/b]';
			break;
			case 'I':
				$("shout_data").value = '[i]' + msg + '[/i]';
			break;
			case 'U':
				$("shout_data").value = '[u]' + msg + '[/u]';
			break;
		}
	},

	postShout: function() {
		message = $("shout_data").value;
		if (message == "") {
			return false;
		}

		$("shouting-status").value = ShoutBox.lang[0];

		postData = "shout_data="+encodeURIComponent(message).replace(/\+/g, "%2B");
		new Ajax.Request('xmlhttp.php?action=add_shout', {method: 'post', postBody: postData, onComplete: function(request) { ShoutBox.postedShout(request); }});
	},

	postedShout: function(request) {
		
		if (request.responseText == 'deleted') {
			ShoutBox.firstRun = 1;
			ShoutBox.lastID = 0;
			alert("Shouts deleted as requested.");
		}
		else if (request.responseText.indexOf('flood') != -1) {
			var split = new Array();
			split = request.responseText.split('|');			
			var interval = split[1]; 
			
			alert(ShoutBox.lang[3].replace('<interval>', interval));
		}
		else if (request.responseText.indexOf("success") == -1) {
			alert(ShoutBox.lang[4]);
		}

		$("shouting-status").value = ShoutBox.lang[1];
		ShoutBox.showShouts();
	},
	
	// report shout
	reportShout: function(reason, id) {
		
		reason = reason;
		sid = parseInt(id);
		
		if (reason == "" || sid == "") {
			return false;
		}

		postData = "reason="+encodeURIComponent(reason).replace(/\+/g, "%2B")+"&sid="+encodeURIComponent(sid).replace(/\+/g, "%2B");
		new Ajax.Request('xmlhttp.php?action=report_shout', {method: 'post', postBody: postData, onComplete: function(request) { ShoutBox.shoutReported(request); }});
	},

	shoutReported: function(request) {
		if (request.responseText == 'invalid_shout') {
			alert(ShoutBox.lang[11]);
			return false;
		}
		else if (request.responseText == 'already_reported') {
			alert(ShoutBox.lang[13]);
			return false;
		}
		else if (request.responseText == 'shout_reported') {
			alert(ShoutBox.lang[12]);
		}
		
		ShoutBox.showShouts();
	},
	
	// prompt reason
	promptReason: function(id) {
		
		var reason = prompt("Enter a reason:", "");
		
		if (reason == "" || reason == null || id == "") {
			return false;
		}
		
		id = parseInt(id);
		
		return ShoutBox.reportShout(reason, id);
	},
	
	deleteShout: function(id, type, message) {
		
		message = message.escapeHTML(); // escape HTML before outputting the message
		
		var confirmation = confirm(message);
		
		if (!confirmation)
			return false;
		
		if (type == 1) {
			$("shoutbox_data").innerHTML = ShoutBox.lang[2];
		}

		new Ajax.Request('xmlhttp.php?action=delete_shout&id='+id, {method: 'get', onComplete: function(request) { ShoutBox.deletedShout(request, id, type); } });
	},
	
	deletedShout: function(request, id, type) {
		if (request.responseText.indexOf("success") == -1) {
			alert("Error deleting shout... Try again!");
		} else if (type == 2) {
			alert("Shout deleted.");
		}

		if (type == 1) {
			ShoutBox.DataStore = new Array();
			ShoutBox.lastID = 0;
			ShoutBox.showShouts();
		} else {
			try {
				$("shout-"+id).style.display = "none";
			} catch (e) { 
				$("shout-"+id).style.display = "hidden";
			}
		}

	},
	
	removeShout: function(id, type, message) {
		
		message = message.escapeHTML(); // escape HTML before outputting the message
		
		var confirmation = confirm(message);
		
		if (!confirmation)
			return false;
			
		if (type == 1) {
			$("shoutbox_data").innerHTML = ShoutBox.lang[2];
		}

		new Ajax.Request('xmlhttp.php?action=remove_shout&id='+id, {method: 'get', onComplete: function(request) { ShoutBox.deletedShout(request, id, type); } });
	},
	
	removedShout: function(request, id, type) {
		if (request.responseText.indexOf("success") == -1) {
			alert("Error removing shout... Try again!");
		} else if (type == 2) {
			alert("Shout removed.");
		}

		if (type == 1) {
			ShoutBox.DataStore = new Array();
			ShoutBox.lastID = 0;
			ShoutBox.showShouts();
		} else {
			try {
				$("shout-"+id).style.display = "none";
			} catch (e) { 
				$("shout-"+id).style.display = "hidden";
			}
		}

	},
	
	recoverShout: function(id, type, message) {
		
		message = message.escapeHTML(); // escape HTML before outputting the message
		
		var confirmation = confirm(message);
		
		if (!confirmation)
			return false;

		if (type == 1) {
			$("shoutbox_data").innerHTML = ShoutBox.lang[2];
		}

		new Ajax.Request('xmlhttp.php?action=recover_shout&id='+id, {method: 'get', onComplete: function(request) { ShoutBox.recoveredShout(request, id, type); } });
	},
	
	recoveredShout: function(request, id, type) {
		if (request.responseText.indexOf("success") == -1) {
			alert("Error recovering shout... Try again!");
		} else if (type == 2) {
			alert("Shout recovered.");
		}

		if (type == 1) {
			ShoutBox.DataStore = new Array();
			ShoutBox.lastID = 0;
			ShoutBox.showShouts();
		} else {
			try {
				$("shout-"+id).style.display = "none";
			} catch (e) { 
				$("shout-"+id).style.display = "hidden";
			}
		}

	},

	cleanDataStore: function() {
		if (ShoutBox.DataStore.length > ShoutBox.MaxEntries) {
			for (var i = (ShoutBox.DataStore.length - ShoutBox.MaxEntries); i > 0; i--) {
				ShoutBox.DataStore[i] = "";
			}
		}
	},

	disableShout: function() {
		try { 
			$("shouting-status").disabled = true;
		} catch (e) {
			$("shouting-status").readonly = true;
		}
	},
};

i dont know what to do and where to put that jQuery.noConflict();
Hello..
i can't understand this, and i dont know what to do,.

By MattRogowski
You've included jQuery and it's conflicting with the MyBB javascript. After jQuery is included, add this:

Code:
jQuery.noConflict();

and in any jQuery code you've added, change any $ to jQuery

-------------------

can you give me example?
here's the entire code of myshoutbox.js
// MyShoutbox for MyBB
// (c) Pirata Nervo, www.consoleworld.net
//
// Based off:
// SpiceFuse AJAX ShoutBox for MyBB
// (c) Asad Niazi, www.spicefuse.com!
//
// Code is copyrighted and does not belong to public domain.
// Copying or reusing in different forms/softwares isn't allowed.
// 
//
//

var ShoutBox = {
	
	refreshInterval: 60,
	lastID: 0,
	totalEntries: 0,
	firstRun: 1,
	MaxEntries: 5,
	DataStore: new Array(),
	lang: ['Shouting...', 'Shout Now!', 'Loading...', 'Flood check! Please try again in <interval> seconds.', 'Couldn\'t shout or perform action. Please try again!', 'Sending message...', 'Send!'],


	showShouts: function() {
		setTimeout("ShoutBox.showShouts();", ShoutBox.refreshInterval * 1000);
		if (typeof Ajax == 'object') {
			new Ajax.Request('xmlhttp.php?action=show_shouts&last_id='+ShoutBox.lastID, {method: 'get', onComplete: function(request) { ShoutBox.shoutsLoaded(request); } });
		}
	},

	shoutsLoaded: function(request) {
		
		var theHTML = "";
		var curData = "";
		var data = request.responseText.split('^--^');
		var theID = parseInt(data[0]);
		var theEntries = parseInt(data[1]);

		if (theID <= ShoutBox.lastID) {
			return;
		}

		// add to data store now...
		curData = data[2].split("\r\n");

		// only 1 message?
		if (curData.length == 1) 
		{
			length = ShoutBox.DataStore.length;
			ShoutBox.DataStore[ length ] = curData[0];
		} 
		else 
		{
			// hush, lots of em
			var collectData = "";
			var length = 0;
			for (var i = curData.length; i >= 0; i--) 
			{
				if (curData[i] != "" && curData[i] != undefined) {
					length = ShoutBox.DataStore.length;
					ShoutBox.DataStore[ length ] = curData[i];
				}	
			}
		}

		ShoutBox.lastID = theID;
		ShoutBox.totalEntries += theEntries;

		if (ShoutBox.firstRun == 1) {
			theHTML = data[2];
			ShoutBox.firstRun = 0;
		} else {

			// the data is more than the limit? hard luck here then... just get it from datastore
			if ((theEntries + ShoutBox.totalEntries) > ShoutBox.MaxEntries) {
				for (var j=0, i = ShoutBox.DataStore.length-1; j < ShoutBox.MaxEntries; i--, j++) {
					theHTML += ShoutBox.DataStore[i];
				}

				ShoutBox.totalEntries = ShoutBox.MaxEntries;

			} else {
				theHTML = data[2] + $("shoutbox_data").innerHTML;
			}

		}

		$("shoutbox_data").innerHTML = theHTML;

		// clean up DataStore
		ShoutBox.cleanDataStore();
	},
	
	pvtAdd: function(uid) {
		var msg = $("shout_data").value;
		$("shout_data").value = '/pvt ' + uid + ' ' + msg;
	},
	
	colorAdd: function(color) {
		var msg = $("shout_data").value;
		
		$("shout_data").value = '[color=#' + color + ']' + msg + '[/color]';
	},
	
	mycodeAdd: function(code) {
		var msg = $("shout_data").value;
		
		switch (code)
		{
			case 'S':
				$("shout_data").value = '[s]' + msg + '[/s]';
			break;
			case 'B':
				$("shout_data").value = '[b]' + msg + '[/b]';
			break;
			case 'I':
				$("shout_data").value = '[i]' + msg + '[/i]';
			break;
			case 'U':
				$("shout_data").value = '[u]' + msg + '[/u]';
			break;
		}
	},

	postShout: function() {
		message = $("shout_data").value;
		if (message == "") {
			return false;
		}

		$("shouting-status").value = ShoutBox.lang[0];

		postData = "shout_data="+encodeURIComponent(message).replace(/\+/g, "%2B");
		new Ajax.Request('xmlhttp.php?action=add_shout', {method: 'post', postBody: postData, onComplete: function(request) { ShoutBox.postedShout(request); }});
	},

	postedShout: function(request) {
		
		if (request.responseText == 'deleted') {
			ShoutBox.firstRun = 1;
			ShoutBox.lastID = 0;
			alert("Shouts deleted as requested.");
		}
		else if (request.responseText.indexOf('flood') != -1) {
			var split = new Array();
			split = request.responseText.split('|');			
			var interval = split[1]; 
			
			alert(ShoutBox.lang[3].replace('<interval>', interval));
		}
		else if (request.responseText.indexOf("success") == -1) {
			alert(ShoutBox.lang[4]);
		}

		$("shouting-status").value = ShoutBox.lang[1];
		ShoutBox.showShouts();
	},
	
	// report shout
	reportShout: function(reason, id) {
		
		reason = reason;
		sid = parseInt(id);
		
		if (reason == "" || sid == "") {
			return false;
		}

		postData = "reason="+encodeURIComponent(reason).replace(/\+/g, "%2B")+"&sid="+encodeURIComponent(sid).replace(/\+/g, "%2B");
		new Ajax.Request('xmlhttp.php?action=report_shout', {method: 'post', postBody: postData, onComplete: function(request) { ShoutBox.shoutReported(request); }});
	},

	shoutReported: function(request) {
		if (request.responseText == 'invalid_shout') {
			alert(ShoutBox.lang[11]);
			return false;
		}
		else if (request.responseText == 'already_reported') {
			alert(ShoutBox.lang[13]);
			return false;
		}
		else if (request.responseText == 'shout_reported') {
			alert(ShoutBox.lang[12]);
		}
		
		ShoutBox.showShouts();
	},
	
	// prompt reason
	promptReason: function(id) {
		
		var reason = prompt("Enter a reason:", "");
		
		if (reason == "" || reason == null || id == "") {
			return false;
		}
		
		id = parseInt(id);
		
		return ShoutBox.reportShout(reason, id);
	},
	
	deleteShout: function(id, type, message) {
		
		message = message.escapeHTML(); // escape HTML before outputting the message
		
		var confirmation = confirm(message);
		
		if (!confirmation)
			return false;
		
		if (type == 1) {
			$("shoutbox_data").innerHTML = ShoutBox.lang[2];
		}

		new Ajax.Request('xmlhttp.php?action=delete_shout&id='+id, {method: 'get', onComplete: function(request) { ShoutBox.deletedShout(request, id, type); } });
	},
	
	deletedShout: function(request, id, type) {
		if (request.responseText.indexOf("success") == -1) {
			alert("Error deleting shout... Try again!");
		} else if (type == 2) {
			alert("Shout deleted.");
		}

		if (type == 1) {
			ShoutBox.DataStore = new Array();
			ShoutBox.lastID = 0;
			ShoutBox.showShouts();
		} else {
			try {
				$("shout-"+id).style.display = "none";
			} catch (e) { 
				$("shout-"+id).style.display = "hidden";
			}
		}

	},
	
	removeShout: function(id, type, message) {
		
		message = message.escapeHTML(); // escape HTML before outputting the message
		
		var confirmation = confirm(message);
		
		if (!confirmation)
			return false;
			
		if (type == 1) {
			$("shoutbox_data").innerHTML = ShoutBox.lang[2];
		}

		new Ajax.Request('xmlhttp.php?action=remove_shout&id='+id, {method: 'get', onComplete: function(request) { ShoutBox.deletedShout(request, id, type); } });
	},
	
	removedShout: function(request, id, type) {
		if (request.responseText.indexOf("success") == -1) {
			alert("Error removing shout... Try again!");
		} else if (type == 2) {
			alert("Shout removed.");
		}

		if (type == 1) {
			ShoutBox.DataStore = new Array();
			ShoutBox.lastID = 0;
			ShoutBox.showShouts();
		} else {
			try {
				$("shout-"+id).style.display = "none";
			} catch (e) { 
				$("shout-"+id).style.display = "hidden";
			}
		}

	},
	
	recoverShout: function(id, type, message) {
		
		message = message.escapeHTML(); // escape HTML before outputting the message
		
		var confirmation = confirm(message);
		
		if (!confirmation)
			return false;

		if (type == 1) {
			$("shoutbox_data").innerHTML = ShoutBox.lang[2];
		}

		new Ajax.Request('xmlhttp.php?action=recover_shout&id='+id, {method: 'get', onComplete: function(request) { ShoutBox.recoveredShout(request, id, type); } });
	},
	
	recoveredShout: function(request, id, type) {
		if (request.responseText.indexOf("success") == -1) {
			alert("Error recovering shout... Try again!");
		} else if (type == 2) {
			alert("Shout recovered.");
		}

		if (type == 1) {
			ShoutBox.DataStore = new Array();
			ShoutBox.lastID = 0;
			ShoutBox.showShouts();
		} else {
			try {
				$("shout-"+id).style.display = "none";
			} catch (e) { 
				$("shout-"+id).style.display = "hidden";
			}
		}

	},

	cleanDataStore: function() {
		if (ShoutBox.DataStore.length > ShoutBox.MaxEntries) {
			for (var i = (ShoutBox.DataStore.length - ShoutBox.MaxEntries); i > 0; i--) {
				ShoutBox.DataStore[i] = "";
			}
		}
	},

	disableShout: function() {
		try { 
			$("shouting-status").disabled = true;
		} catch (e) {
			$("shouting-status").readonly = true;
		}
	},
};

anyone ?
anyone can help Shiny.. he is my Friend... anyone can help us..?
In future, can you please not make loads of threads on the same thing. Try and have some patience, we are not your servants.

Do you know exactly what it is n your forum that even needs jQuery...?? I don't think it's MyShoutbox.
hello Matt, sorry for what i've done.
the only jscript i uploaded to my forum is Overview.js and myshoutbox.js, that's all.

i really dont know,.
i just use this 2 plugins with jscript..
i checked all my mods here with jscript, but only Overview and Shoutbox has jscript..
Its not just plugins, you're theme also has jquery scripts in it. If you as the admin don't have an idea of what you're installing and putting on your board, its no surprise you're in the predicament you are in.

The board is currently closed so I can't see it but do you have any more scripts loading in the showthread pages? You need to find all your jquery scripts and add the jquery.nocoflict function to it.

Also, I think you're confusing jscripts and jquery, we're asking you to check for jquery, not all jscripts are jquery.
Pages: 1 2 3