PDA

View Full Version : Reputation.



ripper
02-03-2010, 06:03 PM
hi guys, might seem pointless like but when i try to add to peoples Rep it doesnt seem to add to the points its basically just jumps the page, ?

Thanks

JIMINATOR
02-03-2010, 06:54 PM
one of the admins will have to figure it out, but it looks like the following JS may not be installed....
clientscript/vbulletin_ajax_reputation.js

ripper
02-03-2010, 07:05 PM
ok thanks jim :)

Bingo
02-04-2010, 02:00 AM
I noticed that a while back. I poked around the code and I can't figure it out.

If I get some time this weekend I'll go look again. Problem is, I'm crap with code. I see where it's supposed to be and it seems like it's there, but obviously something is wrong.

I promise to go take a look again but can't promise I'll figure it out. I really do wish I could get it working again though!

Thanks for the headsup, mate.

B

JIMINATOR
02-04-2010, 04:23 AM
bingo, copy and paste into a file named:
forums/clientscript/vbulletin_ajax_reputation.js
the file should live with the other .js files


/*================================================= =====================*\
|| ################################################## ################## ||
|| # vBulletin 3.6.10 Patch Level 1
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2008 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| ################################################## ################## ||
\*================================================ ======================*/

/**
* Register a post for ajax reputation
*
* @param string Postid
*
* @return vB_Reputation_Object
*/
function vbrep_register(postid)
{
if (typeof vBrep == 'object' && typeof postid != 'undefined')
{
return vBrep.register(postid);
}
}

// ################################################## ###########################
// vB_Reputation_Handler
// ################################################## ###########################

/**
* vBulletin reputation registry
*/
function vB_Reputation_Handler()
{
this.reps = new Array();
this.ajax = new Array();
};

// ================================================== ===========================
// vB_Reputation_Handler methods

/**
* Register a control object as a reputation control
*
* @param string ID of the control object
*
* @return vB_Reputation_Object
*/
vB_Reputation_Handler.prototype.register = function(postid)
{
if (AJAX_Compatible && (typeof vb_disable_ajax == 'undefined' || vb_disable_ajax < 2))
{
this.reps[postid] = new vB_Reputation_Object(postid);
if (obj = fetch_object('reputation_' + postid))
{
obj.onclick = vB_Reputation_Object.prototype.reputation_click;
return this.reps[postid];
}
}
};

// ################################################## ###########################
// initialize reputation registry

vBrep = new vB_Reputation_Handler();

// ################################################## ###########################
// vB_Reputation_Object
// ################################################## ###########################

/**
* vBulletin Reputation class constructor
*
* Manages a single reputation and control object
* Initializes control object
*
* @param string postid
*/
function vB_Reputation_Object(postid)
{
this.postid = postid;
this.divname = 'reputationmenu_' + postid + '_menu';
this.divobj = null;
this.postobj = fetch_object('post' + postid);

this.vbmenuname = 'reputationmenu_' + postid;
this.vbmenu = null;

this.xml_sender_populate = null;
this.xml_sender_submit = null;

var me = this;

/**
* Populate OnReadyStateChange callback. Uses a closure to keep state.
* Remember to use me instead of "this" inside this function!
*/
this.onreadystatechange_populate = function()
{
if (me.xml_sender_populate.handler.readyState == 4 && me.xml_sender_populate.handler.status == 200)
{
if (me.xml_sender_populate.handler.responseXML)
{
// check for error first
var error = me.xml_sender_populate.fetch_data(fetch_tags(me.xm l_sender_populate.handler.responseXML, 'error')[0]);
if (error)
{
alert(error);
}
else
{
if (!me.divobj)
{
// Create new div to hold reputation menu html
me.divobj = document.createElement('div');
me.divobj.id = me.divname;
me.divobj.style.display = 'none';
me.divobj.onkeypress = vB_Reputation_Object.prototype.repinput_onkeypress ;
me.postobj.parentNode.appendChild(me.divobj);

me.vbmenu = vbmenu_register(me.vbmenuname, true);
// Remove menu's mouseover event
fetch_object(me.vbmenu.controlkey).onmouseover = '';
fetch_object(me.vbmenu.controlkey).onclick = '';
}

me.divobj.innerHTML = me.xml_sender_populate.fetch_data(fetch_tags(me.xm l_sender_populate.handler.responseXML, 'reputationbit')[0]);

var inputs = fetch_tags(me.divobj, 'input');
for (var i = 0; i < inputs.length; i++)
{
if (inputs[i].type == 'submit')
{
var sbutton = inputs[i];
var button = document.createElement('input');
button.type = 'button';
button.className = sbutton.className;
button.value = sbutton.value;
button.onclick = vB_Reputation_Object.prototype.submit_onclick;
sbutton.parentNode.insertBefore(button, sbutton);
sbutton.parentNode.removeChild(sbutton);
button.name = sbutton.name;
button.id = sbutton.name + '_' + me.postid
}
}

me.vbmenu.show(fetch_object(me.vbmenuname));
}
}

if (is_ie)
{
me.xml_sender_populate.handler.abort();
}
}
}

/**
* Submit OnReadyStateChange callback. Uses a closure to keep state.
* Remember to use me instead of "this" inside this function!
*/
this.onreadystatechange_submit = function()
{
if (me.xml_sender_submit.handler.readyState == 4 && me.xml_sender_submit.handler.status == 200)
{
if (me.xml_sender_submit.handler.responseXML)
{
// Register new menu item for this reputation icon
if (!me.vbmenu)
{
me.vbmenu = vbmenu_register(me.vbmenuname, true);
// Remove menu's mouseover event
fetch_object(me.vbmenu.controlkey).onmouseover = '';
fetch_object(me.vbmenu.controlkey).onclick = '';
}

// check for error first
var error = me.xml_sender_submit.fetch_data(fetch_tags(me.xml_ sender_submit.handler.responseXML, 'error')[0]);
if (error)
{
me.vbmenu.hide(fetch_object(me.vbmenuname));
alert(error);
}
else
{
me.vbmenu.hide(fetch_object(me.vbmenuname));
var repinfo = fetch_tags(me.xml_sender_submit.handler.responseXM L, 'reputation')[0];
var repdisplay = repinfo.getAttribute('repdisplay');
var reppower = repinfo.getAttribute('reppower');
var userid = repinfo.getAttribute('userid');

var spans = fetch_tags(document, 'span');
var postid = null;
var match = null;

for (var i = 0; i < spans.length; i++)
{
if (match = spans[i].id.match(/^reppower_(\d+)_(\d+)$/))
{
if (match[2] == userid)
{
spans[i].innerHTML = reppower;
}
}
else if (match = spans[i].id.match(/^repdisplay_(\d+)_(\d+)$/))
{
if (match[2] == userid)
{
spans[i].innerHTML = repdisplay;
}
}
}
alert(me.xml_sender_submit.fetch_data(repinfo));
}
}

if (is_ie)
{
me.xml_sender_submit.handler.abort();
}
}
}
}

/**
* Handles click events on reputation icon
*/
vB_Reputation_Object.prototype.reputation_click = function (e)
{
e = e ? e : window.event;

do_an_e(e);
var postid = this.id.substr(this.id.lastIndexOf('_') + 1);
var repobj = vBrep.reps[postid];

// fetch and return reputation html
if (repobj.vbmenu == null)
{
repobj.populate();
}
else if (vBmenu.activemenu != repobj.vbmenuname)
{
repobj.vbmenu.show(fetch_object(repobj.vbmenuname) );
}
else
{
repobj.vbmenu.hide();
}

return true;
}

/**
* Handles click events on reputation submit button
*/

vB_Reputation_Object.prototype.submit_onclick = function (e)
{
e = e ? e : window.event;
do_an_e(e);

var postid = this.id.substr(this.id.lastIndexOf('_') + 1);
var repobj = vBrep.reps[postid];
repobj.submit();

return false;
}

/**
* Catches the keypress of the reputation controls to keep them from submitting to inlineMod
*/
vB_Reputation_Object.prototype.repinput_onkeypress = function (e)
{
e = e ? e : window.event;

switch (e.keyCode)
{
case 13:
{
vBrep.reps[this.id.split(/_/)[1]].submit();
return false;
}
default:
{
return true;
}
}
}

/**
* Queries for proper response to reputation, response varies
*
*/
vB_Reputation_Object.prototype.populate = function()
{
this.xml_sender_populate = new vB_AJAX_Handler(true);
this.xml_sender_populate.onreadystatechange(this.o nreadystatechange_populate);
this.xml_sender_populate.send('reputation.php?p=' + this.postid, 'p=' + this.postid + '&ajax=1');
}

/**
* Submits reputation
*
*/
vB_Reputation_Object.prototype.submit = function()
{
this.psuedoform = new vB_Hidden_Form('reputation.php');
this.psuedoform.add_variable('ajax', 1);
this.psuedoform.add_variables_from_object(this.div obj);

this.xml_sender_submit = new vB_AJAX_Handler(true);
this.xml_sender_submit.onreadystatechange(this.onr eadystatechange_submit)
this.xml_sender_submit.send(
'reputation.php?do=addreputation&p=' + this.psuedoform.fetch_variable('p') + '&reputation=' + this.psuedoform.fetch_variable('reputation') + '&reason=' + PHP.urlencode(this.psuedoform.fetch_variable('reas on')),
this.psuedoform.build_query_string()
);
}

/*================================================= =====================*\
|| ################################################## ##################
|| # Downloaded: 18:29, Wed Jun 11th 2008
|| # CVS: $RCSfile$ - $Revision: 15754 $
|| ################################################## ##################
\*================================================ ======================*/

EXEcution
02-04-2010, 04:38 AM
I dunno, this hax might steal your bank account number and make Jim the admin so he can ban us all.

Grimmy
02-04-2010, 06:59 AM
He can't ban everybody. Hehe

ripper
02-04-2010, 09:04 AM
I noticed that a while back. I poked around the code and I can't figure it out.

If I get some time this weekend I'll go look again. Problem is, I'm crap with code. I see where it's supposed to be and it seems like it's there, but obviously something is wrong.

I promise to go take a look again but can't promise I'll figure it out. I really do wish I could get it working again though!

Thanks for the headsup, mate.

B
No Probs, cheers B

Bingo
02-06-2010, 10:17 PM
I'll do this soon. Obviously I want to do a full backup and download which takes quite a while. Superbowl weekend turns out not to be a weekend full of free time when I'm Chief Cooker and Party Central. lol

Thanks though dude. If that works (not that I think it won't) then I owe you BIG time.

ripper
02-06-2010, 10:37 PM
I'll do this soon. Obviously I want to do a full backup and download which takes quite a while. Superbowl weekend turns out not to be a weekend full of free time when I'm Chief Cooker and Party Central. lol

Thanks though dude. If that works (not that I think it won't) then I owe you BIG time.
lol no probs on the time, when you have free time just have a look :D thanks man, let me no whn its fixed and youll be the 1st to receive the rep :D :P

Prosciutto
02-11-2010, 11:26 PM
still it isn't fixed :P

Bingo
02-12-2010, 09:28 PM
Yeah, I've been playing with it this week. Spent a few hours on it and still no dice.

Didn't want to post till I tried one more thing, prolly tomorrow afternoon.

I *think* the problem is in the forum code itself rather than the rep module - which is why it's been so hard to find and fix.

But again - since I don't know the code very well I could also be way off.

ripper
02-19-2010, 05:09 PM
hows it goin guys? any updates?

thanks,

OUTLAWS Tip
02-19-2010, 09:24 PM
Nope!

You are an unknown quantity for the rest of eternity.

:P

Bingo
02-19-2010, 10:47 PM
Nope!

You are an unknown quantity for the rest of eternity.

:P

I don't know what you are talking about, chump. He's better than you.

In other news - no dammit. It's pissing me right the hell off but no - I can't seem to find the bug.

OUTLAWS Tip
02-20-2010, 12:05 AM
If you put your mouse over the button that is what it says.
chump yourself

Bingo
02-20-2010, 08:23 PM
If you put your mouse over the button that is what it says.
chump yourself

You sure about that, MEGA-CHUMP?!

Prosciutto
03-04-2010, 01:53 PM
Bingo will become famous soon enough :P

Bingo
03-05-2010, 11:54 PM
Hey man, I'm trying! I keep calling the papers but they won't come interview me :(

Bingo
05-24-2010, 09:34 AM
In other news, thanks to Grimmy pulling off the upgrade for us, Reputation is back and working again! Approve or Disapprove at will folks!

Nitro
05-25-2010, 04:32 AM
Added rep for ya : )

JIMINATOR
05-25-2010, 04:49 AM
hey, I need a million reps so I can be cool also.....

Bingo
05-25-2010, 11:31 AM
hey, I need a million reps so I can be cool also.....

Well now, you're just going to have to earn that, now aren't you? I prefer small unmarked bills, by the way. :thumbs:

Nitro
05-26-2010, 10:12 PM
hey, I need a million reps so I can be cool also.....

Don't be such a grouch Jim!

*Titanium*
05-27-2010, 02:40 AM
hey, I need a million reps so I can be cool also.....

i find it pointless too but let's not ruin it for the kids :D

Bingo
05-27-2010, 09:42 PM
i find it pointless too but let's not ruin it for the kids :D

Well of course for that I had to go and rep you.

*Titanium*
05-29-2010, 08:31 AM
Well of course for that I had to go and rep you.

Right back at you...hope it worked :D