Closed (won't fix)
Project:
Vote Up/Down
Version:
6.x-2.0-rc1
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
23 Jan 2009 at 14:46 UTC
Updated:
28 Jul 2010 at 17:44 UTC
I'm trying to change the voting widget to a span of text rather than an image and I'm stumped.
Ideally I'd want something like on flag module -- "vote for this post", for example.
The JS removes the contents of the widget and if I comment that out, I get the "An HTTP error" JS error popup when I try to vote.
Comments
Comment #1
joachim commentedTo add more detail -- the problem is basically that the HTML in the theme function and the accompanying Javascript are too tightly connected.
If you try to do your own thing in the theme, it breaks. Here's what the js does:
$('span.vote-up-inact, span.vote-down-inact, span.vote-up-act, span.vote-down-act').each(function () {
// so we're selecting the SPANs....
// Read in the path to the PHP handler
uri = $(this).attr('title');
// the URI was spoofed in by the theme as a TITLE. weird.
// Remove the title, so no tooltip will display
$(this).removeAttr('title');
// now kill it
// remove href link
$(this).html('');
// now kill the ENTIRE CONTENTS of the span!
// Create an object with this uri. Because
// we feed in the span as an argument, we'll be able
// to attach events to this element.
if (!vdb[uri]) {
vdb[uri] = new Drupal.VDB(this, uri);
}
// and now totally rejig it.
The voting widget shouldn't rely on JS to produce something, and it shouldn't kill what's there.
Comment #2
marvil07 commentedPlease take a look to the update on the project page, now
5.xis not-really-maintained.If you think your question is still applicably to the last recommended version(
6.x-2.x) please move the version accordingly and reopen it.Comment #3
sreynen commentedThis is still an issue in 6.x.
$(this).html('');doesn't do what the comment right above says it should do (remove a specific tag). I suggest replacing that with a more specific$(this).find('a.vote-up-inact, a.vote-down-inact').remove();Comment #4
marvil07 commentedsorry, the recommended way to do such a customization is make your own widget(not use js to change the widget), that process is extensively documented on WIDGETAPI.txt