Jump to content

Help With a Script


Chocolate570
 Share

Recommended Posts

I need to change this script so that instead of creating a option box, it should create a text box. To test it, go sign up an invisionfree board, then edit your profile. Put this in the footer section to test it.

<script type="text/javascript"><!--/*Display mood in mini profile, view profile.Created By Peter[url="http://s9.invisionfree.com/iFusion/"]http://s9.invisionfree.com/iFusion/[/url]*///Add moods herevar iMoods = ["Happy", "Sad", "Angry", "Euphoric", "Cheerful", "Gloomy"];//URL to be used when users don't have one.var emptyURL = "http://invisionfree.com";iCur = {  mood: null};var iTable = document.getElementsByTagName("table");var iCell = document.getElementsByTagName("td");String.prototype.check_web_url = function(type){  mRe = /\[mood:(.+?)\]/i  if(this.match(mRe)){      iCur.mood = RegExp.$1;      document.theForm.WebSite.value = this.replace(mRe, "");  } else if(type){      if(this.length == 0 || this.match(/^http:\/\/$/i)){        document.theForm.WebSite.value = emptyURL + "[mood:" + iCur.mood + "]";      } else {        document.theForm.WebSite.value += "[mood:" + iCur.mood + "]";      }  }}function makeMDrop(){  var iDrop = document.createElement("select");  var iFont = document.createElement("font");  var iTxt = document.createTextNode("Select Mood");  var iOptTxt = document.createElement("option");  iFont.style.fontWeight = "bold";  iFont.appendChild(iTxt);  iOptTxt.text = "Select Mood";  iOptTxt.value = "null";  iDrop.options.add(iOptTxt);  iDrop.appendChild(iOptTxt);  iDrop.id = "mood";  iDrop.className = "forminput";  for(m=0;m<iMoods.length;m++){      var iOpt = document.createElement("option");      iOpt.value = iMoods[m];      iOpt.text = iMoods[m];      iDrop.options.add(iOpt);      if(iMoods[m] == iCur.mood){        iDrop.selectedIndex = (m + 1);      }  }  for(c=0;c<iCell.length;c++){      if(iCell[c].className == "pformleft" && iCell[c].innerHTML.match(/<b>Your website url<\/b>/i)){        var iParent = iCell[c].parentNode.parentNode;        var nCell = iParent.insertRow(2).insertCell(0);        nCell.className = "pformleft";        nCell.appendChild(iFont);        var nCell = iParent.rows[2].insertCell(1);        nCell.className = "pformright";        nCell.appendChild(iDrop);      }  }}function doViewPro(){  var iFont = document.createElement("font");  var iTxt = document.createTextNode("Mood");  iFont.style.fontWeight = "bold";  iFont.appendChild(iTxt);  for(c=0;c<iCell.length;c++){      if(iCell[c].className == "row1" && iCell[c].width == "70%" && iCell[c].innerHTML.match(/\[mood:(.+?)\]/gi)){        iCur.mood = RegExp.$1;        iCellHTML = decodeURI(iCell[c].innerHTML)        iCell[c].innerHTML = iCellHTML.replace(/\[mood:(.+?)\]/gi, "");        var iParent = iCell[c].parentNode.parentNode;        var nCell = iParent.insertRow(2).insertCell(0);        nCell.className = "row3";        nCell.appendChild(iFont);        var nCell = iParent.rows[2].insertCell(1);        nCell.className = "row1";        nCell.appendChild(document.createTextNode(iCur.mood));      }  }}function miniProfile(){  var re = /(\[|%5B)mood:(.+?)(\]|%5D)/gi  for(t=0;t<iTable.length;t++){      if(iTable[t].width == "100%" && iTable[t].cellSpacing == "1" && iTable[t].cellPadding == "3" && iTable[t].innerHTML.match(re)){        var iDiv = iTable[t].getElementsByTagName("div");        for(d=0;d<iDiv.length;d++){            if(iDiv[d].align == "left" && iDiv[d].className == "darkrow3" && iDiv[d].innerHTML.match(re)){              iCur.mood = RegExp.$2;              iDivHTML = decodeURI(iDiv[d].innerHTML);              iDiv[d].innerHTML = iDivHTML.replace(re, "");            }        }        var iSpan = iTable[t].getElementsByTagName("span");        for(s=0;s<iSpan.length;s++){            if(iSpan[s].className == "postdetails" && iSpan[s].innerHTML.match(/(Posts: \d+<br>)/i)){              iSpan[s].innerHTML = iSpan[s].innerHTML.replace(RegExp.$1, RegExp.$1 + "Mood: " + iCur.mood + "<br />");            }        }      }  }}if(location.href.match(/act=UserCP&CODE=01/)){  document.theForm.WebSite.value.check_web_url();  makeMDrop();  if(document.theForm){      var theDrop = document.getElementById("mood");      document.theForm.onsubmit = function(){        iCur.mood = theDrop.options[theDrop.options.selectedIndex].value;        document.theForm.WebSite.value.check_web_url(true);      }  }}if(location.href.match(/\?showuser=\d+/i)){  doViewPro();}if(location.href.match(/\?showtopic=\d+/i)){  miniProfile();}//--></script>

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...