Adding Money Code Html
3 posters
Page 1 of 1
Adding Money Code Html
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>
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>
xXEmo_LoveXx- New Member
- Posts : 6
Reputation : 0
Language : English
Re: Adding Money Code Html
yeah i'm pretty sure that i am, phpbb2 right?
xXEmo_LoveXx- New Member
- Posts : 6
Reputation : 0
Language : English
Re: Adding Money Code Html
taintedpixels.forumotion.com
I haven't edited anything on it yet I'm wanting to get this working before I do that.
I haven't edited anything on it yet I'm wanting to get this working before I do that.
xXEmo_LoveXx- New Member
- Posts : 6
Reputation : 0
Language : English
Re: Adding Money Code Html
i went to display>>styles>>version>> and changed it from 3 to 2 but kept the current style
xXEmo_LoveXx- New Member
- Posts : 6
Reputation : 0
Language : English
Re: Adding Money Code Html
oh okay i'm changing it now, what do i do after it's changed?
xXEmo_LoveXx- New Member
- Posts : 6
Reputation : 0
Language : English
Re: Adding Money Code Html
Find out if you have template editing. Admin panel>>Display>>near the botton left.
Guest- Guest
Re: Adding Money Code Html
yeah i do i did with the other style i had too
xXEmo_LoveXx- New Member
- Posts : 6
Reputation : 0
Language : English
Re: Adding Money Code Html
Where i put this code at ?!~
T__________T- New Member
- Posts : 15
Reputation : 0
Language : chinese
Location : U.S.A
Re: Adding Money Code Html
Where do you put it
room28spartan- Forumember
- Posts : 235
Reputation : 3
Language : Gibberish
Location : I know where you live too!
Re: Adding Money Code Html
I am not put this code to any where yet ~
I go make it . After i Understanding more that ~
I go make it . After i Understanding more that ~
T__________T- New Member
- Posts : 15
Reputation : 0
Language : chinese
Location : U.S.A
Similar topics
» Adding HTML Code in Footer for Ads
» Adding an html code (hide button)
» Adding an html code (megaupload filebox)
» Problems Editing Posts and adding HTML Code
» adding widget with HTML code to show things such as teamspeak viewer on portal
» Adding an html code (hide button)
» Adding an html code (megaupload filebox)
» Problems Editing Posts and adding HTML Code
» adding widget with HTML code to show things such as teamspeak viewer on portal
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum