index.html 141 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934
  1. <!DOCTYPE html>
  2. <html dir="ltr" lang="en-US">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="author" content="Washington Botelho">
  9. <meta name="description" content="A Star Rating Plugin">
  10. <meta name="google" content="notranslate">
  11. <meta name="keywords" content="jquery,rating,raty,voto,star,staring,classificacao,classificar,votar,plugin,javascript,library">
  12. <meta name="robots" content="ALL">
  13. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  14. <link href="favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
  15. <title>jQuery Raty | A Star Rating Plugin - Washington Botelho</title>
  16. <meta content="authenticity_token" name="csrf-param">
  17. <link href="stylesheets/labs.css" media="screen" rel="stylesheet" type="text/css">
  18. <link rel="stylesheet" href="../lib/jquery.raty.css">
  19. <style>.functions .demo {
  20. margin-bottom: 10px;
  21. }
  22. .functions .item {
  23. background-color: #FEFEFE;
  24. border-radius: 4px;
  25. display: inline-block;
  26. margin-bottom: 5px;
  27. padding: 5px 10px;
  28. }
  29. .functions .item a {
  30. border: 1px solid #CCC;
  31. margin-left: 10px;
  32. padding: 5px;
  33. text-decoration: none;
  34. }
  35. .functions .item input {
  36. display: inline-block;
  37. margin-left: 2px;
  38. padding: 5px 6px;
  39. width: 120px;
  40. }
  41. .functions .item label {
  42. display: inline-block;
  43. font-size: 1.1em;
  44. font-weight: bold;
  45. }
  46. .hint {
  47. text-align: center;
  48. width: 160px
  49. }
  50. div.hint {
  51. font-size: 1.4em;
  52. height: 46px;
  53. margin-top: 15px;
  54. padding: 7px
  55. }
  56. </style>
  57. <script src="../vendor/jquery.js"></script><script src="../lib/jquery.raty.js"></script>
  58. <script src="javascripts/labs.js" type="text/javascript"></script>
  59. </head>
  60. <body>
  61. <div class="content">
  62. <div role="banner" class="header">
  63. <h1><a href="/raty">jQuery Raty</a></h1>
  64. <div>A Star Rating Plugin</div>
  65. </div>
  66. <nav role="navigation" class="navigation">
  67. <a href="http://github.com/wbotelhos/archive/2.8.0.zip" class="download" title="Download version 2.7.0"><i class="i-file-zip"></i> v2.8.0</a>
  68. <a href="http://github.com/wbotelhos/raty" class="i-github" target="blank" title="Github &lt;http://github.com/wbotelhos/raty&gt;"></a>
  69. <a href="http://wbotelhos.com/labs" class="labs i-labs" target="blank" title="Labs &lt;http://wbotelhos.com/labs&gt;"></a>
  70. <i class="i-heart" title="Thank you! &lt;3"></i>
  71. <div id="donations">
  72. <a href="http://gittip.com/wbotelhos" target="_blank">Git tip</a>
  73. <span>•</span>
  74. <a href="http://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;business=X8HEP2878NDEG&amp;item_name=jQuery%20Raty" target="_blank">Paypal</a>
  75. </div>
  76. </nav>
  77. <div class="clearfix"></div>
  78. <article>
  79. <div class="body">
  80. <h1>Default</h1>
  81. <p>You need just to have a <code>div</code> to build the Raty.</p>
  82. <div id="default"></div>
  83. <div class="highlight"><pre><span class="nt">&lt;div&gt;&lt;/div&gt;</span>
  84. </pre></div>
  85. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">();</span>
  86. </pre></div>
  87. <h1>Score</h1>
  88. <p>Used when we want starts with a saved rating.</p>
  89. <div id="score"></div>
  90. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">});</span>
  91. </pre></div>
  92. <h1>Score callback</h1>
  93. <p>If you need to start you score depending of a dynamic value, you can to use callback for it.<br>
  94. You can pass any value for it, not necessarily a data- value. You can use a field value for example.</p>
  95. <div id="score-callback" data-score="1"></div>
  96. <div class="highlight"><pre><span class="nt">&lt;div</span> <span class="na">data-score=</span><span class="s">"1"</span><span class="nt">&gt;&lt;/div&gt;</span>
  97. </pre></div>
  98. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  99. <span class="nx">score</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
  100. <span class="k">return</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'data-score'</span><span class="p">);</span>
  101. <span class="p">}</span>
  102. <span class="p">});</span>
  103. </pre></div>
  104. <h1>Score Name</h1>
  105. <p>Changes the name of the hidden <a href="#score">score</a> field.</p>
  106. <div id="scoreName"></div>
  107. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">scoreName</span><span class="o">:</span> <span class="s1">'entity[score]'</span> <span class="p">});</span>
  108. </pre></div>
  109. <h1>Number</h1>
  110. <p>Changes the number of stars.</p>
  111. <div id="number"></div>
  112. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">number</span><span class="o">:</span> <span class="mi">10</span> <span class="p">});</span>
  113. </pre></div>
  114. <h1>Number callback</h1>
  115. <p>You can receive the <a href="#number">number</a> of stars dynamic using callback to set it.</p>
  116. <div id="number-callback" data-number="3"></div>
  117. <div class="highlight"><pre><span class="nt">&lt;div</span> <span class="na">data-number=</span><span class="s">"3"</span><span class="nt">&gt;&lt;/div&gt;</span>
  118. </pre></div>
  119. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  120. <span class="nx">number</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
  121. <span class="k">return</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">'data-number'</span><span class="p">);</span>
  122. <span class="p">}</span>
  123. <span class="p">});</span>
  124. </pre></div>
  125. <h1>Number Max</h1>
  126. <p>Change the maximum of start that can be created.</p>
  127. <div id="numberMax"></div>
  128. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  129. <span class="nx">numberMax</span> <span class="o">:</span> <span class="mi">5</span><span class="p">,</span>
  130. <span class="nx">number</span> <span class="o">:</span> <span class="mi">100</span>
  131. <span class="p">});</span>
  132. </pre></div>
  133. <h1>Read Only</h1>
  134. <p>You can prevent users to vote. It can be applied with or without <a href="#score">score</a> and all stars will receives the <a href="#hints">hint</a> corresponding of the selected star.<br>
  135. Stop the mouse over the stars to see:</p>
  136. <div id="readOnly"></div>
  137. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">readOnly</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">});</span>
  138. </pre></div>
  139. <h1>Read Only callback</h1>
  140. <p>You can decide if the rating will be <a href="#readOnly">readOnly</a> dynamically returning <code>true</code> of <code>false</code> on callback.</p>
  141. <div id="readOnly-callback"></div>
  142. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  143. <span class="nx">readOnly</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
  144. <span class="k">return</span> <span class="s1">'true becomes readOnly'</span> <span class="o">==</span> <span class="s1">'true becomes readOnly'</span><span class="p">;</span>
  145. <span class="p">}</span>
  146. <span class="p">});</span>
  147. </pre></div>
  148. <h1>No Rated Message</h1>
  149. <p>If <a href="#readOnly">readOnly</a> is enabled and there is no <a href="#score">score</a>, the <a href="#hint">hint</a> "Not rated yet!" will be shown for all stars. But you can change it.<br>
  150. Stop the mouse over the star to see:</p>
  151. <div id="noRatedMsg"></div>
  152. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  153. <span class="nx">readOnly</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  154. <span class="nx">noRatedMsg</span> <span class="o">:</span> <span class="s2">"I'am readOnly and I haven't rated yet!"</span>
  155. <span class="p">});</span>
  156. </pre></div>
  157. <h1>Half Show</h1>
  158. <p>You can represent a float <a href="#score">score</a> as a half star icon.<br>
  159. This options is just to <strong>show</strong> the half star. If you want enable the vote with half star on mouseover, please check the option <a href="#half">half</a>.<br>
  160. The <code>round</code> options showed belows is just for the <strong>icon</strong>, the score keeps as <strong>float</strong> always.</p>
  161. <h2>Enabled</h2>
  162. <p>The round rules are:</p>
  163. <ul>
  164. <li>Down: score &lt;= x.25 the star will be rounded down;</li>
  165. <li>Half: score &gt;= x.26 and &lt;= x.75 the star will be a half star;</li>
  166. <li>Up: score &gt;= x.76 the star will be rounded up.</li>
  167. </ul>
  168. <div id="halfShow-true"></div>
  169. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">score</span><span class="o">:</span> <span class="mf">3.26</span> <span class="p">});</span>
  170. </pre></div>
  171. <h2>Disabled</h2>
  172. <p>The rules becomes:</p>
  173. <ul>
  174. <li>Down: score &lt; x.6 the star will be rounded down;</li>
  175. <li>Up: score &gt;= x.6 the star will be rounded up;</li>
  176. </ul>
  177. <div id="halfShow-false"></div>
  178. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  179. <span class="nx">halfShow</span> <span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
  180. <span class="nx">score</span> <span class="o">:</span> <span class="mf">3.26</span>
  181. <span class="p">});</span>
  182. </pre></div>
  183. <h1>Round</h1>
  184. <p>You can customize the round values of the <a href="#halfShow">halfShow</a> option.<br>
  185. We changed the default interval [x.25 .. x.76], now x.26 will round down instead of to be a half star.<br>
  186. Remember that the <code>full</code> attribute is used only when halfShow is disabled.<br>
  187. You can specify just the attribute you want to change and keeps the others as default.</p>
  188. <div id="round"></div>
  189. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  190. <span class="nx">round</span> <span class="o">:</span> <span class="p">{</span> <span class="nx">down</span><span class="o">:</span> <span class="p">.</span><span class="mi">26</span><span class="p">,</span> <span class="nx">full</span><span class="o">:</span> <span class="p">.</span><span class="mi">6</span><span class="p">,</span> <span class="nx">up</span><span class="o">:</span> <span class="p">.</span><span class="mi">76</span> <span class="p">},</span>
  191. <span class="nx">score</span> <span class="o">:</span> <span class="mf">3.26</span>
  192. <span class="p">});</span>
  193. </pre></div>
  194. <h1>Half</h1>
  195. <p>Enables the half star mouseover to be possible vote with half values.<br>
  196. If you want to vote with more precison than half value, please check the option <a href="#precision">precision</a>.</p>
  197. <div id="half"></div>
  198. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">half</span><span class="o">:</span> <span class="kc">true</span> <span class="p">});</span>
  199. </pre></div>
  200. <h1>Star Half</h1>
  201. <p>Changes the name of the half star.<br>
  202. Pay attention, when you want specify a different icon with a different directory, you must to set the <a href="#path">path</a> option to <code>null</code> to avoid it to be prepended on your path and, consequently, specify all other icons with explicit original path.</p>
  203. <div id="starHalf"></div>
  204. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  205. <span class="nx">half</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  206. <span class="nx">starHalf</span> <span class="o">:</span> <span class="s1">'star-half-mono.png'</span>
  207. <span class="p">});</span>
  208. </pre></div>
  209. <p>You can to use the size of icon you want.</p>
  210. <div id="size"></div>
  211. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  212. <span class="nx">cancel</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  213. <span class="nx">starOff</span> <span class="o">:</span> <span class="s1">'star-off-big.png'</span><span class="p">,</span>
  214. <span class="nx">starOn</span> <span class="o">:</span> <span class="s1">'star-on-big.png'</span>
  215. <span class="p">});</span>
  216. </pre></div>
  217. <h1>Click</h1>
  218. <p>Callback to handle the <a href="#score">score</a> and the click <code>event</code> on click action.<br>
  219. You can mension the Raty element (DOM) itself using <code>this</code>.</p>
  220. <div id="click"></div>
  221. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  222. <span class="nx">click</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">score</span><span class="p">,</span> <span class="nx">evt</span><span class="p">)</span> <span class="p">{</span>
  223. <span class="nx">alert</span><span class="p">(</span><span class="s1">'ID: '</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">id</span> <span class="o">+</span> <span class="s2">"\nscore: "</span> <span class="o">+</span> <span class="nx">score</span> <span class="o">+</span> <span class="s2">"\nevent: "</span> <span class="o">+</span> <span class="nx">evt</span><span class="p">);</span>
  224. <span class="p">}</span>
  225. <span class="p">});</span>
  226. </pre></div>
  227. <h1>Click Prevent</h1>
  228. <p>If you return <code>false</code> into callback, the click action will be prevented.</p>
  229. <div id="click-prevent"></div>
  230. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  231. <span class="nx">click</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">score</span><span class="p">,</span> <span class="nx">evt</span><span class="p">)</span> <span class="p">{</span>
  232. <span class="nx">alert</span><span class="p">(</span><span class="s1">'Score will not change.'</span><span class="p">)</span>
  233. <span class="k">return</span> <span class="kc">false</span><span class="p">;</span>
  234. <span class="p">}</span>
  235. <span class="p">});</span>
  236. </pre></div>
  237. <h1>Hints</h1>
  238. <p>Changes the hint for each star by it position on array.<br>
  239. If you pass <code>null</code>, the <a href="#score">score</a> value of this star will be the hint.<br>
  240. If you pass <code>undefined</code>, this position will be ignored and receive the default hint.</p>
  241. <div id="hints"></div>
  242. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">hints</span><span class="o">:</span> <span class="p">[</span><span class="s1">'a'</span><span class="p">,</span> <span class="kc">null</span><span class="p">,</span> <span class="s1">''</span><span class="p">,</span> <span class="kc">undefined</span><span class="p">,</span> <span class="s1">'*_*'</span><span class="p">]});</span>
  243. </pre></div>
  244. <h1>Path</h1>
  245. <p>Changes the path where your icons are located.<br>
  246. Set it only if you want the same path for all icons.<br>
  247. Don't mind about the last slash of the path, if you don't put it, it will be setted for you.</p>
  248. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">path</span><span class="o">:</span> <span class="s1">'assets/images'</span> <span class="p">});</span>
  249. </pre></div>
  250. <p>Now we have the following full paths: <strong>assets/images/star-on.png</strong>, <strong>assets/images/star-off.png</strong> and so.</p>
  251. <h1>Path Callback</h1>
  252. <p>You can set the path dinamically using callback.</p>
  253. <div class="highlight"><pre><span class="nt">&lt;div</span> <span class="na">data-path=</span><span class="s">"assets/images"</span><span class="nt">&gt;&lt;/div&gt;</span>
  254. </pre></div>
  255. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  256. <span class="nx">path</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
  257. <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">getAttribute</span><span class="p">(</span><span class="s1">'data-path'</span><span class="p">);</span>
  258. <span class="p">}</span>
  259. <span class="p">});</span>
  260. </pre></div>
  261. <h1>Star Off and Star On</h1>
  262. <p>Changes the name of the star on and star off.</p>
  263. <div id="star-off-and-star-on"></div>
  264. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  265. <span class="nx">starOff</span> <span class="o">:</span> <span class="s1">'off.png'</span><span class="p">,</span>
  266. <span class="nx">starOn</span> <span class="o">:</span> <span class="s1">'on.png'</span>
  267. <span class="p">});</span>
  268. </pre></div>
  269. <h1>Cancel</h1>
  270. <p>Add a cancel button on the left side of the stars to cacel the <a href="#score">score</a>.<br>
  271. Inside the <a href="#click">click</a> callback the argument code receives the value <code>null</code> when we click on cancel button.</p>
  272. <div id="cancel"></div>
  273. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">cancel</span><span class="o">:</span> <span class="kc">true</span> <span class="p">});</span>
  274. </pre></div>
  275. <h1>Cancel Hint</h1>
  276. <p>Like the stars, the <a href="#cancel">cancel</a> button have a hint too, and you can change it.<br>
  277. Stop the mouse over the cancel button to see:</p>
  278. <div id="cancelHint"></div>
  279. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  280. <span class="nx">cancel</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  281. <span class="nx">cancelHint</span> <span class="o">:</span> <span class="s1">'My cancel hint!'</span>
  282. <span class="p">});</span>
  283. </pre></div>
  284. <h1>Cancel Place</h1>
  285. <p>Changes the <a href="#cancel">cancel</a> button to the right side.</p>
  286. <div id="cancelPlace"></div>
  287. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  288. <span class="nx">cancel</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  289. <span class="nx">cancelPlace</span> <span class="o">:</span> <span class="s1">'right'</span>
  290. <span class="p">});</span>
  291. </pre></div>
  292. <h1>Cancel off and Cancel On</h1>
  293. <p>Changes the on and off icon of the <a href="#cancel">cancel</a> button.</p>
  294. <div id="cancel-off-and-cancel-on"></div>
  295. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  296. <span class="nx">cancel</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  297. <span class="nx">cancelOff</span> <span class="o">:</span> <span class="s1">'cancel-off.png'</span><span class="p">,</span>
  298. <span class="nx">cancelOn</span> <span class="o">:</span> <span class="s1">'cancel-on.png'</span>
  299. <span class="p">});</span>
  300. </pre></div>
  301. <h1>Icon Range</h1>
  302. <p>It's an array of objects where each one represents a custom icon.<br>
  303. The <code>range</code> attribute is until wich position the icon will be displayed.<br>
  304. The <code>on</code> attribute is the active icon.<br>
  305. The <code>off</code> attribute is the inactive icon.</p>
  306. <div id="iconRange"></div>
  307. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  308. <span class="nx">iconRange</span><span class="o">:</span> <span class="p">[</span>
  309. <span class="p">{</span> <span class="nx">range</span><span class="o">:</span> <span class="mi">1</span><span class="p">,</span> <span class="nx">on</span><span class="o">:</span> <span class="s1">'1.png'</span><span class="p">,</span> <span class="nx">off</span><span class="o">:</span> <span class="s1">'0.png'</span> <span class="p">},</span>
  310. <span class="p">{</span> <span class="nx">range</span><span class="o">:</span> <span class="mi">2</span><span class="p">,</span> <span class="nx">on</span><span class="o">:</span> <span class="s1">'2.png'</span><span class="p">,</span> <span class="nx">off</span><span class="o">:</span> <span class="s1">'0.png'</span> <span class="p">},</span>
  311. <span class="p">{</span> <span class="nx">range</span><span class="o">:</span> <span class="mi">3</span><span class="p">,</span> <span class="nx">on</span><span class="o">:</span> <span class="s1">'3.png'</span><span class="p">,</span> <span class="nx">off</span><span class="o">:</span> <span class="s1">'0.png'</span> <span class="p">},</span>
  312. <span class="p">{</span> <span class="nx">range</span><span class="o">:</span> <span class="mi">4</span><span class="p">,</span> <span class="nx">on</span><span class="o">:</span> <span class="s1">'4.png'</span><span class="p">,</span> <span class="nx">off</span><span class="o">:</span> <span class="s1">'0.png'</span> <span class="p">},</span>
  313. <span class="p">{</span> <span class="nx">range</span><span class="o">:</span> <span class="mi">5</span><span class="p">,</span> <span class="nx">on</span><span class="o">:</span> <span class="s1">'5.png'</span><span class="p">,</span> <span class="nx">off</span><span class="o">:</span> <span class="s1">'0.png'</span> <span class="p">}</span>
  314. <span class="p">]</span>
  315. <span class="p">});</span>
  316. </pre></div>
  317. <p>You can use an interval of the same icon jumping some number.<br>
  318. The <code>range</code> attribute must be in an ascending order.<br>
  319. If the value <code>on</code> or <code>off</code> is omitted then the attribute <code>starOn</code> and <code>starOff</code> will be used.</p>
  320. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  321. <span class="nx">starOff</span> <span class="o">:</span> <span class="s1">'0.png'</span><span class="p">,</span>
  322. <span class="nx">iconRange</span> <span class="o">:</span> <span class="p">[</span>
  323. <span class="p">{</span> <span class="nx">range</span> <span class="o">:</span> <span class="mi">1</span><span class="p">,</span> <span class="nx">on</span><span class="o">:</span> <span class="s1">'1.png'</span> <span class="p">},</span>
  324. <span class="p">{</span> <span class="nx">range</span> <span class="o">:</span> <span class="mi">3</span><span class="p">,</span> <span class="nx">on</span><span class="o">:</span> <span class="s1">'3.png'</span> <span class="p">},</span>
  325. <span class="p">{</span> <span class="nx">range</span> <span class="o">:</span> <span class="mi">5</span><span class="p">,</span> <span class="nx">on</span><span class="o">:</span> <span class="s1">'5.png'</span> <span class="p">}</span>
  326. <span class="p">]</span>
  327. <span class="p">});</span>
  328. </pre></div>
  329. <p>Now we have all off icons as <strong>0.png</strong>, icons 1 and 2 as <strong>1.png</strong>, icon 3 as <strong>3.png</strong> and icons 4 and 5 as <strong>5.png</strong>. </p>
  330. <h1>Target</h1>
  331. <p>Some place to display the <a href="#hints">hints</a> or the <a href="#cancelHint">cancelHint</a>.</p>
  332. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  333. <span class="nx">cancel</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  334. <span class="nx">target</span> <span class="o">:</span> <span class="s1">'#hint'</span>
  335. <span class="p">});</span>
  336. </pre></div>
  337. <p>Your target can be a <code>div</code>.</p>
  338. <div id="target-div"></div>
  339. <div id="target-div-hint" class="input hint"></div>
  340. <div class="highlight"><pre><span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">"hint"</span><span class="nt">&gt;&lt;/div&gt;</span>
  341. </pre></div>
  342. <p>Your target can be a <code>text</code> field.</p>
  343. <div id="target-text"></div>
  344. <p><input id="target-text-hint" type="text" class="input hint"></p>
  345. <div class="highlight"><pre><span class="nt">&lt;input</span> <span class="na">id=</span><span class="s">"hint"</span> <span class="na">type=</span><span class="s">"text"</span> <span class="nt">/&gt;</span>
  346. </pre></div>
  347. <p>Your target can be a <code>textarea</code>.</p>
  348. <div id="target-textarea"></div>
  349. <p><textarea id="target-textarea-hint" class="input hint"></textarea></p>
  350. <div class="highlight"><pre><span class="nt">&lt;textarea</span> <span class="na">id=</span><span class="s">"hint"</span><span class="nt">&gt;&lt;/textarea&gt;</span>
  351. </pre></div>
  352. <p>Your target can be a <code>select</code>.</p>
  353. <div id="target-select"></div>
  354. <p><select id="target-select-hint" class="input hint"><br>
  355. <option value="">--</option>
  356. <br>
  357. <option value="bad">bad</option>
  358. <br>
  359. <option value="poor">poor</option>
  360. <br>
  361. <option value="regular">regular</option>
  362. <br>
  363. <option value="good">good</option>
  364. <br>
  365. <option value="gorgeous">gorgeous</option>
  366. <br>
  367. </select></p>
  368. <div class="highlight"><pre><span class="nt">&lt;select</span> <span class="na">id=</span><span class="s">"hint"</span><span class="nt">&gt;</span>
  369. <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">""</span><span class="nt">&gt;</span>--<span class="nt">&lt;/option&gt;</span>
  370. <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"bad"</span><span class="nt">&gt;</span>bad<span class="nt">&lt;/option&gt;</span>
  371. <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"poor"</span><span class="nt">&gt;</span>poor<span class="nt">&lt;/option&gt;</span>
  372. <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"regular"</span><span class="nt">&gt;</span>regular<span class="nt">&lt;/option&gt;</span>
  373. <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"good"</span><span class="nt">&gt;</span>good<span class="nt">&lt;/option&gt;</span>
  374. <span class="nt">&lt;option</span> <span class="na">value=</span><span class="s">"gorgeous"</span><span class="nt">&gt;</span>gorgeous<span class="nt">&lt;/option&gt;</span>
  375. <span class="nt">&lt;/select&gt;</span>
  376. </pre></div>
  377. <h1>Target Type</h1>
  378. <p>You have the option <code>hint</code> or <code>score</code> to chosse.<br>
  379. You can choose to see the <a href="#score">score</a> instead the <a href="#hints">hints</a> using the value <code>score</code>.<br>
  380. For the <a href="#cancel">cancel</a> button the value is empty.</p>
  381. <div id="targetType"></div>
  382. <div id="targetType-hint" class="input hint"></div>
  383. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  384. <span class="nx">cancel</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  385. <span class="nx">target</span> <span class="o">:</span> <span class="s1">'#hint'</span><span class="p">,</span>
  386. <span class="nx">targetType</span> <span class="o">:</span> <span class="s1">'score'</span>
  387. <span class="p">});</span>
  388. </pre></div>
  389. <h1>Target Keep</h1>
  390. <p>If you want to keep the <a href="#score">score</a> into the hint box after you do the rating, turn on this option.</p>
  391. <div id="targetKeep"></div>
  392. <div id="targetKeep-hint" class="input hint"></div>
  393. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  394. <span class="nx">cancel</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  395. <span class="nx">target</span> <span class="o">:</span> <span class="s1">'#hint'</span><span class="p">,</span>
  396. <span class="nx">targetKeep</span> <span class="o">:</span> <span class="kc">true</span>
  397. <span class="p">});</span>
  398. </pre></div>
  399. <h1>Target Text</h1>
  400. <p>Normally all <a href="#target-div">target</a> is keeped blank if you don't use the <a href="#targetKeep">targetKeep</a> option.<br>
  401. If you want a default content you can use this option.</p>
  402. <div id="targetText"></div>
  403. <div id="targetText-hint" class="input hint"></div>
  404. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  405. <span class="nx">target</span> <span class="o">:</span> <span class="s1">'#hint'</span><span class="p">,</span>
  406. <span class="nx">targetText</span> <span class="o">:</span> <span class="s1">'--'</span>
  407. <span class="p">});</span>
  408. </pre></div>
  409. <h1>Target Format</h1>
  410. <p>You can choose a template to be merged with your hints and displayed on <a href="#target-div">target</a>.</p>
  411. <div id="targetFormat"></div>
  412. <div id="targetFormat-hint" class="input hint"></div>
  413. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  414. <span class="nx">target</span> <span class="o">:</span> <span class="s1">'#hint'</span><span class="p">,</span>
  415. <span class="nx">targetFormat</span> <span class="o">:</span> <span class="s1">'Rating: {score}'</span>
  416. <span class="p">});</span>
  417. </pre></div>
  418. <h1>Target Score</h1>
  419. <p>You can keep the score value inside the binded element by default or choose where to put it.<br>
  420. If you change the score target, the default score field won't be created.<br>
  421. It is not like <a href="#target-div">target</a> option for display purpose, it is the real current score data.</p>
  422. <div id="targetScore"></div>
  423. <p><input id="target-score" type="text" class="input hint"></p>
  424. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  425. <span class="nx">targetScore</span><span class="o">:</span> <span class="s1">'#target'</span>
  426. <span class="p">});</span>
  427. </pre></div>
  428. <h1>Mouseover</h1>
  429. <p>You can handle the action on mouseover.<br>
  430. The arguments is the same of the <a href="#click">click</a> callback.<br>
  431. The options <a href="#target-div">target</a>, <a href="#targetFormat">targetFormat</a>, <a href="#targetKeep">targetKeep</a>, <a href="#targetText">targetText</a> and <a href="#targetType">targetType</a> are abstractions of this callback. You can do it by yourself.</p>
  432. <div id="mouseover"></div>
  433. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  434. <span class="nx">mouseover</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">score</span><span class="p">,</span> <span class="nx">evt</span><span class="p">)</span> <span class="p">{</span>
  435. <span class="nx">alert</span><span class="p">(</span><span class="s1">'ID: '</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">id</span> <span class="o">+</span> <span class="s2">"\nscore: "</span> <span class="o">+</span> <span class="nx">score</span> <span class="o">+</span> <span class="s2">"\nevent: "</span> <span class="o">+</span> <span class="nx">evt</span><span class="p">);</span>
  436. <span class="p">}</span>
  437. <span class="p">});</span>
  438. </pre></div>
  439. <h1>Mouseout</h1>
  440. <p>You can handle the action on mouseout.<br>
  441. The arguments is the same of the <a href="#mouseover">mouseover</a> callback.</p>
  442. <div id="mouseout"></div>
  443. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  444. <span class="nx">mouseout</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">score</span><span class="p">,</span> <span class="nx">evt</span><span class="p">)</span> <span class="p">{</span>
  445. <span class="nx">alert</span><span class="p">(</span><span class="s1">'ID: '</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">id</span> <span class="o">+</span> <span class="s2">"\nscore: "</span> <span class="o">+</span> <span class="nx">score</span> <span class="o">+</span> <span class="s2">"\nevent: "</span> <span class="o">+</span> <span class="nx">evt</span><span class="p">);</span>
  446. <span class="p">}</span>
  447. <span class="p">});</span>
  448. </pre></div>
  449. <h1>Precision</h1>
  450. <p>You can get the right position of the cursor to get a precision <a href="#score">score</a>.<br>
  451. The star is represented just as half and full star, but the <a href="#score">score</a> is saved with precision.<br>
  452. When you enable this option the <a href="#half">half</a> options is automatically enabled and <a href="#targetType">targetType</a> is changed to <code>score</code>.</p>
  453. <div id="precision"></div>
  454. <div id="precision-hint" class="input hint"></div>
  455. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#precision'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  456. <span class="nx">cancel</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  457. <span class="nx">cancelOff</span> <span class="o">:</span> <span class="s1">'cancel-off.png'</span><span class="p">,</span>
  458. <span class="nx">cancelOn</span> <span class="o">:</span> <span class="s1">'cancel-on.png'</span><span class="p">,</span>
  459. <span class="nx">path</span> <span class="o">:</span> <span class="s1">'images'</span><span class="p">,</span>
  460. <span class="nx">starHalf</span> <span class="o">:</span> <span class="s1">'star-half.png'</span><span class="p">,</span>
  461. <span class="nx">starOff</span> <span class="o">:</span> <span class="s1">'star-off.png'</span><span class="p">,</span>
  462. <span class="nx">starOn</span> <span class="o">:</span> <span class="s1">'star-on.png'</span><span class="p">,</span>
  463. <span class="nx">target</span> <span class="o">:</span> <span class="s1">'#precision-hint'</span><span class="p">,</span>
  464. <span class="nx">targetKeep</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  465. <span class="nx">precision</span> <span class="o">:</span> <span class="kc">true</span>
  466. <span class="p">});</span>
  467. </pre></div>
  468. <h1>Space</h1>
  469. <p>You can take off the space between the star.</p>
  470. <div id="space"></div>
  471. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#space'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">space</span><span class="o">:</span> <span class="kc">false</span> <span class="p">});</span>
  472. </pre></div>
  473. <h1>Single</h1>
  474. <p>You can turn on just the mouseovered star instead all from the first until that one.</p>
  475. <div id="single"></div>
  476. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#single'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">single</span><span class="o">:</span> <span class="kc">true</span> <span class="p">});</span>
  477. </pre></div>
  478. <h1>Star Type</h1>
  479. <p>It lets you to change the star element type. Changing it from <code>img</code> to <code>i</code>, for example, gives you the change to use font instead image. There is a sample CSS (<code>stylesheets/jquery.raty.css</code>) using a sample fonts (<code>fonts/jquery.raty.[eot|svg|ttf|woff]</code>).</p>
  480. <p>To be easier to use, we replace the dot (.) extension to hyphen (-), so you do not need to change the original names, just set the names to your fonts. We recommend you use the <a href="http://icomoon.io">Ico Moon</a> app to be possible to download only the icons you need and rename it.</p>
  481. <div id="starType"></div>
  482. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  483. <span class="nx">cancel</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  484. <span class="nx">half</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  485. <span class="nx">starType</span> <span class="o">:</span> <span class="s1">'i'</span>
  486. <span class="p">});</span>
  487. </pre></div>
  488. <h1>Changing the settings globally</h1>
  489. <p>You can change any option mentioning the scope <code>$.fn.raty.defaults.OPTION = VALUE;</code>. It must be called before you bind the plugin.</p>
  490. <div class="highlight"><pre><span class="nx">$</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">defaults</span><span class="p">.</span><span class="nx">path</span> <span class="o">=</span> <span class="nx">assets</span><span class="p">;</span>
  491. <span class="nx">$</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">defaults</span><span class="p">.</span><span class="nx">cancel</span> <span class="o">=</span> <span class="kc">true</span><span class="p">;</span>
  492. </pre></div>
  493. <h1>Options</h1>
  494. <div class="highlight"><pre><span class="nx">cancel</span><span class="o">:</span> <span class="kc">false</span>
  495. </pre></div>
  496. <p>Creates a cancel button to cancel the rating.</p>
  497. <div class="highlight"><pre><span class="nx">cancelClass</span><span class="o">:</span> <span class="s1">'raty-cancel'</span>
  498. </pre></div>
  499. <p>Name of cancel's class.</p>
  500. <div class="highlight"><pre><span class="nx">cancelHint</span><span class="o">:</span> <span class="s1">'Cancel this rating!'</span>
  501. </pre></div>
  502. <p>The cancel's button hint.</p>
  503. <div class="highlight"><pre><span class="nx">cancelOff</span><span class="o">:</span> <span class="s1">'cancel-off.png'</span>
  504. </pre></div>
  505. <p>Icon used on active cancel.</p>
  506. <div class="highlight"><pre><span class="nx">cancelOn</span><span class="o">:</span> <span class="s1">'cancel-on.png'</span>
  507. </pre></div>
  508. <p>Icon used inactive cancel.</p>
  509. <div class="highlight"><pre><span class="nx">cancelPlace</span><span class="o">:</span> <span class="s1">'left'</span>
  510. </pre></div>
  511. <p>Cancel's button position.</p>
  512. <div class="highlight"><pre><span class="nx">click</span><span class="o">:</span> <span class="kc">undefined</span>
  513. </pre></div>
  514. <p>Callback executed on rating click.</p>
  515. <div class="highlight"><pre><span class="nx">half</span><span class="o">:</span> <span class="kc">false</span>
  516. </pre></div>
  517. <p>Enables half star selection.</p>
  518. <div class="highlight"><pre><span class="nx">halfShow</span><span class="o">:</span> <span class="kc">true</span>
  519. </pre></div>
  520. <p>Enables half star display.</p>
  521. <div class="highlight"><pre><span class="nx">hints</span><span class="o">:</span> <span class="p">[</span><span class="s1">'bad'</span><span class="p">,</span> <span class="s1">'poor'</span><span class="p">,</span> <span class="s1">'regular'</span><span class="p">,</span> <span class="s1">'good'</span><span class="p">,</span> <span class="s1">'gorgeous'</span><span class="p">]</span>
  522. </pre></div>
  523. <p>Hints used on each star.</p>
  524. <div class="highlight"><pre><span class="nx">iconRange</span><span class="o">:</span> <span class="kc">undefined</span>
  525. </pre></div>
  526. <p>Object list with position and icon on and off to do a mixed icons.</p>
  527. <div class="highlight"><pre><span class="nx">mouseout</span><span class="o">:</span> <span class="kc">undefined</span>
  528. </pre></div>
  529. <p>Callback executed on mouseout.</p>
  530. <div class="highlight"><pre><span class="nx">mouseover</span><span class="o">:</span> <span class="kc">undefined</span>
  531. </pre></div>
  532. <p>Callback executed on mouseover.</p>
  533. <div class="highlight"><pre><span class="nx">noRatedMsg</span><span class="o">:</span> <span class="s1">'Not rated yet!'</span>
  534. </pre></div>
  535. <p>Hint for no rated elements when it's <a href="#readOnly">readOnly</a>.</p>
  536. <div class="highlight"><pre><span class="nx">number</span><span class="o">:</span> <span class="mi">5</span>
  537. </pre></div>
  538. <p>Number of stars that will be presented.</p>
  539. <div class="highlight"><pre><span class="nx">numberMax</span><span class="o">:</span> <span class="mi">20</span>
  540. </pre></div>
  541. <p>Max of star the option <a href="#number">number</a> can creates.</p>
  542. <div class="highlight"><pre><span class="nx">path</span><span class="o">:</span> <span class="kc">undefined</span>
  543. </pre></div>
  544. <p>A global locate where the icon will be looked.</p>
  545. <div class="highlight"><pre><span class="nx">precision</span><span class="o">:</span> <span class="kc">false</span>
  546. </pre></div>
  547. <p>Enables the selection of a precision score.</p>
  548. <div class="highlight"><pre><span class="nx">readOnly</span><span class="o">:</span> <span class="kc">false</span>
  549. </pre></div>
  550. <p>Turns the rating read-only.</p>
  551. <div class="highlight"><pre><span class="nx">round</span><span class="o">:</span> <span class="p">{</span> <span class="nx">down</span><span class="o">:</span> <span class="p">.</span><span class="mi">25</span><span class="p">,</span> <span class="nx">full</span><span class="o">:</span> <span class="p">.</span><span class="mi">6</span><span class="p">,</span> <span class="nx">up</span><span class="o">:</span> <span class="p">.</span><span class="mi">76</span> <span class="p">}</span>
  552. </pre></div>
  553. <p>Included values attributes to do the <a href="#score">score</a> round math.</p>
  554. <div class="highlight"><pre><span class="nx">score</span><span class="o">:</span> <span class="kc">undefined</span>
  555. </pre></div>
  556. <p>Initial rating.</p>
  557. <div class="highlight"><pre><span class="nx">scoreName</span><span class="o">:</span> <span class="s1">'score'</span>
  558. </pre></div>
  559. <p>Name of the hidden field that holds the score value.</p>
  560. <div class="highlight"><pre><span class="nx">single</span><span class="o">:</span> <span class="kc">false</span>
  561. </pre></div>
  562. <p>Enables just a single star selection.</p>
  563. <div class="highlight"><pre><span class="nx">space</span><span class="o">:</span> <span class="kc">true</span>
  564. </pre></div>
  565. <p>Puts space between the icons.</p>
  566. <div class="highlight"><pre><span class="nx">starHalf</span><span class="o">:</span> <span class="s1">'star-half.png'</span>
  567. </pre></div>
  568. <p>The name of the half star image.</p>
  569. <div class="highlight"><pre><span class="nx">starOff</span><span class="o">:</span> <span class="s1">'star-off.png'</span>
  570. </pre></div>
  571. <p>Name of the star image off.</p>
  572. <div class="highlight"><pre><span class="nx">starOn</span><span class="o">:</span> <span class="s1">'star-on.png'</span>
  573. </pre></div>
  574. <p>Name of the star image on.</p>
  575. <div class="highlight"><pre><span class="nx">target</span><span class="o">:</span> <span class="kc">undefined</span>
  576. </pre></div>
  577. <p>Element selector where the <a href="#score">score</a> will be displayed.</p>
  578. <div class="highlight"><pre><span class="nx">targetFormat</span><span class="o">:</span> <span class="s1">'{score}'</span>
  579. </pre></div>
  580. <p>Template to interpolate the <a href="#score">score</a> in.</p>
  581. <div class="highlight"><pre><span class="nx">targetKeep</span><span class="o">:</span> <span class="kc">false</span>
  582. </pre></div>
  583. <p>If the last rating value will be keeped after mouseout.</p>
  584. <div class="highlight"><pre><span class="nx">targetText</span><span class="o">:</span> <span class="s1">''</span>
  585. </pre></div>
  586. <p>Default text setted on <a href="target">target</a>.</p>
  587. <div class="highlight"><pre><span class="nx">targetType</span><span class="o">:</span> <span class="s1">'hint'</span>
  588. </pre></div>
  589. <p>Option to choose if <a href="target">target</a> will receive hint or the score number.</p>
  590. <h1>Functions</h1>
  591. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">(</span><span class="s1">'score'</span><span class="p">);</span>
  592. </pre></div>
  593. <p>Get the current score. If there is no score then undefined will be returned.</p>
  594. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">(</span><span class="s1">'score'</span><span class="p">,</span> <span class="nx">number</span><span class="p">);</span>
  595. </pre></div>
  596. <p>Set a score.</p>
  597. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">(</span><span class="s1">'click'</span><span class="p">,</span> <span class="nx">number</span><span class="p">);</span>
  598. </pre></div>
  599. <p>Click on some star. It always call the click callback if it exists.</p>
  600. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'.star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">(</span><span class="s1">'readOnly'</span><span class="p">,</span> <span class="kr">boolean</span><span class="p">);</span>
  601. </pre></div>
  602. <p>Change the read-only state.</p>
  603. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">(</span><span class="s1">'cancel'</span><span class="p">,</span> <span class="kr">boolean</span><span class="p">);</span>
  604. </pre></div>
  605. <p>Cancel the rating. The boolean parameter tells if the click will be called or not. If you ommit it, false it will be.</p>
  606. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">(</span><span class="s1">'reload'</span><span class="p">);</span>
  607. </pre></div>
  608. <p>Reload the rating with the same configuration it was binded.</p>
  609. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">(</span><span class="s1">'set'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">option</span><span class="o">:</span> <span class="nx">value</span> <span class="p">});</span>
  610. </pre></div>
  611. <p>Reset the rating with new configurations. Only options especified will be overrided.</p>
  612. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">(</span><span class="s1">'destroy'</span><span class="p">);</span>
  613. </pre></div>
  614. <p>Destroy the bind and gives you the raw element before the bind.</p>
  615. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">(</span><span class="s1">'move'</span><span class="p">,</span> <span class="nx">number</span><span class="p">);</span>
  616. </pre></div>
  617. <p>Move the mouse to the given score point position.</p>
  618. <h1>Functions demo</h1>
  619. <div class="functions">
  620. <div class="demo">
  621. <div id="functions"></div>
  622. <div id="functions-hint" class="input hint"></div>
  623. </div>
  624. <div class="item">
  625. <label for="score-function">score:</label>
  626. <input id="score-function" type="text" value="1" class="input">
  627. <a id="score-function-run" href="javascript:void(0);" title="score">run</a>
  628. </div>
  629. <div class="item">
  630. <label for="click-function">click:</label>
  631. <input id="click-function" type="text" value="2" class="input">
  632. <a id="click-function-run" href="javascript:void(0);" title="click">run</a>
  633. </div>
  634. <div class="item">
  635. <label for="readOnly-function">readOnly:</label>
  636. <input id="readOnly-function" type="text" value="true" class="input">
  637. <a id="readOnly-function-run" href="javascript:void(0);" title="readOnly">run</a>
  638. </div>
  639. <div class="item">
  640. <label for="cancel-function">cancel:</label>
  641. <input id="cancel-function" type="text" value="true" class="input">
  642. <a id="cancel-function-run" href="javascript:void(0);" title="cancel">run</a>
  643. </div>
  644. <div class="item">
  645. <label for="reload-function">reload:</label>
  646. <input id="reload-function" type="text" value="true" disabled class="input">
  647. <a id="reload-function-run" href="javascript:void(0);" title="reload">run</a>
  648. </div>
  649. <div class="item">
  650. <label for="get-score-function">score:</label>
  651. <input id="get-score-function" type="text" value="get" disabled class="input">
  652. <a id="get-score-function-run" href="javascript:void(0);" title="get score">run</a>
  653. </div>
  654. <div class="item">
  655. <label for="set-score-function">score:</label>
  656. <input id="set-score-function" type="text" value="3" class="input">
  657. <a id="set-score-function-run" href="javascript:void(0);" title="set score">run</a>
  658. </div>
  659. <div class="item">
  660. <label for="set-function">set:</label>
  661. <input id="set-function" type="text" value="{ cancel: false }" class="input">
  662. <a id="set-function-run" href="javascript:void(0);" title="set">run</a>
  663. </div>
  664. <div class="item">
  665. <label for="destroy-function">destroy:</label>
  666. <input id="destroy-function" type="text" value="true" disabled class="input">
  667. <a id="destroy-function-run" href="javascript:void(0);" title="destroy">run</a>
  668. </div>
  669. <div class="item">
  670. <label for="move-function">move:</label>
  671. <input id="move-function" type="text" value="3.7" class="input">
  672. <a id="move-function-run" href="javascript:void(0);" title="move">run</a>
  673. </div>
  674. </div>
  675. <h1>Tests</h1>
  676. <p>This plugin is tested to work better. <a href="spec/run.html">Check it out!</a></p>
  677. </div>
  678. </article>
  679. <div class="share">
  680. <p>Share it!</p>
  681. <div class="twitter"><a href="https://twitter.com/intent/tweet?text=%22jQuery+Raty+-+A+Star+Rating+Plugin%22+%7E&amp;url=http%3A%2F%2Fwbotelhos.com%2Fraty&amp;via=wbotelhos" target="_blank" title="via Twitter"><i class="i-twitter"></i></a></div>
  682. </div>
  683. <section class="comments">
  684. <ol>
  685. <li id="comment-768" class="comment">
  686. <div class="avatar">
  687. <img alt="" src="http://www.gravatar.com/avatar/f8c18f2fb33110004b53df292ce7d566?d=mm" title="James">
  688. </div>
  689. <div class="body">
  690. <header>
  691. <a href="javascript:void(0);">James</a>
  692. </header>
  693. <p>Hello,</p>
  694. <p>I have created a very simple page. But it doesn't work with score attribute. I cannot find where the problem is. It will show 5 grey stars, but it should show 3 yellow stars. </p>
  695. <div class="highlight"><pre><span class="nx">$</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">defaults</span><span class="p">.</span><span class="nx">path</span> <span class="o">=</span> <span class="s1">'js/images'</span><span class="p">;</span>
  696. <span class="nx">$</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
  697. <span class="nx">$</span><span class="p">(</span><span class="s1">'#score'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">3</span> <span class="p">});</span>
  698. <span class="p">});</span>
  699. </pre></div>
  700. <footer>
  701. <a href="#comment-768" class="anchor" title="Link to this comment">#768</a>
  702. </footer>
  703. </div>
  704. <ol>
  705. <li id="comment-773" class="comment">
  706. <div class="avatar">
  707. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  708. </div>
  709. <div class="body">
  710. <header>
  711. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  712. <span class="flag author">author</span>
  713. </header>
  714. <p>James,</p>
  715. <p>The options <code>score</code> just do the rating.<br>
  716. If you want to change the numbe of stars, use the option <code>number</code>.</p>
  717. <footer>
  718. <a href="#comment-773" class="anchor" title="Link to this comment">#773</a>
  719. </footer>
  720. </div>
  721. </li>
  722. </ol>
  723. </li>
  724. <li id="comment-767" class="comment">
  725. <div class="avatar">
  726. <img alt="" src="http://www.gravatar.com/avatar/a93750d68359fd4a954113b17b8d1d25?d=mm" title="Muhammad Saleh">
  727. </div>
  728. <div class="body">
  729. <header>
  730. <a href="javascript:void(0);">Muhammad Saleh</a>
  731. </header>
  732. <p>Quick tip for anyone who will use Raty in RTL application<br>
  733. you will find that the half star icon will work properly in LTR as it will be flipped in RTL</p>
  734. <p>To fix that don't create a new image just use this snippet:</p>
  735. <div class="highlight"><pre><span class="nt">img</span><span class="o">[</span><span class="nt">src</span><span class="o">$=</span><span class="s2">"star-half.png"</span><span class="o">]</span><span class="p">{</span>
  736. <span class="o">-</span><span class="n">moz</span><span class="o">-</span><span class="n">transform</span><span class="o">:</span> <span class="n">scaleX</span><span class="p">(</span><span class="m">-1</span><span class="p">);</span>
  737. <span class="o">-</span><span class="n">webkit</span><span class="o">-</span><span class="n">transform</span><span class="o">:</span> <span class="n">scaleX</span><span class="p">(</span><span class="m">-1</span><span class="p">);</span>
  738. <span class="o">-</span><span class="n">o</span><span class="o">-</span><span class="n">transform</span><span class="o">:</span> <span class="n">scaleX</span><span class="p">(</span><span class="m">-1</span><span class="p">);</span>
  739. <span class="n">transform</span><span class="o">:</span> <span class="n">scaleX</span><span class="p">(</span><span class="m">-1</span><span class="p">);</span>
  740. <span class="o">-</span><span class="n">ms</span><span class="o">-</span><span class="n">filter</span><span class="o">:</span> <span class="n">fliph</span><span class="p">;</span> <span class="c">/*IE*/</span>
  741. <span class="n">filter</span><span class="o">:</span> <span class="n">fliph</span><span class="p">;</span> <span class="c">/*IE*/</span>
  742. <span class="p">}</span>
  743. </pre></div>
  744. <p>The previous snippet will flip the image horizontally and it's cross browser.</p>
  745. <p>Happy Coding!</p>
  746. <footer>
  747. <a href="#comment-767" class="anchor" title="Link to this comment">#767</a>
  748. </footer>
  749. </div>
  750. <ol>
  751. <li id="comment-772" class="comment">
  752. <div class="avatar">
  753. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  754. </div>
  755. <div class="body">
  756. <header>
  757. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  758. <span class="flag author">author</span>
  759. </header>
  760. <p>Muhammad Saleh,</p>
  761. <p>Thanks! (:</p>
  762. <footer>
  763. <a href="#comment-772" class="anchor" title="Link to this comment">#772</a>
  764. </footer>
  765. </div>
  766. </li>
  767. </ol>
  768. </li>
  769. <li id="comment-765" class="comment">
  770. <div class="avatar">
  771. <img alt="" src="http://www.gravatar.com/avatar/fa61aa1d27df09f36563b340156ee5d1?d=mm" title="Naseer">
  772. </div>
  773. <div class="body">
  774. <header>
  775. <a href="http:learn.ecozlabs.com" target="_blank">Naseer</a>
  776. </header>
  777. <p>The click callback is not working with other options. My code is...</p>
  778. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="nb">document</span><span class="p">).</span><span class="nx">ready</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
  779. <span class="nx">$</span><span class="p">(</span><span class="s1">'#star-&lt;?php echo $result['</span><span class="nx">ItemId</span><span class="s1">']; ?&gt;'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  780. <span class="nx">readOnly</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  781. <span class="nx">score</span> <span class="o">:</span> <span class="o">&lt;?</span><span class="nx">php</span> <span class="nx">echo</span> <span class="nx">$result</span><span class="p">[</span><span class="s1">'StarRating'</span><span class="p">];</span> <span class="o">?&gt;</span><span class="p">,</span>
  782. <span class="nx">hints</span> <span class="o">:</span> <span class="p">[</span><span class="s1">'&lt;?php echo $result['</span><span class="nx">StarRating</span><span class="s1">']; ?&gt; out of 5 stars'</span><span class="p">,</span> <span class="s1">'&lt;?php echo $result['</span><span class="nx">StarRating</span><span class="s1">']; ?&gt; out of 5 stars'</span><span class="p">,</span> <span class="s1">'&lt;?php echo $result['</span><span class="nx">StarRating</span><span class="s1">']; ?&gt; out of 5 stars'</span><span class="p">,</span> <span class="s1">'&lt;?php echo $result['</span><span class="nx">StarRating</span><span class="s1">']; ?&gt; out of 5 stars'</span><span class="p">,</span> <span class="s1">'&lt;?php echo $result['</span><span class="nx">StarRating</span><span class="s1">']; ?&gt; out of 5 stars'</span><span class="p">],</span>
  783. <span class="nx">precision</span> <span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  784. <span class="nx">click</span> <span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
  785. <span class="nx">alert</span><span class="p">(</span><span class="s1">'score: '</span><span class="p">);</span>
  786. <span class="p">}</span>
  787. <span class="p">});</span>
  788. <span class="p">});</span>
  789. </pre></div>
  790. <footer>
  791. <a href="#comment-765" class="anchor" title="Link to this comment">#765</a>
  792. </footer>
  793. </div>
  794. <ol>
  795. <li id="comment-771" class="comment">
  796. <div class="avatar">
  797. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  798. </div>
  799. <div class="body">
  800. <header>
  801. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  802. <span class="flag author">author</span>
  803. </header>
  804. <p>Naseer,</p>
  805. <p>First, when you have a doubt try to do a simpler example as possible.<br>
  806. I don't know if some of your dynamic PHP variable is breaking something.<br>
  807. Put some code on a live example on web then pass us the link.</p>
  808. <footer>
  809. <a href="#comment-771" class="anchor" title="Link to this comment">#771</a>
  810. </footer>
  811. </div>
  812. </li>
  813. </ol>
  814. </li>
  815. <li id="comment-764" class="comment">
  816. <div class="avatar">
  817. <img alt="" src="http://www.gravatar.com/avatar/39a3c4ee3b965521c0663bae4c8312b6?d=mm" title="Websun">
  818. </div>
  819. <div class="body">
  820. <header>
  821. <a href="http://websuntaraporn.com/" target="_blank">Websun</a>
  822. </header>
  823. <p>Hi,<br>
  824. How can I start using this Raty? What else do I need other than jquery.js and jquery.raty.js?<br>
  825. Sorry if this question looks silly.</p>
  826. <footer>
  827. <a href="#comment-764" class="anchor" title="Link to this comment">#764</a>
  828. </footer>
  829. </div>
  830. <ol>
  831. <li id="comment-770" class="comment">
  832. <div class="avatar">
  833. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  834. </div>
  835. <div class="body">
  836. <header>
  837. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  838. <span class="flag author">author</span>
  839. </header>
  840. <p>Websun,</p>
  841. <p>The best way to know how to use Raty is check this demo page. But basically is this:</p>
  842. <div class="highlight"><pre><span class="o">&lt;</span><span class="nx">script</span> <span class="nx">src</span><span class="o">=</span><span class="s2">"jquery.js"</span><span class="o">&gt;&lt;</span><span class="err">/script&gt;</span>
  843. <span class="o">&lt;</span><span class="nx">script</span> <span class="nx">src</span><span class="o">=</span><span class="s2">"jquery.raty.js"</span><span class="o">&gt;&lt;</span><span class="err">/script&gt;</span>
  844. </pre></div>
  845. <div class="highlight"><pre><span class="nt">&lt;div&gt;&lt;/div&gt;</span>
  846. </pre></div>
  847. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">();</span>
  848. </pre></div>
  849. <footer>
  850. <a href="#comment-770" class="anchor" title="Link to this comment">#770</a>
  851. </footer>
  852. </div>
  853. </li>
  854. <li id="comment-766" class="comment">
  855. <div class="avatar">
  856. <img alt="" src="http://www.gravatar.com/avatar/a93750d68359fd4a954113b17b8d1d25?d=mm" title="Muhammad Saleh">
  857. </div>
  858. <div class="body">
  859. <header>
  860. <a href="javascript:void(0);">Muhammad Saleh</a>
  861. </header>
  862. <p>Websun,</p>
  863. <p>You will also need the images for the<br>
  864. star on<br>
  865. star off<br>
  866. star half</p>
  867. <p>and you may skip the fonts ;) I did that</p>
  868. <footer>
  869. <a href="#comment-766" class="anchor" title="Link to this comment">#766</a>
  870. </footer>
  871. </div>
  872. </li>
  873. </ol>
  874. </li>
  875. <li id="comment-763" class="comment">
  876. <div class="avatar">
  877. <img alt="" src="http://www.gravatar.com/avatar/5ca422fa639219f682462cf9a95f687b?d=mm" title="Tom">
  878. </div>
  879. <div class="body">
  880. <header>
  881. <a href="javascript:void(0);">Tom</a>
  882. </header>
  883. <p>Is it possible to turn off the hints all together?<br>
  884. When I pass null and it shows the 'score', it's not showing the fraction amount. I.e. a score of 3.5 for the hint is showing as 3. As such, I'd like to turn it off.</p>
  885. <footer>
  886. <a href="#comment-763" class="anchor" title="Link to this comment">#763</a>
  887. </footer>
  888. </div>
  889. <ol>
  890. <li id="comment-769" class="comment">
  891. <div class="avatar">
  892. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  893. </div>
  894. <div class="body">
  895. <header>
  896. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  897. <span class="flag author">author</span>
  898. </header>
  899. <p>Tom,</p>
  900. <p>The version 2.7.0 will suport fraction hint.<br>
  901. You can use the code from master to test it before the official release.</p>
  902. <footer>
  903. <a href="#comment-769" class="anchor" title="Link to this comment">#769</a>
  904. </footer>
  905. </div>
  906. </li>
  907. </ol>
  908. </li>
  909. <li id="comment-756" class="comment">
  910. <div class="avatar">
  911. <img alt="" src="http://www.gravatar.com/avatar/3150fd42a3442786a74afdae5c6a93d9?d=mm" title="anon">
  912. </div>
  913. <div class="body">
  914. <header>
  915. <a href="javascript:void(0);">anon</a>
  916. </header>
  917. <p>Wow, I'm impressed. This is very nice</p>
  918. <footer>
  919. <a href="#comment-756" class="anchor" title="Link to this comment">#756</a>
  920. </footer>
  921. </div>
  922. </li>
  923. <li id="comment-754" class="comment">
  924. <div class="avatar">
  925. <img alt="" src="http://www.gravatar.com/avatar/ae4944c7330826ba11eb7b3d099e8e8b?d=mm" title="Waleed">
  926. </div>
  927. <div class="body">
  928. <header>
  929. <a href="javascript:void(0);">Waleed</a>
  930. </header>
  931. <p>Hi,</p>
  932. <p>Is it possible to have a different image on hovering and different for a set rating. For example normally if i have a 3 star out of 5 star rating already set as the average user rating, so the 3 stars are yellow. What if while hovering over the stars i want to have orange stars showing your hover selection and when you select it say 4 star you set 4 stars yellow</p>
  933. <p>thanks</p>
  934. <footer>
  935. <a href="#comment-754" class="anchor" title="Link to this comment">#754</a>
  936. </footer>
  937. </div>
  938. <ol>
  939. <li id="comment-762" class="comment">
  940. <div class="avatar">
  941. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  942. </div>
  943. <div class="body">
  944. <header>
  945. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  946. <span class="flag author">author</span>
  947. </header>
  948. <p>Waleed,</p>
  949. <p>The <a href="#comment-752">same request</a> of Alex.<br>
  950. Please, open an issue.</p>
  951. <footer>
  952. <a href="#comment-762" class="anchor" title="Link to this comment">#762</a>
  953. </footer>
  954. </div>
  955. </li>
  956. </ol>
  957. </li>
  958. <li id="comment-752" class="comment">
  959. <div class="avatar">
  960. <img alt="" src="http://www.gravatar.com/avatar/3f7f9ad4799ea029e522954e34c8c107?d=mm" title="alex">
  961. </div>
  962. <div class="body">
  963. <header>
  964. <a href="javascript:void(0);">alex</a>
  965. </header>
  966. <p>Feature Request:</p>
  967. <p>It would be nice if there were 4 states with 4 images. Currently this is used only for ON or OFF, so you can show only what the user has voted for before or what they are voting for now. Many sites have a need to show the average vote across all users as well. In that case you would need 4 states (OFF, ON-USER, ON-COMMUNITY, ON-BOTH). That way you can show both how this particular user voted as well as the average community vote.</p>
  968. <footer>
  969. <a href="#comment-752" class="anchor" title="Link to this comment">#752</a>
  970. </footer>
  971. </div>
  972. <ol>
  973. <li id="comment-761" class="comment">
  974. <div class="avatar">
  975. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  976. </div>
  977. <div class="body">
  978. <header>
  979. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  980. <span class="flag author">author</span>
  981. </header>
  982. <p>alex,</p>
  983. <p>It is a lot more code and I don't know if is a good idea.<br>
  984. The plugins is big enough. But open an issue and lats watch the +1's.</p>
  985. <footer>
  986. <a href="#comment-761" class="anchor" title="Link to this comment">#761</a>
  987. </footer>
  988. </div>
  989. </li>
  990. </ol>
  991. </li>
  992. <li id="comment-751" class="comment">
  993. <div class="avatar">
  994. <img alt="" src="http://www.gravatar.com/avatar/dac5c46d3e520fc0109b91330e47d208?d=mm" title="Shawn">
  995. </div>
  996. <div class="body">
  997. <header>
  998. <a href="javascript:void(0);">Shawn</a>
  999. </header>
  1000. <p>Washington,</p>
  1001. <p>First, thank you for writing and sharing this. It has saved me a lot of time and works great! </p>
  1002. <p>Second, I do have one small issue with cancel. It seems to work great in non-IE browsers (figures). In IE, it clears the rating when I mouseover the cancel image but as soon as I move my mouse off of the cancel image, my rating is reset to the original. Any ideas?</p>
  1003. <p>Thanks again, <br>
  1004. Shawn</p>
  1005. <footer>
  1006. <a href="#comment-751" class="anchor" title="Link to this comment">#751</a>
  1007. </footer>
  1008. </div>
  1009. <ol>
  1010. <li id="comment-760" class="comment">
  1011. <div class="avatar">
  1012. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1013. </div>
  1014. <div class="body">
  1015. <header>
  1016. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1017. <span class="flag author">author</span>
  1018. </header>
  1019. <p>Shawn,</p>
  1020. <p>Could you open an issue?</p>
  1021. <footer>
  1022. <a href="#comment-760" class="anchor" title="Link to this comment">#760</a>
  1023. </footer>
  1024. </div>
  1025. </li>
  1026. </ol>
  1027. </li>
  1028. <li id="comment-749" class="comment">
  1029. <div class="avatar">
  1030. <img alt="" src="http://www.gravatar.com/avatar/4634c4710a9ee6f9002ce1d20228a9eb?d=mm" title="Elad">
  1031. </div>
  1032. <div class="body">
  1033. <header>
  1034. <a href="javascript:void(0);">Elad</a>
  1035. </header>
  1036. <p>Hi,</p>
  1037. <p>I am trying to change the to readonly onclick but it is not working.</p>
  1038. <p>Here is my code (my div's ID is starRating):</p>
  1039. <div class="highlight"><pre><span class="o">&lt;</span><span class="nx">script</span><span class="o">&gt;</span>
  1040. <span class="nx">$</span><span class="p">(</span><span class="s1">'#starRating'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  1041. <span class="nx">click</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">score</span><span class="p">,</span> <span class="nx">evt</span><span class="p">)</span> <span class="p">{</span>
  1042. <span class="nx">$</span><span class="p">(</span><span class="s1">'#starRating'</span><span class="p">).</span><span class="nx">raty</span><span class="p">(</span><span class="s1">'readOnly'</span><span class="p">,</span> <span class="kc">true</span><span class="p">);</span>
  1043. <span class="p">}</span>
  1044. <span class="p">});</span>
  1045. <span class="o">&lt;</span><span class="err">/script&gt;</span>
  1046. </pre></div>
  1047. <p>What am I doing wrong?</p>
  1048. <footer>
  1049. <a href="#comment-749" class="anchor" title="Link to this comment">#749</a>
  1050. </footer>
  1051. </div>
  1052. <ol>
  1053. <li id="comment-759" class="comment">
  1054. <div class="avatar">
  1055. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1056. </div>
  1057. <div class="body">
  1058. <header>
  1059. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1060. <span class="flag author">author</span>
  1061. </header>
  1062. <p>Elad,</p>
  1063. <p>I run you code and it works.</p>
  1064. <footer>
  1065. <a href="#comment-759" class="anchor" title="Link to this comment">#759</a>
  1066. </footer>
  1067. </div>
  1068. </li>
  1069. </ol>
  1070. </li>
  1071. <li id="comment-747" class="comment">
  1072. <div class="avatar">
  1073. <img alt="" src="http://www.gravatar.com/avatar/5915c9422895966a496a8aa6e63f7010?d=mm" title="Teo Dragovic">
  1074. </div>
  1075. <div class="body">
  1076. <header>
  1077. <a href="javascript:void(0);">Teo Dragovic</a>
  1078. </header>
  1079. <p>Hi,</p>
  1080. <p>is it possible to extend plugin so it outputs <code>&lt;span&gt;</code> element with starOn and starOff as classes? I'm thinking of using icon font instead of images.</p>
  1081. <p>Thanks.</p>
  1082. <footer>
  1083. <a href="#comment-747" class="anchor" title="Link to this comment">#747</a>
  1084. </footer>
  1085. </div>
  1086. <ol>
  1087. <li id="comment-757" class="comment">
  1088. <div class="avatar">
  1089. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1090. </div>
  1091. <div class="body">
  1092. <header>
  1093. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1094. <span class="flag author">author</span>
  1095. </header>
  1096. <p>Teo Dragovic,</p>
  1097. <p>Yes, use the version 2.6.0 with option <code>starType</code>.</p>
  1098. <footer>
  1099. <a href="#comment-757" class="anchor" title="Link to this comment">#757</a>
  1100. </footer>
  1101. </div>
  1102. </li>
  1103. </ol>
  1104. </li>
  1105. <li id="comment-721" class="comment">
  1106. <div class="avatar">
  1107. <img alt="" src="http://www.gravatar.com/avatar/a6054cbf21f02625367e3c88e1da0f8a?d=mm" title="Tatiana Perere">
  1108. </div>
  1109. <div class="body">
  1110. <header>
  1111. <a href="javascript:void(0);">Tatiana Perere</a>
  1112. </header>
  1113. <p>Hi!</p>
  1114. <p>I want only the star selected get marked. How can I do that?</p>
  1115. <p>Thank you!</p>
  1116. <footer>
  1117. <a href="#comment-721" class="anchor" title="Link to this comment">#721</a>
  1118. </footer>
  1119. </div>
  1120. <ol>
  1121. <li id="comment-744" class="comment">
  1122. <div class="avatar">
  1123. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1124. </div>
  1125. <div class="body">
  1126. <header>
  1127. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1128. <span class="flag author">author</span>
  1129. </header>
  1130. <p>Tatiana Perere,</p>
  1131. <p>Use the options <code>single</code>.</p>
  1132. <footer>
  1133. <a href="#comment-744" class="anchor" title="Link to this comment">#744</a>
  1134. </footer>
  1135. </div>
  1136. </li>
  1137. <li id="comment-722" class="comment">
  1138. <div class="avatar">
  1139. <img alt="" src="http://www.gravatar.com/avatar/a6054cbf21f02625367e3c88e1da0f8a?d=mm" title="Tatiana Perere">
  1140. </div>
  1141. <div class="body">
  1142. <header>
  1143. <a href="javascript:void(0);">Tatiana Perere</a>
  1144. </header>
  1145. <p>Did it changing the js lib.</p>
  1146. <p>I suggest to add this feature as an option. Very easy to do it.</p>
  1147. <p>Valeu!</p>
  1148. <footer>
  1149. <a href="#comment-722" class="anchor" title="Link to this comment">#722</a>
  1150. </footer>
  1151. </div>
  1152. <ol>
  1153. <li id="comment-745" class="comment">
  1154. <div class="avatar">
  1155. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1156. </div>
  1157. <div class="body">
  1158. <header>
  1159. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1160. <span class="flag author">author</span>
  1161. </header>
  1162. <p>Tatiana Perere,</p>
  1163. <p>Good job, but it is a option called <code>single</code>.<br>
  1164. But the next time a pull request is a polite thanks.</p>
  1165. <footer>
  1166. <a href="#comment-745" class="anchor" title="Link to this comment">#745</a>
  1167. </footer>
  1168. </div>
  1169. <ol>
  1170. <li id="comment-746" class="comment">
  1171. <div class="avatar">
  1172. <img alt="" src="http://www.gravatar.com/avatar/a6054cbf21f02625367e3c88e1da0f8a?d=mm" title="Tatiana Perere">
  1173. </div>
  1174. <div class="body">
  1175. <header>
  1176. <a href="javascript:void(0);">Tatiana Perere</a>
  1177. </header>
  1178. <p>Washington Botelho,</p>
  1179. <p>Hey man, I'm sorry.</p>
  1180. <p>I undo those changes and I use the single=true option now.</p>
  1181. <p>But the mouseOver behavior was bothering me, so I added the code on</p>
  1182. <div class="highlight"><pre><span class="nx">_bindOver</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span> <span class="o">:</span>
  1183. <span class="k">else</span> <span class="p">{</span>
  1184. <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">self</span><span class="p">.</span><span class="nx">opt</span><span class="p">.</span><span class="nx">single</span><span class="p">){</span>
  1185. <span class="nx">methods</span><span class="p">.</span><span class="nx">_fill</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">self</span><span class="p">,</span> <span class="nx">score</span><span class="p">);</span>
  1186. <span class="p">}</span>
  1187. <span class="p">}</span>
  1188. </pre></div>
  1189. <p>and to have the mark action onclick I added the same mouseOut bind to onClick bind:</p>
  1190. <div class="highlight"><pre><span class="k">if</span><span class="p">(</span><span class="nx">self</span><span class="p">.</span><span class="nx">opt</span><span class="p">.</span><span class="nx">single</span><span class="p">){</span>
  1191. <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">on</span><span class="p">(</span><span class="s1">'click.raty'</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">evt</span><span class="p">)</span> <span class="p">{</span>
  1192. <span class="kd">var</span> <span class="nx">score</span> <span class="o">=</span> <span class="nb">parseFloat</span><span class="p">(</span><span class="nx">self</span><span class="p">.</span><span class="nx">score</span><span class="p">.</span><span class="nx">val</span><span class="p">())</span> <span class="o">||</span> <span class="kc">undefined</span><span class="p">;</span>
  1193. <span class="nx">methods</span><span class="p">.</span><span class="nx">_apply</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">self</span><span class="p">,</span> <span class="nx">score</span><span class="p">);</span>
  1194. <span class="nx">methods</span><span class="p">.</span><span class="nx">_target</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">self</span><span class="p">,</span> <span class="nx">score</span><span class="p">,</span> <span class="nx">evt</span><span class="p">);</span>
  1195. <span class="k">if</span> <span class="p">(</span><span class="nx">self</span><span class="p">.</span><span class="nx">opt</span><span class="p">.</span><span class="nx">mouseout</span><span class="p">)</span> <span class="p">{</span>
  1196. <span class="nx">self</span><span class="p">.</span><span class="nx">opt</span><span class="p">.</span><span class="nx">mouseout</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">self</span><span class="p">,</span> <span class="nx">score</span><span class="p">,</span> <span class="nx">evt</span><span class="p">);</span>
  1197. <span class="p">}</span>
  1198. <span class="p">});</span>
  1199. <span class="p">}</span>
  1200. </pre></div>
  1201. <p>Now I have a very different behavior when using SINGLE.</p>
  1202. <p>Cheers!</p>
  1203. <footer>
  1204. <a href="#comment-746" class="anchor" title="Link to this comment">#746</a>
  1205. </footer>
  1206. </div>
  1207. </li>
  1208. </ol>
  1209. </li>
  1210. </ol>
  1211. </li>
  1212. </ol>
  1213. </li>
  1214. <li id="comment-719" class="comment">
  1215. <div class="avatar">
  1216. <img alt="" src="http://www.gravatar.com/avatar/728d40265575c53e45fa0778c47ecbbb?d=mm" title="Hussaim">
  1217. </div>
  1218. <div class="body">
  1219. <header>
  1220. <a href="javascript:void(0);">Hussaim</a>
  1221. </header>
  1222. <p>Can i change name of <code>&lt;input type="hidden"&gt;</code>?<br>
  1223. i want to assign parent div name to hidden element name</p>
  1224. <div class="highlight"><pre><span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">'star'</span> <span class="na">name=</span><span class="s">n</span><span class="nt">&gt;</span>
  1225. ..
  1226. ..
  1227. ..
  1228. <span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">'hidden'</span> <span class="na">name=</span><span class="s">parentName</span><span class="nt">&gt;</span>
  1229. <span class="nt">&lt;div/&gt;</span>
  1230. </pre></div>
  1231. <footer>
  1232. <a href="#comment-719" class="anchor" title="Link to this comment">#719</a>
  1233. </footer>
  1234. </div>
  1235. <ol>
  1236. <li id="comment-743" class="comment">
  1237. <div class="avatar">
  1238. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1239. </div>
  1240. <div class="body">
  1241. <header>
  1242. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1243. <span class="flag author">author</span>
  1244. </header>
  1245. <p>Hussaim,</p>
  1246. <p>Yes, use the option <code>scoreName</code>.</p>
  1247. <footer>
  1248. <a href="#comment-743" class="anchor" title="Link to this comment">#743</a>
  1249. </footer>
  1250. </div>
  1251. </li>
  1252. </ol>
  1253. </li>
  1254. <li id="comment-718" class="comment">
  1255. <div class="avatar">
  1256. <img alt="" src="http://www.gravatar.com/avatar/2eb9f371561aaba13ed4ded358e6a136?d=mm" title="florin">
  1257. </div>
  1258. <div class="body">
  1259. <header>
  1260. <a href="javascript:void(0);">florin</a>
  1261. </header>
  1262. <p>Same question as Jing bellow :)</p>
  1263. <footer>
  1264. <a href="#comment-718" class="anchor" title="Link to this comment">#718</a>
  1265. </footer>
  1266. </div>
  1267. <ol>
  1268. <li id="comment-742" class="comment">
  1269. <div class="avatar">
  1270. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1271. </div>
  1272. <div class="body">
  1273. <header>
  1274. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1275. <span class="flag author">author</span>
  1276. </header>
  1277. <p>florin,</p>
  1278. <p>Same answer! :)</p>
  1279. <footer>
  1280. <a href="#comment-742" class="anchor" title="Link to this comment">#742</a>
  1281. </footer>
  1282. </div>
  1283. </li>
  1284. </ol>
  1285. </li>
  1286. <li id="comment-717" class="comment">
  1287. <div class="avatar">
  1288. <img alt="" src="http://www.gravatar.com/avatar/618067e2cb0e4bf960fa14b98aaf584f?d=mm" title="Jing">
  1289. </div>
  1290. <div class="body">
  1291. <header>
  1292. <a href="javascript:void(0);">Jing</a>
  1293. </header>
  1294. <p>Hi!<br>
  1295. I hope after clicking the star become read-only.<br>
  1296. How should do?<br>
  1297. Thanks in advance!</p>
  1298. <footer>
  1299. <a href="#comment-717" class="anchor" title="Link to this comment">#717</a>
  1300. </footer>
  1301. </div>
  1302. <ol>
  1303. <li id="comment-741" class="comment">
  1304. <div class="avatar">
  1305. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1306. </div>
  1307. <div class="body">
  1308. <header>
  1309. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1310. <span class="flag author">author</span>
  1311. </header>
  1312. <p>Jing,</p>
  1313. <p>Inside <code>click</code> callback, calls the <code>readOnly</code> function.</p>
  1314. <footer>
  1315. <a href="#comment-741" class="anchor" title="Link to this comment">#741</a>
  1316. </footer>
  1317. </div>
  1318. </li>
  1319. </ol>
  1320. </li>
  1321. <li id="comment-715" class="comment">
  1322. <div class="avatar">
  1323. <img alt="" src="http://www.gravatar.com/avatar/a0ea23054a1e071bc746b7fa0b8d4c04?d=mm" title="Joey">
  1324. </div>
  1325. <div class="body">
  1326. <header>
  1327. <a href="javascript:void(0);">Joey</a>
  1328. </header>
  1329. <p>First, thanks for the plugin!</p>
  1330. <p>I deployed the plugin, but was having trouble with the validation of the rating. I wanted to use my own element to house the score. I used the scoreName &amp; targetScore, but the plugin always creates an element with the same name as the one I created. Is there a way to tell the plugin to no generate an element?</p>
  1331. <p>Thanks!</p>
  1332. <footer>
  1333. <a href="#comment-715" class="anchor" title="Link to this comment">#715</a>
  1334. </footer>
  1335. </div>
  1336. <ol>
  1337. <li id="comment-740" class="comment">
  1338. <div class="avatar">
  1339. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1340. </div>
  1341. <div class="body">
  1342. <header>
  1343. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1344. <span class="flag author">author</span>
  1345. </header>
  1346. <p>Joey,</p>
  1347. <p>The score element is create only if you don't provide a valid (existent) target score: <a href="https://github.com/wbotelhos/blob/master/../lib/jquery.raty.js#L215">https://github.com/wbotelhos/blob/master/../lib/jquery.raty.js#L215</a></p>
  1348. <footer>
  1349. <a href="#comment-740" class="anchor" title="Link to this comment">#740</a>
  1350. </footer>
  1351. </div>
  1352. </li>
  1353. </ol>
  1354. </li>
  1355. <li id="comment-714" class="comment">
  1356. <div class="avatar">
  1357. <img alt="" src="http://www.gravatar.com/avatar/f5c79c7fc5770a01431171929fa11e6c?d=mm" title="cesar">
  1358. </div>
  1359. <div class="body">
  1360. <header>
  1361. <a href="javascript:void(0);">cesar</a>
  1362. </header>
  1363. <p>when i write the html code with jquery, a click function doesn't work</p>
  1364. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s2">"#div1"</span><span class="p">).</span><span class="nx">html</span><span class="p">(</span><span class="s2">"&lt;div id='star' data-score='1'&gt;&lt;/div&gt;"</span><span class="p">);</span>
  1365. </pre></div>
  1366. <p>help me please and excusa me, a dont speak english :D</p>
  1367. <footer>
  1368. <a href="#comment-714" class="anchor" title="Link to this comment">#714</a>
  1369. </footer>
  1370. </div>
  1371. <ol>
  1372. <li id="comment-739" class="comment">
  1373. <div class="avatar">
  1374. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1375. </div>
  1376. <div class="body">
  1377. <header>
  1378. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1379. <span class="flag author">author</span>
  1380. </header>
  1381. <p>cesar,</p>
  1382. <p>It should be work, since you bind the Raty after the HTML is on body.<br>
  1383. Try:</p>
  1384. <div class="highlight"><pre><span class="kd">var</span> <span class="nx">star</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="s1">'&lt;div id="star" data-score="1"&gt;&lt;/div&gt;'</span><span class="p">).</span><span class="nx">appendTo</span><span class="p">(</span><span class="s1">'#div1'</span><span class="p">);</span>
  1385. <span class="nx">star</span><span class="p">.</span><span class="nx">raty</span><span class="p">();</span>
  1386. </pre></div>
  1387. <footer>
  1388. <a href="#comment-739" class="anchor" title="Link to this comment">#739</a>
  1389. </footer>
  1390. </div>
  1391. </li>
  1392. </ol>
  1393. </li>
  1394. <li id="comment-713" class="comment">
  1395. <div class="avatar">
  1396. <img alt="" src="http://www.gravatar.com/avatar/8a7eb9231635fc348203a6a5e398fef5?d=mm" title="rent-aroom">
  1397. </div>
  1398. <div class="body">
  1399. <header>
  1400. <a href="http://www.rent-aroom.com/rate-our-service" target="_blank">rent-aroom</a>
  1401. </header>
  1402. <p>Thank you for the script. Looking great :-)</p>
  1403. <p><a href="http://www.rent-aroom.com/rate-our-service">http://www.rent-aroom.com/rate-our-service</a></p>
  1404. <footer>
  1405. <a href="#comment-713" class="anchor" title="Link to this comment">#713</a>
  1406. </footer>
  1407. </div>
  1408. <ol>
  1409. <li id="comment-738" class="comment">
  1410. <div class="avatar">
  1411. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1412. </div>
  1413. <div class="body">
  1414. <header>
  1415. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1416. <span class="flag author">author</span>
  1417. </header>
  1418. <p>rent-aroom,</p>
  1419. <p>Good to hear that.<br>
  1420. Great job and thanks! (:</p>
  1421. <footer>
  1422. <a href="#comment-738" class="anchor" title="Link to this comment">#738</a>
  1423. </footer>
  1424. </div>
  1425. </li>
  1426. </ol>
  1427. </li>
  1428. <li id="comment-710" class="comment">
  1429. <div class="avatar">
  1430. <img alt="" src="http://www.gravatar.com/avatar/daa3ff6d45f9e36144996cef997b52a5?d=mm" title="John Paul">
  1431. </div>
  1432. <div class="body">
  1433. <header>
  1434. <a href="javascript:void(0);">John Paul</a>
  1435. </header>
  1436. <p>Is there any way to stop the user from submitting another rating after they have already sent one? I am recording these to database and want it to be a one time thing per user. Could I set it to read only after my POST?</p>
  1437. <footer>
  1438. <a href="#comment-710" class="anchor" title="Link to this comment">#710</a>
  1439. </footer>
  1440. </div>
  1441. <ol>
  1442. <li id="comment-737" class="comment">
  1443. <div class="avatar">
  1444. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1445. </div>
  1446. <div class="body">
  1447. <header>
  1448. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1449. <span class="flag author">author</span>
  1450. </header>
  1451. <p>John Paul,</p>
  1452. <p>You can, but it is just JS, Raty can't do it for you.<br>
  1453. You can set it to read-only the time you want, but the time and how you want to do this, is up to you.</p>
  1454. <footer>
  1455. <a href="#comment-737" class="anchor" title="Link to this comment">#737</a>
  1456. </footer>
  1457. </div>
  1458. </li>
  1459. </ol>
  1460. </li>
  1461. <li id="comment-706" class="comment">
  1462. <div class="avatar">
  1463. <img alt="" src="http://www.gravatar.com/avatar/ba7b758a7f5ffafb168fce7e02a5420a?d=mm" title="José Leite">
  1464. </div>
  1465. <div class="body">
  1466. <header>
  1467. <a href="javascript:void(0);">José Leite</a>
  1468. </header>
  1469. <p>Washington Botelho,</p>
  1470. <p>I wrote the following code:</p>
  1471. <div class="highlight"><pre><span class="p">{{</span><span class="k">if</span> <span class="nx">comments</span><span class="o">:</span><span class="p">}}</span>
  1472. <span class="p">{{</span><span class="k">for</span> <span class="nx">idx</span><span class="p">,</span> <span class="nx">comment</span> <span class="k">in</span> <span class="nx">enumerate</span><span class="p">(</span><span class="nx">comments</span><span class="p">)</span><span class="o">:</span><span class="p">}}</span>
  1473. <span class="o">&lt;</span><span class="nx">div</span> <span class="kr">class</span><span class="o">=</span><span class="s2">"badge badge-warning"</span> <span class="nx">id</span><span class="o">=</span><span class="s2">"star{{idx}}"</span><span class="o">&gt;</span><span class="p">{{</span><span class="o">=</span><span class="nx">comment</span><span class="p">.</span><span class="nx">rating</span><span class="p">}}</span><span class="o">&lt;</span><span class="err">/div&gt;</span>
  1474. <span class="o">&lt;</span><span class="nx">script</span><span class="o">&gt;</span>
  1475. <span class="nx">$</span><span class="p">(</span><span class="s1">'#star{{idx}}'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  1476. <span class="nx">numberMax</span> <span class="o">:</span> <span class="mi">10</span><span class="p">,</span>
  1477. <span class="nx">readOnly</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  1478. <span class="nx">score</span><span class="o">:</span> <span class="p">{{</span><span class="o">=</span><span class="nx">comment</span><span class="p">.</span><span class="nx">rating</span><span class="p">}}</span>
  1479. <span class="p">});</span>
  1480. <span class="o">&lt;</span><span class="err">/script&gt;</span>
  1481. <span class="p">{{</span><span class="nx">pass</span><span class="p">}}</span>
  1482. <span class="p">{{</span><span class="nx">pass</span><span class="p">}}</span>
  1483. </pre></div>
  1484. <footer>
  1485. <a href="#comment-706" class="anchor" title="Link to this comment">#706</a>
  1486. </footer>
  1487. </div>
  1488. <ol>
  1489. <li id="comment-730" class="comment">
  1490. <div class="avatar">
  1491. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1492. </div>
  1493. <div class="body">
  1494. <header>
  1495. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1496. <span class="flag author">author</span>
  1497. </header>
  1498. <p>José Leite,</p>
  1499. <p>Build your HTML elements first, then after apply Raty using class and getting the rating from data attribute, like so:</p>
  1500. <div class="highlight"><pre><span class="nt">&lt;div</span> <span class="na">data-rating=</span><span class="s">"{{= comment.rating}}"</span> <span class="na">class=</span><span class="s">"badge badge-warning"</span><span class="nt">&gt;</span>{{= comment.rating}}<span class="nt">&lt;/div&gt;</span>
  1501. </pre></div>
  1502. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'.badge'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  1503. <span class="nx">score</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
  1504. <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">getAttribute</span><span class="p">(</span><span class="s1">'data-rating'</span><span class="p">);</span>
  1505. <span class="p">}</span>
  1506. <span class="p">});</span>
  1507. </pre></div>
  1508. <footer>
  1509. <a href="#comment-730" class="anchor" title="Link to this comment">#730</a>
  1510. </footer>
  1511. </div>
  1512. </li>
  1513. </ol>
  1514. </li>
  1515. <li id="comment-704" class="comment">
  1516. <div class="avatar">
  1517. <img alt="" src="http://www.gravatar.com/avatar/762d76f623aa73837652480d20126008?d=mm" title="Swagata">
  1518. </div>
  1519. <div class="body">
  1520. <header>
  1521. <a href="javascript:void(0);">Swagata</a>
  1522. </header>
  1523. <p>I tried the mouse over but it did not work. on mouse over call back , I was setting the score in a hidden variable , to get it's value on form post.</p>
  1524. <footer>
  1525. <a href="#comment-704" class="anchor" title="Link to this comment">#704</a>
  1526. </footer>
  1527. </div>
  1528. <ol>
  1529. <li id="comment-736" class="comment">
  1530. <div class="avatar">
  1531. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1532. </div>
  1533. <div class="body">
  1534. <header>
  1535. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1536. <span class="flag author">author</span>
  1537. </header>
  1538. <p>Swagata,</p>
  1539. <p>Raty already has a hidden field called <code>score</code> by default the you can change.<br>
  1540. Your you can use the new option <code>scoreTarget</code> and decide to where send the score.<br>
  1541. Your you can use your ideia and copy the score for wherever you want.</p>
  1542. <footer>
  1543. <a href="#comment-736" class="anchor" title="Link to this comment">#736</a>
  1544. </footer>
  1545. </div>
  1546. </li>
  1547. </ol>
  1548. </li>
  1549. <li id="comment-701" class="comment">
  1550. <div class="avatar">
  1551. <img alt="" src="http://www.gravatar.com/avatar/9906126bc5f8e48554f27b3002c0cadd?d=mm" title="Marc Stein">
  1552. </div>
  1553. <div class="body">
  1554. <header>
  1555. <a href="http://recippia.herokuapp.com/test.html" target="_blank">Marc Stein</a>
  1556. </header>
  1557. <p>Hi Washington,</p>
  1558. <p>I'm having a styling issue with Raty that I've been unable to solve.</p>
  1559. <p>If you take a look at <a href="http://recippia.herokuapp.com/test.html">http://recippia.herokuapp.com/test.html</a> you can see that the stars stack vertically rather than displaying inline. I'v tried overriding the img tag formatting in style.css but this doesn't seem to do the trick. Any thoughts as to how to resolve this?</p>
  1560. <p>Many thanks in advance,</p>
  1561. <p>Marc</p>
  1562. <p>Great plugin, BTW!</p>
  1563. <footer>
  1564. <a href="#comment-701" class="anchor" title="Link to this comment">#701</a>
  1565. </footer>
  1566. </div>
  1567. <ol>
  1568. <li id="comment-735" class="comment">
  1569. <div class="avatar">
  1570. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1571. </div>
  1572. <div class="body">
  1573. <header>
  1574. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1575. <span class="flag author">author</span>
  1576. </header>
  1577. <p>Marc Stein,</p>
  1578. <p>I could not to see the problem.<br>
  1579. But you can set <code>space: off</code> to avoid empty space and then manipulate the images.</p>
  1580. <footer>
  1581. <a href="#comment-735" class="anchor" title="Link to this comment">#735</a>
  1582. </footer>
  1583. </div>
  1584. </li>
  1585. </ol>
  1586. </li>
  1587. <li id="comment-696" class="comment">
  1588. <div class="avatar">
  1589. <img alt="" src="http://www.gravatar.com/avatar/7ea8556715a4d33e151bcf1437cc2568?d=mm" title="Surjit Sidhu">
  1590. </div>
  1591. <div class="body">
  1592. <header>
  1593. <a href="http://surjitsidhu.com" target="_blank">Surjit Sidhu</a>
  1594. </header>
  1595. <p>I want to display "based on x reviews" after stars. how can do this ?<br>
  1596. i tried to modify js function, but does not find exact line to change</p>
  1597. <footer>
  1598. <a href="#comment-696" class="anchor" title="Link to this comment">#696</a>
  1599. </footer>
  1600. </div>
  1601. <ol>
  1602. <li id="comment-734" class="comment">
  1603. <div class="avatar">
  1604. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1605. </div>
  1606. <div class="body">
  1607. <header>
  1608. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1609. <span class="flag author">author</span>
  1610. </header>
  1611. <p>Surjit Sidhu,</p>
  1612. <p>You need to use the <a href="#target-div">target</a> options.<br>
  1613. But if you want to display the number of reviews, you should keep it on database and display it for your own.</p>
  1614. <footer>
  1615. <a href="#comment-734" class="anchor" title="Link to this comment">#734</a>
  1616. </footer>
  1617. </div>
  1618. </li>
  1619. </ol>
  1620. </li>
  1621. <li id="comment-694" class="comment">
  1622. <div class="avatar">
  1623. <img alt="" src="http://www.gravatar.com/avatar/c2a125bf6a22088c271ae68a2029f147?d=mm" title="sudarshan">
  1624. </div>
  1625. <div class="body">
  1626. <header>
  1627. <a href="javascript:void(0);">sudarshan</a>
  1628. </header>
  1629. <p>Hello sir, nice work.<br>
  1630. I have one doubt I am not getting img of stars when I used it in Codeigniter project. Can you tell me where can I provide Base url for img folder??<br>
  1631. Thanks.</p>
  1632. <footer>
  1633. <a href="#comment-694" class="anchor" title="Link to this comment">#694</a>
  1634. </footer>
  1635. </div>
  1636. <ol>
  1637. <li id="comment-726" class="comment">
  1638. <div class="avatar">
  1639. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1640. </div>
  1641. <div class="body">
  1642. <header>
  1643. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1644. <span class="flag author">author</span>
  1645. </header>
  1646. <p>sudarshan,</p>
  1647. <p>The base URL is up to you and your framework.<br>
  1648. Raty can't provide it for you, sorry.</p>
  1649. <footer>
  1650. <a href="#comment-726" class="anchor" title="Link to this comment">#726</a>
  1651. </footer>
  1652. </div>
  1653. </li>
  1654. <li id="comment-695" class="comment">
  1655. <div class="avatar">
  1656. <img alt="" src="http://www.gravatar.com/avatar/08cdeee40a7c2a05cd09f10e6d18f7e0?d=mm" title="Vlad">
  1657. </div>
  1658. <div class="body">
  1659. <header>
  1660. <a href="javascript:void(0);">Vlad</a>
  1661. </header>
  1662. <p>sudarshan, </p>
  1663. <p>Had the same issue, </p>
  1664. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  1665. <span class="nx">path</span><span class="o">:</span> <span class="s1">'img/'</span><span class="p">,</span>
  1666. <span class="p">});</span>
  1667. </pre></div>
  1668. <p>if that doesnt work try,</p>
  1669. <div class="highlight"><pre><span class="nx">jQuery</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">$</span><span class="p">)</span> <span class="p">{</span>
  1670. <span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  1671. <span class="nx">path</span><span class="o">:</span> <span class="s1">'img/'</span><span class="p">,</span>
  1672. <span class="p">});</span>
  1673. <span class="p">});</span>
  1674. </pre></div>
  1675. <footer>
  1676. <a href="#comment-695" class="anchor" title="Link to this comment">#695</a>
  1677. </footer>
  1678. </div>
  1679. <ol>
  1680. <li id="comment-727" class="comment">
  1681. <div class="avatar">
  1682. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1683. </div>
  1684. <div class="body">
  1685. <header>
  1686. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1687. <span class="flag author">author</span>
  1688. </header>
  1689. <p>Vlad,</p>
  1690. <p>It could work, but the case is not the whole Raty, just the images.</p>
  1691. <footer>
  1692. <a href="#comment-727" class="anchor" title="Link to this comment">#727</a>
  1693. </footer>
  1694. </div>
  1695. </li>
  1696. <li id="comment-703" class="comment">
  1697. <div class="avatar">
  1698. <img alt="" src="http://www.gravatar.com/avatar/9041010388ef45fd147e202b733f616e?d=mm" title="Malek">
  1699. </div>
  1700. <div class="body">
  1701. <header>
  1702. <a href="http://sweettutos.wordpress.com" target="_blank">Malek</a>
  1703. </header>
  1704. <p>the slash is added programmatically I noticed.<br>
  1705. So just 'img' and the stars assets should be loaded correctly. Vlad,</p>
  1706. <footer>
  1707. <a href="#comment-703" class="anchor" title="Link to this comment">#703</a>
  1708. </footer>
  1709. </div>
  1710. <ol>
  1711. <li id="comment-728" class="comment">
  1712. <div class="avatar">
  1713. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1714. </div>
  1715. <div class="body">
  1716. <header>
  1717. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1718. <span class="flag author">author</span>
  1719. </header>
  1720. <p>Malek,</p>
  1721. <p>It was fixed on version 2.5.1: "The path always was prepend avoiding absolute or different path for each icon."</p>
  1722. <footer>
  1723. <a href="#comment-728" class="anchor" title="Link to this comment">#728</a>
  1724. </footer>
  1725. </div>
  1726. </li>
  1727. </ol>
  1728. </li>
  1729. </ol>
  1730. </li>
  1731. </ol>
  1732. </li>
  1733. <li id="comment-692" class="comment">
  1734. <div class="avatar">
  1735. <img alt="" src="http://www.gravatar.com/avatar/24c63b5f5e5be52f7934a5fa10535221?d=mm" title="Cabel">
  1736. </div>
  1737. <div class="body">
  1738. <header>
  1739. <a href="javascript:void(0);">Cabel</a>
  1740. </header>
  1741. <p>Any easy way to make the stars smaller? Other than that, what a great plugin, keep up the great work. </p>
  1742. <div class="highlight"><pre><span class="nx">$</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">defaults</span><span class="p">.</span><span class="nx">path</span> <span class="o">=</span> <span class="s1">'/images'</span><span class="p">;</span>
  1743. <span class="nx">$</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
  1744. <span class="nx">$</span><span class="p">(</span><span class="s1">'#default'</span><span class="p">).</span><span class="nx">raty</span><span class="p">();</span>
  1745. <span class="nx">$</span><span class="p">(</span><span class="s1">'.stars'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span> <span class="nx">readOnly</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> <span class="nx">score</span><span class="o">:</span> <span class="mi">1</span><span class="p">,</span> <span class="nx">size</span><span class="o">:</span> <span class="mi">12</span> <span class="p">});</span>
  1746. <span class="p">});</span>
  1747. </pre></div>
  1748. <footer>
  1749. <a href="#comment-692" class="anchor" title="Link to this comment">#692</a>
  1750. </footer>
  1751. </div>
  1752. <ol>
  1753. <li id="comment-729" class="comment">
  1754. <div class="avatar">
  1755. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1756. </div>
  1757. <div class="body">
  1758. <header>
  1759. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1760. <span class="flag author">author</span>
  1761. </header>
  1762. <p>Cabel,</p>
  1763. <p>You can set a default size for all intances.<br>
  1764. But the only way is set the <code>size</code> to be possible calculate the right width.</p>
  1765. <footer>
  1766. <a href="#comment-729" class="anchor" title="Link to this comment">#729</a>
  1767. </footer>
  1768. </div>
  1769. </li>
  1770. </ol>
  1771. </li>
  1772. <li id="comment-691" class="comment">
  1773. <div class="avatar">
  1774. <img alt="" src="http://www.gravatar.com/avatar/0788403895239b40d68eb9c9f43cf00c?d=mm" title="ISEE">
  1775. </div>
  1776. <div class="body">
  1777. <header>
  1778. <a href="javascript:void(0);">ISEE</a>
  1779. </header>
  1780. <p>Hi.<br>
  1781. Now, we can get the score from the callbcak function when the raty was initialized, suck as:</p>
  1782. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'div'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  1783. <span class="nx">click</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">score</span><span class="p">,</span> <span class="nx">evt</span><span class="p">)</span> <span class="p">{</span>
  1784. <span class="nx">alert</span><span class="p">(</span><span class="s1">'score: '</span> <span class="o">+</span> <span class="nx">score</span><span class="p">);</span>
  1785. <span class="p">}</span>
  1786. <span class="p">});</span>
  1787. </pre></div>
  1788. <p>but can we get the score in the other function?</p>
  1789. <footer>
  1790. <a href="#comment-691" class="anchor" title="Link to this comment">#691</a>
  1791. </footer>
  1792. </div>
  1793. <ol>
  1794. <li id="comment-725" class="comment">
  1795. <div class="avatar">
  1796. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1797. </div>
  1798. <div class="body">
  1799. <header>
  1800. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1801. <span class="flag author">author</span>
  1802. </header>
  1803. <p>ISEE,</p>
  1804. <p>Get the score when it is initialized is on <code>score</code> option via <code>function() { return 1; }</code>, not on <code>click</code>.<br>
  1805. On <code>click</code> you get the score choosed, like on <code>mouseover</code>and <code>mouseout</code></p>
  1806. <footer>
  1807. <a href="#comment-725" class="anchor" title="Link to this comment">#725</a>
  1808. </footer>
  1809. </div>
  1810. </li>
  1811. </ol>
  1812. </li>
  1813. <li id="comment-690" class="comment">
  1814. <div class="avatar">
  1815. <img alt="" src="http://www.gravatar.com/avatar/b6367e697ad8fa8010315bb21e49fe6a?d=mm" title="Darren Teng">
  1816. </div>
  1817. <div class="body">
  1818. <header>
  1819. <a href="javascript:void(0);">Darren Teng</a>
  1820. </header>
  1821. <p>Hi Washington, can I set my own title for each star, such as <code>'good' =&gt; 'Strongly agree'</code>, <code>'bad' =&gt; 'Strongly disagree'</code>?</p>
  1822. <p>Thanks for your great work!</p>
  1823. <footer>
  1824. <a href="#comment-690" class="anchor" title="Link to this comment">#690</a>
  1825. </footer>
  1826. </div>
  1827. <ol>
  1828. <li id="comment-723" class="comment">
  1829. <div class="avatar">
  1830. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1831. </div>
  1832. <div class="body">
  1833. <header>
  1834. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1835. <span class="flag author">author</span>
  1836. </header>
  1837. <p>Darren Teng,</p>
  1838. <p>Yes, you have the options <code>hints</code> to do that.</p>
  1839. <footer>
  1840. <a href="#comment-723" class="anchor" title="Link to this comment">#723</a>
  1841. </footer>
  1842. </div>
  1843. </li>
  1844. <li id="comment-712" class="comment">
  1845. <div class="avatar">
  1846. <img alt="" src="http://www.gravatar.com/avatar/26a67c4df92e642a577e88784285f2c1?d=mm" title="Jirka Kyncl">
  1847. </div>
  1848. <div class="body">
  1849. <header>
  1850. <a href="javascript:void(0);">Jirka Kyncl</a>
  1851. </header>
  1852. <p>I found it now :)<br>
  1853. you can set parameter hints.</p>
  1854. <p>Ex:</p>
  1855. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  1856. <span class="nx">number</span><span class="o">:</span> <span class="mi">5</span><span class="p">,</span>
  1857. <span class="nx">score</span><span class="o">:</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">data</span><span class="p">(</span><span class="s1">'rate'</span><span class="p">),</span>
  1858. <span class="nx">path</span><span class="o">:</span> <span class="s1">'js/img'</span><span class="p">,</span>
  1859. <span class="nx">readOnly</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span>
  1860. <span class="nx">noRatedMsg</span> <span class="o">:</span> <span class="s2">"Very very bad woman!"</span><span class="p">,</span>
  1861. <span class="nx">hints</span><span class="o">:</span> <span class="p">[</span><span class="s2">"somthing"</span><span class="p">,</span> <span class="s2">"bless"</span><span class="p">,</span> <span class="s2">"Monitor"</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="s2">"evaluation"</span><span class="p">]</span>
  1862. <span class="p">});</span>
  1863. </pre></div>
  1864. <footer>
  1865. <a href="#comment-712" class="anchor" title="Link to this comment">#712</a>
  1866. </footer>
  1867. </div>
  1868. </li>
  1869. <li id="comment-711" class="comment">
  1870. <div class="avatar">
  1871. <img alt="" src="http://www.gravatar.com/avatar/26a67c4df92e642a577e88784285f2c1?d=mm" title="Jirka Kyncl">
  1872. </div>
  1873. <div class="body">
  1874. <header>
  1875. <a href="javascript:void(0);">Jirka Kyncl</a>
  1876. </header>
  1877. <p>Hi, you can change it in source code. In hints array. I didn't found better solution.</p>
  1878. <footer>
  1879. <a href="#comment-711" class="anchor" title="Link to this comment">#711</a>
  1880. </footer>
  1881. </div>
  1882. <ol>
  1883. <li id="comment-724" class="comment">
  1884. <div class="avatar">
  1885. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1886. </div>
  1887. <div class="body">
  1888. <header>
  1889. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1890. <span class="flag author">author</span>
  1891. </header>
  1892. <p>Jirka Kyncl,</p>
  1893. <p>The better solution is just override the parameter <code>hints</code>.</p>
  1894. <footer>
  1895. <a href="#comment-724" class="anchor" title="Link to this comment">#724</a>
  1896. </footer>
  1897. </div>
  1898. </li>
  1899. </ol>
  1900. </li>
  1901. </ol>
  1902. </li>
  1903. <li id="comment-687" class="comment">
  1904. <div class="avatar">
  1905. <img alt="" src="http://www.gravatar.com/avatar/c44a4af00544c70a6841006998c6b795?d=mm" title="Guilherme Duailibe">
  1906. </div>
  1907. <div class="body">
  1908. <header>
  1909. <a href="javascript:void(0);">Guilherme Duailibe</a>
  1910. </header>
  1911. <p>Excelente plugin! Estou usando. Obrigado!</p>
  1912. <footer>
  1913. <a href="#comment-687" class="anchor" title="Link to this comment">#687</a>
  1914. </footer>
  1915. </div>
  1916. <ol>
  1917. <li id="comment-689" class="comment">
  1918. <div class="avatar">
  1919. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1920. </div>
  1921. <div class="body">
  1922. <header>
  1923. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1924. <span class="flag author">author</span>
  1925. </header>
  1926. <p>Guilherme Duailibe,</p>
  1927. <p>Thank you! (:</p>
  1928. <footer>
  1929. <a href="#comment-689" class="anchor" title="Link to this comment">#689</a>
  1930. </footer>
  1931. </div>
  1932. </li>
  1933. </ol>
  1934. </li>
  1935. <li id="comment-686" class="comment">
  1936. <div class="avatar">
  1937. <img alt="" src="http://www.gravatar.com/avatar/c8c6efe450847ee184720928b6e69654?d=mm" title="Daniel Better">
  1938. </div>
  1939. <div class="body">
  1940. <header>
  1941. <a href="javascript:void(0);">Daniel Better</a>
  1942. </header>
  1943. <p>Hi Washington, first of all, great plugin, gj!<br>
  1944. Secondly, is there a way to enlarge the stars even more then 24px as seen here? </p>
  1945. <p>Regards, Daniel.</p>
  1946. <footer>
  1947. <a href="#comment-686" class="anchor" title="Link to this comment">#686</a>
  1948. </footer>
  1949. </div>
  1950. <ol>
  1951. <li id="comment-688" class="comment">
  1952. <div class="avatar">
  1953. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1954. </div>
  1955. <div class="body">
  1956. <header>
  1957. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1958. <span class="flag author">author</span>
  1959. </header>
  1960. <p>Daniel Better,</p>
  1961. <p>Yes, just use your new icon and set the value of it as px on <code>size</code> property.</p>
  1962. <footer>
  1963. <a href="#comment-688" class="anchor" title="Link to this comment">#688</a>
  1964. </footer>
  1965. </div>
  1966. </li>
  1967. </ol>
  1968. </li>
  1969. <li id="comment-679" class="comment">
  1970. <div class="avatar">
  1971. <img alt="" src="http://www.gravatar.com/avatar/4653dd9471188ec0936b4e8013ad8fc4?d=mm" title="Nishit">
  1972. </div>
  1973. <div class="body">
  1974. <header>
  1975. <a href="javascript:void(0);">Nishit</a>
  1976. </header>
  1977. <p>Hi Washington,</p>
  1978. <p>I would like to thank you for this plugin. It works flawlessly. Great work.</p>
  1979. <p>Regards.</p>
  1980. <footer>
  1981. <a href="#comment-679" class="anchor" title="Link to this comment">#679</a>
  1982. </footer>
  1983. </div>
  1984. <ol>
  1985. <li id="comment-680" class="comment">
  1986. <div class="avatar">
  1987. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  1988. </div>
  1989. <div class="body">
  1990. <header>
  1991. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  1992. <span class="flag author">author</span>
  1993. </header>
  1994. <p>Nishit,</p>
  1995. <p>Thanks man! (:</p>
  1996. <footer>
  1997. <a href="#comment-680" class="anchor" title="Link to this comment">#680</a>
  1998. </footer>
  1999. </div>
  2000. </li>
  2001. </ol>
  2002. </li>
  2003. <li id="comment-676" class="comment">
  2004. <div class="avatar">
  2005. <img alt="" src="http://www.gravatar.com/avatar/1fca03d51d167c31f2079aae85becf90?d=mm" title="Brian">
  2006. </div>
  2007. <div class="body">
  2008. <header>
  2009. <a href="javascript:void(0);">Brian</a>
  2010. </header>
  2011. <p>I have a need for multiple ratings on a page. For example, individual ratings for things such as "Price," "Value" and "Quality." Is there a way to specify scoreName for each instance of a rating? Excellent plugin, btw.</p>
  2012. <footer>
  2013. <a href="#comment-676" class="anchor" title="Link to this comment">#676</a>
  2014. </footer>
  2015. </div>
  2016. <ol>
  2017. <li id="comment-678" class="comment">
  2018. <div class="avatar">
  2019. <img alt="" src="http://www.gravatar.com/avatar/1fca03d51d167c31f2079aae85becf90?d=mm" title="Brian">
  2020. </div>
  2021. <div class="body">
  2022. <header>
  2023. <a href="javascript:void(0);">Brian</a>
  2024. </header>
  2025. <p>In the init function, I have changed:</p>
  2026. <div class="highlight"><pre><span class="k">this</span><span class="p">.</span><span class="nx">opt</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="kc">true</span><span class="p">,</span> <span class="p">{},</span> <span class="nx">$</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">defaults</span><span class="p">,</span> <span class="nx">settings</span><span class="p">);</span>
  2027. </pre></div>
  2028. <p>to</p>
  2029. <div class="highlight"><pre><span class="k">this</span><span class="p">.</span><span class="nx">opt</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="kc">true</span><span class="p">,</span> <span class="p">{},</span> <span class="nx">$</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">defaults</span><span class="p">,</span> <span class="nx">settings</span><span class="p">,</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">data</span><span class="p">());</span>
  2030. </pre></div>
  2031. <p>This allows me to pass instance variables via the div. Example:</p>
  2032. <div class="highlight"><pre><span class="nt">&lt;div</span> <span class="na">class=</span><span class="s">"my-rating"</span> <span class="na">data-score-name=</span><span class="s">"rating[quality]"</span><span class="nt">&gt;&lt;/div&gt;</span>
  2033. </pre></div>
  2034. <p>Perhaps a consideration to add to the master?</p>
  2035. <footer>
  2036. <a href="#comment-678" class="anchor" title="Link to this comment">#678</a>
  2037. </footer>
  2038. </div>
  2039. <ol>
  2040. <li id="comment-684" class="comment">
  2041. <div class="avatar">
  2042. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2043. </div>
  2044. <div class="body">
  2045. <header>
  2046. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2047. <span class="flag author">author</span>
  2048. </header>
  2049. <p>Brian,</p>
  2050. <p>Could you open a issue to create a <code>scoreName</code> callback?<br>
  2051. This way we can pass a function to <code>scoreName</code> and receive it via data or whatever.</p>
  2052. <p>Thanks.</p>
  2053. <footer>
  2054. <a href="#comment-684" class="anchor" title="Link to this comment">#684</a>
  2055. </footer>
  2056. </div>
  2057. </li>
  2058. </ol>
  2059. </li>
  2060. </ol>
  2061. </li>
  2062. <li id="comment-674" class="comment">
  2063. <div class="avatar">
  2064. <img alt="" src="http://www.gravatar.com/avatar/ef48b31893ff7bc1e1f842ff2a9ef677?d=mm" title="Istvan Szollosi">
  2065. </div>
  2066. <div class="body">
  2067. <header>
  2068. <a href="http://i-sty.comule.com" target="_blank">Istvan Szollosi</a>
  2069. </header>
  2070. <p>Hi,<br>
  2071. I tried to use your plugin in my blog/web-shop but I got these errors:</p>
  2072. <div class="highlight"><pre><span class="nx">Uncaught</span> <span class="nx">TypeError</span><span class="o">:</span> <span class="nb">Object</span> <span class="err">#</span><span class="o">&lt;</span><span class="nb">Object</span><span class="o">&gt;</span> <span class="nx">has</span> <span class="nx">no</span> <span class="nx">method</span> <span class="s1">'on'</span> <span class="nx">jquery</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">min</span><span class="p">.</span><span class="nx">js</span><span class="o">:</span><span class="mi">12</span>
  2073. <span class="nx">a</span><span class="p">.</span><span class="nx">_bindClick</span> <span class="nx">jquery</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">min</span><span class="p">.</span><span class="nx">js</span><span class="o">:</span><span class="mi">12</span>
  2074. <span class="nx">a</span><span class="p">.</span><span class="nx">_binds</span> <span class="nx">jquery</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">min</span><span class="p">.</span><span class="nx">js</span><span class="o">:</span><span class="mi">12</span>
  2075. <span class="p">(</span><span class="nx">anonymous</span> <span class="kd">function</span><span class="p">)</span> <span class="nx">jquery</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">min</span><span class="p">.</span><span class="nx">js</span><span class="o">:</span><span class="mi">12</span>
  2076. <span class="nx">E</span><span class="p">.</span><span class="nx">extend</span><span class="p">.</span><span class="nx">each</span> <span class="nx">VM4322</span><span class="o">:</span><span class="mi">1</span>
  2077. <span class="nx">E</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">E</span><span class="p">.</span><span class="nx">each</span> <span class="nx">VM4322</span><span class="o">:</span><span class="mi">1</span>
  2078. <span class="nx">a</span><span class="p">.</span><span class="nx">init</span> <span class="nx">jquery</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">min</span><span class="p">.</span><span class="nx">js</span><span class="o">:</span><span class="mi">12</span>
  2079. <span class="nx">b</span><span class="p">.</span><span class="nx">fn</span><span class="p">.</span><span class="nx">raty</span> <span class="nx">jquery</span><span class="p">.</span><span class="nx">raty</span><span class="p">.</span><span class="nx">min</span><span class="p">.</span><span class="nx">js</span><span class="o">:</span><span class="mi">12</span>
  2080. <span class="p">(</span><span class="nx">anonymous</span> <span class="kd">function</span><span class="p">)</span> <span class="nx">produs</span><span class="p">.</span><span class="nx">php</span><span class="o">?</span><span class="nx">produsid</span><span class="o">=</span><span class="mi">21</span><span class="o">:</span><span class="mi">245</span>
  2081. <span class="p">(</span><span class="nx">anonymous</span> <span class="kd">function</span><span class="p">)</span> <span class="nx">VM4322</span><span class="o">:</span><span class="mi">1</span>
  2082. <span class="p">(</span><span class="nx">anonymous</span> <span class="kd">function</span><span class="p">)</span> <span class="nx">VM4322</span><span class="o">:</span><span class="mi">1</span>
  2083. <span class="nx">E</span><span class="p">.</span><span class="nx">extend</span><span class="p">.</span><span class="nx">each</span> <span class="nx">VM4322</span><span class="o">:</span><span class="mi">1</span>
  2084. <span class="nx">E</span><span class="p">.</span><span class="nx">extend</span><span class="p">.</span><span class="nx">ready</span> <span class="nx">VM4322</span><span class="o">:</span><span class="mi">1</span>
  2085. <span class="nx">event</span><span class="p">.</span><span class="nx">returnValue</span> <span class="nx">is</span> <span class="nx">deprecated</span><span class="p">.</span> <span class="nx">Please</span> <span class="nx">use</span> <span class="nx">the</span> <span class="nx">standard</span> <span class="nx">event</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">()</span> <span class="nx">instead</span><span class="p">.</span>
  2086. </pre></div>
  2087. <footer>
  2088. <a href="#comment-674" class="anchor" title="Link to this comment">#674</a>
  2089. </footer>
  2090. </div>
  2091. <ol>
  2092. <li id="comment-683" class="comment">
  2093. <div class="avatar">
  2094. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2095. </div>
  2096. <div class="body">
  2097. <header>
  2098. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2099. <span class="flag author">author</span>
  2100. </header>
  2101. <p>Istvan Szollosi,</p>
  2102. <p>Check if your jQuery was imported before the Raty call.<br>
  2103. Check if you jQuery version has the new method <code>on</code>.</p>
  2104. <p>This problem is about import, about jQuery, not about Raty.</p>
  2105. <footer>
  2106. <a href="#comment-683" class="anchor" title="Link to this comment">#683</a>
  2107. </footer>
  2108. </div>
  2109. </li>
  2110. </ol>
  2111. </li>
  2112. <li id="comment-673" class="comment">
  2113. <div class="avatar">
  2114. <img alt="" src="http://www.gravatar.com/avatar/07777442d9de807b3e8962129bc5fdfb?d=mm" title="Mark">
  2115. </div>
  2116. <div class="body">
  2117. <header>
  2118. <a href="javascript:void(0);">Mark</a>
  2119. </header>
  2120. <p>Hi</p>
  2121. <p>Is there a way of easily posting the data to a rails application? I have added the call to my application to get the images and the java but every time I post my form my defined attribute doesn't save the the rating to the DB. Heres my code :</p>
  2122. <div class="highlight"><pre><span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">"star"</span> <span class="na">data-score=</span><span class="s">"1"</span><span class="nt">&gt;</span>
  2123. <span class="err">&lt;</span>%= :review_rating %&gt;
  2124. <span class="nt">&lt;/div&gt;</span>
  2125. </pre></div>
  2126. <div class="highlight"><pre><span class="nx">$</span><span class="p">(</span><span class="s1">'#star'</span><span class="p">).</span><span class="nx">raty</span><span class="p">({</span>
  2127. <span class="nx">score</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
  2128. <span class="k">return</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">':review_rating'</span><span class="p">)</span>
  2129. <span class="p">}</span>
  2130. <span class="p">});</span>
  2131. </pre></div>
  2132. <p>Forgive me if it seems basic but I know very little about J query and am at beginner level. The <code>:review_rating</code> is my rails attribute that Im trying to commit the score to.</p>
  2133. <p>Please let me know.</p>
  2134. <p>Many Thanks </p>
  2135. <footer>
  2136. <a href="#comment-673" class="anchor" title="Link to this comment">#673</a>
  2137. </footer>
  2138. </div>
  2139. <ol>
  2140. <li id="comment-682" class="comment">
  2141. <div class="avatar">
  2142. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2143. </div>
  2144. <div class="body">
  2145. <header>
  2146. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2147. <span class="flag author">author</span>
  2148. </header>
  2149. <p>Mark,</p>
  2150. <p>The value send by jQuery Raty is a hidden field, not what you put inside the div.<br>
  2151. This content inside the div is ignored, because Raty will override it, then you <code>&lt;%= :review_rating %&gt;</code> is useless.<br>
  2152. By default the hidden field that holds the score is called <code>score</code>, but you can change it if you need.</p>
  2153. <footer>
  2154. <a href="#comment-682" class="anchor" title="Link to this comment">#682</a>
  2155. </footer>
  2156. </div>
  2157. </li>
  2158. </ol>
  2159. </li>
  2160. <li id="comment-672" class="comment">
  2161. <div class="avatar">
  2162. <img alt="" src="http://www.gravatar.com/avatar/2fe6bd71a146dd113e894200ccc5e417?d=mm" title="Brandon">
  2163. </div>
  2164. <div class="body">
  2165. <header>
  2166. <a href="javascript:void(0);">Brandon</a>
  2167. </header>
  2168. <p>Awesome plugin! Super easy to use and dropped right into my rails app for a reviews rating system. Thanks!</p>
  2169. <footer>
  2170. <a href="#comment-672" class="anchor" title="Link to this comment">#672</a>
  2171. </footer>
  2172. </div>
  2173. <ol>
  2174. <li id="comment-681" class="comment">
  2175. <div class="avatar">
  2176. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2177. </div>
  2178. <div class="body">
  2179. <header>
  2180. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2181. <span class="flag author">author</span>
  2182. </header>
  2183. <p>Brandon,</p>
  2184. <p>Great! (:</p>
  2185. <footer>
  2186. <a href="#comment-681" class="anchor" title="Link to this comment">#681</a>
  2187. </footer>
  2188. </div>
  2189. </li>
  2190. </ol>
  2191. </li>
  2192. <li id="comment-666" class="comment">
  2193. <div class="avatar">
  2194. <img alt="" src="http://www.gravatar.com/avatar/5f932334f26daeb30e1f6843f4c5fe70?d=mm" title="Daniel Weller">
  2195. </div>
  2196. <div class="body">
  2197. <header>
  2198. <a href="javascript:void(0);">Daniel Weller</a>
  2199. </header>
  2200. <p>Here is a link to a tutorial for ruby on rails. If anyone can get it to fully work let me know! I've been able to only get the update stars to work. (Average rating isn't working)</p>
  2201. <p><a href="http://paweljaniak.co.za/2013/07/25/5-star-ratings-with-rails/">http://paweljaniak.co.za/2013/07/25/5-star-ratings-with-rails/</a></p>
  2202. <footer>
  2203. <a href="#comment-666" class="anchor" title="Link to this comment">#666</a>
  2204. </footer>
  2205. </div>
  2206. <ol>
  2207. <li id="comment-671" class="comment">
  2208. <div class="avatar">
  2209. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2210. </div>
  2211. <div class="body">
  2212. <header>
  2213. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2214. <span class="flag author">author</span>
  2215. </header>
  2216. <p>Daniel Weller,</p>
  2217. <p>Thanks for the contribution.</p>
  2218. <footer>
  2219. <a href="#comment-671" class="anchor" title="Link to this comment">#671</a>
  2220. </footer>
  2221. </div>
  2222. </li>
  2223. </ol>
  2224. </li>
  2225. <li id="comment-664" class="comment">
  2226. <div class="avatar">
  2227. <img alt="" src="http://www.gravatar.com/avatar/17d0a792231574531d52fd09e5cad84a?d=mm" title="Max">
  2228. </div>
  2229. <div class="body">
  2230. <header>
  2231. <a href="javascript:void(0);">Max</a>
  2232. </header>
  2233. <p>@Roosevelt: luckily you find the download on his github page as well: <a href="https://github.com/wbotelhos/raty">https://github.com/wbotelhos/raty</a></p>
  2234. <footer>
  2235. <a href="#comment-664" class="anchor" title="Link to this comment">#664</a>
  2236. </footer>
  2237. </div>
  2238. <ol>
  2239. <li id="comment-670" class="comment">
  2240. <div class="avatar">
  2241. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2242. </div>
  2243. <div class="body">
  2244. <header>
  2245. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2246. <span class="flag author">author</span>
  2247. </header>
  2248. <p>Max,</p>
  2249. <p>Thanks for the help. (:</p>
  2250. <footer>
  2251. <a href="#comment-670" class="anchor" title="Link to this comment">#670</a>
  2252. </footer>
  2253. </div>
  2254. </li>
  2255. </ol>
  2256. </li>
  2257. <li id="comment-662" class="comment">
  2258. <div class="avatar">
  2259. <img alt="" src="http://www.gravatar.com/avatar/b19d3a8e787126de5953c113ceff2be9?d=mm" title="Roosevelt P">
  2260. </div>
  2261. <div class="body">
  2262. <header>
  2263. <a href="http://www.naetech.com" target="_blank">Roosevelt P</a>
  2264. </header>
  2265. <p>Your download link to the plugin is throwing a 404 error.</p>
  2266. <footer>
  2267. <a href="#comment-662" class="anchor" title="Link to this comment">#662</a>
  2268. </footer>
  2269. </div>
  2270. <ol>
  2271. <li id="comment-669" class="comment">
  2272. <div class="avatar">
  2273. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2274. </div>
  2275. <div class="body">
  2276. <header>
  2277. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2278. <span class="flag author">author</span>
  2279. </header>
  2280. <p>Roosevelt P,</p>
  2281. <p>I fixed it. Thanks!</p>
  2282. <footer>
  2283. <a href="#comment-669" class="anchor" title="Link to this comment">#669</a>
  2284. </footer>
  2285. </div>
  2286. </li>
  2287. </ol>
  2288. </li>
  2289. <li id="comment-661" class="comment">
  2290. <div class="avatar">
  2291. <img alt="" src="http://www.gravatar.com/avatar/e72a8f02bf33e4b757bd9d9a75ca6977?d=mm" title="Bill">
  2292. </div>
  2293. <div class="body">
  2294. <header>
  2295. <a href="javascript:void(0);">Bill</a>
  2296. </header>
  2297. <p>Hi,</p>
  2298. <p>Is there a way to check and see if a visitor has already voted &amp; if so, then set it to read only?</p>
  2299. <p>Also, I would like to store the rating &amp; number of votes in a mySQL database, how could I do that?</p>
  2300. <footer>
  2301. <a href="#comment-661" class="anchor" title="Link to this comment">#661</a>
  2302. </footer>
  2303. </div>
  2304. <ol>
  2305. <li id="comment-668" class="comment">
  2306. <div class="avatar">
  2307. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2308. </div>
  2309. <div class="body">
  2310. <header>
  2311. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2312. <span class="flag author">author</span>
  2313. </header>
  2314. <p>Bill,</p>
  2315. <p>You can save it into database.<br>
  2316. When the user click on star, it actives the <a href="#click">click</a> callback, inside it you can get the score and save it via ajax.</p>
  2317. <p>Or you can just let the user to vote and create a submit button that will send the value keeped into hidden field named <code>score</code> by default.</p>
  2318. <footer>
  2319. <a href="#comment-668" class="anchor" title="Link to this comment">#668</a>
  2320. </footer>
  2321. </div>
  2322. </li>
  2323. </ol>
  2324. </li>
  2325. <li id="comment-660" class="comment">
  2326. <div class="avatar">
  2327. <img alt="" src="http://www.gravatar.com/avatar/b38e22f68b14e6752dd6fd9400ebef0a?d=mm" title="Tj">
  2328. </div>
  2329. <div class="body">
  2330. <header>
  2331. <a href="javascript:void(0);">Tj</a>
  2332. </header>
  2333. <p>Hi, How to save previous ratings ?? How to download and install this plugin ?</p>
  2334. <p>please help</p>
  2335. <footer>
  2336. <a href="#comment-660" class="anchor" title="Link to this comment">#660</a>
  2337. </footer>
  2338. </div>
  2339. <ol>
  2340. <li id="comment-667" class="comment">
  2341. <div class="avatar">
  2342. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2343. </div>
  2344. <div class="body">
  2345. <header>
  2346. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2347. <span class="flag author">author</span>
  2348. </header>
  2349. <p>Tj,</p>
  2350. <p>To save the last rating, you need to keep it on your database.<br>
  2351. To instal, just import the files e use the code showed on this page.</p>
  2352. <footer>
  2353. <a href="#comment-667" class="anchor" title="Link to this comment">#667</a>
  2354. </footer>
  2355. </div>
  2356. </li>
  2357. </ol>
  2358. </li>
  2359. <li id="comment-654" class="comment">
  2360. <div class="avatar">
  2361. <img alt="" src="http://www.gravatar.com/avatar/da5b2acb1906cb835262546e3b67fc4b?d=mm" title="Lanamaja">
  2362. </div>
  2363. <div class="body">
  2364. <header>
  2365. <a href="javascript:void(0);">Lanamaja</a>
  2366. </header>
  2367. <p>Hi,<br>
  2368. how can i add this on a wordpress page? and/or include into a contact form?<br>
  2369. If i want the plugin to open up different links or display messages depending on the number of stars the user clicked, how could i manage this<br>
  2370. with your plugin?</p>
  2371. <p>Thanks in advance</p>
  2372. <footer>
  2373. <a href="#comment-654" class="anchor" title="Link to this comment">#654</a>
  2374. </footer>
  2375. </div>
  2376. <ol>
  2377. <li id="comment-659" class="comment">
  2378. <div class="avatar">
  2379. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2380. </div>
  2381. <div class="body">
  2382. <header>
  2383. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2384. <span class="flag author">author</span>
  2385. </header>
  2386. <p>Lanamaja,</p>
  2387. <p>You will use the same code. But where put it, I can't help you, because I don't know about wordpress coding.</p>
  2388. <p>To open whatever you want, use the callback <a href="#click">click</a>, inside it you can get the <code>score</code> and do your logic.</p>
  2389. <footer>
  2390. <a href="#comment-659" class="anchor" title="Link to this comment">#659</a>
  2391. </footer>
  2392. </div>
  2393. </li>
  2394. </ol>
  2395. </li>
  2396. <li id="comment-652" class="comment">
  2397. <div class="avatar">
  2398. <img alt="" src="http://www.gravatar.com/avatar/1761d6e4e94e6591190678d6b32c72a3?d=mm" title="Amarpreet">
  2399. </div>
  2400. <div class="body">
  2401. <header>
  2402. <a href="javascript:void(0);">Amarpreet</a>
  2403. </header>
  2404. <p>Hi,</p>
  2405. <p>Could you help me with how i can post the rating using ajax. </p>
  2406. <footer>
  2407. <a href="#comment-652" class="anchor" title="Link to this comment">#652</a>
  2408. </footer>
  2409. </div>
  2410. <ol>
  2411. <li id="comment-653" class="comment">
  2412. <div class="avatar">
  2413. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2414. </div>
  2415. <div class="body">
  2416. <header>
  2417. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2418. <span class="flag author">author</span>
  2419. </header>
  2420. <p>Amarpreet,</p>
  2421. <p>You can do it from inside the <a href="#click">click</a> callback.<br>
  2422. Get the <a href="#score">score</a> value and manipulate it with jQuery.</p>
  2423. <p>Ajax POST reference: <a href="http://api.jquery.com/jquery.post">http://api.jquery.com/jquery.post</a></p>
  2424. <footer>
  2425. <a href="#comment-653" class="anchor" title="Link to this comment">#653</a>
  2426. </footer>
  2427. </div>
  2428. </li>
  2429. </ol>
  2430. </li>
  2431. <li id="comment-650" class="comment">
  2432. <div class="avatar">
  2433. <img alt="" src="http://www.gravatar.com/avatar/9ba395435487e85de7df942b77a75674?d=mm" title="Washington Botelho">
  2434. </div>
  2435. <div class="body">
  2436. <header>
  2437. <a href="http://wbotelhos.com" target="_blank">Washington Botelho</a>
  2438. </header>
  2439. <p>first</p>
  2440. <footer>
  2441. <a href="#comment-650" class="anchor" title="Link to this comment">#650</a>
  2442. </footer>
  2443. </div>
  2444. </li>
  2445. </ol>
  2446. </section>
  2447. <script>
  2448. $(function() {
  2449. AntiBOT.init('.new_comment');
  2450. CommentResponder.init();
  2451. $('#comment_body').taby();
  2452. });
  2453. </script>
  2454. </div>
  2455. <script>
  2456. $.fn.raty.defaults.path = '../lib/images';
  2457. $(function() {
  2458. $('#default').raty();
  2459. $('#score').raty({ score: 3 });
  2460. $('#score-callback').raty({
  2461. score: function() {
  2462. return $(this).attr('data-score');
  2463. }
  2464. });
  2465. $('#scoreName').raty({ scoreName: 'entity[score]' });
  2466. $('#number').raty({ number: 10 });
  2467. $('#number-callback').raty({
  2468. number: function() {
  2469. return $(this).attr('data-number');
  2470. }
  2471. });
  2472. $('#numberMax').raty({
  2473. numberMax : 5,
  2474. number : 100
  2475. });
  2476. $('#readOnly').raty({ readOnly: true, score: 3 });
  2477. $('#readOnly-callback').raty({
  2478. readOnly: function() {
  2479. return 'true becomes readOnly' == 'true becomes readOnly';
  2480. }
  2481. });
  2482. $('#noRatedMsg').raty({
  2483. readOnly : true,
  2484. noRatedMsg : "I'am readOnly and I haven't rated yet!"
  2485. });
  2486. $('#halfShow-true').raty({ score: 3.26 });
  2487. $('#halfShow-false').raty({
  2488. halfShow : false,
  2489. score : 3.26
  2490. });
  2491. $('#round').raty({
  2492. round : { down: .26, full: .6, up: .76 },
  2493. score : 3.26
  2494. });
  2495. $('#half').raty({
  2496. half : true,
  2497. hints : [['bad 1/2', 'bad'], ['poor 1/2', 'poor'], ['regular 1/2', 'regular'], ['good 1/2', 'good'], ['gorgeous 1/2', 'gorgeous']]
  2498. });
  2499. $('#starHalf').raty({
  2500. half : true,
  2501. path : null,
  2502. starHalf : 'images/star-half-mono.png',
  2503. starOff : '../lib/images/star-off.png',
  2504. starOn : '../lib/images/star-on.png'
  2505. });
  2506. $('#click').raty({
  2507. click: function(score, evt) {
  2508. alert('ID: ' + this.id + "\nscore: " + score + "\nevent: " + evt.type);
  2509. }
  2510. });
  2511. $('#click-prevent').raty({
  2512. click: function(score, evt) {
  2513. alert('Score will not change.')
  2514. return false;
  2515. }
  2516. });
  2517. $('#hints').raty({ hints: ['a', null, '', undefined, '*_*']});
  2518. $('#star-off-and-star-on').raty({
  2519. path : 'images',
  2520. starOff : 'off.png',
  2521. starOn : 'on.png'
  2522. });
  2523. $('#cancel').raty({ cancel: true });
  2524. $('#cancelHint').raty({
  2525. cancel : true,
  2526. cancelHint : 'My cancel hint!'
  2527. });
  2528. $('#cancelPlace').raty({
  2529. cancel : true,
  2530. cancelPlace : 'right'
  2531. });
  2532. $('#star-off-and-star-on').raty({
  2533. path : 'images',
  2534. starOff : 'off.png',
  2535. starOn : 'on.png'
  2536. });
  2537. $('#cancel-off-and-cancel-on').raty({
  2538. cancel : true,
  2539. cancelOff : 'images/cancel-custom-off.png',
  2540. cancelOn : 'images/cancel-custom-on.png',
  2541. path : null,
  2542. starOff : '../lib/images/star-off.png',
  2543. starOn : '../lib/images/star-on.png'
  2544. });
  2545. $('#iconRange').raty({
  2546. path : null,
  2547. starOff : '../lib/images/star-off.png',
  2548. iconRange : [
  2549. { range: 1, on: 'images/1.png', off: 'images/0.png' },
  2550. { range: 2, on: 'images/2.png', off: 'images/0.png' },
  2551. { range: 3, on: 'images/3.png', off: 'images/0.png' },
  2552. { range: 4, on: 'images/4.png', off: 'images/0.png' },
  2553. { range: 5, on: 'images/5.png', off: 'images/0.png' }
  2554. ]
  2555. });
  2556. $('#size').raty({
  2557. path : 'images',
  2558. cancel : true,
  2559. cancelOff : 'cancel-off.png',
  2560. cancelOn : 'cancel-on.png',
  2561. half : true,
  2562. starHalf : 'star-half.png',
  2563. starOff : 'star-off.png',
  2564. starOn : 'star-on.png'
  2565. });
  2566. $('#target-div').raty({
  2567. cancel : true,
  2568. target : '#target-div-hint'
  2569. });
  2570. $('#target-text').raty({
  2571. cancel : true,
  2572. target : '#target-text-hint'
  2573. });
  2574. $('#target-textarea').raty({
  2575. cancel : true,
  2576. target : '#target-textarea-hint'
  2577. });
  2578. $('#target-select').raty({
  2579. cancel : true,
  2580. target : '#target-select-hint'
  2581. });
  2582. $('#targetType').raty({
  2583. cancel : true,
  2584. target : '#targetType-hint',
  2585. targetType : 'score'
  2586. });
  2587. $('#targetKeep').raty({
  2588. cancel : true,
  2589. target : '#targetKeep-hint',
  2590. targetKeep : true
  2591. });
  2592. $('#targetText').raty({
  2593. target : '#targetText-hint',
  2594. targetText : '--'
  2595. });
  2596. $('#targetFormat').raty({
  2597. target : '#targetFormat-hint',
  2598. targetFormat : 'Rating: {score}'
  2599. });
  2600. $('#targetScore').raty({
  2601. targetScore: '#target-score'
  2602. });
  2603. $('#mouseover').raty({
  2604. mouseover: function(score, evt) {
  2605. alert('ID: ' + this.id + "\nscore: " + score + "\nevent: " + evt.type);
  2606. }
  2607. });
  2608. $('#mouseout').raty({
  2609. mouseout: function(score, evt) {
  2610. alert('ID: ' + this.id + "\nscore: " + score + "\nevent: " + evt.type);
  2611. }
  2612. });
  2613. $('#precision').raty({
  2614. cancel : true,
  2615. cancelOff : 'cancel-off.png',
  2616. cancelOn : 'cancel-on.png',
  2617. path : 'images',
  2618. starHalf : 'star-half.png',
  2619. starOff : 'star-off.png',
  2620. starOn : 'star-on.png',
  2621. target : '#precision-hint',
  2622. targetKeep : true,
  2623. precision : true
  2624. });
  2625. $('#space').raty({ space: false });
  2626. $('#single').raty({ single: true });
  2627. $('#starType').raty({
  2628. cancel : true,
  2629. half : true,
  2630. starType : 'i'
  2631. });
  2632. $('#functions').raty({
  2633. cancel : true,
  2634. cancelOff : 'cancel-off.png',
  2635. cancelOn : 'cancel-on.png',
  2636. path : 'images',
  2637. precision : true,
  2638. starHalf : 'star-half.png',
  2639. starOff : 'star-off.png',
  2640. starOn : 'star-on.png',
  2641. target : '#functions-hint',
  2642. targetKeep : true,
  2643. click: function(score, evt) {
  2644. alert('ID: ' + this.id + "\nscore: " + score + "\nevent: " + evt.type);
  2645. },
  2646. hints: [
  2647. ['bad 1' , 'bad 2' , 'bad 3' , 'bad 4' , 'bad 5' , 'bad 6' , 'bad 7' , 'bad 8' , 'bad 9' , 'bad' ],
  2648. ['poor 1' , 'poor 2' , 'poor 3' , 'poor 4' , 'poor 5' , 'poor 6' , 'poor 7' , 'poor 8' , 'poor 9' , 'poor' ],
  2649. ['regular 1' , 'regular 2' , 'regular 3' , 'regular 4' , 'regular 5' , 'regular 6' , 'regular 7' , 'regular 8' , 'regular 9' , 'regular' ],
  2650. ['good 1' , 'good 2' , 'good 3' , 'good 4' , 'good 5' , 'good 6' , 'good 7' , 'good 8' , 'good 9' , 'good' ],
  2651. ['gorgeous 1' , 'gorgeous 2' , 'gorgeous 3' , 'gorgeous 4' , 'gorgeous 5' , 'gorgeous 6' , 'gorgeous 7' , 'gorgeous 8' , 'gorgeous 9' , 'gorgeous' ]
  2652. ]
  2653. });
  2654. $('#score-function-run').on('click', function() {
  2655. $('#functions').raty('score', $('#' + this.id.replace('-run', '')).val());
  2656. });
  2657. $('#click-function-run').on('click', function() {
  2658. $('#functions').raty('click', $('#' + this.id.replace('-run', '')).val());
  2659. });
  2660. $('#readOnly-function-run').on('click', function() {
  2661. var isReadOnly = $('#' + this.id.replace('-run', '')).val() === 'true';
  2662. $('#functions').raty('readOnly', isReadOnly);
  2663. });
  2664. $('#cancel-function-run').on('click', function() {
  2665. var isTrigger = $('#' + this.id.replace('-run', '')).val() === 'true';
  2666. $('#functions').raty('cancel', isTrigger);
  2667. });
  2668. $('#reload-function-run').on('click', function() {
  2669. $('#functions').raty('reload');
  2670. });
  2671. $('#get-score-function-run').on('click', function() {
  2672. alert('score: ' + $('#functions').raty('score'));
  2673. });
  2674. $('#set-score-function-run').on('click', function() {
  2675. $('#functions').raty('score', $('#' + this.id.replace('-run', '')).val());
  2676. });
  2677. $('#set-function-run').on('click', function() {
  2678. var options = $('#' + this.id.replace('-run', '').val()),
  2679. command = "$('#functions').raty('set', " + options + ");";
  2680. eval(command);
  2681. });
  2682. $('#destroy-function-run').on('click', function() {
  2683. $('#functions').raty('destroy');
  2684. });
  2685. $('#move-function-run').on('click', function() {
  2686. $('#functions').raty('move', $('#' + this.id.replace('-run', '')).val());
  2687. });
  2688. });
  2689. </script>
  2690. </body>
  2691. </html>