moon4u / Spoiler Tag Fix

// ==UserScript==
// @name           Spoiler Tag Fix
// @description    Fixes the spoiler tag's lack of word wrap in the animes-bg.com
// @namespace      http://www.forum.animes-bg.com
// @author         Moon
// @version        1.0a
// @include        *forum.animes-bg.com*
// ==/UserScript==

window.onload = function () {
	var spoilers = document.getElementsByClassName("spoiler");
	for (var i=0; i<spoilers.length; i++) {
		div = spoilers[i].getElementsByClassName("alt2")[0];
		div.style.setProperty("word-wrap", "break-word");
		div.style.setProperty("white-space", "pre-wrap");       /* CSS 3 */
		div.style.setProperty("white-space", "-moz-pre-wrap");  /* Mozilla, since 1999 */
		div.style.setProperty("white-space", "-pre-wrap");      /* Opera 4-6 */
		div.style.setProperty("white-space", "-o-pre-wrap");    /* Opera 7 */
		div.style.setProperty("width", "100%");
		var width = div.parentNode.parentNode.parentNode.clientWidth;
		div.parentNode.parentNode.style.setProperty("width", width+"px");
	};
}