var imText='/cute-text/qt-binText.php'; var tt=0; var defText="[Type text here and drag it to position]"; var barFontSizeDefault=30; var barFontNameDefault=2305; var text_align=1; var current_ctt; var currently_displaying; var colorMode="text"; //set color for text function appendMainObject(mObject){ document.getElementById("sHolder").appendChild(mObject); } function insertSinlgeImage(url){ var ot=addGraphics(); ot.oFormat["tp"]="gr"; ot.oFormat["i"]=url; currently_displaying=0; showGEdit(ot.tt); setImage(ot.tt); } function clrscr(){ var oChildren = document.getElementById("textHolder").childNodes; while (oChildren.length>0) { var oChild=oChildren[0]; delEdit(oChild.tt,true); } } function updateAllText(){ var oChildren = document.getElementById("textHolder").childNodes; for(var i=0; i < oChildren.length; i++) { // Loop through the children var sObj=oChildren[i]; if (sObj.oFormat["tp"]=="tx") { //update image ctt=sObj.tt; document.getElementById("i_" + ctt).innerHTML=""; var imTextBin=new Image; imTextBin.alt='Click to drag or edit this text'; imTextBin.src=imText+"?" + serializeObject(sObj,false) + "&" + serializeObject(appControl,false); document.getElementById("i_" + ctt).appendChild(imTextBin); } } } function delEdit(ctt,hideedit){ if ((document.getElementById("t_" + ctt)) && hideedit) hideEdit(ctt,true); var oChild=document.getElementById("t_" + ctt); if (oChild) document.getElementById("textHolder").removeChild(oChild); } function setTextAlign(text_align_id){ if (!text_align_id) return false; text_align=text_align_id; var imgs = document.getElementsByTagName("img"); for (var imgi=0;imgiCute Text by The Doll Palace / Click to edit"; document.getElementById("barSaveAreaIUTXT").value=binUrl; document.getElementById("barSaveAreaITTXT").innerHTML="Preview Image"; window.frames["ndisplay"].document.location.href="http://www.thedollpalace.com/cute-text/qt-binComplete.php?qt-id=" + savedId + "&action=download"; document.getElementById("barSaveArea").style.display=""; document.getElementById("btnSave").style.backgroundImage='url(http://ww2.thedollpalace.com/images/icon/icon_dm_save_button2.gif)'; document.getElementById("btnPhotoSave").disabled=false; document.getElementById("btnSave").disabled=false; } function loadSavedItem(savedId){ xajax_load_items(savedId); } function updateApplication(){ document.getElementById("barBgColor").value=appControl.oFormat["bg"]; document.getElementById("qtMain").parentNode.style.backgroundColor=appControl.oFormat["bg"]; } function updateText(ctt){ document.getElementById("barSaveArea").style.display="none"; if (!ctt) return false; var FontSize_id=document.getElementById("barFontSize").options[document.getElementById("barFontSize").selectedIndex].value; var FontName_id=document.getElementById("barFontName").options[document.getElementById("barFontName").selectedIndex].value; var OutlineWidth_id=document.getElementById("barOutlineWidth").options[document.getElementById("barOutlineWidth").selectedIndex].value; var TextColor=document.getElementById("barTextColor").value; var OutlineColor=document.getElementById("barOutlineColor").value; barFontSizeDefault=FontSize_id; barFontNameDefault=FontName_id; var sObj=document.getElementById("t_" + ctt); if (sObj){ if (sObj.oFormat["tp"]=="tx"){ sObj.oFormat["t"]=document.getElementById("a_" + ctt).value; sObj.oFormat["fs"]=FontSize_id; sObj.oFormat["fi"]=FontName_id; sObj.oFormat["tc"]=TextColor; sObj.oFormat["oc"]=OutlineColor; sObj.oFormat["ta"]=text_align; sObj.oFormat["ow"]=OutlineWidth_id; //update image document.getElementById("i_" + ctt).innerHTML=""; var imTextBin=new Image; imTextBin.alt='Click to drag or edit this text'; imTextBin.src=imText+"?" + serializeObject(sObj,false) + "&" + serializeObject(appControl,false); document.getElementById("i_" + ctt).appendChild(imTextBin); document.getElementById("tp_" + ctt).style.display="none"; } } } function setImage(ctt){ document.getElementById("barSaveArea").style.display="none"; if (document.getElementById("t_" + ctt)){ var imageURL=document.getElementById("barFetchImage").value; document.getElementById("t_" + ctt).oFormat["i"]=imageURL; document.getElementById("i_" + ctt).innerHTML=""; var imTextBin=new Image; imTextBin.alt='Click to drag or change this image'; imTextBin.src=imageURL; document.getElementById("barFetchImage").value=""; document.getElementById("i_" + ctt).appendChild(imTextBin); hideEdit(ctt,true); } } function showGEdit(ctt){ if (currently_displaying==ctt) return; var oChildren = document.getElementById("textHolder").childNodes; for (oChildName in oChildren) { if (oChildren[oChildName].tt){ if (ctt!=oChildren[oChildName].tt){ hideEdit(oChildren[oChildName].tt,false); changeOpac(oChildren[oChildName], 30); } } } current_ctt=ctt; document.getElementById("imgToolBar").style.display=""; document.getElementById("th_" + ctt).style.display=""; var tObject=document.getElementById("t_" + ctt); tObject.style.backgroundColor="#ccccff"; changeOpac(tObject, 80); var imageURL=tObject.oFormat["i"]; if (imageURL) document.getElementById("barFetchImage").value=imageURL; tObject.style.borderWidth=1; tObject.style.zIndex=1000; currently_displaying=ctt; } function showEdit(ctt){ if (currently_displaying==ctt) return; var oChildren = document.getElementById("textHolder").childNodes; for (oChildName in oChildren) { if (oChildren[oChildName].tt){ if (ctt!=oChildren[oChildName].tt){ hideEdit(oChildren[oChildName].tt,false); changeOpac(oChildren[oChildName], 30); } } } current_ctt=ctt; document.getElementById("txtToolbar").style.display=""; var tObject=document.getElementById("t_" + ctt); tObject.style.backgroundColor="#ccccff"; changeOpac(tObject, 80); var FontSizeIndex_id=getSelValueIndex(document.getElementById("barFontSize"),tObject.oFormat["fs"]); var FontNameIndex_id=getSelValueIndex(document.getElementById("barFontName"),tObject.oFormat["fi"]); var OutlineWidthIndex_id=getSelValueIndex(document.getElementById("barOutlineWidth"),tObject.oFormat["ow"]); var TextAlign_id=tObject.oFormat["ta"]; var TextColor=tObject.oFormat["tc"]; var OutlineColor=tObject.oFormat["oc"]; var aText=tObject.oFormat["t"]; if (aText) document.getElementById("a_" + tObject.tt).value=aText; if (TextColor) document.getElementById("barTextColor").value=TextColor; if (OutlineColor) document.getElementById("barOutlineColor").value=OutlineColor; document.getElementById("barFontSize").selectedIndex=FontSizeIndex_id; document.getElementById("barFontName").selectedIndex=FontNameIndex_id; document.getElementById("barOutlineWidth").selectedIndex=OutlineWidthIndex_id; document.getElementById("th_" + ctt).style.display=""; tObject.style.borderWidth=1; tObject.style.zIndex=1000; if (TextAlign_id) setTextAlign(TextAlign_id); currently_displaying=ctt; } function hideEdit(ctt,enableOpac){ if (document.getElementById("t_" + ctt)) { var tp=document.getElementById("t_" + ctt).oFormat["tp"]; if (tp=="tx"){ if (!document.getElementById("t_" + ctt).oFormat["t"]) delEdit(ctt,false); else if ((!document.getElementById("t_" + ctt).oFormat["t"]) || (document.getElementById("t_" + ctt).oFormat["t"]=="")) delEdit(ctt,false); } else if (tp=="gr"){ if (document.getElementById("t_" + ctt).oFormat["i"]){ if ((!document.getElementById("t_" + ctt).oFormat["i"]) || (document.getElementById("t_" + ctt).oFormat["i"]=="") || (document.getElementById("t_" + ctt).oFormat["i"]=="http://")) { delEdit(ctt,false); } } } } currently_displaying=0; hide_color(); document.getElementById("txtToolbar").style.display="none"; document.getElementById("imgToolBar").style.display="none"; document.getElementById("barFetchImage").value=""; if (document.getElementById("th_" + ctt)) document.getElementById("th_" + ctt).style.display="none"; if (document.getElementById("t_" + ctt)) { document.getElementById("t_" + ctt).style.borderWidth=0; document.getElementById("t_" + ctt).style.zIndex=ctt; document.getElementById("t_" + ctt).style.backgroundColor="transparent"; } if (enableOpac){ var oChildren = document.getElementById("textHolder").childNodes; for (oChildName in oChildren) { if (oChildren[oChildName] && oChildren[oChildName].tt) changeOpac(oChildren[oChildName], 100); } } } function addText(){ tt++; //create new object var kI=document.createElement("div"); kI.tt=tt; kI.id="t_" + tt; kI.oFormat=new Object(); kI.oFormat["tp"]="tx"; kI.oFormat["t"]=""; kI.oFormat["fs"]=barFontSizeDefault; kI.oFormat["fi"]=barFontNameDefault; kI.style.position="absolute"; kI.style.top=150; kI.style.left=250; kI.style.border="1px solid black"; kI.style.width=250; kI.style.height=160; kI.style.padding=5; kI.style.zIndex=tt; //create image holder var ia=document.createElement("div"); ia.tt=tt; ia.id="i_" + tt; ia.onclick=function(){var ctt=ia.tt; showEdit(ctt);}; //create textarea var ta=document.createElement("textarea"); ta.innerHTML=defText; ta.tt=tt; ta.id="a_" + tt; ta.style.width=250; ta.style.height=80; ta.style.fontFamily="verdana"; ta.style.fontSize=11; ta.onkeydown=function(){document.getElementById("tp_" + ta.tt).style.display="";}; ta.onclick=function(){if (document.getElementById(ta.id).value==defText) highlight(ta);}; var tp=document.createElement("button"); tp.className="btnItemButton"; tp.tt=tt; tp.id="tp_" + tt; tp.appendChild(document.createTextNode("Preview")); tp.style.width=100; tp.style.height=20; tp.style.display="none"; tp.onclick=function(){var ctt=tp.tt; updateText(ctt);}; var tb=document.createElement("button"); tb.className="btnItemButton"; tb.tt=tt; tb.id="tb_" + tt; tb.appendChild(document.createTextNode("OK")); tb.style.width=100; tb.style.height=20; tb.onclick=function(){var ctt=tb.tt; updateText(ctt); hideEdit(ctt,true);}; var tbc=document.createElement("button"); tbc.className="btnItemButton"; tbc.tt=tt; tbc.id="tbc_" + tt; tbc.appendChild(document.createTextNode("Cancel")); tbc.style.width=100; tbc.style.height=20; tbc.onclick=function(){var ctt=tbc.tt; hideEdit(ctt,true);}; var db=new Image; db.tt=tt; db.alt="Delete this text"; db.style.marginTop=5; db.style.cursor="pointer"; db.id="db_" + tt; db.src="http://ww2.thedollpalace.com/images/icon/icon_dm_recycle_bin_a.gif"; db.onclick=function(){var ctt=db.tt; delEdit(ctt,true);}; kI.appendChild(ia); var oTable = document.createElement("TABLE"); oTable.id="th_"+tt; var oTHead = document.createElement("THEAD"); var oTBody = document.createElement("TBODY"); var oTFoot = document.createElement("TFOOT"); var oCaption = document.createElement("CAPTION"); oTable.appendChild(oTHead); oTable.appendChild(oTBody); oTable.appendChild(oTFoot); oTable.appendChild(oCaption); var oRow = document.createElement("TR"); oTHead.appendChild(oRow); var oCell = document.createElement("TD"); oCell.setAttribute('colSpan', '4'); oCell.appendChild(ta); oRow.appendChild(oCell); var oRow = document.createElement("TR"); oTHead.appendChild(oRow); var oCell = document.createElement("TD"); oCell.style.verticalAlign='bottom'; oCell.appendChild(tp); oRow.appendChild(oCell); var oCell = document.createElement("TD"); oCell.style.verticalAlign='bottom'; oCell.appendChild(tb); oRow.appendChild(oCell); var oCell = document.createElement("TD"); oCell.style.verticalAlign='bottom'; oCell.appendChild(tbc); oRow.appendChild(oCell); var oCell = document.createElement("TD"); oCell.style.verticalAlign='bottom'; oCell.appendChild(db); oRow.appendChild(oCell); kI.appendChild(oTable); document.getElementById("textHolder").appendChild(kI); Drag.init(document.getElementById("t_" + tt)); setTextAlign(text_align); showEdit(tt); return kI; } function addGraphics(){ tt++; var kI=document.createElement("div"); kI.tt=tt; kI.id="t_" + tt; kI.oFormat=new Object(); kI.oFormat["tp"]="gr"; kI.oFormat["i"]="http://"; kI.style.position="absolute"; kI.style.top=150; kI.style.left=250; kI.style.border="1px solid black"; kI.style.width=320; kI.style.height=160; kI.style.padding=5; kI.style.zIndex=tt; var ia=document.createElement("div"); ia.tt=tt; ia.id="i_" + tt; ia.onclick=function(){var ctt=ia.tt; showGEdit(ctt);}; var tb=document.createElement("button"); tb.className="btnItemButton"; tb.tt=tt; tb.id="tb_" + tt; tb.appendChild(document.createTextNode("OK")); tb.style.width=100; tb.style.height=20; tb.onclick=function(){var ctt=tb.tt; hideEdit(ctt,true);}; var db=new Image; db.tt=tt; db.alt="Delete this image"; db.style.marginTop=5; db.style.cursor="pointer"; db.id="db_" + tt; db.src="http://ww2.thedollpalace.com/images/icon/icon_dm_recycle_bin_a.gif"; db.onclick=function(){var ctt=db.tt; delEdit(ctt,true);}; kI.appendChild(ia); var oTable = document.createElement("TABLE"); oTable.id="th_"+tt; var oTHead = document.createElement("THEAD"); var oTBody = document.createElement("TBODY"); var oTFoot = document.createElement("TFOOT"); var oCaption = document.createElement("CAPTION"); oTable.appendChild(oTHead); oTable.appendChild(oTBody); oTable.appendChild(oTFoot); oTable.appendChild(oCaption); var oRow = document.createElement("TR"); oTHead.appendChild(oRow); var oCell = document.createElement("TD"); oCell.style.verticalAlign='bottom'; oCell.appendChild(tb); oRow.appendChild(oCell); var oCell = document.createElement("TD"); oCell.style.verticalAlign='bottom'; oCell.appendChild(db); oRow.appendChild(oCell); kI.appendChild(oTable); document.getElementById("textHolder").appendChild(kI); Drag.init(document.getElementById("t_" + tt)); showGEdit(tt); return kI; }