User:Mfaizsyahmi/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 = ' [ Copy this | Start New | Full Size ]'; newSection.setAttribute('class',"module"); section.parentNode.insertBefore(newSection,section); } addOnloadHook(insertChatangoSection);