Post by Ross on Sept 28, 2005 11:47:41 GMT -8
Global Footer
This merges the members post count with their karma to give a new 'Money' Type value, this value is calculated using the amount of karma they have earnt and the number of posts they have. Edit the variables near the top of the script with the amount of Money they get for each karma/post. Anyone with the ability to modify profiles will be able to modify the amount of money a user has in their profile.
Note, this will remove the 'karma' value from the mini-profile.
<script type="text/javascript">
<!--
/*
Karma-Money Hack by Ross
goes in global footer
101support.proboards43.com
do not edit or redistribute without permission
this header must stay intact at all times
*/
// Number of points for each karma a member has
var KarmaToAdd = 10;
// Number of points for each post a member has
var PostToAdd = 2;
// Name of 'Points'
var iName = 'Reputation:'
// No need to edit below
var td = document.getElementsByTagName('td');
for(i=0; i<td.length; i++)
{
if(td.width == '20%' && td.innerHTML.match(/Karma:/i))
{
karma = (td.parentNode.innerHTML.match(/Karma: (.+?)</i))? RegExp.$1 : '';
posts = (td.innerHTML.match(/Posts: (.+?)</i))? RegExp.$1 : '';
newPost = PostToAdd * parseInt(posts.replace(/,/g,''));
newKarma = KarmaToAdd * parseInt(karma.replace(/,/g,''));
additional = (td.innerHTML.match(/\[P:(.+?)\]/))? parseInt(RegExp.$1) : '';
td.innerHTML = td.innerHTML.replace(/<br>\[P:(.+?)\]<br>/i,'<br/>').replace(/\[P:(.+?)\]/,'');
newMon = newKarma + newPost + additional;
td.innerHTML = td.innerHTML.replace(new RegExp('Karma: '+karma, 'i'), iName +' '+newMon)
}
}
if(document.modifyForm && document.modifyForm.karma)
{
form = document.modifyForm;
obj = form.karma.parentNode.parentNode.parentNode;
newTR = obj.parentNode.insertRow(4);
for(c=0; c<3; c++){ newTR.insertCell(0); }
newTR.cells[0].innerHTML = '<font size=2>'+iName+'</font>';
newTR.cells[1].innerHTML = '<input type="text" size="20" name="points" maxlength="5">';
newTR.cells[2].innerHTML = '<font size=1>Enter the number of points to add to add or subtract from this members profile.</font>';
currentPoints = (form.customtitle.value.match(/\[P:(.+?)\]/))? parseInt(RegExp.$1) : '';
form.customtitle.value = form.customtitle.value.replace(/\[P:(.+?)\]/,'');
form.onsubmit=function()
{
if(form.points.value == ''){ form.points.value = '0'; }
newTotal = parseInt(form.points.value) + currentPoints;
form.customtitle.value += '[P:'+newTotal+']';
}
}
//-->
</script>
This merges the members post count with their karma to give a new 'Money' Type value, this value is calculated using the amount of karma they have earnt and the number of posts they have. Edit the variables near the top of the script with the amount of Money they get for each karma/post. Anyone with the ability to modify profiles will be able to modify the amount of money a user has in their profile.
Note, this will remove the 'karma' value from the mini-profile.
<script type="text/javascript">
<!--
/*
Karma-Money Hack by Ross
goes in global footer
101support.proboards43.com
do not edit or redistribute without permission
this header must stay intact at all times
*/
// Number of points for each karma a member has
var KarmaToAdd = 10;
// Number of points for each post a member has
var PostToAdd = 2;
// Name of 'Points'
var iName = 'Reputation:'
// No need to edit below
var td = document.getElementsByTagName('td');
for(i=0; i<td.length; i++)
{
if(td.width == '20%' && td.innerHTML.match(/Karma:/i))
{
karma = (td.parentNode.innerHTML.match(/Karma: (.+?)</i))? RegExp.$1 : '';
posts = (td.innerHTML.match(/Posts: (.+?)</i))? RegExp.$1 : '';
newPost = PostToAdd * parseInt(posts.replace(/,/g,''));
newKarma = KarmaToAdd * parseInt(karma.replace(/,/g,''));
additional = (td.innerHTML.match(/\[P:(.+?)\]/))? parseInt(RegExp.$1) : '';
td.innerHTML = td.innerHTML.replace(/<br>\[P:(.+?)\]<br>/i,'<br/>').replace(/\[P:(.+?)\]/,'');
newMon = newKarma + newPost + additional;
td.innerHTML = td.innerHTML.replace(new RegExp('Karma: '+karma, 'i'), iName +' '+newMon)
}
}
if(document.modifyForm && document.modifyForm.karma)
{
form = document.modifyForm;
obj = form.karma.parentNode.parentNode.parentNode;
newTR = obj.parentNode.insertRow(4);
for(c=0; c<3; c++){ newTR.insertCell(0); }
newTR.cells[0].innerHTML = '<font size=2>'+iName+'</font>';
newTR.cells[1].innerHTML = '<input type="text" size="20" name="points" maxlength="5">';
newTR.cells[2].innerHTML = '<font size=1>Enter the number of points to add to add or subtract from this members profile.</font>';
currentPoints = (form.customtitle.value.match(/\[P:(.+?)\]/))? parseInt(RegExp.$1) : '';
form.customtitle.value = form.customtitle.value.replace(/\[P:(.+?)\]/,'');
form.onsubmit=function()
{
if(form.points.value == ''){ form.points.value = '0'; }
newTotal = parseInt(form.points.value) + currentPoints;
form.customtitle.value += '[P:'+newTotal+']';
}
}
//-->
</script>