// Version: 1.2; Hack's Park shoutBox /********************************************************************************** * HP_shoutBox.js *********************************************************************************** * Mod name: shoutBox * Version: 1.2 * Mod By: Hack's Park * - makito [Marco Florian Gonzales] * Support, updates, news: www.hackspark.com **********************************************************************************/ var HP_shoutBox = new Array(); // Estado HP_shoutBox['sd_msgs'] = false; HP_shoutBox['sd_post'] = false; HP_shoutBox['hd_msgs'] = false; HP_shoutBox['hd_emos'] = true; HP_shoutBox['hd_n'] = false; HP_shoutBox['hd_s'] = false; HP_shoutBox['hd_k'] = false; HP_shoutBox['hd_load'] = true; HP_shoutBox['timeout'] = false; HP_shoutBox['refresh'] = 5000; HP_shoutBox["popup"] = false; HP_shoutBox["lng_loading"] = ''; HP_shoutBox["in_bgcolor"] = '#fff'; HP_shoutBox["in_color"] = '#000'; function HP_shoutBox_Post(sc) { if (document.forms.shoutbox.msg.value.length <= 2) { alert(HP_shoutBox["lng_empty"]); return; } if (HP_shoutBox['sd_post']) { alert(HP_shoutBox["lng_jstSending"]); return; } HP_shoutBox['sd_post'] = true; setInnerHTML(document.getElementById("hp_shoutbox_div_status"), HP_shoutBox["lng_loading"]); var msg = document.forms.shoutbox.msg.value; document.forms.shoutbox.msg.value = ""; document.forms.shoutbox.msg.focus(); document.forms.shoutbox.send.disabled = true; document.forms.shoutbox.send.value = HP_shoutBox["lng_sendingPost"]; var x = new Array(); x[x.length] = 'mensaje=' + escape(textToEntities(msg.replace(/&#/g, "&#"))).replace(/\+/g, "%2B"); x[x.length] = 'negrita=' + escape(textToEntities(document.forms.shoutbox.hdn.value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B"); x[x.length] = 'subrayado=' + escape(textToEntities(document.forms.shoutbox.hds.value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B"); x[x.length] = 'kursiva=' + escape(textToEntities(document.forms.shoutbox.hdk.value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B"); x[x.length] = 'face=' + escape(textToEntities(document.forms.shoutbox.hdface.value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B"); x[x.length] = 'color=' + escape(textToEntities(document.forms.shoutbox.hdcolor.value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B"); x[x.length] = 'bgcolor=' + escape(textToEntities(document.forms.shoutbox.hdbgcolor.value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B"); if (HP_shoutBox["popup"]) sendXMLDocument(smf_scripturl + "?action=shoutbox;sa=send;sesc=" + sc + ";xml;popup", x.join("&"), HP_shoutBox_Post2); else sendXMLDocument(smf_scripturl + "?action=shoutbox;sa=send;sesc=" + sc + ";xml", x.join("&"), HP_shoutBox_Post2); } function HP_shoutBox_Post2(XMLDoc) { var error; error = XMLDoc.getElementsByTagName("error")[0]; document.forms.shoutbox.send.disabled = false; document.forms.shoutbox.send.value = HP_shoutBox["lng_sent"]; window.clearTimeout(HP_shoutBox['timeout']); HP_shoutBox_getMsgs2(XMLDoc); HP_shoutBox['sd_post'] = false; if (error) alert(error.childNodes[0].nodeValue); } function HP_shoutBox_getMsgs() { if (HP_shoutBox['sd_msgs'] || HP_shoutBox['sd_post']) return; window.clearTimeout(HP_shoutBox['timeout']); HP_shoutBox['sd_msgs'] = true; setInnerHTML(document.getElementById("hp_shoutbox_div_status"), HP_shoutBox["lng_loading"]); if (HP_shoutBox["popup"]) getXMLDocument(smf_scripturl + "?action=shoutbox;sa=get;xml;popup", HP_shoutBox_getMsgs2); else getXMLDocument(smf_scripturl + "?action=shoutbox;sa=get;xml", HP_shoutBox_getMsgs2); } function HP_shoutBox_getMsgs2(XMLDoc) { var shouts; shouts = XMLDoc.getElementsByTagName("shouts")[0].childNodes[0].nodeValue; window.clearTimeout(HP_shoutBox['timeout']); if (HP_shoutBox["is_ie"]) setOuterHTML(document.getElementById("hp_shoutbox_div_shouts"), shouts); else setInnerHTML(document.getElementById("hp_shoutbox_div_shouts"), shouts); setInnerHTML(document.getElementById("hp_shoutbox_div_status"), ""); HP_shoutBox['sd_msgs'] = false; HP_shoutBox['timeout'] = window.setTimeout("HP_shoutBox_getMsgs();", HP_shoutBox['refresh']); } function HP_shoutBox_sh(mode, idGet) { if (!idGet) return; if (idGet == 'msgs') { document.getElementById("hp_shoutbox_collapse").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif"); if (!mode) { HP_shoutBox['hd_load'] = true; HP_shoutBox['sd_msgs'] = false; HP_shoutBox['sd_post'] = false; HP_shoutBox['timeout'] = window.setTimeout("HP_shoutBox_getMsgs();", 10); } else { HP_shoutBox['hd_load'] = false; HP_shoutBox['sd_msgs'] = true; HP_shoutBox['sd_post'] = true; window.clearTimeout(HP_shoutBox['timeout']); } } document.getElementById("hp_shoutbox_div_" + idGet).style.display = mode ? "none" : ""; HP_shoutBox['hd_' + idGet] = mode; } function HP_shoutBox_setColor(sh,c) { if (typeof(c) == "undefined") c = document.getElementById("hp_colorpicker_input_aply").value; if (!HP_colorPicker['bg']) { eval('document.forms.shoutbox.msg.style.color = "' + c + '"'); document.getElementById("hp_shoutbox_s_color").style.backgroundColor = c; if (c == '') { eval('document.forms.shoutbox.msg.style.border = "1px solid inherit"'); document.getElementById("hp_shoutbox_s_color").src = smf_images_url + "/bbc/nocolor.gif"; } else { eval('document.forms.shoutbox.msg.style.border = "1px solid ' + c + '"'); document.getElementById("hp_shoutbox_s_color").src = smf_images_url + "/blank.gif"; } document.forms.shoutbox.hdcolor.value = c; HP_colorPicker['color'] = c; } else { eval('document.forms.shoutbox.msg.style.backgroundColor = "' + c + '"'); document.getElementById("hp_shoutbox_s_bgcolor").style.backgroundColor = c; if (c == '') document.getElementById("hp_shoutbox_s_bgcolor").src = smf_images_url + "/bbc/nocolor.gif"; else document.getElementById("hp_shoutbox_s_bgcolor").src = smf_images_url + "/blank.gif"; document.forms.shoutbox.hdbgcolor.value = c; HP_colorPicker['bg_color'] = c; } if (sh) HP_colorPicker_sh(); } function HP_shoutBox_shFace() { if (document.getElementById("hp_shoutbox_div_face").style.display == 'none') document.getElementById("hp_shoutbox_div_face").style.display = ''; else document.getElementById("hp_shoutbox_div_face").style.display = 'none'; } function HP_shoutBox_setFace(c) { eval('document.forms.shoutbox.msg.style["fontFamily"] = "' + c + '"'); document.forms.shoutbox.hdface.value = c; } function bbc_highlight(something,mode) { something.style.backgroundImage = "url(" + smf_images_url + (mode ? "/bbc/bbc_hoverbg.gif)" : "/bbc/bbc_bg.gif)"); } function HP_shoutBox_Clear() { document.forms.shoutbox.hdcolor.value = ""; document.forms.shoutbox.hdbgcolor.value = ""; document.forms.shoutbox.hdn.value = "0"; document.forms.shoutbox.hdk.value = "0"; document.forms.shoutbox.hds.value = "0"; document.forms.shoutbox.hdface.value = "Verdana"; eval('document.forms.shoutbox.msg.style["fontWeight"] = "normal"'); eval('document.forms.shoutbox.msg.style["fontStyle"] = "normal"'); eval('document.forms.shoutbox.msg.style["fontFamily"] = "verdana"'); eval('document.forms.shoutbox.msg.style["textDecoration"] = "none"'); eval('document.forms.shoutbox.msg.style.color = "' + HP_shoutBox["in_color"] + '"'); eval('document.forms.shoutbox.msg.style.border = "1px solid"'); eval('document.forms.shoutbox.msg.style.backgroundColor = "' + HP_shoutBox["in_bgcolor"] + '"'); HP_shoutBox['hd_n'] = false; HP_shoutBox['hd_s'] = false; HP_shoutBox['hd_k'] = false; HP_colorPicker['bg_color'] = ''; HP_colorPicker['color'] = ''; document.getElementById("hp_shoutbox_s_color").src = smf_images_url + "/bbc/nocolor.gif"; document.getElementById("hp_shoutbox_s_bgcolor").src = smf_images_url + "/bbc/nocolor.gif"; } function HP_shoutBox_setPro(p,mode) { switch(p) { case 'n': if (mode) { document.forms.shoutbox.hdn.value = '1'; eval('document.forms.shoutbox.msg.style["fontWeight"] = "bold"'); } else { document.forms.shoutbox.hdn.value = '0'; eval('document.forms.shoutbox.msg.style["fontWeight"] = "normal"'); } HP_shoutBox['hd_n'] = mode; break; case 'k': if (mode) { document.forms.shoutbox.hdk.value = '1'; eval('document.forms.shoutbox.msg.style["fontStyle"] = "italic"'); } else { document.forms.shoutbox.hdk.value = '0'; eval('document.forms.shoutbox.msg.style["fontStyle"] = "normal"'); } HP_shoutBox['hd_k'] = mode; break; case 's': if (mode) { document.forms.shoutbox.hds.value = '1'; eval('document.forms.shoutbox.msg.style["textDecoration"] = "underline"'); } else { document.forms.shoutbox.hds.value = '0'; eval('document.forms.shoutbox.msg.style["textDecoration"] = "none"'); } HP_shoutBox['hd_s'] = mode; break; } } function HP_shoutBox_sURL() { if (document.forms.shoutbox.msg.value != "") if (!window.confirm(HP_shoutBox["lng_no_empty"])) return; document.forms.shoutbox.msg.value = ""; var url = window.prompt(HP_shoutBox["lng_insert_url"], ''); if (!url) return; if (url.lenght == 0) return alert(HP_shoutBox["lng_empty_url"]); var expr = /^(http|HTTP):\/\/.*$/; if (!expr.test(url)) url = "http://" + url; url = "/url " + url; document.forms.shoutbox.msg.value = url; }