$(document).ready(function () {
$("#icon").keyup(function () {
var iconStr = $(this).val();
$("#iconPreview").empty();
if (!iconStr)
return;
if (iconStr.indexOf("http") == 0)
$("#iconPreview").append($("", { src: iconStr }));
else
$("#iconPreview").append($("
", { src: g_staticUrl + "/images/wow/icons/large/" + iconStr.toLowerCase() + ".jpg" }));
});
});
var previewWindow;
function initToolbox() {
if (window.getSelection || document.getSelection || (document.selection && document.selection.createRange))
$WH.ge("editToolbar").style.display = "";
}
function updatePreview(a) {
if (a || $WH.ge("previewupdate").checked) {
var editor = $WH.ge("editBox");
clearTimeout(editor.timer);
editor.timer = setTimeout(function () {
var buff = Markup.toHtml($WH.ge("editBox").value, { allow: "Markup.CLASS_STAFF", preview: true });
var qfEditor;
if ((qfEditor = $WH.ge("changelogBox")) && qfEditor.value != "")
buff += Markup.toHtml("[changelog open=true]" + qfEditor.value + "[/changelog]", { allow: "Markup.CLASS_STAFF", preview: true });
if (previewWindow) {
try {
previewWindow.updatePreview(buff);
}
catch(e) {
detach($WH.ge("detachLink"));
}
}
else
$WH.ge("livePreview").innerHTML = buff;
}, 250);
}
}
function updateQfPreview(a) {
if (a || $WH.ge("previewupdate").checked) {
var b = $WH.ge("qfBox");
clearTimeout(b.timer);
b.timer = setTimeout(function () {
var d = Markup.toHtml($WH.ge("qfBox").value.replace(/[\r\n]+/g, ""), { allow: Markup.CLASS_STAFF, root: "ul", preview: true });
if (previewWindow) {
try {
previewWindow.updateQfPreview(d);
}
catch(f) {
detach($WH.ge("detachLink"));
}
}
else {
var c = $WH.ge("liveQfPreview");
if (d)
c.innerHTML = d;
c.parentNode.parentNode.parentNode.parentNode.style.display = (d ? "" : "none");
}
}, 250);
}
}
function detach(c) {
if (previewWindow) {
try {
previewWindow.close();
}
catch(a) {}
previewWindow = 0;
updatePreview(1);
updateQfPreview(1);
c.innerHTML = "Detach";
}
else {
try {
previewWindow = window.open("", "", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
previewWindow.document.open();
var b = '\n\n';
b += "