Version Description
- TWEAKED: added new filters yasr_custom_loader and yasr_custom_loader_url to customize loader
- FIXED: better ajax response when data is imported from another plugin
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 3.1.2 |
Comparing to | |
See all releases |
Code changes from version 3.1.1 to 3.1.2
admin/js/src/yasr-settings-page.js
CHANGED
@@ -146,8 +146,7 @@ if (activeTab === 'migration_tools') {
|
|
146 |
jQuery('#yasr-import-ratemypost-submit').on('click', function () {
|
147 |
|
148 |
//show loader on click
|
149 |
-
document.getElementById('yasr-import-ratemypost-answer').innerHTML =
|
150 |
-
'<img src="' + yasrWindowVar.loaderUrl + '" alt="yasr-loader" width="16" height="16">';
|
151 |
|
152 |
var nonce = document.getElementById('yasr-import-rmp-nonce').value;
|
153 |
|
@@ -166,8 +165,7 @@ if (activeTab === 'migration_tools') {
|
|
166 |
jQuery('#yasr-import-wppr-submit').on('click', function () {
|
167 |
|
168 |
//show loader on click
|
169 |
-
document.getElementById('yasr-import-wppr-answer').innerHTML =
|
170 |
-
'<img src="' + yasrWindowVar.loaderUrl + '" alt="yasr-loader" width="16" height="16">';
|
171 |
|
172 |
var nonce = document.getElementById('yasr-import-wppr-nonce').value;
|
173 |
|
@@ -177,7 +175,7 @@ if (activeTab === 'migration_tools') {
|
|
177 |
};
|
178 |
|
179 |
jQuery.post(ajaxurl, data, function (response) {
|
180 |
-
|
181 |
document.getElementById('yasr-import-wppr-answer').innerHTML = response;
|
182 |
});
|
183 |
|
@@ -186,8 +184,7 @@ if (activeTab === 'migration_tools') {
|
|
186 |
jQuery('#yasr-import-kksr-submit').on('click', function () {
|
187 |
|
188 |
//show loader on click
|
189 |
-
document.getElementById('yasr-import-kksr-answer').innerHTML =
|
190 |
-
'<img src="' + yasrWindowVar.loaderUrl + '" alt="yasr-loader" width="16" height="16">';
|
191 |
|
192 |
var nonce = document.getElementById('yasr-import-kksr-nonce').value;
|
193 |
|
@@ -197,7 +194,7 @@ if (activeTab === 'migration_tools') {
|
|
197 |
};
|
198 |
|
199 |
jQuery.post(ajaxurl, data, function (response) {
|
200 |
-
|
201 |
document.getElementById('yasr-import-kksr-answer').innerHTML = response;
|
202 |
});
|
203 |
|
@@ -207,8 +204,7 @@ if (activeTab === 'migration_tools') {
|
|
207 |
jQuery('#yasr-import-mr-submit').on('click', function () {
|
208 |
|
209 |
//show loader on click
|
210 |
-
document.getElementById('yasr-import-mr-answer').innerHTML =
|
211 |
-
'<img src="' + yasrWindowVar.loaderUrl + '" alt="yasr-loader" width="16" height="16">';
|
212 |
|
213 |
var nonce = document.getElementById('yasr-import-mr-nonce').value;
|
214 |
|
@@ -218,7 +214,7 @@ if (activeTab === 'migration_tools') {
|
|
218 |
};
|
219 |
|
220 |
jQuery.post(ajaxurl, data, function (response) {
|
221 |
-
|
222 |
document.getElementById('yasr-import-mr-answer').innerHTML = response;
|
223 |
});
|
224 |
|
146 |
jQuery('#yasr-import-ratemypost-submit').on('click', function () {
|
147 |
|
148 |
//show loader on click
|
149 |
+
document.getElementById('yasr-import-ratemypost-answer').innerHTML = yasrWindowVar.loaderHtml;
|
|
|
150 |
|
151 |
var nonce = document.getElementById('yasr-import-rmp-nonce').value;
|
152 |
|
165 |
jQuery('#yasr-import-wppr-submit').on('click', function () {
|
166 |
|
167 |
//show loader on click
|
168 |
+
document.getElementById('yasr-import-wppr-answer').innerHTML = yasrWindowVar.loaderHtml;
|
|
|
169 |
|
170 |
var nonce = document.getElementById('yasr-import-wppr-nonce').value;
|
171 |
|
175 |
};
|
176 |
|
177 |
jQuery.post(ajaxurl, data, function (response) {
|
178 |
+
response = JSON.parse(response);
|
179 |
document.getElementById('yasr-import-wppr-answer').innerHTML = response;
|
180 |
});
|
181 |
|
184 |
jQuery('#yasr-import-kksr-submit').on('click', function () {
|
185 |
|
186 |
//show loader on click
|
187 |
+
document.getElementById('yasr-import-kksr-answer').innerHTML = yasrWindowVar.loaderHtml;
|
|
|
188 |
|
189 |
var nonce = document.getElementById('yasr-import-kksr-nonce').value;
|
190 |
|
194 |
};
|
195 |
|
196 |
jQuery.post(ajaxurl, data, function (response) {
|
197 |
+
response = JSON.parse(response);
|
198 |
document.getElementById('yasr-import-kksr-answer').innerHTML = response;
|
199 |
});
|
200 |
|
204 |
jQuery('#yasr-import-mr-submit').on('click', function () {
|
205 |
|
206 |
//show loader on click
|
207 |
+
document.getElementById('yasr-import-mr-answer').innerHTML = yasrWindowVar.loaderHtml;
|
|
|
208 |
|
209 |
var nonce = document.getElementById('yasr-import-mr-nonce').value;
|
210 |
|
214 |
};
|
215 |
|
216 |
jQuery.post(ajaxurl, data, function (response) {
|
217 |
+
response = JSON.parse(response);
|
218 |
document.getElementById('yasr-import-mr-answer').innerHTML = response;
|
219 |
});
|
220 |
|
admin/js/yasr-settings.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(()=>{var e={726:function(e,t,r){"use strict";var a;!function(n){if("function"!=typeof s){var s=function(e){return e};s.nonNative=!0}const o=s("plaintext"),i=s("html"),l=s("comment"),d=/<(\w*)>/g,c=/<\/?([^\s\/>]+)/;function u(e,t,r){return y(e=e||"",m(t=t||[],r=r||""))}function m(e,t){return{allowable_tags:e=function(e){let t=new Set;if("string"==typeof e){let r;for(;r=d.exec(e);)t.add(r[1])}else s.nonNative||"function"!=typeof e[s.iterator]?"function"==typeof e.forEach&&e.forEach(t.add,t):t=new Set(e);return t}(e),tag_replacement:t,state:o,tag_buffer:"",depth:0,in_quote_char:""}}function y(e,t){if("string"!=typeof e)throw new TypeError("'html' parameter must be a string");let r=t.allowable_tags,a=t.tag_replacement,n=t.state,s=t.tag_buffer,d=t.depth,c=t.in_quote_char,u="";for(let t=0,m=e.length;t<m;t++){let m=e[t];if(n===o)if("<"===m)n=i,s+=m;else u+=m;else if(n===i)switch(m){case"<":if(c)break;d++;break;case">":if(c)break;if(d){d--;break}c="",n=o,s+=">",r.has(p(s))?u+=s:u+=a,s="";break;case'"':case"'":c=m===c?"":c||m,s+=m;break;case"-":"<!-"===s&&(n=l),s+=m;break;case" ":case"\n":if("<"===s){n=o,u+="< ",s="";break}s+=m;break;default:s+=m}else if(n===l)if(">"===m)"--"==s.slice(-2)&&(n=o),s="";else s+=m}return t.state=n,t.tag_buffer=s,t.depth=d,t.in_quote_char=c,u}function p(e){let t=c.exec(e);return t?t[1].toLowerCase():null}u.init_streaming_mode=function(e,t){let r=m(e=e||[],t=t||"");return function(e){return y(e||"",r)}},void 0===(a=function(){return u}.call(t,r,t,e))||(e.exports=a)}()}},t={};function r(a){var n=t[a];if(void 0!==n)return n.exports;var s=t[a]={exports:{}};return e[a].call(s.exports,s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;if(document.getElementsByClassName("nav-tab-active").length>0&&(e=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===e){var t=document.getElementById("yasr_auto_insert_switch").checked,r=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===t&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===r&&jQuery(".yasr-stars-title-options-class").prop("disabled",!0),document.getElementById("yasr_auto_insert_switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-auto-insert-options-class").prop("disabled",!1):jQuery(".yasr-auto-insert-options-class").prop("disabled",!0)})),document.getElementById("yasr-general-options-stars-title-switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-stars-title-options-class").prop("disabled",!1):jQuery(".yasr-stars-title-options-class").prop("disabled",!0)})),document.getElementById("yasr-settings-custom-texts").addEventListener("click",(function(){document.getElementById("yasr-settings-custom-text-before-overall").value="Our Score",document.getElementById("yasr-settings-custom-text-before-visitor").value="Click to rate this post!",document.getElementById("yasr-settings-custom-text-after-visitor").value="[Total: %total_count% Average: %average%]",document.getElementById("yasr-settings-custom-text-rating-saved").value="Rating saved!",document.getElementById("yasr-settings-custom-text-rating-updated").value="Rating updated!",document.getElementById("yasr-settings-custom-text-must-sign-in").value="You must sign in to vote",document.getElementById("yasr-settings-custom-text-already-rated").value="You have already voted for this article with %rating%"}))}if("style_options"===e&&(wp.codeEditor.initialize(document.getElementById("yasr_style_options_textarea"),yasr_cm_settings),jQuery("#yasr-color-scheme-preview-link").on("click",(function(){return jQuery("#yasr-color-scheme-preview").toggle("slow"),!1})),wp.hooks.doAction("yasrStyleOptions")),"manage_multi"===e){var a=parseInt(document.getElementById("n-multiset").value);if(jQuery("#yasr-multi-set-doc-link").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),jQuery("#yasr-multi-set-doc-link-hide").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),1===a){var n=jQuery("#yasr-edit-form-number-elements").attr("value");n++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(n>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var e=jQuery(document.createElement("tr"));e.html('<td colspan="2">Element #'+n+' <input type="text" name="edit-multi-set-element-'+n+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),n++}))}else a>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var e={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(e)})),!1})),jQuery(document).ajaxComplete((function(){var e=jQuery("#yasr-edit-form-number-elements").attr("value");e++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(e>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var t=jQuery(document.createElement("tr"));t.html('<td colspan="2">Element #'+e+' <input type="text" name="edit-multi-set-element-'+e+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),e++}))})))}"migration_tools"===e&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML='<img src="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';var e={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-ratemypost-answer").innerHTML=e}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML='<img src="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML='<img src="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML='<img src="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-mr-answer").innerHTML=e}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===e&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{"use strict";let e;var t,a=function(t){var r=t.colClass,a=t.post,n=a.link,s=a.title;return React.createElement("td",{className:r},React.createElement("a",{href:n},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===e&&(e=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),e.innerHTML=t;const r=e.textContent;return e.innerHTML="",r}(s)))},n=new Uint8Array(16);function s(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(n)}const o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const i=function(e){return"string"==typeof e&&o.test(e)};for(var l=[],d=0;d<256;++d)l.push((d+256).toString(16).substr(1));const c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase();if(!i(r))throw TypeError("Stringified UUID is invalid");return r};const u=function(e,t,r){var a=(e=e||{}).random||(e.rng||s)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){r=r||0;for(var n=0;n<16;++n)t[r+n]=a[n];return t}return c(a)};var m=r(726),y=r.n(m),p=function(e){var t=e.html;return React.createElement("div",{dangerouslySetInnerHTML:{__html:y()(t,"<strong><p>")}})},g=function(e){var t=e.post,r=t.number_of_votes,a=t.rating,n=e.text;if(void 0!==r){var s=JSON.parse(yasrWindowVar.textAfterVr);return s=(s=s.replace("%total_count%",r)).replace("%average%",a),React.createElement("div",{className:"yasr-most-rated-text"},React.createElement(p,{html:s}))}return React.createElement("span",null,n," ",a)},f=function(e){var t=e.size,r=e.htmlId,a=e.element,n=e.step,s=e.readonly,o=e.rating;return React.createElement("div",{id:r,ref:function(){return yasrSetRaterValue(t,r,a,n,s,o)}})},h=function(e){var t=e.rankingParams,r=e.tableId,a=e.colClass,n=e.post,s="after",o=JSON.parse(yasrWindowVar.textRating),i=new URLSearchParams(t);null!==i.get("text_position")&&(s=i.get("text_position")),null!==i.get("custom_txt")&&(o=i.get("custom_txt"));var l={rating:n.rating,htmlId:"yasr-ranking-element-"+u(),size:document.getElementById(r).dataset.rankingSize};return"before"===s?React.createElement("td",{className:a},React.createElement(g,{post:n,text:o}),React.createElement(f,l)):React.createElement("td",{className:a},React.createElement(f,l),React.createElement(g,{post:n,text:o}))},v=function(e){var t={colClass:e.leftClass,post:e.post},r={rankingParams:e.rankingParams,tableId:e.tableId,colClass:e.rightClass,post:e.post};return React.createElement("tr",{className:e.trClass},React.createElement(a,t),React.createElement(h,r))},_=function(e){var t=e.tBodyId,r=e.show,a=e.data,n=e.source,s=e.rankingParams,o=e.tableId;return React.createElement("tbody",{id:t,style:{display:r}},a.map((function(e,t){var r="yasr-rankings-td-colored",a="yasr-top-10-most-highest-left",i="yasr-top-10-most-highest-right";return"author_ranking"===n&&(r="yasr-rankings-td-white",a="yasr-top-10-overall-left",i="yasr-top-10-overall-right"),t%2==0&&(r="yasr-rankings-td-white","author_ranking"===n&&(r="yasr-rankings-td-colored")),React.createElement(v,{key:e.post_id,source:n,tableId:o,rankingParams:s,post:e,trClass:r,leftClass:a,rightClass:i})})))},E=function(e){return function(t){t.preventDefault();var r=t.target.id,a=e.tableId,n="link-most-rated-posts-"+a,s="link-highest-rated-posts-"+a,o="most-rated-posts-"+a,i="highest-rated-posts-"+a,l=document.getElementById(r),d=document.createElement("span");d.innerHTML=l.innerHTML,d.id=l.id,l.parentNode.replaceChild(d,l),r===n&&(document.getElementById(i).style.display="none",document.getElementById(o).style.display="",d=document.getElementById(s),l.innerHTML=d.innerHTML,l.id=d.id,d.parentNode.replaceChild(l,d)),r===s&&(document.getElementById(o).style.display="none",document.getElementById(i).style.display="",d=document.getElementById(n),l.innerHTML=d.innerHTML,l.id=d.id,d.parentNode.replaceChild(l,d))}},b=function(e){var t=e.tableId,r=e.source,a=e.defaultView,n="link-most-rated-posts-"+t,s="link-highest-rated-posts-"+t;if("author_ranking"!==r){var o=React.createElement("span",null,React.createElement("span",{id:n},JSON.parse(yasrWindowVar.textMostRated))," | ",React.createElement("a",{href:"#",id:s,onClick:E(e)},JSON.parse(yasrWindowVar.textHighestRated)));return"highest"===a&&(o=React.createElement("span",null,React.createElement("span",{id:s},JSON.parse(yasrWindowVar.textHighestRated))," | ",React.createElement("a",{href:"#",id:n,onClick:E(e)},JSON.parse(yasrWindowVar.textMostRated)))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,JSON.parse(yasrWindowVar.textLeftColumnHeader)),React.createElement("th",null,JSON.parse(yasrWindowVar.textOrderBy),": ",o)))}return React.createElement(React.Fragment,null)},w=function(e){var t=e.error,r=e.isLoaded,a=e.data,n=e.source,s=e.rankingParams,o=e.tableId;if(t)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error")));if(!1===r)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,JSON.parse(yasrWindowVar.textLoadRanking))));if("overall_rating"===n||"author_multi"===n)return React.createElement(_,{data:a,tableId:o,tBodyId:"overall_"+o,rankingParams:s,show:"table-row-group",source:n});var i=a.most,l=a.highest,d="table-row-group",c="none",u="most",m=d,y=c,p=new URLSearchParams(s);return null!==p.get("view")&&(u=p.get("view")),"highest"===u&&(m=c,y=d),React.createElement(React.Fragment,null,React.createElement(b,{tableId:o,source:n,defaultView:u}),React.createElement(_,{data:i,tableId:o,tBodyId:"most-rated-posts-"+o,rankingParams:s,show:m,source:n}),React.createElement(_,{data:l,tableId:o,tBodyId:"highest-rated-posts-"+o,rankingParams:s,show:y,source:n}))};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},k.apply(this,arguments)}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,n,s=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(s.push(a.value),!t||s.length!==t);o=!0);}catch(e){i=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw n}}return s}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}var x=wp.element,j=x.useState,R=x.useEffect,C=function(e,t,r){var a=t,n="&nonce_rankings="+r,s=function(e,t){var r="";if(""!==e&&!1!==e){var a=new URLSearchParams(e);null!==a.get("order_by")&&(r+="order_by="+a.get("order_by")),null!==a.get("limit")&&(r+="&limit="+a.get("limit")),null!==a.get("start_date")&&"0"!==a.get("start_date")&&(r+="&start_date="+a.get("start_date")),null!==a.get("end_date")&&"0"!==a.get("end_date")&&(r+="&end_date="+a.get("end_date")),null!==a.get("ctg")?r+="&ctg="+a.get("ctg"):null!==a.get("cpt")&&(r+="&cpt="+a.get("cpt")),""!==r&&(r="&"+(r=r.replace(/\s+/g,""))),"visitor_multi"!==t&&"author_multi"!==t||null!==a.get("setid")&&(r+="&setid="+a.get("setid")),"visitor_votes"===t&&(null!==a.get("required_votes[most]")&&(r="&required_votes="+a.get("required_votes[most]")),null!==a.get("required_votes[highest]")&&(r="&required_votes="+a.get("required_votes[highest]")))}return r}(""!==e?e:"",a);return"author_ranking"===a||"author_multi"===a||"overall_rating"===a?[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+a+s+n]:[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+s+n,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+s+n]},Q=function(e){var t=e.tableId,r=e.source,a=e.params,n=e.nonce,s={tableId:t,source:r,rankingParams:a},o=I(j(null),2),i=o[0],l=o[1],d=I(j(!1),2),c=d[0],u=d[1],m=I(j([]),2),y=m[0],p=m[1],g=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=JSON.parse(document.getElementById(t).dataset.rankingData);!0===e&&console.info("Ajax Disabled, getting data from source"),p(r)};return R((function(){var e,t;"yes"!==yasrWindowVar.ajaxEnabled?(g(!0),u(!0)):r?(e=[],t=C(a,r,n),Promise.all(t.map((function(t){return fetch(t).then((function(e){return!0===e.ok?e.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(t){"KO"===t?g():("overall_rating"===t.source||"author_multi"===t.source?e="overall_rating"===t.source?t.data_overall:t.data_mv:e[t.show]=t.data_vv,p(e))})).catch((function(e){g(),console.info(e)}))}))).then((function(e){u(!0)})).catch((function(e){g(),console.info(e)}))):l("Invalid Data Source")}),[]),React.createElement(React.Fragment,null,React.createElement(w,k({error:i,isLoaded:c,data:y},s)))},S=wp.element.render,L=function(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var r=e.item(t).id,a=JSON.parse(e.item(t).dataset.rankingSource),n=JSON.parse(e.item(t).dataset.rankingParams),s=JSON.parse(e.item(t).dataset.rankingNonce),o=document.getElementById(r);S(React.createElement(Q,{source:a,tableId:r,params:n,nonce:s}),o)}};L();tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"});var N,O=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(N=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===N){var T,V=function(e){var t=K.value,r=document.getElementById("yasr-builder-shortcode").textContent,a=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];a=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",a),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+r).then((function(e){return!0===e.ok?e.json():(console.info(O("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(e){console.info(e)})).then((function(e){if("KO"!==e){var t=document.createElement("div");t.innerHTML=e,F.childNodes.length>0?F.replaceChild(t,F.childNodes[0]):F.appendChild(t)}})).then((function(e){a.forEach((function(e){t===e&&L()}))}))},M=function(e,t,r,a,n,s,o,i,l){e.style.display="",t.style.display="",s.style.display="",l.style.display="",r.style.display="none",a.style.display="none",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},H=function(e,t,r,a,n,s,o,i,l){r.style.display="",a.style.display="",t.style.display="",s.style.display="",l.style.display="",e.style.display="none",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},P=function(e,t,r,a,n,s,o,i,l){n.style.display="",l.style.display="none",e.style.display="none",r.style.display="none",a.style.display="none",t.style.display="none",s.style.display="none",null!==o&&(o.style.display="none"),null!==i&&(i.style.display="none")},A=function(e,t,r,a,n,s,o,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],d=arguments.length>9?arguments[9]:void 0;!0===l?(X.className="",X.classList.add("yasr-settings-row-24"),r.style.display="",a.style.display="",e.style.display="none"):(r.style.display="none",a.style.display="none",e.style.display=""),s.style.display="",t.style.display="",d.style.display="",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="")},W=".yasr-builder-elements-parents",J=".yasr-builder-elements-childs";jQuery(W).prop("disabled",!0),jQuery(J).prop("disabled",!0),jQuery(W).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",W,J);var q=[],U={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};T=U.name,document.getElementById("yasr-builder-shortcode").textContent="["+T+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+T+"]");var z=document.getElementById("yasr-builder-button-preview"),D=document.getElementById("yasr-builder-copy-shortcode"),F=document.getElementById("yasr-builder-preview"),K=document.getElementById("yasr-ranking-source"),Y=document.getElementById("yasr-ranking-multiset-select"),$=document.getElementById("yasr-builder-datepicker-start"),G=document.getElementById("yasr-builder-datepicker-end"),X=document.getElementById("yasr-builder-params-container"),Z=document.getElementById("builder-vv-default-view"),ee=document.getElementById("builder-vv-required-votes"),te=document.getElementById("builder-stars-size"),re=document.getElementById("builder-overall-text"),ae=document.getElementById("builder-username-options"),ne=document.getElementById("builder-category"),se=document.getElementById("builder-cpt"),oe=document.getElementById("yasr-ranking-multiset"),ie=document.getElementById("yasr-builder-datepicker"),le=K.value,de=!1;$.value="",G.value="","yasr_ov_ranking"===le?M(re,te,Z,ee,ae,ne,se,oe,ie):"yasr_most_active_users"===le||"yasr_top_reviewers"===le?P(re,te,Z,ee,ae,ne,se,oe,ie):"yasr_multi_set_ranking"===le?A(re,te,Z,ee,ae,ne,se,oe,!1,ie):"yasr_visitor_multi_set_ranking"===le?A(re,te,Z,ee,ae,ne,se,oe,!0,ie):H(re,te,Z,ee,ae,ne,se,oe,ie),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)X.className="",X.classList.add("yasr-settings-row-33"),F.innerHTML="",$.value="",G.value="",U={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""},"yasr_ov_ranking"===e.target.value?M(re,te,Z,ee,ae,ne,se,oe,ie):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?P(re,te,Z,ee,ae,ne,se,oe,ie):"yasr_multi_set_ranking"===e.target.value?(A(re,te,Z,ee,ae,ne,se,oe,!1,ie),U.setid=" setid="+Y[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(A(re,te,Z,ee,ae,ne,se,oe,!0,ie),U.setid=" setid="+Y[0].value):H(re,te,Z,ee,ae,ne,se,oe,ie),U.name=e.target.value,T=U.name+U.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(U.setid=" setid="+e.target.value),q=wp.hooks.applyFilters("yasrBuilderFilterShortcode",U);for(var t=2;U.length;t++)q.hasOwnProperty(U[t])&&(U[t]=q[t]);T=U.name+U.setid+U.rows+U.view+U.minvotesmost+U.minvoteshg+U.size+U.txtPosition+U.txt+U.display+U.start_date+U.end_date+U.category+U.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+T+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+T+"]"),!0===de&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&V()})),D.onclick=function(e){!function(e){var t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}(document.getElementById(e.target.id).getAttribute("data-shortcode"))},z.onclick=function(e){V(),de=!0}}})()})();
|
1 |
+
(()=>{var e={726:function(e,t,r){"use strict";var n;!function(a){if("function"!=typeof s){var s=function(e){return e};s.nonNative=!0}const o=s("plaintext"),i=s("html"),l=s("comment"),d=/<(\w*)>/g,c=/<\/?([^\s\/>]+)/;function u(e,t,r){return y(e=e||"",m(t=t||[],r=r||""))}function m(e,t){return{allowable_tags:e=function(e){let t=new Set;if("string"==typeof e){let r;for(;r=d.exec(e);)t.add(r[1])}else s.nonNative||"function"!=typeof e[s.iterator]?"function"==typeof e.forEach&&e.forEach(t.add,t):t=new Set(e);return t}(e),tag_replacement:t,state:o,tag_buffer:"",depth:0,in_quote_char:""}}function y(e,t){if("string"!=typeof e)throw new TypeError("'html' parameter must be a string");let r=t.allowable_tags,n=t.tag_replacement,a=t.state,s=t.tag_buffer,d=t.depth,c=t.in_quote_char,u="";for(let t=0,m=e.length;t<m;t++){let m=e[t];if(a===o)if("<"===m)a=i,s+=m;else u+=m;else if(a===i)switch(m){case"<":if(c)break;d++;break;case">":if(c)break;if(d){d--;break}c="",a=o,s+=">",r.has(p(s))?u+=s:u+=n,s="";break;case'"':case"'":c=m===c?"":c||m,s+=m;break;case"-":"<!-"===s&&(a=l),s+=m;break;case" ":case"\n":if("<"===s){a=o,u+="< ",s="";break}s+=m;break;default:s+=m}else if(a===l)if(">"===m)"--"==s.slice(-2)&&(a=o),s="";else s+=m}return t.state=a,t.tag_buffer=s,t.depth=d,t.in_quote_char=c,u}function p(e){let t=c.exec(e);return t?t[1].toLowerCase():null}u.init_streaming_mode=function(e,t){let r=m(e=e||[],t=t||"");return function(e){return y(e||"",r)}},void 0===(n=function(){return u}.call(t,r,t,e))||(e.exports=n)}()}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;if(document.getElementsByClassName("nav-tab-active").length>0&&(e=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===e){var t=document.getElementById("yasr_auto_insert_switch").checked,r=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===t&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===r&&jQuery(".yasr-stars-title-options-class").prop("disabled",!0),document.getElementById("yasr_auto_insert_switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-auto-insert-options-class").prop("disabled",!1):jQuery(".yasr-auto-insert-options-class").prop("disabled",!0)})),document.getElementById("yasr-general-options-stars-title-switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-stars-title-options-class").prop("disabled",!1):jQuery(".yasr-stars-title-options-class").prop("disabled",!0)})),document.getElementById("yasr-settings-custom-texts").addEventListener("click",(function(){document.getElementById("yasr-settings-custom-text-before-overall").value="Our Score",document.getElementById("yasr-settings-custom-text-before-visitor").value="Click to rate this post!",document.getElementById("yasr-settings-custom-text-after-visitor").value="[Total: %total_count% Average: %average%]",document.getElementById("yasr-settings-custom-text-rating-saved").value="Rating saved!",document.getElementById("yasr-settings-custom-text-rating-updated").value="Rating updated!",document.getElementById("yasr-settings-custom-text-must-sign-in").value="You must sign in to vote",document.getElementById("yasr-settings-custom-text-already-rated").value="You have already voted for this article with %rating%"}))}if("style_options"===e&&(wp.codeEditor.initialize(document.getElementById("yasr_style_options_textarea"),yasr_cm_settings),jQuery("#yasr-color-scheme-preview-link").on("click",(function(){return jQuery("#yasr-color-scheme-preview").toggle("slow"),!1})),wp.hooks.doAction("yasrStyleOptions")),"manage_multi"===e){var n=parseInt(document.getElementById("n-multiset").value);if(jQuery("#yasr-multi-set-doc-link").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),jQuery("#yasr-multi-set-doc-link-hide").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),1===n){var a=jQuery("#yasr-edit-form-number-elements").attr("value");a++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(a>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var e=jQuery(document.createElement("tr"));e.html('<td colspan="2">Element #'+a+' <input type="text" name="edit-multi-set-element-'+a+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),a++}))}else n>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var e={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(e)})),!1})),jQuery(document).ajaxComplete((function(){var e=jQuery("#yasr-edit-form-number-elements").attr("value");e++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(e>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var t=jQuery(document.createElement("tr"));t.html('<td colspan="2">Element #'+e+' <input type="text" name="edit-multi-set-element-'+e+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),e++}))})))}"migration_tools"===e&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-ratemypost-answer").innerHTML=e}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-mr-answer").innerHTML=e}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===e&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{"use strict";let e;var t,n=function(t){var r=t.colClass,n=t.post,a=n.link,s=n.title;return React.createElement("td",{className:r},React.createElement("a",{href:a},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===e&&(e=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),e.innerHTML=t;const r=e.textContent;return e.innerHTML="",r}(s)))},a=new Uint8Array(16);function s(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(a)}const o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const i=function(e){return"string"==typeof e&&o.test(e)};for(var l=[],d=0;d<256;++d)l.push((d+256).toString(16).substr(1));const c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase();if(!i(r))throw TypeError("Stringified UUID is invalid");return r};const u=function(e,t,r){var n=(e=e||{}).random||(e.rng||s)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=n[a];return t}return c(n)};var m=r(726),y=r.n(m),p=function(e){var t=e.html;return React.createElement("div",{dangerouslySetInnerHTML:{__html:y()(t,"<strong><p>")}})},g=function(e){var t=e.post,r=t.number_of_votes,n=t.rating,a=e.text;if(void 0!==r){var s=JSON.parse(yasrWindowVar.textAfterVr);return s=(s=s.replace("%total_count%",r)).replace("%average%",n),React.createElement("div",{className:"yasr-most-rated-text"},React.createElement(p,{html:s}))}return React.createElement("span",null,a," ",n)},f=function(e){var t=e.size,r=e.htmlId,n=e.element,a=e.step,s=e.readonly,o=e.rating;return React.createElement("div",{id:r,ref:function(){return yasrSetRaterValue(t,r,n,a,s,o)}})},v=function(e){var t=e.rankingParams,r=e.tableId,n=e.colClass,a=e.post,s="after",o=JSON.parse(yasrWindowVar.textRating),i=new URLSearchParams(t);null!==i.get("text_position")&&(s=i.get("text_position")),null!==i.get("custom_txt")&&(o=i.get("custom_txt"));var l={rating:a.rating,htmlId:"yasr-ranking-element-"+u(),size:document.getElementById(r).dataset.rankingSize};return"before"===s?React.createElement("td",{className:n},React.createElement(g,{post:a,text:o}),React.createElement(f,l)):React.createElement("td",{className:n},React.createElement(f,l),React.createElement(g,{post:a,text:o}))},h=function(e){var t={colClass:e.leftClass,post:e.post},r={rankingParams:e.rankingParams,tableId:e.tableId,colClass:e.rightClass,post:e.post};return React.createElement("tr",{className:e.trClass},React.createElement(n,t),React.createElement(v,r))},_=function(e){var t=e.tBodyId,r=e.show,n=e.data,a=e.source,s=e.rankingParams,o=e.tableId;return React.createElement("tbody",{id:t,style:{display:r}},n.map((function(e,t){var r="yasr-rankings-td-colored",n="yasr-top-10-most-highest-left",i="yasr-top-10-most-highest-right";return"author_ranking"===a&&(r="yasr-rankings-td-white",n="yasr-top-10-overall-left",i="yasr-top-10-overall-right"),t%2==0&&(r="yasr-rankings-td-white","author_ranking"===a&&(r="yasr-rankings-td-colored")),React.createElement(h,{key:e.post_id,source:a,tableId:o,rankingParams:s,post:e,trClass:r,leftClass:n,rightClass:i})})))},E=function(e){return function(t){t.preventDefault();var r=t.target.id,n=e.tableId,a="link-most-rated-posts-"+n,s="link-highest-rated-posts-"+n,o="most-rated-posts-"+n,i="highest-rated-posts-"+n,l=document.getElementById(r),d=document.createElement("span");d.innerHTML=l.innerHTML,d.id=l.id,l.parentNode.replaceChild(d,l),r===a&&(document.getElementById(i).style.display="none",document.getElementById(o).style.display="",d=document.getElementById(s),l.innerHTML=d.innerHTML,l.id=d.id,d.parentNode.replaceChild(l,d)),r===s&&(document.getElementById(o).style.display="none",document.getElementById(i).style.display="",d=document.getElementById(a),l.innerHTML=d.innerHTML,l.id=d.id,d.parentNode.replaceChild(l,d))}},b=function(e){var t=e.tableId,r=e.source,n=e.defaultView,a="link-most-rated-posts-"+t,s="link-highest-rated-posts-"+t;if("author_ranking"!==r){var o=React.createElement("span",null,React.createElement("span",{id:a},JSON.parse(yasrWindowVar.textMostRated))," | ",React.createElement("a",{href:"#",id:s,onClick:E(e)},JSON.parse(yasrWindowVar.textHighestRated)));return"highest"===n&&(o=React.createElement("span",null,React.createElement("span",{id:s},JSON.parse(yasrWindowVar.textHighestRated))," | ",React.createElement("a",{href:"#",id:a,onClick:E(e)},JSON.parse(yasrWindowVar.textMostRated)))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,JSON.parse(yasrWindowVar.textLeftColumnHeader)),React.createElement("th",null,JSON.parse(yasrWindowVar.textOrderBy),": ",o)))}return React.createElement(React.Fragment,null)},k=function(e){var t=e.error,r=e.isLoaded,n=e.data,a=e.source,s=e.rankingParams,o=e.tableId;if(t)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error")));if(!1===r)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,JSON.parse(yasrWindowVar.textLoadRanking))));if("overall_rating"===a||"author_multi"===a)return React.createElement(_,{data:n,tableId:o,tBodyId:"overall_"+o,rankingParams:s,show:"table-row-group",source:a});var i=n.most,l=n.highest,d="table-row-group",c="none",u="most",m=d,y=c,p=new URLSearchParams(s);return null!==p.get("view")&&(u=p.get("view")),"highest"===u&&(m=c,y=d),React.createElement(React.Fragment,null,React.createElement(b,{tableId:o,source:a,defaultView:u}),React.createElement(_,{data:i,tableId:o,tBodyId:"most-rated-posts-"+o,rankingParams:s,show:m,source:a}),React.createElement(_,{data:l,tableId:o,tBodyId:"highest-rated-posts-"+o,rankingParams:s,show:y,source:a}))};function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},w.apply(this,arguments)}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,s=[],o=!0,i=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(s.push(n.value),!t||s.length!==t);o=!0);}catch(e){i=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(i)throw a}}return s}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var x=wp.element,j=x.useState,R=x.useEffect,C=function(e,t,r){var n=t,a="&nonce_rankings="+r,s=function(e,t){var r="";if(""!==e&&!1!==e){var n=new URLSearchParams(e);null!==n.get("order_by")&&(r+="order_by="+n.get("order_by")),null!==n.get("limit")&&(r+="&limit="+n.get("limit")),null!==n.get("start_date")&&"0"!==n.get("start_date")&&(r+="&start_date="+n.get("start_date")),null!==n.get("end_date")&&"0"!==n.get("end_date")&&(r+="&end_date="+n.get("end_date")),null!==n.get("ctg")?r+="&ctg="+n.get("ctg"):null!==n.get("cpt")&&(r+="&cpt="+n.get("cpt")),""!==r&&(r="&"+(r=r.replace(/\s+/g,""))),"visitor_multi"!==t&&"author_multi"!==t||null!==n.get("setid")&&(r+="&setid="+n.get("setid")),"visitor_votes"===t&&(null!==n.get("required_votes[most]")&&(r="&required_votes="+n.get("required_votes[most]")),null!==n.get("required_votes[highest]")&&(r="&required_votes="+n.get("required_votes[highest]")))}return r}(""!==e?e:"",n);return"author_ranking"===n||"author_multi"===n||"overall_rating"===n?[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+n+s+a]:[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+n+s+a,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+n+s+a]},S=function(e){var t=e.tableId,r=e.source,n=e.params,a=e.nonce,s={tableId:t,source:r,rankingParams:n},o=I(j(null),2),i=o[0],l=o[1],d=I(j(!1),2),c=d[0],u=d[1],m=I(j([]),2),y=m[0],p=m[1],g=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=JSON.parse(document.getElementById(t).dataset.rankingData);!0===e&&console.info("Ajax Disabled, getting data from source"),p(r)};return R((function(){var e,t;"yes"!==yasrWindowVar.ajaxEnabled?(g(!0),u(!0)):r?(e=[],t=C(n,r,a),Promise.all(t.map((function(t){return fetch(t).then((function(e){return!0===e.ok?e.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(t){"KO"===t?g():("overall_rating"===t.source||"author_multi"===t.source?e="overall_rating"===t.source?t.data_overall:t.data_mv:e[t.show]=t.data_vv,p(e))})).catch((function(e){g(),console.info(e)}))}))).then((function(e){u(!0)})).catch((function(e){g(),console.info(e)}))):l("Invalid Data Source")}),[]),React.createElement(React.Fragment,null,React.createElement(k,w({error:i,isLoaded:c,data:y},s)))},Q=wp.element.render,N=function(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var r=e.item(t).id,n=JSON.parse(e.item(t).dataset.rankingSource),a=JSON.parse(e.item(t).dataset.rankingParams),s=JSON.parse(e.item(t).dataset.rankingNonce),o=document.getElementById(r);Q(React.createElement(S,{source:n,tableId:r,params:a,nonce:s}),o)}};N();tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"});var L,O=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(L=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===L){var H,T=function(e){var t=K.value,r=document.getElementById("yasr-builder-shortcode").textContent,n=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];n=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",n),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+r).then((function(e){return!0===e.ok?e.json():(console.info(O("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(e){console.info(e)})).then((function(e){if("KO"!==e){var t=document.createElement("div");t.innerHTML=e,U.childNodes.length>0?U.replaceChild(t,U.childNodes[0]):U.appendChild(t)}})).then((function(e){n.forEach((function(e){t===e&&N()}))}))},V=function(e,t,r,n,a,s,o,i,l){e.style.display="",t.style.display="",s.style.display="",l.style.display="",r.style.display="none",n.style.display="none",a.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},M=function(e,t,r,n,a,s,o,i,l){r.style.display="",n.style.display="",t.style.display="",s.style.display="",l.style.display="",e.style.display="none",a.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},P=function(e,t,r,n,a,s,o,i,l){a.style.display="",l.style.display="none",e.style.display="none",r.style.display="none",n.style.display="none",t.style.display="none",s.style.display="none",null!==o&&(o.style.display="none"),null!==i&&(i.style.display="none")},A=function(e,t,r,n,a,s,o,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],d=arguments.length>9?arguments[9]:void 0;!0===l?(X.className="",X.classList.add("yasr-settings-row-24"),r.style.display="",n.style.display="",e.style.display="none"):(r.style.display="none",n.style.display="none",e.style.display=""),s.style.display="",t.style.display="",d.style.display="",a.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="")},J=".yasr-builder-elements-parents",W=".yasr-builder-elements-childs";jQuery(J).prop("disabled",!0),jQuery(W).prop("disabled",!0),jQuery(J).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",J,W);var q=[],z={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};H=z.name,document.getElementById("yasr-builder-shortcode").textContent="["+H+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+H+"]");var D=document.getElementById("yasr-builder-button-preview"),F=document.getElementById("yasr-builder-copy-shortcode"),U=document.getElementById("yasr-builder-preview"),K=document.getElementById("yasr-ranking-source"),Y=document.getElementById("yasr-ranking-multiset-select"),$=document.getElementById("yasr-builder-datepicker-start"),G=document.getElementById("yasr-builder-datepicker-end"),X=document.getElementById("yasr-builder-params-container"),Z=document.getElementById("builder-vv-default-view"),ee=document.getElementById("builder-vv-required-votes"),te=document.getElementById("builder-stars-size"),re=document.getElementById("builder-overall-text"),ne=document.getElementById("builder-username-options"),ae=document.getElementById("builder-category"),se=document.getElementById("builder-cpt"),oe=document.getElementById("yasr-ranking-multiset"),ie=document.getElementById("yasr-builder-datepicker"),le=K.value,de=!1;$.value="",G.value="","yasr_ov_ranking"===le?V(re,te,Z,ee,ne,ae,se,oe,ie):"yasr_most_active_users"===le||"yasr_top_reviewers"===le?P(re,te,Z,ee,ne,ae,se,oe,ie):"yasr_multi_set_ranking"===le?A(re,te,Z,ee,ne,ae,se,oe,!1,ie):"yasr_visitor_multi_set_ranking"===le?A(re,te,Z,ee,ne,ae,se,oe,!0,ie):M(re,te,Z,ee,ne,ae,se,oe,ie),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)X.className="",X.classList.add("yasr-settings-row-33"),U.innerHTML="",$.value="",G.value="",z={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""},"yasr_ov_ranking"===e.target.value?V(re,te,Z,ee,ne,ae,se,oe,ie):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?P(re,te,Z,ee,ne,ae,se,oe,ie):"yasr_multi_set_ranking"===e.target.value?(A(re,te,Z,ee,ne,ae,se,oe,!1,ie),z.setid=" setid="+Y[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(A(re,te,Z,ee,ne,ae,se,oe,!0,ie),z.setid=" setid="+Y[0].value):M(re,te,Z,ee,ne,ae,se,oe,ie),z.name=e.target.value,H=z.name+z.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(z.setid=" setid="+e.target.value),q=wp.hooks.applyFilters("yasrBuilderFilterShortcode",z);for(var t=2;z.length;t++)q.hasOwnProperty(z[t])&&(z[t]=q[t]);H=z.name+z.setid+z.rows+z.view+z.minvotesmost+z.minvoteshg+z.size+z.txtPosition+z.txt+z.display+z.start_date+z.end_date+z.category+z.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+H+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+H+"]"),!0===de&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&T()})),F.onclick=function(e){!function(e){var t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}(document.getElementById(e.target.id).getAttribute("data-shortcode"))},D.onclick=function(e){T(),de=!0}}})()})();
|
freemius/languages/freemius-de_DE.mo
ADDED
Binary file
|
includes/classes/YasrScriptsLoader.php
CHANGED
@@ -46,15 +46,21 @@ class YasrScriptsLoader {
|
|
46 |
public function loadWindowVar() {
|
47 |
//This is required to use wp_localize_script without dependency
|
48 |
//https://wordpress.stackexchange.com/a/311279/48442
|
49 |
-
wp_register_script('yasr-window-var', '', array(),
|
50 |
wp_enqueue_script('yasr-window-var');
|
51 |
|
52 |
$yasr_visitor_votes_loader =
|
53 |
-
'<div id="loader
|
54 |
'<img src="' . esc_url(YASR_IMG_DIR . 'loader.gif').'"
|
55 |
title="yasr-loader" alt="yasr-loader" height="16" width="16">'.
|
56 |
'</div>';
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
$yasr_window_var = array(
|
60 |
'siteUrl' => site_url(),
|
@@ -63,7 +69,7 @@ class YasrScriptsLoader {
|
|
63 |
'visitorStatsEnabled' => YASR_VISITORS_STATS,
|
64 |
'ajaxEnabled' => YASR_ENABLE_AJAX,
|
65 |
'loaderHtml' => $yasr_visitor_votes_loader,
|
66 |
-
'loaderUrl' => esc_url(
|
67 |
'isUserLoggedIn' => json_encode(is_user_logged_in()),
|
68 |
'isRtl' => json_encode(is_rtl()),
|
69 |
'starSingleForm' => json_encode(esc_html__('star', 'yet-another-stars-rating')),
|
46 |
public function loadWindowVar() {
|
47 |
//This is required to use wp_localize_script without dependency
|
48 |
//https://wordpress.stackexchange.com/a/311279/48442
|
49 |
+
wp_register_script('yasr-window-var', '', array(), YASR_VERSION_NUM, true);
|
50 |
wp_enqueue_script('yasr-window-var');
|
51 |
|
52 |
$yasr_visitor_votes_loader =
|
53 |
+
'<div id="yasr-loader" style="display: inline-block"> '.
|
54 |
'<img src="' . esc_url(YASR_IMG_DIR . 'loader.gif').'"
|
55 |
title="yasr-loader" alt="yasr-loader" height="16" width="16">'.
|
56 |
'</div>';
|
57 |
|
58 |
+
//Use this hook to customize loader
|
59 |
+
$yasr_visitor_votes_loader = apply_filters('yasr_custom_loader', $yasr_visitor_votes_loader);
|
60 |
+
|
61 |
+
//Use this hook to customize only the loader url
|
62 |
+
//since version 3.1.2, yasrWindowVar.loaderUrl it is not used in YASR, but it is useful to keep it
|
63 |
+
$yasr_visitor_votes_loader_url = apply_filters('yasr_custom_loader_url', YASR_IMG_DIR . 'loader.gif');
|
64 |
|
65 |
$yasr_window_var = array(
|
66 |
'siteUrl' => site_url(),
|
69 |
'visitorStatsEnabled' => YASR_VISITORS_STATS,
|
70 |
'ajaxEnabled' => YASR_ENABLE_AJAX,
|
71 |
'loaderHtml' => $yasr_visitor_votes_loader,
|
72 |
+
'loaderUrl' => esc_url($yasr_visitor_votes_loader_url),
|
73 |
'isUserLoggedIn' => json_encode(is_user_logged_in()),
|
74 |
'isRtl' => json_encode(is_rtl()),
|
75 |
'starSingleForm' => json_encode(esc_html__('star', 'yet-another-stars-rating')),
|
includes/yasr-includes-functions.php
CHANGED
@@ -307,8 +307,11 @@ function yasr_kses($string) {
|
|
307 |
),
|
308 |
'img' => array (
|
309 |
'src' => array(),
|
|
|
|
|
|
|
|
|
310 |
'class' => array(),
|
311 |
-
'alt' => array()
|
312 |
),
|
313 |
'br' => array(),
|
314 |
'strong' =>array()
|
307 |
),
|
308 |
'img' => array (
|
309 |
'src' => array(),
|
310 |
+
'title' => array(),
|
311 |
+
'height' => array(),
|
312 |
+
'width' => array(),
|
313 |
+
'alt' => array(),
|
314 |
'class' => array(),
|
|
|
315 |
),
|
316 |
'br' => array(),
|
317 |
'strong' =>array()
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Donate link: https://www.paypal.com/donate/?hosted_button_id=SVTAVUF62QZ4W
|
|
3 |
Tags: rating, rate post, star rating, google rating, block
|
4 |
Requires at least: 4.7
|
5 |
Contributors: Dudo
|
6 |
-
Tested up to: 6.0.
|
7 |
-
Stable tag: 3.1.
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
@@ -206,6 +206,10 @@ Yes, YASR is 100% fully compatible with PHP 8
|
|
206 |
|
207 |
The full changelog can be found in the plugin's directory. Recent entries:
|
208 |
|
|
|
|
|
|
|
|
|
209 |
= 3.1.1 =
|
210 |
* FIXED: Rich snippets fix for "Product itemType". See [#1](https://github.com/Dudo1985/Yet-Another-Stars-Rating/issues/1).
|
211 |
* TWEAKED: updated Freemius sdk to version 2.4.5
|
3 |
Tags: rating, rate post, star rating, google rating, block
|
4 |
Requires at least: 4.7
|
5 |
Contributors: Dudo
|
6 |
+
Tested up to: 6.0.2
|
7 |
+
Stable tag: 3.1.2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
206 |
|
207 |
The full changelog can be found in the plugin's directory. Recent entries:
|
208 |
|
209 |
+
= 3.1.2 =
|
210 |
+
* TWEAKED: added new filters yasr_custom_loader and yasr_custom_loader_url to customize loader
|
211 |
+
* FIXED: better ajax response when data is imported from another plugin
|
212 |
+
|
213 |
= 3.1.1 =
|
214 |
* FIXED: Rich snippets fix for "Product itemType". See [#1](https://github.com/Dudo1985/Yet-Another-Stars-Rating/issues/1).
|
215 |
* TWEAKED: updated Freemius sdk to version 2.4.5
|
yet-another-stars-rating.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
7 |
-
* Version: 3.1.
|
8 |
* Requires at least: 4.7
|
9 |
* Requires PHP: 5.4
|
10 |
* Author: Dario Curvino
|
@@ -78,7 +78,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
78 |
yasr_fs();
|
79 |
// Signal that SDK was initiated.
|
80 |
do_action( 'yasr_fs_loaded' );
|
81 |
-
define( 'YASR_VERSION_NUM', '3.1.
|
82 |
//Plugin absolute path
|
83 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
84 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
7 |
+
* Version: 3.1.2
|
8 |
* Requires at least: 4.7
|
9 |
* Requires PHP: 5.4
|
10 |
* Author: Dario Curvino
|
78 |
yasr_fs();
|
79 |
// Signal that SDK was initiated.
|
80 |
do_action( 'yasr_fs_loaded' );
|
81 |
+
define( 'YASR_VERSION_NUM', '3.1.2' );
|
82 |
//Plugin absolute path
|
83 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
84 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|