📄 menugenerator.js
字号:
p.childs[p.childCount]=null;
p.childCount--;
for(i=index;i<p.childCount;i++){
p.childs[i].childIndex--;
}
return 1;
}
else return 0;
}
this.write=function(){
var tab="\t";
for(var i=0;i<this.index;i++){
tab+="\t";
}
this.xml="\n"+tab+"<"+sptags[this.type];
if(this.style>0)this.xml+=" style=\""+spform2.xtyles.options[this.style].value+"\"";
if(this.label!="")this.xml+=" label=\""+duzelt1(this.label)+"\"";
//if(this.href!="")this.xml+=" href=\""+duzelt2(this.href)+"\"";
if(this.href!="")this.xml+=" href=\""+this.href+"\"";
if(this.width!="")this.xml+=" width=\""+this.width+"\"";
var state=0;
for(var j=0;j<this.childCount;j++){
if(this.childs[j]!=null){
if(this.childs[j].type>=0){
if(state==0){state=1;this.xml+=">";}
this.childs[j].write();
this.xml+=this.childs[j].xml;
}
}
}
if(state==0)this.xml+=" />";
else this.xml+="\n"+tab+"</"+sptags[this.type]+">";
}
this.spdisplay=function(){
var left=16;
left+=this.index*64;
var str="";
if(this.type==0)str="root menu ";
if(this.label!="")str+=" "+this.label;
if(this.style>0)str+="<br>style=\""+spform2.xtyles.options[this.style].value+"\"";
var style="style='margin-left:"+left+"; ";
if(this.id==selMenu){
if(this.type<0)style+="border:1px #00CCFF dotted;";
else if(this.type>=0&&this.type<2)style+="color:#888888;border:1px #00CCFF solid;";
else if(this.type==2)style+="color:#888888;border:1px #00CCFF solid;";
else if(this.type==3)str="<hr style='height:4px ;color:#00CCFF;'>";
}
else {
if(this.type<0)style+="border:1px #444444 dotted;";
else if(this.type>=0&&this.type<2)style+="color:#888888;border:1px #444444 solid;";
else if(this.type==2)style+="color:#888888;border:1px #444444 solid;";
else if(this.type==3)str="<hr style='height:4px;color:#888888;'>";
}
this.disHTML="";
this.disHTML="<span class='tree2' "+style+"' onClick='fntree1("+this.id+")'>"+str+"</span><br>";
for(var j=0;j<this.childCount;j++){
if(this.childs[j]!=null){
this.childs[j].spdisplay();
this.disHTML+=this.childs[j].disHTML;
}
}
if(this.type==0){
menutree.innerHTML=this.disHTML;
}
}
}
//------------------------------------------------------------------------------
function savestyle(style){
var name="";
var el=null;
var str1="";
var c=style.nod;
for(i=0;i<spform.elements.length;i++){
el=spform.elements[i];
name=spform.elements[i].name;
if(name.indexOf("style_normal_")>=0){
str1=name.substr(12);
style[nods1[c]+str1]=el.value;
}
else if(name.indexOf("style_")>=0){
str1=name.substr(6);
style[str1]=el.value;
}
}
}
//------------------------------------------------------------------------------
function changestyle(index){
var adet=spform.xtyle_parent.options.length;
for(i=adet-1;i>index;i--){
spform.xtyle_parent.options[i]=null;
}
for(i=adet-1;i<index;i++){
spform.xtyle_parent.add(new Option(spxml.styles[i].name,spxml.styles[i].name,false,false));
}
savestyle(spxml.cursty);
change(index);
spdiv1.style.visibility="hidden";
}
//------------------------------------------------------------------------------
function fnhelp0(){
spdiv1.style.visibility="hidden";
}
//------------------------------------------------------------------------------
function fnpopupshow(popup,obj,x,y){
var p=obj;
var left=x;
var top=y;
while(p!=null){
left+=p.offsetLeft;
top+=p.offsetTop;
p=p.offsetParent;
}
popup.style.posLeft=left;
popup.style.posTop=top;
if(spfocus!=null)spfocus.sponblur();
popup.style.visibility="visible";
}
//------------------------------------------------------------------------------
function fnhelp2(obj,id){
colorBox.div.style.visibility="hidden";
spdiv1.style.visibility="hidden";
spdiv1.innerHTML=helpstr1[id];
//spdiv1.innerHTML="<b>#"+id+"</b> "+helpstr1[id];//silinecek gecici
spdiv1.style.posHeight=0;
fnpopupshow(spdiv1,obj,-8,22);
}
//------------------------------------------------------------------------------
function fnhelp1(){
var index=this.helpid;
var nod=nods1[spxml.cursty.nod];
var helpstr=helpstr1[this.helpid];
if(index>=30 && index<=50)helpstr=helpstr.replace(/\x23/g,nod);
colorBox.div.style.visibility="hidden";
spdiv1.style.visibility="hidden";
spdiv1.innerHTML=helpstr;
//spdiv1.innerHTML="<b>#"+index+"</b> "+helpstr;//silinecek gecici
spdiv1.style.posHeight=0;
var x=-8;
var y=22;
fnpopupshow(spdiv1,this,x,y);
}
//------------------------------------------------------------------------------
function deletestyle(){
var x=null;
var index=spxml.cursty.index;//incele
for(i=0;i<countMenu;i++){
if(objMenu[i].style==index+1){
fnhelp2(right0,2);
return;
}
}
if(spxml.styleCount>1){
for(i=index;i>0;i--)spform.xtyle_parent.options[i]=null;
spxml.styleCount--;
var name=spxml.styles[index].name;
for(i=index;i<spxml.styleCount;i++){
spxml.styles[i]=spxml.styles[i+1];
spxml.styles[i].index--;
spform2.xtyles.options[i+1].value=spform2.xtyles.options[i+2].value;
spform2.xtyles.options[i+1].text=spform2.xtyles.options[i+2].text;
if(spxml.styles[i].parent==name)spxml.parent="";
}
spxml.styles[spxml.styleCount]=null;
spform2.xtyles.options[spxml.styleCount+1]=null;
change((index>0)?index-1:0);
}
else if(spxml.styleCount==1){
spxml.styles[0]=new Style();
spxml.styles[0].name="style"+(++spxml.uniqueCount);
spform2.xtyles.options[1].value=spxml.styles[0].name;
spform2.xtyles.options[1].text=spxml.styles[0].name;
change(0);
}
}
//------------------------------------------------------------------------------
function change(index){
rightactive(0);
spxml.cursty=spxml.styles[index];
var style=spxml.cursty;
style.nod=0;
for(i=0;i<5;i++)window["spnod"+i].innerText=nods2[0];
for(i=0;i<spform.elements.length;i++){
el=spform.elements[i];
name=spform.elements[i].name;
if(name.indexOf("style_")>=0){
str1=name.substr(6);
el.value=style[str1];
}
}
}
//------------------------------------------------------------------------------
function newstyle(){
var el=null;
var str1="";
var index=spxml.cursty.index;
savestyle(spxml.cursty);
spform.xtyle_parent.add(new Option(spxml.cursty.name,spxml.cursty.name,false,false));
spxml.cursty=spxml.addStyle(null);
change(spxml.cursty.index);
spform2.xtyles.add(new Option(spxml.cursty.name,spxml.cursty.name,false,false));
}
//------------------------------------------------------------------------------
function fnkp1(){//rakam
var c=event.keyCode;
if(!(c>=48&&c<=58)&&c!=43&&c!=45)return false;
}
//------------------------------------------------------------------------------
function fnkp2(){//color
var c=event.keyCode;
var len=this.value.length;
if(len>=6)return false;
if(!(c>=48&&c<=58)&&!(c>=65&&c<=70)&&!(c>=97&&c<=102))return false;
}
//------------------------------------------------------------------------------
function fnku2(){//color
if(colorBox.div.style.visibility=="visible"){
colorBox.selected=0;
colorBox.div.style.visibility="hidden";
}
}
//------------------------------------------------------------------------------
function fnkp3(){//alpha
var c=event.keyCode;
if(!(c>=48&&c<=58))return false;
}
//------------------------------------------------------------------------------
function fnkp4(){//string
var c=event.keyCode;
if(c==38||c==60||c==62||c==39||c==34)return false;
}
//------------------------------------------------------------------------------
function sponblur(){
var input=this.op;
input.value=this.value;
this.style.visibility="hidden";
input.style.visibility="visible";
spfocus=null;
}
//------------------------------------------------------------------------------
function sponfocus(){
var select=this.op;
for(i=0;i<select.options.length;i++){
if(select.options[i].value==this.value){
select.options.selectedIndex=i;
break;
}
}
this.style.visibility="hidden";
if(browser.ver>=5.5)select.style.posLeft=this.offsetLeft-this.offsetParent.offsetLeft;
else select.style.posLeft=this.offsetLeft;
select.style.posTop=this.offsetTop;
select.style.visibility="visible";
if(spfocus!=null)spfocus.sponblur();
spfocus=select;
}
//------------------------------------------------------------------------------
document.onclick=function(){
if(spfocus!=null&&spfocus!=event.srcElement)spfocus.sponblur();
if(spdiv1.style.visibility=="visible")spdiv1.style.visibility="hidden";
}
//------------------------------------------------------------------------------
window.onresize=function(){
if(spfocus!=null&&spfocus!=event.srcElement)spfocus.sponblur();
}
//------------------------------------------------------------------------------
function copy2Clipboard() {
fnxmlyaz();
textRange = spform2.xmlstr.createTextRange();
textRange.execCommand("RemoveFormat");
textRange.execCommand("Copy");
}
//------------------------------------------------------------------------------
function fnviewmenu(){
if(openwin==null){
fnOpenwin();
}
else if(openwin.closed==true){
fnOpenwin();
}
else {
openwin.location.reload();
openwin.focus();
}
}
//------------------------------------------------------------------------------
function alpfocus(){
this.oldValue=this.value;
}
//------------------------------------------------------------------------------
function alpblur(){
var x=parseInt(this.value,10);
if(isNaN(x))this.value=this.oldValue;
else if(x<0||x>100)this.value=this.oldValue;
else this.value=x;
}
//------------------------------------------------------------------------------
function stylenameonblur(){
if(this.value.length<1) {
var degisti=false;
this.value=spxml.cursty.name;
degisti=true;
}
else if(spxml.cursty.name!=this.value){
var mevcut=-1;
for(i in spxml.styles){
if(spxml.cursty!=spxml.styles[i]&&spxml.styles[i].name==this.value)mevcut=i;
}
if(mevcut>=0){
this.value=spxml.cursty.name;
changestyle(mevcut);
}
else {
spxml.cursty.name=this.value;
degisti=true;
}
}
if(degisti==true){
var i=spxml.cursty.index+1;
spform2.xtyles.options[i].value=this.value;
spform2.xtyles.options[i].text=this.value;
spform2.xtyles.onchange();
}
}
//------------------------------------------------------------------------------
window.onunload=function(){
if(openwin!=null){
if(openwin.closed==false)openwin.close();
}
}
//------------------------------------------------------------------------------
function rightactive(index){
var oldright=window["right"+(spxml.cursty.nod+3)];
var newright=window["right"+(index+3)];
oldright.style.backgroundColor="#CCCCCC";
oldright.style.color="#000000";
newright.style.backgroundColor="#444444";
newright.style.color="#FFFFFF";
}
function rightover(){
fnhelp0();
if(this.rightindex>=3 && this.rightindex<=5){
fnhelp2(right3,this.rightindex);
if(this.rightindex==spxml.cursty.nod+3)return;
}
else if(this.rightindex>=0 && this.rightindex<2){
fnhelp2(right0,this.rightindex);
}
else if(this.rightindex==2){
spdiv1.style.posHeight=0;
spdiv1.style.visibility="hidden";
var str="Birden daha fazla style oldu饀 zaman bu style\' lardan herhangi birisini aktif yapmay
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -