The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Adding Money Code Html

3 posters

Go down

Adding Money Code Html Empty Adding Money Code Html

Post by xXEmo_LoveXx November 4th 2008, 4:39 pm

Ok so I have this code that adds virtual money or whatever you decide to call it to each person when they post it's kind of like a rewards system you know and I was wondering if anyone could tell me where to post it to make it work. In other forums it's posted in the global footer but I can't seem to find one on here. Please help!

Code Ex:
<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 = 1;

// What do you want to call your money?
var NameOfMoney = 'Screams';

// 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>
avatar
xXEmo_LoveXx
New Member

Posts : 6
Reputation : 0
Language : English

Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by Guest November 4th 2008, 4:50 pm

Are you on veersion 2 site with template editing?
avatar
Guest
Guest


Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by xXEmo_LoveXx November 4th 2008, 4:52 pm

yeah i'm pretty sure that i am, phpbb2 right?
avatar
xXEmo_LoveXx
New Member

Posts : 6
Reputation : 0
Language : English

Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by Guest November 4th 2008, 5:10 pm

link to your forum?
avatar
Guest
Guest


Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by xXEmo_LoveXx November 4th 2008, 5:14 pm

taintedpixels.forumotion.com
I haven't edited anything on it yet I'm wanting to get this working before I do that.
avatar
xXEmo_LoveXx
New Member

Posts : 6
Reputation : 0
Language : English

Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by Guest November 4th 2008, 5:15 pm

That is version three site
avatar
Guest
Guest


Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by xXEmo_LoveXx November 4th 2008, 5:18 pm

i went to display>>styles>>version>> and changed it from 3 to 2 but kept the current style
avatar
xXEmo_LoveXx
New Member

Posts : 6
Reputation : 0
Language : English

Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by Guest November 4th 2008, 5:22 pm

Yes that is because the style is for only version 3
avatar
Guest
Guest


Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by xXEmo_LoveXx November 4th 2008, 5:23 pm

oh okay i'm changing it now, what do i do after it's changed?
avatar
xXEmo_LoveXx
New Member

Posts : 6
Reputation : 0
Language : English

Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by Guest November 4th 2008, 5:23 pm

Find out if you have template editing. Admin panel>>Display>>near the botton left.
avatar
Guest
Guest


Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by xXEmo_LoveXx November 4th 2008, 5:25 pm

yeah i do i did with the other style i had too
avatar
xXEmo_LoveXx
New Member

Posts : 6
Reputation : 0
Language : English

Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by T__________T December 11th 2008, 12:57 am

Where i put this code at ?!~
avatar
T__________T
New Member

Male Posts : 15
Reputation : 0
Language : chinese
Location : U.S.A

Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by room28spartan December 11th 2008, 1:23 am

Where do you put it
room28spartan
room28spartan
Forumember

Male Posts : 235
Reputation : 3
Language : Gibberish
Location : I know where you live too!

Back to top Go down

Adding Money Code Html Empty Re: Adding Money Code Html

Post by T__________T December 12th 2008, 7:24 pm

I am not put this code to any where yet ~
I go make it . After i Understanding more that ~
avatar
T__________T
New Member

Male Posts : 15
Reputation : 0
Language : chinese
Location : U.S.A

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum