Using both star-rating and like - one script

Place for comments, problems, questions, or any issue related to the JavaScript / PHP scripts from this site.
David
Posts: 15

Using both star-rating and like - one script

Hi Marplo,
I haven't tried yet, but is it possible to load both the star-rating and the Like/Dislike script from the one header or is the js and JSON too similar and will interfere with each other?

I've made some quasi responsive styles and the star-rating is too small for the touch templates. :(
An example is here under the games - (It should load a touch template) And will take you to the Credits where you have been included as I said you would be. ;)
http://gnuarcadescript.com/arcade/index ... on=credits

Or just a simple Game where it looks fine on PC - But too small on a tablet.
gnuarcadescript.com/arcade/index.php?action=play&ID=1820

I'd really like to load both if I can - But I can get around it if I can't.
Thanks,
David.

Admin Posts: 805
Hello
I didn't try to use both rating-star and like scripts in the same page, but you can try for test to see how it works, and check the console for errors.
Anyway, those scripts will not use the same json / data, but each one with its rating data.

- Or, an easy way is to modify the css style of the rating-stars (or make another one) to look bigger for touch templates. And just load the css style of the rating-stars according to the theme.

David Posts: 15
Thanks again,

I already have the .css independently added to each theme along with the 2 rating stars - so I'll have a play with that, the problem is (From Memory) that the mouse-over 'grey' star is common in the js?

But I'll have a play and report back on what works and what may not.

Admin Posts: 805
I didn't understand well the question /the problem. When the mouse is over the stars, it is applied a hover effect that changes the stars to show the chosed rating before click.

David Posts: 15
This is the problem with star2 (Hover) as it's common in the js.

Code: Select all

   if (navigator.userAgent.indexOf("Firefox")!=-1) star_sp.setAttribute('style', 'width:'+((i_sp+1)*22)+'px; background:url("ratingfiles/star2.png")');
    else {
      star_sp.style.width = ((i_sp+1)*22)+'px';
      star_sp.style.background = 'url("ratingfiles/star2.png")';
I can increase the size of the other stars and modify the css for each theme but I can't set a select constant/var like 'THEME_PATH' in the js and move the star2.png to each template images folder.

Doesn't matter, now that you have said the two scripts shouldn't interfere with each other I'll now spend some time modifying the Like/Dislike script. ;)

Admin Posts: 805
If you will want to change the stars size and css style according to template, just tell where you can not handle, and I'll try to help if I can.

The rating star and voting up/down not interfere because they use js functions with different names, different html /css elements, and different json files.

David Posts: 15
I really appreciate the offer to help, but I think I've got enough to keep me busy for a couple of weeks finishing everything else off. Then I will be looking at it seriously.

And I'm pretty sure that I can get it to a point where there may be just one sticky point with the js?