×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: vote buttons: add title popup

vote buttons: add title popup 15 years 4 weeks ago #7482

  • Brecht Coene
  • Brecht Coene's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 49
  • Thank you received: 0
I would like to add a title to the vote buttons so it displays a little info popup.

Which file do I modify for this?

BTW: keep up the good work

vote buttons: add title popup 15 years 4 weeks ago #7483

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Can you explain with a little more details what exactly are you trying to do? When should the popup show? And normally you have to look for the vote functions in comment.class.php

vote buttons: add title popup 15 years 4 weeks ago #7484

  • Brecht Coene
  • Brecht Coene's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 49
  • Thank you received: 0
For an average user it is not understood what the vote functions mean: what does it say when someone votes + or when someone votes -

I would like to explain this to the user by showing a tooltip (or other) box with text that appears on mouseover.

does this help?

vote buttons: add title popup 15 years 4 weeks ago #7493

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
The comment.class.php is making the layout for the vote. I can not tell you the exact function, but I remember that it was there. You can play with the output there and make the popup.

vote buttons: add title popup 15 years 3 weeks ago #7515

  • Brecht Coene
  • Brecht Coene's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 49
  • Thank you received: 0
find this
function voting_cell($mode, $num, $id)
    {
	return "<li><a id='$mode$id' class='voting_$mode' href='javascript:JOSC_voting($id,\"$mode\")'>$num</a></li>";
    }
 
    function voting($voting_no, $voting_yes, $id, $contentId)
    {
	$html = '';
	if ($this->_voting_visible) {
	    if ($voting_yes == '') {
		$voting_yes = 0;
		$voting_no = 0;
	    }
	    $html .= "<ul class='voting'>";
	    $html .= $this->voting_cell('yes', $voting_yes, $id);
	    $html .= $this->voting_cell('no', $voting_no, $id) ;
	    $html .= '</ul>';
	}
		/*
		 * If voting no are 2x greater than voting yes => mode hide
		 */
	$this->_hide = (($voting_no + 1) > (($voting_yes + 1) * 2));
	return $html;
    }

and replace by

function voting_cell($mode, $num, $id, $tooltip = '')
    {
    $onmouseover = "";
    if (!empty($tooltip))
    {
    	$onmouseover = "alt=\"$tooltip\" title=\"$tooltip\"";
    }
	return "<li><a id='$mode$id' $onmouseover class='voting_$mode' href='javascript:JOSC_voting($id,\"$mode\")'>$num</a></li>";
    }
 
    function voting($voting_no, $voting_yes, $id, $contentId)
    {
	$html = '';
	if ($this->_voting_visible) {
	    if ($voting_yes == '') {
		$voting_yes = 0;
		$voting_no = 0;
	    }
	    $html .= "<ul class='voting'>";
	    $html .= $this->voting_cell('yes', $voting_yes, $id, 'Higher kudos');
	    $html .= $this->voting_cell('no', $voting_no, $id, 'Lower kudos') ;
	    $html .= '</ul>';
	}
		/*
		 * If voting no are 2x greater than voting yes => mode hide
		 */
	$this->_hide = (($voting_no + 1) > (($voting_yes + 1) * 2));
	return $html;
    }

vote buttons: add title popup 15 years 3 weeks ago #7552

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
You don't need the onmouseover JS event, this is basic HTML! Just set the title= (for tooltip) and alt= (for accessibility) tags permanently, that is correct W3C accessibility spec. Good practice is to make title and alt both the same, and remember that only IE uses alt as the tooltip (so title= is a must).

vote buttons: add title popup 15 years 3 weeks ago #7557

  • Brecht Coene
  • Brecht Coene's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 49
  • Thank you received: 0
Please check well.

Only variable name is onmouseover. Already it is using alt and title only.

vote buttons: add title popup 15 years 3 weeks ago #7570

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
Ah yes of course, I just saw the word "onmouseover" and was too quick to answer. Glad you figured it out though :)
  • Page:
  • 1
Time to create page: 0.117 seconds