Version Description
- Fix for an authenticated XSS vulnerability if 'Load results with AJAX?' is enabled
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 3.0.0 |
Comparing to | |
See all releases |
Code changes from version 2.9.9 to 3.0.0
- admin/js/guten/yasr-guten-misc.js +1 -1
- admin/js/yasr-pricing-page.js +1 -1
- admin/js/yasr-settings.js +1 -1
- includes/js/catch-inifite-scroll.js +1 -1
- includes/js/shortcodes/rankings.js +1 -1
- includes/shortcodes/classes/YasrShortcodesAjax.php +14 -4
- readme.txt +13 -11
- yet-another-stars-rating.php +2 -2
admin/js/guten/yasr-guten-misc.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(()=>{var e={245:(e,t,a)=>{"use strict";a.r(t),a.d(t,{YasrBlocksPanel:()=>R,YasrDivRatingOverall:()=>E,YasrNoSettingsPanel:()=>b,YasrPrintInputId:()=>h,YasrPrintSelectSize:()=>g,YasrProText:()=>v,yasrLabelSelectSize:()=>i,yasrLeaveThisBlankText:()=>m,yasrOptionalText:()=>s,yasrOverallDescription:()=>d,yasrSelectSizeChoose:()=>c,yasrSelectSizeLarge:()=>p,yasrSelectSizeMedium:()=>y,yasrSelectSizeSmall:()=>u,yasrVisitorVotesDescription:()=>f});var r=a(245),n=wp.i18n.__,o=wp.components.PanelBody,l=wp.blockEditor.InspectorControls,s=n("All these settings are optional","yet-another-stars-rating"),i=n("Choose Size","yet-another-stars-rating"),c=n("Choose stars size","yet-another-stars-rating"),u=n("Small","yet-another-stars-rating"),y=n("Medium","yet-another-stars-rating"),p=n("Large","yet-another-stars-rating"),m=n("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),d=n("Remember: only the post author can rate here.","yet-another-stars-rating"),f=n("This is the star set where your users will be able to vote","yet-another-stars-rating");function g(e){return React.createElement("form",null,React.createElement("select",{value:e.size,onChange:function(t){return(0,e.setAttributes)({size:(a=t).target.querySelector("option:checked").value}),void a.preventDefault();var a}},React.createElement("option",{value:"--"},r.yasrSelectSizeChoose),React.createElement("option",{value:"small"},r.yasrSelectSizeSmall),React.createElement("option",{value:"medium"},r.yasrSelectSizeMedium),React.createElement("option",{value:"large"},r.yasrSelectSizeLarge)))}function h(e){var t;return!1!==e.postId&&(t=e.postId),React.createElement("div",null,React.createElement("input",{type:"text",size:"4",defaultValue:t,onKeyPress:function(t){return function(e,t){if("Enter"===t.key){var a=t.target.value;!0!==/^\d+$/.test(a)&&""!==a||e({postId:a}),t.preventDefault()}}(e.setAttributes,t)}}))}function v(){var e=n("To be able to customize this ranking, you need","yet-another-stars-rating"),t=n("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 b(e){return React.createElement("div",null,React.createElement(v,null))}function R(e){var t;return"visitors"===e.block&&(t=f),"overall"===e.block&&(t=d),React.createElement(l,null,"overall"===e.block&&React.createElement(E,null),React.createElement(o,{title:"Settings"},React.createElement("h3",null,s),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,i),React.createElement("div",null,React.createElement(g,{size:e.size,setAttributes:e.setAttributes}))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(h,{postId:e.postId,setAttributes:e.setAttributes}),React.createElement("div",{className:"yasr-guten-block-explain"},m)),React.createElement("div",{className:"yasr-guten-block-panel"},t)))}function E(e){if(!0===JSON.parse(yasrConstantGutenberg.isFseElement))return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement("div",null,n("This is a template file, you can't rate here. You need to insert the rating inside the single post or page","yet-another-stars-rating")),React.createElement("br",null));var t=n("Rate this article / item","yet-another-stars-rating"),a=wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,r=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()};return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},t,React.createElement("div",{id:"overall-rater",ref:function(){return function(e,t){var a,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],l=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=arguments.length>2&&void 0!==arguments[2]&&arguments[2]||document.getElementById(t),e=parseInt(e),raterJs({starSize:e,showToolTip:!1,element:a,step:r,readOnly:n,rating:o,rateCallback:l})}(32,"overall-rater",!1,.1,!1,a,r)}}))}}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,a),o.exports}a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{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},e(t)}function t(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t){return a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},a(e,t)}function r(t,a){if(a&&("object"===e(a)||"function"==typeof a))return a;if(void 0!==a)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}var o=wp.i18n.__,l=wp.blocks.registerBlockType,s=wp.components,i=s.PanelBody,c=(s.PanelRow,wp.element.Fragment),u=wp.editor,y=(u.BlockControls,u.InspectorControls),p=o("All these settings are optional","yet-another-stars-rating"),m=o("Choose Size","yet-another-stars-rating"),d=o("Choose stars size","yet-another-stars-rating"),f=o("Small","yet-another-stars-rating"),g=o("Medium","yet-another-stars-rating"),h=o("Large","yet-another-stars-rating"),v=o("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),b=o("Remember: only the post author can rate here.","yet-another-stars-rating"),R=o("This is the star set where your users will be able to vote","yet-another-stars-rating"),E=o('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Overall Rating" again.',"yet-another-stars-rating"),w=o('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Visitors Votes" again.',"yet-another-stars-rating");l("yet-another-stars-rating/yasr-overall-rating",{title:o("[DEPRECATED]Yasr: Overall Rating","yet-another-stars-rating"),description:E,icon:"star-half",keywords:[o("rating","yet-another-stars-rating"),o("author","yet-another-stars-rating"),o("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 l,s=e.attributes,u=s.overallRatingMeta,R=s.size,E=s.postId,w=e.setAttributes,k=e.isSelected,_=u,S=null,P=null;"--"!==R&&(S=' size="'+R+'"'),l=/^\d+$/.test(E),"--"!==E&&!0===l&&(P=' postid="'+E+'"');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)}(y,React.Component);var l,s,i,c,u=(i=y,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=n(i);if(c){var a=n(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return r(this,e)});function y(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,y),(t=u.call(this,e)).yasrOverallRateThis=o("Rate this article / item","yet-another-stars-rating"),t}return l=y,(s=[{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:_,readOnly:!1,element:document.querySelector("#overall-rater"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),w({overallRatingMeta:e}),this.setRating(e),t()}})}})))}}])&&t(l.prototype,s),y}();function z(){return React.createElement("form",null,React.createElement("select",{value:R,onChange:I},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},h)))}function I(e){var t=e.target.querySelector("option:checked");w({size:t.value}),e.preventDefault()}function T(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:C}))}function C(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||w({postId:t}),e.preventDefault()}}function N(e){return React.createElement(y,null,React.createElement("div",{class:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(O,null)),React.createElement(i,{title:"Settings"},React.createElement("h3",null,p),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(z,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(T,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},b)))}return React.createElement(c,null,React.createElement(N,null),React.createElement("div",{className:e.className},"[yasr_overall_rating",S,P,"]",k&&React.createElement(z,null)))},save:function(e){var t=e.attributes,a=t.size,r=t.postId,n="",o=r;return a&&(n+='size="'+a+'"'),r&&("--"===r&&(o=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_overall_rating ",n,"]")}}),l("yet-another-stars-rating/yasr-visitor-votes",{title:o("[DEPRECATED]Yasr: Visitor Votes","yet-another-stars-rating"),description:w,icon:"star-half",keywords:[o("rating","yet-another-stars-rating"),o("visitor","yet-another-stars-rating"),o("votes","yet-another-stars-rating")],attributes:{size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var t,a=e.attributes,r=a.size,n=a.postId,o=e.setAttributes,l=e.isSelected,s=null,u=null;function b(){return React.createElement("form",null,React.createElement("select",{value:r,onChange:E},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},h)))}function E(e){var t=e.target.querySelector("option:checked");o({size:t.value}),e.preventDefault()}function w(){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||o({postId:t}),e.preventDefault()}}function _(e){return React.createElement(y,null,React.createElement(i,{title:"Settings"},React.createElement("h3",null,p),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(b,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(w,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},R)))}return t=/^\d+$/.test(n),"--"!==r&&(s=' size="'+r+'"'),"--"!==n&&!0===t&&(u=' postid="'+n+'"'),React.createElement(c,null,React.createElement(_,null),React.createElement("div",{className:e.className},"[yasr_visitor_votes",s,u,"]",l&&React.createElement(b,null)))},save:function(e){var t=e.attributes,a=t.size,r=t.postId,n="",o=r;return a&&(n+='size="'+a+'"'),r&&("--"===r&&(o=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_visitor_votes ",n,"]")}}),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-overall-rating"),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-visitor-votes")})(),(()=>{"use strict";var e=a(245);function t(e){return t="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(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),e}function l(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&&s(e,t)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function i(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 a,r=y(e);if(t){var n=y(this).constructor;a=Reflect.construct(r,arguments,n)}else a=r.apply(this,arguments);return c(this,a)}}function c(e,a){if(a&&("object"===t(a)||"function"==typeof a))return a;if(void 0!==a)throw new TypeError("Derived constructors may only return object or undefined");return u(e)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var p=wp.i18n.__,m=wp.plugins.registerPlugin,d=wp.editPost,f=d.PluginSidebar,g=d.PluginSidebarMoreMenuItem,h=wp.components.PanelBody,v=wp.element.Fragment,b=function(){return React.createElement("div",null)},R=function(e){l(a,React.Component);var t=i(a);function a(e){var n;r(this,a),n=t.call(this,e);var o=!1;return"yes"===wp.data.select("core/editor").getCurrentPost().meta.yasr_auto_insert_disabled&&(o=!0),n.state={postExcluded:o},n.yasrUpdatePostMetaAutoInsert=n.yasrUpdatePostMetaAutoInsert.bind(u(n)),n}return o(a,[{key:"yasrUpdatePostMetaAutoInsert",value:function(e){var t=e.target,a="checkbox"===t.type?t.checked:t.value;this.setState({postExcluded:a}),!0===a?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,p("Disable auto insert for this post or page?","yet-another-stars-rating"))),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"}))))}}]),a}(),E=function(t){l(n,React.Component);var a=i(n);function n(e){var t;r(this,n),t=a.call(this,e);var o=!1;return"disabled"!==yasrConstantGutenberg.autoInsert&&(o=!0),t.state={yasrAutoInsertEnabled:o},t}return o(n,[{key:"render",value:function(){var t=[React.createElement(b,{key:0})];return wp.hooks.doAction("yasr_below_panel",t),React.createElement(v,null,React.createElement(g,{name:"yasr-sidebar",type:"sidebar",target:"yasr-guten-sidebar"},p("YASR post settings","yet-another-stars-rating")),React.createElement(f,{name:"yasr-guten-sidebar",title:"YASR Settings"},React.createElement(h,null,React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(e.YasrDivRatingOverall,null),React.createElement("div",null,p('This is the same value that you find the "Yasr: Overall Rating" block.',"yet-another-stars-rating")),this.state.yasrAutoInsertEnabled&&React.createElement(R,null),t))))}}]),n}();m("yasr-sidebar",{icon:"star-half",title:p("Yasr: Settings","yet-another-stars-rating"),render:E})})()})();
|
1 |
+
(()=>{var e={245:(e,t,r)=>{"use strict";r.r(t),r.d(t,{YasrBlocksPanel:()=>R,YasrDivRatingOverall:()=>E,YasrNoSettingsPanel:()=>b,YasrPrintInputId:()=>h,YasrPrintSelectSize:()=>g,YasrProText:()=>v,yasrLabelSelectSize:()=>i,yasrLeaveThisBlankText:()=>d,yasrOptionalText:()=>s,yasrOverallDescription:()=>m,yasrSelectSizeChoose:()=>c,yasrSelectSizeLarge:()=>y,yasrSelectSizeMedium:()=>p,yasrSelectSizeSmall:()=>u,yasrVisitorVotesDescription:()=>f});var a=r(245),n=wp.i18n.__,o=wp.components.PanelBody,l=wp.blockEditor.InspectorControls,s=n("All these settings are optional","yet-another-stars-rating"),i=n("Choose Size","yet-another-stars-rating"),c=n("Choose stars size","yet-another-stars-rating"),u=n("Small","yet-another-stars-rating"),p=n("Medium","yet-another-stars-rating"),y=n("Large","yet-another-stars-rating"),d=n("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),m=n("Remember: only the post author can rate here.","yet-another-stars-rating"),f=n("This is the star set where your users will be able to vote","yet-another-stars-rating");function g(e){return React.createElement("form",null,React.createElement("select",{value:e.size,onChange:function(t){return(0,e.setAttributes)({size:(r=t).target.querySelector("option:checked").value}),void r.preventDefault();var r}},React.createElement("option",{value:"--"},a.yasrSelectSizeChoose),React.createElement("option",{value:"small"},a.yasrSelectSizeSmall),React.createElement("option",{value:"medium"},a.yasrSelectSizeMedium),React.createElement("option",{value:"large"},a.yasrSelectSizeLarge)))}function h(e){var t;return!1!==e.postId&&(t=e.postId),React.createElement("div",null,React.createElement("input",{type:"text",size:"4",defaultValue:t,onKeyPress:function(t){return function(e,t){if("Enter"===t.key){var r=t.target.value;!0!==/^\d+$/.test(r)&&""!==r||e({postId:r}),t.preventDefault()}}(e.setAttributes,t)}}))}function v(){var e=n("To be able to customize this ranking, you need","yet-another-stars-rating"),t=n("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 b(e){return React.createElement("div",null,React.createElement(v,null))}function R(e){var t;return"visitors"===e.block&&(t=f),"overall"===e.block&&(t=m),React.createElement(l,null,"overall"===e.block&&React.createElement(E,null),React.createElement(o,{title:"Settings"},React.createElement("h3",null,s),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,i),React.createElement("div",null,React.createElement(g,{size:e.size,setAttributes:e.setAttributes}))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(h,{postId:e.postId,setAttributes:e.setAttributes}),React.createElement("div",{className:"yasr-guten-block-explain"},d)),React.createElement("div",{className:"yasr-guten-block-panel"},t)))}function E(e){if(!0===JSON.parse(yasrConstantGutenberg.isFseElement))return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement("div",null,n("This is a template file, you can't rate here. You need to insert the rating inside the single post or page","yet-another-stars-rating")),React.createElement("br",null));var t=n("Rate this article / item","yet-another-stars-rating"),r=wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,a=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()};return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},t,React.createElement("div",{id:"overall-rater",ref:function(){return function(e,t){var r,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],l=arguments.length>6&&void 0!==arguments[6]&&arguments[6];r=arguments.length>2&&void 0!==arguments[2]&&arguments[2]||document.getElementById(t),e=parseInt(e),raterJs({starSize:e,showToolTip:!1,element:r,step:a,readOnly:n,rating:o,rateCallback:l})}(32,"overall-rater",!1,.1,!1,r,a)}}))}}},t={};function r(a){var n=t[a];if(void 0!==n)return n.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{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},e(t)}function t(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}function a(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}var o=wp.i18n.__,l=wp.blocks.registerBlockType,s=wp.components,i=s.PanelBody,c=(s.PanelRow,wp.element.Fragment),u=wp.editor,p=(u.BlockControls,u.InspectorControls),y=o("All these settings are optional","yet-another-stars-rating"),d=o("Choose Size","yet-another-stars-rating"),m=o("Choose stars size","yet-another-stars-rating"),f=o("Small","yet-another-stars-rating"),g=o("Medium","yet-another-stars-rating"),h=o("Large","yet-another-stars-rating"),v=o("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),b=o("Remember: only the post author can rate here.","yet-another-stars-rating"),R=o("This is the star set where your users will be able to vote","yet-another-stars-rating"),E=o('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Overall Rating" again.',"yet-another-stars-rating"),w=o('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Visitors Votes" again.',"yet-another-stars-rating");l("yet-another-stars-rating/yasr-overall-rating",{title:o("[DEPRECATED]Yasr: Overall Rating","yet-another-stars-rating"),description:E,icon:"star-half",keywords:[o("rating","yet-another-stars-rating"),o("author","yet-another-stars-rating"),o("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 l,s=e.attributes,u=s.overallRatingMeta,R=s.size,E=s.postId,w=e.setAttributes,k=e.isSelected,_=u,S=null,P=null;"--"!==R&&(S=' size="'+R+'"'),l=/^\d+$/.test(E),"--"!==E&&!0===l&&(P=' postid="'+E+'"');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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)}(p,React.Component);var l,s,i,c,u=(i=p,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=n(i);if(c){var r=n(this).constructor;e=Reflect.construct(t,arguments,r)}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=u.call(this,e)).yasrOverallRateThis=o("Rate this article / item","yet-another-stars-rating"),t}return l=p,(s=[{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:_,readOnly:!1,element:document.querySelector("#overall-rater"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),w({overallRatingMeta:e}),this.setRating(e),t()}})}})))}}])&&t(l.prototype,s),Object.defineProperty(l,"prototype",{writable:!1}),p}();function z(){return React.createElement("form",null,React.createElement("select",{value:R,onChange:I},React.createElement("option",{value:"--"},m),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},h)))}function I(e){var t=e.target.querySelector("option:checked");w({size:t.value}),e.preventDefault()}function T(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:C}))}function C(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||w({postId:t}),e.preventDefault()}}function N(e){return React.createElement(p,null,React.createElement("div",{class:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(O,null)),React.createElement(i,{title:"Settings"},React.createElement("h3",null,y),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,d),React.createElement("div",null,React.createElement(z,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(T,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},b)))}return React.createElement(c,null,React.createElement(N,null),React.createElement("div",{className:e.className},"[yasr_overall_rating",S,P,"]",k&&React.createElement(z,null)))},save:function(e){var t=e.attributes,r=t.size,a=t.postId,n="",o=a;return r&&(n+='size="'+r+'"'),a&&("--"===a&&(o=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_overall_rating ",n,"]")}}),l("yet-another-stars-rating/yasr-visitor-votes",{title:o("[DEPRECATED]Yasr: Visitor Votes","yet-another-stars-rating"),description:w,icon:"star-half",keywords:[o("rating","yet-another-stars-rating"),o("visitor","yet-another-stars-rating"),o("votes","yet-another-stars-rating")],attributes:{size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var t,r=e.attributes,a=r.size,n=r.postId,o=e.setAttributes,l=e.isSelected,s=null,u=null;function b(){return React.createElement("form",null,React.createElement("select",{value:a,onChange:E},React.createElement("option",{value:"--"},m),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},h)))}function E(e){var t=e.target.querySelector("option:checked");o({size:t.value}),e.preventDefault()}function w(){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||o({postId:t}),e.preventDefault()}}function _(e){return React.createElement(p,null,React.createElement(i,{title:"Settings"},React.createElement("h3",null,y),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,d),React.createElement("div",null,React.createElement(b,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(w,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},R)))}return t=/^\d+$/.test(n),"--"!==a&&(s=' size="'+a+'"'),"--"!==n&&!0===t&&(u=' postid="'+n+'"'),React.createElement(c,null,React.createElement(_,null),React.createElement("div",{className:e.className},"[yasr_visitor_votes",s,u,"]",l&&React.createElement(b,null)))},save:function(e){var t=e.attributes,r=t.size,a=t.postId,n="",o=a;return r&&(n+='size="'+r+'"'),a&&("--"===a&&(o=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_visitor_votes ",n,"]")}}),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-overall-rating"),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-visitor-votes")})(),(()=>{"use strict";var e=r(245);function t(e){return t="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(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function o(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function i(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,a=p(e);if(t){var n=p(this).constructor;r=Reflect.construct(a,arguments,n)}else r=a.apply(this,arguments);return c(this,r)}}function c(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return u(e)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}var y=wp.i18n.__,d=wp.plugins.registerPlugin,m=wp.editPost,f=m.PluginSidebar,g=m.PluginSidebarMoreMenuItem,h=wp.components.PanelBody,v=wp.element.Fragment,b=function(){return React.createElement("div",null)},R=function(e){l(r,React.Component);var t=i(r);function r(e){var n;a(this,r),n=t.call(this,e);var o=!1;return"yes"===wp.data.select("core/editor").getCurrentPost().meta.yasr_auto_insert_disabled&&(o=!0),n.state={postExcluded:o},n.yasrUpdatePostMetaAutoInsert=n.yasrUpdatePostMetaAutoInsert.bind(u(n)),n}return o(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,y("Disable auto insert for this post or page?","yet-another-stars-rating"))),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}(),E=function(t){l(n,React.Component);var r=i(n);function n(e){var t;a(this,n),t=r.call(this,e);var o=!1;return"disabled"!==yasrConstantGutenberg.autoInsert&&(o=!0),t.state={yasrAutoInsertEnabled:o},t}return o(n,[{key:"render",value:function(){var t=[React.createElement(b,{key:0})];return wp.hooks.doAction("yasr_below_panel",t),React.createElement(v,null,React.createElement(g,{name:"yasr-sidebar",type:"sidebar",target:"yasr-guten-sidebar"},y("YASR post settings","yet-another-stars-rating")),React.createElement(f,{name:"yasr-guten-sidebar",title:"YASR Settings"},React.createElement(h,null,React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(e.YasrDivRatingOverall,null),React.createElement("div",null,y('This is the same value that you find the "Yasr: Overall Rating" block.',"yet-another-stars-rating")),this.state.yasrAutoInsertEnabled&&React.createElement(R,null),t))))}}]),n}();d("yasr-sidebar",{icon:"star-half",title:y("Yasr: Settings","yet-another-stars-rating"),render:E})})()})();
|
admin/js/yasr-pricing-page.js
CHANGED
@@ -1 +1 @@
|
|
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},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},c(e,t)}function a(t,c){if(c&&("object"===e(c)||"function"==typeof c))return c;if(void 0!==c)throw new TypeError("Derived constructors may only return object or undefined");return r(t)}function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(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 r={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},n=[];for(var l in r){var i=encodeURIComponent(l),s=encodeURIComponent(r[l]);n.push(i+"="+s)}n=n.join("&");var u=yasrCommonData.adminUrl+"admin.php?"+n;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=n(o);if(y){var c=n(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(r(t)),t.updateCycle=t.updateCycle.bind(r(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"}})();
|
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},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},c(e,t)}function a(t,c){if(c&&("object"===e(c)||"function"==typeof c))return c;if(void 0!==c)throw new TypeError("Derived constructors may only return object or undefined");return r(t)}function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(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 r={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},n=[];for(var l in r){var i=encodeURIComponent(l),s=encodeURIComponent(r[l]);n.push(i+"="+s)}n=n.join("&");var u=yasrCommonData.adminUrl+"admin.php?"+n;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}}),Object.defineProperty(e,"prototype",{writable:!1}),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=n(o);if(y){var c=n(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(r(t)),t.updateCycle=t.updateCycle.bind(r(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),Object.defineProperty(l,"prototype",{writable:!1}),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 |
-
(()=>{var e;if(document.getElementsByClassName("nav-tab-active").length>0&&(e=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===e){var t=document.getElementById("yasr_auto_insert_switch").checked,a=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===t&&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-rating-saved").value="Rating saved!",document.getElementById("yasr-settings-custom-text-rating-updated").value="Rating updated!",document.getElementById("yasr-settings-custom-text-must-sign-in").value="You must sign in to vote",document.getElementById("yasr-settings-custom-text-already-rated").value="You have already voted for this article with %rating%"}))}if("style_options"===e&&(wp.codeEditor.initialize(document.getElementById("yasr_style_options_textarea"),yasr_cm_settings),jQuery("#yasr-color-scheme-preview-link").on("click",(function(){return jQuery("#yasr-color-scheme-preview").toggle("slow"),!1})),wp.hooks.doAction("yasrStyleOptions")),"manage_multi"===e){var n=parseInt(document.getElementById("n-multiset").value);if(jQuery("#yasr-multi-set-doc-link").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),jQuery("#yasr-multi-set-doc-link-hide").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),1===n){var r=jQuery("#yasr-edit-form-number-elements").attr("value");r++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(r>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 #'+r+' <input type="text" name="edit-multi-set-element-'+r+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),r++}))}else n>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var e={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(e)})),!1})),jQuery(document).ajaxComplete((function(){var e=jQuery("#yasr-edit-form-number-elements").attr("value");e++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(e>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var t=jQuery(document.createElement("tr"));t.html('<td colspan="2">Element #'+e+' <input type="text" name="edit-multi-set-element-'+e+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),e++}))})))}"migration_tools"===e&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-ratemypost-answer").innerHTML=e}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-mr-answer").innerHTML=e}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===e&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{"use strict";var e,t,a=new Uint8Array(16);function n(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(a)}const r=/^(?:[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(e){return"string"==typeof e&&r.test(e)};for(var o=[],i=0;i<256;++i)o.push((i+256).toString(16).substr(1));const l=function(e,t,a){var r=(e=e||{}).random||(e.rng||n)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){a=a||0;for(var i=0;i<16;++i)t[a+i]=r[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!s(a))throw TypeError("Stringified UUID is invalid");return a}(r)};function d(e){return d="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},d(e)}function c(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function m(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var p=wp.i18n.__,g=wp.element.render;function h(e){var t="yasr-ranking-element-"+l(),a=document.getElementById(e.tableId).dataset.rankingSize;return React.createElement("div",{id:t,ref:function(){return function(e,t){var a,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=arguments.length>2&&void 0!==arguments[2]&&arguments[2]||document.getElementById(t),e=parseInt(e),raterJs({starSize:e,showToolTip:!1,element:a,step:n,readOnly:r,rating:s,rateCallback:o})}(a,t,!1,.1,!0,e.rating)}})}function f(e){if(void 0!==e.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",p("Total:","yet-another-stars-rating")," ",e.post.number_of_votes," ",p("Average:","yet-another-stars-rating")," ",e.post.rating,"]");var t=e.text;return React.createElement("span",{className:"yasr-highest-rated-text"},t," ",e.post.rating)}function v(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===e&&(e=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),e.innerHTML=t;var a=e.textContent;return e.innerHTML="",a}(t.post.title)))}function _(e){var t="after",a=p("Rating:","yet-another-stars-rating"),n=new URLSearchParams(e.rankingParams);return null!==n.get("text_position")&&(t=n.get("text_position")),null!==n.get("custom_txt")&&(a=n.get("custom_txt")),"before"===t?React.createElement("td",{className:e.colClass},React.createElement(f,{post:e.post,tableId:e.tableId,text:a}),React.createElement(h,{rating:e.post.rating,tableId:e.tableId})):React.createElement("td",{className:e.colClass},React.createElement(h,{rating:e.post.rating,tableId:e.tableId}),React.createElement(f,{post:e.post,tableId:e.tableId,text:a}))}function b(e){var t="",a="";return"author_ranking"===e.source?(t="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===e.source&&(t="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:e.trClass},React.createElement(v,{colClass:t,post:e.post}),React.createElement(_,{colClass:a,post:e.post,tableId:e.tableId,rankingParams:e.rankingParams}))}function E(e){return React.createElement("tbody",{id:e.tBodyId,style:{display:e.show}},e.data.map((function(t,a){var n="yasr-rankings-td-colored";return"author_ranking"===e.source&&(n="yasr-rankings-td-white"),a%2==0&&(n="yasr-rankings-td-white","author_ranking"===e.source&&(n="yasr-rankings-td-colored")),React.createElement(b,{key:t.post_id,source:e.source,tableId:e.tableId,rankingParams:e.rankingParams,post:t,trClass:n})})))}var k=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&&u(e,t)}(o,React.Component);var t,a,n,r,s=(n=o,r=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=y(n);if(r){var a=y(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return m(this,e)});function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=s.call(this,e)).state={error:null,isLoaded:!1,data:[],tableId:e.tableId,source:e.source,rankingParams:e.params,nonce:e.nonce},t}return t=o,a=[{key:"componentDidMount",value:function(){var e=this,t=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(p("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:t});else if(this.state.source){var n=this.returnRestUrl();Promise.all(n.map((function(e){return fetch(e).then((function(e){return!0===e.ok?e.json():(console.info(p("Ajax Call Failed. Getting data from source")),"KO")})).then((function(e){"KO"===e?a=t:"overall_rating"===e.source||"author_multi"===e.source?a="overall_rating"===e.source?e.data_overall:e.data_mv:a[e.show]=e.data_vv})).catch((function(e){a=t,console.info(p(e))}))}))).then((function(t){e.setState({isLoaded:!0,data:a})})).catch((function(t){console.info(p(t)),e.setState({isLoaded:!0,data:a})}))}else this.setState({error:p("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var e,t=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,n="&nonce_rankings="+this.state.nonce,r="";if(""!==t&&!1!==t){var s=new URLSearchParams(t);null!==s.get("order_by")&&(r+="order_by="+s.get("order_by")),null!==s.get("limit")&&(r+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(r+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(r+="&end_date="+s.get("end_date")),null!==s.get("ctg")?r+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(r+="&cpt="+s.get("cpt")),""!==r&&(r="&"+(r=r.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(r+="&setid="+s.get("setid"))}else r="";if("author_ranking"===a||"author_multi"===a)e=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+r+n];else{var o="",i="";if(""!==t){var l=new URLSearchParams(t);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]"))}e=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+r+o+n,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+r+i+n]}return e}},{key:"rankingTableHead",value:function(e,t){var a=this.state.tableId,n="link-most-rated-posts-"+a,r="link-highest-rated-posts-"+a;if("author_ranking"!==e){var s=React.createElement("span",null,React.createElement("span",{id:n},p("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},p("Highest Rated","yet-another-stars-rating")));return"highest"===t&&(s=React.createElement("span",null,React.createElement("span",{id:r},p("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},p("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,p("Post","yet-another-stars-rating")),React.createElement("th",null,p("Order By","yet-another-stars-rating"),": ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(e){e.preventDefault();var t=e.target.id,a=this.state.tableId,n="link-most-rated-posts-"+a,r="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(t),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),t===n&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),t===r&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var e=this.state,t=e.data,a=e.source,n=e.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(E,{data:t,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:n,show:"table-row-group",source:a});var r=t.most,s=t.highest,o="table-row-group",i="none",l="most",d=o,c=i,u=new URLSearchParams(n);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(E,{data:r,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:n,show:d,source:a}),React.createElement(E,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:n,show:c,source:a}))}},{key:"render",value:function(){var e=this.state,t=e.error,a=e.isLoaded;return t?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,p("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}],a&&c(t.prototype,a),o}();function I(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var a=e.item(t).id,n=JSON.parse(e.item(t).dataset.rankingSource),r=JSON.parse(e.item(t).dataset.rankingParams),s=JSON.parse(e.item(t).dataset.rankingNonce),o=document.getElementById(a);g(React.createElement(k,{source:n,tableId:a,params:r,nonce:s}),o)}}I(),tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"});var w,B=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(w=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===w){var R,j=function(e){var t=D.value,a=document.getElementById("yasr-builder-shortcode").textContent,n=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];n=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",n),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+a).then((function(e){return!0===e.ok?e.json():(console.info(B("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(e){console.info(e)})).then((function(e){if("KO"!==e){var t=document.createElement("div");t.innerHTML=e,M.childNodes.length>0?M.replaceChild(t,M.childNodes[0]):M.appendChild(t)}})).then((function(e){n.forEach((function(e){t===e&&I()}))}))},x=function(e,t,a,n,r,s,o,i,l){e.style.display="",t.style.display="",s.style.display="",l.style.display="",a.style.display="none",n.style.display="none",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},C=function(e,t,a,n,r,s,o,i,l){a.style.display="",n.style.display="",t.style.display="",s.style.display="",l.style.display="",e.style.display="none",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},Q=function(e,t,a,n,r,s,o,i,l){r.style.display="",l.style.display="none",e.style.display="none",a.style.display="none",n.style.display="none",t.style.display="none",s.style.display="none",null!==o&&(o.style.display="none"),null!==i&&(i.style.display="none")},T=function(e,t,a,n,r,s,o,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],d=arguments.length>9?arguments[9]:void 0;!0===l?(F.className="",F.classList.add("yasr-settings-row-24"),a.style.display="",n.style.display="",e.style.display="none"):(a.style.display="none",n.style.display="none",e.style.display=""),s.style.display="",t.style.display="",d.style.display="",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="")},L=".yasr-builder-elements-parents",S=".yasr-builder-elements-childs";jQuery(L).prop("disabled",!0),jQuery(S).prop("disabled",!0),jQuery(L).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",L,S);var P=[],H={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};R=H.name,document.getElementById("yasr-builder-shortcode").textContent="["+R+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+R+"]");var O=document.getElementById("yasr-builder-button-preview"),N=document.getElementById("yasr-builder-copy-shortcode"),M=document.getElementById("yasr-builder-preview"),D=document.getElementById("yasr-ranking-source"),A=document.getElementById("yasr-ranking-multiset-select"),U=document.getElementById("yasr-builder-datepicker-start"),q=document.getElementById("yasr-builder-datepicker-end"),F=document.getElementById("yasr-builder-params-container"),z=document.getElementById("builder-vv-default-view"),J=document.getElementById("builder-vv-required-votes"),V=document.getElementById("builder-stars-size"),K=document.getElementById("builder-overall-text"),Y=document.getElementById("builder-username-options"),G=document.getElementById("builder-category"),$=document.getElementById("builder-cpt"),W=document.getElementById("yasr-ranking-multiset"),X=document.getElementById("yasr-builder-datepicker"),Z=D.value,ee=!1;U.value="",q.value="","yasr_ov_ranking"===Z?x(K,V,z,J,Y,G,$,W,X):"yasr_most_active_users"===Z||"yasr_top_reviewers"===Z?Q(K,V,z,J,Y,G,$,W,X):"yasr_multi_set_ranking"===Z?T(K,V,z,J,Y,G,$,W,!1,X):"yasr_visitor_multi_set_ranking"===Z?T(K,V,z,J,Y,G,$,W,!0,X):C(K,V,z,J,Y,G,$,W,X),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)F.className="",F.classList.add("yasr-settings-row-33"),M.innerHTML="",U.value="",q.value="",H={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""},"yasr_ov_ranking"===e.target.value?x(K,V,z,J,Y,G,$,W,X):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?Q(K,V,z,J,Y,G,$,W,X):"yasr_multi_set_ranking"===e.target.value?(T(K,V,z,J,Y,G,$,W,!1,X),H.setid=" setid="+A[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(T(K,V,z,J,Y,G,$,W,!0,X),H.setid=" setid="+A[0].value):C(K,V,z,J,Y,G,$,W,X),H.name=e.target.value,R=H.name+H.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(H.setid=" setid="+e.target.value),P=wp.hooks.applyFilters("yasrBuilderFilterShortcode",H);for(var t=2;H.length;t++)P.hasOwnProperty(H[t])&&(H[t]=P[t]);R=H.name+H.setid+H.rows+H.view+H.minvotesmost+H.minvoteshg+H.size+H.txtPosition+H.txt+H.display+H.start_date+H.end_date+H.category+H.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+R+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+R+"]"),!0===ee&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&j()})),N.onclick=function(e){var t,a;t=document.getElementById(e.target.id).getAttribute("data-shortcode"),(a=document.createElement("textarea")).value=t,a.setAttribute("readonly",""),a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)},O.onclick=function(e){j(),ee=!0}}})();
|
1 |
+
(()=>{var e;if(document.getElementsByClassName("nav-tab-active").length>0&&(e=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===e){var t=document.getElementById("yasr_auto_insert_switch").checked,a=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===t&&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-rating-saved").value="Rating saved!",document.getElementById("yasr-settings-custom-text-rating-updated").value="Rating updated!",document.getElementById("yasr-settings-custom-text-must-sign-in").value="You must sign in to vote",document.getElementById("yasr-settings-custom-text-already-rated").value="You have already voted for this article with %rating%"}))}if("style_options"===e&&(wp.codeEditor.initialize(document.getElementById("yasr_style_options_textarea"),yasr_cm_settings),jQuery("#yasr-color-scheme-preview-link").on("click",(function(){return jQuery("#yasr-color-scheme-preview").toggle("slow"),!1})),wp.hooks.doAction("yasrStyleOptions")),"manage_multi"===e){var n=parseInt(document.getElementById("n-multiset").value);if(jQuery("#yasr-multi-set-doc-link").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),jQuery("#yasr-multi-set-doc-link-hide").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),1===n){var r=jQuery("#yasr-edit-form-number-elements").attr("value");r++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(r>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 #'+r+' <input type="text" name="edit-multi-set-element-'+r+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),r++}))}else n>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var e={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(e)})),!1})),jQuery(document).ajaxComplete((function(){var e=jQuery("#yasr-edit-form-number-elements").attr("value");e++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(e>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var t=jQuery(document.createElement("tr"));t.html('<td colspan="2">Element #'+e+' <input type="text" name="edit-multi-set-element-'+e+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),e++}))})))}"migration_tools"===e&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-ratemypost-answer").innerHTML=e}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML='<img src="'+yasrCommonData.loaderHtml+'"</img>';var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-mr-answer").innerHTML=e}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===e&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{"use strict";let e;var t,a=new Uint8Array(16);function n(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(a)}const r=/^(?:[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(e){return"string"==typeof e&&r.test(e)};for(var o=[],i=0;i<256;++i)o.push((i+256).toString(16).substr(1));const l=function(e,t,a){var r=(e=e||{}).random||(e.rng||n)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){a=a||0;for(var i=0;i<16;++i)t[a+i]=r[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!s(a))throw TypeError("Stringified UUID is invalid");return a}(r)};function d(e){return d="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},d(e)}function c(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function y(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}var p=wp.i18n.__,g=wp.element.render;function h(e){var t="yasr-ranking-element-"+l(),a=document.getElementById(e.tableId).dataset.rankingSize;return React.createElement("div",{id:t,ref:function(){return function(e,t){var a,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=arguments.length>2&&void 0!==arguments[2]&&arguments[2]||document.getElementById(t),e=parseInt(e),raterJs({starSize:e,showToolTip:!1,element:a,step:n,readOnly:r,rating:s,rateCallback:o})}(a,t,!1,.1,!0,e.rating)}})}function f(e){if(void 0!==e.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",p("Total:","yet-another-stars-rating")," ",e.post.number_of_votes," ",p("Average:","yet-another-stars-rating")," ",e.post.rating,"]");var t=e.text;return React.createElement("span",{className:"yasr-highest-rated-text"},t," ",e.post.rating)}function v(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===e&&(e=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),e.innerHTML=t;const a=e.textContent;return e.innerHTML="",a}(t.post.title)))}function _(e){var t="after",a=p("Rating:","yet-another-stars-rating"),n=new URLSearchParams(e.rankingParams);return null!==n.get("text_position")&&(t=n.get("text_position")),null!==n.get("custom_txt")&&(a=n.get("custom_txt")),"before"===t?React.createElement("td",{className:e.colClass},React.createElement(f,{post:e.post,tableId:e.tableId,text:a}),React.createElement(h,{rating:e.post.rating,tableId:e.tableId})):React.createElement("td",{className:e.colClass},React.createElement(h,{rating:e.post.rating,tableId:e.tableId}),React.createElement(f,{post:e.post,tableId:e.tableId,text:a}))}function b(e){var t="",a="";return"author_ranking"===e.source?(t="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===e.source&&(t="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:e.trClass},React.createElement(v,{colClass:t,post:e.post}),React.createElement(_,{colClass:a,post:e.post,tableId:e.tableId,rankingParams:e.rankingParams}))}function E(e){return React.createElement("tbody",{id:e.tBodyId,style:{display:e.show}},e.data.map((function(t,a){var n="yasr-rankings-td-colored";return"author_ranking"===e.source&&(n="yasr-rankings-td-white"),a%2==0&&(n="yasr-rankings-td-white","author_ranking"===e.source&&(n="yasr-rankings-td-colored")),React.createElement(b,{key:t.post_id,source:e.source,tableId:e.tableId,rankingParams:e.rankingParams,post:t,trClass:n})})))}var k=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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}(o,React.Component);var t,a,n,r,s=(n=o,r=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=m(n);if(r){var a=m(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return y(this,e)});function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=s.call(this,e)).state={error:null,isLoaded:!1,data:[],tableId:e.tableId,source:e.source,rankingParams:e.params,nonce:e.nonce},t}return t=o,a=[{key:"componentDidMount",value:function(){var e=this,t=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrCommonData.ajaxEnabled)console.info(p("Ajax Disabled, getting data from source","yet-another-stars-rating")),this.setState({isLoaded:!0,data:t});else if(this.state.source){var n=this.returnRestUrl();Promise.all(n.map((function(e){return fetch(e).then((function(e){return!0===e.ok?e.json():(console.info(p("Ajax Call Failed. Getting data from source")),"KO")})).then((function(e){"KO"===e?a=t:"overall_rating"===e.source||"author_multi"===e.source?a="overall_rating"===e.source?e.data_overall:e.data_mv:a[e.show]=e.data_vv})).catch((function(e){a=t,console.info(p(e))}))}))).then((function(t){e.setState({isLoaded:!0,data:a})})).catch((function(t){console.info(p(t)),e.setState({isLoaded:!0,data:a})}))}else this.setState({error:p("Invalid Data Source","yet-another-stars-rating")})}},{key:"returnRestUrl",value:function(){var e,t=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,n="&nonce_rankings="+this.state.nonce,r="";if(""!==t&&!1!==t){var s=new URLSearchParams(t);null!==s.get("order_by")&&(r+="order_by="+s.get("order_by")),null!==s.get("limit")&&(r+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(r+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(r+="&end_date="+s.get("end_date")),null!==s.get("ctg")?r+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(r+="&cpt="+s.get("cpt")),""!==r&&(r="&"+(r=r.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(r+="&setid="+s.get("setid"))}else r="";if("author_ranking"===a||"author_multi"===a)e=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+r+n];else{var o="",i="";if(""!==t){var l=new URLSearchParams(t);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]"))}e=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+r+o+n,yasrCommonData.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+r+i+n]}return e}},{key:"rankingTableHead",value:function(e,t){var a=this.state.tableId,n="link-most-rated-posts-"+a,r="link-highest-rated-posts-"+a;if("author_ranking"!==e){var s=React.createElement("span",null,React.createElement("span",{id:n},p("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},p("Highest Rated","yet-another-stars-rating")));return"highest"===t&&(s=React.createElement("span",null,React.createElement("span",{id:r},p("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},p("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,p("Post","yet-another-stars-rating")),React.createElement("th",null,p("Order By","yet-another-stars-rating"),": ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(e){e.preventDefault();var t=e.target.id,a=this.state.tableId,n="link-most-rated-posts-"+a,r="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(t),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),t===n&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),t===r&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var e=this.state,t=e.data,a=e.source,n=e.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(E,{data:t,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:n,show:"table-row-group",source:a});var r=t.most,s=t.highest,o="table-row-group",i="none",l="most",d=o,c=i,u=new URLSearchParams(n);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(E,{data:r,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:n,show:d,source:a}),React.createElement(E,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:n,show:c,source:a}))}},{key:"render",value:function(){var e=this.state,t=e.error,a=e.isLoaded;return t?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,p("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}],a&&c(t.prototype,a),Object.defineProperty(t,"prototype",{writable:!1}),o}();function I(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var a=e.item(t).id,n=JSON.parse(e.item(t).dataset.rankingSource),r=JSON.parse(e.item(t).dataset.rankingParams),s=JSON.parse(e.item(t).dataset.rankingNonce),o=document.getElementById(a);g(React.createElement(k,{source:n,tableId:a,params:r,nonce:s}),o)}}I(),tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"});var w,B=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(w=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===w){var R,j=function(e){var t=D.value,a=document.getElementById("yasr-builder-shortcode").textContent,n=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];n=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",n),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+a).then((function(e){return!0===e.ok?e.json():(console.info(B("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(e){console.info(e)})).then((function(e){if("KO"!==e){var t=document.createElement("div");t.innerHTML=e,M.childNodes.length>0?M.replaceChild(t,M.childNodes[0]):M.appendChild(t)}})).then((function(e){n.forEach((function(e){t===e&&I()}))}))},x=function(e,t,a,n,r,s,o,i,l){e.style.display="",t.style.display="",s.style.display="",l.style.display="",a.style.display="none",n.style.display="none",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},C=function(e,t,a,n,r,s,o,i,l){a.style.display="",n.style.display="",t.style.display="",s.style.display="",l.style.display="",e.style.display="none",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},Q=function(e,t,a,n,r,s,o,i,l){r.style.display="",l.style.display="none",e.style.display="none",a.style.display="none",n.style.display="none",t.style.display="none",s.style.display="none",null!==o&&(o.style.display="none"),null!==i&&(i.style.display="none")},T=function(e,t,a,n,r,s,o,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],d=arguments.length>9?arguments[9]:void 0;!0===l?(F.className="",F.classList.add("yasr-settings-row-24"),a.style.display="",n.style.display="",e.style.display="none"):(a.style.display="none",n.style.display="none",e.style.display=""),s.style.display="",t.style.display="",d.style.display="",r.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="")},L=".yasr-builder-elements-parents",S=".yasr-builder-elements-childs";jQuery(L).prop("disabled",!0),jQuery(S).prop("disabled",!0),jQuery(L).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",L,S);var P=[],H={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};R=H.name,document.getElementById("yasr-builder-shortcode").textContent="["+R+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+R+"]");var O=document.getElementById("yasr-builder-button-preview"),N=document.getElementById("yasr-builder-copy-shortcode"),M=document.getElementById("yasr-builder-preview"),D=document.getElementById("yasr-ranking-source"),A=document.getElementById("yasr-ranking-multiset-select"),U=document.getElementById("yasr-builder-datepicker-start"),q=document.getElementById("yasr-builder-datepicker-end"),F=document.getElementById("yasr-builder-params-container"),z=document.getElementById("builder-vv-default-view"),J=document.getElementById("builder-vv-required-votes"),V=document.getElementById("builder-stars-size"),K=document.getElementById("builder-overall-text"),Y=document.getElementById("builder-username-options"),G=document.getElementById("builder-category"),$=document.getElementById("builder-cpt"),W=document.getElementById("yasr-ranking-multiset"),X=document.getElementById("yasr-builder-datepicker"),Z=D.value,ee=!1;U.value="",q.value="","yasr_ov_ranking"===Z?x(K,V,z,J,Y,G,$,W,X):"yasr_most_active_users"===Z||"yasr_top_reviewers"===Z?Q(K,V,z,J,Y,G,$,W,X):"yasr_multi_set_ranking"===Z?T(K,V,z,J,Y,G,$,W,!1,X):"yasr_visitor_multi_set_ranking"===Z?T(K,V,z,J,Y,G,$,W,!0,X):C(K,V,z,J,Y,G,$,W,X),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)F.className="",F.classList.add("yasr-settings-row-33"),M.innerHTML="",U.value="",q.value="",H={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""},"yasr_ov_ranking"===e.target.value?x(K,V,z,J,Y,G,$,W,X):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?Q(K,V,z,J,Y,G,$,W,X):"yasr_multi_set_ranking"===e.target.value?(T(K,V,z,J,Y,G,$,W,!1,X),H.setid=" setid="+A[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(T(K,V,z,J,Y,G,$,W,!0,X),H.setid=" setid="+A[0].value):C(K,V,z,J,Y,G,$,W,X),H.name=e.target.value,R=H.name+H.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(H.setid=" setid="+e.target.value),P=wp.hooks.applyFilters("yasrBuilderFilterShortcode",H);for(var t=2;H.length;t++)P.hasOwnProperty(H[t])&&(H[t]=P[t]);R=H.name+H.setid+H.rows+H.view+H.minvotesmost+H.minvoteshg+H.size+H.txtPosition+H.txt+H.display+H.start_date+H.end_date+H.category+H.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+R+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+R+"]"),!0===ee&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&j()})),N.onclick=function(e){var t,a;t=document.getElementById(e.target.id).getAttribute("data-shortcode"),(a=document.createElement("textarea")).value=t,a.setAttribute("readonly",""),a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)},O.onclick=function(e){j(),ee=!0}}})();
|
includes/js/catch-inifite-scroll.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(()=>{"use strict";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 e(t){return null!=t&&""!==t||(t=!0),"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1),t}wp.i18n.__;for(var a=["yasr-rater-stars","yasr-multiset-visitors-rater"],r=0;r<a.length;r++)n(a[r]);function n(a){var r=document.getElementsByClassName(a);r.length>0&&("yasr-rater-stars"===a&&function(e){for(var a=0;a<e.length;a++)if(!1===e.item(a).classList.contains("yasr-star-rating")){var r=e.item(a),n=r.id;t(r.getAttribute("data-rater-starsize"),n,r)}}(r),"yasr-multiset-visitors-rater"===a&&function(a){for(var r="",n=[],s=document.getElementById("yasr-pro-multiset-review-rating"),o=0;o<a.length;o++)!function(o){if(!1===a.item(o).classList.contains("yasr-star-rating")){var i=a.item(o),l=i.id,c=i.getAttribute("data-rater-readonly"),u=i.getAttribute("data-rater-starsize");u||(u=16),c=e(c);t(u,l,i,1,c,!1,(function(t,e){var a=i.getAttribute("data-rater-postid"),o=i.getAttribute("data-rater-setid"),l=i.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var c=parseInt(t);this.setRating(c),r={postid:a,setid:o,field:l,rating:c},n.push(r),s&&(s.value=JSON.stringify(n)),e()}))}}(o);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var t=this.getAttribute("data-postid"),e=this.getAttribute("data-setid"),a=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+t+"-"+e).hide(),jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).show();var r={action:"yasr_visitor_multiset_field_vote",nonce:a,post_id:t,rating:n,set_id:e};jQuery.post(yasrCommonData.ajaxurl,r,(function(a){var r;r=(a=JSON.parse(a)).text,jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(r)}))}))}(r))}var s,o,i=wp.i18n.__;function l(t){if(t.length>0&&(function(t){for(var a=0;a<t.length;a++)!function(a){if(!1===t.item(a).classList.contains("yasr-star-rating")){var r=t.item(a),n=r.getAttribute("data-rating"),s=r.getAttribute("data-readonly-attribute"),o=r.getAttribute("data-rater-readonly");null===s&&(s=!1),s=e(s),o=e(o),!0===s&&(o=!0);var l=r.getAttribute("data-rater-postid"),u=r.id,d=u.replace("yasr-visitor-votes-rater-",""),m=parseInt(r.getAttribute("data-rater-starsize")),g=r.getAttribute("data-rater-nonce"),y=r.getAttribute("data-issingular"),v="yasr-vv-votes-number-container-"+d,f="yasr-vv-average-container-"+d,p="yasr-vv-bottom-container-"+d,h="yasr-vv-loader-"+d,_=document.getElementById(v),b=document.getElementById(f),E=document.getElementById(p),R=document.getElementById(h);if("yes"===yasrCommonData.ajaxEnabled){null!==R&&(R.innerHTML=yasrCommonData.loaderHtml);var k={action:"yasr_load_vv",post_id:l};jQuery.get(yasrCommonData.ajaxurl,k).done((function(t){var e,a=JSON.parse(t);e=!0===s||a.yasr_visitor_votes.stars_attributes.read_only,n=(n=a.yasr_visitor_votes.number_of_votes>0?a.yasr_visitor_votes.sum_votes/a.yasr_visitor_votes.number_of_votes:0).toFixed(1),n=parseFloat(n),c(m,n,l,e,u,0,g,y,_,b,R,E),!0!==s&&(null!==_&&(_.innerHTML=a.yasr_visitor_votes.number_of_votes),null!==b&&(b.innerHTML=n),!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,r){console.info(i("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),c(m,n,l,o,u,0,g,y,_,b,R,E),!0!==s&&(E.style.display="")}))}else c(m,n,l,o,u,0,g,y,_,b,R,E)}}(a)}(t),"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(u(e))}))},onHidden:function(){r=s}})}(n)}(a)}}function c(a,r,n,s,o,i,l,c,u,d,m,g){r=parseFloat(r),s=e(s);var y=document.getElementById(o);null!==m&&(m.innerHTML=""),t(a,o,y,1,s,r,(function(t,e){null!==m&&(m.innerHTML=yasrCommonData.loaderHtml);var a={action:"yasr_send_visitor_rating",rating:t,post_id:n,nonce_visitor:l,is_singular:c};this.setRating(t),this.disable(),jQuery.post(yasrCommonData.ajaxurl,a,(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!==u&&(u.innerHTML=e),null!==d&&(d.innerHTML=a)):r=t.text,null!==g&&(g.innerHTML=r,g.style.display=""),null!==m&&(m.innerHTML="")})),e()}))}function u(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 l=i("stars","yet-another-stars-rating"),c=0,u=0,d=5;d>0;d--)1===d&&(l=i("star","yet-another-stars-rating")),void 0!==t[d]&&(c=t[d].progressbar,u=t[d].n_of_votes),o+="<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>".concat(d," ").concat(l,"</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(c,"'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style=\"flex-basis:").concat(s,' ">').concat(u,"</div>\n </div>");return o+"</div></div>"}l(document.getElementsByClassName("yasr-rater-stars-vv"));var d=new Uint8Array(16);function m(){if(!o&&!(o="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 o(d)}const g=/^(?:[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,y=function(t){return"string"==typeof t&&g.test(t)};for(var v=[],f=0;f<256;++f)v.push((f+256).toString(16).substr(1));const p=function(t,e,a){var r=(t=t||{}).random||(t.rng||m)();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 function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(v[t[e+0]]+v[t[e+1]]+v[t[e+2]]+v[t[e+3]]+"-"+v[t[e+4]]+v[t[e+5]]+"-"+v[t[e+6]]+v[t[e+7]]+"-"+v[t[e+8]]+v[t[e+9]]+"-"+v[t[e+10]]+v[t[e+11]]+v[t[e+12]]+v[t[e+13]]+v[t[e+14]]+v[t[e+15]]).toLowerCase();if(!y(a))throw TypeError("Stringified UUID is invalid");return a}(r)};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},h(t)}function _(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 b(t,e){return b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},b(t,e)}function E(t,e){if(e&&("object"===h(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function R(t){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},R(t)}var k=wp.i18n.__,I=wp.element.render;function w(e){var a="yasr-ranking-element-"+p(),r=document.getElementById(e.tableId).dataset.rankingSize;return React.createElement("div",{id:a,ref:function(){return t(r,a,!1,.1,!0,e.rating)}})}function C(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 x(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===s&&(s=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),s.innerHTML=t;var e=s.textContent;return s.innerHTML="",e}(t.post.title)))}function L(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(C,{post:t.post,tableId:t.tableId,text:a}),React.createElement(w,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(w,{rating:t.post.rating,tableId:t.tableId}),React.createElement(C,{post:t.post,tableId:t.tableId,text:a}))}function B(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(x,{colClass:e,post:t.post}),React.createElement(L,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function T(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(B,{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&&b(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=R(r);if(n){var a=R(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return E(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,k("Post","yet-another-stars-rating")),React.createElement("th",null,k("Order By","yet-another-stars-rating"),": ",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(T,{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(T,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(T,{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,k("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&_(e.prototype,a),o}();function j(){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);I(React.createElement(S,{source:r,tableId:a,params:n,nonce:s}),o)}}j(),jQuery(document).ajaxComplete((function(t,e,a){var r=yasrCommonData.siteUrl+"/page/";a.url.includes(r)&&(function(){for(var t=["yasr-rater-stars","yasr-multiset-visitors-rater"],e=0;e<t.length;e++)n(t[e])}(),l(document.getElementsByClassName("yasr-rater-stars-vv")),j())}))})();
|
1 |
+
(()=>{"use strict";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 e(t){return null!=t&&""!==t||(t=!0),"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1),t}wp.i18n.__;for(var a=["yasr-rater-stars","yasr-multiset-visitors-rater"],r=0;r<a.length;r++)n(a[r]);function n(a){var r=document.getElementsByClassName(a);r.length>0&&("yasr-rater-stars"===a&&function(e){for(var a=0;a<e.length;a++)if(!1===e.item(a).classList.contains("yasr-star-rating")){var r=e.item(a),n=r.id;t(r.getAttribute("data-rater-starsize"),n,r)}}(r),"yasr-multiset-visitors-rater"===a&&function(a){for(var r="",n=[],s=document.getElementById("yasr-pro-multiset-review-rating"),o=0;o<a.length;o++)!function(o){if(!1===a.item(o).classList.contains("yasr-star-rating")){var i=a.item(o),l=i.id,c=i.getAttribute("data-rater-readonly"),u=i.getAttribute("data-rater-starsize");u||(u=16),c=e(c);t(u,l,i,1,c,!1,(function(t,e){var a=i.getAttribute("data-rater-postid"),o=i.getAttribute("data-rater-setid"),l=i.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var c=parseInt(t);this.setRating(c),r={postid:a,setid:o,field:l,rating:c},n.push(r),s&&(s.value=JSON.stringify(n)),e()}))}}(o);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var t=this.getAttribute("data-postid"),e=this.getAttribute("data-setid"),a=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+t+"-"+e).hide(),jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).show();var r={action:"yasr_visitor_multiset_field_vote",nonce:a,post_id:t,rating:n,set_id:e};jQuery.post(yasrCommonData.ajaxurl,r,(function(a){var r;r=(a=JSON.parse(a)).text,jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(r)}))}))}(r))}var s=wp.i18n.__;function o(t){if(t.length>0&&(function(t){for(var a=0;a<t.length;a++)!function(a){if(!1===t.item(a).classList.contains("yasr-star-rating")){var r=t.item(a),n=r.getAttribute("data-rating"),o=r.getAttribute("data-readonly-attribute"),l=r.getAttribute("data-rater-readonly");null===o&&(o=!1),o=e(o),l=e(l),!0===o&&(l=!0);var c=r.getAttribute("data-rater-postid"),u=r.id,d=u.replace("yasr-visitor-votes-rater-",""),m=parseInt(r.getAttribute("data-rater-starsize")),g=r.getAttribute("data-rater-nonce"),y=r.getAttribute("data-issingular"),v="yasr-vv-votes-number-container-"+d,f="yasr-vv-average-container-"+d,p="yasr-vv-bottom-container-"+d,h="yasr-vv-loader-"+d,_=document.getElementById(v),b=document.getElementById(f),E=document.getElementById(p),R=document.getElementById(h);if("yes"===yasrCommonData.ajaxEnabled){null!==R&&(R.innerHTML=yasrCommonData.loaderHtml);var k={action:"yasr_load_vv",post_id:c};jQuery.get(yasrCommonData.ajaxurl,k).done((function(t){var e,a=JSON.parse(t);e=!0===o||a.yasr_visitor_votes.stars_attributes.read_only,n=(n=a.yasr_visitor_votes.number_of_votes>0?a.yasr_visitor_votes.sum_votes/a.yasr_visitor_votes.number_of_votes:0).toFixed(1),n=parseFloat(n),i(m,n,c,e,u,0,g,y,_,b,R,E),!0!==o&&(null!==_&&(_.innerHTML=a.yasr_visitor_votes.number_of_votes),null!==b&&(b.innerHTML=n),!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,r){console.info(s("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),i(m,n,c,l,u,0,g,y,_,b,R,E),!0!==o&&(E.style.display="")}))}else i(m,n,c,l,u,0,g,y,_,b,R,E)}}(a)}(t),"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(l(e))}))},onHidden:function(){r=s}})}(n)}(a)}}function i(a,r,n,s,o,i,l,c,u,d,m,g){r=parseFloat(r),s=e(s);var y=document.getElementById(o);null!==m&&(m.innerHTML=""),t(a,o,y,1,s,r,(function(t,e){null!==m&&(m.innerHTML=yasrCommonData.loaderHtml);var a={action:"yasr_send_visitor_rating",rating:t,post_id:n,nonce_visitor:l,is_singular:c};this.setRating(t),this.disable(),jQuery.post(yasrCommonData.ajaxurl,a,(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!==u&&(u.innerHTML=e),null!==d&&(d.innerHTML=a)):r=t.text,null!==g&&(g.innerHTML=r,g.style.display=""),null!==m&&(m.innerHTML="")})),e()}))}function l(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,o="5%";n<=3&&(o="5%"),n>3&&n<=5&&(o="10%"),n>5&&(o="15%");var i='<div class="yasr-visitors-stats-tooltip">';i+='<span id="yasr-medium-rating-tooltip">'+e+" "+s("out of 5 stars","yet-another-stars-rating")+"</span>",i+='<div class="yasr-progress-bars-container">';for(var l=s("stars","yet-another-stars-rating"),c=0,u=0,d=5;d>0;d--)1===d&&(l=s("star","yet-another-stars-rating")),void 0!==t[d]&&(c=t[d].progressbar,u=t[d].n_of_votes),i+="<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>".concat(d," ").concat(l,"</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(c,"'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style=\"flex-basis:").concat(o,' ">').concat(u,"</div>\n </div>");return i+"</div></div>"}let c;var u;o(document.getElementsByClassName("yasr-rater-stars-vv"));var d=new Uint8Array(16);function m(){if(!u&&!(u="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 u(d)}const g=/^(?:[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,y=function(t){return"string"==typeof t&&g.test(t)};for(var v=[],f=0;f<256;++f)v.push((f+256).toString(16).substr(1));const p=function(t,e,a){var r=(t=t||{}).random||(t.rng||m)();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 function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(v[t[e+0]]+v[t[e+1]]+v[t[e+2]]+v[t[e+3]]+"-"+v[t[e+4]]+v[t[e+5]]+"-"+v[t[e+6]]+v[t[e+7]]+"-"+v[t[e+8]]+v[t[e+9]]+"-"+v[t[e+10]]+v[t[e+11]]+v[t[e+12]]+v[t[e+13]]+v[t[e+14]]+v[t[e+15]]).toLowerCase();if(!y(a))throw TypeError("Stringified UUID is invalid");return a}(r)};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},h(t)}function _(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 b(t,e){return b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},b(t,e)}function E(t,e){if(e&&("object"===h(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function R(t){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},R(t)}var k=wp.i18n.__,w=wp.element.render;function I(e){var a="yasr-ranking-element-"+p(),r=document.getElementById(e.tableId).dataset.rankingSize;return React.createElement("div",{id:a,ref:function(){return t(r,a,!1,.1,!0,e.rating)}})}function C(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 x(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===c&&(c=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),c.innerHTML=t;const e=c.textContent;return c.innerHTML="",e}(t.post.title)))}function L(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(C,{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(C,{post:t.post,tableId:t.tableId,text:a}))}function B(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(x,{colClass:e,post:t.post}),React.createElement(L,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function T(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(B,{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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b(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=R(r);if(n){var a=R(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return E(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,k("Post","yet-another-stars-rating")),React.createElement("th",null,k("Order By","yet-another-stars-rating"),": ",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(T,{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(T,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(T,{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,k("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&_(e.prototype,a),Object.defineProperty(e,"prototype",{writable:!1}),o}();function j(){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(S,{source:r,tableId:a,params:n,nonce:s}),o)}}j(),jQuery(document).ajaxComplete((function(t,e,a){var r=yasrCommonData.siteUrl+"/page/";a.url.includes(r)&&(function(){for(var t=["yasr-rater-stars","yasr-multiset-visitors-rater"],e=0;e<t.length;e++)n(t[e])}(),o(document.getElementsByClassName("yasr-rater-stars-vv")),j())}))})();
|
includes/js/shortcodes/rankings.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(()=>{"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,o=function(t){return"string"==typeof t&&n.test(t)};for(var s=[],i=0;i<256;++i)s.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=(s[t[e+0]]+s[t[e+1]]+s[t[e+2]]+s[t[e+3]]+"-"+s[t[e+4]]+s[t[e+5]]+"-"+s[t[e+6]]+s[t[e+7]]+"-"+s[t[e+8]]+s[t[e+9]]+"-"+s[t[e+10]]+s[t[e+11]]+s[t[e+12]]+s[t[e+13]]+s[t[e+14]]+s[t[e+15]]).toLowerCase();if(!o(a))throw TypeError("Stringified UUID is invalid");return a}(n)};function c(t){return c="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},c(t)}function u(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 d(t,e){return d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},d(t,e)}function m(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}var h=wp.i18n.__,f=wp.element.render;function y(t){var e="yasr-ranking-element-"+l(),a=document.getElementById(t.tableId).dataset.rankingSize;return React.createElement("div",{id:e,ref:function(){return function(t,e){var a,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=arguments.length>2&&void 0!==arguments[2]&&arguments[2]||document.getElementById(e),t=parseInt(t),raterJs({starSize:t,showToolTip:!1,element:a,step:r,readOnly:n,rating:o,rateCallback:s})}(a,e,!1,.1,!0,t.rating)}})}function p(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",h("Total:","yet-another-stars-rating")," ",t.post.number_of_votes," ",h("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 v(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=h("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(p,{post:t.post,tableId:t.tableId,text:a}),React.createElement(y,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(y,{rating:t.post.rating,tableId:t.tableId}),React.createElement(p,{post:t.post,tableId:t.tableId,text:a}))}function R(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(v,{colClass:e,post:t.post}),React.createElement(b,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function E(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(R,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}var _=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&&d(t,e)}(s,React.Component);var e,a,r,n,o=(r=s,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=g(r);if(n){var a=g(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return m(this,t)});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=o.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(h("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(h("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(h(t))}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(h(e)),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:h("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 o=new URLSearchParams(e);null!==o.get("order_by")&&(n+="order_by="+o.get("order_by")),null!==o.get("limit")&&(n+="&limit="+o.get("limit")),null!==o.get("start_date")&&"0"!==o.get("start_date")&&(n+="&start_date="+o.get("start_date")),null!==o.get("end_date")&&"0"!==o.get("end_date")&&(n+="&end_date="+o.get("end_date")),null!==o.get("ctg")?n+="&ctg="+o.get("ctg"):null!==o.get("cpt")&&(n+="&cpt="+o.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==o.get("setid")&&(n+="&setid="+o.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var s="",i="";if(""!==e){var l=new URLSearchParams(e);null!==l.get("required_votes[most]")&&(s="&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+s+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 o=React.createElement("span",null,React.createElement("span",{id:r},h("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},h("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(o=React.createElement("span",null,React.createElement("span",{id:n},h("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},h("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,h("Post","yet-another-stars-rating")),React.createElement("th",null,h("Order By","yet-another-stars-rating"),": ",o)))}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,o="most-rated-posts-"+a,s="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(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===n&&(document.getElementById(o).style.display="none",document.getElementById(s).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(E,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,o=e.highest,s="table-row-group",i="none",l="most",c=s,u=i,d=new URLSearchParams(r);return null!==d.get("view")&&(l=d.get("view")),"highest"===l&&(c=i,u=s),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(E,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(E,{data:o,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,h("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&u(e.prototype,a),s}();!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),o=JSON.parse(t.item(e).dataset.rankingNonce),s=document.getElementById(a);f(React.createElement(_,{source:r,tableId:a,params:n,nonce:o}),s)}}()})();
|
1 |
+
(()=>{"use strict";let t;var 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,o=function(t){return"string"==typeof t&&n.test(t)};for(var s=[],i=0;i<256;++i)s.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=(s[t[e+0]]+s[t[e+1]]+s[t[e+2]]+s[t[e+3]]+"-"+s[t[e+4]]+s[t[e+5]]+"-"+s[t[e+6]]+s[t[e+7]]+"-"+s[t[e+8]]+s[t[e+9]]+"-"+s[t[e+10]]+s[t[e+11]]+s[t[e+12]]+s[t[e+13]]+s[t[e+14]]+s[t[e+15]]).toLowerCase();if(!o(a))throw TypeError("Stringified UUID is invalid");return a}(n)};function c(t){return c="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},c(t)}function u(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 d(t,e){return d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},d(t,e)}function m(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}var h=wp.i18n.__,f=wp.element.render;function p(t){var e="yasr-ranking-element-"+l(),a=document.getElementById(t.tableId).dataset.rankingSize;return React.createElement("div",{id:e,ref:function(){return function(t,e){var a,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];a=arguments.length>2&&void 0!==arguments[2]&&arguments[2]||document.getElementById(e),t=parseInt(t),raterJs({starSize:t,showToolTip:!1,element:a,step:r,readOnly:n,rating:o,rateCallback:s})}(a,e,!1,.1,!0,t.rating)}})}function y(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",h("Total:","yet-another-stars-rating")," ",t.post.number_of_votes," ",h("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 v(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;const a=t.textContent;return t.innerHTML="",a}(e.post.title)))}function b(t){var e="after",a=h("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(y,{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(y,{post:t.post,tableId:t.tableId,text:a}))}function R(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(v,{colClass:e,post:t.post}),React.createElement(b,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function E(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(R,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}var _=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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(s,React.Component);var e,a,r,n,o=(r=s,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=g(r);if(n){var a=g(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return m(this,t)});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=o.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(h("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(h("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(h(t))}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(h(e)),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:h("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 o=new URLSearchParams(e);null!==o.get("order_by")&&(n+="order_by="+o.get("order_by")),null!==o.get("limit")&&(n+="&limit="+o.get("limit")),null!==o.get("start_date")&&"0"!==o.get("start_date")&&(n+="&start_date="+o.get("start_date")),null!==o.get("end_date")&&"0"!==o.get("end_date")&&(n+="&end_date="+o.get("end_date")),null!==o.get("ctg")?n+="&ctg="+o.get("ctg"):null!==o.get("cpt")&&(n+="&cpt="+o.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==o.get("setid")&&(n+="&setid="+o.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrCommonData.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var s="",i="";if(""!==e){var l=new URLSearchParams(e);null!==l.get("required_votes[most]")&&(s="&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+s+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 o=React.createElement("span",null,React.createElement("span",{id:r},h("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},h("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(o=React.createElement("span",null,React.createElement("span",{id:n},h("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},h("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,h("Post","yet-another-stars-rating")),React.createElement("th",null,h("Order By","yet-another-stars-rating"),": ",o)))}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,o="most-rated-posts-"+a,s="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(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===n&&(document.getElementById(o).style.display="none",document.getElementById(s).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(E,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,o=e.highest,s="table-row-group",i="none",l="most",c=s,u=i,d=new URLSearchParams(r);return null!==d.get("view")&&(l=d.get("view")),"highest"===l&&(c=i,u=s),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(E,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(E,{data:o,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,h("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&u(e.prototype,a),Object.defineProperty(e,"prototype",{writable:!1}),s}();!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),o=JSON.parse(t.item(e).dataset.rankingNonce),s=document.getElementById(a);f(React.createElement(_,{source:r,tableId:a,params:n,nonce:o}),s)}}()})();
|
includes/shortcodes/classes/YasrShortcodesAjax.php
CHANGED
@@ -638,14 +638,24 @@ class YasrShortcodesAjax {
|
|
638 |
* @return array|false|false[]
|
639 |
*/
|
640 |
public static function rankingData($source=false, $request=false) {
|
641 |
-
$is_ajax
|
|
|
642 |
|
643 |
if (isset($_GET['action']) && isset($_GET['source']) && isset($_GET['nonce_rankings'])) {
|
644 |
-
$request
|
645 |
-
$source
|
|
|
646 |
$is_ajax = true;
|
647 |
}
|
648 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
649 |
$data_to_return = array(
|
650 |
'source' => $source
|
651 |
);
|
@@ -706,7 +716,7 @@ class YasrShortcodesAjax {
|
|
706 |
|
707 |
//if this is coming from an ajax request
|
708 |
if($is_ajax === true) {
|
709 |
-
echo json_encode($data_to_return);
|
710 |
die();
|
711 |
}
|
712 |
|
638 |
* @return array|false|false[]
|
639 |
*/
|
640 |
public static function rankingData($source=false, $request=false) {
|
641 |
+
$is_ajax = false;
|
642 |
+
$nonce_visitor = false;
|
643 |
|
644 |
if (isset($_GET['action']) && isset($_GET['source']) && isset($_GET['nonce_rankings'])) {
|
645 |
+
$request = $_GET;
|
646 |
+
$source = (string)$_GET['source'];
|
647 |
+
$nonce_visitor = $_GET['nonce_rankings'];
|
648 |
$is_ajax = true;
|
649 |
}
|
650 |
|
651 |
+
if($is_ajax === true) {
|
652 |
+
$error = esc_html__('Can\'t show rankings, wrong nonce.', 'yet-another-stars-rating');
|
653 |
+
$nonce_response = self::validNonce($nonce_visitor, 'yasr_nonce_rankings', $error);
|
654 |
+
if ($nonce_response !== true) {
|
655 |
+
die ($nonce_response);
|
656 |
+
}
|
657 |
+
}
|
658 |
+
|
659 |
$data_to_return = array(
|
660 |
'source' => $source
|
661 |
);
|
716 |
|
717 |
//if this is coming from an ajax request
|
718 |
if($is_ajax === true) {
|
719 |
+
echo esc_html(json_encode($data_to_return));
|
720 |
die();
|
721 |
}
|
722 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: rating, rate post, rate page, star rating, google rating, votes
|
|
4 |
Requires at least: 5.0
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.9
|
7 |
-
Stable tag:
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
@@ -56,7 +56,7 @@ MusicRecording,
|
|
56 |
Organization,
|
57 |
Product §,
|
58 |
Recipe ||,
|
59 |
-
SoftwareApplication
|
60 |
|
61 |
✝ BlogPosting itemtype will not show stars in search result.
|
62 |
More info [here](https://wordpress.org/plugins/yet-another-stars-rating/faq/)
|
@@ -99,6 +99,14 @@ More info [here](https://wordpress.org/plugins/yet-another-stars-rating/faq/)
|
|
99 |
* recipeCuisine
|
100 |
* recipeIngredient
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
== Video Tutorial ==
|
103 |
|
104 |
= Old video, but still valid. =
|
@@ -195,6 +203,9 @@ Yes, YASR is 100% fully compatible with PHP 8
|
|
195 |
|
196 |
The full changelog can be found in the plugin's directory. Recent entries:
|
197 |
|
|
|
|
|
|
|
198 |
= 2.9.9 =
|
199 |
* TWEAKED: removed "Pro only features" box in the editor screen
|
200 |
|
@@ -210,19 +221,10 @@ The full changelog can be found in the plugin's directory. Recent entries:
|
|
210 |
* TWEAKED: nonces are checked only for logged in users.
|
211 |
* TWEAKED: "Stats" page is now renamed in "Manage Ratings"
|
212 |
* TWEAKED: below the editor is now easier to manage Multi Sets
|
213 |
-
[//]: # fs_premium_only_begin
|
214 |
-
PREMIUM ONLY:
|
215 |
-
* NEW FEATURE: is now possible to use Multi Set along with user reviews!
|
216 |
-
To enable it, just select "YES" to "Insert this Multi Set in the comment form?"
|
217 |
-
[//]: # fs_premium_only_end
|
218 |
|
219 |
= 2.9.6 =
|
220 |
* FIXED: support for wp_template and wp_template_part CPT, used by FSE
|
221 |
* FIXED: html tags in custom texts didn't work
|
222 |
-
[//]: # fs_premium_only_begin
|
223 |
-
PREMIUM ONLY:
|
224 |
-
* FIXED: comments feed didn't work if reviews in comment are enabled
|
225 |
-
[//]: # fs_premium_only_end
|
226 |
|
227 |
= 2.9.5 =
|
228 |
* NEW FEATURE: In the settings, is now possible to customize the text when a rating is saved / updated
|
4 |
Requires at least: 5.0
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.9
|
7 |
+
Stable tag: 3.0.0
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
56 |
Organization,
|
57 |
Product §,
|
58 |
Recipe ||,
|
59 |
+
SoftwareApplication ◊
|
60 |
|
61 |
✝ BlogPosting itemtype will not show stars in search result.
|
62 |
More info [here](https://wordpress.org/plugins/yet-another-stars-rating/faq/)
|
99 |
* recipeCuisine
|
100 |
* recipeIngredient
|
101 |
|
102 |
+
◊ SoftwareApplication supports the following properties
|
103 |
+
* applicationCategory
|
104 |
+
* operatingSystem
|
105 |
+
* Currency
|
106 |
+
* Price Valid Until
|
107 |
+
* Availability
|
108 |
+
* Url
|
109 |
+
|
110 |
== Video Tutorial ==
|
111 |
|
112 |
= Old video, but still valid. =
|
203 |
|
204 |
The full changelog can be found in the plugin's directory. Recent entries:
|
205 |
|
206 |
+
= 3.0.0 =
|
207 |
+
* Fix for an authenticated XSS vulnerability if 'Load results with AJAX?' is enabled
|
208 |
+
|
209 |
= 2.9.9 =
|
210 |
* TWEAKED: removed "Pro only features" box in the editor screen
|
211 |
|
221 |
* TWEAKED: nonces are checked only for logged in users.
|
222 |
* TWEAKED: "Stats" page is now renamed in "Manage Ratings"
|
223 |
* TWEAKED: below the editor is now easier to manage Multi Sets
|
|
|
|
|
|
|
|
|
|
|
224 |
|
225 |
= 2.9.6 =
|
226 |
* FIXED: support for wp_template and wp_template_part CPT, used by FSE
|
227 |
* FIXED: html tags in custom texts didn't work
|
|
|
|
|
|
|
|
|
228 |
|
229 |
= 2.9.5 =
|
230 |
* NEW FEATURE: In the settings, is now possible to customize the text when a rating is saved / updated
|
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:
|
8 |
* Requires at least: 5.6
|
9 |
* Requires PHP: 5.4
|
10 |
* Author: Dario Curvino
|
@@ -78,7 +78,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
78 |
yasr_fs();
|
79 |
// Signal that SDK was initiated.
|
80 |
do_action( 'yasr_fs_loaded' );
|
81 |
-
define( 'YASR_VERSION_NUM', '
|
82 |
//Plugin absolute path
|
83 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
84 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
|
7 |
+
* Version: 3.0.0
|
8 |
* Requires at least: 5.6
|
9 |
* Requires PHP: 5.4
|
10 |
* Author: Dario Curvino
|
78 |
yasr_fs();
|
79 |
// Signal that SDK was initiated.
|
80 |
do_action( 'yasr_fs_loaded' );
|
81 |
+
define( 'YASR_VERSION_NUM', '3.0.0' );
|
82 |
//Plugin absolute path
|
83 |
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
|
84 |
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
|