Version Description
- NEW FEATURE: yasr_visitor_votes is now a Gutenberg block
- FIXED: In Gutenberg, when using yasr_overall_rating block, if post is rated and size or post_id is changed, stars got full filled
- TWEAKED: In classic editor, now overall_rating get saved along with the post update/save
- FIXED: In classic editor, review type didn't get saved if post is updated just after the type was changed
- TWEAKED: updated rater library
- TWEAKED: added a div with class "yasr-overall-rating" in the front end shortcode to allow customization
- TWEAKED: dropped out support for extensions
- TWEAKED: minor changes
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 1.9.0 |
Comparing to | |
See all releases |
Code changes from version 1.8.9 to 1.9.0
- changelog.txt +34 -0
- freemius/README.md +0 -253
- freemius/assets/scss/admin/plugin-upgrade-notice.scss +0 -8
- freemius/package.json +0 -27
- js/rater-js-rtl.js +0 -314
- js/rater-js.js +176 -30
- js/src/yasr-guten-blocks.js +312 -72
- js/tippy.all.min.js +0 -1
- js/yasr-admin.js +23 -126
- js/yasr-guten-blocks.js +372 -75
- lib/admin/settings/yasr-settings-functions.php +0 -39
- lib/admin/yasr-admin-actions.php +0 -3
- lib/admin/yasr-editor-functions.php +16 -10
- yasr-metabox-multiple-rating.php → lib/admin/yasr-metabox-multiple-rating.php +0 -0
- lib/admin/yasr-metabox-top-right.php +142 -0
- lib/yasr-ajax-functions.php +2 -64
- lib/yasr-db-functions.php +124 -29
- lib/yasr-functions.php +73 -13
- lib/yasr-shortcode-functions.php +4 -1
- readme.txt +17 -36
- yasr-metabox-top-right.php +0 -261
- yet-another-stars-rating.php +3 -8
changelog.txt
CHANGED
@@ -1,3 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 1.7.0 =
|
2 |
* FIXED: Yasr overall rating not showing up if custom text isn't set
|
3 |
|
1 |
+
= 1.8.2 =
|
2 |
+
* FIXED: widgets didn't load in front end
|
3 |
+
|
4 |
+
= 1.8.1 =
|
5 |
+
* Rounded stars again available
|
6 |
+
|
7 |
+
= 1.8.0 =
|
8 |
+
* This is a very important release. A lot of code has been cleaned up/rewritten. Images are not png anymore, but svg.
|
9 |
+
Everthing is now fresher and even more lightweight then before. If you customized your stars set, check it again in the settings.
|
10 |
+
[//]: # fs_premium_only_begin
|
11 |
+
* FIXED: string when the rating of a review is updated
|
12 |
+
* FIXED: Javascript error when the current user has not left a review for a post or page
|
13 |
+
* FIXED: undefined constant
|
14 |
+
[//]: # fs_premium_only_end
|
15 |
+
|
16 |
+
= 1.7.4 =
|
17 |
+
* Css fixes
|
18 |
+
|
19 |
+
= 1.7.3 =
|
20 |
+
* FIXED: Multi set's field name is now 40 chars long instead of 23
|
21 |
+
* TWEAKED: progress bars doesn't use jquery anymore, it's css only
|
22 |
+
* TWEAKED: tooltip for yasr_visitor_votes doesn't use jquery anymore, but uses [tippy](https://atomiks.github.io/tippyjs/) instead
|
23 |
+
* TWEAKED: A lot of under the hood changes
|
24 |
+
[//]: # fs_premium_only_begin
|
25 |
+
* FIXED: Cookie check wasn't working
|
26 |
+
* TWEAKED: Review in comments now can work without Jquery
|
27 |
+
[//]: # fs_premium_only_end
|
28 |
+
|
29 |
+
= 1.7.2 =
|
30 |
+
* FIXED: yasr_visitor_multiset didn't work
|
31 |
+
|
32 |
+
= 1.7.1 =
|
33 |
+
* FIXED: security fix
|
34 |
+
|
35 |
= 1.7.0 =
|
36 |
* FIXED: Yasr overall rating not showing up if custom text isn't set
|
37 |
|
freemius/README.md
DELETED
@@ -1,253 +0,0 @@
|
|
1 |
-
Freemius WordPress SDK
|
2 |
-
======================
|
3 |
-
|
4 |
-
[Monetization](https://freemius.com/wordpress/), [analytics](https://freemius.com/wordpress/insights/), and marketing automation platform for plugin & theme developers. Freemius empower developers to create prosperous subscription based businesses.
|
5 |
-
|
6 |
-
You can see some of the WordPress.org plugins & themes that are utilizing the power of Freemius here:
|
7 |
-
|
8 |
-
https://includewp.com/freemius/#focus
|
9 |
-
|
10 |
-
If you are a WordPress plugin or theme developer and you are interested to monetize with Freemius you can [sign-up here for free](https://dashboard.freemius.com/register/):
|
11 |
-
|
12 |
-
https://dashboard.freemius.com/register/
|
13 |
-
|
14 |
-
**Below you'll find the integration instructions for our WordPress SDK.**
|
15 |
-
|
16 |
-
## Code Documentation
|
17 |
-
|
18 |
-
You can find the SDK's PHP-Doc documentation here:
|
19 |
-
https://codedoc.pub/freemius/wordpress-sdk/master/
|
20 |
-
|
21 |
-
## Initializing the SDK
|
22 |
-
|
23 |
-
Copy the code below and paste it into the top of your main plugin's PHP file, right after the plugin's header comment:
|
24 |
-
|
25 |
-
```php
|
26 |
-
<?php
|
27 |
-
// Create a helper function for easy SDK access.
|
28 |
-
function my_prefix_fs() {
|
29 |
-
global $my_prefix_fs;
|
30 |
-
if ( ! isset( $my_prefix_fs ) ) {
|
31 |
-
// Include Freemius SDK.
|
32 |
-
require_once dirname(__FILE__) . '/freemius/start.php';
|
33 |
-
|
34 |
-
$my_prefix_fs = fs_dynamic_init( array(
|
35 |
-
'id' => '1234',
|
36 |
-
'slug' => 'my-plugin-slug',
|
37 |
-
'menu_slug' => 'my_menu_slug', // You can also use __FILE__
|
38 |
-
'public_key' => 'pk_MY_PUBLIC_KEY',
|
39 |
-
'is_live' => true,
|
40 |
-
'is_premium' => true,
|
41 |
-
'has_addons' => false,
|
42 |
-
'has_paid_plans' => false,
|
43 |
-
// Set the SDK to work in a sandbox mode (for development & testing).
|
44 |
-
// IMPORTANT: MAKE SURE TO REMOVE SECRET KEY BEFORE DEPLOYMENT.
|
45 |
-
'secret_key' => 'sk_MY_SECRET_KEY',
|
46 |
-
) );
|
47 |
-
}
|
48 |
-
|
49 |
-
return $my_prefix_fs;
|
50 |
-
}
|
51 |
-
|
52 |
-
// Init Freemius.
|
53 |
-
my_prefix_fs();
|
54 |
-
?>
|
55 |
-
```
|
56 |
-
|
57 |
-
- **1234** - Replace with your plugin's ID.
|
58 |
-
- **pk_MY_PUBLIC_KEY** - Replace with your plugin's public key.
|
59 |
-
- **sk_MY_SECRET_KEY** - Replace with your plugin's secret key.
|
60 |
-
- **my-plugin-slug** - Replace with your plugin's WordPress.org slug.
|
61 |
-
- **my_menu_slug** - Replace with your admin dashboard settings menu slug.
|
62 |
-
|
63 |
-
|
64 |
-
## Usage example
|
65 |
-
|
66 |
-
You can call the SDK by using the shortcode function:
|
67 |
-
|
68 |
-
```php
|
69 |
-
<?php my_prefix_fs()->get_upgrade_url(); ?>
|
70 |
-
```
|
71 |
-
|
72 |
-
Or when calling Freemius multiple times in a scope, it's recommended to use it with the global variable:
|
73 |
-
|
74 |
-
```php
|
75 |
-
<?php
|
76 |
-
global $my_prefix_fs;
|
77 |
-
$my_prefix_fs->get_account_url();
|
78 |
-
?>
|
79 |
-
```
|
80 |
-
|
81 |
-
## Adding license based logic examples
|
82 |
-
|
83 |
-
Add marketing content to encourage your users to upgrade for your paid version:
|
84 |
-
|
85 |
-
```php
|
86 |
-
<?php
|
87 |
-
if ( my_prefix_fs()->is_not_paying() ) {
|
88 |
-
echo '<section><h1>' . esc_html__('Awesome Premium Features', 'my-plugin-slug') . '</h1>';
|
89 |
-
echo '<a href="' . my_prefix_fs()->get_upgrade_url() . '">' .
|
90 |
-
esc_html__('Upgrade Now!', 'my-plugin-slug') .
|
91 |
-
'</a>';
|
92 |
-
echo '</section>';
|
93 |
-
}
|
94 |
-
?>
|
95 |
-
```
|
96 |
-
|
97 |
-
Add logic which will only be available in your premium plugin version:
|
98 |
-
|
99 |
-
```php
|
100 |
-
<?php
|
101 |
-
// This "if" block will be auto removed from the Free version.
|
102 |
-
if ( my_prefix_fs()->is__premium_only() ) {
|
103 |
-
|
104 |
-
// ... premium only logic ...
|
105 |
-
|
106 |
-
}
|
107 |
-
?>
|
108 |
-
```
|
109 |
-
|
110 |
-
To add a function which will only be available in your premium plugin version, simply add __premium_only as the suffix of the function name. Just make sure that all lines that call that method directly or by hooks, are also wrapped in premium only logic:
|
111 |
-
|
112 |
-
```php
|
113 |
-
<?php
|
114 |
-
class My_Plugin {
|
115 |
-
function init() {
|
116 |
-
...
|
117 |
-
|
118 |
-
// This "if" block will be auto removed from the free version.
|
119 |
-
if ( my_prefix_fs()->is__premium_only() ) {
|
120 |
-
// Init premium version.
|
121 |
-
$this->admin_init__premium_only();
|
122 |
-
|
123 |
-
add_action( 'admin_init', array( &$this, 'admin_init_hook__premium_only' );
|
124 |
-
}
|
125 |
-
|
126 |
-
...
|
127 |
-
}
|
128 |
-
|
129 |
-
// This method will be only included in the premium version.
|
130 |
-
function admin_init__premium_only() {
|
131 |
-
...
|
132 |
-
}
|
133 |
-
|
134 |
-
// This method will be only included in the premium version.
|
135 |
-
function admin_init_hook__premium_only() {
|
136 |
-
...
|
137 |
-
}
|
138 |
-
}
|
139 |
-
?>
|
140 |
-
```
|
141 |
-
|
142 |
-
Add logic which will only be executed for customers in your 'professional' plan:
|
143 |
-
|
144 |
-
```php
|
145 |
-
<?php
|
146 |
-
if ( my_prefix_fs()->is_plan('professional', true) ) {
|
147 |
-
// .. logic related to Professional plan only ...
|
148 |
-
}
|
149 |
-
?>
|
150 |
-
```
|
151 |
-
|
152 |
-
Add logic which will only be executed for customers in your 'professional' plan or higher plans:
|
153 |
-
|
154 |
-
```php
|
155 |
-
<?php
|
156 |
-
if ( my_prefix_fs()->is_plan('professional') ) {
|
157 |
-
// ... logic related to Professional plan and higher plans ...
|
158 |
-
}
|
159 |
-
?>
|
160 |
-
```
|
161 |
-
|
162 |
-
Add logic which will only be available in your premium plugin version AND will only be executed for customers in your 'professional' plan (and higher plans):
|
163 |
-
|
164 |
-
```php
|
165 |
-
<?php
|
166 |
-
// This "if" block will be auto removed from the Free version.
|
167 |
-
if ( my_prefix_fs()->is_plan__premium_only('professional') ) {
|
168 |
-
// ... logic related to Professional plan and higher plans ...
|
169 |
-
}
|
170 |
-
?>
|
171 |
-
```
|
172 |
-
|
173 |
-
Add logic only for users in trial:
|
174 |
-
|
175 |
-
```php
|
176 |
-
<?php
|
177 |
-
if ( my_prefix_fs()->is_trial() ) {
|
178 |
-
// ... logic for users in trial ...
|
179 |
-
}
|
180 |
-
?>
|
181 |
-
```
|
182 |
-
|
183 |
-
Add logic for specified paid plan:
|
184 |
-
|
185 |
-
```php
|
186 |
-
<?php
|
187 |
-
// This "if" block will be auto removed from the Free version.
|
188 |
-
if ( my_prefix_fs()->is__premium_only() ) {
|
189 |
-
if ( my_prefix_fs()->is_plan( 'professional', true ) ) {
|
190 |
-
|
191 |
-
// ... logic related to Professional plan only ...
|
192 |
-
|
193 |
-
} else if ( my_prefix_fs()->is_plan( 'business' ) ) {
|
194 |
-
|
195 |
-
// ... logic related to Business plan and higher plans ...
|
196 |
-
|
197 |
-
}
|
198 |
-
}
|
199 |
-
?>
|
200 |
-
```
|
201 |
-
|
202 |
-
## Excluding files and folders from the free plugin version
|
203 |
-
There are two ways to exclude files from your free version.
|
204 |
-
|
205 |
-
1. Add `__premium_only` just before the file extension. For example, functions__premium_only.php will be only included in the premium plugin version. This works for all type of files, not only PHP.
|
206 |
-
2. Add `@fs_premium_only` a sepcial meta tag to the plugin's main PHP file header. Example:
|
207 |
-
```php
|
208 |
-
<?php
|
209 |
-
/**
|
210 |
-
* Plugin Name: My Very Awesome Plugin
|
211 |
-
* Plugin URI: http://my-awesome-plugin.com
|
212 |
-
* Description: Create and manage Awesomeness right in WordPress.
|
213 |
-
* Version: 1.0.0
|
214 |
-
* Author: Awesomattic
|
215 |
-
* Author URI: http://my-awesome-plugin.com/me/
|
216 |
-
* License: GPLv2
|
217 |
-
* Text Domain: myplugin
|
218 |
-
* Domain Path: /langs
|
219 |
-
*
|
220 |
-
* @fs_premium_only /lib/functions.php, /premium-files/
|
221 |
-
*/
|
222 |
-
|
223 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
224 |
-
exit;
|
225 |
-
}
|
226 |
-
|
227 |
-
// ... my code ...
|
228 |
-
?>
|
229 |
-
```
|
230 |
-
The file `/lib/functions.php` and the directory `/premium-files/` will be removed from the free plugin version.
|
231 |
-
|
232 |
-
# WordPress.org Compliance
|
233 |
-
Based on [WordPress.org Guidelines](https://wordpress.org/plugins/about/guidelines/) you are not allowed to submit a plugin that has premium code in it:
|
234 |
-
> All code hosted by WordPress.org servers must be free and fully-functional. If you want to sell advanced features for a plugin (such as a "pro" version), then you must sell and serve that code from your own site, we will not host it on our servers.
|
235 |
-
|
236 |
-
Therefore, if you want to deploy your free plugin's version to WordPress.org, make sure you wrap all your premium code with `if ( my_prefix_fs()->{{ method }}__premium_only() )` or the other methods provided to exclude premium features & files from the free version.
|
237 |
-
|
238 |
-
## Deployment
|
239 |
-
Zip your plugin's root folder and upload it in the Deployment section in the *Freemius Developer's Dashboard*.
|
240 |
-
The plugin will be scanned and processed by a custom developed *PHP Processor* which will auto-generate two versions of your plugin:
|
241 |
-
|
242 |
-
1. **Premium version**: Identical to your uploaded version, including all code (except your `secret_key`). Will be enabled for download ONLY for your paying or in trial customers.
|
243 |
-
2. **Free version**: The code stripped from all your paid features (based on the logic added wrapped in `{ method }__premium_only()`).
|
244 |
-
|
245 |
-
The free version is the one that you should give your users to download. Therefore, download the free generated version and upload to your site. Or, if your plugin was WordPress.org complaint and you made sure to exclude all your premium code with the different provided techniques, you can deploy the downloaded free version to the .org repo.
|
246 |
-
|
247 |
-
## Reporting Bugs
|
248 |
-
Email dev [at] freemius [dot] com
|
249 |
-
|
250 |
-
## FAQ
|
251 |
-
|
252 |
-
## Copyright
|
253 |
-
Freemius, Inc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
freemius/assets/scss/admin/plugin-upgrade-notice.scss
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
.plugins p.upgrade-notice
|
2 |
-
{
|
3 |
-
border: 0;
|
4 |
-
background-color: #d54e21;
|
5 |
-
padding: 10px;
|
6 |
-
color: #f9f9f9;
|
7 |
-
margin-top: 10px;
|
8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
freemius/package.json
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "freemius-wordpress-sdk",
|
3 |
-
"description": "Monetization, analytics, and marketing automation platform for plugin & theme developers.",
|
4 |
-
"author": "Freemius, Inc.",
|
5 |
-
"license": "GPL-3.0",
|
6 |
-
"homepage": "https://freemius.com",
|
7 |
-
"version": "2.1.2",
|
8 |
-
"main": "gulpfile.js",
|
9 |
-
"dependencies": {},
|
10 |
-
"scripts": {
|
11 |
-
"test": "echo \"Error: no test specified\" && exit 1",
|
12 |
-
"prune": "rimraf .codeclimate.yml .git .github .gitignore .travis.yml gulpfile.js composer.json"
|
13 |
-
},
|
14 |
-
"repository": "Freemius/wordpress-sdk.git",
|
15 |
-
"devDependencies": {
|
16 |
-
"gulp": "^3.9.1",
|
17 |
-
"gulp-clean": "^0.3.2",
|
18 |
-
"gulp-fs": "0.0.2",
|
19 |
-
"gulp-gettext": "^0.3.0",
|
20 |
-
"gulp-path": "^3.0.3",
|
21 |
-
"gulp-pofill": "^1.0.0",
|
22 |
-
"gulp-rename": "^1.2.2",
|
23 |
-
"gulp-sort": "^2.0.0",
|
24 |
-
"gulp-transifex": "^0.1.17",
|
25 |
-
"gulp-wp-pot": "^1.3.5"
|
26 |
-
}
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/rater-js-rtl.js
DELETED
@@ -1,314 +0,0 @@
|
|
1 |
-
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.raterJs = f()}})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
|
2 |
-
"use strict";
|
3 |
-
|
4 |
-
/*! rater-js. [c] 2018 Fredrik Olsson. MIT License */
|
5 |
-
// var css = require('./style.css');
|
6 |
-
|
7 |
-
module.exports = function rater(options) {
|
8 |
-
//private fields
|
9 |
-
var showToolTip = true;
|
10 |
-
|
11 |
-
if (typeof options.element === "undefined" || options.element === null) {
|
12 |
-
throw new Error("element required");
|
13 |
-
}
|
14 |
-
|
15 |
-
if (typeof options.showToolTip !== "undefined") {
|
16 |
-
showToolTip = !!options.showToolTip;
|
17 |
-
}
|
18 |
-
|
19 |
-
if (typeof options.step !== "undefined") {
|
20 |
-
if (options.step <= 0 || options.step > 1) {
|
21 |
-
throw new Error("step must be a number between 0 and 1");
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
var stars = options.max || 5;
|
26 |
-
var starSize = options.starSize || 16;
|
27 |
-
var step = options.step || 1;
|
28 |
-
var onHover = options.onHover;
|
29 |
-
var onLeave = options.onLeave;
|
30 |
-
var rating;
|
31 |
-
var myRating;
|
32 |
-
var elem = options.element;
|
33 |
-
elem.classList.add("star-rating");
|
34 |
-
var div = document.createElement("div");
|
35 |
-
div.classList.add("star-value");
|
36 |
-
div.style.backgroundSize = starSize + "px";
|
37 |
-
elem.appendChild(div);
|
38 |
-
elem.style.width = starSize * stars + "px";
|
39 |
-
elem.style.height = starSize + "px";
|
40 |
-
elem.style.backgroundSize = starSize + "px";
|
41 |
-
var callback = options.rateCallback;
|
42 |
-
var disabled = !!options.readOnly;
|
43 |
-
var disableText;
|
44 |
-
var isRating = false;
|
45 |
-
var isBusyText = options.isBusyText;
|
46 |
-
var currentRating;
|
47 |
-
var ratingText;
|
48 |
-
|
49 |
-
if (typeof options.disableText !== "undefined") {
|
50 |
-
disableText = options.disableText;
|
51 |
-
} else {
|
52 |
-
disableText = "{rating}/{maxRating}";
|
53 |
-
}
|
54 |
-
|
55 |
-
if (typeof options.ratingText !== "undefined") {
|
56 |
-
ratingText = options.ratingText;
|
57 |
-
} else {
|
58 |
-
ratingText = "{rating}/{maxRating}";
|
59 |
-
}
|
60 |
-
|
61 |
-
if (options.rating) {
|
62 |
-
setRating(options.rating);
|
63 |
-
} else {
|
64 |
-
var dataRating = elem.dataset.rating;
|
65 |
-
|
66 |
-
if (dataRating) {
|
67 |
-
setRating(+dataRating);
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
if (typeof rating === "undefined") {
|
72 |
-
elem.querySelector(".star-value").style.width = "0px";
|
73 |
-
}
|
74 |
-
|
75 |
-
if (disabled) {
|
76 |
-
disable();
|
77 |
-
} //private methods
|
78 |
-
|
79 |
-
|
80 |
-
function onMouseMove(e) {
|
81 |
-
if (disabled === true || isRating === true) {
|
82 |
-
return;
|
83 |
-
}
|
84 |
-
|
85 |
-
var parentOffset = this.getBoundingClientRect();
|
86 |
-
var relX = e.pageX - parentOffset.left;
|
87 |
-
|
88 |
-
var width = elem.offsetWidth;
|
89 |
-
|
90 |
-
var relXRtl= width - relX;
|
91 |
-
var valueForDivision = width/100;
|
92 |
-
|
93 |
-
var percent = relXRtl/valueForDivision;
|
94 |
-
|
95 |
-
if (percent < 101) {
|
96 |
-
if (step === 1) {
|
97 |
-
currentRating = Math.ceil(percent / 100 * stars);
|
98 |
-
} else {
|
99 |
-
var rat = percent / 100 * stars;
|
100 |
-
|
101 |
-
for (var i = 0;; i += step) {
|
102 |
-
if (i >= rat) {
|
103 |
-
currentRating = i;
|
104 |
-
break;
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
if (currentRating > 5) {
|
110 |
-
currentRating = 5;
|
111 |
-
}
|
112 |
-
|
113 |
-
elem.querySelector(".star-value").style.width = currentRating / stars * 100 + "%";
|
114 |
-
|
115 |
-
if (showToolTip) {
|
116 |
-
var toolTip = ratingText.replace("{rating}", currentRating);
|
117 |
-
toolTip = toolTip.replace("{maxRating}", stars);
|
118 |
-
elem.setAttribute("data-title", toolTip);
|
119 |
-
}
|
120 |
-
|
121 |
-
if (typeof onHover === "function") {
|
122 |
-
onHover(currentRating, rating);
|
123 |
-
}
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
|
128 |
-
function onStarOut(e) {
|
129 |
-
if (typeof rating !== "undefined") {
|
130 |
-
elem.querySelector(".star-value").style.width = rating / stars * 100 + "%";
|
131 |
-
elem.setAttribute("data-rating", rating);
|
132 |
-
} else {
|
133 |
-
elem.querySelector(".star-value").style.width = "0%";
|
134 |
-
elem.removeAttribute("data-rating");
|
135 |
-
}
|
136 |
-
|
137 |
-
if (typeof onLeave === "function") {
|
138 |
-
onLeave(currentRating, rating);
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
function onStarClick(e) {
|
143 |
-
if (disabled === true) {
|
144 |
-
return;
|
145 |
-
}
|
146 |
-
|
147 |
-
if (isRating === true) {
|
148 |
-
return;
|
149 |
-
}
|
150 |
-
|
151 |
-
if (typeof callback !== "undefined") {
|
152 |
-
isRating = true;
|
153 |
-
myRating = currentRating;
|
154 |
-
|
155 |
-
if (typeof isBusyText === "undefined") {
|
156 |
-
elem.removeAttribute("data-title");
|
157 |
-
} else {
|
158 |
-
elem.setAttribute("data-title", isBusyText);
|
159 |
-
}
|
160 |
-
|
161 |
-
callback.call(this, myRating, function () {
|
162 |
-
if (disabled === false) {
|
163 |
-
elem.removeAttribute("data-title");
|
164 |
-
}
|
165 |
-
|
166 |
-
isRating = false;
|
167 |
-
});
|
168 |
-
}
|
169 |
-
} //public methods
|
170 |
-
|
171 |
-
|
172 |
-
function disable() {
|
173 |
-
disabled = true;
|
174 |
-
|
175 |
-
if (showToolTip && !!disableText) {
|
176 |
-
var toolTip = disableText.replace("{rating}", rating);
|
177 |
-
toolTip = toolTip.replace("{maxRating}", stars);
|
178 |
-
elem.setAttribute("data-title", toolTip);
|
179 |
-
} else {
|
180 |
-
elem.removeAttribute("data-title");
|
181 |
-
}
|
182 |
-
}
|
183 |
-
|
184 |
-
function enable() {
|
185 |
-
disabled = false;
|
186 |
-
elem.removeAttribute("data-title");
|
187 |
-
}
|
188 |
-
|
189 |
-
function setRating(value) {
|
190 |
-
//Added for Yasr
|
191 |
-
if (value === -1) {
|
192 |
-
value = undefined;
|
193 |
-
}
|
194 |
-
|
195 |
-
if (typeof value !== "number" && typeof value !== "undefined") {
|
196 |
-
throw new Error("Value must be a number or undefined.");
|
197 |
-
}
|
198 |
-
|
199 |
-
if (value < 0 || value > stars) {
|
200 |
-
var ratingError = new Error("Value too high. Please set a rating of " + stars + " or below.");
|
201 |
-
ratingError.name = "ratingError";
|
202 |
-
throw ratingError;
|
203 |
-
}
|
204 |
-
|
205 |
-
rating = value;
|
206 |
-
elem.querySelector(".star-value").style.width = value / stars * 100 + "%";
|
207 |
-
elem.setAttribute("data-rating", value);
|
208 |
-
}
|
209 |
-
|
210 |
-
function getRating() {
|
211 |
-
return rating;
|
212 |
-
}
|
213 |
-
|
214 |
-
function dispose() {
|
215 |
-
elem.removeEventListener("mousemove", onMouseMove);
|
216 |
-
elem.removeEventListener("mouseleave", onStarOut);
|
217 |
-
elem.removeEventListener("click", onStarClick);
|
218 |
-
}
|
219 |
-
|
220 |
-
elem.addEventListener("mousemove", onMouseMove);
|
221 |
-
elem.addEventListener("mouseleave", onStarOut);
|
222 |
-
var module = {
|
223 |
-
setRating: setRating,
|
224 |
-
getRating: getRating,
|
225 |
-
disable: disable,
|
226 |
-
enable: enable,
|
227 |
-
dispose: dispose
|
228 |
-
};
|
229 |
-
|
230 |
-
elem.addEventListener("click", onStarClick.bind(module));
|
231 |
-
return module;
|
232 |
-
};
|
233 |
-
|
234 |
-
},{"./style.css":2}],2:[function(require,module,exports){
|
235 |
-
var css = ".star-rating {\n width: 0;\n position: relative;\n display: inline-block;\n background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDguOSIgaGVpZ2h0PSIxMDMuNiIgdmlld0JveD0iMCAwIDEwOC45IDEwMy42Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UzZTZlNjt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPnN0YXJfMDwvdGl0bGU+PGcgaWQ9IkxheWVyXzIiIGRhdGEtbmFtZT0iTGF5ZXIgMiI+PGcgaWQ9IkxheWVyXzEtMiIgZGF0YS1uYW1lPSJMYXllciAxIj48cG9seWdvbiBjbGFzcz0iY2xzLTEiIHBvaW50cz0iMTA4LjkgMzkuNiA3MS4zIDM0LjEgNTQuNCAwIDM3LjYgMzQuMSAwIDM5LjYgMjcuMiA2Ni4xIDIwLjggMTAzLjYgNTQuNCA4NS45IDg4LjEgMTAzLjYgODEuNyA2Ni4xIDEwOC45IDM5LjYiLz48L2c+PC9nPjwvc3ZnPgo=);\n background-position: 0 0;\n background-repeat: repeat-x;\n cursor: pointer;\n}\n.star-rating[data-title]:hover:after {\n content: attr(data-title);\n padding: 4px 8px;\n color: #333;\n position: absolute;\n left: 0;\n top: 100%;\n z-index: 20;\n white-space: nowrap;\n -moz-border-radius: 5px;\n -webkit-border-radius: 5px;\n border-radius: 5px;\n -moz-box-shadow: 0px 0px 4px #222;\n -webkit-box-shadow: 0px 0px 4px #222;\n box-shadow: 0px 0px 4px #222;\n background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);\n background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #eeeeee),color-stop(1, #cccccc));\n background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);\n background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);\n background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);\n background-image: -o-linear-gradient(top, #eeeeee, #cccccc);\n}\n.star-rating .star-value {\n height: 100%;\n position: absolute;\n}\n.star-rating .star-value {\n position: absolute;\n height: 100%;\n width: 100%;\n background: url('data:image/svg+xml;base64,PHN2ZwoJeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTA4LjkiIGhlaWdodD0iMTAzLjYiIHZpZXdCb3g9IjAgMCAxMDguOSAxMDMuNiI+Cgk8ZGVmcz4KCQk8c3R5bGU+LmNscy0xe2ZpbGw6I2YxYzk0Nzt9PC9zdHlsZT4KCTwvZGVmcz4KCTx0aXRsZT5zdGFyMTwvdGl0bGU+Cgk8ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj4KCQk8ZyBpZD0iTGF5ZXJfMS0yIiBkYXRhLW5hbWU9IkxheWVyIDEiPgoJCQk8cG9seWdvbiBjbGFzcz0iY2xzLTEiIHBvaW50cz0iNTQuNCAwIDcxLjMgMzQuMSAxMDguOSAzOS42IDgxLjcgNjYuMSA4OC4xIDEwMy42IDU0LjQgODUuOSAyMC44IDEwMy42IDI3LjIgNjYuMSAwIDM5LjYgMzcuNiAzNC4xIDU0LjQgMCIvPgoJCTwvZz4KCTwvZz4KPC9zdmc+Cg==');\n background-repeat: repeat-x;\n}\n"; (require("browserify-css").createStyle(css, { "href": "lib\\style.css" }, { "insertAt": "bottom" })); module.exports = css;
|
236 |
-
},{"browserify-css":3}],3:[function(require,module,exports){
|
237 |
-
'use strict';
|
238 |
-
// For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field.
|
239 |
-
|
240 |
-
var styleElementsInsertedAtTop = [];
|
241 |
-
|
242 |
-
var insertStyleElement = function(styleElement, options) {
|
243 |
-
var head = document.head || document.getElementsByTagName('head')[0];
|
244 |
-
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
|
245 |
-
|
246 |
-
options = options || {};
|
247 |
-
options.insertAt = options.insertAt || 'bottom';
|
248 |
-
|
249 |
-
if (options.insertAt === 'top') {
|
250 |
-
if (!lastStyleElementInsertedAtTop) {
|
251 |
-
head.insertBefore(styleElement, head.firstChild);
|
252 |
-
} else if (lastStyleElementInsertedAtTop.nextSibling) {
|
253 |
-
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
|
254 |
-
} else {
|
255 |
-
head.appendChild(styleElement);
|
256 |
-
}
|
257 |
-
styleElementsInsertedAtTop.push(styleElement);
|
258 |
-
} else if (options.insertAt === 'bottom') {
|
259 |
-
head.appendChild(styleElement);
|
260 |
-
} else {
|
261 |
-
throw new Error('Invalid value for parameter \'insertAt\'. Must be \'top\' or \'bottom\'.');
|
262 |
-
}
|
263 |
-
};
|
264 |
-
|
265 |
-
module.exports = {
|
266 |
-
// Create a <link> tag with optional data attributes
|
267 |
-
createLink: function(href, attributes) {
|
268 |
-
var head = document.head || document.getElementsByTagName('head')[0];
|
269 |
-
var link = document.createElement('link');
|
270 |
-
|
271 |
-
link.href = href;
|
272 |
-
link.rel = 'stylesheet';
|
273 |
-
|
274 |
-
for (var key in attributes) {
|
275 |
-
if ( ! attributes.hasOwnProperty(key)) {
|
276 |
-
continue;
|
277 |
-
}
|
278 |
-
var value = attributes[key];
|
279 |
-
link.setAttribute('data-' + key, value);
|
280 |
-
}
|
281 |
-
|
282 |
-
head.appendChild(link);
|
283 |
-
},
|
284 |
-
// Create a <style> tag with optional data attributes
|
285 |
-
createStyle: function(cssText, attributes, extraOptions) {
|
286 |
-
extraOptions = extraOptions || {};
|
287 |
-
|
288 |
-
var style = document.createElement('style');
|
289 |
-
style.type = 'text/css';
|
290 |
-
|
291 |
-
for (var key in attributes) {
|
292 |
-
if ( ! attributes.hasOwnProperty(key)) {
|
293 |
-
continue;
|
294 |
-
}
|
295 |
-
var value = attributes[key];
|
296 |
-
style.setAttribute('data-' + key, value);
|
297 |
-
}
|
298 |
-
|
299 |
-
if (style.sheet) { // for jsdom and IE9+
|
300 |
-
style.innerHTML = cssText;
|
301 |
-
style.sheet.cssText = cssText;
|
302 |
-
insertStyleElement(style, { insertAt: extraOptions.insertAt });
|
303 |
-
} else if (style.styleSheet) { // for IE8 and below
|
304 |
-
insertStyleElement(style, { insertAt: extraOptions.insertAt });
|
305 |
-
style.styleSheet.cssText = cssText;
|
306 |
-
} else { // for Chrome, Firefox, and Safari
|
307 |
-
style.appendChild(document.createTextNode(cssText));
|
308 |
-
insertStyleElement(style, { insertAt: extraOptions.insertAt });
|
309 |
-
}
|
310 |
-
}
|
311 |
-
};
|
312 |
-
|
313 |
-
},{}]},{},[1])(1)
|
314 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/rater-js.js
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
"use strict";
|
3 |
|
4 |
/*! rater-js. [c] 2018 Fredrik Olsson. MIT License */
|
5 |
-
|
6 |
|
7 |
-
module.exports = function
|
8 |
//private fields
|
9 |
var showToolTip = true;
|
10 |
|
@@ -22,17 +22,30 @@
|
|
22 |
}
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
var stars = options.max || 5;
|
26 |
var starSize = options.starSize || 16;
|
27 |
var step = options.step || 1;
|
28 |
var onHover = options.onHover;
|
29 |
var onLeave = options.onLeave;
|
30 |
-
var rating;
|
31 |
var myRating;
|
32 |
-
var elem = options.element;
|
33 |
elem.classList.add("star-rating");
|
34 |
var div = document.createElement("div");
|
35 |
div.classList.add("star-value");
|
|
|
|
|
|
|
|
|
|
|
36 |
div.style.backgroundSize = starSize + "px";
|
37 |
elem.appendChild(div);
|
38 |
elem.style.width = starSize * stars + "px";
|
@@ -68,7 +81,7 @@
|
|
68 |
}
|
69 |
}
|
70 |
|
71 |
-
if (
|
72 |
elem.querySelector(".star-value").style.width = "0px";
|
73 |
}
|
74 |
|
@@ -78,13 +91,43 @@
|
|
78 |
|
79 |
|
80 |
function onMouseMove(e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
if (disabled === true || isRating === true) {
|
82 |
return;
|
83 |
}
|
84 |
|
85 |
-
var xCoor =
|
|
|
86 |
var width = elem.offsetWidth;
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
if (percent < 101) {
|
90 |
if (step === 1) {
|
@@ -105,7 +148,7 @@
|
|
105 |
if (showToolTip) {
|
106 |
var toolTip = ratingText.replace("{rating}", currentRating);
|
107 |
toolTip = toolTip.replace("{maxRating}", stars);
|
108 |
-
elem.setAttribute("
|
109 |
}
|
110 |
|
111 |
if (typeof onHover === "function") {
|
@@ -113,20 +156,30 @@
|
|
113 |
}
|
114 |
}
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
function onStarOut(e) {
|
118 |
-
if (
|
119 |
-
elem.querySelector(".star-value").style.width = rating / stars * 100 + "%";
|
120 |
-
elem.setAttribute("data-rating", rating);
|
121 |
-
} else {
|
122 |
elem.querySelector(".star-value").style.width = "0%";
|
123 |
elem.removeAttribute("data-rating");
|
|
|
|
|
|
|
124 |
}
|
125 |
|
126 |
if (typeof onLeave === "function") {
|
127 |
onLeave(currentRating, rating);
|
128 |
}
|
129 |
}
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
function onStarClick(e) {
|
132 |
if (disabled === true) {
|
@@ -142,68 +195,111 @@
|
|
142 |
myRating = currentRating;
|
143 |
|
144 |
if (typeof isBusyText === "undefined") {
|
145 |
-
elem.removeAttribute("
|
146 |
} else {
|
147 |
-
elem.setAttribute("
|
148 |
}
|
149 |
|
|
|
150 |
callback.call(this, myRating, function () {
|
151 |
if (disabled === false) {
|
152 |
-
elem.removeAttribute("
|
153 |
}
|
154 |
|
155 |
isRating = false;
|
|
|
156 |
});
|
157 |
}
|
158 |
-
}
|
|
|
|
|
|
|
159 |
|
160 |
|
161 |
function disable() {
|
162 |
disabled = true;
|
|
|
163 |
|
164 |
if (showToolTip && !!disableText) {
|
165 |
-
var toolTip = disableText.replace("{rating}", rating);
|
166 |
toolTip = toolTip.replace("{maxRating}", stars);
|
167 |
-
elem.setAttribute("
|
168 |
} else {
|
169 |
-
elem.removeAttribute("
|
170 |
}
|
171 |
}
|
|
|
|
|
|
|
|
|
172 |
|
173 |
function enable() {
|
174 |
disabled = false;
|
175 |
-
elem.removeAttribute("
|
|
|
176 |
}
|
|
|
|
|
|
|
|
|
177 |
|
178 |
function setRating(value) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
//Added for Yasr
|
180 |
if (value === -1) {
|
181 |
value = undefined;
|
182 |
}
|
183 |
|
184 |
-
if (typeof value !== "number" && typeof value !== "undefined") {
|
185 |
-
throw new Error("Value must be a number or undefined.");
|
186 |
-
}
|
187 |
-
|
188 |
if (value < 0 || value > stars) {
|
189 |
-
|
190 |
-
ratingError.name = "ratingError";
|
191 |
-
throw ratingError;
|
192 |
}
|
193 |
|
194 |
rating = value;
|
195 |
elem.querySelector(".star-value").style.width = value / stars * 100 + "%";
|
196 |
elem.setAttribute("data-rating", value);
|
197 |
}
|
|
|
|
|
|
|
|
|
198 |
|
199 |
function getRating() {
|
200 |
return rating;
|
201 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
function dispose() {
|
204 |
elem.removeEventListener("mousemove", onMouseMove);
|
205 |
elem.removeEventListener("mouseleave", onStarOut);
|
206 |
elem.removeEventListener("click", onStarClick);
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
|
209 |
elem.addEventListener("mousemove", onMouseMove);
|
@@ -213,15 +309,65 @@
|
|
213 |
getRating: getRating,
|
214 |
disable: disable,
|
215 |
enable: enable,
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
|
219 |
elem.addEventListener("click", onStarClick.bind(module));
|
|
|
|
|
|
|
|
|
220 |
return module;
|
221 |
};
|
222 |
|
223 |
},{"./style.css":2}],2:[function(require,module,exports){
|
224 |
-
var css = ".star-rating {\n width: 0;\n position: relative;\n display: inline-block;\n background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDguOSIgaGVpZ2h0PSIxMDMuNiIgdmlld0JveD0iMCAwIDEwOC45IDEwMy42Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UzZTZlNjt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPnN0YXJfMDwvdGl0bGU+PGcgaWQ9IkxheWVyXzIiIGRhdGEtbmFtZT0iTGF5ZXIgMiI+PGcgaWQ9IkxheWVyXzEtMiIgZGF0YS1uYW1lPSJMYXllciAxIj48cG9seWdvbiBjbGFzcz0iY2xzLTEiIHBvaW50cz0iMTA4LjkgMzkuNiA3MS4zIDM0LjEgNTQuNCAwIDM3LjYgMzQuMSAwIDM5LjYgMjcuMiA2Ni4xIDIwLjggMTAzLjYgNTQuNCA4NS45IDg4LjEgMTAzLjYgODEuNyA2Ni4xIDEwOC45IDM5LjYiLz48L2c+PC9nPjwvc3ZnPgo=);\n background-position: 0 0;\n background-repeat: repeat-x;\n cursor: pointer;\n}\n.star-rating
|
225 |
},{"browserify-css":3}],3:[function(require,module,exports){
|
226 |
'use strict';
|
227 |
// For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field.
|
@@ -300,4 +446,4 @@
|
|
300 |
};
|
301 |
|
302 |
},{}]},{},[1])(1)
|
303 |
-
});
|
2 |
"use strict";
|
3 |
|
4 |
/*! rater-js. [c] 2018 Fredrik Olsson. MIT License */
|
5 |
+
//var css = require('./style.css');
|
6 |
|
7 |
+
module.exports = function (options) {
|
8 |
//private fields
|
9 |
var showToolTip = true;
|
10 |
|
22 |
}
|
23 |
}
|
24 |
|
25 |
+
//Added for Yasr
|
26 |
+
var reverse = false;
|
27 |
+
|
28 |
+
if(document.dir === 'rtl') {
|
29 |
+
reverse = true;
|
30 |
+
}
|
31 |
+
//////////
|
32 |
+
|
33 |
+
var elem = options.element;
|
34 |
var stars = options.max || 5;
|
35 |
var starSize = options.starSize || 16;
|
36 |
var step = options.step || 1;
|
37 |
var onHover = options.onHover;
|
38 |
var onLeave = options.onLeave;
|
39 |
+
var rating = null;
|
40 |
var myRating;
|
|
|
41 |
elem.classList.add("star-rating");
|
42 |
var div = document.createElement("div");
|
43 |
div.classList.add("star-value");
|
44 |
+
|
45 |
+
if (reverse) {
|
46 |
+
div.classList.add("rtl");
|
47 |
+
}
|
48 |
+
|
49 |
div.style.backgroundSize = starSize + "px";
|
50 |
elem.appendChild(div);
|
51 |
elem.style.width = starSize * stars + "px";
|
81 |
}
|
82 |
}
|
83 |
|
84 |
+
if (!rating) {
|
85 |
elem.querySelector(".star-value").style.width = "0px";
|
86 |
}
|
87 |
|
91 |
|
92 |
|
93 |
function onMouseMove(e) {
|
94 |
+
onMove(e, false);
|
95 |
+
}
|
96 |
+
/**
|
97 |
+
* Called by eventhandlers when mouse or touch events are triggered
|
98 |
+
* @param {MouseEvent} e
|
99 |
+
*/
|
100 |
+
|
101 |
+
function onMove(e, isTouch) {
|
102 |
if (disabled === true || isRating === true) {
|
103 |
return;
|
104 |
}
|
105 |
|
106 |
+
var xCoor = null;
|
107 |
+
var percent;
|
108 |
var width = elem.offsetWidth;
|
109 |
+
|
110 |
+
if (reverse) {
|
111 |
+
var parentOffset = elem.getBoundingClientRect();
|
112 |
+
|
113 |
+
if (isTouch) {
|
114 |
+
xCoor = e.changedTouches[0].pageX - parentOffset.left;
|
115 |
+
} else {
|
116 |
+
xCoor = e.pageX - parentOffset.left;
|
117 |
+
}
|
118 |
+
|
119 |
+
var relXRtl = width - xCoor;
|
120 |
+
var valueForDivision = width / 100;
|
121 |
+
percent = relXRtl / valueForDivision;
|
122 |
+
} else {
|
123 |
+
if (isTouch) {
|
124 |
+
xCoor = e.changedTouches[0].pageX - e.changedTouches[0].target.offsetLeft;
|
125 |
+
} else {
|
126 |
+
xCoor = e.offsetX;
|
127 |
+
}
|
128 |
+
|
129 |
+
percent = xCoor / width * 100;
|
130 |
+
}
|
131 |
|
132 |
if (percent < 101) {
|
133 |
if (step === 1) {
|
148 |
if (showToolTip) {
|
149 |
var toolTip = ratingText.replace("{rating}", currentRating);
|
150 |
toolTip = toolTip.replace("{maxRating}", stars);
|
151 |
+
elem.setAttribute("title", toolTip);
|
152 |
}
|
153 |
|
154 |
if (typeof onHover === "function") {
|
156 |
}
|
157 |
}
|
158 |
}
|
159 |
+
/**
|
160 |
+
* Called when mouse is released. This function will update the view with the rating.
|
161 |
+
* @param {MouseEvent} e
|
162 |
+
*/
|
163 |
+
|
164 |
|
165 |
function onStarOut(e) {
|
166 |
+
if (!rating) {
|
|
|
|
|
|
|
167 |
elem.querySelector(".star-value").style.width = "0%";
|
168 |
elem.removeAttribute("data-rating");
|
169 |
+
} else {
|
170 |
+
elem.querySelector(".star-value").style.width = rating / stars * 100 + "%";
|
171 |
+
elem.setAttribute("data-rating", rating);
|
172 |
}
|
173 |
|
174 |
if (typeof onLeave === "function") {
|
175 |
onLeave(currentRating, rating);
|
176 |
}
|
177 |
}
|
178 |
+
/**
|
179 |
+
* Called when star is clicked.
|
180 |
+
* @param {MouseEvent} e
|
181 |
+
*/
|
182 |
+
|
183 |
|
184 |
function onStarClick(e) {
|
185 |
if (disabled === true) {
|
195 |
myRating = currentRating;
|
196 |
|
197 |
if (typeof isBusyText === "undefined") {
|
198 |
+
elem.removeAttribute("title");
|
199 |
} else {
|
200 |
+
elem.setAttribute("title", isBusyText);
|
201 |
}
|
202 |
|
203 |
+
elem.classList.add("is-busy");
|
204 |
callback.call(this, myRating, function () {
|
205 |
if (disabled === false) {
|
206 |
+
elem.removeAttribute("title");
|
207 |
}
|
208 |
|
209 |
isRating = false;
|
210 |
+
elem.classList.remove("is-busy");
|
211 |
});
|
212 |
}
|
213 |
+
}
|
214 |
+
/**
|
215 |
+
* Disables the rater so that it's not possible to click the stars.
|
216 |
+
*/
|
217 |
|
218 |
|
219 |
function disable() {
|
220 |
disabled = true;
|
221 |
+
elem.classList.add("disabled");
|
222 |
|
223 |
if (showToolTip && !!disableText) {
|
224 |
+
var toolTip = disableText.replace("{rating}", !!rating ? rating : 0);
|
225 |
toolTip = toolTip.replace("{maxRating}", stars);
|
226 |
+
elem.setAttribute("title", toolTip);
|
227 |
} else {
|
228 |
+
elem.removeAttribute("title");
|
229 |
}
|
230 |
}
|
231 |
+
/**
|
232 |
+
* Enabled the rater so that it's possible to click the stars.
|
233 |
+
*/
|
234 |
+
|
235 |
|
236 |
function enable() {
|
237 |
disabled = false;
|
238 |
+
elem.removeAttribute("title");
|
239 |
+
elem.classList.remove("disabled");
|
240 |
}
|
241 |
+
/**
|
242 |
+
* Sets the rating
|
243 |
+
*/
|
244 |
+
|
245 |
|
246 |
function setRating(value) {
|
247 |
+
if (typeof value === "undefined") {
|
248 |
+
throw new Error("Value not set.");
|
249 |
+
}
|
250 |
+
|
251 |
+
if (value === null) {
|
252 |
+
throw new Error("Value cannot be null.");
|
253 |
+
}
|
254 |
+
|
255 |
+
if (typeof value !== "number") {
|
256 |
+
throw new Error("Value must be a number.");
|
257 |
+
}
|
258 |
+
|
259 |
//Added for Yasr
|
260 |
if (value === -1) {
|
261 |
value = undefined;
|
262 |
}
|
263 |
|
|
|
|
|
|
|
|
|
264 |
if (value < 0 || value > stars) {
|
265 |
+
throw new Error("Value too high. Please set a rating of " + stars + " or below.");
|
|
|
|
|
266 |
}
|
267 |
|
268 |
rating = value;
|
269 |
elem.querySelector(".star-value").style.width = value / stars * 100 + "%";
|
270 |
elem.setAttribute("data-rating", value);
|
271 |
}
|
272 |
+
/**
|
273 |
+
* Gets the rating
|
274 |
+
*/
|
275 |
+
|
276 |
|
277 |
function getRating() {
|
278 |
return rating;
|
279 |
}
|
280 |
+
/**
|
281 |
+
* Set the rating to a value to inducate it's not rated.
|
282 |
+
*/
|
283 |
+
|
284 |
+
|
285 |
+
function clear() {
|
286 |
+
rating = null;
|
287 |
+
elem.querySelector(".star-value").style.width = "0px";
|
288 |
+
elem.removeAttribute("title");
|
289 |
+
}
|
290 |
+
/**
|
291 |
+
* Remove event handlers.
|
292 |
+
*/
|
293 |
+
|
294 |
|
295 |
function dispose() {
|
296 |
elem.removeEventListener("mousemove", onMouseMove);
|
297 |
elem.removeEventListener("mouseleave", onStarOut);
|
298 |
elem.removeEventListener("click", onStarClick);
|
299 |
+
elem.removeEventListener("touchmove", handleMove, false);
|
300 |
+
elem.removeEventListener("touchstart", handleStart, false);
|
301 |
+
elem.removeEventListener("touchend", handleEnd, false);
|
302 |
+
elem.removeEventListener("touchcancel", handleCancel, false);
|
303 |
}
|
304 |
|
305 |
elem.addEventListener("mousemove", onMouseMove);
|
309 |
getRating: getRating,
|
310 |
disable: disable,
|
311 |
enable: enable,
|
312 |
+
clear: clear,
|
313 |
+
dispose: dispose,
|
314 |
+
|
315 |
+
get element() {
|
316 |
+
return elem;
|
317 |
+
}
|
318 |
+
|
319 |
};
|
320 |
+
/**
|
321 |
+
* Handles touchmove event.
|
322 |
+
* @param {TouchEvent} e
|
323 |
+
*/
|
324 |
+
|
325 |
+
function handleMove(e) {
|
326 |
+
e.preventDefault();
|
327 |
+
onMove(e, true);
|
328 |
+
}
|
329 |
+
/**
|
330 |
+
* Handles touchstart event.
|
331 |
+
* @param {TouchEvent} e
|
332 |
+
*/
|
333 |
+
|
334 |
+
|
335 |
+
function handleStart(e) {
|
336 |
+
e.preventDefault();
|
337 |
+
onMove(e, true);
|
338 |
+
}
|
339 |
+
/**
|
340 |
+
* Handles touchend event.
|
341 |
+
* @param {TouchEvent} e
|
342 |
+
*/
|
343 |
+
|
344 |
+
|
345 |
+
function handleEnd(evt) {
|
346 |
+
evt.preventDefault();
|
347 |
+
onMove(evt, true);
|
348 |
+
onStarClick.call(module);
|
349 |
+
}
|
350 |
+
/**
|
351 |
+
* Handles touchend event.
|
352 |
+
* @param {TouchEvent} e
|
353 |
+
*/
|
354 |
+
|
355 |
+
|
356 |
+
function handleCancel(e) {
|
357 |
+
e.preventDefault();
|
358 |
+
onStarOut(e);
|
359 |
+
}
|
360 |
|
361 |
elem.addEventListener("click", onStarClick.bind(module));
|
362 |
+
elem.addEventListener("touchmove", handleMove, false);
|
363 |
+
elem.addEventListener("touchstart", handleStart, false);
|
364 |
+
elem.addEventListener("touchend", handleEnd, false);
|
365 |
+
elem.addEventListener("touchcancel", handleCancel, false);
|
366 |
return module;
|
367 |
};
|
368 |
|
369 |
},{"./style.css":2}],2:[function(require,module,exports){
|
370 |
+
var css = ".star-rating {\n width: 0;\n position: relative;\n display: inline-block;\n background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDguOSIgaGVpZ2h0PSIxMDMuNiIgdmlld0JveD0iMCAwIDEwOC45IDEwMy42Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UzZTZlNjt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPnN0YXJfMDwvdGl0bGU+PGcgaWQ9IkxheWVyXzIiIGRhdGEtbmFtZT0iTGF5ZXIgMiI+PGcgaWQ9IkxheWVyXzEtMiIgZGF0YS1uYW1lPSJMYXllciAxIj48cG9seWdvbiBjbGFzcz0iY2xzLTEiIHBvaW50cz0iMTA4LjkgMzkuNiA3MS4zIDM0LjEgNTQuNCAwIDM3LjYgMzQuMSAwIDM5LjYgMjcuMiA2Ni4xIDIwLjggMTAzLjYgNTQuNCA4NS45IDg4LjEgMTAzLjYgODEuNyA2Ni4xIDEwOC45IDM5LjYiLz48L2c+PC9nPjwvc3ZnPgo=);\n background-position: 0 0;\n background-repeat: repeat-x;\n cursor: pointer;\n}\n.star-rating .star-value {\n position: absolute;\n height: 100%;\n width: 100%;\n background: url('data:image/svg+xml;base64,PHN2ZwoJeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTA4LjkiIGhlaWdodD0iMTAzLjYiIHZpZXdCb3g9IjAgMCAxMDguOSAxMDMuNiI+Cgk8ZGVmcz4KCQk8c3R5bGU+LmNscy0xe2ZpbGw6I2YxYzk0Nzt9PC9zdHlsZT4KCTwvZGVmcz4KCTx0aXRsZT5zdGFyMTwvdGl0bGU+Cgk8ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj4KCQk8ZyBpZD0iTGF5ZXJfMS0yIiBkYXRhLW5hbWU9IkxheWVyIDEiPgoJCQk8cG9seWdvbiBjbGFzcz0iY2xzLTEiIHBvaW50cz0iNTQuNCAwIDcxLjMgMzQuMSAxMDguOSAzOS42IDgxLjcgNjYuMSA4OC4xIDEwMy42IDU0LjQgODUuOSAyMC44IDEwMy42IDI3LjIgNjYuMSAwIDM5LjYgMzcuNiAzNC4xIDU0LjQgMCIvPgoJCTwvZz4KCTwvZz4KPC9zdmc+Cg==');\n background-repeat: repeat-x;\n}\n.star-rating.disabled {\n cursor: default;\n}\n.star-rating.is-busy {\n cursor: wait;\n}\n.star-rating .star-value.rtl {\n -moz-transform: scaleX(-1);\n -o-transform: scaleX(-1);\n -webkit-transform: scaleX(-1);\n transform: scaleX(-1);\n filter: FlipH;\n -ms-filter: \"FlipH\";\n right: 0;\n left: auto;\n}\n"; (require("browserify-css").createStyle(css, { "href": "lib\\style.css" }, { "insertAt": "bottom" })); module.exports = css;
|
371 |
},{"browserify-css":3}],3:[function(require,module,exports){
|
372 |
'use strict';
|
373 |
// For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field.
|
446 |
};
|
447 |
|
448 |
},{}]},{},[1])(1)
|
449 |
+
});
|
js/src/yasr-guten-blocks.js
CHANGED
@@ -17,9 +17,23 @@ const {
|
|
17 |
InspectorControls
|
18 |
} = wp.editor;
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
/**
|
22 |
-
* Register:
|
23 |
*
|
24 |
* Registers a new block provided a unique name and an object defining its
|
25 |
* behavior. Once registered, the block is made editor as an option to any
|
@@ -45,13 +59,25 @@ const {
|
|
45 |
__('overall', 'yet-another-stars-rating')
|
46 |
],
|
47 |
attributes: {
|
48 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
size: {
|
50 |
type: 'string',
|
51 |
default: '--'
|
52 |
},
|
53 |
postId: {
|
54 |
-
type: '
|
55 |
default: ''
|
56 |
},
|
57 |
},
|
@@ -60,132 +86,347 @@ const {
|
|
60 |
|
61 |
function( props ) {
|
62 |
|
63 |
-
const { attributes: { size, postId }, setAttributes, isSelected } = props;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
let sizeAttribute = null;
|
66 |
let postIdAttribute = null;
|
67 |
-
|
68 |
-
const chooseText = __('Choose stars size', 'yet-another-stars-rating');
|
69 |
-
const smallText = __('Small', 'yet-another-stars-rating');
|
70 |
-
const mediumText = __('Medium', 'yet-another-stars-rating');
|
71 |
-
const largeText = __('Large', 'yet-another-stars-rating');
|
72 |
-
const leaveThisBlankText = __('Leave this blank if you don\'t know what you\'re doing.', 'yet-another-stars-rating');
|
73 |
|
74 |
if (size !== '--') {
|
75 |
sizeAttribute = ' size="' + size + '"';
|
76 |
}
|
77 |
|
78 |
-
|
|
|
|
|
79 |
postIdAttribute = ' postid="' +postId + '"';
|
80 |
}
|
81 |
|
82 |
-
|
83 |
-
if (event.key === 'Enter') {
|
84 |
-
const postIdValue = event.target.value;
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
|
93 |
}
|
94 |
|
95 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
return (
|
97 |
-
<form
|
98 |
-
<select value={
|
99 |
-
<option value="--">{
|
100 |
-
<option value="small">{
|
101 |
-
<option value="medium">{
|
102 |
-
<option value="large">{
|
103 |
</select>
|
104 |
</form>
|
105 |
);
|
106 |
}
|
107 |
|
108 |
-
function
|
109 |
const selected = event.target.querySelector( 'option:checked' );
|
110 |
setAttributes( { size: selected.value } );
|
111 |
event.preventDefault();
|
112 |
}
|
113 |
|
114 |
-
function
|
115 |
return (
|
116 |
<div>
|
117 |
-
<input type="text" size="4" onKeyPress={
|
118 |
</div>
|
119 |
);
|
120 |
}
|
121 |
|
122 |
-
function
|
|
|
|
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
const hideLoaderOverall = {display: 'none'};
|
127 |
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
-
|
131 |
|
132 |
-
|
|
|
|
|
|
|
|
|
133 |
|
134 |
-
<
|
135 |
-
{
|
136 |
-
</span>
|
137 |
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
145 |
|
146 |
-
|
147 |
-
<span id="yasr_rateit_overall_value" />
|
148 |
-
</div>
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
);
|
|
|
153 |
|
|
|
|
|
|
|
|
|
154 |
}
|
155 |
|
156 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
return (
|
164 |
<InspectorControls>
|
165 |
-
<div className="yasr-guten-block-panel yasr-guten-block-panel-center">
|
166 |
-
{divForVoteOverall()}
|
167 |
-
</div>
|
168 |
|
169 |
<PanelBody title='Settings'>
|
170 |
-
<h3>{
|
171 |
|
172 |
<div className="yasr-guten-block-panel">
|
173 |
-
<label>{
|
174 |
<div>
|
175 |
-
|
176 |
</div>
|
177 |
</div>
|
178 |
|
179 |
<div className="yasr-guten-block-panel">
|
180 |
-
<label>
|
181 |
-
|
182 |
<div className="yasr-guten-block-explain">
|
183 |
-
{
|
184 |
</div>
|
185 |
</div>
|
186 |
|
187 |
<div className="yasr-guten-block-panel">
|
188 |
-
{
|
189 |
</div>
|
190 |
</PanelBody>
|
191 |
</InspectorControls>
|
@@ -195,11 +436,10 @@ const {
|
|
195 |
|
196 |
return (
|
197 |
<Fragment>
|
198 |
-
|
199 |
-
|
200 |
<div className={ props.className }>
|
201 |
-
[
|
202 |
-
{
|
203 |
</div>
|
204 |
</Fragment>
|
205 |
);
|
@@ -215,20 +455,20 @@ const {
|
|
215 |
*/
|
216 |
save:
|
217 |
function( props ) {
|
218 |
-
const { attributes: {
|
219 |
|
220 |
-
let
|
221 |
|
222 |
if (size) {
|
223 |
-
|
224 |
}
|
225 |
if (postId) {
|
226 |
-
|
227 |
}
|
228 |
|
229 |
return (
|
230 |
-
<p>[
|
231 |
);
|
232 |
},
|
233 |
|
234 |
-
|
17 |
InspectorControls
|
18 |
} = wp.editor;
|
19 |
|
20 |
+
const yasrOptionalText = __('All these settings are optional', 'yet-another-stars-rating');
|
21 |
+
|
22 |
+
const yasrLabelSelectSize = __('Choose Size', 'yet-another-stars-rating');
|
23 |
+
|
24 |
+
const yasrSelectSizeChoose = __('Choose stars size', 'yet-another-stars-rating');
|
25 |
+
const yasrSelectSizeSmall = __('Small', 'yet-another-stars-rating');
|
26 |
+
const yasrSelectSizeMedium = __('Medium', 'yet-another-stars-rating');
|
27 |
+
const yasrSelectSizeLarge = __('Large', 'yet-another-stars-rating');
|
28 |
+
|
29 |
+
const yasrLeaveThisBlankText = __('Leave this blank if you don\'t know what you\'re doing.', 'yet-another-stars-rating');
|
30 |
+
|
31 |
+
const yasrOverallDescription = __('Remember: only the post author can rate here.', 'yet-another-stars-rating');
|
32 |
+
const yasrVisitorVotesDescription = __('This is the star set where your users will be able to vote', 'yet-another-stars-rating');
|
33 |
+
|
34 |
|
35 |
/**
|
36 |
+
* Register: a Gutenberg Block.
|
37 |
*
|
38 |
* Registers a new block provided a unique name and an object defining its
|
39 |
* behavior. Once registered, the block is made editor as an option to any
|
59 |
__('overall', 'yet-another-stars-rating')
|
60 |
],
|
61 |
attributes: {
|
62 |
+
//should be needed just overallRatingMeta:
|
63 |
+
//but, after the post is saved/updated
|
64 |
+
//the meta filed returns always undefined
|
65 |
+
//see this bug https://github.com/WordPress/gutenberg/issues/4989
|
66 |
+
overallRatingMeta: {
|
67 |
+
type: 'string',
|
68 |
+
source: 'meta',
|
69 |
+
meta: 'yasr_overall_rating'
|
70 |
+
},
|
71 |
+
overallRatingAttribute: {
|
72 |
+
type: 'number',
|
73 |
+
default: 0
|
74 |
+
},
|
75 |
size: {
|
76 |
type: 'string',
|
77 |
default: '--'
|
78 |
},
|
79 |
postId: {
|
80 |
+
type: 'number',
|
81 |
default: ''
|
82 |
},
|
83 |
},
|
86 |
|
87 |
function( props ) {
|
88 |
|
89 |
+
const { attributes: {overallRatingMeta, overallRatingAttribute, size, postId }, setAttributes, isSelected } = props;
|
90 |
+
|
91 |
+
let overallRating = 0;
|
92 |
+
|
93 |
+
if (overallRatingAttribute === 0) {
|
94 |
+
overallRating = overallRatingMeta;
|
95 |
+
}
|
96 |
+
else {
|
97 |
+
overallRating = overallRatingAttribute;
|
98 |
+
}
|
99 |
|
100 |
let sizeAttribute = null;
|
101 |
let postIdAttribute = null;
|
102 |
+
let isNum = false;
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
if (size !== '--') {
|
105 |
sizeAttribute = ' size="' + size + '"';
|
106 |
}
|
107 |
|
108 |
+
isNum = /^\d+$/.test(postId);
|
109 |
+
|
110 |
+
if (postId && isNum === true) {
|
111 |
postIdAttribute = ' postid="' +postId + '"';
|
112 |
}
|
113 |
|
114 |
+
class YasrCreateDivRater extends React.Component {
|
|
|
|
|
115 |
|
116 |
+
constructor(props) {
|
117 |
+
super(props);
|
118 |
+
//const divOverall = React.createRef();
|
119 |
+
}
|
120 |
+
|
121 |
+
render () {
|
122 |
+
return (
|
123 |
+
<div>
|
124 |
+
<div id="overall-rater" ref={()=>
|
125 |
+
raterJs({
|
126 |
+
starSize: 32,
|
127 |
+
step: 0.1,
|
128 |
+
showToolTip: false,
|
129 |
+
rating: overallRating,
|
130 |
+
readOnly: false,
|
131 |
+
element: document.querySelector("#overall-rater"),
|
132 |
+
rateCallback: function rateCallback(rating, done) {
|
133 |
+
|
134 |
+
rating = rating.toFixed(1);
|
135 |
+
rating = parseFloat(rating);
|
136 |
+
|
137 |
+
setAttributes( { overallRatingAttribute: rating } );
|
138 |
+
|
139 |
+
//show the load. IF insert before setAttributes, doesn't work
|
140 |
+
jQuery('#loader-overall-rating').show();
|
141 |
+
|
142 |
+
this.setRating(rating);
|
143 |
+
|
144 |
+
const currentPostId = wp.data.select("core/editor").getCurrentPostId();
|
145 |
+
|
146 |
+
var data = {
|
147 |
+
action: 'yasr_send_overall_rating',
|
148 |
+
yasr_nonce_overall_rating: yasrConstantGutenberg.nonceOverall,
|
149 |
+
yasr_overall_rating: rating,
|
150 |
+
post_id: currentPostId
|
151 |
+
};
|
152 |
+
|
153 |
+
//Send value to the Server
|
154 |
+
jQuery.post(ajaxurl, data, function(response) {
|
155 |
+
jQuery('#loader-overall-rating').hide();
|
156 |
+
response = JSON.parse(response);
|
157 |
+
if (response === 'OK') {
|
158 |
+
jQuery('#yasr-rateit-overall-value').text('You\'ve rated it: ' + rating);
|
159 |
+
}
|
160 |
+
});
|
161 |
+
|
162 |
+
done();
|
163 |
+
|
164 |
+
}
|
165 |
+
})
|
166 |
+
|
167 |
+
}
|
168 |
+
/>
|
169 |
+
|
170 |
+
</div>
|
171 |
+
);
|
172 |
}
|
173 |
|
174 |
}
|
175 |
|
176 |
+
function YasrDivRatingOverall (props) {
|
177 |
+
|
178 |
+
const yasrOverallRateThis = __("Rate this article / item", 'yet-another-stars-rating');
|
179 |
+
const yasrLoading = __("Loading, please wait",'yet-another-stars-rating');
|
180 |
+
const hideLoaderOverall = {display: 'none'};
|
181 |
+
|
182 |
+
return (
|
183 |
+
<div>
|
184 |
+
{yasrOverallRateThis}
|
185 |
+
<YasrCreateDivRater />
|
186 |
+
|
187 |
+
<span id="loader-overall-rating" style={hideLoaderOverall}>
|
188 |
+
{yasrLoading} <img src={yasrCommonDataAdmin.loaderHtml} />
|
189 |
+
</span>
|
190 |
+
|
191 |
+
<div id="yasr-rateit-overall-value" >
|
192 |
+
</div>
|
193 |
+
|
194 |
+
</div>
|
195 |
+
|
196 |
+
);
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
+
function YasrPrintSelectSize () {
|
201 |
return (
|
202 |
+
<form>
|
203 |
+
<select value={size} onChange={ yasrSetStarsSize }>
|
204 |
+
<option value="--">{yasrSelectSizeChoose}</option>
|
205 |
+
<option value="small">{yasrSelectSizeSmall}</option>
|
206 |
+
<option value="medium">{yasrSelectSizeMedium}</option>
|
207 |
+
<option value="large">{yasrSelectSizeLarge}</option>
|
208 |
</select>
|
209 |
</form>
|
210 |
);
|
211 |
}
|
212 |
|
213 |
+
function yasrSetStarsSize(event) {
|
214 |
const selected = event.target.querySelector( 'option:checked' );
|
215 |
setAttributes( { size: selected.value } );
|
216 |
event.preventDefault();
|
217 |
}
|
218 |
|
219 |
+
function YasrPrintInputId() {
|
220 |
return (
|
221 |
<div>
|
222 |
+
<input type="text" size="4" onKeyPress={yasrSetPostId} />
|
223 |
</div>
|
224 |
);
|
225 |
}
|
226 |
|
227 |
+
function yasrSetPostId (event) {
|
228 |
+
if (event.key === 'Enter') {
|
229 |
+
const postIdValue = event.target.value;
|
230 |
|
231 |
+
//postID is always a string, here I check if this string is made only by digits
|
232 |
+
var isNum = /^\d+$/.test(postIdValue);
|
|
|
233 |
|
234 |
+
if (isNum === true) {
|
235 |
+
setAttributes({postId: postIdValue})
|
236 |
+
}
|
237 |
+
event.preventDefault();
|
238 |
+
}
|
239 |
+
}
|
240 |
|
241 |
+
function YasrOverallPanel (props) {
|
242 |
|
243 |
+
return (
|
244 |
+
<InspectorControls>
|
245 |
+
<div class="yasr-guten-block-panel yasr-guten-block-panel-center">
|
246 |
+
<YasrDivRatingOverall />
|
247 |
+
</div>
|
248 |
|
249 |
+
<PanelBody title='Settings'>
|
250 |
+
<h3>{yasrOptionalText}</h3>
|
|
|
251 |
|
252 |
+
<div className="yasr-guten-block-panel">
|
253 |
+
<label>{yasrLabelSelectSize}</label>
|
254 |
+
<div>
|
255 |
+
<YasrPrintSelectSize />
|
256 |
+
</div>
|
257 |
+
</div>
|
258 |
|
259 |
+
<div className="yasr-guten-block-panel">
|
260 |
+
<label>Post ID</label>
|
261 |
+
<YasrPrintInputId/>
|
262 |
+
<div className="yasr-guten-block-explain">
|
263 |
+
{yasrLeaveThisBlankText}
|
264 |
+
</div>
|
265 |
+
</div>
|
266 |
|
267 |
+
<div className="yasr-guten-block-panel">
|
268 |
+
{yasrOverallDescription}
|
269 |
+
</div>
|
270 |
+
</PanelBody>
|
271 |
+
</InspectorControls>
|
272 |
+
);
|
273 |
|
274 |
+
}
|
|
|
|
|
275 |
|
276 |
+
return (
|
277 |
+
<Fragment>
|
278 |
+
<YasrOverallPanel />
|
279 |
+
<div className={ props.className }>
|
280 |
+
[yasr_overall_rating{sizeAttribute}{postIdAttribute}]
|
281 |
+
{isSelected && <YasrPrintSelectSize />}
|
282 |
</div>
|
283 |
+
</Fragment>
|
284 |
+
);
|
285 |
+
},
|
286 |
+
|
287 |
+
/**
|
288 |
+
* The save function defines the way in which the different attributes should be combined
|
289 |
+
* into the final markup, which is then serialized by Gutenberg into post_content.
|
290 |
+
*
|
291 |
+
* The "save" property must be specified and must be a valid function.
|
292 |
+
*
|
293 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
294 |
+
*/
|
295 |
+
save:
|
296 |
+
function( props ) {
|
297 |
+
const { attributes: {overallRatingAttribute, size, postId }} = props;
|
298 |
+
|
299 |
+
console.log(props);
|
300 |
+
|
301 |
+
let yasrOverallAttributes = null;
|
302 |
+
|
303 |
+
if (size) {
|
304 |
+
yasrOverallAttributes += ' size="' +size+ '"';
|
305 |
+
}
|
306 |
+
if (postId) {
|
307 |
+
yasrOverallAttributes += ' postid="'+postId+'"';
|
308 |
+
}
|
309 |
+
|
310 |
+
return (
|
311 |
+
<p>[yasr_overall_rating {yasrOverallAttributes}]</p>
|
312 |
+
);
|
313 |
+
},
|
314 |
+
|
315 |
+
});
|
316 |
+
|
317 |
+
|
318 |
+
registerBlockType(
|
319 |
+
|
320 |
+
'yet-another-stars-rating/yasr-visitor-votes', {
|
321 |
+
|
322 |
+
title: __( 'Yasr: Visitor Votes', 'yet-another-stars-rating' ),
|
323 |
+
description: __('Insert the ability for your visitors to vote', 'yet-another-stars-rating'),
|
324 |
+
icon: 'star-half',
|
325 |
+
category: 'yet-another-stars-rating',
|
326 |
+
keywords: [
|
327 |
+
__('rating', 'yet-another-stars-rating'),
|
328 |
+
__('visitor', 'yet-another-stars-rating'),
|
329 |
+
__('votes', 'yet-another-stars-rating')
|
330 |
+
],
|
331 |
+
attributes: {
|
332 |
+
//name of the attribute
|
333 |
+
size: {
|
334 |
+
type: 'string',
|
335 |
+
default: '--'
|
336 |
+
},
|
337 |
+
postId: {
|
338 |
+
type: 'int',
|
339 |
+
default: ''
|
340 |
+
},
|
341 |
+
},
|
342 |
|
343 |
+
edit:
|
344 |
+
|
345 |
+
function( props ) {
|
346 |
+
|
347 |
+
const { attributes: { size, postId }, setAttributes, isSelected } = props;
|
348 |
+
|
349 |
+
let sizeAttribute = null;
|
350 |
+
let postIdAttribute = null;
|
351 |
+
let isNum = false;
|
352 |
+
|
353 |
+
isNum = /^\d+$/.test(postId);
|
354 |
+
|
355 |
+
if (size !== '--') {
|
356 |
+
sizeAttribute = ' size="' + size + '"';
|
357 |
+
}
|
358 |
+
|
359 |
+
if (postId && isNum === true) {
|
360 |
+
postIdAttribute = ' postid="' +postId + '"';
|
361 |
+
}
|
362 |
+
|
363 |
+
|
364 |
+
function YasrPrintSelectSize () {
|
365 |
+
return (
|
366 |
+
<form>
|
367 |
+
<select value={size} onChange={ yasrSetStarsSize }>
|
368 |
+
<option value="--">{yasrSelectSizeChoose}</option>
|
369 |
+
<option value="small">{yasrSelectSizeSmall}</option>
|
370 |
+
<option value="medium">{yasrSelectSizeMedium}</option>
|
371 |
+
<option value="large">{yasrSelectSizeLarge}</option>
|
372 |
+
</select>
|
373 |
+
</form>
|
374 |
);
|
375 |
+
}
|
376 |
|
377 |
+
function yasrSetStarsSize(event) {
|
378 |
+
const selected = event.target.querySelector( 'option:checked' );
|
379 |
+
setAttributes( { size: selected.value } );
|
380 |
+
event.preventDefault();
|
381 |
}
|
382 |
|
383 |
+
function YasrPrintInputId() {
|
384 |
+
return (
|
385 |
+
<div>
|
386 |
+
<input type="text" size="4" onKeyPress={yasrSetPostId} />
|
387 |
+
</div>
|
388 |
+
);
|
389 |
+
}
|
390 |
+
|
391 |
+
function yasrSetPostId (event) {
|
392 |
+
if (event.key === 'Enter') {
|
393 |
+
const postIdValue = event.target.value;
|
394 |
|
395 |
+
//postID is always a string, here I check if this string is made only by digits
|
396 |
+
var isNum = /^\d+$/.test(postIdValue);
|
397 |
+
|
398 |
+
if (isNum === true) {
|
399 |
+
setAttributes({postId: postIdValue})
|
400 |
+
}
|
401 |
+
event.preventDefault();
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
function YasrVVPanel (props) {
|
406 |
|
407 |
return (
|
408 |
<InspectorControls>
|
|
|
|
|
|
|
409 |
|
410 |
<PanelBody title='Settings'>
|
411 |
+
<h3>{yasrOptionalText}</h3>
|
412 |
|
413 |
<div className="yasr-guten-block-panel">
|
414 |
+
<label>{yasrLabelSelectSize}</label>
|
415 |
<div>
|
416 |
+
<YasrPrintSelectSize />
|
417 |
</div>
|
418 |
</div>
|
419 |
|
420 |
<div className="yasr-guten-block-panel">
|
421 |
+
<label>Post ID</label>
|
422 |
+
<YasrPrintInputId/>
|
423 |
<div className="yasr-guten-block-explain">
|
424 |
+
{yasrLeaveThisBlankText}
|
425 |
</div>
|
426 |
</div>
|
427 |
|
428 |
<div className="yasr-guten-block-panel">
|
429 |
+
{yasrVisitorVotesDescription}
|
430 |
</div>
|
431 |
</PanelBody>
|
432 |
</InspectorControls>
|
436 |
|
437 |
return (
|
438 |
<Fragment>
|
439 |
+
<YasrVVPanel />
|
|
|
440 |
<div className={ props.className }>
|
441 |
+
[yasr_visitor_votes{sizeAttribute}{postIdAttribute}]
|
442 |
+
{isSelected && <YasrPrintSelectSize />}
|
443 |
</div>
|
444 |
</Fragment>
|
445 |
);
|
455 |
*/
|
456 |
save:
|
457 |
function( props ) {
|
458 |
+
const { attributes: {size, postId} } = props;
|
459 |
|
460 |
+
let yasrVVAttributes = null;
|
461 |
|
462 |
if (size) {
|
463 |
+
yasrVVAttributes += ' size="' +size+ '"';
|
464 |
}
|
465 |
if (postId) {
|
466 |
+
yasrVVAttributes += ' postid="'+postId+'"';
|
467 |
}
|
468 |
|
469 |
return (
|
470 |
+
<p>[yasr_visitor_votes {yasrVVAttributes}]</p>
|
471 |
);
|
472 |
},
|
473 |
|
474 |
+
});
|
js/tippy.all.min.js
CHANGED
@@ -1,2 +1 @@
|
|
1 |
(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.tippy=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var r=e.ownerDocument.defaultView,a=r.getComputedStyle(e,null);return t?a[t]:a}function r(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function a(e){if(!e)return document.body;switch(e.nodeName){case'HTML':case'BODY':return e.ownerDocument.body;case'#document':return e.body;}var p=t(e),o=p.overflow,i=p.overflowX,n=p.overflowY;return /(auto|scroll|overlay)/.test(o+n+i)?e:a(r(e))}function p(e){return 11===e?ht:10===e?bt:ht||bt}function o(e){if(!e)return document.documentElement;for(var r=p(10)?document.body:null,a=e.offsetParent||null;a===r&&e.nextElementSibling;)a=(e=e.nextElementSibling).offsetParent;var i=a&&a.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TH','TD','TABLE'].indexOf(a.nodeName)&&'static'===t(a,'position')?o(a):a:e?e.ownerDocument.documentElement:document.documentElement}function n(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||o(e.firstElementChild)===e)}function s(e){return null===e.parentNode?e:s(e.parentNode)}function l(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var r=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,a=r?e:t,p=r?t:e,i=document.createRange();i.setStart(a,0),i.setEnd(p,0);var d=i.commonAncestorContainer;if(e!==d&&t!==d||a.contains(p))return n(d)?d:o(d);var c=s(e);return c.host?l(c.host,t):l(e,s(t).host)}function d(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'top',r='top'===t?'scrollTop':'scrollLeft',a=e.nodeName;if('BODY'===a||'HTML'===a){var p=e.ownerDocument.documentElement,o=e.ownerDocument.scrollingElement||p;return o[r]}return e[r]}function c(e,t){var r=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],a=d(t,'top'),p=d(t,'left'),o=r?-1:1;return e.top+=a*o,e.bottom+=a*o,e.left+=p*o,e.right+=p*o,e}function m(e,t){var r='x'===t?'Left':'Top',a='Left'===r?'Right':'Bottom';return parseFloat(e['border'+r+'Width'],10)+parseFloat(e['border'+a+'Width'],10)}function f(e,t,r,a){return Je(t['offset'+e],t['scroll'+e],r['client'+e],r['offset'+e],r['scroll'+e],p(10)?parseInt(r['offset'+e])+parseInt(a['margin'+('Height'===e?'Top':'Left')])+parseInt(a['margin'+('Height'===e?'Bottom':'Right')]):0)}function h(e){var t=e.body,r=e.documentElement,a=p(10)&&getComputedStyle(r);return{height:f('Height',t,r,a),width:f('Width',t,r,a)}}function b(e){return xt({},e,{right:e.left+e.width,bottom:e.top+e.height})}function u(e){var r={};try{if(p(10)){r=e.getBoundingClientRect();var a=d(e,'top'),o=d(e,'left');r.top+=a,r.left+=o,r.bottom+=a,r.right+=o}else r=e.getBoundingClientRect()}catch(t){}var i={left:r.left,top:r.top,width:r.right-r.left,height:r.bottom-r.top},n='HTML'===e.nodeName?h(e.ownerDocument):{},s=n.width||e.clientWidth||i.right-i.left,l=n.height||e.clientHeight||i.bottom-i.top,c=e.offsetWidth-s,f=e.offsetHeight-l;if(c||f){var y=t(e);c-=m(y,'x'),f-=m(y,'y'),i.width-=c,i.height-=f}return b(i)}function y(e,r){var o=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],i=p(10),n='HTML'===r.nodeName,s=u(e),l=u(r),d=a(e),m=t(r),f=parseFloat(m.borderTopWidth,10),h=parseFloat(m.borderLeftWidth,10);o&&n&&(l.top=Je(l.top,0),l.left=Je(l.left,0));var y=b({top:s.top-l.top-f,left:s.left-l.left-h,width:s.width,height:s.height});if(y.marginTop=0,y.marginLeft=0,!i&&n){var g=parseFloat(m.marginTop,10),x=parseFloat(m.marginLeft,10);y.top-=f-g,y.bottom-=f-g,y.left-=h-x,y.right-=h-x,y.marginTop=g,y.marginLeft=x}return(i&&!o?r.contains(d):r===d&&'BODY'!==d.nodeName)&&(y=c(y,r)),y}function g(e){var t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],r=e.ownerDocument.documentElement,a=y(e,r),p=Je(r.clientWidth,window.innerWidth||0),o=Je(r.clientHeight,window.innerHeight||0),i=t?0:d(r),n=t?0:d(r,'left'),s={top:i-a.top+a.marginTop,left:n-a.left+a.marginLeft,width:p,height:o};return b(s)}function x(e){var a=e.nodeName;return'BODY'!==a&&'HTML'!==a&&('fixed'===t(e,'position')||x(r(e)))}function w(e){if(!e||!e.parentElement||p())return document.documentElement;for(var r=e.parentElement;r&&'none'===t(r,'transform');)r=r.parentElement;return r||document.documentElement}function v(e,t,p,o){var i=!!(4<arguments.length&&void 0!==arguments[4])&&arguments[4],n={top:0,left:0},s=i?w(e):l(e,t);if('viewport'===o)n=g(s,i);else{var d;'scrollParent'===o?(d=a(r(t)),'BODY'===d.nodeName&&(d=e.ownerDocument.documentElement)):'window'===o?d=e.ownerDocument.documentElement:d=o;var c=y(d,s,i);if('HTML'===d.nodeName&&!x(s)){var m=h(e.ownerDocument),f=m.height,b=m.width;n.top+=c.top-c.marginTop,n.bottom=f+c.top,n.left+=c.left-c.marginLeft,n.right=b+c.left}else n=c}p=p||0;var u='number'==typeof p;return n.left+=u?p:p.left||0,n.top+=u?p:p.top||0,n.right-=u?p:p.right||0,n.bottom-=u?p:p.bottom||0,n}function k(e){var t=e.width,r=e.height;return t*r}function E(e,t,r,a,p){var o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf('auto'))return e;var i=v(r,a,o,p),n={top:{width:i.width,height:t.top-i.top},right:{width:i.right-t.right,height:i.height},bottom:{width:i.width,height:i.bottom-t.bottom},left:{width:t.left-i.left,height:i.height}},s=Object.keys(n).map(function(e){return xt({key:e},n[e],{area:k(n[e])})}).sort(function(e,t){return t.area-e.area}),l=s.filter(function(e){var t=e.width,a=e.height;return t>=r.clientWidth&&a>=r.clientHeight}),d=0<l.length?l[0].key:s[0].key,c=e.split('-')[1];return d+(c?'-'+c:'')}function O(e,t,r){var a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,p=a?w(t):l(t,r);return y(r,p,a)}function C(e){var t=e.ownerDocument.defaultView,r=t.getComputedStyle(e),a=parseFloat(r.marginTop||0)+parseFloat(r.marginBottom||0),p=parseFloat(r.marginLeft||0)+parseFloat(r.marginRight||0),o={width:e.offsetWidth+p,height:e.offsetHeight+a};return o}function L(e){var t={left:'right',right:'left',bottom:'top',top:'bottom'};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function T(e,t,r){r=r.split('-')[0];var a=C(e),p={width:a.width,height:a.height},o=-1!==['right','left'].indexOf(r),i=o?'top':'left',n=o?'left':'top',s=o?'height':'width',l=o?'width':'height';return p[i]=t[i]+t[s]/2-a[s]/2,p[n]=r===n?t[n]-a[l]:t[L(n)],p}function S(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function A(e,t,r){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===r});var a=S(e,function(e){return e[t]===r});return e.indexOf(a)}function Y(t,r,a){var p=void 0===a?t:t.slice(0,A(t,'name',a));return p.forEach(function(t){t['function']&&console.warn('`modifier.function` is deprecated, use `modifier.fn`!');var a=t['function']||t.fn;t.enabled&&e(a)&&(r.offsets.popper=b(r.offsets.popper),r.offsets.reference=b(r.offsets.reference),r=a(r,t))}),r}function P(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=O(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=E(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=T(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?'fixed':'absolute',e=Y(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function D(e,t){return e.some(function(e){var r=e.name,a=e.enabled;return a&&r===t})}function X(e){for(var t=[!1,'ms','Webkit','Moz','O'],r=e.charAt(0).toUpperCase()+e.slice(1),a=0;a<t.length;a++){var p=t[a],o=p?''+p+r:e;if('undefined'!=typeof document.body.style[o])return o}return null}function I(){return this.state.isDestroyed=!0,D(this.modifiers,'applyStyle')&&(this.popper.removeAttribute('x-placement'),this.popper.style.position='',this.popper.style.top='',this.popper.style.left='',this.popper.style.right='',this.popper.style.bottom='',this.popper.style.willChange='',this.popper.style[X('transform')]=''),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function N(e){var t=e.ownerDocument;return t?t.defaultView:window}function H(e,t,r,p){var o='BODY'===e.nodeName,i=o?e.ownerDocument.defaultView:e;i.addEventListener(t,r,{passive:!0}),o||H(a(i.parentNode),t,r,p),p.push(i)}function W(e,t,r,p){r.updateBound=p,N(e).addEventListener('resize',r.updateBound,{passive:!0});var o=a(e);return H(o,'scroll',r.updateBound,r.scrollParents),r.scrollElement=o,r.eventsEnabled=!0,r}function B(){this.state.eventsEnabled||(this.state=W(this.reference,this.options,this.state,this.scheduleUpdate))}function M(e,t){return N(e).removeEventListener('resize',t.updateBound),t.scrollParents.forEach(function(e){e.removeEventListener('scroll',t.updateBound)}),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t}function R(){this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=M(this.reference,this.state))}function z(e){return''!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function F(e,t){Object.keys(t).forEach(function(r){var a='';-1!==['width','height','top','right','bottom','left'].indexOf(r)&&z(t[r])&&(a='px'),e.style[r]=t[r]+a})}function _(e,t){Object.keys(t).forEach(function(r){var a=t[r];!1===a?e.removeAttribute(r):e.setAttribute(r,t[r])})}function U(e,t){var r=e.offsets,a=r.popper,p=r.reference,o=Qe,i=function(e){return e},n=o(a.width),s=o(p.width),l=-1!==['left','right'].indexOf(e.placement),d=-1!==e.placement.indexOf('-'),c=t?l||d||s%2==n%2?o:Ge:i,m=t?o:i;return{left:c(1==s%2&&1==n%2&&!d&&t?a.left-1:a.left),top:m(a.top),bottom:m(a.bottom),right:c(a.right)}}function V(e,t,r){var a=S(e,function(e){var r=e.name;return r===t}),p=!!a&&e.some(function(e){return e.name===r&&e.enabled&&e.order<a.order});if(!p){var o='`'+t+'`';console.warn('`'+r+'`'+' modifier is required by '+o+' modifier in order to work, be sure to include it before '+o+'!')}return p}function q(e){return'end'===e?'start':'start'===e?'end':e}function j(e){var t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],r=kt.indexOf(e),a=kt.slice(r+1).concat(kt.slice(0,r));return t?a.reverse():a}function K(e,t,r,a){var p=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),o=+p[1],i=p[2];if(!o)return e;if(0===i.indexOf('%')){var n;switch(i){case'%p':n=r;break;case'%':case'%r':default:n=a;}var s=b(n);return s[t]/100*o}if('vh'===i||'vw'===i){var l;return l='vh'===i?Je(document.documentElement.clientHeight,window.innerHeight||0):Je(document.documentElement.clientWidth,window.innerWidth||0),l/100*o}return o}function G(e,t,r,a){var p=[0,0],o=-1!==['right','left'].indexOf(a),i=e.split(/(\+|\-)/).map(function(e){return e.trim()}),n=i.indexOf(S(i,function(e){return-1!==e.search(/,|\s/)}));i[n]&&-1===i[n].indexOf(',')&&console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');var s=/\s*,\s*|\s+/,l=-1===n?[i]:[i.slice(0,n).concat([i[n].split(s)[0]]),[i[n].split(s)[1]].concat(i.slice(n+1))];return l=l.map(function(e,a){var p=(1===a?!o:o)?'height':'width',i=!1;return e.reduce(function(e,t){return''===e[e.length-1]&&-1!==['+','-'].indexOf(t)?(e[e.length-1]=t,i=!0,e):i?(e[e.length-1]+=t,i=!1,e):e.concat(t)},[]).map(function(e){return K(e,p,t,r)})}),l.forEach(function(e,t){e.forEach(function(r,a){z(r)&&(p[t]+=r*('-'===e[a-1]?-1:1))})}),p}function Q(e,t){var r=t.offset,a=e.placement,p=e.offsets,o=p.popper,i=p.reference,n=a.split('-')[0],s=void 0;return s=z(+r)?[+r,0]:G(r,o,i,n),'left'===n?(o.top+=s[0],o.left-=s[1]):'right'===n?(o.top+=s[0],o.left+=s[1]):'top'===n?(o.left+=s[0],o.top-=s[1]):'bottom'===n&&(o.left+=s[0],o.top+=s[1]),e.popper=o,e}function J(e){return[].slice.call(e)}function Z(e,t){return(Lt.closest||function(e){for(var t=this;t;){if(Tt.call(t,e))return t;t=t.parentElement}}).call(e,t)}function $(e,t){for(;e;){if(t(e))return e;e=e.parentElement}}function ee(){return document.createElement('div')}function te(e,t){e[St.x&&'innerHTML']=t instanceof Element?t[St.x&&'innerHTML']:t}function re(e,t){t.content instanceof Element?(te(e,''),e.appendChild(t.content)):e[t.allowHTML?'innerHTML':'textContent']=t.content}function ae(e){return{tooltip:e.querySelector(Ct.TOOLTIP),backdrop:e.querySelector(Ct.BACKDROP),content:e.querySelector(Ct.CONTENT),arrow:e.querySelector(Ct.ARROW)||e.querySelector(Ct.ROUND_ARROW)}}function pe(e){e.setAttribute('data-inertia','')}function oe(e){e.removeAttribute('data-inertia')}function ie(e){var t=ee();return'round'===e?(t.className='tippy-roundarrow',te(t,'<svg viewBox="0 0 24 8" xmlns="http://www.w3.org/2000/svg"><path d="M3 8s2.021-.015 5.253-4.218C9.584 2.051 10.797 1.007 12 1c1.203-.007 2.416 1.035 3.761 2.782C19.012 8.005 21 8 21 8H3z"/></svg>')):t.className='tippy-arrow',t}function ne(){var e=ee();return e.className='tippy-backdrop',e.setAttribute('data-state','hidden'),e}function se(e,t){e.setAttribute('tabindex','-1'),t.setAttribute('data-interactive','')}function le(e,t){e.removeAttribute('tabindex'),t.removeAttribute('data-interactive')}function de(e,t){e.forEach(function(e){e&&(e.style.transitionDuration=t+'ms')})}function ce(e,t,r){e[t+'EventListener']('transitionend',r)}function me(e){var t=e.getAttribute('x-placement');return t?t.split('-')[0]:''}function fe(e,t){e.forEach(function(e){e&&e.setAttribute('data-state',t)})}function he(e){void e.offsetHeight}function be(e,t){var r=ee();r.className='tippy-popper',r.setAttribute('role','tooltip'),r.id='tippy-'+e,r.style.zIndex=t.zIndex;var a=ee();a.className='tippy-tooltip',a.style.maxWidth=t.maxWidth+('number'==typeof t.maxWidth?'px':''),a.setAttribute('data-size',t.size),a.setAttribute('data-animation',t.animation),a.setAttribute('data-state','hidden'),t.theme.split(' ').forEach(function(e){a.classList.add(e+'-theme')});var p=ee();return p.className='tippy-content',p.setAttribute('data-state','hidden'),t.interactive&&se(r,a),t.arrow&&a.appendChild(ie(t.arrowType)),t.animateFill&&(a.appendChild(ne()),a.setAttribute('data-animatefill','')),t.inertia&&pe(a),re(p,t),a.appendChild(p),r.appendChild(a),r.addEventListener('focusout',function(t){t.relatedTarget&&r._tippy&&!$(t.relatedTarget,function(e){return e===r})&&t.relatedTarget!==r._tippy.reference&&r._tippy.props.shouldPopperHideOnBlur(t)&&r._tippy.hide()}),r}function ye(e,t,r){var a=ae(e),p=a.tooltip,o=a.content,i=a.backdrop,n=a.arrow;e.style.zIndex=r.zIndex,p.setAttribute('data-size',r.size),p.setAttribute('data-animation',r.animation),p.style.maxWidth=r.maxWidth+('number'==typeof r.maxWidth?'px':''),t.content!==r.content&&re(o,r),!t.animateFill&&r.animateFill?(p.appendChild(ne()),p.setAttribute('data-animatefill','')):t.animateFill&&!r.animateFill&&(p.removeChild(i),p.removeAttribute('data-animatefill')),!t.arrow&&r.arrow?p.appendChild(ie(r.arrowType)):t.arrow&&!r.arrow&&p.removeChild(n),t.arrow&&r.arrow&&t.arrowType!==r.arrowType&&p.replaceChild(ie(r.arrowType),n),!t.interactive&&r.interactive?se(e,p):t.interactive&&!r.interactive&&le(e,p),!t.inertia&&r.inertia?pe(p):t.inertia&&!r.inertia&&oe(p),t.theme!==r.theme&&(t.theme.split(' ').forEach(function(e){p.classList.remove(e+'-theme')}),r.theme.split(' ').forEach(function(e){p.classList.add(e+'-theme')}))}function ue(e,t){var r=e.popper,a=e.options,p=a.onCreate,o=a.onUpdate;a.onCreate=a.onUpdate=function(){he(r),t(),o(),a.onCreate=p,a.onUpdate=o}}function ge(e){J(document.querySelectorAll(Ct.POPPER)).forEach(function(t){var r=t._tippy;r&&!0===r.props.hideOnClick&&(!e||t!==e.popper)&&r.hide()})}function xe(e,t,r,a){if(!e)return!0;var p=r.clientX,o=r.clientY,i=a.interactiveBorder,n=a.distance,s=t.top-o>('top'===e?i+n:i),l=o-t.bottom>('bottom'===e?i+n:i),d=t.left-p>('left'===e?i+n:i),c=p-t.right>('right'===e?i+n:i);return s||l||d||c}function we(e,t){return-(e-t)+'px'}function ve(){At||(At=!0,ot&&document.body.classList.add('tippy-iOS'),window.performance&&document.addEventListener('mousemove',ke))}function ke(){var e=performance.now();20>e-Yt&&(At=!1,document.removeEventListener('mousemove',ke),!ot&&document.body.classList.remove('tippy-iOS')),Yt=e}function Ee(e){var t=e.target;if(!(t instanceof Element))return ge();var r=Z(t,Ct.POPPER);if(!(r&&r._tippy&&r._tippy.props.interactive)){var a=$(t,function(e){return e._tippy&&e._tippy.reference===e});if(a){var p=a._tippy,o=-1<p.props.trigger.indexOf('click');if(At||o)return ge(p);if(!0!==p.props.hideOnClick||o)return;p.clearDelayTimeouts()}ge()}}function Oe(){var e=document,t=e.activeElement;t&&t.blur&&t._tippy&&t.blur()}function Ce(){J(document.querySelectorAll(Ct.POPPER)).forEach(function(e){var t=e._tippy;t.props.livePlacement||t.popperInstance.scheduleUpdate()})}function Le(){document.addEventListener('click',Ee,!0),document.addEventListener('touchstart',ve,{passive:!0}),window.addEventListener('blur',Oe),window.addEventListener('resize',Ce),!it&&(navigator.maxTouchPoints||navigator.msMaxTouchPoints)&&document.addEventListener('pointerdown',ve)}function Te(e){return'[object Object]'==={}.toString.call(e)}function Se(e,t){return{}.hasOwnProperty.call(e,t)}function Ae(e){return!isNaN(e)&&!isNaN(parseFloat(e))}function Ye(e){if(e instanceof Element||Te(e))return[e];if(e instanceof NodeList)return J(e);if(Array.isArray(e))return e;try{return J(document.querySelectorAll(e))}catch(t){return[]}}function Pe(e,t,r){if(Array.isArray(e)){var a=e[t];return null==a?r:a}return e}function De(e){var t=window.scrollX||window.pageXOffset,r=window.scrollY||window.pageYOffset;e.focus(),scroll(t,r)}function Xe(e){setTimeout(e,1)}function Ie(e,t){var r;return function(){var a=this,p=arguments;clearTimeout(r),r=setTimeout(function(){return e.apply(a,p)},t)}}function Ne(e,t){return e&&e.modifiers&&e.modifiers[t]}function He(e){return!(e instanceof Element)||Tt.call(e,'a[href],area[href],button,details,input,textarea,select,iframe,[tabindex]')&&!e.hasAttribute('disabled')}function We(e){return Pt.reduce(function(t,r){var a=(e.getAttribute('data-tippy-'+r)||'').trim();return a?(t[r]='content'===r?a:'true'===a||'false'!==a&&(Ae(a)?+a:'['===a[0]||'{'===a[0]?JSON.parse(a):a),t):t},{})}function Be(e){var t={isVirtual:!0,attributes:e.attributes||{},setAttribute:function(t,r){e.attributes[t]=r},getAttribute:function(t){return e.attributes[t]},removeAttribute:function(t){delete e.attributes[t]},hasAttribute:function(t){return t in e.attributes},addEventListener:function(){},removeEventListener:function(){},classList:{classNames:{},add:function(t){e.classList.classNames[t]=!0},remove:function(t){delete e.classList.classNames[t]},contains:function(t){return t in e.classList.classNames}}};for(var r in t)e[r]=t[r]}function Me(e,t){var r=Dt({},t,t.performance?{}:We(e));return r.arrow&&(r.animateFill=!1),'function'==typeof r.appendTo&&(r.appendTo=t.appendTo(e)),'function'==typeof r.content&&(r.content=t.content(e)),r}function Re(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];Object.keys(e).forEach(function(e){if(!Se(t,e))throw new Error('[tippy]: `'+e+'` is not a valid option')})}function ze(e,t){return(t?e:{X:'Y',Y:'X'}[e])||''}function Fe(e,t,r,p){var o=t[0],i=t[1];if(!o&&!i)return'';var n={scale:function(){return i?r?o+', '+i:i+', '+o:''+o}(),translate:function(){return i?r?p?o+'px, '+-i+'px':o+'px, '+i+'px':p?-i+'px, '+o+'px':i+'px, '+o+'px':p?-o+'px':o+'px'}()};return n[e]}function _e(e,t){var r=e.match(new RegExp(t+'([XY])'));return r?r[1]:''}function Ue(e,t){var r=e.match(t);return r?r[1].split(',').map(function(e){return parseFloat(e,10)}):[]}function Ve(e,t){var r=me(Z(e,Ct.POPPER)),a='top'===r||'bottom'===r,p='right'===r||'bottom'===r,o={translate:{axis:_e(t,'translate'),numbers:Ue(t,Xt.translate)},scale:{axis:_e(t,'scale'),numbers:Ue(t,Xt.scale)}},i=t.replace(Xt.translate,'translate'+ze(o.translate.axis,a)+'('+Fe('translate',o.translate.numbers,a,p)+')').replace(Xt.scale,'scale'+ze(o.scale.axis,a)+'('+Fe('scale',o.scale.numbers,a,p)+')');e.style['undefined'==typeof document.body.style.transform?'webkitTransform':'transform']=i}function qe(e,t){function r(){Xe(function(){z=!1})}function a(){X=new MutationObserver(function(){q.popperInstance.update()}),X.observe(U,{childList:!0,subtree:!0,characterData:!0})}function p(e){var t=N=e,r=t.clientX,a=t.clientY;if(q.popperInstance){var p=me(q.popper),o=q.popperChildren.arrow?20:5,i='top'===p||'bottom'===p,n='left'===p||'right'===p,l=i?Je(o,r):r,d=n?Je(o,a):a;i&&l>o&&(l=Ke(r,window.innerWidth-o)),n&&d>o&&(d=Ke(a,window.innerHeight-o));var c=q.reference.getBoundingClientRect(),m=q.props.followCursor,f='horizontal'===m,h='vertical'===m;q.popperInstance.reference={getBoundingClientRect:function(){return{width:0,height:0,top:f?c.top:d,bottom:f?c.bottom:d,left:h?c.left:l,right:h?c.right:l}},clientWidth:0,clientHeight:0},q.popperInstance.scheduleUpdate(),'initial'===m&&q.state.isVisible&&s()}}function o(e){var t=Z(e.target,q.props.target);t&&!t._tippy&&(qe(t,Dt({},q.props,{target:'',showOnInit:!0})),i(e))}function i(e){if(T(),!q.state.isVisible){if(q.props.target)return o(e);if(B=!0,q.props.wait)return q.props.wait(q,e);x()&&document.addEventListener('mousemove',p);var t=Pe(q.props.delay,0,nt.delay);t?H=setTimeout(function(){A()},t):A()}}function n(){if(T(),!q.state.isVisible)return s();B=!1;var e=Pe(q.props.delay,1,nt.delay);e?W=setTimeout(function(){q.state.isVisible&&Y()},e):Y()}function s(){document.removeEventListener('mousemove',p),N=null}function l(){document.body.removeEventListener('mouseleave',n),document.removeEventListener('mousemove',F)}function d(e){!q.state.isEnabled||y(e)||(!q.state.isVisible&&(I=e),'click'===e.type&&!1!==q.props.hideOnClick&&q.state.isVisible?n():i(e))}function c(e){var t=$(e.target,function(e){return e._tippy}),r=Z(e.target,Ct.POPPER)===q.popper,a=t===q.reference;r||a||xe(me(q.popper),q.popper.getBoundingClientRect(),e,q.props)&&(l(),n())}function m(e){return y(e)?void 0:q.props.interactive?(document.body.addEventListener('mouseleave',n),void document.addEventListener('mousemove',F)):void n()}function f(e){if(e.target===q.reference){if(q.props.interactive){if(!e.relatedTarget)return;if(Z(e.relatedTarget,Ct.POPPER))return}n()}}function h(e){Z(e.target,q.props.target)&&i(e)}function b(e){Z(e.target,q.props.target)&&n()}function y(e){var t=-1<e.type.indexOf('touch'),r=it&&At&&q.props.touchHold&&!t,a=At&&!q.props.touchHold&&t;return r||a}function u(){var e=q.props.popperOptions,t=q.popperChildren,r=t.tooltip,a=t.arrow;return new Ot(q.reference,q.popper,Dt({placement:q.props.placement},e,{modifiers:Dt({},e?e.modifiers:{},{preventOverflow:Dt({boundariesElement:q.props.boundary},Ne(e,'preventOverflow')),arrow:Dt({element:a,enabled:!!a},Ne(e,'arrow')),flip:Dt({enabled:q.props.flip,padding:q.props.distance+5,behavior:q.props.flipBehavior},Ne(e,'flip')),offset:Dt({offset:q.props.offset},Ne(e,'offset'))}),onCreate:function(){r.style[me(q.popper)]=we(q.props.distance,nt.distance),a&&q.props.arrowTransform&&Ve(a,q.props.arrowTransform)},onUpdate:function(){var e=r.style;e.top='',e.bottom='',e.left='',e.right='',e[me(q.popper)]=we(q.props.distance,nt.distance),a&&q.props.arrowTransform&&Ve(a,q.props.arrowTransform)}}))}function g(e){q.popperInstance?!x()&&(q.popperInstance.scheduleUpdate(),q.props.livePlacement&&q.popperInstance.enableEventListeners()):(q.popperInstance=u(),a(),(!q.props.livePlacement||x())&&q.popperInstance.disableEventListeners()),q.popperInstance.reference=q.reference;var t=q.popperChildren.arrow;if(x()){t&&(t.style.margin='0');var r=Pe(q.props.delay,0,nt.delay);I.type&&p(r&&N?N:I)}else t&&(t.style.margin='');ue(q.popperInstance,e),q.props.appendTo.contains(q.popper)||(q.props.appendTo.appendChild(q.popper),q.props.onMount(q),q.state.isMounted=!0)}function x(){return q.props.followCursor&&!At&&'focus'!==I.type}function w(){de([q.popper],pt?0:q.props.updateDuration);(function e(){q.popperInstance&&q.popperInstance.scheduleUpdate(),q.state.isMounted?requestAnimationFrame(e):de([q.popper],0)})()}function v(e,t){E(e,function(){!q.state.isVisible&&q.props.appendTo.contains(q.popper)&&t()})}function k(e,t){E(e,t)}function E(e,t){if(0===e)return t();var r=q.popperChildren.tooltip,a=function a(p){p.target===r&&(ce(r,'remove',a),t())};ce(r,'remove',M),ce(r,'add',a),M=a}function O(e,t,r){q.reference.addEventListener(e,t),r.push({eventType:e,handler:t})}function C(){R=q.props.trigger.trim().split(' ').reduce(function(e,t){return'manual'===t?e:(q.props.target?'mouseenter'===t?(O('mouseover',h,e),O('mouseout',b,e)):'focus'===t?(O('focusin',h,e),O('focusout',b,e)):'click'===t?O(t,h,e):void 0:(O(t,d,e),q.props.touchHold&&(O('touchstart',d,e),O('touchend',m,e)),'mouseenter'===t?O('mouseleave',m,e):'focus'===t?O(pt?'focusout':'blur',f,e):void 0),e)},[])}function L(){R.forEach(function(e){var t=e.eventType,r=e.handler;q.reference.removeEventListener(t,r)})}function T(){clearTimeout(H),clearTimeout(W)}function S(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};Re(e,nt);var t=q.props,r=Me(q.reference,Dt({},q.props,e,{performance:!0}));r.performance=Se(e,'performance')?e.performance:t.performance,q.props=r,(Se(e,'trigger')||Se(e,'touchHold'))&&(L(),C()),Se(e,'interactiveDebounce')&&(l(),F=Ie(c,e.interactiveDebounce)),ye(q.popper,t,r),q.popperChildren=ae(q.popper),q.popperInstance&&st.some(function(t){return Se(e,t)})&&(q.popperInstance.destroy(),q.popperInstance=u(),!q.state.isVisible&&q.popperInstance.disableEventListeners(),q.props.followCursor&&N&&p(N))}function A(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Pe(q.props.duration,0,nt.duration[0]);return q.state.isDestroyed||!q.state.isEnabled||At&&!q.props.touch?void 0:q.reference.isVirtual||document.documentElement.contains(q.reference)?q.reference.hasAttribute('disabled')?void 0:z?void(z=!1):void(!1===q.props.onShow(q)||(q.popper.style.visibility='visible',q.state.isVisible=!0,de([q.popper,q.popperChildren.tooltip,q.popperChildren.backdrop],0),g(function(){q.state.isVisible&&(!x()&&q.popperInstance.update(),de([q.popperChildren.tooltip,q.popperChildren.backdrop,q.popperChildren.content],e),q.popperChildren.backdrop&&(q.popperChildren.content.style.transitionDelay=Qe(e/6)+'ms'),q.props.interactive&&q.reference.classList.add('tippy-active'),q.props.sticky&&w(),fe([q.popperChildren.tooltip,q.popperChildren.backdrop,q.popperChildren.content],'visible'),k(e,function(){0===q.props.updateDuration&&q.popperChildren.tooltip.classList.add('tippy-notransition'),q.props.autoFocus&&q.props.interactive&&-1<['focus','click'].indexOf(I.type)&&De(q.popper),q.reference.setAttribute('aria-'+q.props.aria,q.popper.id),q.props.onShown(q),q.state.isShown=!0}))}))):P()}function Y(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Pe(q.props.duration,1,nt.duration[1]);q.state.isDestroyed||!q.state.isEnabled||!1===q.props.onHide(q)||(0===q.props.updateDuration&&q.popperChildren.tooltip.classList.remove('tippy-notransition'),q.props.interactive&&q.reference.classList.remove('tippy-active'),q.popper.style.visibility='hidden',q.state.isVisible=!1,q.state.isShown=!1,de([q.popperChildren.tooltip,q.popperChildren.backdrop,q.popperChildren.content],e),fe([q.popperChildren.tooltip,q.popperChildren.backdrop,q.popperChildren.content],'hidden'),q.props.autoFocus&&q.props.interactive&&!z&&-1<['focus','click'].indexOf(I.type)&&('focus'===I.type&&(z=!0),De(q.reference)),v(e,function(){B||s(),q.reference.removeAttribute('aria-'+q.props.aria),q.popperInstance.disableEventListeners(),q.props.appendTo.removeChild(q.popper),q.state.isMounted=!1,q.props.onHidden(q)}))}function P(e){q.state.isDestroyed||(q.state.isMounted&&Y(0),L(),q.reference.removeEventListener('click',r),delete q.reference._tippy,q.props.target&&e&&J(q.reference.querySelectorAll(q.props.target)).forEach(function(e){return e._tippy&&e._tippy.destroy()}),q.popperInstance&&q.popperInstance.destroy(),X&&X.disconnect(),q.state.isDestroyed=!0)}var D=Me(e,t);if(!D.multiple&&e._tippy)return null;var X=null,I={},N=null,H=0,W=0,B=!1,M=function(){},R=[],z=!1,F=0<D.interactiveDebounce?Ie(c,D.interactiveDebounce):c,_=It++,U=be(_,D);U.addEventListener('mouseenter',function(e){q.props.interactive&&q.state.isVisible&&'mouseenter'===I.type&&i(e)}),U.addEventListener('mouseleave',function(e){q.props.interactive&&'mouseenter'===I.type&&0===q.props.interactiveDebounce&&xe(me(U),U.getBoundingClientRect(),e,q.props)&&n()});var V=ae(U),q={id:_,reference:e,popper:U,popperChildren:V,popperInstance:null,props:D,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},clearDelayTimeouts:T,set:S,setContent:function(e){S({content:e})},show:A,hide:Y,enable:function(){q.state.isEnabled=!0},disable:function(){q.state.isEnabled=!1},destroy:P};return C(),e.addEventListener('click',r),D.lazy||(q.popperInstance=u(),q.popperInstance.disableEventListeners()),D.showOnInit&&i(),!D.a11y||D.target||He(e)||e.setAttribute('tabindex','0'),e._tippy=q,U._tippy=q,q}function je(e,t,r){Re(t,nt),Nt||(Le(),Nt=!0);var a=Dt({},nt,t);Te(e)&&Be(e);var p=Ye(e),o=p[0],i=(r&&o?[o]:p).reduce(function(e,t){var r=t&&qe(t,a);return r&&e.push(r),e},[]),n={targets:e,props:a,instances:i,destroyAll:function(){n.instances.forEach(function(e){e.destroy()}),n.instances=[]}};return n}for(var Ke=Math.min,Ge=Math.floor,Qe=Math.round,Je=Math.max,Ze='.tippy-iOS{cursor:pointer!important}.tippy-notransition{transition:none!important}.tippy-popper{-webkit-perspective:700px;perspective:700px;z-index:9999;outline:0;transition-timing-function:cubic-bezier(.165,.84,.44,1);pointer-events:none;line-height:1.4;max-width:calc(100% - 10px)}.tippy-popper[x-placement^=top] .tippy-backdrop{border-radius:40% 40% 0 0}.tippy-popper[x-placement^=top] .tippy-roundarrow{bottom:-8px;-webkit-transform-origin:50% 0;transform-origin:50% 0}.tippy-popper[x-placement^=top] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.tippy-popper[x-placement^=top] .tippy-arrow{border-top:8px solid #333;border-right:8px solid transparent;border-left:8px solid transparent;bottom:-7px;margin:0 6px;-webkit-transform-origin:50% 0;transform-origin:50% 0}.tippy-popper[x-placement^=top] .tippy-backdrop{-webkit-transform-origin:0 25%;transform-origin:0 25%}.tippy-popper[x-placement^=top] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-55%);transform:scale(1) translate(-50%,-55%)}.tippy-popper[x-placement^=top] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-50%,-45%);transform:scale(.2) translate(-50%,-45%);opacity:0}.tippy-popper[x-placement^=top] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateY(-20px);transform:translateY(-20px)}.tippy-popper[x-placement^=top] [data-animation=perspective]{-webkit-transform-origin:bottom;transform-origin:bottom}.tippy-popper[x-placement^=top] [data-animation=perspective][data-state=visible]{-webkit-transform:translateY(-10px) rotateX(0);transform:translateY(-10px) rotateX(0)}.tippy-popper[x-placement^=top] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:translateY(0) rotateX(60deg);transform:translateY(0) rotateX(60deg)}.tippy-popper[x-placement^=top] [data-animation=fade][data-state=visible]{-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateY(0);transform:translateY(0)}.tippy-popper[x-placement^=top] [data-animation=scale][data-state=visible]{-webkit-transform:translateY(-10px) scale(1);transform:translateY(-10px) scale(1)}.tippy-popper[x-placement^=top] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateY(0) scale(.5);transform:translateY(0) scale(.5)}.tippy-popper[x-placement^=bottom] .tippy-backdrop{border-radius:0 0 30% 30%}.tippy-popper[x-placement^=bottom] .tippy-roundarrow{top:-8px;-webkit-transform-origin:50% 100%;transform-origin:50% 100%}.tippy-popper[x-placement^=bottom] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(0);transform:rotate(0)}.tippy-popper[x-placement^=bottom] .tippy-arrow{border-bottom:8px solid #333;border-right:8px solid transparent;border-left:8px solid transparent;top:-7px;margin:0 6px;-webkit-transform-origin:50% 100%;transform-origin:50% 100%}.tippy-popper[x-placement^=bottom] .tippy-backdrop{-webkit-transform-origin:0 -50%;transform-origin:0 -50%}.tippy-popper[x-placement^=bottom] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-45%);transform:scale(1) translate(-50%,-45%)}.tippy-popper[x-placement^=bottom] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-50%);transform:scale(.2) translate(-50%);opacity:0}.tippy-popper[x-placement^=bottom] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateY(20px);transform:translateY(20px)}.tippy-popper[x-placement^=bottom] [data-animation=perspective]{-webkit-transform-origin:top;transform-origin:top}.tippy-popper[x-placement^=bottom] [data-animation=perspective][data-state=visible]{-webkit-transform:translateY(10px) rotateX(0);transform:translateY(10px) rotateX(0)}.tippy-popper[x-placement^=bottom] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:translateY(0) rotateX(-60deg);transform:translateY(0) rotateX(-60deg)}.tippy-popper[x-placement^=bottom] [data-animation=fade][data-state=visible]{-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateY(0);transform:translateY(0)}.tippy-popper[x-placement^=bottom] [data-animation=scale][data-state=visible]{-webkit-transform:translateY(10px) scale(1);transform:translateY(10px) scale(1)}.tippy-popper[x-placement^=bottom] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateY(0) scale(.5);transform:translateY(0) scale(.5)}.tippy-popper[x-placement^=left] .tippy-backdrop{border-radius:50% 0 0 50%}.tippy-popper[x-placement^=left] .tippy-roundarrow{right:-16px;-webkit-transform-origin:33.33333333% 50%;transform-origin:33.33333333% 50%}.tippy-popper[x-placement^=left] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.tippy-popper[x-placement^=left] .tippy-arrow{border-left:8px solid #333;border-top:8px solid transparent;border-bottom:8px solid transparent;right:-7px;margin:3px 0;-webkit-transform-origin:0 50%;transform-origin:0 50%}.tippy-popper[x-placement^=left] .tippy-backdrop{-webkit-transform-origin:50% 0;transform-origin:50% 0}.tippy-popper[x-placement^=left] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-50%);transform:scale(1) translate(-50%,-50%)}.tippy-popper[x-placement^=left] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-75%,-50%);transform:scale(.2) translate(-75%,-50%);opacity:0}.tippy-popper[x-placement^=left] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateX(-20px);transform:translateX(-20px)}.tippy-popper[x-placement^=left] [data-animation=perspective]{-webkit-transform-origin:right;transform-origin:right}.tippy-popper[x-placement^=left] [data-animation=perspective][data-state=visible]{-webkit-transform:translateX(-10px) rotateY(0);transform:translateX(-10px) rotateY(0)}.tippy-popper[x-placement^=left] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:translateX(0) rotateY(-60deg);transform:translateX(0) rotateY(-60deg)}.tippy-popper[x-placement^=left] [data-animation=fade][data-state=visible]{-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateX(0);transform:translateX(0)}.tippy-popper[x-placement^=left] [data-animation=scale][data-state=visible]{-webkit-transform:translateX(-10px) scale(1);transform:translateX(-10px) scale(1)}.tippy-popper[x-placement^=left] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateX(0) scale(.5);transform:translateX(0) scale(.5)}.tippy-popper[x-placement^=right] .tippy-backdrop{border-radius:0 50% 50% 0}.tippy-popper[x-placement^=right] .tippy-roundarrow{left:-16px;-webkit-transform-origin:66.66666666% 50%;transform-origin:66.66666666% 50%}.tippy-popper[x-placement^=right] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.tippy-popper[x-placement^=right] .tippy-arrow{border-right:8px solid #333;border-top:8px solid transparent;border-bottom:8px solid transparent;left:-7px;margin:3px 0;-webkit-transform-origin:100% 50%;transform-origin:100% 50%}.tippy-popper[x-placement^=right] .tippy-backdrop{-webkit-transform-origin:-50% 0;transform-origin:-50% 0}.tippy-popper[x-placement^=right] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-50%);transform:scale(1) translate(-50%,-50%)}.tippy-popper[x-placement^=right] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-25%,-50%);transform:scale(.2) translate(-25%,-50%);opacity:0}.tippy-popper[x-placement^=right] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateX(20px);transform:translateX(20px)}.tippy-popper[x-placement^=right] [data-animation=perspective]{-webkit-transform-origin:left;transform-origin:left}.tippy-popper[x-placement^=right] [data-animation=perspective][data-state=visible]{-webkit-transform:translateX(10px) rotateY(0);transform:translateX(10px) rotateY(0)}.tippy-popper[x-placement^=right] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:translateX(0) rotateY(60deg);transform:translateX(0) rotateY(60deg)}.tippy-popper[x-placement^=right] [data-animation=fade][data-state=visible]{-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateX(0);transform:translateX(0)}.tippy-popper[x-placement^=right] [data-animation=scale][data-state=visible]{-webkit-transform:translateX(10px) scale(1);transform:translateX(10px) scale(1)}.tippy-popper[x-placement^=right] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateX(0) scale(.5);transform:translateX(0) scale(.5)}.tippy-tooltip{position:relative;color:#fff;border-radius:4px;font-size:.9rem;padding:.3rem .6rem;max-width:350px;text-align:center;will-change:transform;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#333}.tippy-tooltip[data-size=small]{padding:.2rem .4rem;font-size:.75rem}.tippy-tooltip[data-size=large]{padding:.4rem .8rem;font-size:1rem}.tippy-tooltip[data-animatefill]{overflow:hidden;background-color:transparent}.tippy-tooltip[data-interactive],.tippy-tooltip[data-interactive] path{pointer-events:auto}.tippy-tooltip[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.53,2,.36,.85)}.tippy-tooltip[data-inertia][data-state=hidden]{transition-timing-function:ease}.tippy-arrow,.tippy-roundarrow{position:absolute;width:0;height:0}.tippy-roundarrow{width:24px;height:8px;fill:#333;pointer-events:none}.tippy-backdrop{position:absolute;will-change:transform;background-color:#333;border-radius:50%;width:calc(110% + 2rem);left:50%;top:50%;z-index:-1;transition:all cubic-bezier(.46,.1,.52,.98);-webkit-backface-visibility:hidden;backface-visibility:hidden}.tippy-backdrop:after{content:"";float:left;padding-top:100%}.tippy-backdrop+.tippy-content{transition-property:opacity;will-change:opacity}.tippy-backdrop+.tippy-content[data-state=visible]{opacity:1}.tippy-backdrop+.tippy-content[data-state=hidden]{opacity:0}',$e='3.4.0',et='undefined'!=typeof window,tt=et?navigator:{},rt=et?window:{},at=('MutationObserver'in rt),pt=/MSIE |Trident\//.test(tt.userAgent),ot=/iPhone|iPad|iPod/.test(tt.platform)&&!rt.MSStream,it=('ontouchstart'in rt),nt={a11y:!0,allowHTML:!0,animateFill:!0,animation:'shift-away',appendTo:function(){return document.body},aria:'describedby',arrow:!1,arrowTransform:'',arrowType:'sharp',autoFocus:!0,boundary:'scrollParent',content:'',delay:[0,20],distance:10,duration:[325,275],flip:!0,flipBehavior:'flip',followCursor:!1,hideOnClick:!0,inertia:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,lazy:!0,livePlacement:!0,maxWidth:'',multiple:!1,offset:0,onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},performance:!1,placement:'top',popperOptions:{},shouldPopperHideOnBlur:function(){return!0},showOnInit:!1,size:'regular',sticky:!1,target:'',theme:'dark',touch:!0,touchHold:!1,trigger:'mouseenter focus',updateDuration:200,wait:null,zIndex:9999},st=['arrow','arrowType','distance','flip','flipBehavior','offset','placement','popperOptions'],lt='undefined'!=typeof window&&'undefined'!=typeof document,dt=['Edge','Trident','Firefox'],ct=0,mt=0;mt<dt.length;mt+=1)if(lt&&0<=navigator.userAgent.indexOf(dt[mt])){ct=1;break}var i=lt&&window.Promise,ft=i?function(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},ct))}},ht=lt&&!!(window.MSInputMethodContext&&document.documentMode),bt=lt&&/MSIE 10/.test(navigator.userAgent),yt=function(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')},ut=function(){function e(e,t){for(var r,a=0;a<t.length;a++)r=t[a],r.enumerable=r.enumerable||!1,r.configurable=!0,'value'in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),gt=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},xt=Object.assign||function(e){for(var t,r=1;r<arguments.length;r++)for(var a in t=arguments[r],t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},wt=lt&&/Firefox/i.test(navigator.userAgent),vt=['auto-start','auto','auto-end','top-start','top','top-end','right-start','right','right-end','bottom-end','bottom','bottom-start','left-end','left','left-start'],kt=vt.slice(3),Et={FLIP:'flip',CLOCKWISE:'clockwise',COUNTERCLOCKWISE:'counterclockwise'},Ot=function(){function t(r,a){var p=this,o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};yt(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(p.update)},this.update=ft(this.update.bind(this)),this.options=xt({},t.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=r&&r.jquery?r[0]:r,this.popper=a&&a.jquery?a[0]:a,this.options.modifiers={},Object.keys(xt({},t.Defaults.modifiers,o.modifiers)).forEach(function(e){p.options.modifiers[e]=xt({},t.Defaults.modifiers[e]||{},o.modifiers?o.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return xt({name:e},p.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(t){t.enabled&&e(t.onLoad)&&t.onLoad(p.reference,p.popper,p.options,t,p.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return ut(t,[{key:'update',value:function(){return P.call(this)}},{key:'destroy',value:function(){return I.call(this)}},{key:'enableEventListeners',value:function(){return B.call(this)}},{key:'disableEventListeners',value:function(){return R.call(this)}}]),t}();Ot.Utils=('undefined'==typeof window?global:window).PopperUtils,Ot.placements=vt,Ot.Defaults={placement:'bottom',positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,r=t.split('-')[0],a=t.split('-')[1];if(a){var p=e.offsets,o=p.reference,i=p.popper,n=-1!==['bottom','top'].indexOf(r),s=n?'left':'top',l=n?'width':'height',d={start:gt({},s,o[s]),end:gt({},s,o[s]+o[l]-i[l])};e.offsets.popper=xt({},i,d[a])}return e}},offset:{order:200,enabled:!0,fn:Q,offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,t){var r=t.boundariesElement||o(e.instance.popper);e.instance.reference===r&&(r=o(r));var a=X('transform'),p=e.instance.popper.style,i=p.top,n=p.left,s=p[a];p.top='',p.left='',p[a]='';var l=v(e.instance.popper,e.instance.reference,t.padding,r,e.positionFixed);p.top=i,p.left=n,p[a]=s,t.boundaries=l;var d=t.priority,c=e.offsets.popper,m={primary:function(e){var r=c[e];return c[e]<l[e]&&!t.escapeWithReference&&(r=Je(c[e],l[e])),gt({},e,r)},secondary:function(e){var r='right'===e?'left':'top',a=c[r];return c[e]>l[e]&&!t.escapeWithReference&&(a=Ke(c[r],l[e]-('right'===e?c.width:c.height))),gt({},r,a)}};return d.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';c=xt({},c,m[t](e))}),e.offsets.popper=c,e},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,r=t.popper,a=t.reference,p=e.placement.split('-')[0],o=Ge,i=-1!==['top','bottom'].indexOf(p),n=i?'right':'bottom',s=i?'left':'top',l=i?'width':'height';return r[n]<o(a[s])&&(e.offsets.popper[s]=o(a[s])-r[l]),r[s]>o(a[n])&&(e.offsets.popper[s]=o(a[n])),e}},arrow:{order:500,enabled:!0,fn:function(e,r){var a;if(!V(e.instance.modifiers,'arrow','keepTogether'))return e;var p=r.element;if('string'==typeof p){if(p=e.instance.popper.querySelector(p),!p)return e;}else if(!e.instance.popper.contains(p))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var o=e.placement.split('-')[0],i=e.offsets,n=i.popper,s=i.reference,l=-1!==['left','right'].indexOf(o),d=l?'height':'width',c=l?'Top':'Left',m=c.toLowerCase(),f=l?'left':'top',h=l?'bottom':'right',y=C(p)[d];s[h]-y<n[m]&&(e.offsets.popper[m]-=n[m]-(s[h]-y)),s[m]+y>n[h]&&(e.offsets.popper[m]+=s[m]+y-n[h]),e.offsets.popper=b(e.offsets.popper);var u=s[m]+s[d]/2-y/2,g=t(e.instance.popper),x=parseFloat(g['margin'+c],10),w=parseFloat(g['border'+c+'Width'],10),v=u-e.offsets.popper[m]-x-w;return v=Je(Ke(n[d]-y,v),0),e.arrowElement=p,e.offsets.arrow=(a={},gt(a,m,Qe(v)),gt(a,f,''),a),e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(D(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var r=v(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),a=e.placement.split('-')[0],p=L(a),o=e.placement.split('-')[1]||'',i=[];switch(t.behavior){case Et.FLIP:i=[a,p];break;case Et.CLOCKWISE:i=j(a);break;case Et.COUNTERCLOCKWISE:i=j(a,!0);break;default:i=t.behavior;}return i.forEach(function(n,s){if(a!==n||i.length===s+1)return e;a=e.placement.split('-')[0],p=L(a);var l=e.offsets.popper,d=e.offsets.reference,c=Ge,m='left'===a&&c(l.right)>c(d.left)||'right'===a&&c(l.left)<c(d.right)||'top'===a&&c(l.bottom)>c(d.top)||'bottom'===a&&c(l.top)<c(d.bottom),f=c(l.left)<c(r.left),h=c(l.right)>c(r.right),b=c(l.top)<c(r.top),y=c(l.bottom)>c(r.bottom),u='left'===a&&f||'right'===a&&h||'top'===a&&b||'bottom'===a&&y,g=-1!==['top','bottom'].indexOf(a),x=!!t.flipVariations&&(g&&'start'===o&&f||g&&'end'===o&&h||!g&&'start'===o&&b||!g&&'end'===o&&y);(m||u||x)&&(e.flipped=!0,(m||u)&&(a=i[s+1]),x&&(o=q(o)),e.placement=a+(o?'-'+o:''),e.offsets.popper=xt({},e.offsets.popper,T(e.instance.popper,e.offsets.reference,e.placement)),e=Y(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundariesElement:'viewport'},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,r=t.split('-')[0],a=e.offsets,p=a.popper,o=a.reference,i=-1!==['left','right'].indexOf(r),n=-1===['top','left'].indexOf(r);return p[i?'left':'top']=o[r]-(n?p[i?'width':'height']:0),e.placement=L(t),e.offsets.popper=b(p),e}},hide:{order:800,enabled:!0,fn:function(e){if(!V(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,r=S(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottom<r.top||t.left>r.right||t.top>r.bottom||t.right<r.left){if(!0===e.hide)return e;e.hide=!0,e.attributes['x-out-of-boundaries']=''}else{if(!1===e.hide)return e;e.hide=!1,e.attributes['x-out-of-boundaries']=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var r=t.x,a=t.y,p=e.offsets.popper,i=S(e.instance.modifiers,function(e){return'applyStyle'===e.name}).gpuAcceleration;void 0!==i&&console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');var n=void 0===i?t.gpuAcceleration:i,s=o(e.instance.popper),l=u(s),d={position:p.position},c=U(e,2>window.devicePixelRatio||!wt),m='bottom'===r?'top':'bottom',f='right'===a?'left':'right',h=X('transform'),b=void 0,y=void 0;if(y='bottom'==m?'HTML'===s.nodeName?-s.clientHeight+c.bottom:-l.height+c.bottom:c.top,b='right'==f?'HTML'===s.nodeName?-s.clientWidth+c.right:-l.width+c.right:c.left,n&&h)d[h]='translate3d('+b+'px, '+y+'px, 0)',d[m]=0,d[f]=0,d.willChange='transform';else{var g='bottom'==m?-1:1,x='right'==f?-1:1;d[m]=y*g,d[f]=b*x,d.willChange=m+', '+f}var w={"x-placement":e.placement};return e.attributes=xt({},w,e.attributes),e.styles=xt({},d,e.styles),e.arrowStyles=xt({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:'bottom',y:'right'},applyStyle:{order:900,enabled:!0,fn:function(e){return F(e.instance.popper,e.styles),_(e.instance.popper,e.attributes),e.arrowElement&&Object.keys(e.arrowStyles).length&&F(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,r,a,p){var o=O(p,t,e,r.positionFixed),i=E(r.placement,o,t,e,r.modifiers.flip.boundariesElement,r.modifiers.flip.padding);return t.setAttribute('x-placement',i),F(t,{position:r.positionFixed?'fixed':'absolute'}),r},gpuAcceleration:void 0}}};var Ct={POPPER:'.tippy-popper',TOOLTIP:'.tippy-tooltip',CONTENT:'.tippy-content',BACKDROP:'.tippy-backdrop',ARROW:'.tippy-arrow',ROUND_ARROW:'.tippy-roundarrow'},Lt=et?Element.prototype:{},Tt=Lt.matches||Lt.matchesSelector||Lt.webkitMatchesSelector||Lt.mozMatchesSelector||Lt.msMatchesSelector,St={x:!0},At=!1,Yt=0,Pt=Object.keys(nt),Dt=Object.assign||function(e){for(var t,r=1;r<arguments.length;r++)for(var a in t=arguments[r],t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Xt={translate:/translateX?Y?\(([^)]+)\)/,scale:/scaleX?Y?\(([^)]+)\)/},It=1,Nt=!1;je.version=$e,je.defaults=nt,je.one=function(e,t){return je(e,t,!0).instances[0]},je.setDefaults=function(e){Object.keys(e).forEach(function(t){nt[t]=e[t]})},je.disableAnimations=function(){je.setDefaults({duration:0,updateDuration:0,animateFill:!1})},je.hideAllPoppers=ge,je.useCapture=function(){};return et&&setTimeout(function(){J(document.querySelectorAll('[data-tippy]')).forEach(function(e){var t=e.getAttribute('data-tippy');t&&je(e,{content:t})})}),function(e){if(at){var t=document.createElement('style');t.type='text/css',t.textContent=e,document.head.insertBefore(t,document.head.firstChild)}}(Ze),je});
|
2 |
-
//# sourceMappingURL=tippy.all.min.js.map
|
1 |
(function(e,t){'object'==typeof exports&&'undefined'!=typeof module?module.exports=t():'function'==typeof define&&define.amd?define(t):e.tippy=t()})(this,function(){'use strict';function e(e){return e&&'[object Function]'==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var r=e.ownerDocument.defaultView,a=r.getComputedStyle(e,null);return t?a[t]:a}function r(e){return'HTML'===e.nodeName?e:e.parentNode||e.host}function a(e){if(!e)return document.body;switch(e.nodeName){case'HTML':case'BODY':return e.ownerDocument.body;case'#document':return e.body;}var p=t(e),o=p.overflow,i=p.overflowX,n=p.overflowY;return /(auto|scroll|overlay)/.test(o+n+i)?e:a(r(e))}function p(e){return 11===e?ht:10===e?bt:ht||bt}function o(e){if(!e)return document.documentElement;for(var r=p(10)?document.body:null,a=e.offsetParent||null;a===r&&e.nextElementSibling;)a=(e=e.nextElementSibling).offsetParent;var i=a&&a.nodeName;return i&&'BODY'!==i&&'HTML'!==i?-1!==['TH','TD','TABLE'].indexOf(a.nodeName)&&'static'===t(a,'position')?o(a):a:e?e.ownerDocument.documentElement:document.documentElement}function n(e){var t=e.nodeName;return'BODY'!==t&&('HTML'===t||o(e.firstElementChild)===e)}function s(e){return null===e.parentNode?e:s(e.parentNode)}function l(e,t){if(!e||!e.nodeType||!t||!t.nodeType)return document.documentElement;var r=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,a=r?e:t,p=r?t:e,i=document.createRange();i.setStart(a,0),i.setEnd(p,0);var d=i.commonAncestorContainer;if(e!==d&&t!==d||a.contains(p))return n(d)?d:o(d);var c=s(e);return c.host?l(c.host,t):l(e,s(t).host)}function d(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'top',r='top'===t?'scrollTop':'scrollLeft',a=e.nodeName;if('BODY'===a||'HTML'===a){var p=e.ownerDocument.documentElement,o=e.ownerDocument.scrollingElement||p;return o[r]}return e[r]}function c(e,t){var r=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],a=d(t,'top'),p=d(t,'left'),o=r?-1:1;return e.top+=a*o,e.bottom+=a*o,e.left+=p*o,e.right+=p*o,e}function m(e,t){var r='x'===t?'Left':'Top',a='Left'===r?'Right':'Bottom';return parseFloat(e['border'+r+'Width'],10)+parseFloat(e['border'+a+'Width'],10)}function f(e,t,r,a){return Je(t['offset'+e],t['scroll'+e],r['client'+e],r['offset'+e],r['scroll'+e],p(10)?parseInt(r['offset'+e])+parseInt(a['margin'+('Height'===e?'Top':'Left')])+parseInt(a['margin'+('Height'===e?'Bottom':'Right')]):0)}function h(e){var t=e.body,r=e.documentElement,a=p(10)&&getComputedStyle(r);return{height:f('Height',t,r,a),width:f('Width',t,r,a)}}function b(e){return xt({},e,{right:e.left+e.width,bottom:e.top+e.height})}function u(e){var r={};try{if(p(10)){r=e.getBoundingClientRect();var a=d(e,'top'),o=d(e,'left');r.top+=a,r.left+=o,r.bottom+=a,r.right+=o}else r=e.getBoundingClientRect()}catch(t){}var i={left:r.left,top:r.top,width:r.right-r.left,height:r.bottom-r.top},n='HTML'===e.nodeName?h(e.ownerDocument):{},s=n.width||e.clientWidth||i.right-i.left,l=n.height||e.clientHeight||i.bottom-i.top,c=e.offsetWidth-s,f=e.offsetHeight-l;if(c||f){var y=t(e);c-=m(y,'x'),f-=m(y,'y'),i.width-=c,i.height-=f}return b(i)}function y(e,r){var o=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],i=p(10),n='HTML'===r.nodeName,s=u(e),l=u(r),d=a(e),m=t(r),f=parseFloat(m.borderTopWidth,10),h=parseFloat(m.borderLeftWidth,10);o&&n&&(l.top=Je(l.top,0),l.left=Je(l.left,0));var y=b({top:s.top-l.top-f,left:s.left-l.left-h,width:s.width,height:s.height});if(y.marginTop=0,y.marginLeft=0,!i&&n){var g=parseFloat(m.marginTop,10),x=parseFloat(m.marginLeft,10);y.top-=f-g,y.bottom-=f-g,y.left-=h-x,y.right-=h-x,y.marginTop=g,y.marginLeft=x}return(i&&!o?r.contains(d):r===d&&'BODY'!==d.nodeName)&&(y=c(y,r)),y}function g(e){var t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],r=e.ownerDocument.documentElement,a=y(e,r),p=Je(r.clientWidth,window.innerWidth||0),o=Je(r.clientHeight,window.innerHeight||0),i=t?0:d(r),n=t?0:d(r,'left'),s={top:i-a.top+a.marginTop,left:n-a.left+a.marginLeft,width:p,height:o};return b(s)}function x(e){var a=e.nodeName;return'BODY'!==a&&'HTML'!==a&&('fixed'===t(e,'position')||x(r(e)))}function w(e){if(!e||!e.parentElement||p())return document.documentElement;for(var r=e.parentElement;r&&'none'===t(r,'transform');)r=r.parentElement;return r||document.documentElement}function v(e,t,p,o){var i=!!(4<arguments.length&&void 0!==arguments[4])&&arguments[4],n={top:0,left:0},s=i?w(e):l(e,t);if('viewport'===o)n=g(s,i);else{var d;'scrollParent'===o?(d=a(r(t)),'BODY'===d.nodeName&&(d=e.ownerDocument.documentElement)):'window'===o?d=e.ownerDocument.documentElement:d=o;var c=y(d,s,i);if('HTML'===d.nodeName&&!x(s)){var m=h(e.ownerDocument),f=m.height,b=m.width;n.top+=c.top-c.marginTop,n.bottom=f+c.top,n.left+=c.left-c.marginLeft,n.right=b+c.left}else n=c}p=p||0;var u='number'==typeof p;return n.left+=u?p:p.left||0,n.top+=u?p:p.top||0,n.right-=u?p:p.right||0,n.bottom-=u?p:p.bottom||0,n}function k(e){var t=e.width,r=e.height;return t*r}function E(e,t,r,a,p){var o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf('auto'))return e;var i=v(r,a,o,p),n={top:{width:i.width,height:t.top-i.top},right:{width:i.right-t.right,height:i.height},bottom:{width:i.width,height:i.bottom-t.bottom},left:{width:t.left-i.left,height:i.height}},s=Object.keys(n).map(function(e){return xt({key:e},n[e],{area:k(n[e])})}).sort(function(e,t){return t.area-e.area}),l=s.filter(function(e){var t=e.width,a=e.height;return t>=r.clientWidth&&a>=r.clientHeight}),d=0<l.length?l[0].key:s[0].key,c=e.split('-')[1];return d+(c?'-'+c:'')}function O(e,t,r){var a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,p=a?w(t):l(t,r);return y(r,p,a)}function C(e){var t=e.ownerDocument.defaultView,r=t.getComputedStyle(e),a=parseFloat(r.marginTop||0)+parseFloat(r.marginBottom||0),p=parseFloat(r.marginLeft||0)+parseFloat(r.marginRight||0),o={width:e.offsetWidth+p,height:e.offsetHeight+a};return o}function L(e){var t={left:'right',right:'left',bottom:'top',top:'bottom'};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function T(e,t,r){r=r.split('-')[0];var a=C(e),p={width:a.width,height:a.height},o=-1!==['right','left'].indexOf(r),i=o?'top':'left',n=o?'left':'top',s=o?'height':'width',l=o?'width':'height';return p[i]=t[i]+t[s]/2-a[s]/2,p[n]=r===n?t[n]-a[l]:t[L(n)],p}function S(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function A(e,t,r){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===r});var a=S(e,function(e){return e[t]===r});return e.indexOf(a)}function Y(t,r,a){var p=void 0===a?t:t.slice(0,A(t,'name',a));return p.forEach(function(t){t['function']&&console.warn('`modifier.function` is deprecated, use `modifier.fn`!');var a=t['function']||t.fn;t.enabled&&e(a)&&(r.offsets.popper=b(r.offsets.popper),r.offsets.reference=b(r.offsets.reference),r=a(r,t))}),r}function P(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=O(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=E(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=T(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?'fixed':'absolute',e=Y(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function D(e,t){return e.some(function(e){var r=e.name,a=e.enabled;return a&&r===t})}function X(e){for(var t=[!1,'ms','Webkit','Moz','O'],r=e.charAt(0).toUpperCase()+e.slice(1),a=0;a<t.length;a++){var p=t[a],o=p?''+p+r:e;if('undefined'!=typeof document.body.style[o])return o}return null}function I(){return this.state.isDestroyed=!0,D(this.modifiers,'applyStyle')&&(this.popper.removeAttribute('x-placement'),this.popper.style.position='',this.popper.style.top='',this.popper.style.left='',this.popper.style.right='',this.popper.style.bottom='',this.popper.style.willChange='',this.popper.style[X('transform')]=''),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function N(e){var t=e.ownerDocument;return t?t.defaultView:window}function H(e,t,r,p){var o='BODY'===e.nodeName,i=o?e.ownerDocument.defaultView:e;i.addEventListener(t,r,{passive:!0}),o||H(a(i.parentNode),t,r,p),p.push(i)}function W(e,t,r,p){r.updateBound=p,N(e).addEventListener('resize',r.updateBound,{passive:!0});var o=a(e);return H(o,'scroll',r.updateBound,r.scrollParents),r.scrollElement=o,r.eventsEnabled=!0,r}function B(){this.state.eventsEnabled||(this.state=W(this.reference,this.options,this.state,this.scheduleUpdate))}function M(e,t){return N(e).removeEventListener('resize',t.updateBound),t.scrollParents.forEach(function(e){e.removeEventListener('scroll',t.updateBound)}),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t}function R(){this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=M(this.reference,this.state))}function z(e){return''!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function F(e,t){Object.keys(t).forEach(function(r){var a='';-1!==['width','height','top','right','bottom','left'].indexOf(r)&&z(t[r])&&(a='px'),e.style[r]=t[r]+a})}function _(e,t){Object.keys(t).forEach(function(r){var a=t[r];!1===a?e.removeAttribute(r):e.setAttribute(r,t[r])})}function U(e,t){var r=e.offsets,a=r.popper,p=r.reference,o=Qe,i=function(e){return e},n=o(a.width),s=o(p.width),l=-1!==['left','right'].indexOf(e.placement),d=-1!==e.placement.indexOf('-'),c=t?l||d||s%2==n%2?o:Ge:i,m=t?o:i;return{left:c(1==s%2&&1==n%2&&!d&&t?a.left-1:a.left),top:m(a.top),bottom:m(a.bottom),right:c(a.right)}}function V(e,t,r){var a=S(e,function(e){var r=e.name;return r===t}),p=!!a&&e.some(function(e){return e.name===r&&e.enabled&&e.order<a.order});if(!p){var o='`'+t+'`';console.warn('`'+r+'`'+' modifier is required by '+o+' modifier in order to work, be sure to include it before '+o+'!')}return p}function q(e){return'end'===e?'start':'start'===e?'end':e}function j(e){var t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],r=kt.indexOf(e),a=kt.slice(r+1).concat(kt.slice(0,r));return t?a.reverse():a}function K(e,t,r,a){var p=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),o=+p[1],i=p[2];if(!o)return e;if(0===i.indexOf('%')){var n;switch(i){case'%p':n=r;break;case'%':case'%r':default:n=a;}var s=b(n);return s[t]/100*o}if('vh'===i||'vw'===i){var l;return l='vh'===i?Je(document.documentElement.clientHeight,window.innerHeight||0):Je(document.documentElement.clientWidth,window.innerWidth||0),l/100*o}return o}function G(e,t,r,a){var p=[0,0],o=-1!==['right','left'].indexOf(a),i=e.split(/(\+|\-)/).map(function(e){return e.trim()}),n=i.indexOf(S(i,function(e){return-1!==e.search(/,|\s/)}));i[n]&&-1===i[n].indexOf(',')&&console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');var s=/\s*,\s*|\s+/,l=-1===n?[i]:[i.slice(0,n).concat([i[n].split(s)[0]]),[i[n].split(s)[1]].concat(i.slice(n+1))];return l=l.map(function(e,a){var p=(1===a?!o:o)?'height':'width',i=!1;return e.reduce(function(e,t){return''===e[e.length-1]&&-1!==['+','-'].indexOf(t)?(e[e.length-1]=t,i=!0,e):i?(e[e.length-1]+=t,i=!1,e):e.concat(t)},[]).map(function(e){return K(e,p,t,r)})}),l.forEach(function(e,t){e.forEach(function(r,a){z(r)&&(p[t]+=r*('-'===e[a-1]?-1:1))})}),p}function Q(e,t){var r=t.offset,a=e.placement,p=e.offsets,o=p.popper,i=p.reference,n=a.split('-')[0],s=void 0;return s=z(+r)?[+r,0]:G(r,o,i,n),'left'===n?(o.top+=s[0],o.left-=s[1]):'right'===n?(o.top+=s[0],o.left+=s[1]):'top'===n?(o.left+=s[0],o.top-=s[1]):'bottom'===n&&(o.left+=s[0],o.top+=s[1]),e.popper=o,e}function J(e){return[].slice.call(e)}function Z(e,t){return(Lt.closest||function(e){for(var t=this;t;){if(Tt.call(t,e))return t;t=t.parentElement}}).call(e,t)}function $(e,t){for(;e;){if(t(e))return e;e=e.parentElement}}function ee(){return document.createElement('div')}function te(e,t){e[St.x&&'innerHTML']=t instanceof Element?t[St.x&&'innerHTML']:t}function re(e,t){t.content instanceof Element?(te(e,''),e.appendChild(t.content)):e[t.allowHTML?'innerHTML':'textContent']=t.content}function ae(e){return{tooltip:e.querySelector(Ct.TOOLTIP),backdrop:e.querySelector(Ct.BACKDROP),content:e.querySelector(Ct.CONTENT),arrow:e.querySelector(Ct.ARROW)||e.querySelector(Ct.ROUND_ARROW)}}function pe(e){e.setAttribute('data-inertia','')}function oe(e){e.removeAttribute('data-inertia')}function ie(e){var t=ee();return'round'===e?(t.className='tippy-roundarrow',te(t,'<svg viewBox="0 0 24 8" xmlns="http://www.w3.org/2000/svg"><path d="M3 8s2.021-.015 5.253-4.218C9.584 2.051 10.797 1.007 12 1c1.203-.007 2.416 1.035 3.761 2.782C19.012 8.005 21 8 21 8H3z"/></svg>')):t.className='tippy-arrow',t}function ne(){var e=ee();return e.className='tippy-backdrop',e.setAttribute('data-state','hidden'),e}function se(e,t){e.setAttribute('tabindex','-1'),t.setAttribute('data-interactive','')}function le(e,t){e.removeAttribute('tabindex'),t.removeAttribute('data-interactive')}function de(e,t){e.forEach(function(e){e&&(e.style.transitionDuration=t+'ms')})}function ce(e,t,r){e[t+'EventListener']('transitionend',r)}function me(e){var t=e.getAttribute('x-placement');return t?t.split('-')[0]:''}function fe(e,t){e.forEach(function(e){e&&e.setAttribute('data-state',t)})}function he(e){void e.offsetHeight}function be(e,t){var r=ee();r.className='tippy-popper',r.setAttribute('role','tooltip'),r.id='tippy-'+e,r.style.zIndex=t.zIndex;var a=ee();a.className='tippy-tooltip',a.style.maxWidth=t.maxWidth+('number'==typeof t.maxWidth?'px':''),a.setAttribute('data-size',t.size),a.setAttribute('data-animation',t.animation),a.setAttribute('data-state','hidden'),t.theme.split(' ').forEach(function(e){a.classList.add(e+'-theme')});var p=ee();return p.className='tippy-content',p.setAttribute('data-state','hidden'),t.interactive&&se(r,a),t.arrow&&a.appendChild(ie(t.arrowType)),t.animateFill&&(a.appendChild(ne()),a.setAttribute('data-animatefill','')),t.inertia&&pe(a),re(p,t),a.appendChild(p),r.appendChild(a),r.addEventListener('focusout',function(t){t.relatedTarget&&r._tippy&&!$(t.relatedTarget,function(e){return e===r})&&t.relatedTarget!==r._tippy.reference&&r._tippy.props.shouldPopperHideOnBlur(t)&&r._tippy.hide()}),r}function ye(e,t,r){var a=ae(e),p=a.tooltip,o=a.content,i=a.backdrop,n=a.arrow;e.style.zIndex=r.zIndex,p.setAttribute('data-size',r.size),p.setAttribute('data-animation',r.animation),p.style.maxWidth=r.maxWidth+('number'==typeof r.maxWidth?'px':''),t.content!==r.content&&re(o,r),!t.animateFill&&r.animateFill?(p.appendChild(ne()),p.setAttribute('data-animatefill','')):t.animateFill&&!r.animateFill&&(p.removeChild(i),p.removeAttribute('data-animatefill')),!t.arrow&&r.arrow?p.appendChild(ie(r.arrowType)):t.arrow&&!r.arrow&&p.removeChild(n),t.arrow&&r.arrow&&t.arrowType!==r.arrowType&&p.replaceChild(ie(r.arrowType),n),!t.interactive&&r.interactive?se(e,p):t.interactive&&!r.interactive&&le(e,p),!t.inertia&&r.inertia?pe(p):t.inertia&&!r.inertia&&oe(p),t.theme!==r.theme&&(t.theme.split(' ').forEach(function(e){p.classList.remove(e+'-theme')}),r.theme.split(' ').forEach(function(e){p.classList.add(e+'-theme')}))}function ue(e,t){var r=e.popper,a=e.options,p=a.onCreate,o=a.onUpdate;a.onCreate=a.onUpdate=function(){he(r),t(),o(),a.onCreate=p,a.onUpdate=o}}function ge(e){J(document.querySelectorAll(Ct.POPPER)).forEach(function(t){var r=t._tippy;r&&!0===r.props.hideOnClick&&(!e||t!==e.popper)&&r.hide()})}function xe(e,t,r,a){if(!e)return!0;var p=r.clientX,o=r.clientY,i=a.interactiveBorder,n=a.distance,s=t.top-o>('top'===e?i+n:i),l=o-t.bottom>('bottom'===e?i+n:i),d=t.left-p>('left'===e?i+n:i),c=p-t.right>('right'===e?i+n:i);return s||l||d||c}function we(e,t){return-(e-t)+'px'}function ve(){At||(At=!0,ot&&document.body.classList.add('tippy-iOS'),window.performance&&document.addEventListener('mousemove',ke))}function ke(){var e=performance.now();20>e-Yt&&(At=!1,document.removeEventListener('mousemove',ke),!ot&&document.body.classList.remove('tippy-iOS')),Yt=e}function Ee(e){var t=e.target;if(!(t instanceof Element))return ge();var r=Z(t,Ct.POPPER);if(!(r&&r._tippy&&r._tippy.props.interactive)){var a=$(t,function(e){return e._tippy&&e._tippy.reference===e});if(a){var p=a._tippy,o=-1<p.props.trigger.indexOf('click');if(At||o)return ge(p);if(!0!==p.props.hideOnClick||o)return;p.clearDelayTimeouts()}ge()}}function Oe(){var e=document,t=e.activeElement;t&&t.blur&&t._tippy&&t.blur()}function Ce(){J(document.querySelectorAll(Ct.POPPER)).forEach(function(e){var t=e._tippy;t.props.livePlacement||t.popperInstance.scheduleUpdate()})}function Le(){document.addEventListener('click',Ee,!0),document.addEventListener('touchstart',ve,{passive:!0}),window.addEventListener('blur',Oe),window.addEventListener('resize',Ce),!it&&(navigator.maxTouchPoints||navigator.msMaxTouchPoints)&&document.addEventListener('pointerdown',ve)}function Te(e){return'[object Object]'==={}.toString.call(e)}function Se(e,t){return{}.hasOwnProperty.call(e,t)}function Ae(e){return!isNaN(e)&&!isNaN(parseFloat(e))}function Ye(e){if(e instanceof Element||Te(e))return[e];if(e instanceof NodeList)return J(e);if(Array.isArray(e))return e;try{return J(document.querySelectorAll(e))}catch(t){return[]}}function Pe(e,t,r){if(Array.isArray(e)){var a=e[t];return null==a?r:a}return e}function De(e){var t=window.scrollX||window.pageXOffset,r=window.scrollY||window.pageYOffset;e.focus(),scroll(t,r)}function Xe(e){setTimeout(e,1)}function Ie(e,t){var r;return function(){var a=this,p=arguments;clearTimeout(r),r=setTimeout(function(){return e.apply(a,p)},t)}}function Ne(e,t){return e&&e.modifiers&&e.modifiers[t]}function He(e){return!(e instanceof Element)||Tt.call(e,'a[href],area[href],button,details,input,textarea,select,iframe,[tabindex]')&&!e.hasAttribute('disabled')}function We(e){return Pt.reduce(function(t,r){var a=(e.getAttribute('data-tippy-'+r)||'').trim();return a?(t[r]='content'===r?a:'true'===a||'false'!==a&&(Ae(a)?+a:'['===a[0]||'{'===a[0]?JSON.parse(a):a),t):t},{})}function Be(e){var t={isVirtual:!0,attributes:e.attributes||{},setAttribute:function(t,r){e.attributes[t]=r},getAttribute:function(t){return e.attributes[t]},removeAttribute:function(t){delete e.attributes[t]},hasAttribute:function(t){return t in e.attributes},addEventListener:function(){},removeEventListener:function(){},classList:{classNames:{},add:function(t){e.classList.classNames[t]=!0},remove:function(t){delete e.classList.classNames[t]},contains:function(t){return t in e.classList.classNames}}};for(var r in t)e[r]=t[r]}function Me(e,t){var r=Dt({},t,t.performance?{}:We(e));return r.arrow&&(r.animateFill=!1),'function'==typeof r.appendTo&&(r.appendTo=t.appendTo(e)),'function'==typeof r.content&&(r.content=t.content(e)),r}function Re(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];Object.keys(e).forEach(function(e){if(!Se(t,e))throw new Error('[tippy]: `'+e+'` is not a valid option')})}function ze(e,t){return(t?e:{X:'Y',Y:'X'}[e])||''}function Fe(e,t,r,p){var o=t[0],i=t[1];if(!o&&!i)return'';var n={scale:function(){return i?r?o+', '+i:i+', '+o:''+o}(),translate:function(){return i?r?p?o+'px, '+-i+'px':o+'px, '+i+'px':p?-i+'px, '+o+'px':i+'px, '+o+'px':p?-o+'px':o+'px'}()};return n[e]}function _e(e,t){var r=e.match(new RegExp(t+'([XY])'));return r?r[1]:''}function Ue(e,t){var r=e.match(t);return r?r[1].split(',').map(function(e){return parseFloat(e,10)}):[]}function Ve(e,t){var r=me(Z(e,Ct.POPPER)),a='top'===r||'bottom'===r,p='right'===r||'bottom'===r,o={translate:{axis:_e(t,'translate'),numbers:Ue(t,Xt.translate)},scale:{axis:_e(t,'scale'),numbers:Ue(t,Xt.scale)}},i=t.replace(Xt.translate,'translate'+ze(o.translate.axis,a)+'('+Fe('translate',o.translate.numbers,a,p)+')').replace(Xt.scale,'scale'+ze(o.scale.axis,a)+'('+Fe('scale',o.scale.numbers,a,p)+')');e.style['undefined'==typeof document.body.style.transform?'webkitTransform':'transform']=i}function qe(e,t){function r(){Xe(function(){z=!1})}function a(){X=new MutationObserver(function(){q.popperInstance.update()}),X.observe(U,{childList:!0,subtree:!0,characterData:!0})}function p(e){var t=N=e,r=t.clientX,a=t.clientY;if(q.popperInstance){var p=me(q.popper),o=q.popperChildren.arrow?20:5,i='top'===p||'bottom'===p,n='left'===p||'right'===p,l=i?Je(o,r):r,d=n?Je(o,a):a;i&&l>o&&(l=Ke(r,window.innerWidth-o)),n&&d>o&&(d=Ke(a,window.innerHeight-o));var c=q.reference.getBoundingClientRect(),m=q.props.followCursor,f='horizontal'===m,h='vertical'===m;q.popperInstance.reference={getBoundingClientRect:function(){return{width:0,height:0,top:f?c.top:d,bottom:f?c.bottom:d,left:h?c.left:l,right:h?c.right:l}},clientWidth:0,clientHeight:0},q.popperInstance.scheduleUpdate(),'initial'===m&&q.state.isVisible&&s()}}function o(e){var t=Z(e.target,q.props.target);t&&!t._tippy&&(qe(t,Dt({},q.props,{target:'',showOnInit:!0})),i(e))}function i(e){if(T(),!q.state.isVisible){if(q.props.target)return o(e);if(B=!0,q.props.wait)return q.props.wait(q,e);x()&&document.addEventListener('mousemove',p);var t=Pe(q.props.delay,0,nt.delay);t?H=setTimeout(function(){A()},t):A()}}function n(){if(T(),!q.state.isVisible)return s();B=!1;var e=Pe(q.props.delay,1,nt.delay);e?W=setTimeout(function(){q.state.isVisible&&Y()},e):Y()}function s(){document.removeEventListener('mousemove',p),N=null}function l(){document.body.removeEventListener('mouseleave',n),document.removeEventListener('mousemove',F)}function d(e){!q.state.isEnabled||y(e)||(!q.state.isVisible&&(I=e),'click'===e.type&&!1!==q.props.hideOnClick&&q.state.isVisible?n():i(e))}function c(e){var t=$(e.target,function(e){return e._tippy}),r=Z(e.target,Ct.POPPER)===q.popper,a=t===q.reference;r||a||xe(me(q.popper),q.popper.getBoundingClientRect(),e,q.props)&&(l(),n())}function m(e){return y(e)?void 0:q.props.interactive?(document.body.addEventListener('mouseleave',n),void document.addEventListener('mousemove',F)):void n()}function f(e){if(e.target===q.reference){if(q.props.interactive){if(!e.relatedTarget)return;if(Z(e.relatedTarget,Ct.POPPER))return}n()}}function h(e){Z(e.target,q.props.target)&&i(e)}function b(e){Z(e.target,q.props.target)&&n()}function y(e){var t=-1<e.type.indexOf('touch'),r=it&&At&&q.props.touchHold&&!t,a=At&&!q.props.touchHold&&t;return r||a}function u(){var e=q.props.popperOptions,t=q.popperChildren,r=t.tooltip,a=t.arrow;return new Ot(q.reference,q.popper,Dt({placement:q.props.placement},e,{modifiers:Dt({},e?e.modifiers:{},{preventOverflow:Dt({boundariesElement:q.props.boundary},Ne(e,'preventOverflow')),arrow:Dt({element:a,enabled:!!a},Ne(e,'arrow')),flip:Dt({enabled:q.props.flip,padding:q.props.distance+5,behavior:q.props.flipBehavior},Ne(e,'flip')),offset:Dt({offset:q.props.offset},Ne(e,'offset'))}),onCreate:function(){r.style[me(q.popper)]=we(q.props.distance,nt.distance),a&&q.props.arrowTransform&&Ve(a,q.props.arrowTransform)},onUpdate:function(){var e=r.style;e.top='',e.bottom='',e.left='',e.right='',e[me(q.popper)]=we(q.props.distance,nt.distance),a&&q.props.arrowTransform&&Ve(a,q.props.arrowTransform)}}))}function g(e){q.popperInstance?!x()&&(q.popperInstance.scheduleUpdate(),q.props.livePlacement&&q.popperInstance.enableEventListeners()):(q.popperInstance=u(),a(),(!q.props.livePlacement||x())&&q.popperInstance.disableEventListeners()),q.popperInstance.reference=q.reference;var t=q.popperChildren.arrow;if(x()){t&&(t.style.margin='0');var r=Pe(q.props.delay,0,nt.delay);I.type&&p(r&&N?N:I)}else t&&(t.style.margin='');ue(q.popperInstance,e),q.props.appendTo.contains(q.popper)||(q.props.appendTo.appendChild(q.popper),q.props.onMount(q),q.state.isMounted=!0)}function x(){return q.props.followCursor&&!At&&'focus'!==I.type}function w(){de([q.popper],pt?0:q.props.updateDuration);(function e(){q.popperInstance&&q.popperInstance.scheduleUpdate(),q.state.isMounted?requestAnimationFrame(e):de([q.popper],0)})()}function v(e,t){E(e,function(){!q.state.isVisible&&q.props.appendTo.contains(q.popper)&&t()})}function k(e,t){E(e,t)}function E(e,t){if(0===e)return t();var r=q.popperChildren.tooltip,a=function a(p){p.target===r&&(ce(r,'remove',a),t())};ce(r,'remove',M),ce(r,'add',a),M=a}function O(e,t,r){q.reference.addEventListener(e,t),r.push({eventType:e,handler:t})}function C(){R=q.props.trigger.trim().split(' ').reduce(function(e,t){return'manual'===t?e:(q.props.target?'mouseenter'===t?(O('mouseover',h,e),O('mouseout',b,e)):'focus'===t?(O('focusin',h,e),O('focusout',b,e)):'click'===t?O(t,h,e):void 0:(O(t,d,e),q.props.touchHold&&(O('touchstart',d,e),O('touchend',m,e)),'mouseenter'===t?O('mouseleave',m,e):'focus'===t?O(pt?'focusout':'blur',f,e):void 0),e)},[])}function L(){R.forEach(function(e){var t=e.eventType,r=e.handler;q.reference.removeEventListener(t,r)})}function T(){clearTimeout(H),clearTimeout(W)}function S(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};Re(e,nt);var t=q.props,r=Me(q.reference,Dt({},q.props,e,{performance:!0}));r.performance=Se(e,'performance')?e.performance:t.performance,q.props=r,(Se(e,'trigger')||Se(e,'touchHold'))&&(L(),C()),Se(e,'interactiveDebounce')&&(l(),F=Ie(c,e.interactiveDebounce)),ye(q.popper,t,r),q.popperChildren=ae(q.popper),q.popperInstance&&st.some(function(t){return Se(e,t)})&&(q.popperInstance.destroy(),q.popperInstance=u(),!q.state.isVisible&&q.popperInstance.disableEventListeners(),q.props.followCursor&&N&&p(N))}function A(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Pe(q.props.duration,0,nt.duration[0]);return q.state.isDestroyed||!q.state.isEnabled||At&&!q.props.touch?void 0:q.reference.isVirtual||document.documentElement.contains(q.reference)?q.reference.hasAttribute('disabled')?void 0:z?void(z=!1):void(!1===q.props.onShow(q)||(q.popper.style.visibility='visible',q.state.isVisible=!0,de([q.popper,q.popperChildren.tooltip,q.popperChildren.backdrop],0),g(function(){q.state.isVisible&&(!x()&&q.popperInstance.update(),de([q.popperChildren.tooltip,q.popperChildren.backdrop,q.popperChildren.content],e),q.popperChildren.backdrop&&(q.popperChildren.content.style.transitionDelay=Qe(e/6)+'ms'),q.props.interactive&&q.reference.classList.add('tippy-active'),q.props.sticky&&w(),fe([q.popperChildren.tooltip,q.popperChildren.backdrop,q.popperChildren.content],'visible'),k(e,function(){0===q.props.updateDuration&&q.popperChildren.tooltip.classList.add('tippy-notransition'),q.props.autoFocus&&q.props.interactive&&-1<['focus','click'].indexOf(I.type)&&De(q.popper),q.reference.setAttribute('aria-'+q.props.aria,q.popper.id),q.props.onShown(q),q.state.isShown=!0}))}))):P()}function Y(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:Pe(q.props.duration,1,nt.duration[1]);q.state.isDestroyed||!q.state.isEnabled||!1===q.props.onHide(q)||(0===q.props.updateDuration&&q.popperChildren.tooltip.classList.remove('tippy-notransition'),q.props.interactive&&q.reference.classList.remove('tippy-active'),q.popper.style.visibility='hidden',q.state.isVisible=!1,q.state.isShown=!1,de([q.popperChildren.tooltip,q.popperChildren.backdrop,q.popperChildren.content],e),fe([q.popperChildren.tooltip,q.popperChildren.backdrop,q.popperChildren.content],'hidden'),q.props.autoFocus&&q.props.interactive&&!z&&-1<['focus','click'].indexOf(I.type)&&('focus'===I.type&&(z=!0),De(q.reference)),v(e,function(){B||s(),q.reference.removeAttribute('aria-'+q.props.aria),q.popperInstance.disableEventListeners(),q.props.appendTo.removeChild(q.popper),q.state.isMounted=!1,q.props.onHidden(q)}))}function P(e){q.state.isDestroyed||(q.state.isMounted&&Y(0),L(),q.reference.removeEventListener('click',r),delete q.reference._tippy,q.props.target&&e&&J(q.reference.querySelectorAll(q.props.target)).forEach(function(e){return e._tippy&&e._tippy.destroy()}),q.popperInstance&&q.popperInstance.destroy(),X&&X.disconnect(),q.state.isDestroyed=!0)}var D=Me(e,t);if(!D.multiple&&e._tippy)return null;var X=null,I={},N=null,H=0,W=0,B=!1,M=function(){},R=[],z=!1,F=0<D.interactiveDebounce?Ie(c,D.interactiveDebounce):c,_=It++,U=be(_,D);U.addEventListener('mouseenter',function(e){q.props.interactive&&q.state.isVisible&&'mouseenter'===I.type&&i(e)}),U.addEventListener('mouseleave',function(e){q.props.interactive&&'mouseenter'===I.type&&0===q.props.interactiveDebounce&&xe(me(U),U.getBoundingClientRect(),e,q.props)&&n()});var V=ae(U),q={id:_,reference:e,popper:U,popperChildren:V,popperInstance:null,props:D,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},clearDelayTimeouts:T,set:S,setContent:function(e){S({content:e})},show:A,hide:Y,enable:function(){q.state.isEnabled=!0},disable:function(){q.state.isEnabled=!1},destroy:P};return C(),e.addEventListener('click',r),D.lazy||(q.popperInstance=u(),q.popperInstance.disableEventListeners()),D.showOnInit&&i(),!D.a11y||D.target||He(e)||e.setAttribute('tabindex','0'),e._tippy=q,U._tippy=q,q}function je(e,t,r){Re(t,nt),Nt||(Le(),Nt=!0);var a=Dt({},nt,t);Te(e)&&Be(e);var p=Ye(e),o=p[0],i=(r&&o?[o]:p).reduce(function(e,t){var r=t&&qe(t,a);return r&&e.push(r),e},[]),n={targets:e,props:a,instances:i,destroyAll:function(){n.instances.forEach(function(e){e.destroy()}),n.instances=[]}};return n}for(var Ke=Math.min,Ge=Math.floor,Qe=Math.round,Je=Math.max,Ze='.tippy-iOS{cursor:pointer!important}.tippy-notransition{transition:none!important}.tippy-popper{-webkit-perspective:700px;perspective:700px;z-index:9999;outline:0;transition-timing-function:cubic-bezier(.165,.84,.44,1);pointer-events:none;line-height:1.4;max-width:calc(100% - 10px)}.tippy-popper[x-placement^=top] .tippy-backdrop{border-radius:40% 40% 0 0}.tippy-popper[x-placement^=top] .tippy-roundarrow{bottom:-8px;-webkit-transform-origin:50% 0;transform-origin:50% 0}.tippy-popper[x-placement^=top] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.tippy-popper[x-placement^=top] .tippy-arrow{border-top:8px solid #333;border-right:8px solid transparent;border-left:8px solid transparent;bottom:-7px;margin:0 6px;-webkit-transform-origin:50% 0;transform-origin:50% 0}.tippy-popper[x-placement^=top] .tippy-backdrop{-webkit-transform-origin:0 25%;transform-origin:0 25%}.tippy-popper[x-placement^=top] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-55%);transform:scale(1) translate(-50%,-55%)}.tippy-popper[x-placement^=top] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-50%,-45%);transform:scale(.2) translate(-50%,-45%);opacity:0}.tippy-popper[x-placement^=top] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateY(-20px);transform:translateY(-20px)}.tippy-popper[x-placement^=top] [data-animation=perspective]{-webkit-transform-origin:bottom;transform-origin:bottom}.tippy-popper[x-placement^=top] [data-animation=perspective][data-state=visible]{-webkit-transform:translateY(-10px) rotateX(0);transform:translateY(-10px) rotateX(0)}.tippy-popper[x-placement^=top] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:translateY(0) rotateX(60deg);transform:translateY(0) rotateX(60deg)}.tippy-popper[x-placement^=top] [data-animation=fade][data-state=visible]{-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateY(0);transform:translateY(0)}.tippy-popper[x-placement^=top] [data-animation=scale][data-state=visible]{-webkit-transform:translateY(-10px) scale(1);transform:translateY(-10px) scale(1)}.tippy-popper[x-placement^=top] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateY(0) scale(.5);transform:translateY(0) scale(.5)}.tippy-popper[x-placement^=bottom] .tippy-backdrop{border-radius:0 0 30% 30%}.tippy-popper[x-placement^=bottom] .tippy-roundarrow{top:-8px;-webkit-transform-origin:50% 100%;transform-origin:50% 100%}.tippy-popper[x-placement^=bottom] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(0);transform:rotate(0)}.tippy-popper[x-placement^=bottom] .tippy-arrow{border-bottom:8px solid #333;border-right:8px solid transparent;border-left:8px solid transparent;top:-7px;margin:0 6px;-webkit-transform-origin:50% 100%;transform-origin:50% 100%}.tippy-popper[x-placement^=bottom] .tippy-backdrop{-webkit-transform-origin:0 -50%;transform-origin:0 -50%}.tippy-popper[x-placement^=bottom] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-45%);transform:scale(1) translate(-50%,-45%)}.tippy-popper[x-placement^=bottom] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-50%);transform:scale(.2) translate(-50%);opacity:0}.tippy-popper[x-placement^=bottom] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateY(20px);transform:translateY(20px)}.tippy-popper[x-placement^=bottom] [data-animation=perspective]{-webkit-transform-origin:top;transform-origin:top}.tippy-popper[x-placement^=bottom] [data-animation=perspective][data-state=visible]{-webkit-transform:translateY(10px) rotateX(0);transform:translateY(10px) rotateX(0)}.tippy-popper[x-placement^=bottom] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:translateY(0) rotateX(-60deg);transform:translateY(0) rotateX(-60deg)}.tippy-popper[x-placement^=bottom] [data-animation=fade][data-state=visible]{-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateY(0);transform:translateY(0)}.tippy-popper[x-placement^=bottom] [data-animation=scale][data-state=visible]{-webkit-transform:translateY(10px) scale(1);transform:translateY(10px) scale(1)}.tippy-popper[x-placement^=bottom] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateY(0) scale(.5);transform:translateY(0) scale(.5)}.tippy-popper[x-placement^=left] .tippy-backdrop{border-radius:50% 0 0 50%}.tippy-popper[x-placement^=left] .tippy-roundarrow{right:-16px;-webkit-transform-origin:33.33333333% 50%;transform-origin:33.33333333% 50%}.tippy-popper[x-placement^=left] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.tippy-popper[x-placement^=left] .tippy-arrow{border-left:8px solid #333;border-top:8px solid transparent;border-bottom:8px solid transparent;right:-7px;margin:3px 0;-webkit-transform-origin:0 50%;transform-origin:0 50%}.tippy-popper[x-placement^=left] .tippy-backdrop{-webkit-transform-origin:50% 0;transform-origin:50% 0}.tippy-popper[x-placement^=left] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-50%);transform:scale(1) translate(-50%,-50%)}.tippy-popper[x-placement^=left] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-75%,-50%);transform:scale(.2) translate(-75%,-50%);opacity:0}.tippy-popper[x-placement^=left] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateX(-20px);transform:translateX(-20px)}.tippy-popper[x-placement^=left] [data-animation=perspective]{-webkit-transform-origin:right;transform-origin:right}.tippy-popper[x-placement^=left] [data-animation=perspective][data-state=visible]{-webkit-transform:translateX(-10px) rotateY(0);transform:translateX(-10px) rotateY(0)}.tippy-popper[x-placement^=left] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:translateX(0) rotateY(-60deg);transform:translateX(0) rotateY(-60deg)}.tippy-popper[x-placement^=left] [data-animation=fade][data-state=visible]{-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateX(0);transform:translateX(0)}.tippy-popper[x-placement^=left] [data-animation=scale][data-state=visible]{-webkit-transform:translateX(-10px) scale(1);transform:translateX(-10px) scale(1)}.tippy-popper[x-placement^=left] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateX(0) scale(.5);transform:translateX(0) scale(.5)}.tippy-popper[x-placement^=right] .tippy-backdrop{border-radius:0 50% 50% 0}.tippy-popper[x-placement^=right] .tippy-roundarrow{left:-16px;-webkit-transform-origin:66.66666666% 50%;transform-origin:66.66666666% 50%}.tippy-popper[x-placement^=right] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.tippy-popper[x-placement^=right] .tippy-arrow{border-right:8px solid #333;border-top:8px solid transparent;border-bottom:8px solid transparent;left:-7px;margin:3px 0;-webkit-transform-origin:100% 50%;transform-origin:100% 50%}.tippy-popper[x-placement^=right] .tippy-backdrop{-webkit-transform-origin:-50% 0;transform-origin:-50% 0}.tippy-popper[x-placement^=right] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-50%);transform:scale(1) translate(-50%,-50%)}.tippy-popper[x-placement^=right] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-25%,-50%);transform:scale(.2) translate(-25%,-50%);opacity:0}.tippy-popper[x-placement^=right] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateX(20px);transform:translateX(20px)}.tippy-popper[x-placement^=right] [data-animation=perspective]{-webkit-transform-origin:left;transform-origin:left}.tippy-popper[x-placement^=right] [data-animation=perspective][data-state=visible]{-webkit-transform:translateX(10px) rotateY(0);transform:translateX(10px) rotateY(0)}.tippy-popper[x-placement^=right] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:translateX(0) rotateY(60deg);transform:translateX(0) rotateY(60deg)}.tippy-popper[x-placement^=right] [data-animation=fade][data-state=visible]{-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateX(0);transform:translateX(0)}.tippy-popper[x-placement^=right] [data-animation=scale][data-state=visible]{-webkit-transform:translateX(10px) scale(1);transform:translateX(10px) scale(1)}.tippy-popper[x-placement^=right] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateX(0) scale(.5);transform:translateX(0) scale(.5)}.tippy-tooltip{position:relative;color:#fff;border-radius:4px;font-size:.9rem;padding:.3rem .6rem;max-width:350px;text-align:center;will-change:transform;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#333}.tippy-tooltip[data-size=small]{padding:.2rem .4rem;font-size:.75rem}.tippy-tooltip[data-size=large]{padding:.4rem .8rem;font-size:1rem}.tippy-tooltip[data-animatefill]{overflow:hidden;background-color:transparent}.tippy-tooltip[data-interactive],.tippy-tooltip[data-interactive] path{pointer-events:auto}.tippy-tooltip[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.53,2,.36,.85)}.tippy-tooltip[data-inertia][data-state=hidden]{transition-timing-function:ease}.tippy-arrow,.tippy-roundarrow{position:absolute;width:0;height:0}.tippy-roundarrow{width:24px;height:8px;fill:#333;pointer-events:none}.tippy-backdrop{position:absolute;will-change:transform;background-color:#333;border-radius:50%;width:calc(110% + 2rem);left:50%;top:50%;z-index:-1;transition:all cubic-bezier(.46,.1,.52,.98);-webkit-backface-visibility:hidden;backface-visibility:hidden}.tippy-backdrop:after{content:"";float:left;padding-top:100%}.tippy-backdrop+.tippy-content{transition-property:opacity;will-change:opacity}.tippy-backdrop+.tippy-content[data-state=visible]{opacity:1}.tippy-backdrop+.tippy-content[data-state=hidden]{opacity:0}',$e='3.4.0',et='undefined'!=typeof window,tt=et?navigator:{},rt=et?window:{},at=('MutationObserver'in rt),pt=/MSIE |Trident\//.test(tt.userAgent),ot=/iPhone|iPad|iPod/.test(tt.platform)&&!rt.MSStream,it=('ontouchstart'in rt),nt={a11y:!0,allowHTML:!0,animateFill:!0,animation:'shift-away',appendTo:function(){return document.body},aria:'describedby',arrow:!1,arrowTransform:'',arrowType:'sharp',autoFocus:!0,boundary:'scrollParent',content:'',delay:[0,20],distance:10,duration:[325,275],flip:!0,flipBehavior:'flip',followCursor:!1,hideOnClick:!0,inertia:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,lazy:!0,livePlacement:!0,maxWidth:'',multiple:!1,offset:0,onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},performance:!1,placement:'top',popperOptions:{},shouldPopperHideOnBlur:function(){return!0},showOnInit:!1,size:'regular',sticky:!1,target:'',theme:'dark',touch:!0,touchHold:!1,trigger:'mouseenter focus',updateDuration:200,wait:null,zIndex:9999},st=['arrow','arrowType','distance','flip','flipBehavior','offset','placement','popperOptions'],lt='undefined'!=typeof window&&'undefined'!=typeof document,dt=['Edge','Trident','Firefox'],ct=0,mt=0;mt<dt.length;mt+=1)if(lt&&0<=navigator.userAgent.indexOf(dt[mt])){ct=1;break}var i=lt&&window.Promise,ft=i?function(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then(function(){t=!1,e()}))}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},ct))}},ht=lt&&!!(window.MSInputMethodContext&&document.documentMode),bt=lt&&/MSIE 10/.test(navigator.userAgent),yt=function(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')},ut=function(){function e(e,t){for(var r,a=0;a<t.length;a++)r=t[a],r.enumerable=r.enumerable||!1,r.configurable=!0,'value'in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),gt=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},xt=Object.assign||function(e){for(var t,r=1;r<arguments.length;r++)for(var a in t=arguments[r],t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},wt=lt&&/Firefox/i.test(navigator.userAgent),vt=['auto-start','auto','auto-end','top-start','top','top-end','right-start','right','right-end','bottom-end','bottom','bottom-start','left-end','left','left-start'],kt=vt.slice(3),Et={FLIP:'flip',CLOCKWISE:'clockwise',COUNTERCLOCKWISE:'counterclockwise'},Ot=function(){function t(r,a){var p=this,o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};yt(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(p.update)},this.update=ft(this.update.bind(this)),this.options=xt({},t.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=r&&r.jquery?r[0]:r,this.popper=a&&a.jquery?a[0]:a,this.options.modifiers={},Object.keys(xt({},t.Defaults.modifiers,o.modifiers)).forEach(function(e){p.options.modifiers[e]=xt({},t.Defaults.modifiers[e]||{},o.modifiers?o.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return xt({name:e},p.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(t){t.enabled&&e(t.onLoad)&&t.onLoad(p.reference,p.popper,p.options,t,p.state)}),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return ut(t,[{key:'update',value:function(){return P.call(this)}},{key:'destroy',value:function(){return I.call(this)}},{key:'enableEventListeners',value:function(){return B.call(this)}},{key:'disableEventListeners',value:function(){return R.call(this)}}]),t}();Ot.Utils=('undefined'==typeof window?global:window).PopperUtils,Ot.placements=vt,Ot.Defaults={placement:'bottom',positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,r=t.split('-')[0],a=t.split('-')[1];if(a){var p=e.offsets,o=p.reference,i=p.popper,n=-1!==['bottom','top'].indexOf(r),s=n?'left':'top',l=n?'width':'height',d={start:gt({},s,o[s]),end:gt({},s,o[s]+o[l]-i[l])};e.offsets.popper=xt({},i,d[a])}return e}},offset:{order:200,enabled:!0,fn:Q,offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,t){var r=t.boundariesElement||o(e.instance.popper);e.instance.reference===r&&(r=o(r));var a=X('transform'),p=e.instance.popper.style,i=p.top,n=p.left,s=p[a];p.top='',p.left='',p[a]='';var l=v(e.instance.popper,e.instance.reference,t.padding,r,e.positionFixed);p.top=i,p.left=n,p[a]=s,t.boundaries=l;var d=t.priority,c=e.offsets.popper,m={primary:function(e){var r=c[e];return c[e]<l[e]&&!t.escapeWithReference&&(r=Je(c[e],l[e])),gt({},e,r)},secondary:function(e){var r='right'===e?'left':'top',a=c[r];return c[e]>l[e]&&!t.escapeWithReference&&(a=Ke(c[r],l[e]-('right'===e?c.width:c.height))),gt({},r,a)}};return d.forEach(function(e){var t=-1===['left','top'].indexOf(e)?'secondary':'primary';c=xt({},c,m[t](e))}),e.offsets.popper=c,e},priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,r=t.popper,a=t.reference,p=e.placement.split('-')[0],o=Ge,i=-1!==['top','bottom'].indexOf(p),n=i?'right':'bottom',s=i?'left':'top',l=i?'width':'height';return r[n]<o(a[s])&&(e.offsets.popper[s]=o(a[s])-r[l]),r[s]>o(a[n])&&(e.offsets.popper[s]=o(a[n])),e}},arrow:{order:500,enabled:!0,fn:function(e,r){var a;if(!V(e.instance.modifiers,'arrow','keepTogether'))return e;var p=r.element;if('string'==typeof p){if(p=e.instance.popper.querySelector(p),!p)return e;}else if(!e.instance.popper.contains(p))return console.warn('WARNING: `arrow.element` must be child of its popper element!'),e;var o=e.placement.split('-')[0],i=e.offsets,n=i.popper,s=i.reference,l=-1!==['left','right'].indexOf(o),d=l?'height':'width',c=l?'Top':'Left',m=c.toLowerCase(),f=l?'left':'top',h=l?'bottom':'right',y=C(p)[d];s[h]-y<n[m]&&(e.offsets.popper[m]-=n[m]-(s[h]-y)),s[m]+y>n[h]&&(e.offsets.popper[m]+=s[m]+y-n[h]),e.offsets.popper=b(e.offsets.popper);var u=s[m]+s[d]/2-y/2,g=t(e.instance.popper),x=parseFloat(g['margin'+c],10),w=parseFloat(g['border'+c+'Width'],10),v=u-e.offsets.popper[m]-x-w;return v=Je(Ke(n[d]-y,v),0),e.arrowElement=p,e.offsets.arrow=(a={},gt(a,m,Qe(v)),gt(a,f,''),a),e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(D(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var r=v(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),a=e.placement.split('-')[0],p=L(a),o=e.placement.split('-')[1]||'',i=[];switch(t.behavior){case Et.FLIP:i=[a,p];break;case Et.CLOCKWISE:i=j(a);break;case Et.COUNTERCLOCKWISE:i=j(a,!0);break;default:i=t.behavior;}return i.forEach(function(n,s){if(a!==n||i.length===s+1)return e;a=e.placement.split('-')[0],p=L(a);var l=e.offsets.popper,d=e.offsets.reference,c=Ge,m='left'===a&&c(l.right)>c(d.left)||'right'===a&&c(l.left)<c(d.right)||'top'===a&&c(l.bottom)>c(d.top)||'bottom'===a&&c(l.top)<c(d.bottom),f=c(l.left)<c(r.left),h=c(l.right)>c(r.right),b=c(l.top)<c(r.top),y=c(l.bottom)>c(r.bottom),u='left'===a&&f||'right'===a&&h||'top'===a&&b||'bottom'===a&&y,g=-1!==['top','bottom'].indexOf(a),x=!!t.flipVariations&&(g&&'start'===o&&f||g&&'end'===o&&h||!g&&'start'===o&&b||!g&&'end'===o&&y);(m||u||x)&&(e.flipped=!0,(m||u)&&(a=i[s+1]),x&&(o=q(o)),e.placement=a+(o?'-'+o:''),e.offsets.popper=xt({},e.offsets.popper,T(e.instance.popper,e.offsets.reference,e.placement)),e=Y(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundariesElement:'viewport'},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,r=t.split('-')[0],a=e.offsets,p=a.popper,o=a.reference,i=-1!==['left','right'].indexOf(r),n=-1===['top','left'].indexOf(r);return p[i?'left':'top']=o[r]-(n?p[i?'width':'height']:0),e.placement=L(t),e.offsets.popper=b(p),e}},hide:{order:800,enabled:!0,fn:function(e){if(!V(e.instance.modifiers,'hide','preventOverflow'))return e;var t=e.offsets.reference,r=S(e.instance.modifiers,function(e){return'preventOverflow'===e.name}).boundaries;if(t.bottom<r.top||t.left>r.right||t.top>r.bottom||t.right<r.left){if(!0===e.hide)return e;e.hide=!0,e.attributes['x-out-of-boundaries']=''}else{if(!1===e.hide)return e;e.hide=!1,e.attributes['x-out-of-boundaries']=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var r=t.x,a=t.y,p=e.offsets.popper,i=S(e.instance.modifiers,function(e){return'applyStyle'===e.name}).gpuAcceleration;void 0!==i&&console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');var n=void 0===i?t.gpuAcceleration:i,s=o(e.instance.popper),l=u(s),d={position:p.position},c=U(e,2>window.devicePixelRatio||!wt),m='bottom'===r?'top':'bottom',f='right'===a?'left':'right',h=X('transform'),b=void 0,y=void 0;if(y='bottom'==m?'HTML'===s.nodeName?-s.clientHeight+c.bottom:-l.height+c.bottom:c.top,b='right'==f?'HTML'===s.nodeName?-s.clientWidth+c.right:-l.width+c.right:c.left,n&&h)d[h]='translate3d('+b+'px, '+y+'px, 0)',d[m]=0,d[f]=0,d.willChange='transform';else{var g='bottom'==m?-1:1,x='right'==f?-1:1;d[m]=y*g,d[f]=b*x,d.willChange=m+', '+f}var w={"x-placement":e.placement};return e.attributes=xt({},w,e.attributes),e.styles=xt({},d,e.styles),e.arrowStyles=xt({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:'bottom',y:'right'},applyStyle:{order:900,enabled:!0,fn:function(e){return F(e.instance.popper,e.styles),_(e.instance.popper,e.attributes),e.arrowElement&&Object.keys(e.arrowStyles).length&&F(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,r,a,p){var o=O(p,t,e,r.positionFixed),i=E(r.placement,o,t,e,r.modifiers.flip.boundariesElement,r.modifiers.flip.padding);return t.setAttribute('x-placement',i),F(t,{position:r.positionFixed?'fixed':'absolute'}),r},gpuAcceleration:void 0}}};var Ct={POPPER:'.tippy-popper',TOOLTIP:'.tippy-tooltip',CONTENT:'.tippy-content',BACKDROP:'.tippy-backdrop',ARROW:'.tippy-arrow',ROUND_ARROW:'.tippy-roundarrow'},Lt=et?Element.prototype:{},Tt=Lt.matches||Lt.matchesSelector||Lt.webkitMatchesSelector||Lt.mozMatchesSelector||Lt.msMatchesSelector,St={x:!0},At=!1,Yt=0,Pt=Object.keys(nt),Dt=Object.assign||function(e){for(var t,r=1;r<arguments.length;r++)for(var a in t=arguments[r],t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Xt={translate:/translateX?Y?\(([^)]+)\)/,scale:/scaleX?Y?\(([^)]+)\)/},It=1,Nt=!1;je.version=$e,je.defaults=nt,je.one=function(e,t){return je(e,t,!0).instances[0]},je.setDefaults=function(e){Object.keys(e).forEach(function(t){nt[t]=e[t]})},je.disableAnimations=function(){je.setDefaults({duration:0,updateDuration:0,animateFill:!1})},je.hideAllPoppers=ge,je.useCapture=function(){};return et&&setTimeout(function(){J(document.querySelectorAll('[data-tippy]')).forEach(function(e){var t=e.getAttribute('data-tippy');t&&je(e,{content:t})})}),function(e){if(at){var t=document.createElement('style');t.type='text/css',t.textContent=e,document.head.insertBefore(t,document.head.firstChild)}}(Ze),je});
|
|
js/yasr-admin.js
CHANGED
@@ -23,142 +23,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
23 |
|
24 |
***/
|
25 |
|
26 |
-
/****** Yasr Metabox overall rating ******/
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
|
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
else if (defaultbox === 'numbers') {
|
37 |
-
|
38 |
-
yasrPrintEventSendOverallWithNumbers(postid, nonceOverall);
|
39 |
-
|
40 |
-
}
|
41 |
-
|
42 |
-
yasrSnippetSelect(postid, nonceSnippet);
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
//This is for the stars
|
47 |
-
function yasrPrintEventSendOverallWithStars(postid, nonce, overallRating) {
|
48 |
-
|
49 |
-
//Convert string to number
|
50 |
-
overallRating = parseFloat(overallRating);
|
51 |
-
|
52 |
-
raterJs({
|
53 |
-
starSize: 32,
|
54 |
-
step: 0.1,
|
55 |
-
showToolTip: false,
|
56 |
-
rating: overallRating,
|
57 |
-
readOnly: false,
|
58 |
-
element: document.getElementById("yasr-rater-overall"),
|
59 |
-
rateCallback: function rateCallback(rating, done) {
|
60 |
-
|
61 |
-
jQuery('#loader-overall-rating').show();
|
62 |
-
|
63 |
-
rating = rating.toFixed(1);
|
64 |
-
rating = parseFloat(rating);
|
65 |
-
this.setRating(rating);
|
66 |
-
|
67 |
-
var data = {
|
68 |
-
action: 'yasr_send_overall_rating',
|
69 |
-
nonce: nonce,
|
70 |
-
rating: rating,
|
71 |
-
post_id: postid
|
72 |
-
};
|
73 |
-
|
74 |
-
//Send value to the Server
|
75 |
-
jQuery.post(ajaxurl, data, function(response) {
|
76 |
-
jQuery('#loader-overall-rating').hide();
|
77 |
-
jQuery('#yasr_rateit_overall_value').text(response);
|
78 |
-
}) ;
|
79 |
-
|
80 |
-
done();
|
81 |
-
}
|
82 |
-
});
|
83 |
-
|
84 |
-
|
85 |
-
}
|
86 |
-
|
87 |
-
//This is for the numbers
|
88 |
-
function yasrPrintEventSendOverallWithNumbers(postid, nonce) {
|
89 |
-
|
90 |
-
var integer = jQuery('#yasr-vote-overall-numbers-int').val();
|
91 |
-
|
92 |
-
if (integer == 5) {
|
93 |
-
|
94 |
-
jQuery("#yasr-comma-between-select").hide();
|
95 |
-
jQuery("#yasr-vote-overall-numbers-dec").hide();
|
96 |
-
|
97 |
-
}
|
98 |
|
99 |
-
|
|
|
100 |
|
101 |
-
|
102 |
|
103 |
-
|
104 |
|
105 |
-
|
106 |
-
jQuery("#yasr-vote-overall-numbers-dec").hide();
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
jQuery('#yasr-send-overall-numbers').on('click', function() {
|
113 |
-
|
114 |
-
var integer = jQuery('#yasr-vote-overall-numbers-int').val();
|
115 |
-
|
116 |
-
var decimal = jQuery('#yasr-vote-overall-numbers-dec').val();
|
117 |
-
|
118 |
-
var value = integer + "." + decimal;
|
119 |
-
|
120 |
-
var data = {
|
121 |
-
action: 'yasr_send_overall_rating',
|
122 |
-
nonce: nonce,
|
123 |
-
rating: value,
|
124 |
-
post_id: postid
|
125 |
-
};
|
126 |
-
|
127 |
-
//Send value to the Server
|
128 |
-
jQuery.post(ajaxurl, data, function(response) {
|
129 |
-
jQuery('#yasr-overall-numbers-saved-confirm').text(response);
|
130 |
-
}) ;
|
131 |
-
|
132 |
-
return false;
|
133 |
-
|
134 |
-
});
|
135 |
-
|
136 |
-
}
|
137 |
-
|
138 |
-
//Choose snippet
|
139 |
-
function yasrSnippetSelect(postid, nonceSnippet) {
|
140 |
-
|
141 |
-
jQuery('#yasr-send-review-type').on('click', function() {
|
142 |
-
|
143 |
-
reviewtype = jQuery('#yasr-choose-reviews-types-list').val()
|
144 |
-
|
145 |
-
var data = {
|
146 |
-
action: 'yasr_insert_review_type',
|
147 |
-
reviewtype: reviewtype,
|
148 |
-
postid: postid,
|
149 |
-
nonce: nonceSnippet
|
150 |
-
}
|
151 |
-
|
152 |
-
jQuery.post(ajaxurl, data, function(response) {
|
153 |
-
jQuery('#yasr-ajax-response-review-type').text(response);
|
154 |
-
}) ;
|
155 |
-
|
156 |
-
return false;
|
157 |
-
|
158 |
-
});
|
159 |
-
|
160 |
-
}
|
161 |
|
|
|
162 |
|
163 |
/****** End Yasr Metabox overall rating ******/
|
164 |
|
23 |
|
24 |
***/
|
25 |
|
26 |
+
/****** Yasr Metabox overall rating, used for classic editor ******/
|
27 |
|
28 |
+
function yasrPrintMetaBoxOverall(postid, overallRating) {
|
29 |
|
30 |
+
//Convert string to number
|
31 |
+
overallRating = parseFloat(overallRating);
|
32 |
|
33 |
+
raterJs({
|
34 |
+
starSize: 32,
|
35 |
+
step: 0.1,
|
36 |
+
showToolTip: false,
|
37 |
+
rating: overallRating,
|
38 |
+
readOnly: false,
|
39 |
+
element: document.getElementById("yasr-rater-overall"),
|
40 |
+
rateCallback: function rateCallback(rating, done) {
|
41 |
|
42 |
+
rating = rating.toFixed(1);
|
43 |
+
rating = parseFloat(rating);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
//update hidden field
|
46 |
+
document.getElementById('yasr-overall-rating-value').value = rating;
|
47 |
|
48 |
+
this.setRating(rating);
|
49 |
|
50 |
+
yasrOverallString = 'You\'ve rated';
|
51 |
|
52 |
+
document.getElementById('yasr_rateit_overall_value').textContent = yasrOverallString + ' ' + rating;
|
|
|
53 |
|
54 |
+
done();
|
55 |
+
}
|
56 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
+
}
|
59 |
|
60 |
/****** End Yasr Metabox overall rating ******/
|
61 |
|
js/yasr-guten-blocks.js
CHANGED
@@ -1,3 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
var __ = wp.i18n.__; // Import __() from wp.i18n
|
2 |
|
3 |
var registerBlockType = wp.blocks.registerBlockType; // Import from wp.blocks
|
@@ -10,8 +18,23 @@ var _wp$editor = wp.editor,
|
|
10 |
BlockControls = _wp$editor.BlockControls,
|
11 |
InspectorControls = _wp$editor.InspectorControls;
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
-
* Register:
|
15 |
*
|
16 |
* Registers a new block provided a unique name and an object defining its
|
17 |
* behavior. Once registered, the block is made editor as an option to any
|
@@ -31,147 +54,217 @@ registerBlockType('yet-another-stars-rating/yasr-overall-rating', {
|
|
31 |
category: 'yet-another-stars-rating',
|
32 |
keywords: [__('rating', 'yet-another-stars-rating'), __('author', 'yet-another-stars-rating'), __('overall', 'yet-another-stars-rating')],
|
33 |
attributes: {
|
34 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
size: {
|
36 |
type: 'string',
|
37 |
default: '--'
|
38 |
},
|
39 |
postId: {
|
40 |
-
type: '
|
41 |
default: ''
|
42 |
}
|
43 |
},
|
44 |
|
45 |
edit: function edit(props) {
|
46 |
var _props$attributes = props.attributes,
|
|
|
|
|
47 |
size = _props$attributes.size,
|
48 |
postId = _props$attributes.postId,
|
49 |
setAttributes = props.setAttributes,
|
50 |
isSelected = props.isSelected;
|
51 |
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
var sizeAttribute = null;
|
54 |
var postIdAttribute = null;
|
55 |
-
|
56 |
-
var chooseText = __('Choose stars size', 'yet-another-stars-rating');
|
57 |
-
var smallText = __('Small', 'yet-another-stars-rating');
|
58 |
-
var mediumText = __('Medium', 'yet-another-stars-rating');
|
59 |
-
var largeText = __('Large', 'yet-another-stars-rating');
|
60 |
-
var leaveThisBlankText = __('Leave this blank if you don\'t know what you\'re doing.', 'yet-another-stars-rating');
|
61 |
|
62 |
if (size !== '--') {
|
63 |
sizeAttribute = ' size="' + size + '"';
|
64 |
}
|
65 |
|
66 |
-
|
|
|
|
|
67 |
postIdAttribute = ' postid="' + postId + '"';
|
68 |
}
|
69 |
|
70 |
-
function
|
71 |
-
|
72 |
-
var postIdValue = event.target.value;
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
|
82 |
-
function
|
83 |
return React.createElement(
|
84 |
'form',
|
85 |
-
|
86 |
React.createElement(
|
87 |
'select',
|
88 |
-
{ value: size, onChange:
|
89 |
React.createElement(
|
90 |
'option',
|
91 |
{ value: '--' },
|
92 |
-
|
93 |
),
|
94 |
React.createElement(
|
95 |
'option',
|
96 |
{ value: 'small' },
|
97 |
-
|
98 |
),
|
99 |
React.createElement(
|
100 |
'option',
|
101 |
{ value: 'medium' },
|
102 |
-
|
103 |
),
|
104 |
React.createElement(
|
105 |
'option',
|
106 |
{ value: 'large' },
|
107 |
-
|
108 |
)
|
109 |
)
|
110 |
);
|
111 |
}
|
112 |
|
113 |
-
function
|
114 |
var selected = event.target.querySelector('option:checked');
|
115 |
setAttributes({ size: selected.value });
|
116 |
event.preventDefault();
|
117 |
}
|
118 |
|
119 |
-
function
|
120 |
return React.createElement(
|
121 |
'div',
|
122 |
null,
|
123 |
-
React.createElement('input', { type: 'text', size: '4', onKeyPress:
|
124 |
);
|
125 |
}
|
126 |
|
127 |
-
function
|
128 |
-
|
129 |
-
|
130 |
-
var yasrLoading = __("Loading, please wait", 'yet-another-stars-rating');
|
131 |
-
var hideLoaderOverall = { display: 'none' };
|
132 |
|
133 |
-
|
|
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
{ id: 'yasr-rateit-vote-overall-text' },
|
141 |
-
overallRateThis
|
142 |
-
),
|
143 |
-
React.createElement('div', { id: 'yasr-rater-overall', ref: function ref(elem) {
|
144 |
-
return yasrPrintEventSendOverallWithStars(currentPostId, yasrConstantGutenberg.nonceOverall, yasrConstantGutenberg.overallRating);
|
145 |
-
} }),
|
146 |
-
React.createElement(
|
147 |
-
'div',
|
148 |
-
{ id: 'loader-overall-rating', style: hideLoaderOverall },
|
149 |
-
yasrLoading,
|
150 |
-
' ',
|
151 |
-
React.createElement('img', { src: yasrCommonDataAdmin.loaderHtml })
|
152 |
-
),
|
153 |
-
React.createElement(
|
154 |
-
'div',
|
155 |
-
null,
|
156 |
-
React.createElement('span', { id: 'yasr_rateit_overall_value' })
|
157 |
-
)
|
158 |
-
);
|
159 |
}
|
160 |
|
161 |
-
function
|
162 |
-
|
163 |
-
var optionalText = __('All these settings are optional', 'yet-another-stars-rating');
|
164 |
-
var labelSize = __('Choose Size', 'yet-another-stars-rating');
|
165 |
-
var labelPostID = __('PostId', 'yet-another-stars-rating');
|
166 |
-
var overallDescription = __('Remember: only the post author can rate here', 'yet-another-stars-rating');
|
167 |
|
168 |
return React.createElement(
|
169 |
InspectorControls,
|
170 |
null,
|
171 |
React.createElement(
|
172 |
'div',
|
173 |
-
{
|
174 |
-
|
175 |
),
|
176 |
React.createElement(
|
177 |
PanelBody,
|
@@ -179,7 +272,7 @@ registerBlockType('yet-another-stars-rating/yasr-overall-rating', {
|
|
179 |
React.createElement(
|
180 |
'h3',
|
181 |
null,
|
182 |
-
|
183 |
),
|
184 |
React.createElement(
|
185 |
'div',
|
@@ -187,12 +280,12 @@ registerBlockType('yet-another-stars-rating/yasr-overall-rating', {
|
|
187 |
React.createElement(
|
188 |
'label',
|
189 |
null,
|
190 |
-
|
191 |
),
|
192 |
React.createElement(
|
193 |
'div',
|
194 |
null,
|
195 |
-
|
196 |
)
|
197 |
),
|
198 |
React.createElement(
|
@@ -201,19 +294,19 @@ registerBlockType('yet-another-stars-rating/yasr-overall-rating', {
|
|
201 |
React.createElement(
|
202 |
'label',
|
203 |
null,
|
204 |
-
|
205 |
),
|
206 |
-
|
207 |
React.createElement(
|
208 |
'div',
|
209 |
{ className: 'yasr-guten-block-explain' },
|
210 |
-
|
211 |
)
|
212 |
),
|
213 |
React.createElement(
|
214 |
'div',
|
215 |
{ className: 'yasr-guten-block-panel' },
|
216 |
-
|
217 |
)
|
218 |
)
|
219 |
);
|
@@ -222,7 +315,7 @@ registerBlockType('yet-another-stars-rating/yasr-overall-rating', {
|
|
222 |
return React.createElement(
|
223 |
Fragment,
|
224 |
null,
|
225 |
-
|
226 |
React.createElement(
|
227 |
'div',
|
228 |
{ className: props.className },
|
@@ -230,7 +323,7 @@ registerBlockType('yet-another-stars-rating/yasr-overall-rating', {
|
|
230 |
sizeAttribute,
|
231 |
postIdAttribute,
|
232 |
']',
|
233 |
-
isSelected &&
|
234 |
)
|
235 |
);
|
236 |
},
|
@@ -245,10 +338,13 @@ registerBlockType('yet-another-stars-rating/yasr-overall-rating', {
|
|
245 |
*/
|
246 |
save: function save(props) {
|
247 |
var _props$attributes2 = props.attributes,
|
|
|
248 |
size = _props$attributes2.size,
|
249 |
postId = _props$attributes2.postId;
|
250 |
|
251 |
|
|
|
|
|
252 |
var yasrOverallAttributes = null;
|
253 |
|
254 |
if (size) {
|
@@ -267,4 +363,205 @@ registerBlockType('yet-another-stars-rating/yasr-overall-rating', {
|
|
267 |
);
|
268 |
}
|
269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
});
|
1 |
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
2 |
+
|
3 |
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4 |
+
|
5 |
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
6 |
+
|
7 |
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
8 |
+
|
9 |
var __ = wp.i18n.__; // Import __() from wp.i18n
|
10 |
|
11 |
var registerBlockType = wp.blocks.registerBlockType; // Import from wp.blocks
|
18 |
BlockControls = _wp$editor.BlockControls,
|
19 |
InspectorControls = _wp$editor.InspectorControls;
|
20 |
|
21 |
+
|
22 |
+
var yasrOptionalText = __('All these settings are optional', 'yet-another-stars-rating');
|
23 |
+
|
24 |
+
var yasrLabelSelectSize = __('Choose Size', 'yet-another-stars-rating');
|
25 |
+
|
26 |
+
var yasrSelectSizeChoose = __('Choose stars size', 'yet-another-stars-rating');
|
27 |
+
var yasrSelectSizeSmall = __('Small', 'yet-another-stars-rating');
|
28 |
+
var yasrSelectSizeMedium = __('Medium', 'yet-another-stars-rating');
|
29 |
+
var yasrSelectSizeLarge = __('Large', 'yet-another-stars-rating');
|
30 |
+
|
31 |
+
var yasrLeaveThisBlankText = __('Leave this blank if you don\'t know what you\'re doing.', 'yet-another-stars-rating');
|
32 |
+
|
33 |
+
var yasrOverallDescription = __('Remember: only the post author can rate here.', 'yet-another-stars-rating');
|
34 |
+
var yasrVisitorVotesDescription = __('This is the star set where your users will be able to vote', 'yet-another-stars-rating');
|
35 |
+
|
36 |
/**
|
37 |
+
* Register: a Gutenberg Block.
|
38 |
*
|
39 |
* Registers a new block provided a unique name and an object defining its
|
40 |
* behavior. Once registered, the block is made editor as an option to any
|
54 |
category: 'yet-another-stars-rating',
|
55 |
keywords: [__('rating', 'yet-another-stars-rating'), __('author', 'yet-another-stars-rating'), __('overall', 'yet-another-stars-rating')],
|
56 |
attributes: {
|
57 |
+
//should be needed just overallRatingMeta:
|
58 |
+
//but, after the post is saved/updated
|
59 |
+
//the meta filed returns always undefined
|
60 |
+
//see this bug https://github.com/WordPress/gutenberg/issues/4989
|
61 |
+
overallRatingMeta: {
|
62 |
+
type: 'string',
|
63 |
+
source: 'meta',
|
64 |
+
meta: 'yasr_overall_rating'
|
65 |
+
},
|
66 |
+
overallRatingAttribute: {
|
67 |
+
type: 'number',
|
68 |
+
default: 0
|
69 |
+
},
|
70 |
size: {
|
71 |
type: 'string',
|
72 |
default: '--'
|
73 |
},
|
74 |
postId: {
|
75 |
+
type: 'number',
|
76 |
default: ''
|
77 |
}
|
78 |
},
|
79 |
|
80 |
edit: function edit(props) {
|
81 |
var _props$attributes = props.attributes,
|
82 |
+
overallRatingMeta = _props$attributes.overallRatingMeta,
|
83 |
+
overallRatingAttribute = _props$attributes.overallRatingAttribute,
|
84 |
size = _props$attributes.size,
|
85 |
postId = _props$attributes.postId,
|
86 |
setAttributes = props.setAttributes,
|
87 |
isSelected = props.isSelected;
|
88 |
|
89 |
|
90 |
+
var overallRating = 0;
|
91 |
+
|
92 |
+
if (overallRatingAttribute === 0) {
|
93 |
+
overallRating = overallRatingMeta;
|
94 |
+
} else {
|
95 |
+
overallRating = overallRatingAttribute;
|
96 |
+
}
|
97 |
+
|
98 |
var sizeAttribute = null;
|
99 |
var postIdAttribute = null;
|
100 |
+
var isNum = false;
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
if (size !== '--') {
|
103 |
sizeAttribute = ' size="' + size + '"';
|
104 |
}
|
105 |
|
106 |
+
isNum = /^\d+$/.test(postId);
|
107 |
+
|
108 |
+
if (postId && isNum === true) {
|
109 |
postIdAttribute = ' postid="' + postId + '"';
|
110 |
}
|
111 |
|
112 |
+
var YasrCreateDivRater = function (_React$Component) {
|
113 |
+
_inherits(YasrCreateDivRater, _React$Component);
|
|
|
114 |
|
115 |
+
function YasrCreateDivRater(props) {
|
116 |
+
_classCallCheck(this, YasrCreateDivRater);
|
117 |
+
|
118 |
+
return _possibleConstructorReturn(this, (YasrCreateDivRater.__proto__ || Object.getPrototypeOf(YasrCreateDivRater)).call(this, props));
|
119 |
+
//const divOverall = React.createRef();
|
120 |
}
|
121 |
+
|
122 |
+
_createClass(YasrCreateDivRater, [{
|
123 |
+
key: 'render',
|
124 |
+
value: function render() {
|
125 |
+
return React.createElement(
|
126 |
+
'div',
|
127 |
+
null,
|
128 |
+
React.createElement('div', { id: 'overall-rater', ref: function ref() {
|
129 |
+
return raterJs({
|
130 |
+
starSize: 32,
|
131 |
+
step: 0.1,
|
132 |
+
showToolTip: false,
|
133 |
+
rating: overallRating,
|
134 |
+
readOnly: false,
|
135 |
+
element: document.querySelector("#overall-rater"),
|
136 |
+
rateCallback: function rateCallback(rating, done) {
|
137 |
+
|
138 |
+
rating = rating.toFixed(1);
|
139 |
+
rating = parseFloat(rating);
|
140 |
+
|
141 |
+
setAttributes({ overallRatingAttribute: rating });
|
142 |
+
|
143 |
+
//show the load. IF insert before setAttributes, doesn't work
|
144 |
+
jQuery('#loader-overall-rating').show();
|
145 |
+
|
146 |
+
this.setRating(rating);
|
147 |
+
|
148 |
+
var currentPostId = wp.data.select("core/editor").getCurrentPostId();
|
149 |
+
|
150 |
+
var data = {
|
151 |
+
action: 'yasr_send_overall_rating',
|
152 |
+
yasr_nonce_overall_rating: yasrConstantGutenberg.nonceOverall,
|
153 |
+
yasr_overall_rating: rating,
|
154 |
+
post_id: currentPostId
|
155 |
+
};
|
156 |
+
|
157 |
+
//Send value to the Server
|
158 |
+
jQuery.post(ajaxurl, data, function (response) {
|
159 |
+
jQuery('#loader-overall-rating').hide();
|
160 |
+
response = JSON.parse(response);
|
161 |
+
if (response === 'OK') {
|
162 |
+
jQuery('#yasr-rateit-overall-value').text('You\'ve rated it: ' + rating);
|
163 |
+
}
|
164 |
+
});
|
165 |
+
|
166 |
+
done();
|
167 |
+
}
|
168 |
+
});
|
169 |
+
}
|
170 |
+
})
|
171 |
+
);
|
172 |
+
}
|
173 |
+
}]);
|
174 |
+
|
175 |
+
return YasrCreateDivRater;
|
176 |
+
}(React.Component);
|
177 |
+
|
178 |
+
function YasrDivRatingOverall(props) {
|
179 |
+
|
180 |
+
var yasrOverallRateThis = __("Rate this article / item", 'yet-another-stars-rating');
|
181 |
+
var yasrLoading = __("Loading, please wait", 'yet-another-stars-rating');
|
182 |
+
var hideLoaderOverall = { display: 'none' };
|
183 |
+
|
184 |
+
return React.createElement(
|
185 |
+
'div',
|
186 |
+
null,
|
187 |
+
yasrOverallRateThis,
|
188 |
+
React.createElement(YasrCreateDivRater, null),
|
189 |
+
React.createElement(
|
190 |
+
'span',
|
191 |
+
{ id: 'loader-overall-rating', style: hideLoaderOverall },
|
192 |
+
yasrLoading,
|
193 |
+
' ',
|
194 |
+
React.createElement('img', { src: yasrCommonDataAdmin.loaderHtml })
|
195 |
+
),
|
196 |
+
React.createElement('div', { id: 'yasr-rateit-overall-value' })
|
197 |
+
);
|
198 |
}
|
199 |
|
200 |
+
function YasrPrintSelectSize() {
|
201 |
return React.createElement(
|
202 |
'form',
|
203 |
+
null,
|
204 |
React.createElement(
|
205 |
'select',
|
206 |
+
{ value: size, onChange: yasrSetStarsSize },
|
207 |
React.createElement(
|
208 |
'option',
|
209 |
{ value: '--' },
|
210 |
+
yasrSelectSizeChoose
|
211 |
),
|
212 |
React.createElement(
|
213 |
'option',
|
214 |
{ value: 'small' },
|
215 |
+
yasrSelectSizeSmall
|
216 |
),
|
217 |
React.createElement(
|
218 |
'option',
|
219 |
{ value: 'medium' },
|
220 |
+
yasrSelectSizeMedium
|
221 |
),
|
222 |
React.createElement(
|
223 |
'option',
|
224 |
{ value: 'large' },
|
225 |
+
yasrSelectSizeLarge
|
226 |
)
|
227 |
)
|
228 |
);
|
229 |
}
|
230 |
|
231 |
+
function yasrSetStarsSize(event) {
|
232 |
var selected = event.target.querySelector('option:checked');
|
233 |
setAttributes({ size: selected.value });
|
234 |
event.preventDefault();
|
235 |
}
|
236 |
|
237 |
+
function YasrPrintInputId() {
|
238 |
return React.createElement(
|
239 |
'div',
|
240 |
null,
|
241 |
+
React.createElement('input', { type: 'text', size: '4', onKeyPress: yasrSetPostId })
|
242 |
);
|
243 |
}
|
244 |
|
245 |
+
function yasrSetPostId(event) {
|
246 |
+
if (event.key === 'Enter') {
|
247 |
+
var postIdValue = event.target.value;
|
|
|
|
|
248 |
|
249 |
+
//postID is always a string, here I check if this string is made only by digits
|
250 |
+
var isNum = /^\d+$/.test(postIdValue);
|
251 |
|
252 |
+
if (isNum === true) {
|
253 |
+
setAttributes({ postId: postIdValue });
|
254 |
+
}
|
255 |
+
event.preventDefault();
|
256 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
}
|
258 |
|
259 |
+
function YasrOverallPanel(props) {
|
|
|
|
|
|
|
|
|
|
|
260 |
|
261 |
return React.createElement(
|
262 |
InspectorControls,
|
263 |
null,
|
264 |
React.createElement(
|
265 |
'div',
|
266 |
+
{ 'class': 'yasr-guten-block-panel yasr-guten-block-panel-center' },
|
267 |
+
React.createElement(YasrDivRatingOverall, null)
|
268 |
),
|
269 |
React.createElement(
|
270 |
PanelBody,
|
272 |
React.createElement(
|
273 |
'h3',
|
274 |
null,
|
275 |
+
yasrOptionalText
|
276 |
),
|
277 |
React.createElement(
|
278 |
'div',
|
280 |
React.createElement(
|
281 |
'label',
|
282 |
null,
|
283 |
+
yasrLabelSelectSize
|
284 |
),
|
285 |
React.createElement(
|
286 |
'div',
|
287 |
null,
|
288 |
+
React.createElement(YasrPrintSelectSize, null)
|
289 |
)
|
290 |
),
|
291 |
React.createElement(
|
294 |
React.createElement(
|
295 |
'label',
|
296 |
null,
|
297 |
+
'Post ID'
|
298 |
),
|
299 |
+
React.createElement(YasrPrintInputId, null),
|
300 |
React.createElement(
|
301 |
'div',
|
302 |
{ className: 'yasr-guten-block-explain' },
|
303 |
+
yasrLeaveThisBlankText
|
304 |
)
|
305 |
),
|
306 |
React.createElement(
|
307 |
'div',
|
308 |
{ className: 'yasr-guten-block-panel' },
|
309 |
+
yasrOverallDescription
|
310 |
)
|
311 |
)
|
312 |
);
|
315 |
return React.createElement(
|
316 |
Fragment,
|
317 |
null,
|
318 |
+
React.createElement(YasrOverallPanel, null),
|
319 |
React.createElement(
|
320 |
'div',
|
321 |
{ className: props.className },
|
323 |
sizeAttribute,
|
324 |
postIdAttribute,
|
325 |
']',
|
326 |
+
isSelected && React.createElement(YasrPrintSelectSize, null)
|
327 |
)
|
328 |
);
|
329 |
},
|
338 |
*/
|
339 |
save: function save(props) {
|
340 |
var _props$attributes2 = props.attributes,
|
341 |
+
overallRatingAttribute = _props$attributes2.overallRatingAttribute,
|
342 |
size = _props$attributes2.size,
|
343 |
postId = _props$attributes2.postId;
|
344 |
|
345 |
|
346 |
+
console.log(props);
|
347 |
+
|
348 |
var yasrOverallAttributes = null;
|
349 |
|
350 |
if (size) {
|
363 |
);
|
364 |
}
|
365 |
|
366 |
+
});
|
367 |
+
|
368 |
+
registerBlockType('yet-another-stars-rating/yasr-visitor-votes', {
|
369 |
+
|
370 |
+
title: __('Yasr: Visitor Votes', 'yet-another-stars-rating'),
|
371 |
+
description: __('Insert the ability for your visitors to vote', 'yet-another-stars-rating'),
|
372 |
+
icon: 'star-half',
|
373 |
+
category: 'yet-another-stars-rating',
|
374 |
+
keywords: [__('rating', 'yet-another-stars-rating'), __('visitor', 'yet-another-stars-rating'), __('votes', 'yet-another-stars-rating')],
|
375 |
+
attributes: {
|
376 |
+
//name of the attribute
|
377 |
+
size: {
|
378 |
+
type: 'string',
|
379 |
+
default: '--'
|
380 |
+
},
|
381 |
+
postId: {
|
382 |
+
type: 'int',
|
383 |
+
default: ''
|
384 |
+
}
|
385 |
+
},
|
386 |
+
|
387 |
+
edit: function edit(props) {
|
388 |
+
var _props$attributes3 = props.attributes,
|
389 |
+
size = _props$attributes3.size,
|
390 |
+
postId = _props$attributes3.postId,
|
391 |
+
setAttributes = props.setAttributes,
|
392 |
+
isSelected = props.isSelected;
|
393 |
+
|
394 |
+
|
395 |
+
var sizeAttribute = null;
|
396 |
+
var postIdAttribute = null;
|
397 |
+
var isNum = false;
|
398 |
+
|
399 |
+
isNum = /^\d+$/.test(postId);
|
400 |
+
|
401 |
+
if (size !== '--') {
|
402 |
+
sizeAttribute = ' size="' + size + '"';
|
403 |
+
}
|
404 |
+
|
405 |
+
if (postId && isNum === true) {
|
406 |
+
postIdAttribute = ' postid="' + postId + '"';
|
407 |
+
}
|
408 |
+
|
409 |
+
function YasrPrintSelectSize() {
|
410 |
+
return React.createElement(
|
411 |
+
'form',
|
412 |
+
null,
|
413 |
+
React.createElement(
|
414 |
+
'select',
|
415 |
+
{ value: size, onChange: yasrSetStarsSize },
|
416 |
+
React.createElement(
|
417 |
+
'option',
|
418 |
+
{ value: '--' },
|
419 |
+
yasrSelectSizeChoose
|
420 |
+
),
|
421 |
+
React.createElement(
|
422 |
+
'option',
|
423 |
+
{ value: 'small' },
|
424 |
+
yasrSelectSizeSmall
|
425 |
+
),
|
426 |
+
React.createElement(
|
427 |
+
'option',
|
428 |
+
{ value: 'medium' },
|
429 |
+
yasrSelectSizeMedium
|
430 |
+
),
|
431 |
+
React.createElement(
|
432 |
+
'option',
|
433 |
+
{ value: 'large' },
|
434 |
+
yasrSelectSizeLarge
|
435 |
+
)
|
436 |
+
)
|
437 |
+
);
|
438 |
+
}
|
439 |
+
|
440 |
+
function yasrSetStarsSize(event) {
|
441 |
+
var selected = event.target.querySelector('option:checked');
|
442 |
+
setAttributes({ size: selected.value });
|
443 |
+
event.preventDefault();
|
444 |
+
}
|
445 |
+
|
446 |
+
function YasrPrintInputId() {
|
447 |
+
return React.createElement(
|
448 |
+
'div',
|
449 |
+
null,
|
450 |
+
React.createElement('input', { type: 'text', size: '4', onKeyPress: yasrSetPostId })
|
451 |
+
);
|
452 |
+
}
|
453 |
+
|
454 |
+
function yasrSetPostId(event) {
|
455 |
+
if (event.key === 'Enter') {
|
456 |
+
var postIdValue = event.target.value;
|
457 |
+
|
458 |
+
//postID is always a string, here I check if this string is made only by digits
|
459 |
+
var isNum = /^\d+$/.test(postIdValue);
|
460 |
+
|
461 |
+
if (isNum === true) {
|
462 |
+
setAttributes({ postId: postIdValue });
|
463 |
+
}
|
464 |
+
event.preventDefault();
|
465 |
+
}
|
466 |
+
}
|
467 |
+
|
468 |
+
function YasrVVPanel(props) {
|
469 |
+
|
470 |
+
return React.createElement(
|
471 |
+
InspectorControls,
|
472 |
+
null,
|
473 |
+
React.createElement(
|
474 |
+
PanelBody,
|
475 |
+
{ title: 'Settings' },
|
476 |
+
React.createElement(
|
477 |
+
'h3',
|
478 |
+
null,
|
479 |
+
yasrOptionalText
|
480 |
+
),
|
481 |
+
React.createElement(
|
482 |
+
'div',
|
483 |
+
{ className: 'yasr-guten-block-panel' },
|
484 |
+
React.createElement(
|
485 |
+
'label',
|
486 |
+
null,
|
487 |
+
yasrLabelSelectSize
|
488 |
+
),
|
489 |
+
React.createElement(
|
490 |
+
'div',
|
491 |
+
null,
|
492 |
+
React.createElement(YasrPrintSelectSize, null)
|
493 |
+
)
|
494 |
+
),
|
495 |
+
React.createElement(
|
496 |
+
'div',
|
497 |
+
{ className: 'yasr-guten-block-panel' },
|
498 |
+
React.createElement(
|
499 |
+
'label',
|
500 |
+
null,
|
501 |
+
'Post ID'
|
502 |
+
),
|
503 |
+
React.createElement(YasrPrintInputId, null),
|
504 |
+
React.createElement(
|
505 |
+
'div',
|
506 |
+
{ className: 'yasr-guten-block-explain' },
|
507 |
+
yasrLeaveThisBlankText
|
508 |
+
)
|
509 |
+
),
|
510 |
+
React.createElement(
|
511 |
+
'div',
|
512 |
+
{ className: 'yasr-guten-block-panel' },
|
513 |
+
yasrVisitorVotesDescription
|
514 |
+
)
|
515 |
+
)
|
516 |
+
);
|
517 |
+
}
|
518 |
+
|
519 |
+
return React.createElement(
|
520 |
+
Fragment,
|
521 |
+
null,
|
522 |
+
React.createElement(YasrVVPanel, null),
|
523 |
+
React.createElement(
|
524 |
+
'div',
|
525 |
+
{ className: props.className },
|
526 |
+
'[yasr_visitor_votes',
|
527 |
+
sizeAttribute,
|
528 |
+
postIdAttribute,
|
529 |
+
']',
|
530 |
+
isSelected && React.createElement(YasrPrintSelectSize, null)
|
531 |
+
)
|
532 |
+
);
|
533 |
+
},
|
534 |
+
|
535 |
+
/**
|
536 |
+
* The save function defines the way in which the different attributes should be combined
|
537 |
+
* into the final markup, which is then serialized by Gutenberg into post_content.
|
538 |
+
*
|
539 |
+
* The "save" property must be specified and must be a valid function.
|
540 |
+
*
|
541 |
+
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
542 |
+
*/
|
543 |
+
save: function save(props) {
|
544 |
+
var _props$attributes4 = props.attributes,
|
545 |
+
size = _props$attributes4.size,
|
546 |
+
postId = _props$attributes4.postId;
|
547 |
+
|
548 |
+
|
549 |
+
var yasrVVAttributes = null;
|
550 |
+
|
551 |
+
if (size) {
|
552 |
+
yasrVVAttributes += ' size="' + size + '"';
|
553 |
+
}
|
554 |
+
if (postId) {
|
555 |
+
yasrVVAttributes += ' postid="' + postId + '"';
|
556 |
+
}
|
557 |
+
|
558 |
+
return React.createElement(
|
559 |
+
'p',
|
560 |
+
null,
|
561 |
+
'[yasr_visitor_votes ',
|
562 |
+
yasrVVAttributes,
|
563 |
+
']'
|
564 |
+
);
|
565 |
+
}
|
566 |
+
|
567 |
});
|
lib/admin/settings/yasr-settings-functions.php
CHANGED
@@ -176,14 +176,6 @@ function yasr_general_options_init()
|
|
176 |
'yasr_general_options_section_id',
|
177 |
$option
|
178 |
);
|
179 |
-
add_settings_field(
|
180 |
-
'yasr_choose_overall_rating_method',
|
181 |
-
__( 'How do you want to rate "Overall Rating"?', 'yet-another-stars-rating' ),
|
182 |
-
'yasr_choose_overall_rating_method_callback',
|
183 |
-
'yasr_general_settings_tab',
|
184 |
-
'yasr_general_options_section_id',
|
185 |
-
$option
|
186 |
-
);
|
187 |
}
|
188 |
|
189 |
function yasr_section_callback()
|
@@ -805,41 +797,10 @@ function yasr_choose_snippet_callback( $option )
|
|
805 |
|
806 |
<p> </p>
|
807 |
|
808 |
-
<hr>
|
809 |
-
|
810 |
<?php
|
811 |
}
|
812 |
|
813 |
//End function yasr_choose_snippet_callback
|
814 |
-
function yasr_choose_overall_rating_method_callback( $option )
|
815 |
-
{
|
816 |
-
?>
|
817 |
-
|
818 |
-
<input type="radio" name="yasr_general_options[metabox_overall_rating]" value="stars" class="yasr_choose_overall_rating_method" <?php
|
819 |
-
if ( $option['metabox_overall_rating'] === 'stars' ) {
|
820 |
-
echo " checked=\"checked\" " ;
|
821 |
-
}
|
822 |
-
?> >
|
823 |
-
<?php
|
824 |
-
_e( 'Stars', 'yet-another-stars-rating' );
|
825 |
-
?>
|
826 |
-
<br />
|
827 |
-
|
828 |
-
<input type="radio" name="yasr_general_options[metabox_overall_rating]" value="numbers" class="yasr_choose_overall_rating_method" <?php
|
829 |
-
if ( $option['metabox_overall_rating'] === 'numbers' ) {
|
830 |
-
echo " checked=\"checked\" " ;
|
831 |
-
}
|
832 |
-
?> >
|
833 |
-
<?php
|
834 |
-
_e( 'Numbers', 'yet-another-stars-rating' );
|
835 |
-
?>
|
836 |
-
<br />
|
837 |
-
|
838 |
-
<p> </p>
|
839 |
-
|
840 |
-
<?php
|
841 |
-
}
|
842 |
-
|
843 |
function yasr_general_options_sanitize( $option )
|
844 |
{
|
845 |
//Array to return
|
176 |
'yasr_general_options_section_id',
|
177 |
$option
|
178 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
}
|
180 |
|
181 |
function yasr_section_callback()
|
797 |
|
798 |
<p> </p>
|
799 |
|
|
|
|
|
800 |
<?php
|
801 |
}
|
802 |
|
803 |
//End function yasr_choose_snippet_callback
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
804 |
function yasr_general_options_sanitize( $option )
|
805 |
{
|
806 |
//Array to return
|
lib/admin/yasr-admin-actions.php
CHANGED
@@ -3,9 +3,6 @@
|
|
3 |
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
|
4 |
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
//
|
10 |
add_filter('yasr_filter_style_options', 'yasr_filter_style_options_callback');
|
11 |
|
3 |
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
|
4 |
|
5 |
|
|
|
|
|
|
|
6 |
//
|
7 |
add_filter('yasr_filter_style_options', 'yasr_filter_style_options_callback');
|
8 |
|
lib/admin/yasr-editor-functions.php
CHANGED
@@ -30,7 +30,7 @@ function yasr_gutenberg_scripts () {
|
|
30 |
|
31 |
}
|
32 |
|
33 |
-
//This filter is used to add a new
|
34 |
add_filter( 'block_categories', 'yasr_add_gutenberg_category', 10, 2);
|
35 |
|
36 |
function yasr_add_gutenberg_category ($categories) {
|
@@ -51,18 +51,10 @@ function yasr_add_js_constant_gutenberg ($hook) {
|
|
51 |
|
52 |
if ($hook === 'post.php' || $hook === 'post-new.php') {
|
53 |
|
54 |
-
$
|
55 |
-
$overall_rating=yasr_get_overall_rating($post_id);
|
56 |
-
|
57 |
-
if (!$overall_rating) {
|
58 |
-
$overall_rating = "0";
|
59 |
-
}
|
60 |
-
|
61 |
-
$ajax_nonce_overall = wp_create_nonce( "yasr_nonce_insert_overall_rating" );
|
62 |
|
63 |
wp_localize_script ('yasradmin', 'yasrConstantGutenberg',
|
64 |
array(
|
65 |
-
'overallRating' => $overall_rating,
|
66 |
'nonceOverall' => $ajax_nonce_overall
|
67 |
)
|
68 |
);
|
@@ -71,4 +63,18 @@ function yasr_add_js_constant_gutenberg ($hook) {
|
|
71 |
|
72 |
}
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
?>
|
30 |
|
31 |
}
|
32 |
|
33 |
+
//This filter is used to add a new category in gutenberg
|
34 |
add_filter( 'block_categories', 'yasr_add_gutenberg_category', 10, 2);
|
35 |
|
36 |
function yasr_add_gutenberg_category ($categories) {
|
51 |
|
52 |
if ($hook === 'post.php' || $hook === 'post-new.php') {
|
53 |
|
54 |
+
$ajax_nonce_overall = wp_create_nonce( "yasr_nonce_overall_rating_action" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
wp_localize_script ('yasradmin', 'yasrConstantGutenberg',
|
57 |
array(
|
|
|
58 |
'nonceOverall' => $ajax_nonce_overall
|
59 |
)
|
60 |
);
|
63 |
|
64 |
}
|
65 |
|
66 |
+
//This will add to the gutnberg rest yasr_overall_rating meta field
|
67 |
+
add_action( 'init', 'yasr_gutenberg_show_in_rest_overall_meta' );
|
68 |
+
|
69 |
+
function yasr_gutenberg_show_in_rest_overall_meta() {
|
70 |
+
register_meta( 'post', 'yasr_overall_rating',
|
71 |
+
array(
|
72 |
+
'show_in_rest' => true,
|
73 |
+
'single' => true,
|
74 |
+
'type' => 'number',
|
75 |
+
)
|
76 |
+
);
|
77 |
+
}
|
78 |
+
|
79 |
+
|
80 |
?>
|
yasr-metabox-multiple-rating.php → lib/admin/yasr-metabox-multiple-rating.php
RENAMED
File without changes
|
lib/admin/yasr-metabox-top-right.php
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
|
5 |
+
Copyright 2014 Dario Curvino (email : d.curvino@tiscali.it)
|
6 |
+
|
7 |
+
This program is free software: you can redistribute it and/or modify
|
8 |
+
it under the terms of the GNU General Public License as published by
|
9 |
+
the Free Software Foundation, either version 2 of the License, or
|
10 |
+
(at your option) any later version.
|
11 |
+
|
12 |
+
This program is distributed in the hope that it will be useful,
|
13 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
+
GNU General Public License for more details.
|
16 |
+
|
17 |
+
You should have received a copy of the GNU General Public License
|
18 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>
|
19 |
+
*/
|
20 |
+
|
21 |
+
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
|
22 |
+
|
23 |
+
$post_id=get_the_ID();
|
24 |
+
|
25 |
+
$overall_rating=yasr_get_overall_rating($post_id);
|
26 |
+
|
27 |
+
if (!$overall_rating) {
|
28 |
+
$overall_rating = "0";
|
29 |
+
}
|
30 |
+
|
31 |
+
$ajax_nonce_overall = wp_nonce_field( "yasr_nonce_overall_rating_action", "yasr_nonce_overall_rating");
|
32 |
+
$ajax_nonce_review_type = wp_nonce_field( "yasr_nonce_review_type_action", "yasr_nonce_review_type" );
|
33 |
+
|
34 |
+
?>
|
35 |
+
|
36 |
+
|
37 |
+
<div id="yasr-matabox-top-right">
|
38 |
+
|
39 |
+
<input type="hidden" name="yasr_overall_rating" id="yasr-overall-rating-value" value="<?php echo $overall_rating?>">
|
40 |
+
|
41 |
+
<div id="yasr-vote-overall-stars-container">
|
42 |
+
|
43 |
+
<div id="yasr-vote-overall-stars">
|
44 |
+
<span id="yasr-rateit-vote-overall-text">
|
45 |
+
<?php _e("Rate this article / item", 'yet-another-stars-rating'); ?>
|
46 |
+
</span>
|
47 |
+
|
48 |
+
<div id="yasr-rater-overall" >
|
49 |
+
</div>
|
50 |
+
|
51 |
+
</p>
|
52 |
+
|
53 |
+
<div>
|
54 |
+
<span id="yasr_rateit_overall_value"></span>
|
55 |
+
</div>
|
56 |
+
|
57 |
+
</div>
|
58 |
+
|
59 |
+
</div> <!--End stars container-->
|
60 |
+
|
61 |
+
<hr>
|
62 |
+
|
63 |
+
<?php
|
64 |
+
|
65 |
+
if (YASR_AUTO_INSERT_ENABLED == 1) {
|
66 |
+
|
67 |
+
$is_this_post_exluded = get_post_meta($post_id, 'yasr_auto_insert_disabled', TRUE);
|
68 |
+
|
69 |
+
?>
|
70 |
+
|
71 |
+
<div id="yasr-toprightmetabox-disable-auto-insert">
|
72 |
+
|
73 |
+
<?php _e('Disable auto insert for this post or page?', 'yet-another-stars-rating'); ?>
|
74 |
+
|
75 |
+
<br />
|
76 |
+
|
77 |
+
<div class="yasr-onoffswitch-big" id="yasr-switcher-disable-auto-insert">
|
78 |
+
<input type="checkbox" name="yasr_auto_insert_disabled" class="yasr-onoffswitch-checkbox" value="yes" id="yasr-auto-insert-disabled-switch" <?php if ($is_this_post_exluded === 'yes') echo " checked='checked' "; ?> >
|
79 |
+
<label class="yasr-onoffswitch-label" for="yasr-auto-insert-disabled-switch">
|
80 |
+
<span class="yasr-onoffswitch-inner"></span>
|
81 |
+
<span class="yasr-onoffswitch-switch"></span>
|
82 |
+
</label>
|
83 |
+
</div>
|
84 |
+
|
85 |
+
|
86 |
+
</div>
|
87 |
+
|
88 |
+
<hr>
|
89 |
+
|
90 |
+
<?php
|
91 |
+
|
92 |
+
} //End if auto insert enabled
|
93 |
+
|
94 |
+
?>
|
95 |
+
|
96 |
+
<div class="yasr-choose-reviews-types"><?php _e("This review is about a...", "yet-another-stars-rating"); ?>
|
97 |
+
<br />
|
98 |
+
|
99 |
+
<?php yasr_select_itemtype(); ?>
|
100 |
+
|
101 |
+
</div>
|
102 |
+
|
103 |
+
<p>
|
104 |
+
|
105 |
+
<div>
|
106 |
+
|
107 |
+
<?php
|
108 |
+
|
109 |
+
//Show this message if auto insert is off or if auto insert is not set to show overall rating (so if it is set to visitor rating)
|
110 |
+
if( YASR_AUTO_INSERT_ENABLED == 0 || (YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_WHAT === 'visitor_rating') ) {
|
111 |
+
|
112 |
+
echo "<div>";
|
113 |
+
_e ("Remember to insert this shortcode <strong>[yasr_overall_rating]</strong> where you want to display this rating", 'yet-another-stars-rating');
|
114 |
+
echo "</div>";
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
?>
|
119 |
+
|
120 |
+
</div>
|
121 |
+
|
122 |
+
<?php
|
123 |
+
|
124 |
+
do_action( 'yasr_add_content_bottom_topright_metabox', $post_id );
|
125 |
+
|
126 |
+
?>
|
127 |
+
|
128 |
+
</div>
|
129 |
+
|
130 |
+
<script type="text/javascript">
|
131 |
+
|
132 |
+
jQuery(document).ready(function() {
|
133 |
+
|
134 |
+
var postid = <?php json_encode(the_ID()); ?>;
|
135 |
+
|
136 |
+
var overallRating = <?php echo (json_encode($overall_rating)); ?>
|
137 |
+
|
138 |
+
yasrPrintMetaBoxOverall (postid, overallRating);
|
139 |
+
|
140 |
+
}); //End document ready
|
141 |
+
|
142 |
+
</script>
|
lib/yasr-ajax-functions.php
CHANGED
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
27 |
|
28 |
/****** Get id and overall rating from post or page and write it in db, used in yasr-metabox-overall-rating******/
|
29 |
|
30 |
-
add_action( 'wp_ajax_yasr_send_overall_rating', 'yasr_insert_overall_rating_callback' );
|
31 |
|
32 |
function yasr_insert_overall_rating_callback() {
|
33 |
|
@@ -53,9 +53,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
53 |
$rating = (float)$rating;
|
54 |
|
55 |
if ($rating > 5) {
|
56 |
-
|
57 |
$rating = 5;
|
58 |
-
|
59 |
}
|
60 |
|
61 |
//Put an action to hook into
|
@@ -92,67 +90,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
92 |
|
93 |
die(); // this is required to return a proper result
|
94 |
|
95 |
-
}
|
96 |
-
|
97 |
-
|
98 |
-
/****** Set the review type in yasr metabox overall rating ******/
|
99 |
-
|
100 |
-
add_action ( 'wp_ajax_yasr_insert_review_type', 'yasr_insert_review_type_callback' );
|
101 |
-
|
102 |
-
function yasr_insert_review_type_callback () {
|
103 |
-
|
104 |
-
if (isset($_POST['reviewtype']) && ($_POST['postid'])) {
|
105 |
-
|
106 |
-
$reviewtype = $_POST['reviewtype'];
|
107 |
-
$post_id = $_POST['postid'];
|
108 |
-
$nonce = $_POST['nonce'];
|
109 |
-
|
110 |
-
}
|
111 |
-
|
112 |
-
else {
|
113 |
-
exit();
|
114 |
-
}
|
115 |
-
|
116 |
-
if ( ! current_user_can( 'publish_posts' ) ) {
|
117 |
-
wp_die( __( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ) );
|
118 |
-
}
|
119 |
-
|
120 |
-
if ( ! wp_verify_nonce( $nonce, 'yasr_nonce_review_type' ) ) {
|
121 |
-
die( 'Security check' );
|
122 |
-
}
|
123 |
-
|
124 |
-
$post_id = (int)$post_id;
|
125 |
-
|
126 |
-
if ($reviewtype === "1") {
|
127 |
-
$reviewtype = 'Product';
|
128 |
-
}
|
129 |
-
|
130 |
-
elseif ($reviewtype === "2") {
|
131 |
-
$reviewtype = 'Place';
|
132 |
-
}
|
133 |
-
|
134 |
-
elseif ($reviewtype === "3") {
|
135 |
-
$reviewtype = "Recipe";
|
136 |
-
}
|
137 |
-
|
138 |
-
elseif ($reviewtype === "4") {
|
139 |
-
$reviewtype = 'Other';
|
140 |
-
}
|
141 |
-
|
142 |
-
else {
|
143 |
-
die();
|
144 |
-
}
|
145 |
-
|
146 |
-
$review_type = update_post_meta($post_id, 'yasr_review_type', $reviewtype);
|
147 |
-
|
148 |
-
if($review_type) {
|
149 |
-
_e("Type Saved", "yet-another-stars-rating");
|
150 |
-
}
|
151 |
-
|
152 |
-
die();
|
153 |
-
|
154 |
-
}
|
155 |
-
|
156 |
|
157 |
/****** Get Set name from post or page and output the set,
|
158 |
used in yasr-metabox-multiple-rating******/
|
27 |
|
28 |
/****** Get id and overall rating from post or page and write it in db, used in yasr-metabox-overall-rating******/
|
29 |
|
30 |
+
/*add_action( 'wp_ajax_yasr_send_overall_rating', 'yasr_insert_overall_rating_callback' );
|
31 |
|
32 |
function yasr_insert_overall_rating_callback() {
|
33 |
|
53 |
$rating = (float)$rating;
|
54 |
|
55 |
if ($rating > 5) {
|
|
|
56 |
$rating = 5;
|
|
|
57 |
}
|
58 |
|
59 |
//Put an action to hook into
|
90 |
|
91 |
die(); // this is required to return a proper result
|
92 |
|
93 |
+
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
/****** Get Set name from post or page and output the set,
|
96 |
used in yasr-metabox-multiple-rating******/
|
lib/yasr-db-functions.php
CHANGED
@@ -126,7 +126,7 @@ function yasr_install() {
|
|
126 |
|
127 |
|
128 |
/*
|
129 |
-
* Get overall rating from yasr_votes
|
130 |
* yasr_add_filter_for_schema(), yasr_get_id_value_callback()
|
131 |
* and yasr_rest_get_overall_rating
|
132 |
*
|
@@ -137,15 +137,11 @@ function yasr_get_overall_rating($post_id=FALSE, $create_transient=TRUE) {
|
|
137 |
//if values it's not passed get the post id, since version 1.6.9 this is just for yasr_add_schema function
|
138 |
//and for a further check
|
139 |
if(!$post_id) {
|
140 |
-
|
141 |
$post_id=get_the_ID();
|
142 |
-
|
143 |
}
|
144 |
|
145 |
if (!$post_id) {
|
146 |
-
|
147 |
return;
|
148 |
-
|
149 |
}
|
150 |
|
151 |
$post_id = (int)$post_id;
|
@@ -159,24 +155,18 @@ function yasr_get_overall_rating($post_id=FALSE, $create_transient=TRUE) {
|
|
159 |
|
160 |
//if transient exists return it
|
161 |
if ($transient_overall) {
|
162 |
-
|
163 |
return $transient_overall;
|
164 |
-
|
165 |
}
|
166 |
|
167 |
//get value from db
|
168 |
else {
|
169 |
-
|
170 |
$overall_rating = get_post_meta($post_id, 'yasr_overall_rating', TRUE);
|
171 |
-
|
172 |
}
|
173 |
|
174 |
if ($overall_rating) {
|
175 |
|
176 |
if ($create_transient === TRUE) {
|
177 |
-
|
178 |
set_transient( $transient_name, $overall_rating, WEEK_IN_SECONDS );
|
179 |
-
|
180 |
}
|
181 |
|
182 |
}
|
@@ -189,8 +179,6 @@ function yasr_get_overall_rating($post_id=FALSE, $create_transient=TRUE) {
|
|
189 |
/****** Return the snippet choosen for a post or page ******/
|
190 |
function yasr_get_snippet_type() {
|
191 |
|
192 |
-
global $wpdb;
|
193 |
-
|
194 |
$post_id=get_the_ID();
|
195 |
|
196 |
if (!$post_id) {
|
@@ -202,21 +190,16 @@ function yasr_get_snippet_type() {
|
|
202 |
$result = get_post_meta($post_id, 'yasr_review_type', TRUE);
|
203 |
|
204 |
if($result) {
|
205 |
-
|
206 |
$snippet_type = trim($result);
|
207 |
|
208 |
if ($snippet_type != 'Product' && $snippet_type != 'Place' && $snippet_type != 'Recipe' && $snippet_type != 'Other') {
|
209 |
-
|
210 |
$snippet_type = YASR_ITEMTYPE;
|
211 |
-
|
212 |
}
|
213 |
|
214 |
}
|
215 |
|
216 |
else {
|
217 |
-
|
218 |
$snippet_type = YASR_ITEMTYPE;
|
219 |
-
|
220 |
}
|
221 |
|
222 |
return $snippet_type;
|
@@ -385,9 +368,7 @@ function yasr_get_multi_set_visitor ($post_id, $set_type) {
|
|
385 |
$result = get_transient( 'yasr_visitor_multi_set_' . $post_id . '_' . $set_type );
|
386 |
|
387 |
if ($result !== FALSE) {
|
388 |
-
|
389 |
return $result;
|
390 |
-
|
391 |
}
|
392 |
|
393 |
global $wpdb;
|
@@ -404,9 +385,7 @@ function yasr_get_multi_set_visitor ($post_id, $set_type) {
|
|
404 |
//Should be never empty because first time it's called
|
405 |
//all values are set to 0, just to be safe
|
406 |
if(!empty($result)) {
|
407 |
-
|
408 |
set_transient('yasr_visitor_multi_set_' . $post_id . '_' . $set_type, $result, WEEK_IN_SECONDS );
|
409 |
-
|
410 |
}
|
411 |
|
412 |
return $result;
|
@@ -425,7 +404,7 @@ function yasr_get_visitor_votes ($post_id=FALSE, $create_transient=TRUE) {
|
|
425 |
}
|
426 |
|
427 |
if (!$post_id) {
|
428 |
-
return;
|
429 |
}
|
430 |
|
431 |
$transient_name = 'yasr_visitor_votes_' . $post_id;
|
@@ -443,9 +422,7 @@ function yasr_get_visitor_votes ($post_id=FALSE, $create_transient=TRUE) {
|
|
443 |
$result = $wpdb->get_results($wpdb->prepare("SELECT SUM(vote) AS sum_votes, COUNT(vote) as number_of_votes FROM " . YASR_LOG_TABLE . " WHERE post_id=%d", $post_id));
|
444 |
|
445 |
if ($create_transient == TRUE) {
|
446 |
-
|
447 |
set_transient( $transient_name, $result, WEEK_IN_SECONDS );
|
448 |
-
|
449 |
}
|
450 |
|
451 |
return $result;
|
@@ -845,6 +822,127 @@ add_action ('admin_init', 'admin_init_delete_data_on_post_callback');
|
|
845 |
}
|
846 |
|
847 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
848 |
|
849 |
|
850 |
/******* Add post_meta on save_post if this post is excluded for auto insert *******/
|
@@ -853,9 +951,7 @@ if (YASR_AUTO_INSERT_ENABLED == 1 ) {
|
|
853 |
|
854 |
add_action( 'save_post', 'yasr_exclude_auto_insert_callback' );
|
855 |
|
856 |
-
function yasr_exclude_auto_insert_callback() {
|
857 |
-
|
858 |
-
$post_id = get_the_ID();
|
859 |
|
860 |
if(isset($_POST['yasr_auto_insert_disabled'])) {
|
861 |
update_post_meta($post_id, 'yasr_auto_insert_disabled', 'yes');
|
@@ -865,7 +961,6 @@ if (YASR_AUTO_INSERT_ENABLED == 1 ) {
|
|
865 |
delete_post_meta($post_id, 'yasr_auto_insert_disabled');
|
866 |
}
|
867 |
|
868 |
-
|
869 |
}
|
870 |
|
871 |
}
|
126 |
|
127 |
|
128 |
/*
|
129 |
+
* Get overall rating from yasr_votes table used in
|
130 |
* yasr_add_filter_for_schema(), yasr_get_id_value_callback()
|
131 |
* and yasr_rest_get_overall_rating
|
132 |
*
|
137 |
//if values it's not passed get the post id, since version 1.6.9 this is just for yasr_add_schema function
|
138 |
//and for a further check
|
139 |
if(!$post_id) {
|
|
|
140 |
$post_id=get_the_ID();
|
|
|
141 |
}
|
142 |
|
143 |
if (!$post_id) {
|
|
|
144 |
return;
|
|
|
145 |
}
|
146 |
|
147 |
$post_id = (int)$post_id;
|
155 |
|
156 |
//if transient exists return it
|
157 |
if ($transient_overall) {
|
|
|
158 |
return $transient_overall;
|
|
|
159 |
}
|
160 |
|
161 |
//get value from db
|
162 |
else {
|
|
|
163 |
$overall_rating = get_post_meta($post_id, 'yasr_overall_rating', TRUE);
|
|
|
164 |
}
|
165 |
|
166 |
if ($overall_rating) {
|
167 |
|
168 |
if ($create_transient === TRUE) {
|
|
|
169 |
set_transient( $transient_name, $overall_rating, WEEK_IN_SECONDS );
|
|
|
170 |
}
|
171 |
|
172 |
}
|
179 |
/****** Return the snippet choosen for a post or page ******/
|
180 |
function yasr_get_snippet_type() {
|
181 |
|
|
|
|
|
182 |
$post_id=get_the_ID();
|
183 |
|
184 |
if (!$post_id) {
|
190 |
$result = get_post_meta($post_id, 'yasr_review_type', TRUE);
|
191 |
|
192 |
if($result) {
|
|
|
193 |
$snippet_type = trim($result);
|
194 |
|
195 |
if ($snippet_type != 'Product' && $snippet_type != 'Place' && $snippet_type != 'Recipe' && $snippet_type != 'Other') {
|
|
|
196 |
$snippet_type = YASR_ITEMTYPE;
|
|
|
197 |
}
|
198 |
|
199 |
}
|
200 |
|
201 |
else {
|
|
|
202 |
$snippet_type = YASR_ITEMTYPE;
|
|
|
203 |
}
|
204 |
|
205 |
return $snippet_type;
|
368 |
$result = get_transient( 'yasr_visitor_multi_set_' . $post_id . '_' . $set_type );
|
369 |
|
370 |
if ($result !== FALSE) {
|
|
|
371 |
return $result;
|
|
|
372 |
}
|
373 |
|
374 |
global $wpdb;
|
385 |
//Should be never empty because first time it's called
|
386 |
//all values are set to 0, just to be safe
|
387 |
if(!empty($result)) {
|
|
|
388 |
set_transient('yasr_visitor_multi_set_' . $post_id . '_' . $set_type, $result, WEEK_IN_SECONDS );
|
|
|
389 |
}
|
390 |
|
391 |
return $result;
|
404 |
}
|
405 |
|
406 |
if (!$post_id) {
|
407 |
+
return ;
|
408 |
}
|
409 |
|
410 |
$transient_name = 'yasr_visitor_votes_' . $post_id;
|
422 |
$result = $wpdb->get_results($wpdb->prepare("SELECT SUM(vote) AS sum_votes, COUNT(vote) as number_of_votes FROM " . YASR_LOG_TABLE . " WHERE post_id=%d", $post_id));
|
423 |
|
424 |
if ($create_transient == TRUE) {
|
|
|
425 |
set_transient( $transient_name, $result, WEEK_IN_SECONDS );
|
|
|
426 |
}
|
427 |
|
428 |
return $result;
|
822 |
}
|
823 |
|
824 |
|
825 |
+
/********** Save Post actions **********/
|
826 |
+
|
827 |
+
add_action('save_post', 'yasr_insert_overall_rating_callback');
|
828 |
+
add_action( 'wp_ajax_yasr_send_overall_rating', 'yasr_insert_overall_rating_callback' );
|
829 |
+
|
830 |
+
function yasr_insert_overall_rating_callback ($post_id) {
|
831 |
+
|
832 |
+
$is_ajax = FALSE;
|
833 |
+
$update_result = null;
|
834 |
+
|
835 |
+
if (isset($_POST['yasr_overall_rating']) && isset($_POST['yasr_nonce_overall_rating'])) {
|
836 |
+
$rating = $_POST['yasr_overall_rating'];
|
837 |
+
$nonce = $_POST['yasr_nonce_overall_rating'];
|
838 |
+
|
839 |
+
if (!$post_id) {
|
840 |
+
$post_id = $_POST['post_id'];
|
841 |
+
$is_ajax = TRUE;
|
842 |
+
}
|
843 |
+
|
844 |
+
}
|
845 |
+
|
846 |
+
else {
|
847 |
+
if ($is_ajax === TRUE) {
|
848 |
+
echo json_encode('KO');
|
849 |
+
}
|
850 |
+
return;
|
851 |
+
}
|
852 |
+
|
853 |
+
if ( ! current_user_can( 'publish_posts' ) ) {
|
854 |
+
wp_die( __( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ) );
|
855 |
+
}
|
856 |
+
|
857 |
+
if ( ! wp_verify_nonce( $nonce, 'yasr_nonce_overall_rating_action' ) ) {
|
858 |
+
die( 'Security check' );
|
859 |
+
}
|
860 |
+
|
861 |
+
$rating = (float)$rating;
|
862 |
+
|
863 |
+
if ($rating > 5) {
|
864 |
+
$rating = 5;
|
865 |
+
}
|
866 |
+
|
867 |
+
//Put an action to hook into
|
868 |
+
do_action('yasr_action_on_overall_rating', $post_id, $rating);
|
869 |
+
|
870 |
+
$update_result = update_post_meta($post_id, 'yasr_overall_rating', $rating );
|
871 |
+
|
872 |
+
//if update_post_meta returns an integer means this is a new post
|
873 |
+
//so we're going to insert the default YASR_ITEMTYPE
|
874 |
+
if (is_int($update_result)) {
|
875 |
+
add_post_meta($post_id, 'yasr_review_type', YASR_ITEMTYPE);
|
876 |
+
}
|
877 |
+
|
878 |
+
//this will not work on error or
|
879 |
+
//if the value is the same in the db
|
880 |
+
if ($update_result) {
|
881 |
+
|
882 |
+
$transient_name = 'yasr_overall_rating_' . $post_id;
|
883 |
+
|
884 |
+
set_transient( $transient_name, $rating, WEEK_IN_SECONDS );
|
885 |
+
|
886 |
+
if ($is_ajax === TRUE) {
|
887 |
+
echo json_encode('OK');
|
888 |
+
}
|
889 |
+
|
890 |
+
}
|
891 |
+
|
892 |
+
if ($is_ajax === TRUE) {
|
893 |
+
die();
|
894 |
+
}
|
895 |
+
|
896 |
+
}
|
897 |
+
|
898 |
+
|
899 |
+
add_action( 'save_post', 'yasr_insert_review_type_callback' );
|
900 |
+
|
901 |
+
function yasr_insert_review_type_callback ($post_id) {
|
902 |
+
|
903 |
+
if (isset($_POST['yasr-review-type']) && isset($_POST['yasr_nonce_review_type'])) {
|
904 |
+
$reviewtype = $_POST['yasr-review-type'];
|
905 |
+
$nonce = $_POST['yasr_nonce_review_type'];
|
906 |
+
}
|
907 |
+
|
908 |
+
else {
|
909 |
+
return;
|
910 |
+
}
|
911 |
+
|
912 |
+
if ( ! current_user_can( 'publish_posts' ) ) {
|
913 |
+
wp_die( __( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ) );
|
914 |
+
}
|
915 |
+
|
916 |
+
if ( ! wp_verify_nonce( $nonce, 'yasr_nonce_review_type_action' ) ) {
|
917 |
+
die( 'Security check' );
|
918 |
+
}
|
919 |
+
|
920 |
+
|
921 |
+
$post_id = (int)$post_id;
|
922 |
+
|
923 |
+
if ($reviewtype === "1") {
|
924 |
+
$reviewtype = 'Product';
|
925 |
+
}
|
926 |
+
|
927 |
+
elseif ($reviewtype === "2") {
|
928 |
+
$reviewtype = 'Place';
|
929 |
+
}
|
930 |
+
|
931 |
+
elseif ($reviewtype === "3") {
|
932 |
+
$reviewtype = "Recipe";
|
933 |
+
}
|
934 |
+
|
935 |
+
elseif ($reviewtype === "4") {
|
936 |
+
$reviewtype = 'Other';
|
937 |
+
}
|
938 |
+
|
939 |
+
else {
|
940 |
+
return;
|
941 |
+
}
|
942 |
+
|
943 |
+
$review_type = update_post_meta($post_id, 'yasr_review_type', $reviewtype);
|
944 |
+
|
945 |
+
}
|
946 |
|
947 |
|
948 |
/******* Add post_meta on save_post if this post is excluded for auto insert *******/
|
951 |
|
952 |
add_action( 'save_post', 'yasr_exclude_auto_insert_callback' );
|
953 |
|
954 |
+
function yasr_exclude_auto_insert_callback($post_id) {
|
|
|
|
|
955 |
|
956 |
if(isset($_POST['yasr_auto_insert_disabled'])) {
|
957 |
update_post_meta($post_id, 'yasr_auto_insert_disabled', 'yes');
|
961 |
delete_post_meta($post_id, 'yasr_auto_insert_disabled');
|
962 |
}
|
963 |
|
|
|
964 |
}
|
965 |
|
966 |
}
|
lib/yasr-functions.php
CHANGED
@@ -47,12 +47,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
47 |
wp_add_inline_style( 'yasrcss', YASR_CUSTOM_CSS_RULES );
|
48 |
}
|
49 |
|
50 |
-
|
51 |
-
wp_enqueue_script( 'rater', YASR_JS_DIR . 'rater-js.js' , '', '0.6.0', TRUE );
|
52 |
-
}
|
53 |
-
else {
|
54 |
-
wp_enqueue_script( 'rater', YASR_JS_DIR . 'rater-js-rtl.js' , '', '0.6.0', TRUE );
|
55 |
-
}
|
56 |
|
57 |
wp_enqueue_script( 'yasrfront', YASR_JS_DIR . 'yasr-front.js' , array('jquery', 'rater'), YASR_VERSION_NUM, TRUE );
|
58 |
wp_enqueue_script('tippy', YASR_JS_DIR . 'tippy.all.min.js', '', '3.6.0', TRUE );
|
@@ -288,7 +283,7 @@ function yasr_rtl_support () {
|
|
288 |
function yasr_metabox_overall_rating_content() {
|
289 |
|
290 |
if ( current_user_can( 'publish_posts' ) ) {
|
291 |
-
include
|
292 |
}
|
293 |
else {
|
294 |
_e("You don't have enought privileges to insert Overall Rating");
|
@@ -299,7 +294,7 @@ function yasr_rtl_support () {
|
|
299 |
function yasr_metabox_multiple_rating_content() {
|
300 |
|
301 |
if ( current_user_can( 'publish_posts' ) ) {
|
302 |
-
include
|
303 |
}
|
304 |
else {
|
305 |
_e("You don't have enough privileges to insert a Multi Set");
|
@@ -667,11 +662,8 @@ add_filter('the_content', 'yasr_add_schema');
|
|
667 |
function yasr_select_itemtype() {
|
668 |
|
669 |
$i18n_array_review = __('Product, Place, Recipe, BlogPosting', 'yet-another-stars-rating');
|
670 |
-
|
671 |
$array_review_type = explode(',', $i18n_array_review);
|
672 |
-
|
673 |
$review_type = array_map('trim', $array_review_type);
|
674 |
-
|
675 |
$review_type_choosen = yasr_get_snippet_type();
|
676 |
|
677 |
switch ($review_type_choosen) {
|
@@ -691,7 +683,7 @@ add_filter('the_content', 'yasr_add_schema');
|
|
691 |
|
692 |
?>
|
693 |
|
694 |
-
<select id="yasr-choose-reviews-types-list">
|
695 |
|
696 |
<?php
|
697 |
|
@@ -699,7 +691,7 @@ add_filter('the_content', 'yasr_add_schema');
|
|
699 |
|
700 |
foreach ($review_type as $type) {
|
701 |
|
702 |
-
if ($i
|
703 |
echo "<option value=\"$i\" selected>$type</option>";
|
704 |
}
|
705 |
|
@@ -1013,4 +1005,72 @@ function yasr_delete_cache($array_action_visitor_vote) {
|
|
1013 |
|
1014 |
}
|
1015 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1016 |
?>
|
47 |
wp_add_inline_style( 'yasrcss', YASR_CUSTOM_CSS_RULES );
|
48 |
}
|
49 |
|
50 |
+
wp_enqueue_script( 'rater', YASR_JS_DIR . 'rater-js.js' , '', YASR_VERSION_NUM, TRUE );
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
wp_enqueue_script( 'yasrfront', YASR_JS_DIR . 'yasr-front.js' , array('jquery', 'rater'), YASR_VERSION_NUM, TRUE );
|
53 |
wp_enqueue_script('tippy', YASR_JS_DIR . 'tippy.all.min.js', '', '3.6.0', TRUE );
|
283 |
function yasr_metabox_overall_rating_content() {
|
284 |
|
285 |
if ( current_user_can( 'publish_posts' ) ) {
|
286 |
+
include(YASR_ABSOLUTE_PATH . '/lib/admin/yasr-metabox-top-right.php');
|
287 |
}
|
288 |
else {
|
289 |
_e("You don't have enought privileges to insert Overall Rating");
|
294 |
function yasr_metabox_multiple_rating_content() {
|
295 |
|
296 |
if ( current_user_can( 'publish_posts' ) ) {
|
297 |
+
include(YASR_ABSOLUTE_PATH . '/lib/admin/yasr-metabox-multiple-rating.php');
|
298 |
}
|
299 |
else {
|
300 |
_e("You don't have enough privileges to insert a Multi Set");
|
662 |
function yasr_select_itemtype() {
|
663 |
|
664 |
$i18n_array_review = __('Product, Place, Recipe, BlogPosting', 'yet-another-stars-rating');
|
|
|
665 |
$array_review_type = explode(',', $i18n_array_review);
|
|
|
666 |
$review_type = array_map('trim', $array_review_type);
|
|
|
667 |
$review_type_choosen = yasr_get_snippet_type();
|
668 |
|
669 |
switch ($review_type_choosen) {
|
683 |
|
684 |
?>
|
685 |
|
686 |
+
<select name="yasr-review-type" id="yasr-choose-reviews-types-list">
|
687 |
|
688 |
<?php
|
689 |
|
691 |
|
692 |
foreach ($review_type as $type) {
|
693 |
|
694 |
+
if ($i === $review_type_choosen) {
|
695 |
echo "<option value=\"$i\" selected>$type</option>";
|
696 |
}
|
697 |
|
1005 |
|
1006 |
}
|
1007 |
|
1008 |
+
|
1009 |
+
function yasr_check_valid_url ($url) {
|
1010 |
+
|
1011 |
+
$timeout = 5;
|
1012 |
+
|
1013 |
+
//Check if url is valid
|
1014 |
+
if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
|
1015 |
+
|
1016 |
+
//Check if curl is installed
|
1017 |
+
if (function_exists('curl_version')) {
|
1018 |
+
|
1019 |
+
$ch = curl_init();
|
1020 |
+
curl_setopt($ch, CURLOPT_URL, $url);
|
1021 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1022 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
1023 |
+
|
1024 |
+
//execute curl
|
1025 |
+
$http_respond = trim(strip_tags(curl_exec($ch)));
|
1026 |
+
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
1027 |
+
|
1028 |
+
//Check the response
|
1029 |
+
if (($http_code == "200") || ($http_code == "302")) {
|
1030 |
+
return true;
|
1031 |
+
}
|
1032 |
+
else
|
1033 |
+
{
|
1034 |
+
return false;
|
1035 |
+
}
|
1036 |
+
//close curl
|
1037 |
+
curl_close($ch);
|
1038 |
+
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
//if curl is not installed, use file_get_contents
|
1042 |
+
else {
|
1043 |
+
|
1044 |
+
//...but only if enabled on the server!
|
1045 |
+
if( ini_get('allow_url_fopen') ) {
|
1046 |
+
|
1047 |
+
//Change timeout for file_get_contents
|
1048 |
+
ini_set('default_socket_timeout', $timeout); //5 seconds
|
1049 |
+
|
1050 |
+
$headers = get_headers($url, 1);
|
1051 |
+
$string_to_check = '200 OK';
|
1052 |
+
|
1053 |
+
//check if in the first heade we've 200 OK
|
1054 |
+
if (strpos($headers[0], $string_to_check) !== false) {
|
1055 |
+
return true;
|
1056 |
+
}
|
1057 |
+
else {
|
1058 |
+
return false;
|
1059 |
+
}
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
//if url_fopen is not enabled
|
1063 |
+
else {
|
1064 |
+
return false;
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
}
|
1068 |
+
}
|
1069 |
+
|
1070 |
+
else {
|
1071 |
+
return false;
|
1072 |
+
}
|
1073 |
+
|
1074 |
+
}
|
1075 |
+
|
1076 |
?>
|
lib/yasr-shortcode-functions.php
CHANGED
@@ -56,7 +56,10 @@ add_shortcode ('yasr_overall_rating', 'shortcode_overall_rating_callback');
|
|
56 |
$unique_id = str_shuffle(uniqid());
|
57 |
|
58 |
$overall_rating_html_id = 'yasr-overall-rating-rater-' . $unique_id;
|
59 |
-
$html_stars = "<div class
|
|
|
|
|
|
|
60 |
|
61 |
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
|
62 |
|
56 |
$unique_id = str_shuffle(uniqid());
|
57 |
|
58 |
$overall_rating_html_id = 'yasr-overall-rating-rater-' . $unique_id;
|
59 |
+
$html_stars = "<div class='yasr-overall-rating'>
|
60 |
+
<div class=\"yasr-rater-stars\" id=\"$overall_rating_html_id\" data-rating=\"$overall_rating\" data-rater-starsize=\"$stars_attribute[px_size]\" ></div>
|
61 |
+
</div>
|
62 |
+
";
|
63 |
|
64 |
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
|
65 |
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.3.0
|
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.1
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 1.
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
|
@@ -66,7 +66,8 @@ Do you want more feature? [Check out Yasr Pro!](https://yetanotherstarsrating.co
|
|
66 |
It is the vote given by who writes the review: readers are able to see this vote in read-only mode. Reviewer can vote using the box on the top rigth when writing a new article or post (he or she must have at least the "Author" role). Remember to insert this shortcode **[yasr_overall_rating]** to make it appear where you like. You can choose to make it appear just in a single post/page or in archive pages too (e.g. default Index, category pages, etc).
|
67 |
|
68 |
= What is "Visitor Rating"? =
|
69 |
-
It is the vote that allows your visitors to vote: just paste this shortcode **[yasr_visitor_votes]** where you want the stars to appear.
|
|
|
70 |
|
71 |
[Demo page for Overall Rating and Vistor Rating](https://yetanotherstarsrating.com/yasr-basics-shortcode/)
|
72 |
|
@@ -93,15 +94,15 @@ When a visitor (logged in or not) rates a post/page, his rating is stored in the
|
|
93 |
[Demo page for Rankings](https://yetanotherstarsrating.com/yasr-rankings/)
|
94 |
|
95 |
= Wait, wait! Do I need to keep in mind all this shortcode? =
|
96 |
-
|
|
|
97 |
|
98 |
= Does it work with caching plugins? =
|
99 |
Most def! Yasr supports these caching plugins:
|
100 |
* [Wp Super Cache](https://wordpress.org/plugins/wp-super-cache/)
|
101 |
* [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
|
102 |
-
* [Cache Enabler – WordPress Cache](https://wordpress.org/plugins/cache-enabler/)
|
103 |
* [Wp Fastest Cache](https://wordpress.org/plugins/wp-fastest-cache/)
|
104 |
-
* [Wp Rocket]
|
105 |
|
106 |
= Why I don't see stars in google? =
|
107 |
Please be sure that if you use mostly the "yasr_visitor_votes" shortcode, you've to select "Aggregate Rating" to the question "Which rich snippet do you want to use?" in the General Settings.
|
@@ -112,7 +113,6 @@ If you set up everythings fine, in 99% of cases your stars will appear in a week
|
|
112 |
If doesn't, it's suggested to ask in a SEO oriented forum.
|
113 |
|
114 |
|
115 |
-
|
116 |
== Screenshots ==
|
117 |
1. Example of yasr in a videogame review
|
118 |
2. Another example of a restaurant review
|
@@ -124,6 +124,17 @@ If doesn't, it's suggested to ask in a SEO oriented forum.
|
|
124 |
|
125 |
The full changelog can be found in the plugin's directory. Recent entries:
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
= 1.8.9 =
|
128 |
* FIXED: updated freemius sdk to version 2.2.4
|
129 |
|
@@ -154,36 +165,6 @@ The full changelog can be found in the plugin's directory. Recent entries:
|
|
154 |
* FIXED: multiset doesn't show up in the edit screen if only 1 is used
|
155 |
|
156 |
|
157 |
-
|
158 |
-
= 1.8.2 =
|
159 |
-
* FIXED: widgets didn't load in front end
|
160 |
-
|
161 |
-
= 1.8.1 =
|
162 |
-
* Rounded stars again available
|
163 |
-
|
164 |
-
= 1.8.0 =
|
165 |
-
* This is a very important release. A lot of code has been cleaned up/rewritten. Images are not png anymore, but svg.
|
166 |
-
Everthing is now fresher and even more lightweight then before. If you customized your stars set, check it again in the settings.
|
167 |
-
|
168 |
-
|
169 |
-
= 1.7.4 =
|
170 |
-
* Css fixes
|
171 |
-
|
172 |
-
= 1.7.3 =
|
173 |
-
* FIXED: Multi set's field name is now 40 chars long instead of 23
|
174 |
-
* TWEAKED: progress bars doesn't use jquery anymore, it's css only
|
175 |
-
* TWEAKED: tooltip for yasr_visitor_votes doesn't use jquery anymore, but uses [tippy](https://atomiks.github.io/tippyjs/) instead
|
176 |
-
* TWEAKED: A lot of under the hood changes
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
= 1.7.2 =
|
181 |
-
* FIXED: yasr_visitor_multiset didn't work
|
182 |
-
|
183 |
-
= 1.7.1 =
|
184 |
-
* FIXED: security fix
|
185 |
-
|
186 |
-
|
187 |
= Additional Info =
|
188 |
External Libraries: [Rater](https://github.com/fredolss/rater-js)
|
189 |
[tippy](https://atomiks.github.io/tippyjs/)
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 5.1
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 1.9.0
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
|
66 |
It is the vote given by who writes the review: readers are able to see this vote in read-only mode. Reviewer can vote using the box on the top rigth when writing a new article or post (he or she must have at least the "Author" role). Remember to insert this shortcode **[yasr_overall_rating]** to make it appear where you like. You can choose to make it appear just in a single post/page or in archive pages too (e.g. default Index, category pages, etc).
|
67 |
|
68 |
= What is "Visitor Rating"? =
|
69 |
+
It is the vote that allows your visitors to vote: just paste this shortcode **[yasr_visitor_votes]** where you want the stars to appear.
|
70 |
+
[See the supported caching plugins](https://wordpress.org/plugins/yet-another-stars-rating/#does%20it%20work%20with%20caching%20plugins%3F)
|
71 |
|
72 |
[Demo page for Overall Rating and Vistor Rating](https://yetanotherstarsrating.com/yasr-basics-shortcode/)
|
73 |
|
94 |
[Demo page for Rankings](https://yetanotherstarsrating.com/yasr-rankings/)
|
95 |
|
96 |
= Wait, wait! Do I need to keep in mind all this shortcode? =
|
97 |
+
If you're using the new Gutenberg editor, you don't need at all: just use the blocks.
|
98 |
+
If, instead, you're using the classic editor, in the visual tab just click the "Yasr Shortcode" button above the editor
|
99 |
|
100 |
= Does it work with caching plugins? =
|
101 |
Most def! Yasr supports these caching plugins:
|
102 |
* [Wp Super Cache](https://wordpress.org/plugins/wp-super-cache/)
|
103 |
* [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
|
|
|
104 |
* [Wp Fastest Cache](https://wordpress.org/plugins/wp-fastest-cache/)
|
105 |
+
* [Wp Rocket](https://wp-rocket.me)
|
106 |
|
107 |
= Why I don't see stars in google? =
|
108 |
Please be sure that if you use mostly the "yasr_visitor_votes" shortcode, you've to select "Aggregate Rating" to the question "Which rich snippet do you want to use?" in the General Settings.
|
113 |
If doesn't, it's suggested to ask in a SEO oriented forum.
|
114 |
|
115 |
|
|
|
116 |
== Screenshots ==
|
117 |
1. Example of yasr in a videogame review
|
118 |
2. Another example of a restaurant review
|
124 |
|
125 |
The full changelog can be found in the plugin's directory. Recent entries:
|
126 |
|
127 |
+
= 1.9.0 =
|
128 |
+
* NEW FEATURE: yasr_visitor_votes is now a Gutenberg block
|
129 |
+
* FIXED: In Gutenberg, when using yasr_overall_rating block, if post is rated and size or post_id is changed, stars got full filled
|
130 |
+
* TWEAKED: In classic editor, now overall_rating get saved along with the post update/save
|
131 |
+
* FIXED: In classic editor, review type didn't get saved if post is updated just after the type was changed
|
132 |
+
* TWEAKED: updated rater library
|
133 |
+
* TWEAKED: added a div with class "yasr-overall-rating" in the front end shortcode to allow customization
|
134 |
+
* TWEAKED: dropped out support for extensions
|
135 |
+
* TWEAKED: minor changes
|
136 |
+
|
137 |
+
|
138 |
= 1.8.9 =
|
139 |
* FIXED: updated freemius sdk to version 2.2.4
|
140 |
|
165 |
* FIXED: multiset doesn't show up in the edit screen if only 1 is used
|
166 |
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
= Additional Info =
|
169 |
External Libraries: [Rater](https://github.com/fredolss/rater-js)
|
170 |
[tippy](https://atomiks.github.io/tippyjs/)
|
yasr-metabox-top-right.php
DELETED
@@ -1,261 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
|
5 |
-
Copyright 2014 Dario Curvino (email : d.curvino@tiscali.it)
|
6 |
-
|
7 |
-
This program is free software: you can redistribute it and/or modify
|
8 |
-
it under the terms of the GNU General Public License as published by
|
9 |
-
the Free Software Foundation, either version 2 of the License, or
|
10 |
-
(at your option) any later version.
|
11 |
-
|
12 |
-
This program is distributed in the hope that it will be useful,
|
13 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
-
GNU General Public License for more details.
|
16 |
-
|
17 |
-
You should have received a copy of the GNU General Public License
|
18 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>
|
19 |
-
*/
|
20 |
-
|
21 |
-
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
|
22 |
-
|
23 |
-
$post_id=get_the_ID();
|
24 |
-
|
25 |
-
$overall_rating=yasr_get_overall_rating($post_id);
|
26 |
-
|
27 |
-
if (!$overall_rating) {
|
28 |
-
$overall_rating = "0";
|
29 |
-
}
|
30 |
-
|
31 |
-
//This is for the select
|
32 |
-
if($overall_rating != '-1') {
|
33 |
-
|
34 |
-
$overall_rating_array = explode(".", $overall_rating);
|
35 |
-
$int = $overall_rating_array[0];
|
36 |
-
|
37 |
-
if($int < 5 && array_key_exists(1, $overall_rating_array) == TRUE) {
|
38 |
-
$dec = $overall_rating_array[1];
|
39 |
-
}
|
40 |
-
|
41 |
-
else {
|
42 |
-
|
43 |
-
$dec = 0;
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
}
|
48 |
-
|
49 |
-
else {
|
50 |
-
$int = 0;
|
51 |
-
$dec = 0;
|
52 |
-
}
|
53 |
-
|
54 |
-
$ajax_nonce_overall = wp_create_nonce( "yasr_nonce_insert_overall_rating" );
|
55 |
-
|
56 |
-
$ajax_nonce_review_type = wp_create_nonce( "yasr_nonce_review_type" );
|
57 |
-
|
58 |
-
?>
|
59 |
-
|
60 |
-
|
61 |
-
<div id="yasr-matabox-top-right">
|
62 |
-
|
63 |
-
<?php
|
64 |
-
|
65 |
-
if (YASR_METABOX_OVERALL_RATING != 'numbers') {
|
66 |
-
|
67 |
-
?>
|
68 |
-
|
69 |
-
<div id="yasr-vote-overall-stars-container">
|
70 |
-
|
71 |
-
<div id="yasr-vote-overall-stars">
|
72 |
-
<span id="yasr-rateit-vote-overall-text">
|
73 |
-
<?php _e("Rate this article / item", 'yet-another-stars-rating'); ?>
|
74 |
-
</span>
|
75 |
-
|
76 |
-
<div id="yasr-rater-overall" >
|
77 |
-
</div>
|
78 |
-
|
79 |
-
<div id="loader-overall-rating" style="display:none;" > <?php _e("Loading, please wait",'yet-another-stars-rating'); ?><img src="<?php echo YASR_IMG_DIR . "/loader.gif" ?>">
|
80 |
-
</div>
|
81 |
-
|
82 |
-
</p>
|
83 |
-
|
84 |
-
<div>
|
85 |
-
<span id="yasr_rateit_overall_value"></span>
|
86 |
-
</div>
|
87 |
-
</div>
|
88 |
-
|
89 |
-
</div> <!--End stars container-->
|
90 |
-
|
91 |
-
<?php
|
92 |
-
|
93 |
-
} //End if (YASR_METABOX_OVERALL_RATING == 'stars') {
|
94 |
-
|
95 |
-
else {
|
96 |
-
|
97 |
-
?>
|
98 |
-
|
99 |
-
<div id="yasr-vote-with-numbers-container">
|
100 |
-
|
101 |
-
<div id="yasr-vote-with-numbers" >
|
102 |
-
|
103 |
-
<span id="yasr-rateit-vote-overall-text">
|
104 |
-
<?php _e("Rate this article / item", 'yet-another-stars-rating'); ?>
|
105 |
-
</span>
|
106 |
-
|
107 |
-
<div id="yasr-vote-with-numbers-select-container">
|
108 |
-
|
109 |
-
<select name="yasr-vote-overall-numbers-int" id="yasr-vote-overall-numbers-int" class="yasr-vote-overall-numbers">
|
110 |
-
|
111 |
-
<?php
|
112 |
-
|
113 |
-
for ($i=0; $i<=5; $i++) {
|
114 |
-
|
115 |
-
if ($i == $int) {
|
116 |
-
echo "<option value=\"$i\" selected=\"selected\">$i</option>\n";
|
117 |
-
}
|
118 |
-
|
119 |
-
else {
|
120 |
-
echo "<option value=\"$i\">$i</option>\n";
|
121 |
-
}
|
122 |
-
}
|
123 |
-
|
124 |
-
?>
|
125 |
-
|
126 |
-
</select>
|
127 |
-
|
128 |
-
<span id="yasr-comma-between-select">,</span>
|
129 |
-
|
130 |
-
<select name="yasr-vote-overall-numbers-dec" id="yasr-vote-overall-numbers-dec" class="yasr-vote-overall-numbers">
|
131 |
-
|
132 |
-
<?php
|
133 |
-
|
134 |
-
for ($i=0; $i<=9; $i++) {
|
135 |
-
if ($i == $dec) {
|
136 |
-
echo "<option value=\"$i\" selected=\"selected\">$i</option>\n";
|
137 |
-
}
|
138 |
-
|
139 |
-
else {
|
140 |
-
echo "<option value=\"$i\">$i</option>\n";
|
141 |
-
}
|
142 |
-
}
|
143 |
-
|
144 |
-
?>
|
145 |
-
|
146 |
-
</select>
|
147 |
-
|
148 |
-
</div>
|
149 |
-
|
150 |
-
<p>
|
151 |
-
|
152 |
-
<button href="#" class="button-secondary" id="yasr-send-overall-numbers"><?php _e('Save Vote', 'yet-another-stars-rating'); ?></button>
|
153 |
-
|
154 |
-
<p>
|
155 |
-
|
156 |
-
<span id="yasr-overall-numbers-saved-confirm"></span>
|
157 |
-
|
158 |
-
</div>
|
159 |
-
|
160 |
-
</div> <!--End numbers container-->
|
161 |
-
|
162 |
-
<?php
|
163 |
-
|
164 |
-
} //End if YASR_METABOX_OVERALL_RATING == 'numbers'
|
165 |
-
|
166 |
-
?>
|
167 |
-
|
168 |
-
<hr>
|
169 |
-
|
170 |
-
<?php
|
171 |
-
|
172 |
-
if (YASR_AUTO_INSERT_ENABLED == 1) {
|
173 |
-
|
174 |
-
$is_this_post_exluded = get_post_meta($post_id, 'yasr_auto_insert_disabled', TRUE);
|
175 |
-
|
176 |
-
?>
|
177 |
-
|
178 |
-
<div id="yasr-toprightmetabox-disable-auto-insert">
|
179 |
-
|
180 |
-
<?php _e('Disable auto insert for this post or page?', 'yet-another-stars-rating'); ?>
|
181 |
-
|
182 |
-
<br />
|
183 |
-
|
184 |
-
<div class="yasr-onoffswitch-big" id="yasr-switcher-disable-auto-insert">
|
185 |
-
<input type="checkbox" name="yasr_auto_insert_disabled" class="yasr-onoffswitch-checkbox" value="yes" id="yasr-auto-insert-disabled-switch" <?php if ($is_this_post_exluded === 'yes') echo " checked='checked' "; ?> >
|
186 |
-
<label class="yasr-onoffswitch-label" for="yasr-auto-insert-disabled-switch">
|
187 |
-
<span class="yasr-onoffswitch-inner"></span>
|
188 |
-
<span class="yasr-onoffswitch-switch"></span>
|
189 |
-
</label>
|
190 |
-
</div>
|
191 |
-
|
192 |
-
|
193 |
-
</div>
|
194 |
-
|
195 |
-
<hr>
|
196 |
-
|
197 |
-
<?php
|
198 |
-
|
199 |
-
} //End if auto insert enabled
|
200 |
-
|
201 |
-
?>
|
202 |
-
|
203 |
-
<div class="yasr-choose-reviews-types"><?php _e("This review is about a...", "yet-another-stars-rating"); ?>
|
204 |
-
<br />
|
205 |
-
|
206 |
-
<?php yasr_select_itemtype(); ?>
|
207 |
-
|
208 |
-
<button href="#" class="button-secondary" id="yasr-send-review-type"><?php _e('Select', 'yet-another-stars-rating'); ?></button>
|
209 |
-
|
210 |
-
<br />
|
211 |
-
|
212 |
-
<span id="yasr-ajax-response-review-type"></span>
|
213 |
-
|
214 |
-
</div>
|
215 |
-
|
216 |
-
<p>
|
217 |
-
|
218 |
-
<div>
|
219 |
-
|
220 |
-
<?php
|
221 |
-
|
222 |
-
//Show this message if auto insert is off or if auto insert is not set to show overall rating (so if it is set to visitor rating)
|
223 |
-
if( YASR_AUTO_INSERT_ENABLED == 0 || (YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_WHAT === 'visitor_rating') ) {
|
224 |
-
|
225 |
-
echo "<div>";
|
226 |
-
_e ("Remember to insert this shortcode <strong>[yasr_overall_rating]</strong> where you want to display this rating", 'yet-another-stars-rating');
|
227 |
-
echo "</div>";
|
228 |
-
|
229 |
-
}
|
230 |
-
|
231 |
-
?>
|
232 |
-
|
233 |
-
</div>
|
234 |
-
|
235 |
-
<?php
|
236 |
-
|
237 |
-
do_action( 'yasr_add_content_bottom_topright_metabox', $post_id );
|
238 |
-
|
239 |
-
?>
|
240 |
-
|
241 |
-
</div>
|
242 |
-
|
243 |
-
<script type="text/javascript">
|
244 |
-
|
245 |
-
jQuery(document).ready(function() {
|
246 |
-
|
247 |
-
var defaultbox = <?php echo (json_encode(YASR_METABOX_OVERALL_RATING)); ?>;
|
248 |
-
|
249 |
-
var nonceOverall = <?php echo (json_encode("$ajax_nonce_overall")); ?>;
|
250 |
-
|
251 |
-
var nonceSnippet = <?php echo (json_encode("$ajax_nonce_review_type")); ?>;
|
252 |
-
|
253 |
-
var postid = <?php json_encode(the_ID()); ?>;
|
254 |
-
|
255 |
-
var overallRating = <?php echo (json_encode($overall_rating)); ?>
|
256 |
-
|
257 |
-
yasrDisplayTopRightMetabox(defaultbox, postid, nonceOverall, nonceSnippet, overallRating);
|
258 |
-
|
259 |
-
}); //End document ready
|
260 |
-
|
261 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
|
7 |
-
* Version: 1.
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://yetanotherstarsrating.com/
|
10 |
* Text Domain: yet-another-stars-rating
|
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
-
define( 'YASR_VERSION_NUM', '1.
|
80 |
//Plugin relative path
|
81 |
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
|
82 |
//Plugin RELATIVE PATH without slashes (just the directory's name)
|
@@ -138,7 +138,6 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
138 |
define( "YASR_BLOGPOSTING_ORGANIZATION_LOGO", $yasr_stored_options['blogposting_organization_logo'] );
|
139 |
}
|
140 |
}
|
141 |
-
define( "YASR_METABOX_OVERALL_RATING", $yasr_stored_options['metabox_overall_rating'] );
|
142 |
//Get stored style options
|
143 |
$style_options = get_option( 'yasr_style_options' );
|
144 |
global $style_options ;
|
@@ -287,9 +286,5 @@ if ( !function_exists( 'yasr_fs' ) ) {
|
|
287 |
|
288 |
return $links;
|
289 |
}
|
290 |
-
|
291 |
-
//End function
|
292 |
-
//this is for user who use extensions
|
293 |
-
//remove on Gen 2019
|
294 |
-
define( 'YASR_EDD_SL_STORE_URL', 'http://yetanotherstarsrating.com' );
|
295 |
}
|
4 |
* Plugin Name: Yet Another Stars Rating
|
5 |
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
|
6 |
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
|
7 |
+
* Version: 1.9.0
|
8 |
* Author: Dario Curvino
|
9 |
* Author URI: https://yetanotherstarsrating.com/
|
10 |
* Text Domain: yet-another-stars-rating
|
76 |
yasr_fs();
|
77 |
// Signal that SDK was initiated.
|
78 |
do_action( 'yasr_fs_loaded' );
|
79 |
+
define( 'YASR_VERSION_NUM', '1.9.0' );
|
80 |
//Plugin relative path
|
81 |
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
|
82 |
//Plugin RELATIVE PATH without slashes (just the directory's name)
|
138 |
define( "YASR_BLOGPOSTING_ORGANIZATION_LOGO", $yasr_stored_options['blogposting_organization_logo'] );
|
139 |
}
|
140 |
}
|
|
|
141 |
//Get stored style options
|
142 |
$style_options = get_option( 'yasr_style_options' );
|
143 |
global $style_options ;
|
286 |
|
287 |
return $links;
|
288 |
}
|
289 |
+
|
|
|
|
|
|
|
|
|
290 |
}
|