Version Description
- TWEAKED: removed jacasvript for yasr_visitor_multiset shortcode, use wp_localize_script instead
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 1.5.4 |
Comparing to | |
See all releases |
Code changes from version 1.5.3 to 1.5.4
- css/yasr.css +53 -1
- js/jquery.rateit.min.js.map +1 -0
- js/yasr-front.js +14 -2
- lib/yasr-admin-actions.php +1 -0
- lib/yasr-ajax-functions.php +3 -2
- lib/yasr-functions.php +1 -1
- lib/yasr-shortcode-functions.php +44 -77
- readme.txt +4 -1
- yet-another-stars-rating.php +2 -2
css/yasr.css
CHANGED
@@ -42,7 +42,6 @@
|
|
42 |
display: -moz-inline-box;
|
43 |
display: inline-block;
|
44 |
height: 16px;
|
45 |
-
width: 16px;
|
46 |
outline: none;
|
47 |
vertical-align: -5px;
|
48 |
}
|
@@ -116,6 +115,59 @@ div.bigstars .rateit-selected
|
|
116 |
background-position: 0 -16px;
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
/*** RTL RULES, thank's to Arik Numlock ***/
|
120 |
|
121 |
.rateit .rateit-hover.rateit-hover-rtl, .rateit .rateit-selected.rateit-selected-rtl {
|
42 |
display: -moz-inline-box;
|
43 |
display: inline-block;
|
44 |
height: 16px;
|
|
|
45 |
outline: none;
|
46 |
vertical-align: -5px;
|
47 |
}
|
115 |
background-position: 0 -16px;
|
116 |
}
|
117 |
|
118 |
+
|
119 |
+
/*** Rate it font ***/
|
120 |
+
|
121 |
+
.rateit-font {
|
122 |
+
font-size: 24px;
|
123 |
+
line-height: 1em;
|
124 |
+
}
|
125 |
+
|
126 |
+
.rateit-font .rateit-range {
|
127 |
+
background: none;
|
128 |
+
height: auto;
|
129 |
+
}
|
130 |
+
|
131 |
+
.rateit-font .rateit-empty {
|
132 |
+
color: #ccc;
|
133 |
+
}
|
134 |
+
|
135 |
+
.rateit-font .rateit-range > div {
|
136 |
+
background: none;
|
137 |
+
overflow: hidden;
|
138 |
+
cursor: default;
|
139 |
+
}
|
140 |
+
|
141 |
+
.rateit.rateit-font .rateit-reset {
|
142 |
+
font-size: inherit;
|
143 |
+
background: none;
|
144 |
+
width: 0.6em;
|
145 |
+
height: 0.6em;
|
146 |
+
margin-top: 0.2em;
|
147 |
+
background: gray;
|
148 |
+
border-radius: 50%;
|
149 |
+
position: relative;
|
150 |
+
}
|
151 |
+
|
152 |
+
.rateit.rateit-font .rateit-reset span {
|
153 |
+
display: block;
|
154 |
+
font-weight: bold;
|
155 |
+
color: white;
|
156 |
+
height: calc(50% - 0.045em);
|
157 |
+
top: 0;
|
158 |
+
position: absolute;
|
159 |
+
border-bottom: 0.09em solid white;
|
160 |
+
width: 72%;
|
161 |
+
margin-left: 14%;
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
+
.rateit.rateit-font .rateit-reset:hover, .rateit.rateit-font button.rateit-reset:focus {
|
166 |
+
background: #e6574b; /* Old browsers */
|
167 |
+
background: radial-gradient(ellipse at center, #e6574b 55%,#f6836b 77%,#f9d3cc 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
|
168 |
+
background-position: 0 0;
|
169 |
+
}
|
170 |
+
|
171 |
/*** RTL RULES, thank's to Arik Numlock ***/
|
172 |
|
173 |
.rateit .rateit-hover.rateit-hover-rtl, .rateit .rateit-selected.rateit-selected-rtl {
|
js/jquery.rateit.min.js.map
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{"version":3,"sources":["jquery.rateit.js"],"names":["$","touchHandler","event","touches","originalEvent","changedTouches","first","type","simulatedEvent","document","createEvent","initMouseEvent","window","screenX","screenY","clientX","clientY","target","dispatchEvent","preventDefault","rateit","aria","resetLabel","ratingLabel","fn","p1","p2","index","options","mode","capitaliseFirstLetter","string","charAt","toUpperCase","substr","this","length","tp1","undefined","extend","defaults","data","each","item","itemdata","key","value","ariakey","range","find","attr","arguments","apply","setup","prop","fld","nodeName","getAttribute","val","trigger","min","max","step","hasClass","addClass","ltr","css","unbind","Math","icon","isNaN","readonly","resetable","backingfld","starwidth","starheight","ispreset","hide","parseInt","Number","selectedOption","element","html","append","replace","removeClass","JSON","parse","stringify","isfont","height","stars","txt","i","text","width","presetclass","score","resetbtn","bind","e","blur","Event","isDefaultPrevented","calcRawScore","pageX","offsetx","offset","left","ceil","setHover","w","h","show","setSelection","mousemove","mouseleave","mouseup","keyup","which","jQuery"],"mappings":";;;CAGA,SAAWA,GA6XP,QAASC,GAAaC,GAElB,GAAIC,GAAUD,EAAME,cAAcC,eAC1BC,EAAQH,EAAQ,GAChBI,EAAO,EACf,QAAQL,EAAMK,MACV,IAAK,YAAaA,EAAO,WAAa,MACtC,KAAK,WAAYA,EAAO,SAAW,MACnC,SAAS,OAGb,GAAIC,GAAiBC,SAASC,YAAY,aAC1CF,GAAeG,eAAeJ,GAAM,GAAM,EAAMK,OAAQ,EAClCN,EAAMO,QAASP,EAAMQ,QACrBR,EAAMS,QAAST,EAAMU,SAAS,GAC9B,GAAO,GAAO,EAAO,EAAW,MAEtDV,EAAMW,OAAOC,cAAcV,GAC3BN,EAAMiB,iBA9YVnB,EAAEoB,QACEC,MACIC,WAAY,eACZC,YAAa,WAIrBvB,EAAEwB,GAAGJ,OAAS,SAAUK,EAAIC,GAExB,GAAIC,GAAQ,EACRC,KAAkBC,EAAO,OACzBC,EAAwB,SAAUC,GAClC,MAAOA,GAAOC,OAAO,GAAGC,cAAgBF,EAAOG,OAAO,GAG1D,IAAoB,IAAhBC,KAAKC,OAAgB,MAAOD,KAGhC,IAAIE,GAAMrC,EAAEO,KAAKkB,EACjB,IAAW,UAAPY,GAA0BC,SAAPb,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GAAK,KACxCiD,EAAa9C,KAAKR,IAAIhB,EAAS,SAAWA,EAAS,QAASA,EAAS,SAE1D,IAAXwD,EAAEmB,OAAenB,EAAEmB,QAAUtD,EAAM,GAAK,KACxCiD,EAAa9C,KAAKP,IAAIjB,EAAS,SAAWA,EAAS,QAASA,EAAS,WAI7EA,EAAS,SAAS,IAElBA,EAAS,cACTsD,EAASe,QAOjBjE,EAAME,KAAK,gBAAiBN,EAAS,gBA2B7C5C,EAAEwB,GAAGJ,OAAOoB,UAAaoB,IAAK,EAAGC,IAAK,EAAGC,KAAM,GAAKjC,KAAM,KAAMwC,KAAM,IAAKK,UAAW,GAAIC,WAAY,GAAIJ,UAAU,EAAOC,WAAW,EAAMI,UAAU,GAGtJ5E,EAAE,WAAcA,EAAE,2BAA2BoB,YAE9CoG","file":"jquery.rateit.min.js","sourcesContent":["/*! RateIt | v1.1.0 / 10/20/2016\r\n https://github.com/gjunge/rateit.js | Twitter: @gjunge\r\n*/\r\n(function ($) {\r\n $.rateit = {\r\n aria: {\r\n resetLabel: 'reset rating',\r\n ratingLabel: 'rating'\r\n }\r\n };\r\n\r\n $.fn.rateit = function (p1, p2) {\r\n //quick way out.\r\n var index = 1;\r\n var options = {}; var mode = 'init';\r\n var capitaliseFirstLetter = function (string) {\r\n return string.charAt(0).toUpperCase() + string.substr(1);\r\n };\r\n\r\n if (this.length === 0) { return this; }\r\n\r\n\r\n var tp1 = $.type(p1);\r\n if (tp1 == 'object' || p1 === undefined || p1 === null) {\r\n options = $.extend({}, $.fn.rateit.defaults, p1); //wants to init new rateit plugin(s).\r\n }\r\n else if (tp1 == 'string' && p1 !== 'reset' && p2 === undefined) {\r\n return this.data('rateit' + capitaliseFirstLetter(p1)); //wants to get a value.\r\n }\r\n else if (tp1 == 'string') {\r\n mode = 'setvalue';\r\n }\r\n\r\n return this.each(function () {\r\n var item = $(this);\r\n\r\n\r\n //shorten all the item.data('rateit-XXX'), will save space in closure compiler, will be like item.data('XXX') will become x('XXX')\r\n var itemdata = function (key, value) {\r\n\r\n if (value != null) {\r\n //update aria values\r\n var ariakey = 'aria-value' + ((key == 'value') ? 'now' : key);\r\n var range = item.find('.rateit-range');\r\n if (range.attr(ariakey) != undefined) {\r\n range.attr(ariakey, value);\r\n }\r\n\r\n }\r\n\r\n arguments[0] = 'rateit' + capitaliseFirstLetter(key);\r\n return item.data.apply(item, arguments); ////Fix for WI: 523\r\n };\r\n\r\n //handle programmatic reset\r\n if (p1 == 'reset') {\r\n var setup = itemdata('init'); //get initial value\r\n for (var prop in setup) {\r\n item.data(prop, setup[prop]);\r\n }\r\n\r\n if (itemdata('backingfld')) { //reset also backingfield\r\n var fld = $(itemdata('backingfld'));\r\n // If backing field is a select box with valuesrc option set to \"index\", reset its selectedIndex property; otherwise, reset its value.\r\n if (fld[0].nodeName == 'SELECT' && fld[0].getAttribute('data-rateit-valuesrc') === 'index') {\r\n fld.prop('selectedIndex', itemdata('value'));\r\n }\r\n else {\r\n fld.val(itemdata('value'));\r\n }\r\n fld.trigger('change');\r\n if (fld[0].min) { fld[0].min = itemdata('min'); }\r\n if (fld[0].max) { fld[0].max = itemdata('max'); }\r\n if (fld[0].step) { fld[0].step = itemdata('step'); }\r\n }\r\n item.trigger('reset');\r\n }\r\n\r\n //add the rate it class.\r\n if (!item.hasClass('rateit')) { item.addClass('rateit'); }\r\n\r\n var ltr = item.css('direction') != 'rtl';\r\n\r\n // set value mode\r\n if (mode == 'setvalue') {\r\n if (!itemdata('init')) { throw 'Can\\'t set value before init'; }\r\n\r\n\r\n //if readonly now and it wasn't readonly, remove the eventhandlers.\r\n if (p1 == 'readonly' && p2 == true && !itemdata('readonly')) {\r\n item.find('.rateit-range').unbind();\r\n itemdata('wired', false);\r\n }\r\n //when we receive a null value, reset the score to its min value.\r\n if (p1 == 'value') {\r\n p2 = (p2 == null) ? itemdata('min') : Math.max(itemdata('min'), Math.min(itemdata('max'), p2));\r\n }\r\n if (itemdata('backingfld')) {\r\n //if we have a backing field, check which fields we should update. \r\n //In case of input[type=range], although we did read its attributes even in browsers that don't support it (using fld.attr())\r\n //we only update it in browser that support it (&& fld[0].min only works in supporting browsers), not only does it save us from checking if it is range input type, it also is unnecessary.\r\n var fld = $(itemdata('backingfld'));\r\n // If backing field is a select box with valuesrc option set to \"index\", update its selectedIndex property; otherwise, update its value.\r\n if (fld[0].nodeName == 'SELECT' && fld[0].getAttribute('data-rateit-valuesrc') === 'index') {\r\n if (p1 == 'value') { fld.prop('selectedIndex', p2); }\r\n }\r\n else {\r\n if (p1 == 'value') { fld.val(p2); }\r\n }\r\n if (p1 == 'min' && fld[0].min) { fld[0].min = p2; }\r\n if (p1 == 'max' && fld[0].max) { fld[0].max = p2;}\r\n if (p1 == 'step' && fld[0].step) { fld[0].step = p2; }\r\n }\r\n\r\n itemdata(p1, p2);\r\n }\r\n\r\n\r\n //init rateit plugin\r\n if (!itemdata('init')) {\r\n\r\n //get our values, either from the data-* html5 attribute or from the options.\r\n itemdata('mode', itemdata('mode') || options.mode)\r\n itemdata('icon', itemdata('icon') || options.icon)\r\n itemdata('min', isNaN(itemdata('min')) ? options.min : itemdata('min'));\r\n itemdata('max', isNaN(itemdata('max')) ? options.max : itemdata('max'));\r\n itemdata('step', itemdata('step') || options.step);\r\n itemdata('readonly', itemdata('readonly') !== undefined ? itemdata('readonly') : options.readonly);\r\n itemdata('resetable', itemdata('resetable') !== undefined ? itemdata('resetable') : options.resetable);\r\n itemdata('backingfld', itemdata('backingfld') || options.backingfld);\r\n itemdata('starwidth', itemdata('starwidth') || options.starwidth);\r\n itemdata('starheight', itemdata('starheight') || options.starheight);\r\n itemdata('value', Math.max(itemdata('min'), Math.min(itemdata('max'), (!isNaN(itemdata('value')) ? itemdata('value') : (!isNaN(options.value) ? options.value : options.min)))));\r\n itemdata('ispreset', itemdata('ispreset') !== undefined ? itemdata('ispreset') : options.ispreset);\r\n //are we LTR or RTL?\r\n\r\n if (itemdata('backingfld')) {\r\n //if we have a backing field, hide it, override defaults if range or select.\r\n var fld = $(itemdata('backingfld')).hide();\r\n\r\n if (fld.attr('disabled') || fld.attr('readonly')) {\r\n itemdata('readonly', true); //http://rateit.codeplex.com/discussions/362055 , if a backing field is disabled or readonly at instantiation, make rateit readonly.\r\n }\r\n\r\n if (fld[0].nodeName == 'INPUT') {\r\n if (fld[0].type == 'range' || fld[0].type == 'text') { //in browsers not support the range type, it defaults to text\r\n\r\n itemdata('min', parseInt(fld.attr('min')) || itemdata('min')); //if we would have done fld[0].min it wouldn't have worked in browsers not supporting the range type.\r\n itemdata('max', parseInt(fld.attr('max')) || itemdata('max'));\r\n itemdata('step', parseInt(fld.attr('step')) || itemdata('step'));\r\n }\r\n }\r\n if (fld[0].nodeName == 'SELECT' && fld[0].options.length > 1) {\r\n // If backing field is a select box with valuesrc option set to \"index\", use the indexes of its options; otherwise, use the values.\r\n if (fld[0].getAttribute('data-rateit-valuesrc') === 'index') {\r\n itemdata('min', (!isNaN(itemdata('min')) ? itemdata('min') : Number(fld[0].options[0].index)));\r\n itemdata('max', Number(fld[0].options[fld[0].length - 1].index));\r\n itemdata('step', Number(fld[0].options[1].index) - Number(fld[0].options[0].index));\r\n }\r\n else {\r\n itemdata('min', (!isNaN(itemdata('min')) ? itemdata('min') : Number(fld[0].options[0].value)));\r\n itemdata('max', Number(fld[0].options[fld[0].length - 1].value));\r\n itemdata('step', Number(fld[0].options[1].value) - Number(fld[0].options[0].value));\r\n }\r\n //see if we have a option that as explicity been selected\r\n var selectedOption = fld.find('option[selected]');\r\n if (selectedOption.length == 1) {\r\n // If backing field is a select box with valuesrc option set to \"index\", use the index of selected option; otherwise, use the value.\r\n if (fld[0].getAttribute('data-rateit-valuesrc') === 'index') {\r\n itemdata('value', selectedOption[0].index);\r\n }\r\n else {\r\n itemdata('value', selectedOption.val());\r\n }\r\n }\r\n }\r\n else {\r\n //if it is not a select box, we can get's it's value using the val function. \r\n //If it is a selectbox, we always get a value (the first one of the list), even if it was not explicity set.\r\n itemdata('value', fld.val());\r\n }\r\n\r\n \r\n }\r\n\r\n \r\n\r\n //Create the necessary tags. For ARIA purposes we need to give the items an ID. So we use an internal index to create unique ids\r\n var element = item[0].nodeName == 'DIV' ? 'div' : 'span';\r\n index++;\r\n\r\n var html = '<button id=\"rateit-reset-{{index}}\" type=\"button\" data-role=\"none\" class=\"rateit-reset\" aria-label=\"' + $.rateit.aria.resetLabel + '\" aria-controls=\"rateit-range-{{index}}\"><span></span></button><{{element}} id=\"rateit-range-{{index}}\" class=\"rateit-range\" tabindex=\"0\" role=\"slider\" aria-label=\"' + $.rateit.aria.ratingLabel + '\" aria-owns=\"rateit-reset-{{index}}\" aria-valuemin=\"' + itemdata('min') + '\" aria-valuemax=\"' + itemdata('max') + '\" aria-valuenow=\"' + itemdata('value') + '\"><{{element}} class=\"rateit-empty\"></{{element}}><{{element}} class=\"rateit-selected\"></{{element}}><{{element}} class=\"rateit-hover\"></{{element}}></{{element}}>';\r\n item.append(html.replace(/{{index}}/gi, index).replace(/{{element}}/gi, element));\r\n\r\n //if we are in RTL mode, we have to change the float of the \"reset button\"\r\n if (!ltr) {\r\n item.find('.rateit-reset').css('float', 'right');\r\n item.find('.rateit-selected').addClass('rateit-selected-rtl');\r\n item.find('.rateit-hover').addClass('rateit-hover-rtl');\r\n }\r\n\r\n if (itemdata('mode') == 'font') {\r\n item.addClass('rateit-font').removeClass('rateit-bg');\r\n }\r\n else {\r\n item.addClass('rateit-bg').removeClass('rateit-font');\r\n }\r\n\r\n itemdata('init', JSON.parse(JSON.stringify(item.data()))); //cheap way to create a clone\r\n }\r\n\r\n var isfont = itemdata('mode') == 'font';\r\n\r\n \r\n\r\n\r\n //resize the height of all elements, \r\n if (!isfont) {\r\n item.find('.rateit-selected, .rateit-hover').height(itemdata('starheight'));\r\n }\r\n\r\n\r\n var range = item.find('.rateit-range');\r\n if (isfont) {\r\n //fill the ranges with the icons\r\n var icon = itemdata('icon');\r\n var stars = itemdata('max') - itemdata('min');\r\n\r\n var txt = '';\r\n for(var i = 0; i< stars; i++){\r\n txt += icon;\r\n }\r\n \r\n range.find('> *').text(txt);\r\n \r\n\r\n itemdata('starwidth', range.width() / (itemdata('max') - itemdata('min')))\r\n }\r\n else {\r\n //set the range element to fit all the stars.\r\n range.width(itemdata('starwidth') * (itemdata('max') - itemdata('min'))).height(itemdata('starheight'));\r\n }\r\n\r\n\r\n //add/remove the preset class\r\n var presetclass = 'rateit-preset' + ((ltr) ? '' : '-rtl');\r\n if (itemdata('ispreset')) {\r\n item.find('.rateit-selected').addClass(presetclass);\r\n }\r\n else {\r\n item.find('.rateit-selected').removeClass(presetclass);\r\n }\r\n\r\n //set the value if we have it.\r\n if (itemdata('value') != null) {\r\n var score = (itemdata('value') - itemdata('min')) * itemdata('starwidth');\r\n item.find('.rateit-selected').width(score);\r\n }\r\n\r\n //setup the reset button\r\n var resetbtn = item.find('.rateit-reset');\r\n if (resetbtn.data('wired') !== true) {\r\n resetbtn.bind('click', function (e) {\r\n e.preventDefault();\r\n\r\n resetbtn.blur();\r\n\r\n var event = $.Event('beforereset');\r\n item.trigger(event);\r\n if (event.isDefaultPrevented()) {\r\n return false;\r\n }\r\n\r\n item.rateit('value', null);\r\n item.trigger('reset');\r\n }).data('wired', true);\r\n\r\n }\r\n\r\n //this function calculates the score based on the current position of the mouse.\r\n var calcRawScore = function (element, event) {\r\n var pageX = (event.changedTouches) ? event.changedTouches[0].pageX : event.pageX;\r\n\r\n var offsetx = pageX - $(element).offset().left;\r\n if (!ltr) { offsetx = range.width() - offsetx };\r\n if (offsetx > range.width()) { offsetx = range.width(); }\r\n if (offsetx < 0) { offsetx = 0; }\r\n\r\n return score = Math.ceil(offsetx / itemdata('starwidth') * (1 / itemdata('step')));\r\n };\r\n\r\n //sets the hover element based on the score.\r\n var setHover = function (score) {\r\n var w = score * itemdata('starwidth') * itemdata('step');\r\n var h = range.find('.rateit-hover');\r\n if (h.data('width') != w) {\r\n range.find('.rateit-selected').hide();\r\n h.width(w).show().data('width', w);\r\n var data = [(score * itemdata('step')) + itemdata('min')];\r\n item.trigger('hover', data).trigger('over', data);\r\n }\r\n };\r\n\r\n var setSelection = function (value) {\r\n var event = $.Event('beforerated');\r\n item.trigger(event, [value]);\r\n if (event.isDefaultPrevented()) {\r\n return false;\r\n }\r\n\r\n itemdata('value', value);\r\n if (itemdata('backingfld')) {\r\n // If backing field is a select box with valuesrc option set to \"index\", update its selectedIndex property; otherwise, update its value.\r\n if (fld[0].nodeName == 'SELECT' && fld[0].getAttribute('data-rateit-valuesrc') === 'index') {\r\n $(itemdata('backingfld')).prop('selectedIndex', value).trigger('change');\r\n }\r\n else {\r\n $(itemdata('backingfld')).val(value).trigger('change');\r\n }\r\n }\r\n if (itemdata('ispreset')) { //if it was a preset value, unset that.\r\n range.find('.rateit-selected').removeClass(presetclass);\r\n itemdata('ispreset', false);\r\n }\r\n range.find('.rateit-hover').hide();\r\n range.find('.rateit-selected').width(value * itemdata('starwidth') - (itemdata('min') * itemdata('starwidth'))).show();\r\n item.trigger('hover', [null]).trigger('over', [null]).trigger('rated', [value]);\r\n return true;\r\n };\r\n\r\n if (!itemdata('readonly')) {\r\n //if we are not read only, add all the events\r\n\r\n //if we have a reset button, set the event handler.\r\n if (!itemdata('resetable')) {\r\n resetbtn.hide();\r\n }\r\n\r\n //when the mouse goes over the range element, we set the \"hover\" stars.\r\n if (!itemdata('wired')) {\r\n range.bind('touchmove touchend', touchHandler); //bind touch events\r\n range.mousemove(function (e) {\r\n var score = calcRawScore(this, e);\r\n setHover(score);\r\n });\r\n //when the mouse leaves the range, we have to hide the hover stars, and show the current value.\r\n range.mouseleave(function (e) {\r\n range.find('.rateit-hover').hide().width(0).data('width', '');\r\n item.trigger('hover', [null]).trigger('over', [null]);\r\n range.find('.rateit-selected').show();\r\n });\r\n //when we click on the range, we have to set the value, hide the hover.\r\n range.mouseup(function (e) {\r\n var score = calcRawScore(this, e);\r\n var value = (score * itemdata('step')) + itemdata('min');\r\n setSelection(value);\r\n range.blur();\r\n });\r\n\r\n //support key nav\r\n range.keyup(function (e) {\r\n if (e.which == 38 || e.which == (ltr ? 39 : 37)) {\r\n setSelection(Math.min(itemdata('value') + itemdata('step'), itemdata('max')));\r\n }\r\n if (e.which == 40 || e.which == (ltr ? 37 : 39)) {\r\n setSelection(Math.max(itemdata('value') - itemdata('step'), itemdata('min')));\r\n }\r\n });\r\n\r\n itemdata('wired', true);\r\n }\r\n if (itemdata('resetable')) {\r\n resetbtn.show();\r\n }\r\n }\r\n else {\r\n resetbtn.hide();\r\n }\r\n\r\n range.attr('aria-readonly', itemdata('readonly'));\r\n });\r\n };\r\n\r\n //touch converter http://ross.posterous.com/2008/08/19/iphone-touch-events-in-javascript/\r\n function touchHandler(event) {\r\n\r\n var touches = event.originalEvent.changedTouches,\r\n first = touches[0],\r\n type = \"\";\r\n switch (event.type) {\r\n case \"touchmove\": type = \"mousemove\"; break;\r\n case \"touchend\": type = \"mouseup\"; break;\r\n default: return;\r\n }\r\n\r\n var simulatedEvent = document.createEvent(\"MouseEvent\");\r\n simulatedEvent.initMouseEvent(type, true, true, window, 1,\r\n first.screenX, first.screenY,\r\n first.clientX, first.clientY, false,\r\n false, false, false, 0/*left*/, null);\r\n\r\n first.target.dispatchEvent(simulatedEvent);\r\n event.preventDefault();\r\n };\r\n\r\n //some default values.\r\n $.fn.rateit.defaults = { min: 0, max: 5, step: 0.5, mode: 'bg', icon: '★', starwidth: 16, starheight: 16, readonly: false, resetable: true, ispreset: false };\r\n\r\n //invoke it on all .rateit elements. This could be removed if not wanted.\r\n $(function () { $('div.rateit, span.rateit').rateit(); });\r\n\r\n})(jQuery);"]}
|
js/yasr-front.js
CHANGED
@@ -26,6 +26,14 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
|
26 |
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
});
|
30 |
|
31 |
|
@@ -80,7 +88,7 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
|
80 |
/*** End Yasr Visitor Votes ***/
|
81 |
|
82 |
|
83 |
-
function yasrVisitorsMultiSet (
|
84 |
|
85 |
//will have field id and vote
|
86 |
var ratingObject = "";
|
@@ -88,6 +96,10 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
|
88 |
//an array with all the ratingonjects
|
89 |
var ratingArray = [];
|
90 |
|
|
|
|
|
|
|
|
|
91 |
jQuery('.yasr-visitor-multi-'+postId+'-'+setType).on('rated', function() {
|
92 |
var el = jQuery(this);
|
93 |
var value = el.rateit('value');
|
@@ -125,7 +137,7 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
|
125 |
};
|
126 |
|
127 |
//Send value to the Server
|
128 |
-
jQuery.post(ajaxurl, data, function(response) {
|
129 |
jQuery('#yasr-loader-multiset-visitor-'+postId+'-'+setType).text(response);
|
130 |
});
|
131 |
|
26 |
|
27 |
}
|
28 |
|
29 |
+
|
30 |
+
if (typeof yasrMultiSetData !== 'undefined') {
|
31 |
+
|
32 |
+
yasrVisitorsMultiSet ();
|
33 |
+
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
});
|
38 |
|
39 |
|
88 |
/*** End Yasr Visitor Votes ***/
|
89 |
|
90 |
|
91 |
+
function yasrVisitorsMultiSet () {
|
92 |
|
93 |
//will have field id and vote
|
94 |
var ratingObject = "";
|
96 |
//an array with all the ratingonjects
|
97 |
var ratingArray = [];
|
98 |
|
99 |
+
var postId = yasrCommonData.postid;
|
100 |
+
var setType = yasrMultiSetData.setType;
|
101 |
+
var nonce = yasrMultiSetData.nonceVisitor;
|
102 |
+
|
103 |
jQuery('.yasr-visitor-multi-'+postId+'-'+setType).on('rated', function() {
|
104 |
var el = jQuery(this);
|
105 |
var value = el.rateit('value');
|
137 |
};
|
138 |
|
139 |
//Send value to the Server
|
140 |
+
jQuery.post(yasrCommonData.ajaxurl, data, function(response) {
|
141 |
jQuery('#yasr-loader-multiset-visitor-'+postId+'-'+setType).text(response);
|
142 |
});
|
143 |
|
lib/yasr-admin-actions.php
CHANGED
@@ -35,6 +35,7 @@ add_filter('yasr_filter_style_options', 'yasr_filter_style_options_callback');
|
|
35 |
}
|
36 |
|
37 |
|
|
|
38 |
//Add stars set for yasr stle settings page
|
39 |
//from version 1.2.7
|
40 |
add_action('yasr_style_options_add_settings_field', 'yasr_style_options_add_settings_field_callback');
|
35 |
}
|
36 |
|
37 |
|
38 |
+
|
39 |
//Add stars set for yasr stle settings page
|
40 |
//from version 1.2.7
|
41 |
add_action('yasr_style_options_add_settings_field', 'yasr_style_options_add_settings_field_callback');
|
lib/yasr-ajax-functions.php
CHANGED
@@ -1164,13 +1164,14 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
1164 |
|
1165 |
}
|
1166 |
else {
|
1167 |
-
|
1168 |
}
|
1169 |
|
1170 |
if ( ! wp_verify_nonce( $nonce, 'yasr_nonce_insert_visitor_rating_multiset' ) ) {
|
1171 |
-
die( 'Security check' );
|
1172 |
}
|
1173 |
|
|
|
1174 |
delete_transient( 'yasr_visitor_multi_set_' . $post_id . '_' . $set_type );
|
1175 |
|
1176 |
global $wpdb;
|
1164 |
|
1165 |
}
|
1166 |
else {
|
1167 |
+
exit();
|
1168 |
}
|
1169 |
|
1170 |
if ( ! wp_verify_nonce( $nonce, 'yasr_nonce_insert_visitor_rating_multiset' ) ) {
|
1171 |
+
//die( 'Security check' );
|
1172 |
}
|
1173 |
|
1174 |
+
|
1175 |
delete_transient( 'yasr_visitor_multi_set_' . $post_id . '_' . $set_type );
|
1176 |
|
1177 |
global $wpdb;
|
lib/yasr-functions.php
CHANGED
@@ -295,7 +295,7 @@ function yasr_css_stars_set() {
|
|
295 |
|
296 |
if (!is_admin()) {
|
297 |
|
298 |
-
add_filter('the_content', 'yasr_auto_insert_shortcode_callback'
|
299 |
|
300 |
}
|
301 |
|
295 |
|
296 |
if (!is_admin()) {
|
297 |
|
298 |
+
add_filter('the_content', 'yasr_auto_insert_shortcode_callback');
|
299 |
|
300 |
}
|
301 |
|
lib/yasr-shortcode-functions.php
CHANGED
@@ -25,74 +25,74 @@ add_shortcode ('yasr_overall_rating', 'shortcode_overall_rating_callback');
|
|
25 |
|
26 |
function shortcode_overall_rating_callback ($atts) {
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
<!--Yasr Overall Rating Shortcode-->
|
50 |
';
|
51 |
|
52 |
-
|
53 |
|
54 |
-
|
55 |
|
56 |
-
|
57 |
<span id=\"yasr-custom-text-before-overall\">" . $text_before_star . "</span>";
|
58 |
|
59 |
-
|
60 |
|
61 |
-
|
62 |
|
63 |
-
|
64 |
|
65 |
|
66 |
-
|
67 |
|
68 |
-
|
69 |
|
70 |
-
|
71 |
|
72 |
-
|
73 |
<!--End Yasr Overall Rating Shortcode-->
|
74 |
';
|
75 |
|
76 |
|
77 |
-
|
78 |
-
|
79 |
|
80 |
-
|
81 |
|
82 |
-
|
83 |
|
84 |
-
|
85 |
-
|
86 |
|
87 |
-
|
88 |
|
89 |
-
|
90 |
|
91 |
-
|
92 |
|
93 |
-
|
94 |
|
95 |
-
|
96 |
|
97 |
|
98 |
/****** Add shortcode for user vote ******/
|
@@ -571,9 +571,9 @@ function yasr_visitor_multiset_callback ( $atts ) {
|
|
571 |
|
572 |
if (isset($_COOKIE[$cookiename])) {
|
573 |
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
|
578 |
}
|
579 |
|
@@ -755,35 +755,17 @@ function yasr_visitor_multiset_callback ( $atts ) {
|
|
755 |
}
|
756 |
|
757 |
|
758 |
-
$var_post_id = json_encode($post_id);
|
759 |
-
$var_set_id = json_encode($setid);
|
760 |
-
$var_ajax_url = json_encode(admin_url('admin-ajax.php'));
|
761 |
$var_ajax_nonce_visitor_multiset = json_encode($ajax_nonce_visitor_multiset);
|
762 |
|
763 |
$shortcode_html .= '
|
764 |
<!-- End Yasr Multi Set Shortcode-->
|
765 |
';
|
766 |
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
var postId = $var_post_id;
|
774 |
-
var setType = $setid;
|
775 |
-
var ajaxurl = $var_ajax_url;
|
776 |
-
var nonce = $var_ajax_nonce_visitor_multiset;
|
777 |
-
|
778 |
-
yasrVisitorsMultiSet (postId, setType, ajaxurl, nonce);
|
779 |
-
|
780 |
-
});
|
781 |
-
|
782 |
-
</script>
|
783 |
-
";
|
784 |
-
|
785 |
-
return $shortcode_html . $javascript;
|
786 |
-
|
787 |
|
788 |
return $shortcode_html;
|
789 |
|
@@ -961,21 +943,6 @@ add_shortcode ('yasr_most_or_highest_rated_posts', 'yasr_most_or_highest_rated_p
|
|
961 |
$shortcode_html = __("You've not enought data",'yet-another-stars-rating') . "<br />";
|
962 |
}
|
963 |
|
964 |
-
?>
|
965 |
-
|
966 |
-
<script type="text/javascript">
|
967 |
-
|
968 |
-
document.addEventListener('DOMContentLoaded', function(event) {
|
969 |
-
|
970 |
-
yasrMostOrHighestRatedChart ();
|
971 |
-
|
972 |
-
});
|
973 |
-
|
974 |
-
|
975 |
-
</script>
|
976 |
-
|
977 |
-
<?php
|
978 |
-
|
979 |
$shortcode_html .= '
|
980 |
<!-- End Yasr Most Or Highest Rated Shortcode-->
|
981 |
';
|
25 |
|
26 |
function shortcode_overall_rating_callback ($atts) {
|
27 |
|
28 |
+
if (YASR_SHOW_OVERALL_IN_LOOP === 'disabled' && !is_singular() && is_main_query()) {
|
29 |
|
30 |
+
return;
|
31 |
|
32 |
+
}
|
33 |
|
34 |
+
extract( shortcode_atts (
|
35 |
+
array(
|
36 |
+
'size' => 'large',
|
37 |
+
'postid' => FALSE
|
38 |
+
), $atts )
|
39 |
+
);
|
40 |
|
41 |
+
$overall_rating = yasr_get_overall_rating($postid);
|
42 |
|
43 |
+
//if still false
|
44 |
+
if (!$overall_rating) {
|
45 |
+
$overall_rating = "-1";
|
46 |
+
}
|
47 |
|
48 |
+
$shortcode_html = '
|
49 |
<!--Yasr Overall Rating Shortcode-->
|
50 |
';
|
51 |
|
52 |
+
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
|
53 |
|
54 |
+
$text_before_star = str_replace('%overall_rating%', $overall_rating, YASR_TEXT_BEFORE_OVERALL);
|
55 |
|
56 |
+
$shortcode_html = "<div class=\"yasr-container-custom-text-and-overall\">
|
57 |
<span id=\"yasr-custom-text-before-overall\">" . $text_before_star . "</span>";
|
58 |
|
59 |
+
}
|
60 |
|
61 |
+
$stars_attribute = yasr_stars_size($size);
|
62 |
|
63 |
+
$shortcode_html .= "<div class=\"$stars_attribute[class]\" id=\"yasr_rateit_overall\" data-rateit-starwidth=\"$stars_attribute[px_size]\" data-rateit-starheight=\"$stars_attribute[px_size]\" data-rateit-value=\"$overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>";
|
64 |
|
65 |
|
66 |
+
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
|
67 |
|
68 |
+
$shortcode_html .= "</div>";
|
69 |
|
70 |
+
}
|
71 |
|
72 |
+
$shortcode_html .= '
|
73 |
<!--End Yasr Overall Rating Shortcode-->
|
74 |
';
|
75 |
|
76 |
|
77 |
+
//If overall rating in loop is enabled don't use is_singular && is main_query
|
78 |
+
if ( YASR_SHOW_OVERALL_IN_LOOP === 'enabled' ) {
|
79 |
|
80 |
+
return $shortcode_html;
|
81 |
|
82 |
+
}
|
83 |
|
84 |
+
//default
|
85 |
+
else {
|
86 |
|
87 |
+
if( is_singular() && is_main_query() ) {
|
88 |
|
89 |
+
return $shortcode_html;
|
90 |
|
91 |
+
}
|
92 |
|
93 |
+
}
|
94 |
|
95 |
+
} //end function
|
96 |
|
97 |
|
98 |
/****** Add shortcode for user vote ******/
|
571 |
|
572 |
if (isset($_COOKIE[$cookiename])) {
|
573 |
|
574 |
+
$button = "";
|
575 |
+
$star_readonly = 'true';
|
576 |
+
$span_message_content = __('Thank you for voting! ', 'yet-another-stars-rating');
|
577 |
|
578 |
}
|
579 |
|
755 |
}
|
756 |
|
757 |
|
|
|
|
|
|
|
758 |
$var_ajax_nonce_visitor_multiset = json_encode($ajax_nonce_visitor_multiset);
|
759 |
|
760 |
$shortcode_html .= '
|
761 |
<!-- End Yasr Multi Set Shortcode-->
|
762 |
';
|
763 |
|
764 |
+
wp_localize_script( 'yasrfront', "yasrMultiSetData", array(
|
765 |
+
'nonceVisitor' => $var_ajax_nonce_visitor_multiset,
|
766 |
+
'setType' => $setid
|
767 |
+
)
|
768 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
|
770 |
return $shortcode_html;
|
771 |
|
943 |
$shortcode_html = __("You've not enought data",'yet-another-stars-rating') . "<br />";
|
944 |
}
|
945 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
946 |
$shortcode_html .= '
|
947 |
<!-- End Yasr Most Or Highest Rated Shortcode-->
|
948 |
';
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: 5 star, admin, administrator, AJAX, five-star, javascript, jquery, post r
|
|
4 |
Requires at least: 4.3.0
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 4.9.4
|
7 |
-
Stable tag: 1.5.
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Yet Another Stars Rating is a simple plugin which allows you and / or your visitor to rate a post or element. Ideal for review's website
|
@@ -107,6 +107,9 @@ Of course not: you can easily add it on the visual editor just by clicking the "
|
|
107 |
|
108 |
The full changelog can be found in the plugin's directory. Recent entries:
|
109 |
|
|
|
|
|
|
|
110 |
= 1.5.3 =
|
111 |
* FIXED: var_dump string appear after visitor vote
|
112 |
|
4 |
Requires at least: 4.3.0
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 4.9.4
|
7 |
+
Stable tag: 1.5.4
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Yet Another Stars Rating is a simple plugin which allows you and / or your visitor to rate a post or element. Ideal for review's website
|
107 |
|
108 |
The full changelog can be found in the plugin's directory. Recent entries:
|
109 |
|
110 |
+
= 1.5.4 =
|
111 |
+
* TWEAKED: removed jacasvript for yasr_visitor_multiset shortcode, use wp_localize_script instead
|
112 |
+
|
113 |
= 1.5.3 =
|
114 |
* FIXED: var_dump string appear after visitor vote
|
115 |
|
yet-another-stars-rating.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Yet Another Stars Rating
|
4 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
5 |
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
|
6 |
-
* Version: 1.5.
|
7 |
* Author: Dario Curvino
|
8 |
* Author URI: https://yetanotherstarsrating.com/
|
9 |
* Text Domain: yet-another-stars-rating
|
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
31 |
|
32 |
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
|
33 |
|
34 |
-
define('YASR_VERSION_NUM', '1.5.
|
35 |
|
36 |
//Plugin relative path
|
37 |
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
|
3 |
* Plugin Name: Yet Another Stars Rating
|
4 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
5 |
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
|
6 |
+
* Version: 1.5.4
|
7 |
* Author: Dario Curvino
|
8 |
* Author URI: https://yetanotherstarsrating.com/
|
9 |
* Text Domain: yet-another-stars-rating
|
31 |
|
32 |
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
|
33 |
|
34 |
+
define('YASR_VERSION_NUM', '1.5.4');
|
35 |
|
36 |
//Plugin relative path
|
37 |
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
|