Fandom

Community Central

Admin Forum:Chatango in WikiaRail

19,031pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

This Forum has been archived

Forums: Admin Central Index Technical Help Chatango in WikiaRail
Central's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Note: This topic has been unedited for 1373 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.



I saw on the Dead Island Wiki that they had Chatango Chat in the WikiaRail and now i wonder what code I need to put in to the MediaWiki so that I could implement that on my Wiki (I allready created an Chatango Channel for my Wiki) and replace the WikiaChat. - Regards rmn777777 My User Page on NFS World Info Wiki 18:41, March 23, 2012 (UTC)

They may be violating Wikia's ToU, but it looks pretty straighforward. Maybe you can addapt their code.
From w:c:deadisland:MediaWiki:Common.js:
// Add Chat Box Script
importScriptPage('User:Jgjake2/js/Chat.js', 'deadisland');
From w:c:deadisland:User:Jgjake2/js/Chat.js:
function getElementsByClass(elementName, tagname, tclass){
	var itemsfound = new Array();
	var elements = elementName.getElementsByTagName(tagname);
	for(var i=0;i<elements.length;i++){
		if(hasClass(elements[i], tclass)){
			itemsfound.push(elements[i]);
		}
	}
	return itemsfound;
}
 
function insertChatangoSection(){
	var chatSection = getElementsByClass(document, 'section', 'ChatModule');
	if(chatSection[0] != null) chatSection[0].parentNode.removeChild(chatSection[0]);
	var section = getElementsByClass(document, 'section', 'WikiaBlogListingBox')[0];
	if(section == null){
		section = getElementsByClass(document, 'section', 'LatestPhotosModule')[0];
		if(section == null){
			section = getElementsByClass(document, 'section', 'CommunityCornerModule')[0];
			if(section == null){
				section = getElementsByClass(document, 'div', 'AchievementsModule')[0];
				if(section == null){
					section = getElementsByClass(document, 'section', 'FollowedPagesModule')[0];
					if(section == null){
						section = getElementsByClass(document, 'section', 'WikiaLatestEarnedBadgesModule')[0];
						if(section == null){
							section = document.getElementById('WikiaSpotlightsModule');
							if(section == null) return;
						}
					}
				}
			}
		}
	}
	var newSection = document.createElement("section");
	newSection.innerHTML = '<object width="282" height="360" id="obj_1320770266047"><param name="movie" value="http://deadislandwikia.chatango.com/group"/><param name="wmode" value="transparent"/><param name="AllowScriptAccess" VALUE="always"/><param name="AllowNetworking" VALUE="all"/><param name="AllowFullScreen" VALUE="true"/><param name="flashvars" value="cid=1320770266047&a=262626&b=100&c=FFFFFF&d=CC0000&e=202020&g=FFFFFF&h=000000&j=FFFFFF&k=CC0000&l=4C4C4C&m=FFFFFF&n=CC0000&s=1&t=0"/><embed id="emb_1320770266047" src="http://deadislandwikia.chatango.com/group" width="282" height="360" allowScriptAccess="always" wmode="transparent" allowNetworking="all" type="application/x-shockwave-flash" allowFullScreen="true" flashvars="cid=1320770266047&a=262626&b=100&c=FFFFFF&d=CC0000&e=202020&g=FFFFFF&h=000000&j=FFFFFF&k=CC0000&l=4C4C4C&m=FFFFFF&n=CC0000&s=1&t=0"></embed></object>';
	newSection.setAttribute('class',"module");
	section.parentNode.insertBefore(newSection,section);
}
addOnloadHook(insertChatangoSection);
-- Fandyllic (talk · contr) 23 Mar 2012 2:01 PM Pacific
Thanks Frandyllic. I've been trying this for personal use, and later wiki-wide use. Alas, it seems that absolutely nothing happens, even with a hard refresh AND a purge. And it broke other js that I use too. Could someone check what is it that has gone horribly wrong in the code for me to deserve this? thanks. ;( mfaizsyahmi (talk) 23:53, April 12, 2012 (UTC)
The code Fandyllic posted requires a certain hasClass variable to be also defined. Usually this variable is also a part of the collapsible table code (as on the Dead Island Wiki), but you're missing it on you wiki. The full code to paste (and only that code) would be:
var hasClass = (function () {
   var reCache = {};
   return function (element, className) {
      return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
   };
})();
 
function getElementsByClass(elementName, tagname, tclass){
	var itemsfound = new Array();
	var elements = elementName.getElementsByTagName(tagname);
	for(var i=0;i<elements.length;i++){
		if(hasClass(elements[i], tclass)){
			itemsfound.push(elements[i]);
		}
	}
	return itemsfound;
}
 
function insertChatangoSection(){
	var chatSection = getElementsByClass(document, 'section', 'ChatModule');
	if(chatSection[0] != null) chatSection[0].parentNode.removeChild(chatSection[0]);
	var section = getElementsByClass(document, 'section', 'WikiaBlogListingBox')[0];
	if(section == null){
		section = getElementsByClass(document, 'section', 'LatestPhotosModule')[0];
		if(section == null){
			section = getElementsByClass(document, 'section', 'CommunityCornerModule')[0];
			if(section == null){
				section = getElementsByClass(document, 'div', 'AchievementsModule')[0];
				if(section == null){
					section = getElementsByClass(document, 'section', 'FollowedPagesModule')[0];
					if(section == null){
						section = getElementsByClass(document, 'section', 'WikiaLatestEarnedBadgesModule')[0];
						if(section == null){
							section = document.getElementById('WikiaSpotlightsModule');
							if(section == null) return;
						}
					}
				}
			}
		}
	}
	var newSection = document.createElement("section");
	newSection.innerHTML = '<object width="282" height="360" id="obj_1320770266047"><param name="movie" value="http://deadislandwikia.chatango.com/group"/><param name="wmode" value="transparent"/><param name="AllowScriptAccess" VALUE="always"/><param name="AllowNetworking" VALUE="all"/><param name="AllowFullScreen" VALUE="true"/><param name="flashvars" value="cid=1320770266047&a=262626&b=100&c=FFFFFF&d=CC0000&e=202020&g=FFFFFF&h=000000&j=FFFFFF&k=CC0000&l=4C4C4C&m=FFFFFF&n=CC0000&s=1&t=0"/><embed id="emb_1320770266047" src="http://deadislandwikia.chatango.com/group" width="282" height="360" allowScriptAccess="always" wmode="transparent" allowNetworking="all" type="application/x-shockwave-flash" allowFullScreen="true" flashvars="cid=1320770266047&a=262626&b=100&c=FFFFFF&d=CC0000&e=202020&g=FFFFFF&h=000000&j=FFFFFF&k=CC0000&l=4C4C4C&m=FFFFFF&n=CC0000&s=1&t=0"></embed></object>';
	newSection.setAttribute('class',"module");
	section.parentNode.insertBefore(newSection,section);
}
addOnloadHook(insertChatangoSection);
Sovq 06:35, April 13, 2012 (UTC)
Thanks a lot! mfaizsyahmi (talk) 09 December 2016, 11:46
Sorry for bugging again, but the js also inserted the chat in blog lists of normal pages. You can see this in my sandbox. I figure the js need to be edited so that it would check if the parent element is the wikiarail, but I'm not sure how to do this. Help would be appreciated. Thanks! mfaizsyahmi (talk) 09 December 2016, 11:46
I guess the easiest way to solve this would be to enable Chat in Wiki Features. The script replaces blocks in the siderail with chatango in a certain order. If it can't find & replace chat it will find & replace the blog list, if that's unavailable - the photos module and so on. I guess the script's author didn't consider the blog list class being used elsewhere or it has been released after the script was created. Either way - I would turn on chat if I were you. Sovq 18:30, April 17, 2012 (UTC)

Also on Fandom

Random Wiki