• [MOD] Rating by using AJAX functions-rating without reload (used by V@no) 5 0 5 1
Currently:  

Author Topic: [MOD] Rating by using AJAX functions-rating without reload (used by V@no)  (Read 57108 times)

0 Members and 1 Guest are viewing this topic.

Offline fabio

  • Newbie
  • *
  • Posts: 36
    • View Profile
you mean the js in header.html ?

i just c&p was is posted here
my javascript knowledge is just above 0 so i avoid messing with things like this!

anyay that`s the coed i added
<script type="text/javascript" language="Javascript">

function createXMLHttpRequest() {
  var ua;
  if(window.XMLHttpRequest) {
    try {
      ua = new XMLHttpRequest();
    } catch(e) {
      ua = false;
    }
  } else if(window.ActiveXObject) {
    try {
      ua = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
      ua = false;
    }
  }
  return ua;
}
var req = createXMLHttpRequest();

function rate(id) {

  req.open('get', '{rating_url}&rating=' + id);
  req.onreadystatechange = handleResponse;
  req.send(null);
}

function handleResponse() {
  if(req.readyState <= 3){
    var text = '{lang_loading}';
var divid = 'kbrating';
      document.getElementById(divid).innerHTML = text;
   
  }
  if(req.readyState == 4){
    var response = req.responseText;
    var update = new Array();

    if(response.indexOf('||' != -1)) {
      update = response.split('||');
      document.getElementById(update[0]).innerHTML = update[1];
      document.getElementById(update[2]).innerHTML = update[3];

    }
  }
}
</script>

Offline Azibi

  • Pre-Newbie
  • Posts: 4
    • View Profile
    • Azibi
Re: Rating by using AJAX functions-rating without reload (probably used by V@no)
« Reply #31 on: September 06, 2006, 12:05:46 AM »
Hi. Can you to explain me, why it is't working at my page? it only shows "0.00 (0 Stimme(n))"

http://www.azibi.de/details.php?image_id=2405


Gruß/Greetings Azibi

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Use the rate form in another pages ??? like where ?

can use it at member_profile ?

Offline 2ndzenith

  • Pre-Newbie
  • Posts: 4
    • View Profile
I have installed this mod using the css stars. The stars show up and work, votes are able to be counted. But it doesn't display loading or thanks for voting after you vote. The star graphics just remain there, unable to vote again on that image for that user. 

My gallery is here: http://empiresportscar.org/4images


Within Explorer I get an error in my header.html file on the following line:

document.getElementById(update[2]).innerHTML = update[3];

any help with this would be great!


Offline BartAfterDark

  • Hero Member
  • *****
  • Posts: 520
    • View Profile
2ndzenith I'm going to post the code from my site (that should work)

Offline troopers

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • weltimperator.de
thx, works perfect :D

(nachm 10.mal -g-)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
weltimperator.de

Offline SoftDux

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • SoftDux - The Leaders in Software & Networking
I'm just adding myself to this thread to be notified of updates
Visit these Website:  SA WebHosting Talk || SoftDux

Offline jrey

  • Full Member
  • ***
  • Posts: 165
    • View Profile
    • http://www.jrey.net
Im using this mod and works very good, but I have a litte problem. The problem is that   $lang['already_voted'] and $lang['voting_success'] are showed only in spanish ( I have two languages in my gallery, spanish and english ). I have both messages in english and spanish ( in the main.php file of the lang dir ), but when you rate you see the messages always in spanish ( if you are in the english version its the same, you see these message in spanish ), its a mistake...

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
I would like to add this to my thumbnail_bit.html with a modified rateform (for stars) so that my members can rate directly from the thumbnails.

Everything seems to be working on the detail page, but when i rate from the thumbnails i get a "Security violation" error.

Can anybody help me?

thanks

 :)
« Last Edit: June 14, 2007, 04:49:13 PM by impss »

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
... thanks Konradin for this rating-MOD with AJAX-function , it works perfectly ( with little modifications ) on my site ...
... I've mixed this MOD with Kurt's [MOD] Mouseover/hover rateform ... thanks for this Kurt ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline darvid

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • KNOWTEBOOK.COM - Community for webdeveloper
yes i have :(
i added   {rating_url} the the path seeme to be registered correctly
also when i`ve already voted i get the corresponding message
so i think it has something to do with rating .php (??)


somene posted this link http://komodomedia.com/blog/index.php/2005/08/24/creating-a-star-rater-using-css/
i`ve tried it and works

in rate_form.html
inside the span tags replace the code with this
<ul class='star-rating'>
  <li><a href="javascript:rate('1');" title='Rate this 1 star out of 5' class='one-star'>1</a></li>
  <li><a href='"javascript:rate('2');" title='Rate this 2 stars out of 5' class='two-stars'>2</a></li>
  <li><a href="javascript:rate('3');" title='Rate this 3 stars out of 5' class='three-stars'>3</a></li>
  <li><a href="javascript:rate('4');" title='Rate this 4 stars out of 5' class='four-stars'>4</a></li>
  <li><a href="javascript:rate('5');" title='Rate this 5 stars out of 5' class='five-stars'>5</a></li>
</ul>
      

and add in style.css

/*             styles for the star rater                */
.star-rating{
   list-style:none;
   margin: 0px;
   padding:0px;
   width: 100px;
   height: 20px;
   position: relative;
   background: url(star_rating.gif) top left repeat-x;      
}
.star-rating li{
   padding:0px;
   margin:0px;
   /*\*/
   float: left;
   /* */
}
.star-rating li a{
   display:block;
   width:20px;
   height: 20px;
   text-decoration: none;
   text-indent: -9000px;
   z-index: 20;
   position: absolute;
   padding: 0px;
}
.star-rating li a:hover{
   background: url(star_rating.gif) left bottom;
   z-index: 1;
   left: 0px;
}
.star-rating a.one-star{
   left: 0px;
}
.star-rating a.one-star:hover{
   width:20px;
}
.star-rating a.two-stars{
   left:20px;
}
.star-rating a.two-stars:hover{
   width: 40px;
}
.star-rating a.three-stars:hover{
   width: 60px;
}
.star-rating a.three-stars{
   left: 40px;
}
.star-rating a.four-stars{
   left: 60px;
}   
.star-rating a.four-stars:hover{
   width: 80px;
}
.star-rating a.five-stars{
   left: 80px;
}
.star-rating a.five-stars:hover{
   width: 100px;
}
   
don`t foregt to change the paths of the images    
ps it`s for a 20X20p star image

there is still one mistake in the code in rate_form.html:

<span id="kbrating">
<ul class='star-rating'>
  <li><a href="javascript:rate('1');" title='Rate this 1 star out of 5' class='one-star'>1</a></li>
  <li><a href='"javascript:rate('2');" title='Rate this 2 stars out of 5' class='two-stars'>2</a></li>
  <li><a href="javascript:rate('3');" title='Rate this 3 stars out of 5' class='three-stars'>3</a></li>
  <li><a href="javascript:rate('4');" title='Rate this 4 stars out of 5' class='four-stars'>4</a></li>
  <li><a href="javascript:rate('5');" title='Rate this 5 stars out of 5' class='five-stars'>5</a></li>
</ul>
</span>

correct code:

<span id="kbrating">
<ul class='star-rating'>
  <li><a href="javascript:rate('1');" title='Rate this 1 star out of 5' class='one-star'>1</a></li>
  <li><a href="javascript:rate('2');" title='Rate this 2 stars out of 5' class='two-stars'>2</a></li>
  <li><a href="javascript:rate('3');" title='Rate this 3 stars out of 5' class='three-stars'>3</a></li>
  <li><a href="javascript:rate('4');" title='Rate this 4 stars out of 5' class='four-stars'>4</a></li>
  <li><a href="javascript:rate('5');" title='Rate this 5 stars out of 5' class='five-stars'>5</a></li>
</ul>
</span>
/* KNOWTEBOOK - BoostYourself community for webdeveloper
/* http://www.knowtebook.com

Integration von Wordpress Blog, PHPBB Forum und 4Images Bildergalerie:
http://www.sebastianscheuer.de/aktuell/integration-von-wordpress-blog-phpbb-forum-und-4images-bildergallerie/
DEMO: http://www.pilotenbilder.de/

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
I would like to add this to my thumbnail_bit.html with a modified rateform (for stars) so that my members can rate directly from the thumbnails.

Everything seems to be working on the detail page, but when i rate from the thumbnails i get a "Security violation" error.

Can anybody help me?

thanks

 :)

I would really like my members to be able to vote from thumbnails without page refresh.
I really cant figure out why when i try to , it gives me a Security violation error.

If someone could help me with this it would be greatly appreciated.

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Hi konradin,

thanks for your great Mod.
I change your code a little bit and mixed it with codes from 2 other mods from me  :wink:

=> http://www.4homepages.de/forum/index.php?topic=17829.0

Thanks again....

cu
Kurt

Offline ahmed_badawy

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: [MOD] Rating by using AJAX functions-rating without reload (used by V@no)
« Reply #43 on: January 29, 2009, 11:21:10 PM »
thanx for mod

but i want reload image rate

http://www.4homepages.de/forum/index.php?topic=923.0