Version Description
- FIXED: compatibility with WordPress 5.8
- FIXED: link to trial page
- TWEAKED: added some hooks
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 2.8.3 |
Comparing to | |
See all releases |
Code changes from version 2.8.2 to 2.8.3
- admin/editor/yasr-editor-functions.php +20 -16
- admin/js/src/yasr-settings-page.js +6 -0
- admin/js/yasr-admin.js +1 -1
- admin/js/yasr-editor-screen.js +1 -1
- admin/js/yasr-gutenberg.js +1 -1
- admin/js/yasr-pricing-page.js +1 -1
- admin/js/yasr-settings.js +1 -1
- admin/settings/migrations/yasr-settings-migration-page.php +2 -0
- includes/js/yasr-front.js +1 -1
- readme.txt +6 -1
- yet-another-stars-rating.php +2 -2
admin/editor/yasr-editor-functions.php
CHANGED
@@ -25,25 +25,29 @@ if (!defined('ABSPATH')) {
|
|
25 |
//this load guten-block.js, only in admin side
|
26 |
add_action('enqueue_block_editor_assets', 'yasr_gutenberg_scripts');
|
27 |
function yasr_gutenberg_scripts() {
|
28 |
-
//
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
|
45 |
//This filter is used to add a new category in gutenberg
|
46 |
-
add_filter('
|
47 |
|
48 |
function yasr_add_gutenberg_category($categories) {
|
49 |
return array_merge(
|
25 |
//this load guten-block.js, only in admin side
|
26 |
add_action('enqueue_block_editor_assets', 'yasr_gutenberg_scripts');
|
27 |
function yasr_gutenberg_scripts() {
|
28 |
+
//I need to enqueue this only in post-new.php or post.php
|
29 |
+
$current_screen = get_current_screen();
|
30 |
+
if (property_exists($current_screen, 'base')) {
|
31 |
+
if ($current_screen->base === 'post') {
|
32 |
+
//Script
|
33 |
+
wp_enqueue_script(
|
34 |
+
'yasr-gutenberg',
|
35 |
+
YASR_JS_DIR_ADMIN . 'yasr-gutenberg.js', array(
|
36 |
+
'wp-blocks',
|
37 |
+
'wp-components',
|
38 |
+
'wp-editor',
|
39 |
+
'wp-edit-post',
|
40 |
+
'wp-element',
|
41 |
+
'wp-i18n',
|
42 |
+
'wp-plugins',
|
43 |
+
)
|
44 |
+
);
|
45 |
+
}
|
46 |
+
}
|
47 |
}
|
48 |
|
49 |
//This filter is used to add a new category in gutenberg
|
50 |
+
add_filter('block_categories_all', 'yasr_add_gutenberg_category', 10, 2);
|
51 |
|
52 |
function yasr_add_gutenberg_category($categories) {
|
53 |
return array_merge(
|
admin/js/src/yasr-settings-page.js
CHANGED
@@ -221,6 +221,12 @@ if (activeTab === 'migration_tools') {
|
|
221 |
});
|
222 |
|
223 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
}
|
225 |
|
226 |
/****** End Yasr Settings Page ******/
|
221 |
});
|
222 |
|
223 |
});
|
224 |
+
|
225 |
+
wp.hooks.doAction('yasr_migration_page_bottom');
|
226 |
+
}
|
227 |
+
|
228 |
+
if (activeTab === 'rankings') {
|
229 |
+
wp.hooks.doAction('yasr_ranking_page_top');
|
230 |
}
|
231 |
|
232 |
/****** End Yasr Settings Page ******/
|
admin/js/yasr-admin.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
(()=>{"use strict";tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"})})(),jQuery(document).ready((function(){jQuery(".yasr-log-pagenum").on("click",(function(){jQuery("#yasr-loader-log-metabox").show();var a={action:"yasr_change_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,a,(function(a){jQuery("#yasr-loader-log-metabox").hide(),jQuery("#yasr-log-container").html(a)}))})),jQuery(document).ajaxComplete((function(a,e,r){var o=!0;void 0!==r.data&&(o=r.data.search("action=yasr_change_log_page")),-1!==o&&jQuery(".yasr-log-pagenum").on("click",(function(){jQuery("#yasr-loader-log-metabox").show();var a={action:"yasr_change_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,a,(function(a){jQuery("#yasr-log-container").html(a)}))}))}))})),jQuery(document).ready((function(){jQuery(".yasr-user-log-page-num").on("click",(function(){jQuery("#yasr-loader-user-log-metabox").show();var a={action:"yasr_change_user_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-user-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,a,(function(a){jQuery("#yasr-loader-log-metabox").hide(),jQuery("#yasr-user-log-container").html(a)}))})),jQuery(document).ajaxComplete((function(a,e,r){void 0!==r.data&&-1!==r.data.search("action=yasr_change_user_log_page")&&jQuery(".yasr-user-log-page-num").on("click",(function(){jQuery("#yasr-loader-user-log-metabox").show();var a={action:"yasr_change_user_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-user-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,a,(function(a){jQuery("#yasr-user-log-container").html(a)}))}))}))}));
|
admin/js/yasr-editor-screen.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function n(a){if(t[a])return t[a].exports;var o=t[a]={i:a,l:!1,exports:{}};return e[a].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(a,o,function(t){return e[t]}.bind(null,o));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t){function n(e){"Product"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"LocalBusiness"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Recipe"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"SoftwareApplication"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Book"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Movie"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none"):document.getElementById("yasr-metabox-info-snippet-container").style.display="none"}function a(e,t,n){const a={action:"yasr_send_id_nameset",set_id:e,post_id:t};return jQuery.post(ajaxurl,a,(function(t){n>1&&(document.getElementById("yasr-loader-select-multi-set").style.display="none");for(var a=JSON.parse(t),o="",i=0;i<a.length;i++){var s=a[i].name,r=a[i].average_rating,l=a[i].id;o+="<tr>",o+="<td>"+s+"</td>",o+='<td><div class="yasr-multiset-admin" id="yasr-multiset-admin-'+l+'" data-rating="'+r+'" data-multi-idfield="'+l+'"></div>',o+='<span id="yasr-loader-multi-set-field-'+l+'" style="display: none">',o+='<img src="'+yasrCommonData.loaderHtml+'" alt="yasr-loader"></span>',o+="</span>",o+="</td>",o+="</tr>",document.getElementById("yasr-table-multi-set-admin").innerHTML=o}document.getElementById("yasr-multi-set-admin-choose-text").style.display="block",function(e){document.getElementById("yasr-multiset-id").value=e;let t=document.getElementsByClassName("yasr-multiset-admin"),n=[],a=!1;for(let e=0;e<t.length;e++)!function(e){let o=t.item(e).id,i=document.getElementById(o),s=parseInt(i.getAttribute("data-multi-idfield")),r=parseInt(i.getAttribute("data-rating")),l={field:s,rating:r};n.push(l),raterJs({starSize:32,step:.5,showToolTip:!1,readOnly:!1,element:i,rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),this.setRating(e);for(let t=0;t<n.length;t++)n[t].field===s&&(n[t].rating=e);a=JSON.stringify(n),document.getElementById("yasr-multiset-author-votes").value=a,t()}})}(e)}(e),document.getElementById("yasr-multi-set-admin-explain").style.display="block",document.getElementById("yasr-multi-set-admin-explain-with-id-readonly").innerHTML="<strong>[yasr_multiset setid="+e+"]</strong>",document.getElementById("yasr-multi-set-admin-explain-with-id-visitor").innerHTML="<strong>[yasr_visitor_multiset setid="+e+"]</strong>"})),!1}document.addEventListener("DOMContentLoaded",(function(e){!0!==document.body.classList.contains("block-editor-page")&&(!function(){let e=parseFloat(document.getElementById("yasr-overall-rating-value").value);raterJs({starSize:32,step:.1,showToolTip:!1,rating:e,readOnly:!1,element:document.getElementById("yasr-rater-overall"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),document.getElementById("yasr-overall-rating-value").value=e,this.setRating(e);document.getElementById("yasr_overall_text").textContent="You've rated "+e,t()}})}(),jQuery.get(ajaxurl,{action:"yasr_create_shortcode"},(function(e){jQuery(e).appendTo("body").hide(),function(){let e=!1;null!==document.getElementById("yasr-editor-multiset-container")&&(e=!0);const t=document.getElementById("yasr-tinypopup-link-doc");jQuery("#yasr-link-tab-main").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-main").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-main").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-basics-shortcode/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen")})),jQuery("#yasr-link-tab-charts").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-charts").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-charts").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-rankings/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen")})),jQuery("#yasr-overall").on("click",(function(){jQuery("#yasr-overall-choose-size").toggle("slow")})),jQuery("#yasr-visitor-votes").on("click",(function(){jQuery("#yasr-visitor-choose-size").toggle("slow")})),jQuery(".yasr-tinymce-shortcode-buttons").on("click",(function(){let e=this.getAttribute("data-shortcode");null==tinyMCE.activeEditor?jQuery("#content").append(e):tinyMCE.activeEditor.execCommand("mceInsertContent",0,e),tb_remove()})),!0===e&&jQuery("#yasr-insert-multiset-select").on("click",(function(){var e=jQuery("input:radio[name=yasr_tinymce_pick_set]:checked").val();let t;t=jQuery("#yasr-allow-vote-multiset").is(":checked")?"[yasr_multiset setid=":"[yasr_visitor_multiset setid=",t+=e,jQuery("#yasr-hide-average-multiset").is(":checked")&&(t+=" show_average='no'"),t+="]",null==tinyMCE.activeEditor?jQuery("#content").append(t):tinyMCE.activeEditor.execCommand("mceInsertContent",0,t),tb_remove()}))}()}))),function(){jQuery("#yasr-metabox-below-editor-structured-data-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-structured-data-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-structured-data").show()})),jQuery("#yasr-metabox-below-editor-multiset-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-multiset-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-multiset").show()}));let e=document.getElementById("yasr-metabox-below-editor-select-schema").value;null!==document.getElementById("yasr-editor-multiset-container")&&function(){let e=document.getElementById("yasr-editor-multiset-container"),t=parseInt(e.getAttribute("data-nmultiset")),n=parseInt(e.getAttribute("data-setid")),o=parseInt(e.getAttribute("data-postid"));a(n,o,t),t>1&&jQuery("#yasr-button-select-set").on("click",(function(){return n=jQuery("#select_set").val(),jQuery("#yasr-loader-select-multi-set").show(),a(n,o,t),!1}))}();n(e)}()})),document.getElementById("yasr-metabox-below-editor-select-schema").addEventListener("change",(function(){n(this.value)}))}]);
|
1 |
+
(()=>{function e(e){"Product"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"LocalBusiness"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Recipe"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"SoftwareApplication"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Book"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Movie"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none"):document.getElementById("yasr-metabox-info-snippet-container").style.display="none"}function t(e,t,n){const a={action:"yasr_send_id_nameset",set_id:e,post_id:t};return jQuery.post(ajaxurl,a,(function(t){n>1&&(document.getElementById("yasr-loader-select-multi-set").style.display="none");for(var a=JSON.parse(t),o="",s=0;s<a.length;s++){var i=a[s].name,r=a[s].average_rating,l=a[s].id;o+="<tr>",o+="<td>"+i+"</td>",o+='<td><div class="yasr-multiset-admin" id="yasr-multiset-admin-'+l+'" data-rating="'+r+'" data-multi-idfield="'+l+'"></div>',o+='<span id="yasr-loader-multi-set-field-'+l+'" style="display: none">',o+='<img src="'+yasrCommonData.loaderHtml+'" alt="yasr-loader"></span>',o+="</span>",o+="</td>",o+="</tr>",document.getElementById("yasr-table-multi-set-admin").innerHTML=o}document.getElementById("yasr-multi-set-admin-choose-text").style.display="block",function(e){document.getElementById("yasr-multiset-id").value=e;let t=document.getElementsByClassName("yasr-multiset-admin"),n=[],a=!1;for(let e=0;e<t.length;e++)!function(e){let o=t.item(e).id,s=document.getElementById(o),i=parseInt(s.getAttribute("data-multi-idfield")),r=parseInt(s.getAttribute("data-rating")),l={field:i,rating:r};n.push(l),raterJs({starSize:32,step:.5,showToolTip:!1,readOnly:!1,element:s,rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),this.setRating(e);for(let t=0;t<n.length;t++)n[t].field===i&&(n[t].rating=e);a=JSON.stringify(n),document.getElementById("yasr-multiset-author-votes").value=a,t()}})}(e)}(e),document.getElementById("yasr-multi-set-admin-explain").style.display="block",document.getElementById("yasr-multi-set-admin-explain-with-id-readonly").innerHTML="<strong>[yasr_multiset setid="+e+"]</strong>",document.getElementById("yasr-multi-set-admin-explain-with-id-visitor").innerHTML="<strong>[yasr_visitor_multiset setid="+e+"]</strong>"})),!1}document.addEventListener("DOMContentLoaded",(function(n){var a;!0!==document.body.classList.contains("block-editor-page")&&(function(){let e=parseFloat(document.getElementById("yasr-overall-rating-value").value);raterJs({starSize:32,step:.1,showToolTip:!1,rating:e,readOnly:!1,element:document.getElementById("yasr-rater-overall"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),document.getElementById("yasr-overall-rating-value").value=e,this.setRating(e);document.getElementById("yasr_overall_text").textContent="You've rated "+e,t()}})}(),a={action:"yasr_create_shortcode"},jQuery.get(ajaxurl,a,(function(e){jQuery(e).appendTo("body").hide(),function(){let e=!1;null!==document.getElementById("yasr-editor-multiset-container")&&(e=!0);const t=document.getElementById("yasr-tinypopup-link-doc");jQuery("#yasr-link-tab-main").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-main").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-main").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-basics-shortcode/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen")})),jQuery("#yasr-link-tab-charts").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-charts").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-charts").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-rankings/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen")})),jQuery("#yasr-overall").on("click",(function(){jQuery("#yasr-overall-choose-size").toggle("slow")})),jQuery("#yasr-visitor-votes").on("click",(function(){jQuery("#yasr-visitor-choose-size").toggle("slow")})),jQuery(".yasr-tinymce-shortcode-buttons").on("click",(function(){let e=this.getAttribute("data-shortcode");null==tinyMCE.activeEditor?jQuery("#content").append(e):tinyMCE.activeEditor.execCommand("mceInsertContent",0,e),tb_remove()})),!0===e&&jQuery("#yasr-insert-multiset-select").on("click",(function(){var e=jQuery("input:radio[name=yasr_tinymce_pick_set]:checked").val();let t;t=jQuery("#yasr-allow-vote-multiset").is(":checked")?"[yasr_multiset setid=":"[yasr_visitor_multiset setid=",t+=e,jQuery("#yasr-hide-average-multiset").is(":checked")&&(t+=" show_average='no'"),t+="]",null==tinyMCE.activeEditor?jQuery("#content").append(t):tinyMCE.activeEditor.execCommand("mceInsertContent",0,t),tb_remove()}))}()}))),function(){jQuery("#yasr-metabox-below-editor-structured-data-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-structured-data-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-structured-data").show()})),jQuery("#yasr-metabox-below-editor-multiset-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-multiset-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-multiset").show()}));let n=document.getElementById("yasr-metabox-below-editor-select-schema").value;null!==document.getElementById("yasr-editor-multiset-container")&&function(){let e=document.getElementById("yasr-editor-multiset-container"),n=parseInt(e.getAttribute("data-nmultiset")),a=parseInt(e.getAttribute("data-setid")),o=parseInt(e.getAttribute("data-postid"));t(a,o,n),n>1&&jQuery("#yasr-button-select-set").on("click",(function(){return a=jQuery("#select_set").val(),jQuery("#yasr-loader-select-multi-set").show(),t(a,o,n),!1}))}(),e(n)}()})),document.getElementById("yasr-metabox-below-editor-select-schema").addEventListener("change",(function(){e(this.value)}))})();
|
admin/js/yasr-gutenberg.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){r(1),e.exports=r(2)},function(e,t){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=i(e);if(t){var a=i(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return s(this,r)}}function s(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=wp.i18n.__,c=wp.blocks.registerBlockType,u=wp.components,h=u.PanelBody,y=(u.PanelRow,wp.element.Fragment),d=wp.editor,f=(d.BlockControls,d.InspectorControls),m=l("All these settings are optional","yet-another-stars-rating"),p=l("Choose Size","yet-another-stars-rating"),v=l("Choose stars size","yet-another-stars-rating"),g=l("Small","yet-another-stars-rating"),R=l("Medium","yet-another-stars-rating"),b=l("Large","yet-another-stars-rating"),E=l("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),_=l("Remember: only the post author can rate here.","yet-another-stars-rating"),k=l("This is the star set where your users will be able to vote","yet-another-stars-rating");function w(){var e=l("To be able to customize this ranking, you need","yet-another-stars-rating"),t=l("You can buy the plugin, including support, updates and upgrades, on","yet-another-stars-rating");return React.createElement("h3",null,e," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro"},"Yasr Pro."),React.createElement("br",null),t," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings"},"yetanotherstarsrating.com"))}function A(e){return React.createElement("div",null,React.createElement(w,null))}c("yet-another-stars-rating/yasr-overall-rating",{title:l("Yasr: Overall Rating","yet-another-stars-rating"),description:l("Insert the author rating","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[l("rating","yet-another-stars-rating"),l("author","yet-another-stars-rating"),l("overall","yet-another-stars-rating")],attributes:{overallRatingMeta:{type:"number",source:"meta",meta:"yasr_overall_rating"},size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var t,r=e.attributes,s=r.overallRatingMeta,i=r.size,c=r.postId,u=e.setAttributes,d=e.isSelected,k=s,w=null,A=null;"--"!==i&&(w=' size="'+i+'"'),t=/^\d+$/.test(c),"--"!==c&&!0===t&&(A=' postid="'+c+'"');var O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(c,React.Component);var t,r,s,i=o(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=i.call(this,e)).yasrOverallRateThis=l("Rate this article / item","yet-another-stars-rating"),t}return t=c,(r=[{key:"render",value:function(){return React.createElement("div",null,this.yasrOverallRateThis,React.createElement("div",null,React.createElement("div",{id:"overall-rater",ref:function(){return raterJs({starSize:32,step:.1,showToolTip:!1,rating:k,readOnly:!1,element:document.querySelector("#overall-rater"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),u({overallRatingMeta:e}),this.setRating(e),t()}})}})))}}])&&n(t.prototype,r),s&&n(t,s),c}();function P(){return React.createElement("form",null,React.createElement("select",{value:i,onChange:S},React.createElement("option",{value:"--"},v),React.createElement("option",{value:"small"},g),React.createElement("option",{value:"medium"},R),React.createElement("option",{value:"large"},b)))}function S(e){var t=e.target.querySelector("option:checked");u({size:t.value}),e.preventDefault()}function I(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:x}))}function x(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||u({postId:t}),e.preventDefault()}}function N(e){return React.createElement(f,null,React.createElement("div",{class:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(O,null)),React.createElement(h,{title:"Settings"},React.createElement("h3",null,m),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,p),React.createElement("div",null,React.createElement(P,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(I,null),React.createElement("div",{className:"yasr-guten-block-explain"},E)),React.createElement("div",{className:"yasr-guten-block-panel"},_)))}return React.createElement(y,null,React.createElement(N,null),React.createElement("div",{className:e.className},"[yasr_overall_rating",w,A,"]",d&&React.createElement(P,null)))},save:function(e){var t=e.attributes,r=t.size,n=t.postId,a="",o=n;return r&&(a+='size="'+r+'"'),n&&("--"===n&&(o=wp.data.select("core/editor").getCurrentPostId()),a+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_overall_rating ",a,"]")}}),c("yet-another-stars-rating/yasr-visitor-votes",{title:l("Yasr: Visitor Votes","yet-another-stars-rating"),description:l("Insert the ability for your visitors to vote","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[l("rating","yet-another-stars-rating"),l("visitor","yet-another-stars-rating"),l("votes","yet-another-stars-rating")],attributes:{size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var t,r=e.attributes,n=r.size,a=r.postId,o=e.setAttributes,s=e.isSelected,i=null,l=null;function c(){return React.createElement("form",null,React.createElement("select",{value:n,onChange:u},React.createElement("option",{value:"--"},v),React.createElement("option",{value:"small"},g),React.createElement("option",{value:"medium"},R),React.createElement("option",{value:"large"},b)))}function u(e){var t=e.target.querySelector("option:checked");o({size:t.value}),e.preventDefault()}function d(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:_}))}function _(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||o({postId:t}),e.preventDefault()}}function w(e){return React.createElement(f,null,React.createElement(h,{title:"Settings"},React.createElement("h3",null,m),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,p),React.createElement("div",null,React.createElement(c,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(d,null),React.createElement("div",{className:"yasr-guten-block-explain"},E)),React.createElement("div",{className:"yasr-guten-block-panel"},k)))}return t=/^\d+$/.test(a),"--"!==n&&(i=' size="'+n+'"'),"--"!==a&&!0===t&&(l=' postid="'+a+'"'),React.createElement(y,null,React.createElement(w,null),React.createElement("div",{className:e.className},"[yasr_visitor_votes",i,l,"]",s&&React.createElement(c,null)))},save:function(e){var t=e.attributes,r=t.size,n=t.postId,a="",o=n;return r&&(a+='size="'+r+'"'),n&&("--"===n&&(o=wp.data.select("core/editor").getCurrentPostId()),a+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_visitor_votes ",a,"]")}}),c("yet-another-stars-rating/overall-rating-ranking",{title:l("Yasr: Ranking by overall rating","yet-another-stars-rating"),description:l("This ranking shows the highest rated posts rated through the overall_rating shortcode.","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[l("ranking","yet-another-stars-rating"),l("highest","yet-another-stars-rating"),l("chart","yet-another-stars-rating")],edit:function(e){var t=[React.createElement(A,{key:0})];function r(e){return React.createElement(f,null,React.createElement(h,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,t))))}return wp.hooks.doAction("yasr_overall_rating_rankings",t),React.createElement(y,null,React.createElement(r,null),React.createElement("div",{className:e.className},"[yasr_ov_ranking]"))},save:function(e){return React.createElement("div",null,"[yasr_ov_ranking]")}}),c("yet-another-stars-rating/visitor-votes-ranking",{title:l("Yasr: Ranking by visitors votes","yet-another-stars-rating"),description:l("This ranking shows both the highest and most rated posts rated through the yasr_visitor_votes shortcode. For an item to appear in this chart, it has to be rated at least twice. ","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[l("ranking","yet-another-stars-rating"),l("highest","yet-another-stars-rating"),l("most","yet-another-stars-rating"),l("chart","yet-another-stars-rating")],edit:function(e){var t=[React.createElement(A,{key:0})];function r(e){return React.createElement(f,null,React.createElement(h,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,t))))}return wp.hooks.doAction("yasr_visitor_votes_rankings",t),React.createElement(y,null,React.createElement(r,null),React.createElement("div",{className:e.className},"[yasr_most_or_highest_rated_posts]"))},save:function(e){return React.createElement("div",null,"[yasr_most_or_highest_rated_posts]")}}),c("yet-another-stars-rating/most-active-reviewers",{title:l("Yasr: Most Active Authors","yet-another-stars-rating"),description:l("This ranking shows the most active reviewers on your site.","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[l("ranking","yet-another-stars-rating"),l("highest","yet-another-stars-rating"),l("most","yet-another-stars-rating"),l("chart","yet-another-stars-rating"),l("authors","yet-another-stars-rating")],edit:function(e){var t=[React.createElement(A,{key:0})];function r(e){return React.createElement(f,null,React.createElement(h,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,t))))}return wp.hooks.doAction("yasr_top_reviewers_setting",t),React.createElement(y,null,React.createElement(r,null),React.createElement("div",{className:e.className},"[yasr_top_reviewers]"))},save:function(e){return React.createElement("div",null,"[yasr_top_reviewers]")}}),c("yet-another-stars-rating/most-active-users",{title:l("Yasr: Most Active Visitors","yet-another-stars-rating"),description:l("This ranking shows the most active users, displaying the login name if logged in or “Anonymous” if not.","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[l("ranking","yet-another-stars-rating"),l("highest","yet-another-stars-rating"),l("most","yet-another-stars-rating"),l("chart","yet-another-stars-rating"),l("visitors","yet-another-stars-rating")],edit:function(e){var t=[React.createElement(A,{key:0})];function r(e){return React.createElement(f,null,React.createElement(h,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,t))))}return wp.hooks.doAction("yasr_top_visitor_setting",t),React.createElement(y,null,React.createElement(r,null),React.createElement("div",{className:e.className},"[yasr_most_active_users]"))},save:function(e){return React.createElement("div",null,"[yasr_most_active_users]")}})},function(e,t,r){"use strict";r.r(t);var n=function(e){return"string"!=typeof e||""===e?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)};var a=function(e){return"string"!=typeof e||""===e?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)};var o=function(e,t){return function(r,o,s){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,l=e[t];if(a(r)&&n(o))if("function"==typeof s)if("number"==typeof i){var c={callback:s,priority:i,namespace:o};if(l[r]){var u,h=l[r].handlers;for(u=h.length;u>0&&!(i>=h[u-1].priority);u--);u===h.length?h[u]=c:h.splice(u,0,c),l.__current.forEach((function(e){e.name===r&&e.currentIndex>=u&&e.currentIndex++}))}else l[r]={handlers:[c],runs:0};"hookAdded"!==r&&e.doAction("hookAdded",r,o,s,i)}else console.error("If specified, the hook priority must be a number.");else console.error("The hook callback must be a function.")}};var s=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(o,s){var i=e[t];if(a(o)&&(r||n(s))){if(!i[o])return 0;var l=0;if(r)l=i[o].handlers.length,i[o]={runs:i[o].runs,handlers:[]};else for(var c=i[o].handlers,u=function(e){c[e].namespace===s&&(c.splice(e,1),l++,i.__current.forEach((function(t){t.name===o&&t.currentIndex>=e&&t.currentIndex--})))},h=c.length-1;h>=0;h--)u(h);return"hookRemoved"!==o&&e.doAction("hookRemoved",o,s),l}}};var i=function(e,t){return function(r,n){var a=e[t];return void 0!==n?r in a&&a[r].handlers.some((function(e){return e.namespace===n})):r in a}};var l=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(n){var a=e[t];a[n]||(a[n]={handlers:[],runs:0}),a[n].runs++;var o=a[n].handlers;for(var s=arguments.length,i=new Array(s>1?s-1:0),l=1;l<s;l++)i[l-1]=arguments[l];if(!o||!o.length)return r?i[0]:void 0;var c={name:n,currentIndex:0};for(a.__current.push(c);c.currentIndex<o.length;){var u=o[c.currentIndex],h=u.callback.apply(null,i);r&&(i[0]=h),c.currentIndex++}return a.__current.pop(),r?i[0]:void 0}};var c=function(e,t){return function(){var r,n,a=e[t];return null!==(r=null===(n=a.__current[a.__current.length-1])||void 0===n?void 0:n.name)&&void 0!==r?r:null}};var u=function(e,t){return function(r){var n=e[t];return void 0===r?void 0!==n.__current[0]:!!n.__current[0]&&r===n.__current[0].name}};var h=function(e,t){return function(r){var n=e[t];if(a(r))return n[r]&&n[r].runs?n[r].runs:0}},y=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.actions=Object.create(null),this.actions.__current=[],this.filters=Object.create(null),this.filters.__current=[],this.addAction=o(this,"actions"),this.addFilter=o(this,"filters"),this.removeAction=s(this,"actions"),this.removeFilter=s(this,"filters"),this.hasAction=i(this,"actions"),this.hasFilter=i(this,"filters"),this.removeAllActions=s(this,"actions",!0),this.removeAllFilters=s(this,"filters",!0),this.doAction=l(this,"actions"),this.applyFilters=l(this,"filters",!0),this.currentAction=c(this,"actions"),this.currentFilter=c(this,"filters"),this.doingAction=u(this,"actions"),this.doingFilter=u(this,"filters"),this.didAction=h(this,"actions"),this.didFilter=h(this,"filters")};var d=function(){return new y}();d.addAction,d.addFilter,d.removeAction,d.removeFilter,d.hasAction,d.hasFilter,d.removeAllActions,d.removeAllFilters,d.doAction,d.applyFilters,d.currentAction,d.currentFilter,d.doingAction,d.doingFilter,d.didAction,d.didFilter,d.actions,d.filters;function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function v(e,t,r){return t&&p(e.prototype,t),r&&p(e,r),e}function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&R(e,t)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=k(e);if(t){var a=k(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return E(this,r)}}function E(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var w=wp.i18n.__,A=wp.plugins.registerPlugin,O=wp.editPost,P=O.PluginSidebar,S=O.PluginSidebarMoreMenuItem,I=wp.components,x=(I.TextControl,I.PanelBody),N=(I.PanelRow,wp.editor),T=(N.BlockControls,N.InspectorControls,wp.element.Fragment),C=w("Disable auto insert for this post or page?","yet-another-stars-rating"),F=(w("Rich snippet options","yet-another-stars-rating"),w("Is this a review?","yet-another-stars-rating"),w("Select ItemType ","yet-another-stars-rating"),function(){return React.createElement("div",null)}),j=function(e){g(r,React.Component);var t=b(r);function r(e){var n;return m(this,r),(n=t.call(this,e)).yasrOverallRateThis=w("Rate this article / item","yet-another-stars-rating"),n.yasrOverallMoreInfo=w('This is the same value that you find the "Yasr: Overall Rating" block.',"yet-another-stars-rating"),n}return v(r,[{key:"shouldComponentUpdate",value:function(e,t){return!1}},{key:"printDivOverallRater",value:function(){return React.createElement("div",null,React.createElement("div",{id:"overall-rater-panel",ref:function(){return raterJs({starSize:32,step:.1,showToolTip:!1,rating:wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,readOnly:!1,element:document.querySelector("#overall-rater-panel"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),wp.data.dispatch("core/editor").editPost({meta:{yasr_overall_rating:e}}),this.setRating(e),t()}})}}),React.createElement("br",null),this.yasrOverallMoreInfo)}},{key:"render",value:function(){return React.createElement("div",null,this.yasrOverallRateThis,React.createElement("div",null,this.printDivOverallRater()))}}]),r}(),z=function(e){g(r,React.Component);var t=b(r);function r(e){var n;m(this,r),n=t.call(this,e);var a=!1;return"yes"===wp.data.select("core/editor").getCurrentPost().meta.yasr_auto_insert_disabled&&(a=!0),n.state={postExcluded:a},n.yasrUpdatePostMetaAutoInsert=n.yasrUpdatePostMetaAutoInsert.bind(_(n)),n}return v(r,[{key:"yasrUpdatePostMetaAutoInsert",value:function(e){var t=e.target,r="checkbox"===t.type?t.checked:t.value;this.setState({postExcluded:r}),!0===r?wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"yes"}}):wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"no"}})}},{key:"render",value:function(){return React.createElement("div",{className:"yasr-guten-block-panel-center"},React.createElement("hr",null),React.createElement("label",null,React.createElement("span",null,C)),React.createElement("div",{className:"yasr-onoffswitch-big yasr-onoffswitch-big-center",id:"yasr-switcher-disable-auto-insert"},React.createElement("input",{type:"checkbox",name:"yasr_auto_insert_disabled",className:"yasr-onoffswitch-checkbox",value:"yes",id:"yasr-auto-insert-disabled-switch",defaultChecked:this.state.postExcluded,onChange:this.yasrUpdatePostMetaAutoInsert}),React.createElement("label",{className:"yasr-onoffswitch-label",htmlFor:"yasr-auto-insert-disabled-switch"},React.createElement("span",{className:"yasr-onoffswitch-inner"}),React.createElement("span",{className:"yasr-onoffswitch-switch"}))))}}]),r}(),M=function(e){g(r,React.Component);var t=b(r);function r(e){var n;m(this,r),n=t.call(this,e);var a=!1;return"disabled"!==yasrConstantGutenberg.autoInsert&&(a=!0),n.state={yasrAutoInsertEnabled:a},n}return v(r,[{key:"render",value:function(){var e=[React.createElement(F,{key:0})];return wp.hooks.doAction("yasr_below_panel",e),React.createElement(T,null,React.createElement(S,{name:"yasr-sidebar",type:"sidebar",target:"yasr-guten-sidebar"},w("YASR post settings","yet-another-stars-rating")),React.createElement(P,{name:"yasr-guten-sidebar",title:"YASR Settings"},React.createElement(x,null,React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(j,null),this.state.yasrAutoInsertEnabled&&React.createElement(z,null),e))))}}]),r}();A("yasr-sidebar",{icon:"star-half",title:w("Yasr: Page Settings","yet-another-stars-rating"),render:M})}]);
|
1 |
+
(()=>{function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function n(t,r){return!r||"object"!==e(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t):r}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var s=wp.i18n.__,o=wp.blocks.registerBlockType,i=wp.components,l=i.PanelBody,c=(i.PanelRow,wp.element.Fragment),u=wp.editor,h=(u.BlockControls,u.InspectorControls),y=s("All these settings are optional","yet-another-stars-rating"),m=s("Choose Size","yet-another-stars-rating"),d=s("Choose stars size","yet-another-stars-rating"),f=s("Small","yet-another-stars-rating"),p=s("Medium","yet-another-stars-rating"),g=s("Large","yet-another-stars-rating"),v=s("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),R=s("Remember: only the post author can rate here.","yet-another-stars-rating"),b=s("This is the star set where your users will be able to vote","yet-another-stars-rating");function E(){var e=s("To be able to customize this ranking, you need","yet-another-stars-rating"),t=s("You can buy the plugin, including support, updates and upgrades, on","yet-another-stars-rating");return React.createElement("h3",null,e," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro"},"Yasr Pro."),React.createElement("br",null),t," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings"},"yetanotherstarsrating.com"))}function _(e){return React.createElement("div",null,React.createElement(E,null))}o("yet-another-stars-rating/yasr-overall-rating",{title:s("Yasr: Overall Rating","yet-another-stars-rating"),description:s("Insert the author rating","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[s("rating","yet-another-stars-rating"),s("author","yet-another-stars-rating"),s("overall","yet-another-stars-rating")],attributes:{overallRatingMeta:{type:"number",source:"meta",meta:"yasr_overall_rating"},size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var o,i=e.attributes,u=i.overallRatingMeta,b=i.size,E=i.postId,_=e.setAttributes,k=e.isSelected,w=u,A=null,I=null;"--"!==b&&(A=' size="'+b+'"'),o=/^\d+$/.test(E),"--"!==E&&!0===o&&(I=' postid="'+E+'"');var P=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}(h,React.Component);var o,i,l,c,u=(l=h,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=a(l);if(c){var r=a(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return n(this,e)});function h(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,h),(t=u.call(this,e)).yasrOverallRateThis=s("Rate this article / item","yet-another-stars-rating"),t}return o=h,(i=[{key:"render",value:function(){return React.createElement("div",null,this.yasrOverallRateThis,React.createElement("div",null,React.createElement("div",{id:"overall-rater",ref:function(){return raterJs({starSize:32,step:.1,showToolTip:!1,rating:w,readOnly:!1,element:document.querySelector("#overall-rater"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),_({overallRatingMeta:e}),this.setRating(e),t()}})}})))}}])&&t(o.prototype,i),h}();function O(){return React.createElement("form",null,React.createElement("select",{value:b,onChange:S},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},p),React.createElement("option",{value:"large"},g)))}function S(e){var t=e.target.querySelector("option:checked");_({size:t.value}),e.preventDefault()}function N(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:T}))}function T(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||_({postId:t}),e.preventDefault()}}function C(e){return React.createElement(h,null,React.createElement("div",{class:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(P,null)),React.createElement(l,{title:"Settings"},React.createElement("h3",null,y),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(O,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(N,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},R)))}return React.createElement(c,null,React.createElement(C,null),React.createElement("div",{className:e.className},"[yasr_overall_rating",A,I,"]",k&&React.createElement(O,null)))},save:function(e){var t=e.attributes,r=t.size,n=t.postId,a="",s=n;return r&&(a+='size="'+r+'"'),n&&("--"===n&&(s=wp.data.select("core/editor").getCurrentPostId()),a+=' postid="'+s+'"'),React.createElement("div",null,"[yasr_overall_rating ",a,"]")}}),o("yet-another-stars-rating/yasr-visitor-votes",{title:s("Yasr: Visitor Votes","yet-another-stars-rating"),description:s("Insert the ability for your visitors to vote","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[s("rating","yet-another-stars-rating"),s("visitor","yet-another-stars-rating"),s("votes","yet-another-stars-rating")],attributes:{size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var t,r=e.attributes,n=r.size,a=r.postId,s=e.setAttributes,o=e.isSelected,i=null,u=null;function R(){return React.createElement("form",null,React.createElement("select",{value:n,onChange:E},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},p),React.createElement("option",{value:"large"},g)))}function E(e){var t=e.target.querySelector("option:checked");s({size:t.value}),e.preventDefault()}function _(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:k}))}function k(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||s({postId:t}),e.preventDefault()}}function w(e){return React.createElement(h,null,React.createElement(l,{title:"Settings"},React.createElement("h3",null,y),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(R,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(_,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},b)))}return t=/^\d+$/.test(a),"--"!==n&&(i=' size="'+n+'"'),"--"!==a&&!0===t&&(u=' postid="'+a+'"'),React.createElement(c,null,React.createElement(w,null),React.createElement("div",{className:e.className},"[yasr_visitor_votes",i,u,"]",o&&React.createElement(R,null)))},save:function(e){var t=e.attributes,r=t.size,n=t.postId,a="",s=n;return r&&(a+='size="'+r+'"'),n&&("--"===n&&(s=wp.data.select("core/editor").getCurrentPostId()),a+=' postid="'+s+'"'),React.createElement("div",null,"[yasr_visitor_votes ",a,"]")}}),o("yet-another-stars-rating/overall-rating-ranking",{title:s("Yasr: Ranking by overall rating","yet-another-stars-rating"),description:s("This ranking shows the highest rated posts rated through the overall_rating shortcode.","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[s("ranking","yet-another-stars-rating"),s("highest","yet-another-stars-rating"),s("chart","yet-another-stars-rating")],edit:function(e){var t=[React.createElement(_,{key:0})];function r(e){return React.createElement(h,null,React.createElement(l,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,t))))}return wp.hooks.doAction("yasr_overall_rating_rankings",t),React.createElement(c,null,React.createElement(r,null),React.createElement("div",{className:e.className},"[yasr_ov_ranking]"))},save:function(e){return React.createElement("div",null,"[yasr_ov_ranking]")}}),o("yet-another-stars-rating/visitor-votes-ranking",{title:s("Yasr: Ranking by visitors votes","yet-another-stars-rating"),description:s("This ranking shows both the highest and most rated posts rated through the yasr_visitor_votes shortcode. For an item to appear in this chart, it has to be rated at least twice. ","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[s("ranking","yet-another-stars-rating"),s("highest","yet-another-stars-rating"),s("most","yet-another-stars-rating"),s("chart","yet-another-stars-rating")],edit:function(e){var t=[React.createElement(_,{key:0})];function r(e){return React.createElement(h,null,React.createElement(l,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,t))))}return wp.hooks.doAction("yasr_visitor_votes_rankings",t),React.createElement(c,null,React.createElement(r,null),React.createElement("div",{className:e.className},"[yasr_most_or_highest_rated_posts]"))},save:function(e){return React.createElement("div",null,"[yasr_most_or_highest_rated_posts]")}}),o("yet-another-stars-rating/most-active-reviewers",{title:s("Yasr: Most Active Authors","yet-another-stars-rating"),description:s("This ranking shows the most active reviewers on your site.","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[s("ranking","yet-another-stars-rating"),s("highest","yet-another-stars-rating"),s("most","yet-another-stars-rating"),s("chart","yet-another-stars-rating"),s("authors","yet-another-stars-rating")],edit:function(e){var t=[React.createElement(_,{key:0})];function r(e){return React.createElement(h,null,React.createElement(l,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,t))))}return wp.hooks.doAction("yasr_top_reviewers_setting",t),React.createElement(c,null,React.createElement(r,null),React.createElement("div",{className:e.className},"[yasr_top_reviewers]"))},save:function(e){return React.createElement("div",null,"[yasr_top_reviewers]")}}),o("yet-another-stars-rating/most-active-users",{title:s("Yasr: Most Active Visitors","yet-another-stars-rating"),description:s("This ranking shows the most active users, displaying the login name if logged in or “Anonymous” if not.","yet-another-stars-rating"),icon:"star-half",category:"yet-another-stars-rating",keywords:[s("ranking","yet-another-stars-rating"),s("highest","yet-another-stars-rating"),s("most","yet-another-stars-rating"),s("chart","yet-another-stars-rating"),s("visitors","yet-another-stars-rating")],edit:function(e){var t=[React.createElement(_,{key:0})];function r(e){return React.createElement(h,null,React.createElement(l,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,t))))}return wp.hooks.doAction("yasr_top_visitor_setting",t),React.createElement(c,null,React.createElement(r,null),React.createElement("div",{className:e.className},"[yasr_most_active_users]"))},save:function(e){return React.createElement("div",null,"[yasr_most_active_users]")}})})(),(()=>{"use strict";const e=function(e){return"string"!=typeof e||""===e?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)},t=function(e){return"string"!=typeof e||""===e?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)},r=function(r,n){return function(a,s,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,l=r[n];if(t(a)&&e(s))if("function"==typeof o)if("number"==typeof i){var c={callback:o,priority:i,namespace:s};if(l[a]){var u,h=l[a].handlers;for(u=h.length;u>0&&!(i>=h[u-1].priority);u--);u===h.length?h[u]=c:h.splice(u,0,c),l.__current.forEach((function(e){e.name===a&&e.currentIndex>=u&&e.currentIndex++}))}else l[a]={handlers:[c],runs:0};"hookAdded"!==a&&r.doAction("hookAdded",a,s,o,i)}else console.error("If specified, the hook priority must be a number.");else console.error("The hook callback must be a function.")}},n=function(r,n){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(s,o){var i=r[n];if(t(s)&&(a||e(o))){if(!i[s])return 0;var l=0;if(a)l=i[s].handlers.length,i[s]={runs:i[s].runs,handlers:[]};else for(var c=i[s].handlers,u=function(e){c[e].namespace===o&&(c.splice(e,1),l++,i.__current.forEach((function(t){t.name===s&&t.currentIndex>=e&&t.currentIndex--})))},h=c.length-1;h>=0;h--)u(h);return"hookRemoved"!==s&&r.doAction("hookRemoved",s,o),l}}},a=function(e,t){return function(r,n){var a=e[t];return void 0!==n?r in a&&a[r].handlers.some((function(e){return e.namespace===n})):r in a}},s=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(n){var a=e[t];a[n]||(a[n]={handlers:[],runs:0}),a[n].runs++;for(var s=a[n].handlers,o=arguments.length,i=new Array(o>1?o-1:0),l=1;l<o;l++)i[l-1]=arguments[l];if(!s||!s.length)return r?i[0]:void 0;var c={name:n,currentIndex:0};for(a.__current.push(c);c.currentIndex<s.length;){var u=s[c.currentIndex],h=u.callback.apply(null,i);r&&(i[0]=h),c.currentIndex++}return a.__current.pop(),r?i[0]:void 0}},o=function(e,t){return function(){var r,n,a=e[t];return null!==(r=null===(n=a.__current[a.__current.length-1])||void 0===n?void 0:n.name)&&void 0!==r?r:null}},i=function(e,t){return function(r){var n=e[t];return void 0===r?void 0!==n.__current[0]:!!n.__current[0]&&r===n.__current[0].name}},l=function(e,r){return function(n){var a=e[r];if(t(n))return a[n]&&a[n].runs?a[n].runs:0}};var c=new function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.actions=Object.create(null),this.actions.__current=[],this.filters=Object.create(null),this.filters.__current=[],this.addAction=r(this,"actions"),this.addFilter=r(this,"filters"),this.removeAction=n(this,"actions"),this.removeFilter=n(this,"filters"),this.hasAction=a(this,"actions"),this.hasFilter=a(this,"filters"),this.removeAllActions=n(this,"actions",!0),this.removeAllFilters=n(this,"filters",!0),this.doAction=s(this,"actions"),this.applyFilters=s(this,"filters",!0),this.currentAction=o(this,"actions"),this.currentFilter=o(this,"filters"),this.doingAction=i(this,"actions"),this.doingFilter=i(this,"filters"),this.didAction=l(this,"actions"),this.didFilter=l(this,"filters")};function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m(e,t,r){return t&&y(e.prototype,t),r&&y(e,r),e}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=R(e);if(t){var a=R(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return g(this,r)}}function g(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?v(e):t}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}c.addAction,c.addFilter,c.removeAction,c.removeFilter,c.hasAction,c.hasFilter,c.removeAllActions,c.removeAllFilters,c.doAction,c.applyFilters,c.currentAction,c.currentFilter,c.doingAction,c.doingFilter,c.didAction,c.didFilter,c.actions,c.filters;var b=wp.i18n.__,E=wp.plugins.registerPlugin,_=wp.editPost,k=_.PluginSidebar,w=_.PluginSidebarMoreMenuItem,A=wp.components,I=(A.TextControl,A.PanelBody),P=(A.PanelRow,wp.editor),O=(P.BlockControls,P.InspectorControls,wp.element.Fragment),S=b("Disable auto insert for this post or page?","yet-another-stars-rating"),N=(b("Rich snippet options","yet-another-stars-rating"),b("Is this a review?","yet-another-stars-rating"),b("Select ItemType ","yet-another-stars-rating"),function(){return React.createElement("div",null)}),T=function(e){d(r,React.Component);var t=p(r);function r(e){var n;return h(this,r),(n=t.call(this,e)).yasrOverallRateThis=b("Rate this article / item","yet-another-stars-rating"),n.yasrOverallMoreInfo=b('This is the same value that you find the "Yasr: Overall Rating" block.',"yet-another-stars-rating"),n}return m(r,[{key:"shouldComponentUpdate",value:function(e,t){return!1}},{key:"printDivOverallRater",value:function(){return React.createElement("div",null,React.createElement("div",{id:"overall-rater-panel",ref:function(){return raterJs({starSize:32,step:.1,showToolTip:!1,rating:wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,readOnly:!1,element:document.querySelector("#overall-rater-panel"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),wp.data.dispatch("core/editor").editPost({meta:{yasr_overall_rating:e}}),this.setRating(e),t()}})}}),React.createElement("br",null),this.yasrOverallMoreInfo)}},{key:"render",value:function(){return React.createElement("div",null,this.yasrOverallRateThis,React.createElement("div",null,this.printDivOverallRater()))}}]),r}(),C=function(e){d(r,React.Component);var t=p(r);function r(e){var n;h(this,r),n=t.call(this,e);var a=!1;return"yes"===wp.data.select("core/editor").getCurrentPost().meta.yasr_auto_insert_disabled&&(a=!0),n.state={postExcluded:a},n.yasrUpdatePostMetaAutoInsert=n.yasrUpdatePostMetaAutoInsert.bind(v(n)),n}return m(r,[{key:"yasrUpdatePostMetaAutoInsert",value:function(e){var t=e.target,r="checkbox"===t.type?t.checked:t.value;this.setState({postExcluded:r}),!0===r?wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"yes"}}):wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"no"}})}},{key:"render",value:function(){return React.createElement("div",{className:"yasr-guten-block-panel-center"},React.createElement("hr",null),React.createElement("label",null,React.createElement("span",null,S)),React.createElement("div",{className:"yasr-onoffswitch-big yasr-onoffswitch-big-center",id:"yasr-switcher-disable-auto-insert"},React.createElement("input",{type:"checkbox",name:"yasr_auto_insert_disabled",className:"yasr-onoffswitch-checkbox",value:"yes",id:"yasr-auto-insert-disabled-switch",defaultChecked:this.state.postExcluded,onChange:this.yasrUpdatePostMetaAutoInsert}),React.createElement("label",{className:"yasr-onoffswitch-label",htmlFor:"yasr-auto-insert-disabled-switch"},React.createElement("span",{className:"yasr-onoffswitch-inner"}),React.createElement("span",{className:"yasr-onoffswitch-switch"}))))}}]),r}(),x=function(e){d(r,React.Component);var t=p(r);function r(e){var n;h(this,r),n=t.call(this,e);var a=!1;return"disabled"!==yasrConstantGutenberg.autoInsert&&(a=!0),n.state={yasrAutoInsertEnabled:a},n}return m(r,[{key:"render",value:function(){var e=[React.createElement(N,{key:0})];return wp.hooks.doAction("yasr_below_panel",e),React.createElement(O,null,React.createElement(w,{name:"yasr-sidebar",type:"sidebar",target:"yasr-guten-sidebar"},b("YASR post settings","yet-another-stars-rating")),React.createElement(k,{name:"yasr-guten-sidebar",title:"YASR Settings"},React.createElement(I,null,React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(T,null),this.state.yasrAutoInsertEnabled&&React.createElement(C,null),e))))}}]),r}();E("yasr-sidebar",{icon:"star-half",title:b("Yasr: Page Settings","yet-another-stars-rating"),render:x})})();
|
admin/js/yasr-pricing-page.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function c(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,c),r.l=!0,r.exports}c.m=e,c.c=t,c.d=function(e,t,n){c.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},c.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.t=function(e,t){if(1&t&&(e=c(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(c.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)c.d(n,r,function(t){return e[t]}.bind(null,r));return n},c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,"a",t),t},c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.p="",c(c.s=0)}([function(e,t,c){e.exports=c(1)},function(e,t){function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){for(var c=0;c<t.length;c++){var n=t[c];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var c,n=s(e);if(t){var r=s(this).constructor;c=Reflect.construct(n,arguments,r)}else c=n.apply(this,arguments);return l(this,c)}}function l(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?i(e):t}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e){var t="$";return"eur"===e.name&&(t="€"),React.createElement("small",null,t," ")}function o(e){var t="/year";return"monthly"===e.name&&(t="/month"),"lifetime"===e.name&&(t=""),React.createElement("small",null,t)}function y(e){var t=" 1 website";return"plus"===e.license&&(t=" 5 websites"),"enterprise"===e.license&&(t=" 30 websites"),React.createElement("ul",{className:"PT-Features"},"annual"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"1 year")," of supports and updates ",React.createElement("br",null),"for",React.createElement("strong",null,t)),"monthly"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"1 month")," of supports and updates ",React.createElement("br",null),"for",React.createElement("strong",null,t)),"lifetime"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"Lifetime")," updates and support",React.createElement("br",null),"for",React.createElement("strong",null,t)),React.createElement("li",{className:"yasr-pricing-table-feature"},"User reviews"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Custom rankings"),React.createElement("li",{className:"yasr-pricing-table-feature"},"20 + ready to use themes"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Upload your own theme"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Add fake ratings"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Direct email support"),"lifetime"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},"We setup the plugin for free ",React.createElement("br",null),"(only lifetime plans)"))}function m(e){var t="",c=1,n="";return"single"===e.license?(n="eur"===e.currency?5399:1933,t="monthly"===e.cycle?"eur"===e.currency?"4.49":"4.99":"lifetime"===e.cycle?"eur"===e.currency?"129.99":"149.99":"eur"===e.currency?"41.99":"47.88"):"plus"===e.license?(c=5,n="eur"===e.currency?5400:1935,t="monthly"===e.cycle?"eur"===e.currency?"8.99":"9.99":"lifetime"===e.cycle?"eur"===e.currency?"249.99":"289.99":"eur"===e.currency?"83.88":"95.88"):"enterprise"===e.license&&(c=30,n="eur"===e.currency?5550:5549,t="monthly"===e.cycle?"eur"===e.currency?"12.99":"14.99":"lifetime"===e.cycle?"eur"===e.currency?"359.99":"439.99":"eur"===e.currency?"119.88":"143.88"),React.createElement("div",{className:"yasr-pring-table-price"},React.createElement(u,{name:e.currency}),React.createElement("span",null,t),React.createElement(o,{name:e.cycle}),React.createElement(p,{cycle:e.cycle,currency:e.currency,license:e.license}),React.createElement("p",{className:"PT-CTA"},React.createElement("a",{href:"#",className:"yasr-buy-button",onClick:function(t){!function(e,t,c,n){var r={plugin_id:256,billing_cycle:e,pricing_id:n,licenses:t,id:"yasr_checkout",page:"yasr_settings_page-pricing",checkout:"true",plan_id:"2778",plan_name:"yasrpro",disable_licenses_selector:!0,hide_billing_cycles:!0,currency:c},a=[];for(var l in r){var i=encodeURIComponent(l),s=encodeURIComponent(r[l]);a.push(i+"="+s)}a=a.join("&");var u=yasrCommonData.adminUrl+"admin.php?"+a;window.open(u,"_self")}(e.cycle,c,e.currency,n),t.preventDefault()}},"Buy YASR ")))}function p(e){if("annual"===e.cycle){var t="";return t="plus"===e.license?"eur"===e.currency?"6.99":"7.99":"enterprise"===e.license?"eur"===e.currency?"9.99":"11.99":"eur"===e.currency?"3.49":"3.99",React.createElement("p",{className:"yasr-pricing-table-price-desc"},React.createElement(u,{name:e.currency}),t," /month")}return React.createElement(React.Fragment,null)}var f=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}(u,React.Component);var t,c,l,s=a(u);function u(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(t=s.call(this,e)).state={currencyName:"usd",cycle:"annual"},t.updateCurrency=t.updateCurrency.bind(i(t)),t.updateCycle=t.updateCycle.bind(i(t)),t}return t=u,(c=[{key:"updateCurrency",value:function(e){var t=e.target;!0===("checkbox"===t.type?t.checked:t.value)?this.setState({currencyName:"eur"}):this.setState({currencyName:"usd"})}},{key:"updateCycle",value:function(e){this.setState({cycle:e.target.value})}},{key:"render",value:function(){return React.createElement(React.Fragment,null,React.createElement("div",{id:"yasr-radio-billing-cycle"},React.createElement("input",{type:"radio",id:"yasr-billing-cycle-monthly",name:"billing-cycle",value:"monthly",onChange:this.updateCycle,checked:"monthly"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-monthly"},"Monthly"),React.createElement("input",{type:"radio",id:"yasr-billing-cycle-annual",name:"billing-cycle",value:"annual",onChange:this.updateCycle,checked:"annual"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-annual"},"Annual"),React.createElement("input",{type:"radio",id:"yasr-billing-cycle-lifetime",name:"billing-cycle",value:"lifetime",onChange:this.updateCycle,checked:"lifetime"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-lifetime"},"Lifetime")),React.createElement("div",{id:"yasr-pricing-table"},React.createElement("div",{className:"yasr-pricing-table-item"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Plus"),React.createElement("p",{className:"yasr-pricing-table-subtitle"},"5 websites")),React.createElement(y,{cycle:this.state.cycle,license:"plus"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(m,{cycle:this.state.cycle,currency:this.state.currencyName,license:"plus"}))),React.createElement("div",{className:"yasr-pricing-table-item is-highlighted"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Single"),React.createElement("p",{className:"yasr-pricing-table-subtitle"}," 1 website")),React.createElement(y,{cycle:this.state.cycle,license:"single"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(m,{cycle:this.state.cycle,currency:this.state.currencyName,license:"single"}))),React.createElement("div",{className:"yasr-pricing-table-item"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Enterprise"),React.createElement("p",{className:"yasr-pricing-table-subtitle"}," 30 websites")),React.createElement(y,{cycle:this.state.cycle,license:"enterprise"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(m,{cycle:this.state.cycle,currency:this.state.currencyName,license:"enterprise"})))),React.createElement("div",{id:"switch-container"},React.createElement("span",{className:"yasr-pricing-text-switcher"}," Display Prices In US $ "),React.createElement("label",{className:"yasr-pricing-switch"},React.createElement("input",{type:"checkbox",onChange:this.updateCurrency}),React.createElement("span",{className:"yasr-pricing-slider"})),React.createElement("span",{className:"yasr-pricing-text-switcher"}," €")))}}])&&n(t.prototype,c),l&&n(t,l),u}();ReactDOM.render(React.createElement(f,null),document.getElementById("yasr-table-container"));var d=document.getElementById("yasr-link-policy"),b=document.getElementById("yasr-link-policy-faq"),g=document.getElementById("yasr-refund-policy"),h=document.getElementById("yasr-close-modal-policy");d.addEventListener("click",(function(){g.style.display="block",document.body.style.backgroundColor="rgba(0,0,0,0.7)"})),b.addEventListener("click",(function(){g.style.display="block",document.body.style.backgroundColor="rgba(0,0,0,0.7)"})),h.onclick=function(){g.style.display="none",document.body.style.backgroundColor="#f1f1f1"}}]);
|
1 |
+
(()=>{function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){for(var c=0;c<t.length;c++){var a=t[c];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(t,c){return!c||"object"!==e(c)&&"function"!=typeof c?n(t):c}function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e){var t="$";return"eur"===e.name&&(t="€"),React.createElement("small",null,t," ")}function i(e){var t="/year";return"monthly"===e.name&&(t="/month"),"lifetime"===e.name&&(t=""),React.createElement("small",null,t)}function s(e){var t=" 1 website";return"plus"===e.license&&(t=" 5 websites"),"enterprise"===e.license&&(t=" 30 websites"),React.createElement("ul",{className:"PT-Features"},"annual"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"1 year")," of supports and updates ",React.createElement("br",null),"for",React.createElement("strong",null,t)),"monthly"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"1 month")," of supports and updates ",React.createElement("br",null),"for",React.createElement("strong",null,t)),"lifetime"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},React.createElement("strong",null,"Lifetime")," updates and support",React.createElement("br",null),"for",React.createElement("strong",null,t)),React.createElement("li",{className:"yasr-pricing-table-feature"},"User reviews"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Custom rankings"),React.createElement("li",{className:"yasr-pricing-table-feature"},"20 + ready to use themes"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Upload your own theme"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Add fake ratings"),React.createElement("li",{className:"yasr-pricing-table-feature"},"Direct email support"),"lifetime"===e.cycle&&React.createElement("li",{className:"yasr-pricing-table-feature"},"We setup the plugin for free ",React.createElement("br",null),"(only lifetime plans)"))}function u(e){var t="",c=1,a="";return"single"===e.license?(a="eur"===e.currency?5399:1933,t="monthly"===e.cycle?"eur"===e.currency?"4.49":"4.99":"lifetime"===e.cycle?"eur"===e.currency?"129.99":"149.99":"eur"===e.currency?"41.99":"47.88"):"plus"===e.license?(c=5,a="eur"===e.currency?5400:1935,t="monthly"===e.cycle?"eur"===e.currency?"8.99":"9.99":"lifetime"===e.cycle?"eur"===e.currency?"249.99":"289.99":"eur"===e.currency?"83.88":"95.88"):"enterprise"===e.license&&(c=30,a="eur"===e.currency?5550:5549,t="monthly"===e.cycle?"eur"===e.currency?"12.99":"14.99":"lifetime"===e.cycle?"eur"===e.currency?"359.99":"439.99":"eur"===e.currency?"119.88":"143.88"),React.createElement("div",{className:"yasr-pring-table-price"},React.createElement(l,{name:e.currency}),React.createElement("span",null,t),React.createElement(i,{name:e.cycle}),React.createElement(o,{cycle:e.cycle,currency:e.currency,license:e.license}),React.createElement("p",{className:"PT-CTA"},React.createElement("a",{href:"#",className:"yasr-buy-button",onClick:function(t){!function(e,t,c,a){var n={plugin_id:256,billing_cycle:e,pricing_id:a,licenses:t,id:"yasr_checkout",page:"yasr_settings_page-pricing",checkout:"true",plan_id:"2778",plan_name:"yasrpro",disable_licenses_selector:!0,hide_billing_cycles:!0,currency:c},r=[];for(var l in n){var i=encodeURIComponent(l),s=encodeURIComponent(n[l]);r.push(i+"="+s)}r=r.join("&");var u=yasrCommonData.adminUrl+"admin.php?"+r;window.open(u,"_self")}(e.cycle,c,e.currency,a),t.preventDefault()}},"Buy YASR ")))}function o(e){if("annual"===e.cycle){var t;return t="plus"===e.license?"eur"===e.currency?"6.99":"7.99":"enterprise"===e.license?"eur"===e.currency?"9.99":"11.99":"eur"===e.currency?"3.49":"3.99",React.createElement("p",{className:"yasr-pricing-table-price-desc"},React.createElement(l,{name:e.currency}),t," /month")}return React.createElement(React.Fragment,null)}var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(p,React.Component);var l,i,o,y,m=(o=p,y=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=r(o);if(y){var c=r(this).constructor;e=Reflect.construct(t,arguments,c)}else e=t.apply(this,arguments);return a(this,e)});function p(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),(t=m.call(this,e)).state={currencyName:"usd",cycle:"annual"},t.updateCurrency=t.updateCurrency.bind(n(t)),t.updateCycle=t.updateCycle.bind(n(t)),t}return l=p,(i=[{key:"updateCurrency",value:function(e){var t=e.target;!0===("checkbox"===t.type?t.checked:t.value)?this.setState({currencyName:"eur"}):this.setState({currencyName:"usd"})}},{key:"updateCycle",value:function(e){this.setState({cycle:e.target.value})}},{key:"render",value:function(){return React.createElement(React.Fragment,null,React.createElement("div",{id:"yasr-radio-billing-cycle"},React.createElement("input",{type:"radio",id:"yasr-billing-cycle-monthly",name:"billing-cycle",value:"monthly",onChange:this.updateCycle,checked:"monthly"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-monthly"},"Monthly"),React.createElement("input",{type:"radio",id:"yasr-billing-cycle-annual",name:"billing-cycle",value:"annual",onChange:this.updateCycle,checked:"annual"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-annual"},"Annual"),React.createElement("input",{type:"radio",id:"yasr-billing-cycle-lifetime",name:"billing-cycle",value:"lifetime",onChange:this.updateCycle,checked:"lifetime"===this.state.cycle}),React.createElement("label",{htmlFor:"yasr-billing-cycle-lifetime"},"Lifetime")),React.createElement("div",{id:"yasr-pricing-table"},React.createElement("div",{className:"yasr-pricing-table-item"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Plus"),React.createElement("p",{className:"yasr-pricing-table-subtitle"},"5 websites")),React.createElement(s,{cycle:this.state.cycle,license:"plus"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(u,{cycle:this.state.cycle,currency:this.state.currencyName,license:"plus"}))),React.createElement("div",{className:"yasr-pricing-table-item is-highlighted"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Single"),React.createElement("p",{className:"yasr-pricing-table-subtitle"}," 1 website")),React.createElement(s,{cycle:this.state.cycle,license:"single"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(u,{cycle:this.state.cycle,currency:this.state.currencyName,license:"single"}))),React.createElement("div",{className:"yasr-pricing-table-item"},React.createElement("header",{className:"yasr-pricing-table-heading"},React.createElement("h2",{className:"yasr-pricing-table-title"},"Enterprise"),React.createElement("p",{className:"yasr-pricing-table-subtitle"}," 30 websites")),React.createElement(s,{cycle:this.state.cycle,license:"enterprise"}),React.createElement("div",{className:"yasr-pricing-table-footer"},React.createElement(u,{cycle:this.state.cycle,currency:this.state.currencyName,license:"enterprise"})))),React.createElement("div",{id:"switch-container"},React.createElement("span",{className:"yasr-pricing-text-switcher"}," Display Prices In US $ "),React.createElement("label",{className:"yasr-pricing-switch"},React.createElement("input",{type:"checkbox",onChange:this.updateCurrency}),React.createElement("span",{className:"yasr-pricing-slider"})),React.createElement("span",{className:"yasr-pricing-text-switcher"}," €")))}}])&&t(l.prototype,i),p}();ReactDOM.render(React.createElement(y,null),document.getElementById("yasr-table-container"));var m=document.getElementById("yasr-link-policy"),p=document.getElementById("yasr-link-policy-faq"),f=document.getElementById("yasr-refund-policy"),d=document.getElementById("yasr-close-modal-policy");m.addEventListener("click",(function(){f.style.display="block",document.body.style.backgroundColor="rgba(0,0,0,0.7)"})),p.addEventListener("click",(function(){f.style.display="block",document.body.style.backgroundColor="rgba(0,0,0,0.7)"})),d.onclick=function(){f.style.display="none",document.body.style.backgroundColor="#f1f1f1"}})();
|
admin/js/yasr-settings.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var e={};function a(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=t,a.c=e,a.d=function(t,e,r){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(r,n,function(e){return t[e]}.bind(null,n));return r},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=0)}([function(t,e,a){a(1),t.exports=a(2)},function(t,e){var a;if(document.getElementsByClassName("nav-tab-active").length>0&&(a=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===a){var r=document.getElementById("yasr_auto_insert_switch").checked,n=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===r&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===n&&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-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"===a&&(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"===a){var s=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===s){var o=jQuery("#yasr-edit-form-number-elements").attr("value");o++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(o>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 #'+o+' <input type="text" name="edit-multi-set-element-'+o+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),o++}))}else s>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var t={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,t,(function(t){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(t)})),!1})),jQuery(document).ajaxComplete((function(){var t=jQuery("#yasr-edit-form-number-elements").attr("value");t++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(t>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 #'+t+' <input type="text" name="edit-multi-set-element-'+t+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),t++}))})))}"migration_tools"===a&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var t={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,t,(function(t){t=JSON.parse(t),document.getElementById("yasr-import-ratemypost-answer").innerHTML=t}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var t={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,t,(function(t){document.getElementById("yasr-import-wppr-answer").innerHTML=t}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var t={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,t,(function(t){document.getElementById("yasr-import-kksr-answer").innerHTML=t}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var t={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,t,(function(t){document.getElementById("yasr-import-mr-answer").innerHTML=t}))})))},function(t,e,a){"use strict";var r,n;a.r(e);var s=new Uint8Array(16);function o(){if(!n&&!(n="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 n(s)}var i=/^(?:[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;for(var l=function(t){return"string"==typeof t&&i.test(t)},d=[],u=0;u<256;++u)d.push((u+256).toString(16).substr(1));var c=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(d[t[e+0]]+d[t[e+1]]+d[t[e+2]]+d[t[e+3]]+"-"+d[t[e+4]]+d[t[e+5]]+"-"+d[t[e+6]]+d[t[e+7]]+"-"+d[t[e+8]]+d[t[e+9]]+"-"+d[t[e+10]]+d[t[e+11]]+d[t[e+12]]+d[t[e+13]]+d[t[e+14]]+d[t[e+15]]).toLowerCase();if(!l(a))throw TypeError("Stringified UUID is invalid");return a};for(var y=function(t,e,a){var r=(t=t||{}).random||(t.rng||o)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){a=a||0;for(var n=0;n<16;++n)e[a+n]=r[n];return e}return c(r)},m=wp.i18n.__,g=["yasr-rater-stars","yasr-rater-stars-vv","yasr-multiset-visitors-rater"],p=0;p<g.length;p++)v(g[p]);function v(t){var e=document.getElementsByClassName(t);if(e.length>0){if("yasr-rater-stars"!==t&&"yasr-ranking-stars"!==t||function(t){for(var e=0;e<t.length;e++)if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.id;h(a.getAttribute("data-rater-starsize"),r,a)}}(e),"yasr-rater-stars-vv"===t&&(function(t){for(var e=0;e<t.length;e++)!function(e){if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.getAttribute("data-rating"),n=a.getAttribute("data-readonly-attribute"),s=a.getAttribute("data-rater-readonly");null===n&&(n=!1),n=b(n),s=b(s),!0===n&&(s=!0);var o=a.getAttribute("data-rater-postid"),i=a.id,l=i.replace("yasr-visitor-votes-rater-",""),d=parseInt(a.getAttribute("data-rater-starsize")),u=a.getAttribute("data-rater-nonce"),c=a.getAttribute("data-issingular"),y="yasr-vv-votes-number-container-"+l,g="yasr-vv-average-container-"+l,p="yasr-vv-bottom-container-"+l,v="yasr-vv-loader-"+l,f=document.getElementById(y),h=document.getElementById(g),E=document.getElementById(p),k=document.getElementById(v);if("yes"===yasrCommonData.ajaxEnabled){null!==k&&(k.innerHTML=yasrCommonData.loaderHtml);var w={action:"yasr_load_vv",post_id:o};jQuery.get(yasrCommonData.ajaxurl,w).done((function(t){var e,a=JSON.parse(t);e=!0===n||a.yasr_visitor_votes.stars_attributes.read_only,r=(r=a.yasr_visitor_votes.number_of_votes>0?a.yasr_visitor_votes.sum_votes/a.yasr_visitor_votes.number_of_votes:0).toFixed(1),r=parseFloat(r),_(d,r,o,e,i,l,u,c,f,h,k,E),!0!==n&&(null!==f&&(f.innerHTML=a.yasr_visitor_votes.number_of_votes),null!==h&&(h.innerHTML=r),!1!==a.yasr_visitor_votes.stars_attributes.span_bottom&&null!==E&&(E.innerHTML=a.yasr_visitor_votes.stars_attributes.span_bottom,E.style.display=""))})).fail((function(t,e,a,y){console.info(m("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),_(d,r,o,s,i,l,u,c,f,h,k,E),!0!==n&&(E.style.display="")}))}else _(d,r,o,s,i,l,u,c,f,h,k,E)}}(e)}(e),"yes"===yasrCommonData.visitorStatsEnabled)){var a=document.getElementsByClassName("yasr-dashicons-visitor-stats");a&&function(t){for(var e,a,r=!1,n=0;n<t.length;n++)!function(n){var s="#"+t.item(n).id,o=t.item(n).getAttribute("data-postid");(0===n&&null!==(e=document.getElementsByClassName("yasr-vv-text-container"))&&(a=window.getComputedStyle(e[0],null).getPropertyValue("color")),a)&&(document.getElementById(t.item(n).id).style.fill=a);var i={action:"yasr_stats_visitors_votes",post_id:o};tippy(s,{allowHTML:!0,content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:!0,arrowType:"round",onShow:function(t){s!==r&&jQuery.post(yasrCommonData.ajaxurl,i,(function(e){e=JSON.parse(e),t.setContent(f(e))}))},onHidden:function(){r=s}})}(n)}(a)}"yasr-multiset-visitors-rater"===t&&function(t){for(var e="",a=[],r=0;r<t.length;r++)!function(r){if(!1===t.item(r).classList.contains("yasr-star-rating")){var n=t.item(r),s=n.id,o=n.getAttribute("data-rater-readonly");o=b(o);h(16,s,n,1,o,!1,(function(t,r){var s=n.getAttribute("data-rater-postid"),o=n.getAttribute("data-rater-setid"),i=n.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var l=parseInt(t);this.setRating(l),e={postid:s,setid:o,field:i,rating:l},a.push(e),r()}))}}(r);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var t=this.getAttribute("data-postid"),e=this.getAttribute("data-setid"),r=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+t+"-"+e).hide(),jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).show();var n={action:"yasr_visitor_multiset_field_vote",nonce:r,post_id:t,rating:a,set_id:e};jQuery.post(yasrCommonData.ajaxurl,n,(function(a){var r;r=(a=JSON.parse(a)).text,jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(r)}))}))}(e)}}function f(t){var e=t.medium_rating;delete t.medium_rating;for(var a=0,r=1;r<=5;r++)(1===r||t[r].n_of_votes>a)&&(a=t[r].n_of_votes);var n=Math.log(a)*Math.LOG10E+1|0,s="5%";n<=3&&(s="5%"),n>3&&n<=5&&(s="10%"),n>5&&(s="15%");var o='<div class="yasr-visitors-stats-tooltip">';o+='<span id="yasr-medium-rating-tooltip">'+e+" "+m("out of 5 stars","yet-another-stars-rating")+"</span>",o+='<div class="yasr-progress-bars-container">';for(var i=m("stars","yet-another-stars-rating"),l=0,d=0,u=5;u>0;u--)1===u&&(i=m("star","yet-another-stars-rating")),void 0!==t[u]&&(l=t[u].progressbar,d=t[u].n_of_votes),o+="<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>".concat(u," ").concat(i,"</div> \n <div class='yasr-single-progress-bar-container'> \n <div class='yasr-w3-border'> \n <div class='yasr-w3-amber' style='height:17px;width:").concat(l,"'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style=\"flex-basis:").concat(s,' ">').concat(d,"</div>\n </div>");return o+="</div></div>"}function h(t,e){var a,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],i=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=r||document.getElementById(e),t=parseInt(t),raterJs({starSize:t,showToolTip:!1,element:a,step:n,readOnly:s,rating:o,rateCallback:i})}function _(t,e,a,r,n,s,o,i,l,d,u,c){e=parseFloat(e),r=b(r);var y=document.getElementById(n);null!==u&&(u.innerHTML="");h(t,n,y,1,r,e,(function(t,e){null!==u&&(u.innerHTML=yasrCommonData.loaderHtml);var r={action:"yasr_send_visitor_rating",rating:t,post_id:a,nonce_visitor:o,is_singular:i};this.setRating(t),this.disable(),jQuery.post(yasrCommonData.ajaxurl,r,(function(t){var e,a,r;"success"===(t=JSON.parse(t)).status?(e=t.number_of_votes,a=t.average_rating,r=t.rating_saved_text,null!==l&&(l.innerHTML=e),null!==d&&(d.innerHTML=a)):r=t.text,null!==c&&(c.innerHTML=r,c.style.display=""),null!==u&&(u.innerHTML="")})),e()}))}function b(t){return null!=t&&""!==t||(t=!0),"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1),t}function E(t){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function k(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function w(t,e){return(w=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function I(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,r=j(t);if(e){var n=j(this).constructor;a=Reflect.construct(r,arguments,n)}else a=r.apply(this,arguments);return B(this,a)}}function B(t,e){return!e||"object"!==E(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function j(t){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}O();var x=wp.i18n.__,R=wp.element.render;function C(t){var e="yasr-ranking-element-"+y(),a=document.getElementById(t.tableId).dataset.rankingSize;return React.createElement("div",{id:e,ref:function(){return h(a,e,!1,.1,!0,t.rating)}})}function L(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",x("Total:","yet-another-stars-rating")," ",t.post.number_of_votes," ",x("Average:","yet-another-stars-rating")," ",t.post.rating,"]");var e=t.text;return React.createElement("span",{className:"yasr-highest-rated-text"},e," ",t.post.rating)}function T(t){return React.createElement("td",{className:t.colClass},React.createElement("a",{href:t.post.link},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===r&&(r=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),r.innerHTML=t;var e=r.textContent;return r.innerHTML="",e}(t.post.title)))}function Q(t){var e="after",a=x("Rating:","yet-another-stars-rating"),r=new URLSearchParams(t.rankingParams);return null!==r.get("text_position")&&(e=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===e?React.createElement("td",{className:t.colClass},React.createElement(L,{post:t.post,tableId:t.tableId,text:a}),React.createElement(C,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(C,{rating:t.post.rating,tableId:t.tableId}),React.createElement(L,{post:t.post,tableId:t.tableId,text:a}))}function S(t){var e="",a="";return"author_ranking"===t.source?(e="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===t.source&&(e="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:t.trClass},React.createElement(T,{colClass:e,post:t.post}),React.createElement(Q,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function H(t){return React.createElement("tbody",{id:t.tBodyId,style:{display:t.show}},t.data.map((function(e,a){var r="yasr-rankings-td-colored";return"author_ranking"===t.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===t.source&&(r="yasr-rankings-td-colored")),React.createElement(S,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}var M=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&w(t,e)}(s,React.Component);var e,a,r,n=I(s);function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=n.call(this,t)).state={error:null,isLoaded:!1,data:[],tableId:t.tableId,source:t.source,rankingParams:t.params,nonce:t.nonce},e}return e=s,(a=[{key:"componentDidMount",value:function(){var t=this,e=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(x("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:e});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(t){return fetch(t).then((function(t){return!0===t.ok?t.json():(console.info(x("Ajax Call Failed. Getting data from source")),"KO")})).then((function(t){"KO"===t?a=e:"overall_rating"===t.source||"author_multi"===t.source?a="overall_rating"===t.source?t.data_overall:t.data_mv:a[t.show]=t.data_vv})).catch((function(t){a=e,console.info(x(t))}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(x(e)),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:x("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var t,e=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==e&&!1!==e){var s=new URLSearchParams(e);null!==s.get("order_by")&&(n+="order_by="+s.get("order_by")),null!==s.get("limit")&&(n+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(n+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(n+="&end_date="+s.get("end_date")),null!==s.get("ctg")?n+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(n+="&cpt="+s.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(n+="&setid="+s.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var o="",i="";if(""!==e){var l=new URLSearchParams(e);null!==l.get("required_votes[most]")&&(o="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+o+r,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return t}},{key:"rankingTableHead",value:function(t,e){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==t){var s=React.createElement("span",null,React.createElement("span",{id:r},x("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},x("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(s=React.createElement("span",null,React.createElement("span",{id:n},x("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},x("Most Rated","yet-another-stars-rating")))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,"Post"),React.createElement("th",null,x("Order By","yet-another-stars-rating-pro"),": ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(t){t.preventDefault();var e=t.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(e),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),e===r&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===n&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var t=this.state,e=t.data,a=t.source,r=t.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(H,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,s=e.highest,o="most",i="table-row-group",l="none",d=new URLSearchParams(r);return null!==d.get("view")&&(o=d.get("view")),"highest"===o&&(i="none",l="table-row-group"),React.createElement(React.Fragment,null,this.rankingTableHead(a,o),React.createElement(H,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:i,source:a}),React.createElement(H,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:l,source:a}))}},{key:"render",value:function(){var t=this.state,e=t.error,a=t.isLoaded;return e?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(e),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,x("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&k(e.prototype,a),r&&k(e,r),s}();function O(){var t=document.getElementsByClassName("yasr-stars-rankings");if(t.length>0)for(var e=0;e<t.length;e++){var a=t.item(e).id,r=JSON.parse(t.item(e).dataset.rankingSource),n=JSON.parse(t.item(e).dataset.rankingParams),s=JSON.parse(t.item(e).dataset.rankingNonce),o=document.getElementById(a);R(React.createElement(M,{source:r,tableId:a,params:n,nonce:s}),o)}}tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"});var P,N=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(P=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===P){var A,D=function(t){var e=$.value,a=document.getElementById("yasr-builder-shortcode").textContent,r=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];r=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",r),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+e+"&full_shortcode="+a).then((function(t){return!0===t.ok?t.json():(console.info(N("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(t){console.info(t)})).then((function(t){if("KO"!==t){var e=document.createElement("div");e.innerHTML=t,G.childNodes.length>0?G.replaceChild(e,G.childNodes[0]):G.appendChild(e)}})).then((function(t){r.forEach((function(t){e===t&&O()}))}))},F=function(t,e,a,r,n,s,o,i,l){t.style.display="",e.style.display="",s.style.display="",l.style.display="",a.style.display="none",r.style.display="none",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},J=function(t,e,a,r,n,s,o,i,l){a.style.display="",r.style.display="",e.style.display="",s.style.display="",l.style.display="",t.style.display="none",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},z=function(t,e,a,r,n,s,o,i,l){n.style.display="",l.style.display="none",t.style.display="none",a.style.display="none",r.style.display="none",e.style.display="none",s.style.display="none",null!==o&&(o.style.display="none"),null!==i&&(i.style.display="none")},U=function(t,e,a,r,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?(tt.className="",tt.classList.add("yasr-settings-row-24"),a.style.display="",r.style.display="",t.style.display="none"):(a.style.display="none",r.style.display="none",t.style.display=""),s.style.display="",e.style.display="",d.style.display="",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="")};jQuery(".yasr-builder-elements-parents").prop("disabled",!0),jQuery(".yasr-builder-elements-childs").prop("disabled",!0),jQuery(".yasr-builder-elements-parents").find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",".yasr-builder-elements-parents",".yasr-builder-elements-childs");var q=[],V={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};A=V.name,document.getElementById("yasr-builder-shortcode").textContent="["+A+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+A+"]");var K=document.getElementById("yasr-builder-button-preview"),Y=document.getElementById("yasr-builder-copy-shortcode"),G=document.getElementById("yasr-builder-preview"),$=document.getElementById("yasr-ranking-source"),W=document.getElementById("yasr-ranking-multiset-select"),X=document.getElementById("yasr-builder-datepicker-start"),Z=document.getElementById("yasr-builder-datepicker-end"),tt=document.getElementById("yasr-builder-params-container"),et=document.getElementById("builder-vv-default-view"),at=document.getElementById("builder-vv-required-votes"),rt=document.getElementById("builder-stars-size"),nt=document.getElementById("builder-overall-text"),st=document.getElementById("builder-username-options"),ot=document.getElementById("builder-category"),it=document.getElementById("builder-cpt"),lt=document.getElementById("yasr-ranking-multiset"),dt=document.getElementById("yasr-builder-datepicker"),ut=$.value,ct=!1;X.value="",Z.value="","yasr_ov_ranking"===ut?F(nt,rt,et,at,st,ot,it,lt,dt):"yasr_most_active_users"===ut||"yasr_top_reviewers"===ut?z(nt,rt,et,at,st,ot,it,lt,dt):"yasr_multi_set_ranking"===ut?U(nt,rt,et,at,st,ot,it,lt,!1,dt):"yasr_visitor_multi_set_ranking"===ut?U(nt,rt,et,at,st,ot,it,lt,!0,dt):J(nt,rt,et,at,st,ot,it,lt,dt),document.addEventListener("change",(function(t){if("yasr-ranking-source"===t.target.id)tt.className="",tt.classList.add("yasr-settings-row-33"),G.innerHTML="",X.value="",Z.value="",V={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"===t.target.value?F(nt,rt,et,at,st,ot,it,lt,dt):"yasr_most_active_users"===t.target.value||"yasr_top_reviewers"===t.target.value?z(nt,rt,et,at,st,ot,it,lt,dt):"yasr_multi_set_ranking"===t.target.value?(U(nt,rt,et,at,st,ot,it,lt,!1,dt),V.setid=" setid="+W[0].value):"yasr_visitor_multi_set_ranking"===t.target.value?(U(nt,rt,et,at,st,ot,it,lt,!0,dt),V.setid=" setid="+W[0].value):J(nt,rt,et,at,st,ot,it,lt,dt),V.name=t.target.value,A=V.name+V.setid;else{"yasr-ranking-multiset-select"===t.target.id&&(V.setid=" setid="+t.target.value),q=wp.hooks.applyFilters("yasrBuilderFilterShortcode",V);for(var e=2;V.length;e++)q.hasOwnProperty(V[e])&&(V[e]=q[e]);A=V.name+V.setid+V.rows+V.view+V.minvotesmost+V.minvoteshg+V.size+V.txtPosition+V.txt+V.display+V.start_date+V.end_date+V.category+V.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+A+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+A+"]"),!0===ct&&"yasr-ranking-source"!==t.target.id&&"yasr-builder-category-radio"!==t.target.name&&D()})),Y.onclick=function(t){!function(t){var e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="absolute",e.style.left="-9999px",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}(document.getElementById(t.target.id).getAttribute("data-shortcode"))},K.onclick=function(t){D(),ct=!0}}}]);
|
1 |
+
(()=>{var t;if(document.getElementsByClassName("nav-tab-active").length>0&&(t=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===t){var e=document.getElementById("yasr_auto_insert_switch").checked,a=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===e&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===a&&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-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"===t&&(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"===t){var r=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===r){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 t=jQuery(document.createElement("tr"));t.html('<td colspan="2">Element #'+n+' <input type="text" name="edit-multi-set-element-'+n+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),n++}))}else r>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var t={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,t,(function(t){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(t)})),!1})),jQuery(document).ajaxComplete((function(){var t=jQuery("#yasr-edit-form-number-elements").attr("value");t++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(t>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 #'+t+' <input type="text" name="edit-multi-set-element-'+t+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),t++}))})))}"migration_tools"===t&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var t={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,t,(function(t){t=JSON.parse(t),document.getElementById("yasr-import-ratemypost-answer").innerHTML=t}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var t={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,t,(function(t){document.getElementById("yasr-import-wppr-answer").innerHTML=t}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var t={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,t,(function(t){document.getElementById("yasr-import-kksr-answer").innerHTML=t}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var t={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,t,(function(t){document.getElementById("yasr-import-mr-answer").innerHTML=t}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===t&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{"use strict";var t,e,a=new Uint8Array(16);function r(){if(!e&&!(e="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 e(a)}const n=/^(?:[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,s=function(t){return"string"==typeof t&&n.test(t)};for(var o=[],i=0;i<256;++i)o.push((i+256).toString(16).substr(1));const l=function(t,e,a){var n=(t=t||{}).random||(t.rng||r)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){a=a||0;for(var i=0;i<16;++i)e[a+i]=n[i];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(o[t[e+0]]+o[t[e+1]]+o[t[e+2]]+o[t[e+3]]+"-"+o[t[e+4]]+o[t[e+5]]+"-"+o[t[e+6]]+o[t[e+7]]+"-"+o[t[e+8]]+o[t[e+9]]+"-"+o[t[e+10]]+o[t[e+11]]+o[t[e+12]]+o[t[e+13]]+o[t[e+14]]+o[t[e+15]]).toLowerCase();if(!s(a))throw TypeError("Stringified UUID is invalid");return a}(n)};for(var d=wp.i18n.__,c=["yasr-rater-stars","yasr-rater-stars-vv","yasr-multiset-visitors-rater"],u=0;u<c.length;u++)y(c[u]);function y(t){var e=document.getElementsByClassName(t);if(e.length>0){if("yasr-rater-stars"!==t&&"yasr-ranking-stars"!==t||function(t){for(var e=0;e<t.length;e++)if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.id;g(a.getAttribute("data-rater-starsize"),r,a)}}(e),"yasr-rater-stars-vv"===t&&(function(t){for(var e=0;e<t.length;e++)!function(e){if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.getAttribute("data-rating"),n=a.getAttribute("data-readonly-attribute"),s=a.getAttribute("data-rater-readonly");null===n&&(n=!1),n=v(n),s=v(s),!0===n&&(s=!0);var o=a.getAttribute("data-rater-postid"),i=a.id,l=i.replace("yasr-visitor-votes-rater-",""),c=parseInt(a.getAttribute("data-rater-starsize")),u=a.getAttribute("data-rater-nonce"),y=a.getAttribute("data-issingular"),m="yasr-vv-votes-number-container-"+l,g="yasr-vv-average-container-"+l,h="yasr-vv-bottom-container-"+l,f="yasr-vv-loader-"+l,_=document.getElementById(m),b=document.getElementById(g),E=document.getElementById(h),k=document.getElementById(f);if("yes"===yasrCommonData.ajaxEnabled){null!==k&&(k.innerHTML=yasrCommonData.loaderHtml);var w={action:"yasr_load_vv",post_id:o};jQuery.get(yasrCommonData.ajaxurl,w).done((function(t){var e,a=JSON.parse(t);e=!0===n||a.yasr_visitor_votes.stars_attributes.read_only,r=(r=a.yasr_visitor_votes.number_of_votes>0?a.yasr_visitor_votes.sum_votes/a.yasr_visitor_votes.number_of_votes:0).toFixed(1),r=parseFloat(r),p(c,r,o,e,i,0,u,y,_,b,k,E),!0!==n&&(null!==_&&(_.innerHTML=a.yasr_visitor_votes.number_of_votes),null!==b&&(b.innerHTML=r),!1!==a.yasr_visitor_votes.stars_attributes.span_bottom&&null!==E&&(E.innerHTML=a.yasr_visitor_votes.stars_attributes.span_bottom,E.style.display=""))})).fail((function(t,e,a,l){console.info(d("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),p(c,r,o,s,i,0,u,y,_,b,k,E),!0!==n&&(E.style.display="")}))}else p(c,r,o,s,i,0,u,y,_,b,k,E)}}(e)}(e),"yes"===yasrCommonData.visitorStatsEnabled)){var a=document.getElementsByClassName("yasr-dashicons-visitor-stats");a&&function(t){for(var e,a,r=!1,n=0;n<t.length;n++)!function(n){var s="#"+t.item(n).id,o=t.item(n).getAttribute("data-postid");0===n&&null!==(e=document.getElementsByClassName("yasr-vv-text-container"))&&(a=window.getComputedStyle(e[0],null).getPropertyValue("color")),a&&(document.getElementById(t.item(n).id).style.fill=a);var i={action:"yasr_stats_visitors_votes",post_id:o};tippy(s,{allowHTML:!0,content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:!0,arrowType:"round",onShow:function(t){s!==r&&jQuery.post(yasrCommonData.ajaxurl,i,(function(e){e=JSON.parse(e),t.setContent(m(e))}))},onHidden:function(){r=s}})}(n)}(a)}"yasr-multiset-visitors-rater"===t&&function(t){for(var e="",a=[],r=0;r<t.length;r++)!function(r){if(!1===t.item(r).classList.contains("yasr-star-rating")){var n=t.item(r),s=n.id,o=n.getAttribute("data-rater-readonly");o=v(o);g(16,s,n,1,o,!1,(function(t,r){var s=n.getAttribute("data-rater-postid"),o=n.getAttribute("data-rater-setid"),i=n.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var l=parseInt(t);this.setRating(l),e={postid:s,setid:o,field:i,rating:l},a.push(e),r()}))}}(r);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var t=this.getAttribute("data-postid"),e=this.getAttribute("data-setid"),r=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+t+"-"+e).hide(),jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).show();var n={action:"yasr_visitor_multiset_field_vote",nonce:r,post_id:t,rating:a,set_id:e};jQuery.post(yasrCommonData.ajaxurl,n,(function(a){var r;r=(a=JSON.parse(a)).text,jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(r)}))}))}(e)}}function m(t){var e=t.medium_rating;delete t.medium_rating;for(var a=0,r=1;r<=5;r++)(1===r||t[r].n_of_votes>a)&&(a=t[r].n_of_votes);var n=Math.log(a)*Math.LOG10E+1|0,s="5%";n<=3&&(s="5%"),n>3&&n<=5&&(s="10%"),n>5&&(s="15%");var o='<div class="yasr-visitors-stats-tooltip">';o+='<span id="yasr-medium-rating-tooltip">'+e+" "+d("out of 5 stars","yet-another-stars-rating")+"</span>",o+='<div class="yasr-progress-bars-container">';for(var i=d("stars","yet-another-stars-rating"),l=0,c=0,u=5;u>0;u--)1===u&&(i=d("star","yet-another-stars-rating")),void 0!==t[u]&&(l=t[u].progressbar,c=t[u].n_of_votes),o+="<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>".concat(u," ").concat(i,"</div> \n <div class='yasr-single-progress-bar-container'> \n <div class='yasr-w3-border'> \n <div class='yasr-w3-amber' style='height:17px;width:").concat(l,"'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style=\"flex-basis:").concat(s,' ">').concat(c,"</div>\n </div>");return o+"</div></div>"}function g(t,e){var a,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],i=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=r||document.getElementById(e),t=parseInt(t),raterJs({starSize:t,showToolTip:!1,element:a,step:n,readOnly:s,rating:o,rateCallback:i})}function p(t,e,a,r,n,s,o,i,l,d,c,u){e=parseFloat(e),r=v(r);var y=document.getElementById(n);null!==c&&(c.innerHTML=""),g(t,n,y,1,r,e,(function(t,e){null!==c&&(c.innerHTML=yasrCommonData.loaderHtml);var r={action:"yasr_send_visitor_rating",rating:t,post_id:a,nonce_visitor:o,is_singular:i};this.setRating(t),this.disable(),jQuery.post(yasrCommonData.ajaxurl,r,(function(t){var e,a,r;"success"===(t=JSON.parse(t)).status?(e=t.number_of_votes,a=t.average_rating,r=t.rating_saved_text,null!==l&&(l.innerHTML=e),null!==d&&(d.innerHTML=a)):r=t.text,null!==u&&(u.innerHTML=r,u.style.display=""),null!==c&&(c.innerHTML="")})),e()}))}function v(t){return null!=t&&""!==t||(t=!0),"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1),t}function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _(t,e){return(_=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function b(t,e){return!e||"object"!==h(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function E(t){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}T();var k=wp.i18n.__,w=wp.element.render;function I(t){var e="yasr-ranking-element-"+l(),a=document.getElementById(t.tableId).dataset.rankingSize;return React.createElement("div",{id:e,ref:function(){return g(a,e,!1,.1,!0,t.rating)}})}function B(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",k("Total:","yet-another-stars-rating")," ",t.post.number_of_votes," ",k("Average:","yet-another-stars-rating")," ",t.post.rating,"]");var e=t.text;return React.createElement("span",{className:"yasr-highest-rated-text"},e," ",t.post.rating)}function j(e){return React.createElement("td",{className:e.colClass},React.createElement("a",{href:e.post.link},function(e){if("string"!=typeof e||-1===e.indexOf("&"))return e;void 0===t&&(t=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),t.innerHTML=e;var a=t.textContent;return t.innerHTML="",a}(e.post.title)))}function R(t){var e="after",a=k("Rating:","yet-another-stars-rating"),r=new URLSearchParams(t.rankingParams);return null!==r.get("text_position")&&(e=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===e?React.createElement("td",{className:t.colClass},React.createElement(B,{post:t.post,tableId:t.tableId,text:a}),React.createElement(I,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(I,{rating:t.post.rating,tableId:t.tableId}),React.createElement(B,{post:t.post,tableId:t.tableId,text:a}))}function x(t){var e="",a="";return"author_ranking"===t.source?(e="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===t.source&&(e="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:t.trClass},React.createElement(j,{colClass:e,post:t.post}),React.createElement(R,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function C(t){return React.createElement("tbody",{id:t.tBodyId,style:{display:t.show}},t.data.map((function(e,a){var r="yasr-rankings-td-colored";return"author_ranking"===t.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===t.source&&(r="yasr-rankings-td-colored")),React.createElement(x,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}var L=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_(t,e)}(o,React.Component);var e,a,r,n,s=(r=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=E(r);if(n){var a=E(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return b(this,t)});function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=s.call(this,t)).state={error:null,isLoaded:!1,data:[],tableId:t.tableId,source:t.source,rankingParams:t.params,nonce:t.nonce},e}return e=o,(a=[{key:"componentDidMount",value:function(){var t=this,e=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(k("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:e});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(t){return fetch(t).then((function(t){return!0===t.ok?t.json():(console.info(k("Ajax Call Failed. Getting data from source")),"KO")})).then((function(t){"KO"===t?a=e:"overall_rating"===t.source||"author_multi"===t.source?a="overall_rating"===t.source?t.data_overall:t.data_mv:a[t.show]=t.data_vv})).catch((function(t){a=e,console.info(k(t))}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(k(e)),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:k("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var t,e=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==e&&!1!==e){var s=new URLSearchParams(e);null!==s.get("order_by")&&(n+="order_by="+s.get("order_by")),null!==s.get("limit")&&(n+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(n+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(n+="&end_date="+s.get("end_date")),null!==s.get("ctg")?n+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(n+="&cpt="+s.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(n+="&setid="+s.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var o="",i="";if(""!==e){var l=new URLSearchParams(e);null!==l.get("required_votes[most]")&&(o="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+o+r,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return t}},{key:"rankingTableHead",value:function(t,e){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==t){var s=React.createElement("span",null,React.createElement("span",{id:r},k("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},k("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(s=React.createElement("span",null,React.createElement("span",{id:n},k("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},k("Most Rated","yet-another-stars-rating")))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,"Post"),React.createElement("th",null,k("Order By","yet-another-stars-rating-pro"),": ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(t){t.preventDefault();var e=t.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(e),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),e===r&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===n&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var t=this.state,e=t.data,a=t.source,r=t.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(C,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,s=e.highest,o="table-row-group",i="none",l="most",d=o,c=i,u=new URLSearchParams(r);return null!==u.get("view")&&(l=u.get("view")),"highest"===l&&(d=i,c=o),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(C,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:d,source:a}),React.createElement(C,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}))}},{key:"render",value:function(){var t=this.state,e=t.error,a=t.isLoaded;return e?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(e),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,k("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&f(e.prototype,a),o}();function T(){var t=document.getElementsByClassName("yasr-stars-rankings");if(t.length>0)for(var e=0;e<t.length;e++){var a=t.item(e).id,r=JSON.parse(t.item(e).dataset.rankingSource),n=JSON.parse(t.item(e).dataset.rankingParams),s=JSON.parse(t.item(e).dataset.rankingNonce),o=document.getElementById(a);w(React.createElement(L,{source:r,tableId:a,params:n,nonce:s}),o)}}tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"});var Q,H=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(Q=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===Q){var S,M=function(t){var e=K.value,a=document.getElementById("yasr-builder-shortcode").textContent,r=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];r=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",r),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+e+"&full_shortcode="+a).then((function(t){return!0===t.ok?t.json():(console.info(H("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(t){console.info(t)})).then((function(t){if("KO"!==t){var e=document.createElement("div");e.innerHTML=t,V.childNodes.length>0?V.replaceChild(e,V.childNodes[0]):V.appendChild(e)}})).then((function(t){r.forEach((function(t){e===t&&T()}))}))},A=function(t,e,a,r,n,s,o,i,l){t.style.display="",e.style.display="",s.style.display="",l.style.display="",a.style.display="none",r.style.display="none",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},N=function(t,e,a,r,n,s,o,i,l){a.style.display="",r.style.display="",e.style.display="",s.style.display="",l.style.display="",t.style.display="none",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},O=function(t,e,a,r,n,s,o,i,l){n.style.display="",l.style.display="none",t.style.display="none",a.style.display="none",r.style.display="none",e.style.display="none",s.style.display="none",null!==o&&(o.style.display="none"),null!==i&&(i.style.display="none")},P=function(t,e,a,r,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?(W.className="",W.classList.add("yasr-settings-row-24"),a.style.display="",r.style.display="",t.style.display="none"):(a.style.display="none",r.style.display="none",t.style.display=""),s.style.display="",e.style.display="",d.style.display="",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="")},D=".yasr-builder-elements-parents",F=".yasr-builder-elements-childs";jQuery(D).prop("disabled",!0),jQuery(F).prop("disabled",!0),jQuery(D).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",D,F);var J=[],z={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};S=z.name,document.getElementById("yasr-builder-shortcode").textContent="["+S+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+S+"]");var U=document.getElementById("yasr-builder-button-preview"),q=document.getElementById("yasr-builder-copy-shortcode"),V=document.getElementById("yasr-builder-preview"),K=document.getElementById("yasr-ranking-source"),Y=document.getElementById("yasr-ranking-multiset-select"),G=document.getElementById("yasr-builder-datepicker-start"),$=document.getElementById("yasr-builder-datepicker-end"),W=document.getElementById("yasr-builder-params-container"),X=document.getElementById("builder-vv-default-view"),Z=document.getElementById("builder-vv-required-votes"),tt=document.getElementById("builder-stars-size"),et=document.getElementById("builder-overall-text"),at=document.getElementById("builder-username-options"),rt=document.getElementById("builder-category"),nt=document.getElementById("builder-cpt"),st=document.getElementById("yasr-ranking-multiset"),ot=document.getElementById("yasr-builder-datepicker"),it=K.value,lt=!1;G.value="",$.value="","yasr_ov_ranking"===it?A(et,tt,X,Z,at,rt,nt,st,ot):"yasr_most_active_users"===it||"yasr_top_reviewers"===it?O(et,tt,X,Z,at,rt,nt,st,ot):"yasr_multi_set_ranking"===it?P(et,tt,X,Z,at,rt,nt,st,!1,ot):"yasr_visitor_multi_set_ranking"===it?P(et,tt,X,Z,at,rt,nt,st,!0,ot):N(et,tt,X,Z,at,rt,nt,st,ot),document.addEventListener("change",(function(t){if("yasr-ranking-source"===t.target.id)W.className="",W.classList.add("yasr-settings-row-33"),V.innerHTML="",G.value="",$.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"===t.target.value?A(et,tt,X,Z,at,rt,nt,st,ot):"yasr_most_active_users"===t.target.value||"yasr_top_reviewers"===t.target.value?O(et,tt,X,Z,at,rt,nt,st,ot):"yasr_multi_set_ranking"===t.target.value?(P(et,tt,X,Z,at,rt,nt,st,!1,ot),z.setid=" setid="+Y[0].value):"yasr_visitor_multi_set_ranking"===t.target.value?(P(et,tt,X,Z,at,rt,nt,st,!0,ot),z.setid=" setid="+Y[0].value):N(et,tt,X,Z,at,rt,nt,st,ot),z.name=t.target.value,S=z.name+z.setid;else{"yasr-ranking-multiset-select"===t.target.id&&(z.setid=" setid="+t.target.value),J=wp.hooks.applyFilters("yasrBuilderFilterShortcode",z);for(var e=2;z.length;e++)J.hasOwnProperty(z[e])&&(z[e]=J[e]);S=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="["+S+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+S+"]"),!0===lt&&"yasr-ranking-source"!==t.target.id&&"yasr-builder-category-radio"!==t.target.name&&M()})),q.onclick=function(t){var e,a;e=document.getElementById(t.target.id).getAttribute("data-shortcode"),(a=document.createElement("textarea")).value=e,a.setAttribute("readonly",""),a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)},U.onclick=function(t){M(),lt=!0}}})();
|
admin/settings/migrations/yasr-settings-migration-page.php
CHANGED
@@ -251,6 +251,8 @@ $plugin_imported = get_option('yasr_plugin_imported');
|
|
251 |
<?php
|
252 |
}
|
253 |
}
|
|
|
|
|
254 |
?>
|
255 |
</div>
|
256 |
</td>
|
251 |
<?php
|
252 |
}
|
253 |
}
|
254 |
+
|
255 |
+
do_action('yasr_migration_page_bottom', $plugin_imported);
|
256 |
?>
|
257 |
</div>
|
258 |
</td>
|
includes/js/yasr-front.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var e={};function a(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=t,a.c=e,a.d=function(t,e,r){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(r,n,function(e){return t[e]}.bind(null,n));return r},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=0)}([function(t,e,a){t.exports=a(1)},function(t,e,a){"use strict";var r,n;a.r(e),a.d(e,"yasrSearchStarsDom",(function(){return j})),a.d(e,"yasrSetRaterValue",(function(){return O}));var s=new Uint8Array(16);function o(){if(!n&&!(n="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 n(s)}var i=/^(?:[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;for(var l=function(t){return"string"==typeof t&&i.test(t)},c=[],u=0;u<256;++u)c.push((u+256).toString(16).substr(1));var d=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(c[t[e+0]]+c[t[e+1]]+c[t[e+2]]+c[t[e+3]]+"-"+c[t[e+4]]+c[t[e+5]]+"-"+c[t[e+6]]+c[t[e+7]]+"-"+c[t[e+8]]+c[t[e+9]]+"-"+c[t[e+10]]+c[t[e+11]]+c[t[e+12]]+c[t[e+13]]+c[t[e+14]]+c[t[e+15]]).toLowerCase();if(!l(a))throw TypeError("Stringified UUID is invalid");return a};var m=function(t,e,a){var r=(t=t||{}).random||(t.rng||o)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){a=a||0;for(var n=0;n<16;++n)e[a+n]=r[n];return e}return d(r)};function g(t){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function y(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,e){return(f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function v(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,r=h(t);if(e){var n=h(this).constructor;a=Reflect.construct(r,arguments,n)}else a=r.apply(this,arguments);return p(this,a)}}function p(t,e){return!e||"object"!==g(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var b=wp.i18n.__,_=wp.element.render;function E(t){var e="yasr-ranking-element-"+m(),a=document.getElementById(t.tableId).dataset.rankingSize;return React.createElement("div",{id:e,ref:function(){return O(a,e,!1,.1,!0,t.rating)}})}function R(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",b("Total:","yet-another-stars-rating")," ",t.post.number_of_votes," ",b("Average:","yet-another-stars-rating")," ",t.post.rating,"]");var e=t.text;return React.createElement("span",{className:"yasr-highest-rated-text"},e," ",t.post.rating)}function k(t){return React.createElement("td",{className:t.colClass},React.createElement("a",{href:t.post.link},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===r&&(r=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),r.innerHTML=t;var e=r.textContent;return r.innerHTML="",e}(t.post.title)))}function I(t){var e="after",a=b("Rating:","yet-another-stars-rating"),r=new URLSearchParams(t.rankingParams);return null!==r.get("text_position")&&(e=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===e?React.createElement("td",{className:t.colClass},React.createElement(R,{post:t.post,tableId:t.tableId,text:a}),React.createElement(E,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(E,{rating:t.post.rating,tableId:t.tableId}),React.createElement(R,{post:t.post,tableId:t.tableId,text:a}))}function w(t){var e="",a="";return"author_ranking"===t.source?(e="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===t.source&&(e="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:t.trClass},React.createElement(k,{colClass:e,post:t.post}),React.createElement(I,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function x(t){return React.createElement("tbody",{id:t.tBodyId,style:{display:t.show}},t.data.map((function(e,a){var r="yasr-rankings-td-colored";return"author_ranking"===t.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===t.source&&(r="yasr-rankings-td-colored")),React.createElement(w,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}var S=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&f(t,e)}(s,React.Component);var e,a,r,n=v(s);function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=n.call(this,t)).state={error:null,isLoaded:!1,data:[],tableId:t.tableId,source:t.source,rankingParams:t.params,nonce:t.nonce},e}return e=s,(a=[{key:"componentDidMount",value:function(){var t=this,e=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(b("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:e});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(t){return fetch(t).then((function(t){return!0===t.ok?t.json():(console.info(b("Ajax Call Failed. Getting data from source")),"KO")})).then((function(t){"KO"===t?a=e:"overall_rating"===t.source||"author_multi"===t.source?a="overall_rating"===t.source?t.data_overall:t.data_mv:a[t.show]=t.data_vv})).catch((function(t){a=e,console.info(b(t))}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(b(e)),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:b("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var t,e=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==e&&!1!==e){var s=new URLSearchParams(e);null!==s.get("order_by")&&(n+="order_by="+s.get("order_by")),null!==s.get("limit")&&(n+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(n+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(n+="&end_date="+s.get("end_date")),null!==s.get("ctg")?n+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(n+="&cpt="+s.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(n+="&setid="+s.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var o="",i="";if(""!==e){var l=new URLSearchParams(e);null!==l.get("required_votes[most]")&&(o="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+o+r,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return t}},{key:"rankingTableHead",value:function(t,e){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==t){var s=React.createElement("span",null,React.createElement("span",{id:r},b("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},b("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(s=React.createElement("span",null,React.createElement("span",{id:n},b("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},b("Most Rated","yet-another-stars-rating")))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,"Post"),React.createElement("th",null,b("Order By","yet-another-stars-rating-pro"),": ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(t){t.preventDefault();var e=t.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(e),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),e===r&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===n&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var t=this.state,e=t.data,a=t.source,r=t.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(x,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,s=e.highest,o="most",i="table-row-group",l="none",c=new URLSearchParams(r);return null!==c.get("view")&&(o=c.get("view")),"highest"===o&&(i="none",l="table-row-group"),React.createElement(React.Fragment,null,this.rankingTableHead(a,o),React.createElement(x,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:i,source:a}),React.createElement(x,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:l,source:a}))}},{key:"render",value:function(){var t=this.state,e=t.error,a=t.isLoaded;return e?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(e),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,b("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&y(e.prototype,a),r&&y(e,r),s}();for(var C=wp.i18n.__,L=["yasr-rater-stars","yasr-rater-stars-vv","yasr-multiset-visitors-rater"],T=0;T<L.length;T++)j(L[T]);function j(t){var e=document.getElementsByClassName(t);if(e.length>0){if("yasr-rater-stars"!==t&&"yasr-ranking-stars"!==t||function(t){for(var e=0;e<t.length;e++)if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.id;O(a.getAttribute("data-rater-starsize"),r,a)}}(e),"yasr-rater-stars-vv"===t&&(function(t){for(var e=0;e<t.length;e++)!function(e){if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.getAttribute("data-rating"),n=a.getAttribute("data-readonly-attribute"),s=a.getAttribute("data-rater-readonly");null===n&&(n=!1),n=M(n),s=M(s),!0===n&&(s=!0);var o=a.getAttribute("data-rater-postid"),i=a.id,l=i.replace("yasr-visitor-votes-rater-",""),c=parseInt(a.getAttribute("data-rater-starsize")),u=a.getAttribute("data-rater-nonce"),d=a.getAttribute("data-issingular"),m="yasr-vv-votes-number-container-"+l,g="yasr-vv-average-container-"+l,y="yasr-vv-bottom-container-"+l,f="yasr-vv-loader-"+l,v=document.getElementById(m),p=document.getElementById(g),h=document.getElementById(y),b=document.getElementById(f);if("yes"===yasrCommonData.ajaxEnabled){null!==b&&(b.innerHTML=yasrCommonData.loaderHtml);var _={action:"yasr_load_vv",post_id:o};jQuery.get(yasrCommonData.ajaxurl,_).done((function(t){var e,a=JSON.parse(t);e=!0===n||a.yasr_visitor_votes.stars_attributes.read_only,r=(r=a.yasr_visitor_votes.number_of_votes>0?a.yasr_visitor_votes.sum_votes/a.yasr_visitor_votes.number_of_votes:0).toFixed(1),r=parseFloat(r),P(c,r,o,e,i,l,u,d,v,p,b,h),!0!==n&&(null!==v&&(v.innerHTML=a.yasr_visitor_votes.number_of_votes),null!==p&&(p.innerHTML=r),!1!==a.yasr_visitor_votes.stars_attributes.span_bottom&&null!==h&&(h.innerHTML=a.yasr_visitor_votes.stars_attributes.span_bottom,h.style.display=""))})).fail((function(t,e,a,m){console.info(C("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),P(c,r,o,s,i,l,u,d,v,p,b,h),!0!==n&&(h.style.display="")}))}else P(c,r,o,s,i,l,u,d,v,p,b,h)}}(e)}(e),"yes"===yasrCommonData.visitorStatsEnabled)){var a=document.getElementsByClassName("yasr-dashicons-visitor-stats");a&&function(t){for(var e,a,r=!1,n=0;n<t.length;n++)!function(n){var s="#"+t.item(n).id,o=t.item(n).getAttribute("data-postid");(0===n&&null!==(e=document.getElementsByClassName("yasr-vv-text-container"))&&(a=window.getComputedStyle(e[0],null).getPropertyValue("color")),a)&&(document.getElementById(t.item(n).id).style.fill=a);var i={action:"yasr_stats_visitors_votes",post_id:o};tippy(s,{allowHTML:!0,content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:!0,arrowType:"round",onShow:function(t){s!==r&&jQuery.post(yasrCommonData.ajaxurl,i,(function(e){e=JSON.parse(e),t.setContent(B(e))}))},onHidden:function(){r=s}})}(n)}(a)}"yasr-multiset-visitors-rater"===t&&function(t){for(var e="",a=[],r=0;r<t.length;r++)!function(r){if(!1===t.item(r).classList.contains("yasr-star-rating")){var n=t.item(r),s=n.id,o=n.getAttribute("data-rater-readonly");o=M(o);O(16,s,n,1,o,!1,(function(t,r){var s=n.getAttribute("data-rater-postid"),o=n.getAttribute("data-rater-setid"),i=n.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var l=parseInt(t);this.setRating(l),e={postid:s,setid:o,field:i,rating:l},a.push(e),r()}))}}(r);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var t=this.getAttribute("data-postid"),e=this.getAttribute("data-setid"),r=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+t+"-"+e).hide(),jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).show();var n={action:"yasr_visitor_multiset_field_vote",nonce:r,post_id:t,rating:a,set_id:e};jQuery.post(yasrCommonData.ajaxurl,n,(function(a){var r;r=(a=JSON.parse(a)).text,jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(r)}))}))}(e)}}function B(t){var e=t.medium_rating;delete t.medium_rating;for(var a=0,r=1;r<=5;r++)(1===r||t[r].n_of_votes>a)&&(a=t[r].n_of_votes);var n=Math.log(a)*Math.LOG10E+1|0,s="5%";n<=3&&(s="5%"),n>3&&n<=5&&(s="10%"),n>5&&(s="15%");var o='<div class="yasr-visitors-stats-tooltip">';o+='<span id="yasr-medium-rating-tooltip">'+e+" "+C("out of 5 stars","yet-another-stars-rating")+"</span>",o+='<div class="yasr-progress-bars-container">';for(var i=C("stars","yet-another-stars-rating"),l=0,c=0,u=5;u>0;u--)1===u&&(i=C("star","yet-another-stars-rating")),void 0!==t[u]&&(l=t[u].progressbar,c=t[u].n_of_votes),o+="<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>".concat(u," ").concat(i,"</div> \n <div class='yasr-single-progress-bar-container'> \n <div class='yasr-w3-border'> \n <div class='yasr-w3-amber' style='height:17px;width:").concat(l,"'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style=\"flex-basis:").concat(s,' ">').concat(c,"</div>\n </div>");return o+="</div></div>"}function O(t,e){var a,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],i=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=r||document.getElementById(e),t=parseInt(t),raterJs({starSize:t,showToolTip:!1,element:a,step:n,readOnly:s,rating:o,rateCallback:i})}function P(t,e,a,r,n,s,o,i,l,c,u,d){e=parseFloat(e),r=M(r);var m=document.getElementById(n);null!==u&&(u.innerHTML="");O(t,n,m,1,r,e,(function(t,e){null!==u&&(u.innerHTML=yasrCommonData.loaderHtml);var r={action:"yasr_send_visitor_rating",rating:t,post_id:a,nonce_visitor:o,is_singular:i};this.setRating(t),this.disable(),jQuery.post(yasrCommonData.ajaxurl,r,(function(t){var e,a,r;"success"===(t=JSON.parse(t)).status?(e=t.number_of_votes,a=t.average_rating,r=t.rating_saved_text,null!==l&&(l.innerHTML=e),null!==c&&(c.innerHTML=a)):r=t.text,null!==d&&(d.innerHTML=r,d.style.display=""),null!==u&&(u.innerHTML="")})),e()}))}function M(t){return null!=t&&""!==t||(t=!0),"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1),t}!function(){var t=document.getElementsByClassName("yasr-stars-rankings");if(t.length>0)for(var e=0;e<t.length;e++){var a=t.item(e).id,r=JSON.parse(t.item(e).dataset.rankingSource),n=JSON.parse(t.item(e).dataset.rankingParams),s=JSON.parse(t.item(e).dataset.rankingNonce),o=document.getElementById(a);_(React.createElement(S,{source:r,tableId:a,params:n,nonce:s}),o)}}()}]);
|
1 |
+
(()=>{"use strict";var t,e,a={d:(t,e)=>{for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};a.d({},{a:()=>T});var r=new Uint8Array(16);function n(){if(!e&&!(e="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 e(r)}const s=/^(?:[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,o=function(t){return"string"==typeof t&&s.test(t)};for(var i=[],l=0;l<256;++l)i.push((l+256).toString(16).substr(1));const c=function(t,e,a){var r=(t=t||{}).random||(t.rng||n)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){a=a||0;for(var s=0;s<16;++s)e[a+s]=r[s];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(i[t[e+0]]+i[t[e+1]]+i[t[e+2]]+i[t[e+3]]+"-"+i[t[e+4]]+i[t[e+5]]+"-"+i[t[e+6]]+i[t[e+7]]+"-"+i[t[e+8]]+i[t[e+9]]+"-"+i[t[e+10]]+i[t[e+11]]+i[t[e+12]]+i[t[e+13]]+i[t[e+14]]+i[t[e+15]]).toLowerCase();if(!o(a))throw TypeError("Stringified UUID is invalid");return a}(r)};function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m(t,e){return(m=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function g(t,e){return!e||"object"!==u(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var v=wp.i18n.__,f=wp.element.render;function p(t){var e="yasr-ranking-element-"+c(),a=document.getElementById(t.tableId).dataset.rankingSize;return React.createElement("div",{id:e,ref:function(){return T(a,e,!1,.1,!0,t.rating)}})}function h(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",v("Total:","yet-another-stars-rating")," ",t.post.number_of_votes," ",v("Average:","yet-another-stars-rating")," ",t.post.rating,"]");var e=t.text;return React.createElement("span",{className:"yasr-highest-rated-text"},e," ",t.post.rating)}function _(e){return React.createElement("td",{className:e.colClass},React.createElement("a",{href:e.post.link},function(e){if("string"!=typeof e||-1===e.indexOf("&"))return e;void 0===t&&(t=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),t.innerHTML=e;var a=t.textContent;return t.innerHTML="",a}(e.post.title)))}function b(t){var e="after",a=v("Rating:","yet-another-stars-rating"),r=new URLSearchParams(t.rankingParams);return null!==r.get("text_position")&&(e=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===e?React.createElement("td",{className:t.colClass},React.createElement(h,{post:t.post,tableId:t.tableId,text:a}),React.createElement(p,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(p,{rating:t.post.rating,tableId:t.tableId}),React.createElement(h,{post:t.post,tableId:t.tableId,text:a}))}function E(t){var e="",a="";return"author_ranking"===t.source?(e="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===t.source&&(e="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:t.trClass},React.createElement(_,{colClass:e,post:t.post}),React.createElement(b,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function R(t){return React.createElement("tbody",{id:t.tBodyId,style:{display:t.show}},t.data.map((function(e,a){var r="yasr-rankings-td-colored";return"author_ranking"===t.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===t.source&&(r="yasr-rankings-td-colored")),React.createElement(E,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}for(var k=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&m(t,e)}(o,React.Component);var e,a,r,n,s=(r=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=y(r);if(n){var a=y(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return g(this,t)});function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=s.call(this,t)).state={error:null,isLoaded:!1,data:[],tableId:t.tableId,source:t.source,rankingParams:t.params,nonce:t.nonce},e}return e=o,(a=[{key:"componentDidMount",value:function(){var t=this,e=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(v("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:e});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(t){return fetch(t).then((function(t){return!0===t.ok?t.json():(console.info(v("Ajax Call Failed. Getting data from source")),"KO")})).then((function(t){"KO"===t?a=e:"overall_rating"===t.source||"author_multi"===t.source?a="overall_rating"===t.source?t.data_overall:t.data_mv:a[t.show]=t.data_vv})).catch((function(t){a=e,console.info(v(t))}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(v(e)),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:v("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var t,e=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==e&&!1!==e){var s=new URLSearchParams(e);null!==s.get("order_by")&&(n+="order_by="+s.get("order_by")),null!==s.get("limit")&&(n+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(n+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(n+="&end_date="+s.get("end_date")),null!==s.get("ctg")?n+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(n+="&cpt="+s.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(n+="&setid="+s.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var o="",i="";if(""!==e){var l=new URLSearchParams(e);null!==l.get("required_votes[most]")&&(o="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+o+r,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return t}},{key:"rankingTableHead",value:function(t,e){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==t){var s=React.createElement("span",null,React.createElement("span",{id:r},v("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},v("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(s=React.createElement("span",null,React.createElement("span",{id:n},v("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},v("Most Rated","yet-another-stars-rating")))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,"Post"),React.createElement("th",null,v("Order By","yet-another-stars-rating-pro"),": ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(t){t.preventDefault();var e=t.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(e),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),e===r&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===n&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var t=this.state,e=t.data,a=t.source,r=t.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(R,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,s=e.highest,o="table-row-group",i="none",l="most",c=o,u=i,d=new URLSearchParams(r);return null!==d.get("view")&&(l=d.get("view")),"highest"===l&&(c=i,u=o),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(R,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(R,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:u,source:a}))}},{key:"render",value:function(){var t=this.state,e=t.error,a=t.isLoaded;return e?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(e),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,v("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&d(e.prototype,a),o}(),I=wp.i18n.__,w=["yasr-rater-stars","yasr-rater-stars-vv","yasr-multiset-visitors-rater"],C=0;C<w.length;C++)L(w[C]);function L(t){var e=document.getElementsByClassName(t);if(e.length>0){if("yasr-rater-stars"!==t&&"yasr-ranking-stars"!==t||function(t){for(var e=0;e<t.length;e++)if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.id;T(a.getAttribute("data-rater-starsize"),r,a)}}(e),"yasr-rater-stars-vv"===t&&(function(t){for(var e=0;e<t.length;e++)!function(e){if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.getAttribute("data-rating"),n=a.getAttribute("data-readonly-attribute"),s=a.getAttribute("data-rater-readonly");null===n&&(n=!1),n=B(n),s=B(s),!0===n&&(s=!0);var o=a.getAttribute("data-rater-postid"),i=a.id,l=i.replace("yasr-visitor-votes-rater-",""),c=parseInt(a.getAttribute("data-rater-starsize")),u=a.getAttribute("data-rater-nonce"),d=a.getAttribute("data-issingular"),m="yasr-vv-votes-number-container-"+l,g="yasr-vv-average-container-"+l,y="yasr-vv-bottom-container-"+l,v="yasr-vv-loader-"+l,f=document.getElementById(m),p=document.getElementById(g),h=document.getElementById(y),_=document.getElementById(v);if("yes"===yasrCommonData.ajaxEnabled){null!==_&&(_.innerHTML=yasrCommonData.loaderHtml);var b={action:"yasr_load_vv",post_id:o};jQuery.get(yasrCommonData.ajaxurl,b).done((function(t){var e,a=JSON.parse(t);e=!0===n||a.yasr_visitor_votes.stars_attributes.read_only,r=(r=a.yasr_visitor_votes.number_of_votes>0?a.yasr_visitor_votes.sum_votes/a.yasr_visitor_votes.number_of_votes:0).toFixed(1),r=parseFloat(r),S(c,r,o,e,i,0,u,d,f,p,_,h),!0!==n&&(null!==f&&(f.innerHTML=a.yasr_visitor_votes.number_of_votes),null!==p&&(p.innerHTML=r),!1!==a.yasr_visitor_votes.stars_attributes.span_bottom&&null!==h&&(h.innerHTML=a.yasr_visitor_votes.stars_attributes.span_bottom,h.style.display=""))})).fail((function(t,e,a,l){console.info(I("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),S(c,r,o,s,i,0,u,d,f,p,_,h),!0!==n&&(h.style.display="")}))}else S(c,r,o,s,i,0,u,d,f,p,_,h)}}(e)}(e),"yes"===yasrCommonData.visitorStatsEnabled)){var a=document.getElementsByClassName("yasr-dashicons-visitor-stats");a&&function(t){for(var e,a,r=!1,n=0;n<t.length;n++)!function(n){var s="#"+t.item(n).id,o=t.item(n).getAttribute("data-postid");0===n&&null!==(e=document.getElementsByClassName("yasr-vv-text-container"))&&(a=window.getComputedStyle(e[0],null).getPropertyValue("color")),a&&(document.getElementById(t.item(n).id).style.fill=a);var i={action:"yasr_stats_visitors_votes",post_id:o};tippy(s,{allowHTML:!0,content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:!0,arrowType:"round",onShow:function(t){s!==r&&jQuery.post(yasrCommonData.ajaxurl,i,(function(e){e=JSON.parse(e),t.setContent(x(e))}))},onHidden:function(){r=s}})}(n)}(a)}"yasr-multiset-visitors-rater"===t&&function(t){for(var e="",a=[],r=0;r<t.length;r++)!function(r){if(!1===t.item(r).classList.contains("yasr-star-rating")){var n=t.item(r),s=n.id,o=n.getAttribute("data-rater-readonly");o=B(o);T(16,s,n,1,o,!1,(function(t,r){var s=n.getAttribute("data-rater-postid"),o=n.getAttribute("data-rater-setid"),i=n.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var l=parseInt(t);this.setRating(l),e={postid:s,setid:o,field:i,rating:l},a.push(e),r()}))}}(r);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var t=this.getAttribute("data-postid"),e=this.getAttribute("data-setid"),r=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+t+"-"+e).hide(),jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).show();var n={action:"yasr_visitor_multiset_field_vote",nonce:r,post_id:t,rating:a,set_id:e};jQuery.post(yasrCommonData.ajaxurl,n,(function(a){var r;r=(a=JSON.parse(a)).text,jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(r)}))}))}(e)}}function x(t){var e=t.medium_rating;delete t.medium_rating;for(var a=0,r=1;r<=5;r++)(1===r||t[r].n_of_votes>a)&&(a=t[r].n_of_votes);var n=Math.log(a)*Math.LOG10E+1|0,s="5%";n<=3&&(s="5%"),n>3&&n<=5&&(s="10%"),n>5&&(s="15%");var o='<div class="yasr-visitors-stats-tooltip">';o+='<span id="yasr-medium-rating-tooltip">'+e+" "+I("out of 5 stars","yet-another-stars-rating")+"</span>",o+='<div class="yasr-progress-bars-container">';for(var i=I("stars","yet-another-stars-rating"),l=0,c=0,u=5;u>0;u--)1===u&&(i=I("star","yet-another-stars-rating")),void 0!==t[u]&&(l=t[u].progressbar,c=t[u].n_of_votes),o+="<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>".concat(u," ").concat(i,"</div> \n <div class='yasr-single-progress-bar-container'> \n <div class='yasr-w3-border'> \n <div class='yasr-w3-amber' style='height:17px;width:").concat(l,"'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style=\"flex-basis:").concat(s,' ">').concat(c,"</div>\n </div>");return o+"</div></div>"}function T(t,e){var a,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],i=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=r||document.getElementById(e),t=parseInt(t),raterJs({starSize:t,showToolTip:!1,element:a,step:n,readOnly:s,rating:o,rateCallback:i})}function S(t,e,a,r,n,s,o,i,l,c,u,d){e=parseFloat(e),r=B(r);var m=document.getElementById(n);null!==u&&(u.innerHTML=""),T(t,n,m,1,r,e,(function(t,e){null!==u&&(u.innerHTML=yasrCommonData.loaderHtml);var r={action:"yasr_send_visitor_rating",rating:t,post_id:a,nonce_visitor:o,is_singular:i};this.setRating(t),this.disable(),jQuery.post(yasrCommonData.ajaxurl,r,(function(t){var e,a,r;"success"===(t=JSON.parse(t)).status?(e=t.number_of_votes,a=t.average_rating,r=t.rating_saved_text,null!==l&&(l.innerHTML=e),null!==c&&(c.innerHTML=a)):r=t.text,null!==d&&(d.innerHTML=r,d.style.display=""),null!==u&&(u.innerHTML="")})),e()}))}function B(t){return null!=t&&""!==t||(t=!0),"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1),t}!function(){var t=document.getElementsByClassName("yasr-stars-rankings");if(t.length>0)for(var e=0;e<t.length;e++){var a=t.item(e).id,r=JSON.parse(t.item(e).dataset.rankingSource),n=JSON.parse(t.item(e).dataset.rankingParams),s=JSON.parse(t.item(e).dataset.rankingNonce),o=document.getElementById(a);f(React.createElement(k,{source:r,tableId:a,params:n,nonce:s}),o)}}()})();
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Requires at least: 5.0
|
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 5.4
|
8 |
-
Stable tag: 2.8.
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
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
|
@@ -194,6 +194,11 @@ Yes, YASR is 100% fully compatible with PHP 8
|
|
194 |
|
195 |
The full changelog can be found in the plugin's directory. Recent entries:
|
196 |
|
|
|
|
|
|
|
|
|
|
|
197 |
= 2.8.2 =
|
198 |
* FIXED: if "Enable stars next to the title?" is activated, the ratings also appears in rss feed.
|
199 |
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 5.4
|
8 |
+
Stable tag: 2.8.3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
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
|
194 |
|
195 |
The full changelog can be found in the plugin's directory. Recent entries:
|
196 |
|
197 |
+
= 2.8.3 =
|
198 |
+
* FIXED: compatibility with WordPress 5.8
|
199 |
+
* FIXED: link to trial page
|
200 |
+
* TWEAKED: added some hooks
|
201 |
+
|
202 |
= 2.8.2 =
|
203 |
* FIXED: if "Enable stars next to the title?" is activated, the ratings also appears in rss feed.
|
204 |
|
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: 2.8.
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://dariocurvino.it/
|
10 |
* Text Domain: yet-another-stars-rating
|
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
-
define( 'YASR_VERSION_NUM', '2.8.
|
80 |
//Plugin absolute path
|
81 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
82 |
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: 2.8.3
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://dariocurvino.it/
|
10 |
* Text Domain: yet-another-stars-rating
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
+
define( 'YASR_VERSION_NUM', '2.8.3' );
|
80 |
//Plugin absolute path
|
81 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
82 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|