-
Notifications
You must be signed in to change notification settings - Fork 0
/
documentation.html
1009 lines (940 loc) · 44.4 KB
/
documentation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>jQuery Star Rating Plugin v4.11 (2013-03-14)</title>
<!--// plugin-specific resources //-->
<script src='jquery.js' type="text/javascript"></script>
<script src='jquery.MetaData.js' type="text/javascript" language="javascript"></script>
<script src='jquery.rating.js' type="text/javascript" language="javascript"></script>
<link href='jquery.rating.css' type="text/css" rel="stylesheet"/>
<!--// documentation resources //-->
<!--<script src="http://code.jquery.com/jquery-migrate-1.1.1.js" type="text/javascript"></script>-->
<link type="text/css" href="/@/js/jquery/ui/jquery.ui.css" rel="stylesheet" />
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js" type="text/javascript"></script>
<link href='documentation.css' type="text/css" rel="stylesheet"/>
<script src='documentation.js' type="text/javascript"></script>
</head>
<body>
<div class="Clear" id="wrap">
<div class="Clear" id="head">
<table width="100%" cellspacing="10">
<tr>
<td valign="middle" width="120">
<img src="documentation/fyneworks.png" width="101" height="24" alt="Fyneworks" />
</td>
<td valign="middle" width="10"> </td>
<td valign="middle">
<h1 style="float:left;">jQuery Star Rating Plugin</h1>
v<strong style="color:#000;">4.11 (2013-03-14)</strong>
</td>
</tr>
</table>
</div>
<div class="Clear" id="body">
<div class="Clear" id="documentation">
<div class="tabs">
<ul class="Clear">
<li><a href="#tab-Overview" id="btn-Overview">Intro</a></li>
<li><a href="#tab-Testing" id="btn-Testing">Demos</a></li>
<li><a href="#tab-API" id="btn-API">API</a></li>
<li><a href="#tab-Database" id="btn-Database">Database Integration</a></li>
<li><a href="#tab-Background" id="btn-Background">Background</a></li>
<li><a href="#tab-Download" id="btn-Download">Download</a></li>
<li><a href="#tab-Support" id="btn-Support">Support</a></li>
<li><a href="#tab-License" id="btn-License">License</a></li>
<li><a href="#tab-More" id="btn-More">More</a></li>
<!--<li><a href="#tab-Break" id="btn-Break" style="font-weight:bold; color:red;">Have a break</a></li>-->
</ul><!--// tabs //-->
<!--//
####################################
#
# * START CONTENT *
#
####################################
//-->
<div id="tab-Overview">
<h2>What is this?</h2>
<p>
The <strong>Star Rating Plugin</strong> is a plugin
for the jQuery Javascript library that creates a non-obstrusive
star rating control based on a set of radio input boxes.
</p>
<h2>What does it do?</h2>
<ul>
<li>
It turns a collection of radio boxes into a neat star-rating control.
</li>
<li>
It creates the interface based on standard form elements, which means the
basic functionality will still be available even if Javascript is disabled.
</li>
<li>
<strong style="color: rgb(0, 153, 0);">NEW</strong> (18-Feb-2013):
Compatible with jQuery 1.3+ and the latest 1.9!
</li>
</ul>
<h2>How do I use it?</h2>
<p>
Just add the <code><strong>star</strong></code> class to your radio boxes
</p>
<table cellspacing="5" width="100%">
<tr>
<td valign="top">
<pre class="code"><code class="html"><input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/></code></pre>
</td>
<td valign="top" width="10">»</td>
<td valign="top" width="180">
<input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/>
<input name="star1" type="radio" class="star"/>
</td>
</tr>
</table>
<p>
Use the <code><strong>checked</strong></code> property to specify the initial/default value of the control
</p>
<table cellspacing="5" width="100%">
<tr>
<td valign="top">
<pre class="code"><code class="html"><input name="star2" type="radio" class="star"/>
<input name="star2" type="radio" class="star"/>
<input name="star2" type="radio" class="star" checked="checked"/>
<input name="star2" type="radio" class="star"/>
<input name="star2" type="radio" class="star"/></code></pre>
</td>
<td valign="top" width="10">»</td>
<td valign="top" width="180">
<input name="star2" type="radio" class="star"/>
<input name="star2" type="radio" class="star"/>
<input name="star2" type="radio" class="star" checked="checked"/>
<input name="star2" type="radio" class="star"/>
<input name="star2" type="radio" class="star"/>
</td>
</tr>
</table>
<p>
Use the <code><strong>disabled</strong></code> property to use a control for display purposes only
</p>
<table cellspacing="5" width="100%">
<tr>
<td valign="top">
<pre class="code"><code class="html"><input name="star3" type="radio" class="star" disabled="disabled"/>
<input name="star3" type="radio" class="star" disabled="disabled"/>
<input name="star3" type="radio" class="star" disabled="disabled" checked="checked"/>
<input name="star3" type="radio" class="star" disabled="disabled"/>
<input name="star3" type="radio" class="star" disabled="disabled"/></code></pre>
</td>
<td valign="top" width="10">»</td>
<td valign="top" width="180">
<input name="star3" type="radio" class="star" disabled="disabled"/>
<input name="star3" type="radio" class="star" disabled="disabled"/>
<input name="star3" type="radio" class="star" disabled="disabled" checked="checked"/>
<input name="star3" type="radio" class="star" disabled="disabled"/>
<input name="star3" type="radio" class="star" disabled="disabled"/>
</td>
</tr>
</table>
<h2>What about split stars and 'half ratings'???</h2>
<p>
Use metadata plugin to pass advanced settings to the plugin via the class property.
</p>
<table cellspacing="5" width="100%">
<tr>
<td valign="top">
<pre class="code"><code class="html"><input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}" checked="checked"/>
<input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}"/></code></pre>
</td>
<td valign="top" width="10">»</td>
<td valign="top" width="180">
<input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}" checked="checked"/>
<input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}"/>
<input name="adv1" type="radio" class="star {split:4}"/>
</td>
</tr>
</table>
<p>
Use custom selector
</p>
<table cellspacing="5" width="100%">
<tr>
<td valign="top">
<script>$(function(){ // wait for document to load
$('input.wow').rating();
});</script>
<pre class="code"><code class="js">$(function(){ // wait for document to load
$('input.wow').rating();
});</code></pre>
<pre class="code"><code class="html"><input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}" checked="checked"/>
<input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}"/></code></pre>
</td>
<td valign="top" width="10">»</td>
<td valign="top" width="180">
<input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}" checked="checked"/>
<input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}"/>
<input name="adv2" type="radio" class="wow {split:4}"/>
</td>
</tr>
</table>
<!-- advertising -->
<p>Make sure to upload these changes on to your server<!--<a href="http://www.webhostingsearch.com/blog-hosting.php">blog hosting server</a>-->, this would be a great plugin for your blogs and review sites</p>
</div><!--// tab-Overview //-->
<div id="tab-Testing">
<h2>Test Suite</h2>
<script type="text/javascript" language="javascript">
$(function(){
$('#form1 :radio.star').rating();
$('#form2 :radio.star').rating({cancel: 'Cancel', cancelValue: '0'});
$('#form3 :radio.star').rating();
$('#form4 :radio.star').rating();
});
</script>
<script>
$(function(){
$('#tab-Testing form').submit(function(){
$('.test',this).html('');
$('input',this).each(function(){
if(this.checked) $('.test',this.form).append(''+this.name+': '+this.value+'<br/>');
});
return false;
});
});
</script>
<div class="Clear"> </div>
<form id="form1">
<strong style='font-size:150%'>Test 1</strong> - A blank form
<table width="100%" cellspacing="10"> <tr>
<td valign="top" width="">
<table width="100%">
<tr>
<td valign="top" width="50%">
<div class="Clear">
Rating 1:
(N/M/Y)
<input class="star" type="radio" name="test-1-rating-1" value="N" title="No"/>
<input class="star" type="radio" name="test-1-rating-1" value="M" title="Maybe"/>
<input class="star" type="radio" name="test-1-rating-1" value="Y" title="Yes"/>
</div>
<br/>
<div class="Clear">
Rating 2:
(10 - 50)
<input class="star" type="radio" name="test-1-rating-2" value="10"/>
<input class="star" type="radio" name="test-1-rating-2" value="20"/>
<input class="star" type="radio" name="test-1-rating-2" value="30"/>
<input class="star" type="radio" name="test-1-rating-2" value="40"/>
<input class="star" type="radio" name="test-1-rating-2" value="50"/>
</div>
<br/>
<div class="Clear">
Rating 3:
(1 - 7)
<input class="star" type="radio" name="test-1-rating-3" value="1"/>
<input class="star" type="radio" name="test-1-rating-3" value="2"/>
<input class="star" type="radio" name="test-1-rating-3" value="3"/>
<input class="star" type="radio" name="test-1-rating-3" value="4"/>
<input class="star" type="radio" name="test-1-rating-3" value="5"/>
<input class="star" type="radio" name="test-1-rating-3" value="6"/>
<input class="star" type="radio" name="test-1-rating-3" value="7"/>
</div>
</td>
<td valign="top" width="50%">
<div class="Clear">
Rating 4:
(1 - 5)
<input class="star" type="radio" name="test-1-rating-4" value="1" title="Worst"/>
<input class="star" type="radio" name="test-1-rating-4" value="2" title="Bad"/>
<input class="star" type="radio" name="test-1-rating-4" value="3" title="OK"/>
<input class="star" type="radio" name="test-1-rating-4" value="4" title="Good"/>
<input class="star" type="radio" name="test-1-rating-4" value="5" title="Best"/>
</div>
<br/>
<div class="Clear">
Rating 5:
(1 - 5, required)
<input class="star required" type="radio" name="test-1-rating-5" value="1"/>
<input class="star" type="radio" name="test-1-rating-5" value="2"/>
<input class="star" type="radio" name="test-1-rating-5" value="3"/>
<input class="star" type="radio" name="test-1-rating-5" value="4"/>
<input class="star" type="radio" name="test-1-rating-5" value="5"/>
</div>
<br/>
<div class="Clear">
Rating 6 (readonly):
(1 - 5)
<input class="star" type="radio" name="test-1-rating-6" value="1" disabled="disabled"/>
<input class="star" type="radio" name="test-1-rating-6" value="2" disabled="disabled"/>
<input class="star" type="radio" name="test-1-rating-6" value="3" disabled="disabled"/>
<input class="star" type="radio" name="test-1-rating-6" value="4" disabled="disabled"/>
<input class="star" type="radio" name="test-1-rating-6" value="5" disabled="disabled"/>
</div>
</td>
</tr>
</table>
</td>
<td valign="top" width="5"> </td> <td valign="top" width="50">
<input type="submit" value="Submit scores!" /> </td>
<td valign="top" width="5"> </td> <td valign="top" width="160">
<u>Test results</u>:<br/><br/>
<div class="test Smaller">
<span style="color:#FF0000">Results will be displayed here</span>
</div>
</td>
</tr>
</table>
</form>
<div class="Clear"> </div><div class="Clear"> </div>
<form id="form2">
<strong style='font-size:150%'>Test 2</strong> - With defaults ('checked')
<table width="100%" cellspacing="10"> <tr>
<td valign="top" width="">
<table width="100%">
<tr>
<td valign="top" width="50%">
<div class="Clear">
Rating 1:
(N/M/Y, default M)
</div>
<div class="Clear">
<input class="star" type="radio" name="test-2-rating-1" value="N" title="No"/>
<input class="star" type="radio" name="test-2-rating-1" value="M" title="Maybe" checked="checked"/>
<input class="star" type="radio" name="test-2-rating-1" value="Y" title="Yes"/>
</div>
<div class="Clear">
Rating 2:
(10 - 50, default 30)
</div>
<div class="Clear">
<input class="star" type="radio" name="test-2-rating-2" value="10"/>
<input class="star" type="radio" name="test-2-rating-2" value="20"/>
<input class="star" type="radio" name="test-2-rating-2" value="30" checked="checked"/>
<input class="star" type="radio" name="test-2-rating-2" value="40"/>
<input class="star" type="radio" name="test-2-rating-2" value="50"/>
</div>
<div class="Clear">
Rating 3:
(1 - 7, default 4)
</div>
<div class="Clear">
<input class="star" type="radio" name="test-2-rating-3" value="1"/>
<input class="star" type="radio" name="test-2-rating-3" value="2"/>
<input class="star" type="radio" name="test-2-rating-3" value="3"/>
<input class="star" type="radio" name="test-2-rating-3" value="4" checked="checked"/>
<input class="star" type="radio" name="test-2-rating-3" value="5"/>
<input class="star" type="radio" name="test-2-rating-3" value="6"/>
<input class="star" type="radio" name="test-2-rating-3" value="7"/>
</div>
</td>
<td valign="top" width="50%">
<div class="Clear">
Rating 4:
(1 - 5, default 1)
</div>
<div class="Clear">
<input class="star" type="radio" name="test-2-rating-4" value="1" title="Worst" checked="checked"/>
<input class="star" type="radio" name="test-2-rating-4" value="2" title="Bad"/>
<input class="star" type="radio" name="test-2-rating-4" value="3" title="OK"/>
<input class="star" type="radio" name="test-2-rating-4" value="4" title="Good"/>
<input class="star" type="radio" name="test-2-rating-4" value="5" title="Best"/>
</div>
<div class="Clear">
Rating 5:
(1 - 5, default 5, required)
</div>
<div class="Clear">
<input class="star required" type="radio" name="test-2-rating-5" value="1"/>
<input class="star" type="radio" name="test-2-rating-5" value="2"/>
<input class="star" type="radio" name="test-2-rating-5" value="3"/>
<input class="star" type="radio" name="test-2-rating-5" value="4"/>
<input class="star" type="radio" name="test-2-rating-5" value="5" checked="checked"/>
</div>
<div class="Clear">
Rating 6 (readonly):
(1 - 5, default 3)
</div>
<div class="Clear">
<input class="star" type="radio" name="test-2-rating-6" value="1" disabled="disabled"/>
<input class="star" type="radio" name="test-2-rating-6" value="2" disabled="disabled"/>
<input class="star" type="radio" name="test-2-rating-6" value="3" disabled="disabled" checked="checked"/>
<input class="star" type="radio" name="test-2-rating-6" value="4" disabled="disabled"/>
<input class="star" type="radio" name="test-2-rating-6" value="5" disabled="disabled"/>
</div>
</td>
</tr>
</table>
</td>
<td valign="top" width="5"> </td> <td valign="top" width="50">
<input type="submit" value="Submit scores!" /> </td>
<td valign="top" width="5"> </td> <td valign="top" width="160">
<u>Test results</u>:<br/><br/>
<div class="test Smaller">
<span style="color:#FF0000">Results will be displayed here</span>
</div>
</td>
</tr>
</table>
</form>
<div class="Clear"> </div><div class="Clear"> </div>
<form id="form3A">
<script>
$(function(){
$('.auto-submit-star').rating({
callback: function(value, link){
// 'this' is the hidden form element holding the current value
// 'value' is the value selected
// 'element' points to the link element that received the click.
alert("The value selected was '" + value + "'\n\nWith this callback function I can automatically submit the form with this code:\nthis.form.submit();");
// To submit the form automatically:
//this.form.submit();
// To submit the form via ajax:
//$(this.form).ajaxSubmit();
}
});
});
</script>
<strong style='font-size:150%'>Test 3-A</strong> - With callback
<table width="100%" cellspacing="10"> <tr>
<td valign="top" width="">
<div class="Clear">
Rating 1:
(1 - 3, default 2)
<input class="auto-submit-star" type="radio" name="test-3A-rating-1" value="1"/>
<input class="auto-submit-star" type="radio" name="test-3A-rating-1" value="2" checked="checked"/>
<input class="auto-submit-star" type="radio" name="test-3A-rating-1" value="3"/>
</div>
<div class="Clear">
<pre class="code"><code class="js">$('.auto-submit-star').rating({
callback: function(value, link){
alert(value);
}
});</code></pre>
</div>
</td>
<td valign="top" width="5"> </td> <td valign="top" width="50">
<input type="submit" value="Submit scores!" /> </td>
<td valign="top" width="5"> </td> <td valign="top" width="160">
<u>Test results</u>:<br/><br/>
<div class="test Smaller">
<span style="color:#FF0000">Results will be displayed here</span>
</div>
</td>
</tr>
</table>
</form>
<div class="Clear"> </div><div class="Clear"> </div>
<script>
$(function(){
$('.hover-star').rating({
focus: function(value, link){
// 'this' is the hidden form element holding the current value
// 'value' is the value selected
// 'element' points to the link element that received the click.
var tip = $('#hover-test');
tip[0].data = tip[0].data || tip.html();
tip.html(link.title || 'value: '+value);
},
blur: function(value, link){
var tip = $('#hover-test');
$('#hover-test').html(tip[0].data || '');
}
});
});
</script>
<form id="form3B">
<strong style='font-size:150%'>Test 3-B</strong> - With hover effects
<table width="100%" cellspacing="10"> <tr>
<td valign="top" width="">
<div class="Clear">
Rating 1:
(1 - 3, default 2)
<div>
<input class="hover-star" type="radio" name="test-3B-rating-1" value="1" title="Very poor"/>
<input class="hover-star" type="radio" name="test-3B-rating-1" value="2" title="Poor"/>
<input class="hover-star" type="radio" name="test-3B-rating-1" value="3" title="OK"/>
<input class="hover-star" type="radio" name="test-3B-rating-1" value="4" title="Good"/>
<input class="hover-star" type="radio" name="test-3B-rating-1" value="5" title="Very Good"/>
<span id="hover-test" style="margin:0 0 0 20px;">Hover tips will appear in here</span>
</div>
</div>
<div class="Clear">
<pre class="code"><code class="js">$('.hover-star').rating({
focus: function(value, link){
var tip = $('#hover-test');
tip[0].data = tip[0].data || tip.html();
tip.html(link.title || 'value: '+value);
},
blur: function(value, link){
var tip = $('#hover-test');
$('#hover-test').html(tip[0].data || '');
}
});</code></pre>
</div>
</td>
<td valign="top" width="5"> </td> <td valign="top" width="50">
<input type="submit" value="Submit scores!" /> </td>
<td valign="top" width="5"> </td> <td valign="top" width="160">
<u>Test results</u>:<br/><br/>
<div class="test Smaller">
<span style="color:#FF0000">Results will be displayed here</span>
</div>
</td>
</tr>
</table>
</form>
<div class="Clear"> </div><div class="Clear"> </div>
<form id="form4">
<strong style='font-size:150%'>Test 4</strong> - <strong>Half Stars</strong> and <strong>Split Stars</strong>
<table width="100%" cellspacing="10"> <tr>
<td valign="top" width="">
<table width="100%">
<tr>
<td width="50%">
<div class="Clear">
Rating 1:
(N/M/Y/?)
<div><small><pre class="code"><code class="html"><input class="star {half:true}"</code></pre></small></div>
<input class="star {half:true}" type="radio" name="test-4-rating-1" value="N" title="No"/>
<input class="star {half:true}" type="radio" name="test-4-rating-1" value="M" title="Maybe"/>
<input class="star {half:true}" type="radio" name="test-4-rating-1" value="Y" title="Yes"/>
<input class="star {half:true}" type="radio" name="test-4-rating-1" value="?" title="Don't Know"/>
</div>
<br/>
<div class="Clear">
Rating 2:
(10 - 60)
<div><small><pre class="code"><code class="html"><input class="star {split:3}"</code></pre></small></div>
<input class="star {split:3}" type="radio" name="test-4-rating-2" value="10"/>
<input class="star {split:3}" type="radio" name="test-4-rating-2" value="20"/>
<input class="star {split:3}" type="radio" name="test-4-rating-2" value="30"/>
<input class="star {split:3}" type="radio" name="test-4-rating-2" value="40"/>
<input class="star {split:3}" type="radio" name="test-4-rating-2" value="50"/>
<input class="star {split:3}" type="radio" name="test-4-rating-2" value="60"/>
</div>
<br/>
<div class="Clear">
Rating 3:
(0-5.0, default 3.5)
<div><small><pre class="code"><code class="html"><input class="star {split:2}"</code></pre></small></div>
<input class="star {split:2}" type="radio" name="test-4-rating-3" value="0.5"/>
<input class="star {split:2}" type="radio" name="test-4-rating-3" value="1.0"/>
<input class="star {split:2}" type="radio" name="test-4-rating-3" value="1.5"/>
<input class="star {split:2}" type="radio" name="test-4-rating-3" value="2.0"/>
<input class="star {split:2}" type="radio" name="test-4-rating-3" value="2.5"/>
<input class="star {split:2}" type="radio" name="test-4-rating-3" value="3.0"/>
<input class="star {split:2}" type="radio" name="test-4-rating-3" value="3.5" checked="checked"/>
<input class="star {split:2}" type="radio" name="test-4-rating-3" value="4.0"/>
<input class="star {split:2}" type="radio" name="test-4-rating-3" value="4.5"/>
<input class="star {split:2}" type="radio" name="test-4-rating-3" value="5.0"/>
</div>
</td>
<td valign="top" width="50%">
<div class="Clear">
Rating 4:
(1-6, default 5)
<div><small><pre class="code"><code class="html"><input class="star {split:2}"</code></pre></small></div>
<input class="star {split:2}" type="radio" name="test-4-rating-4" value="1" title="Worst"/>
<input class="star {split:2}" type="radio" name="test-4-rating-4" value="2" title="Bad"/>
<input class="star {split:2}" type="radio" name="test-4-rating-4" value="3" title="OK"/>
<input class="star {split:2}" type="radio" name="test-4-rating-4" value="4" title="Good"/>
<input class="star {split:2}" type="radio" name="test-4-rating-4" value="5" title="Best" checked="checked"/>
<input class="star {split:2}" type="radio" name="test-4-rating-4" value="6" title="Bestest!!!"/>
</div>
<br/>
<div class="Clear">
Rating 5:
(1-20, default 11, required)
<div><small><pre class="code"><code class="html"><input class="star {split:4}"</code></pre></small></div>
<input class="star {split:4} required" type="radio" name="test-4-rating-5" value="1"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="2"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="3"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="4"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="5"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="6"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="7"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="8"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="9"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="10"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="11" checked="checked"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="12"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="13"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="14"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="15"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="16"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="17"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="18"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="19"/>
<input class="star {split:4}" type="radio" name="test-4-rating-5" value="20"/>
</div>
<br/>
<div class="Clear">
Rating 6 (readonly):
(1-20, default 13)
<div><small><pre class="code"><code class="html"><input class="star {split:4}"</code></pre></small></div>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="1" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="2" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="3" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="4" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="5" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="6" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="7" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="8" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="9" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="10" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="11" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="12" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="13" disabled="disabled" checked="checked"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="14" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="15" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="16" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="17" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="18" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="19" disabled="disabled"/>
<input class="star {split:4}" type="radio" name="test-4-rating-6" value="20" disabled="disabled"/>
</div>
</td>
</tr>
</table>
</td>
<td valign="top" width="5"> </td> <td valign="top" width="50">
<input type="submit" value="Submit scores!" /> </td>
<td valign="top" width="5"> </td> <td valign="top" width="160">
<u>Test results</u>:<br/><br/>
<div class="test Smaller">
<span style="color:#FF0000">Results will be displayed here</span>
</div>
</td>
</tr>
</table>
</form>
</div><!--// tab-Testing //-->
<div id="tab-API">
<h2>API</h2>
<p class="B Yes">NEW to v3</p>
<p>API methods can be invoked this this:</p>
<div><pre class="code"><code class="js">$(selector).rating(
'method', // method name
[] // method arguments (not required)
);</code></pre></div>
<br/><br/><br/>
<h3>$().rating('select', index / value)</h3>
<p>
Use this method to set the value (and display) of the star rating control
via javascript. It accepts the index of the star you want to select (0 based)
or its value (which must be passed as a string.
</p>
<p>
Example: (values A/B/C/D/E)
</p>
<form name="api-select">
<input type="radio" class="star" name="api-select-test" value="A"/>
<input type="radio" class="star" name="api-select-test" value="B"/>
<input type="radio" class="star" name="api-select-test" value="C"/>
<input type="radio" class="star" name="api-select-test" value="D"/>
<input type="radio" class="star" name="api-select-test" value="E"/>
<input type="button" value="Submit »" onClick="
$(this).next().html( $(this.form).serialize() || '(nothing submitted)' );
"/>
<span></span>
<br/>
By index:
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('select',0)" value="0"/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('select',1)" value="1"/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('select',2)" value="2"/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('select',3)" value="3"/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('select',4)" value="4"/>
eg.: $('input').rating('select',3)
<br/>
By value:
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('select',this.value)" value="A"/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('select',this.value)" value="B"/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('select',this.value)" value="C"/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('select',this.value)" value="D"/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('select',this.value)" value="E"/>
eg.: $('input').rating('select','C')
</form>
<br/><br/><br/>
<h3>$().rating('readOnly', true / false)</h3>
<p>
Use this method to set the value (and display) of the star rating control
via javascript. It accepts the index of the star you want to select (0 based)
or its value (which must be passed as a string.
</p>
<p>
Example: (values 1,2,3...10)
</p>
<form name="api-readonly">
<input type="radio" class="star {split:2}" name="api-readonly-test" value="1"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="2"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="3"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="4"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="5"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="6"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="7"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="8"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="9"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="10"/>
<input type="button" value="Submit »" onClick="
$(this).next().html( $(this.form).serialize() || '(nothing submitted)' );
"/>
<span></span>
<br/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('readOnly',true)" value="Set readOnly = true"/>
eg.: $('input').rating('readOnly',true)
<br/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('readOnly',false)" value="Set readOnly = false"/>
eg.: $('input').rating('readOnly',false) or simply $('input').rating('readOnly');
</form>
<br/><br/><br/>
<h3>$().rating('disable') / $().rating('enable')</h3>
<p>
These methods bahve almost exactly as the readOnly method, however
they also control whether or not the select value is submitted with
the form.
</p>
<p>
Example: (values 1,2,3...10)
</p>
<form name="api-readonly">
<input type="radio" class="star {split:2}" name="api-readonly-test" value="1"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="2"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="3"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="4"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="5"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="6"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="7"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="8"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="9"/>
<input type="radio" class="star {split:2}" name="api-readonly-test" value="10"/>
<input type="button" value="Submit »" onClick="
$(this).next().html( $(this.form).serialize() || '(nothing submitted)' );
"/>
<span></span>
<br/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('disable')" value="disable"/>
eg.: $('input').rating('disable')
<br/>
<input type="button" onClick="javascript:$('input[type=radio]',this.form).rating('enable')" value="enable"/>
eg.: $('input').rating('enable');
</form>
</div><!--// tab-API //-->
<div id="tab-Database">
<h2>Database Integration</h2>
<p>
I'm sorry to say that for the time being, <strong>it is up to you</strong>
to create the server-side code that will
process the form submission, store it somewhere (like a database) and do stuff with it -
such as displaying averages and stop users from voting more than once.
</p>
<p>
<strong>However</strong>, here are a few alternatives if you don't feel
like getting down and dirty with some good old coding:
<br>http://www.yvoschaap.com/index.php/weblog/css_star_rater_ajax_version/
<br>
<br>and
<br>part 1: http://www.komodomedia.com/blog/2005/08/creating-a-star-rater-using-css/
<br>part 2: http://slim.climaxdesigns.com/tutorial.php?section=slim&id=2
<br>part 3: http://slim.climaxdesigns.com/tutorial.php?section=slim&id=3
<br>part 4: http://slim.climaxdesigns.com/tutorial.php?section=slim&id=9
</p>
</div><!--// tab-Database //-->
<div id="tab-Background">
<h2>Background Information</h2>
<p>As far as I know, this is how it goes...</p>
<ul type="1">
<li> It all started with <em>Will Stuckey</em>'s <a target="_blank" href="http://www.visualjquery.com/rating/rating_redux.html">jQuery Star Rating Super Interface!</a> </li>
<li> The original then became the inspiration for <em>Ritesh Agrawal</em>'s <a target="_blank" href="http://php.scripts.psu.edu/rja171/widgets/rating.php">Simple Star Rating System</a>,
which allows for a GMail like star/un-star toggle. </li>
<li> This was followed by several spin-offs... (one of which is the <a target="_blank" href="http://www.learningjquery.com/2007/05/half-star-rating-plugin">Half-star rating plugin</a>) </li>
<li> Then someone at <a target="_blank" href="http://www.phpletter.com/Demo/Jquery-Star-Rating-Plugin/">PHPLetter.com modified the plugin</a> to overcome the issues - then plugin was now based on standard form elements, meaning
the interface would still work with Javascript disabled making it <em>beautifully downgradable</em>. </li>
<li> Then I came along and noticed a fundamental flaw with the latter: there could only
be one star rating control per page. The rest of the story is what you will see below... </li>
<li> (12-Mar-08): Then <strong>Keith Wood</strong> added some very nice functionality to the plugin:
option to disable the cancel button, option to make the plugin readOnly and ability to accept any value (other than whole numbers) </li>
<li> (20-Mar-08): Now supports half-star, third-star, quater-star, etc... Not additional code required. No additional images required. </li>
<li> (31-Mar-08): Two new events, hover/blur (arguments: [value, linkElement]) </li>
<li> <strong style="color: rgb(0, 153, 0);">NEW</strong> (18-Feb-2013): Compatible with jQuery 1.6, 1.7, 1.8 and 1.9! </li>
</ul>
</div><!--// tab-Background //-->
<div id="tab-Download">
<h2>Download</h2>
<p>
This project (and all related files) can be accessed via its
<a target="_blank" href="https://github.com/havefnubb/jquery-star-rating-plugin">Github repository</a>.
</p>
<p>For download, see the <a href="https://github.com/havefnubb/jquery-star-rating-plugin">release page</a>.</p>
<h2>Related Downloads</h2>
<table cellspacing="5">
<tr>
<td valign="top" align="right">Related:</td>
<td valign="top">
<a target="_blank" href="http://plugins.jquery.com/project/metadata/">Metadata plugin</a> - Used to retrieve inline configuration from class variable
<br/>
<a target="_blank" href="http://www.malsup.com/jquery/form/">Form plugin</a> - Used to submit forms via ajax
</td>
</tr>
</table>
</div><!--// tab-Download //-->
<div id="tab-Support">
<h2>Support</h2>
<p>
Support for help, reporting an issue, etc: <a href="https://github.com/havefnubb/jquery-star-rating-plugin/issues">Github repository</a>
</p>
<h2>Official Links</h2>
<ul>
<li><a href="https://github.com/havefnubb/jquery-star-rating-plugin">Github repository</a></li>
<li>Old <a target="_blank" href="http://code.google.com/p/jquery-star-rating-plugin/">Google Code Project Page</a> (deprecated)</li>
</ul>
<h2>Credits</h2>
<ul>
<li>Fyneworks.com <a href="http://www.fyneworks.com/">professional web design</a> and <a href="http://www.fyneworks.com/">London SEO consultant</a></li>
<li><a target="_blank" href="http://famfamfam.com/">famfamfam.com</a>'s most excellent <a target="_blank" href="http://famfamfam.com/lab/icons/silk/">silk icon set</a></li>
<li><a target="_blank" href="http://keith-wood.name/">Keith Wood</a> - The brain behind v2.1</li>
<li>Dean Edwards - Author of <a target="_blank" href="http://dean.edwards.name/packer/">JS Packer</a> used to compress the plugin</li>
<li>Will Stuckey, Ritesh Agrawal and everyone else who worked in the previous versions of the plugin - I'm not so good with research...</li>
</ul>
<p>
If we've missed anyone (anyone!) please contact us (info at fyneworks.com) and we'll make sure
to give credit where credit is due.
</p>
</div><!--// tab-Support //-->
<!--//
####################################
#
# * END CONTENT *
#
####################################
//-->
<div id="tab-License">
<h2>What's the catch?</h2>
<p>
<strong>There's no catch</strong>. Use it, abuse it - even take it
apart and modify it if you know what you're doing. You don't have to,
but if you're feeling generous you can link back to this website (instructions below).
</p>
<h2>Attribute this work</h2>
<div class="license-info">
<table cellspacing="5" width="100%">
<tr>
<td width="90" align="right">Attribution link:</td>
<td valign="top">© <a href="http://www.fyneworks.com/">Fyneworks.com</a></td>
</tr>
<tr>
<td width="90" align="right">HTML Code:</td>
<td valign="top">
<input type="text" onFocus="this.select();" onClick="this.select()" readonly="" style="width:100%;"
value="&copy; <a href="http://www.fyneworks.com/">Fyneworks.com</a>"
/>
</td>
</tr>
</table>
</div>
<h2>License Info</h2>
<div class="license-info">
<table cellspacing="5" width="100%">
<tr>
<td valign="middle">
<strong>Star Rating Plugin</strong>
by <a href="http://www.fyneworks.com/">Fyneworks.com</a>
is licensed,
<a target="_blank" href="http://jquery.org/license">as jQuery is</a>,
under the
<a target="_blank" href="http://en.wikipedia.org/wiki/MIT_License">MIT License</a>.
</td>
<td width="100"><a target="_blank" href="http://creativecommons.org/licenses/GPL/2.0/"><img alt="Creative Commons License" style="border-width:0" src="http://creativecommons.org/images/public/somerights20.png"/></a></td>
</tr>
<tr>
<td colspan="2">
<pre class="copyright">Copyright © 2008 <a href="http://www.fyneworks.com/">Fyneworks.com</a>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.</pre>
</td>
</tr>
</table>
</div><!--// License Info //-->
</div><!--// tab-License //-->
<div id="tab-More">
</div><!--// tab-More//-->
</div><!--// tabs //-->
</div>
</div>
<div id="push"></div>
</div>
<div id="foot">
<table width="100%" cellspacing="10">
<tr>
<td valign="middle" width="400" align="left">
</td>
<td valign="top" align="center">
[<a href="#">back to top</a>]
</td>
<td valign="middle" width="400" align="right" colspan="2">
</td>
</tr>
<tr>
<td valign="top" width="400">
<strong>jQuery Plugins</strong>
by <a href="http://www.fyneworks.com/">Fyneworks.com</a>
<br/>
Licensed under the
<a target="_blank" href="http://en.wikipedia.org/wiki/MIT_License">MIT License</a> and the
<a target="_blank" href="http://creativecommons.org/licenses/GPL/2.0/">GPL License (2.0)</a>.
</td>
<td valign="top" align="center">
</td>
<td valign="top" width="400" align="right">
<span style="color:#090;">
Tested with jQuery 1.9 on:<br/>IE6, IE7, IE8, FF, Chrome, Opera and Safari
</span>