Post by |<::.|.::>|snarf|<::.|.::>| on Aug 29, 2006 19:06:30 GMT -8
Forum URL: tupeloforums.proboards36.com
Problem: The Allow Members to select a Mood in their profile, by Zando Code and the Money Hack v3 code by Ross and Peter do not like one another. Order does not matter.
I had the Mood code before I added the Money Hack code and everything seemed to be fine UNTIL I changed a member's money amount, and the Mood code stopped working for that member AND the change I made to that user's profile money amount will not take effect. Either code on their own work fine, but whether you put one on top of the other causes this error.
To summarize:
If left alone, both codes work, but when you make a change to a member's Money with Ross' code, then the mood code takes a dump, and changes to the member's money do not go into effect.
Here are both codes as I have them on my forum:
Money Hack v3
Mood Code
URL's changed in mood code to protect the innocent.
Any idea on how to fix this?
snarf
Problem: The Allow Members to select a Mood in their profile, by Zando Code and the Money Hack v3 code by Ross and Peter do not like one another. Order does not matter.
I had the Mood code before I added the Money Hack code and everything seemed to be fine UNTIL I changed a member's money amount, and the Mood code stopped working for that member AND the change I made to that user's profile money amount will not take effect. Either code on their own work fine, but whether you put one on top of the other causes this error.
To summarize:
If left alone, both codes work, but when you make a change to a member's Money with Ross' code, then the mood code takes a dump, and changes to the member's money do not go into effect.
Here are both codes as I have them on my forum:
Money Hack v3
<script type="text/javascript">
<!--
/*
Money Hack v3 - Global footer
Created by Ross, Concept by Peter
This code cannot be reposted at anywhere other than ProBoards Support without permission.
This header must stay intact at all times.
*/
// The value of money a member should gain for each post
var MoneyPerPost = 2;
// What do you want to call your money?
var NameOfMoney = 'TF BUCKS';
// The symbol that will appear next to the money
var SymbolOfMoney = '$';
// No need to edit below
var re = /\[M:(-)?(\d+)\]/im
function updateMon() {
var monChange = document.getElementById('monChange');
var curMon = document.getElementById('monDisplay');
var monType = document.getElementById('monType');
mon = parseInt(curMon.value.replace( SymbolOfMoney , '' ),10) + parseInt( ( ( monType.value == '-' ) ? '-' : '' ) + monChange.value, 10 )
monChange.value = 0;
if(isNaN(mon)) {
alert('You must enter a numerical value')
return false;
}
curMon.value = SymbolOfMoney + mon;
return true;
}
function fNum(num){
if(!isNaN(num)){
num = num.toLocaleString().replace(/\.\d+/, "");
} else {
num = 0;
}
return num;
}
function saveMon() {
updateMon();
var newMon = document.getElementById('monDisplay').value.replace( SymbolOfMoney , '' );
newMon -= (parseInt((document.modifyForm.posts.value) * MoneyPerPost, 10));
document.modifyForm.customtitle.value += '[M:'+newMon+']';
return true;
}
var td = document.getElementsByTagName('td');
for(i=0; i<td.length; i++) {
if(td.item(i).width == '20%' && td.item(i).vAlign == 'top' && td.item(i).parentNode.innerHTML.match(/Posts: (.+?)</)) {
curMon = (RegExp.$1.replace(/,/g,'') * MoneyPerPost);
curMon += td.item(i).innerHTML.match(re)? parseInt((RegExp.$1+RegExp.$2), 10) : 0;
if(td.item(i).lastChild.nodeName.toLowerCase() != 'br')
td.item(i).appendChild(document.createElement('br'));
td.item(i).appendChild(document.createTextNode(NameOfMoney +': '+ SymbolOfMoney + fNum(curMon)));
td.item(i).innerHTML = td.item(i).innerHTML.replace(/<br>\[M:(-)?(\d+)\](<br>member is)/i,'$3').replace(/(<br>(.+?))\[M:(-)?(\d+)\](<br>)/i,'$1$5').replace(/\[M:(-)?(\d+)\]/gim,'');
}
else if(location.href.match(/ion=viewpro/) && td.item(i).width == '25%' && td.item(i).innerHTML.match(/>Posts:</)) {
var monTitle = document.createElement('font');
monTitle.size = '2';
monTitle.appendChild(document.createTextNode(NameOfMoney+':'));
var userMon = document.createElement('font');
userMon.size = '2';
userMon.appendChild(document.createTextNode(SymbolOfMoney+fNum(curMon)));
monRow = td.item(i).parentNode.parentNode.insertRow(6);
monRow.insertCell(0).appendChild(monTitle);
monRow.insertCell(1).appendChild(userMon);
break;
}
}
if(document.modifyForm && document.modifyForm.customtitle) {
if(document.modifyForm.personaltext.value.match(re) && !document.modifyForm.customtitle.value.match(re))
{
document.modifyForm.customtitle.value += '[M:'+RegExp.$1+RegExp.$2+']';
document.modifyForm.personaltext.value = document.modifyForm.personaltext.value.replace(re,'');
}
curMon = document.modifyForm.customtitle.value.match(re)? parseInt(RegExp.$1+RegExp.$2, 10) : 0;
Posts = document.modifyForm.posts.value.match(/(-)?(\d+)/)? parseInt((RegExp.$1+RegExp.$2), 10) : 0;
curMon += (Posts * MoneyPerPost)
document.modifyForm.customtitle.value = document.modifyForm.customtitle.value.replace(re,'');
document.modifyForm.customtitle.maxLength = 490;
var display = document.createElement('input');
display.type = 'text';
display.id = 'monDisplay';
display.size = parseInt(curMon.toString().length, 10) + 2;
display.disabled = true;
display.value = SymbolOfMoney + curMon;
var type = document.createElement('select');
type.id = 'monType';
type.appendChild(document.createElement('option'));
type.firstChild.appendChild(document.createTextNode('+'));
type.appendChild(document.createElement('option'));
type.lastChild.appendChild(document.createTextNode('-'));
type.lastChild.value = '-';
var mon = document.createElement('input');
mon.type = 'text';
mon.id = 'monChange';
mon.size = 5;
mon.value = 0;
var update = document.createElement('input');
update.type = 'button';
update.value = 'Update';
update.onclick = function(){ updateMon(); };
var editMon = document.createElement('font');
editMon.appendChild(type);
editMon.appendChild(document.createTextNode(' '));
editMon.appendChild(mon);
editMon.appendChild(document.createTextNode(' '));
editMon.appendChild(update);
var newTitle = document.createElement('font');
newTitle.size = '2';
newTitle.appendChild(document.createTextNode(NameOfMoney +': '));
newTitle.appendChild(display);
var newDes = document.createElement('font');
newDes.size = '1';
newDes.appendChild(document.createTextNode('Here you can edit the amount of '+NameOfMoney+' a member has. Just enter the value of ' +NameOfMoney+ ' to add or subtract.'));
var target = document.modifyForm.customtitle.parentNode.parentNode.parentNode.parentNode.insertRow(2);
target.insertCell(0).appendChild(newTitle);
target.insertCell(1).appendChild(editMon)
target.insertCell(2).appendChild(newDes);
document.getElementsByName('profileaction').item(0).onclick = function() { saveMon(); };
}
//-->
</script>
Mood Code
<script type="text/javascript">
<!--
/*Allow Memebers to select a Mood in their profile, by Zando*/
var zEmoVar=new Array();
//Edit These
zEmoVar[0]='<option value="http://www.urlofmydomain.com/moods/amused.gif">Amused</option>';
zEmoVar[1]='<option value="http://www.urlofmydomain.com/moods/annoyed.gif">Annoyed</option>';
zEmoVar[2]='<option value="http://www.urlofmydomain.com/moods/cold.gif">Cold</option>';
zEmoVar[3]='<option value="http://www.urlofmydomain.com/moods/confused.gif">Confused</option>';
zEmoVar[4]='<option value="http://www.urlofmydomain.com/moods/curious.gif">Curious</option>';
zEmoVar[5]='<option value="http://www.urlofmydomain.com/moods/cynical.gif">Cynical</option>';
zEmoVar[6]='<option value="http://www.urlofmydomain.com/moods/depressed.gif">Depressed</option>';
zEmoVar[7]='<option value="http://www.urlofmydomain.com/moods/drunk.gif">Drunk</option>';
zEmoVar[8]='<option value="http://www.urlofmydomain.com/moods/embarrassed.gif">Embarassed</option>';
zEmoVar[9]='<option value="http://www.urlofmydomain.com/moods/energetic.gif">Energetic</option>';
zEmoVar[10]='<option value="http://www.urlofmydomain.com/moods/exhausted.gif">Exhausted</option>';
zEmoVar[11]='<option value="http://www.urlofmydomain.com/moods/giggly.gif">Giddy</option>';
zEmoVar[12]='<option value="http://www.urlofmydomain.com/moods/happy.gif">Happy</option>';
zEmoVar[13]='<option value="http://www.urlofmydomain.com/moods/hot.gif">Hot</option>';
zEmoVar[14]='<option value="http://www.urlofmydomain.com/moods/hungry.gif">Hungry</option>';
zEmoVar[15]='<option value="http://www.urlofmydomain.com/moods/hyper.gif">Hyper</option>';
zEmoVar[16]='<option value="http://www.urlofmydomain.com/moods/indescribable.gif">Indescribable</option>';
zEmoVar[17]='<option value="http://www.urlofmydomain.com/moods/mad.gif ">Mad</option>';
zEmoVar[18]='<option value="http://www.urlofmydomain.com/moods/mischievous.gif">Mischevious</option>';
zEmoVar[19]='<option value="http://www.urlofmydomain.com/moods/silly.gif">Silly</option>';
zEmoVar[20]='<option value="http://www.urlofmydomain.com/moods/working.gif">Working</option>';
//Do not Edit below here
var tdz=document.getElementsByTagName("td")
var inp=document.getElementsByTagName("input")
var sel=document.getElementsByTagName("select")
var tbl=document.getElementsByTagName("table")
if(location.href.match(/modifyprofile/)){
document.write('<input name="zDataStore" type="hidden"></input>')
if(document.modifyForm.signature.innerHTML.match(/{=}(.+){\/=}/)){
var zle124=RegExp.$1
for(z=0;z<inp.length;z++){
if(inp[z].name.match(/zDataStore/)){
inp[z].value=zle124
document.modifyForm.signature.innerHTML=document.modifyForm.signature.innerHTML.replace(/{=}(.+){\/=}/, '');
}
}
}
for(z=0;z<tbl.length;z++){
if(tbl[z].width=="650" && tbl[z].rows[0].cells[0].innerHTML.match(/Gender:/)){
var zRow=tbl[z].insertRow(4);var zCell=zRow.insertCell(0);
var zCell2=zRow.insertCell(1);var zCell3=zRow.insertCell(2);
zCell.width="160";zCell.vAlign="top";
zCell.innerHTML='<font size="-1">Mood:</font>';
zCell2.width="245";zCell2.vAlign="top";
zCell2.innerHTML='<select name="zEmotion" onchange="zEmDis()"><option value="zNoEm">Emotion</option><option value="zNoEm">None</option>'+zEmoVar+'</select><b'+'r /><table><tr><td id="zEmDisCell"></td></tr></table>';zCell3.width="245";
zCell3.vAlign="top";
zCell3.innerHTML='<font size="-2">If you wish to have a mood emotion displayed in your profile, then you are able to select one of the provided emotions.</font>';
}
}
function zEmDis(){
for(z=0;z<tdz.length;z++){
if(tdz[z].id.match(/zEmDisCell/)){
for(a=0;a<sel.length;a++){
if(sel[a].name.match(/zEmotion/)){
tdz[z].innerHTML='<img src="'+sel[a].value+'">';
for(i=0;i<inp.length;i++){
if(inp[i].name.match(/zDataStore/)){
inp[i].value=sel[a].value
}
}
if(sel[a].value.match(/zNoEm/)){
tdz[z].innerHTML='';
}
}
}
}
}
}
for(a=0;a<inp.length;a++){
if(inp[a].name.match(/profileaction/) && inp[a].value.match(/Modify Profile/)){
inp[a].onclick=function(){
for(z=0;z<inp.length;z++){
if(inp[z].name.match(/zDataStore/) && !inp[z].value.match(/zNoEm/)){
document.modifyForm.signature.innerHTML+='{=}'+inp[z].value+'{\/=}';
};
}
}
}
}
}
for(z=0;z<tdz.length;z++){
if(tdz[z].width=="20%" && tdz[z].vAlign=="top" && tdz[z].className.match(/windowbg(2)?/) && tdz[z].innerHTML.match(/member is/) && tdz[z+1].innerHTML.match(/{=}(.+){\/=}/)){
var zzFFEEm=RegExp.$1
if(zzFFEEm!="zNoEm"){
tdz[z].innerHTML+='<b'+'r />Mood: <img src="'+zzFFEEm+'" />';
}
tdz[z+1].innerHTML=tdz[z+1].innerHTML.replace(/{=}(.+){\/=}/, '');
}
}
//-->
</script>
URL's changed in mood code to protect the innocent.
Any idea on how to fix this?
snarf