Admin Forum:Chatango in WikiaRail

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 = ' '; newSection.setAttribute('class',"module"); section.parentNode.insertBefore(newSection,section); } addOnloadHook(insertChatangoSection);
 * -- Fandyllic (talk &middot; 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  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 = '<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"> '; newSection.setAttribute('class',"module"); section.parentNode.insertBefore(newSection,section); } addOnloadHook(insertChatangoSection);
 * <span style="font-size:125%; font-weight:bold; font-family:Trebuchet MS, Helvetica, sans-serif; text-shadow:0 0 0.05em #646464">— Sovq 06:35, April 13, 2012 (UTC)
 * Thanks a lot! <span style="color:#222222; text-shadow: 0px 0px 2px gray; font-family:Georgia, Constantia, serif;">— mfaizsyahmi (talk)  August 2024, 
 * 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! <span style="color:#222222; text-shadow: 0px 0px 2px gray; font-family:Georgia, Constantia, serif;">— mfaizsyahmi (talk)  August 2024,