Version Description
- bugfixes
Download this release
Release Info
Developer | kucaahbe |
Plugin | Poll, Survey, Quiz, Slideshow, Form, Story & Landing Page |
Version | 19.6.18 |
Comparing to | |
See all releases |
Code changes from version 19.6.17 to 19.6.18
- admin/content-popup-gutenberg-template.html.php +15 -3
- admin/content-popup-template.html.php +19 -4
- admin/content-popup.php +13 -11
- admin/css/menu-page.css +2 -25
- admin/views/deactivate-feedback-form.php +19 -1
- admin/views/getting_started.php +33 -0
- admin/views/my_placements.php +3 -3
- admin/views/settings_track.php +1 -1
- admin/views/view_my_items.php +73 -34
- gutenberg/.editorconfig +21 -21
- gutenberg/.eslintignore +9 -9
- gutenberg/.eslintrc.json +192 -192
- gutenberg/.gitignore +84 -84
- gutenberg/form/dist/blocks.build.js +1 -1
- gutenberg/form/src/.DS_Store +0 -0
- gutenberg/form/src/block/block.js +168 -211
- gutenberg/init.php +8 -3
- gutenberg/personality/dist/blocks.build.js +1 -1
- gutenberg/personality/src/.DS_Store +0 -0
- gutenberg/personality/src/block/block.js +168 -209
- gutenberg/poll/dist/blocks.build.js +1 -1
- gutenberg/poll/src/.DS_Store +0 -0
- gutenberg/poll/src/block/block.js +167 -208
- gutenberg/slideshow/dist/blocks.build.js +1 -1
- gutenberg/slideshow/src/.DS_Store +0 -0
- gutenberg/slideshow/src/block/block.js +168 -210
- gutenberg/survey/dist/blocks.build.js +1 -1
- gutenberg/survey/src/.DS_Store +0 -0
- gutenberg/survey/src/block/block.js +168 -209
- gutenberg/trivia/dist/blocks.build.js +1 -1
- gutenberg/trivia/src/.DS_Store +0 -0
- gutenberg/trivia/src/block/block.js +170 -211
- includes/opinionstage-article-placement-functions.php +37 -37
- includes/opinionstage-functions.php +93 -93
- includes/opinionstage-sidebar-widget.php +1 -1
- opinionstage-polls.php +1 -1
- plugin.php +2 -2
- readme.txt +687 -685
admin/content-popup-gutenberg-template.html.php
CHANGED
@@ -55,7 +55,7 @@ function opinionstage_create_new_href() {
|
|
55 |
Â
<div class="header-right-container">
|
56 |
Â
<div class="header-right-inner-container">
|
57 |
Â
<div class='filter'>
|
58 |
-
<div class="dropdown">
|
59 |
Â
<button class="dropbtn gutenberg_dropdown" id="dropbtn"><span>All ITEMS</span></button>
|
60 |
Â
<div class="dropdown-content">
|
61 |
Â
<div class='filter__itm'
|
@@ -118,15 +118,17 @@ function opinionstage_create_new_href() {
|
|
118 |
Â
<div class='content__list'>
|
119 |
Â
<div v-if='hasData'>
|
120 |
Â
<div class='content__itm' v-for="widget in widgets">
|
Â
|
|
121 |
Â
<div class='content__image'>
|
122 |
Â
<img :src='widget.imageUrl'>
|
123 |
Â
<div class='content__label'>{{ widget.type }}</div>
|
124 |
Â
</div>
|
125 |
-
|
Â
|
|
126 |
Â
<div class='content__links'>
|
127 |
Â
<button class='popup-content-btn content__links-itm'
|
128 |
Â
@click="var shortcode = widget.landingPageUrl.replace('https://www.opinionstage.com',''); window.verifyOSInsert(shortcode)">insert</button>
|
129 |
-
<div class="dropdown">
|
130 |
Â
<div class="popup-action popup-content-btn"></div>
|
131 |
Â
<div class="content-item-menu">
|
132 |
Â
<div class="top-arrow-box"><div class="top-arrow"></div></div>
|
@@ -225,7 +227,17 @@ function opinionstage_create_new_href() {
|
|
225 |
Â
$('.filter__itm').live('click', function(e) {
|
226 |
Â
var text = $(this).text();
|
227 |
Â
$("button#dropbtn span").text(text);
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
228 |
Â
});
|
Â
|
|
229 |
Â
$('div#show-templates').live('click', function(e) {
|
230 |
Â
var inputs = $(".filter__itm");
|
231 |
Â
for(var i = 0; i < inputs.length; i++){
|
55 |
Â
<div class="header-right-container">
|
56 |
Â
<div class="header-right-inner-container">
|
57 |
Â
<div class='filter'>
|
58 |
+
<div class="dropdown dropdown_items">
|
59 |
Â
<button class="dropbtn gutenberg_dropdown" id="dropbtn"><span>All ITEMS</span></button>
|
60 |
Â
<div class="dropdown-content">
|
61 |
Â
<div class='filter__itm'
|
118 |
Â
<div class='content__list'>
|
119 |
Â
<div v-if='hasData'>
|
120 |
Â
<div class='content__itm' v-for="widget in widgets">
|
121 |
+
<a target="_blank" :href='widget.landingPageUrl'>
|
122 |
Â
<div class='content__image'>
|
123 |
Â
<img :src='widget.imageUrl'>
|
124 |
Â
<div class='content__label'>{{ widget.type }}</div>
|
125 |
Â
</div>
|
126 |
+
</a>
|
127 |
+
<p class='content__info'><a target="_blank" :href='widget.editUrl'>{{ widget.title }}</a></p>
|
128 |
Â
<div class='content__links'>
|
129 |
Â
<button class='popup-content-btn content__links-itm'
|
130 |
Â
@click="var shortcode = widget.landingPageUrl.replace('https://www.opinionstage.com',''); window.verifyOSInsert(shortcode)">insert</button>
|
131 |
+
<div class="dropdown dropdown-popup-action">
|
132 |
Â
<div class="popup-action popup-content-btn"></div>
|
133 |
Â
<div class="content-item-menu">
|
134 |
Â
<div class="top-arrow-box"><div class="top-arrow"></div></div>
|
227 |
Â
$('.filter__itm').live('click', function(e) {
|
228 |
Â
var text = $(this).text();
|
229 |
Â
$("button#dropbtn span").text(text);
|
230 |
+
|
231 |
+
$('.dropdown_items .dropdown-content').attr('style', 'display: none !important');
|
232 |
+
$(".dropdown_items #dropbtn").hover(function() {
|
233 |
+
$('.dropdown_items .dropdown-content').css("display","block");
|
234 |
+
});
|
235 |
+
});
|
236 |
+
|
237 |
+
jQuery(document).live('click', function(e) {
|
238 |
+
$('.dropdown_items .dropdown-content').attr('style', 'display: none !important');
|
239 |
Â
});
|
240 |
+
|
241 |
Â
$('div#show-templates').live('click', function(e) {
|
242 |
Â
var inputs = $(".filter__itm");
|
243 |
Â
for(var i = 0; i < inputs.length; i++){
|
admin/content-popup-template.html.php
CHANGED
@@ -50,7 +50,7 @@ function opinionstage_create_new_href() {
|
|
50 |
Â
<div class="header-right-container">
|
51 |
Â
<div class="header-right-inner-container">
|
52 |
Â
<div class='filter'>
|
53 |
-
<div class="dropdown">
|
54 |
Â
<button class="dropbtn" id="dropbtn"><span>All ITEMS</span></button>
|
55 |
Â
<div class="dropdown-content">
|
56 |
Â
<div class='filter__itm'
|
@@ -112,14 +112,16 @@ function opinionstage_create_new_href() {
|
|
112 |
Â
<div class='content__list'>
|
113 |
Â
<div v-if='hasData'>
|
114 |
Â
<div class='content__itm' v-for="widget in widgets">
|
Â
|
|
115 |
Â
<div class='content__image'>
|
116 |
Â
<img :src='widget.imageUrl'>
|
117 |
Â
<div class='content__label'>{{ widget.type }}</div>
|
118 |
Â
</div>
|
119 |
-
|
Â
|
|
120 |
Â
<div class='content__links'>
|
121 |
Â
<button class='popup-content-btn content__links-itm' @click="insertShortcode(widget)">insert</button>
|
122 |
-
<div class="dropdown">
|
123 |
Â
<div class="popup-action popup-content-btn"></div>
|
124 |
Â
<div class="content-item-menu">
|
125 |
Â
<div class="top-arrow-box"><div class="top-arrow"></div></div>
|
@@ -201,11 +203,24 @@ function opinionstage_create_new_href() {
|
|
201 |
Â
</div>
|
202 |
Â
</template>
|
203 |
Â
<script>
|
204 |
-
jQuery(document).ready(function ($) {
|
205 |
Â
$('.filter__itm').live('click', function(e) {
|
206 |
Â
var text = $(this).text();
|
207 |
Â
$("button#dropbtn span").text(text);
|
Â
|
|
Â
|
|
208 |
Â
});
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
209 |
Â
$('div#show-templates').live('click', function(e) {
|
210 |
Â
var inputs = $(".filter__itm");
|
211 |
Â
for(var i = 0; i < inputs.length; i++){
|
50 |
Â
<div class="header-right-container">
|
51 |
Â
<div class="header-right-inner-container">
|
52 |
Â
<div class='filter'>
|
53 |
+
<div class="dropdown dropdown_items">
|
54 |
Â
<button class="dropbtn" id="dropbtn"><span>All ITEMS</span></button>
|
55 |
Â
<div class="dropdown-content">
|
56 |
Â
<div class='filter__itm'
|
112 |
Â
<div class='content__list'>
|
113 |
Â
<div v-if='hasData'>
|
114 |
Â
<div class='content__itm' v-for="widget in widgets">
|
115 |
+
<a target="_blank" :href='widget.landingPageUrl'>
|
116 |
Â
<div class='content__image'>
|
117 |
Â
<img :src='widget.imageUrl'>
|
118 |
Â
<div class='content__label'>{{ widget.type }}</div>
|
119 |
Â
</div>
|
120 |
+
</a>
|
121 |
+
<p class='content__info'><a target="_blank" :href='widget.editUrl'>{{ widget.title }}</a></p>
|
122 |
Â
<div class='content__links'>
|
123 |
Â
<button class='popup-content-btn content__links-itm' @click="insertShortcode(widget)">insert</button>
|
124 |
+
<div class="dropdown dropdown-popup-action">
|
125 |
Â
<div class="popup-action popup-content-btn"></div>
|
126 |
Â
<div class="content-item-menu">
|
127 |
Â
<div class="top-arrow-box"><div class="top-arrow"></div></div>
|
203 |
Â
</div>
|
204 |
Â
</template>
|
205 |
Â
<script>
|
206 |
+
jQuery(document).ready(function ($) {
|
207 |
Â
$('.filter__itm').live('click', function(e) {
|
208 |
Â
var text = $(this).text();
|
209 |
Â
$("button#dropbtn span").text(text);
|
210 |
+
|
211 |
+
$('.dropdown_items .dropdown-content').attr('style', 'display: none !important');
|
212 |
Â
});
|
213 |
+
|
214 |
+
setTimeout(function(){
|
215 |
+
$(".dropdown_items #dropbtn").hover(function() {
|
216 |
+
$('.dropdown_items .dropdown-content').css("display","block");
|
217 |
+
});
|
218 |
+
},3000);
|
219 |
+
|
220 |
+
jQuery(document).live('click', function(e) {
|
221 |
+
$('.dropdown_items .dropdown-content').attr('style', 'display: none !important');
|
222 |
+
});
|
223 |
+
|
224 |
Â
$('div#show-templates').live('click', function(e) {
|
225 |
Â
var inputs = $(".filter__itm");
|
226 |
Â
for(var i = 0; i < inputs.length; i++){
|
admin/content-popup.php
CHANGED
@@ -115,6 +115,10 @@ span#insert_error_editor a {
|
|
115 |
Â
position: relative;
|
116 |
Â
}
|
117 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
118 |
Â
.dropdown-content {
|
119 |
Â
background-color: #f9f9f9;
|
120 |
Â
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
|
@@ -138,6 +142,9 @@ span#insert_error_editor a {
|
|
138 |
Â
|
139 |
Â
.dropdown-content div:hover {background-color: #3487fa; color: #fff !important;}
|
140 |
Â
|
Â
|
|
Â
|
|
Â
|
|
141 |
Â
.dropdown:hover .dropdown-content {
|
142 |
Â
display: block !important;
|
143 |
Â
width: 180px;
|
@@ -311,7 +318,6 @@ li.create-menu__itm.companymenuli a.alisting {
|
|
311 |
Â
padding: 30px;
|
312 |
Â
}
|
313 |
Â
.opinionstage-content-popup-contents .filter {
|
314 |
-
/* margin-right: 50px !important;*/
|
315 |
Â
width: auto;
|
316 |
Â
}
|
317 |
Â
.opinionstage-content-popup-contents .filter .dropdown .dropbtn {
|
@@ -392,10 +398,6 @@ li.create-menu__itm.companymenuli a.alisting {
|
|
392 |
Â
height: 90px;
|
393 |
Â
width: 15%;
|
394 |
Â
}
|
395 |
-
/*.opinionstage-content-popup-contents .content__image img {
|
396 |
-
height: 90px;
|
397 |
-
width: 120px;
|
398 |
-
}*/
|
399 |
Â
.opinionstage-content-popup-contents .content__info {
|
400 |
Â
background: transparent;
|
401 |
Â
display: inline-block;
|
@@ -407,6 +409,10 @@ li.create-menu__itm.companymenuli a.alisting {
|
|
407 |
Â
text-overflow: ellipsis;
|
408 |
Â
white-space: nowrap;
|
409 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
410 |
Â
.opinionstage-content-popup-contents .content__itm:hover .content__links {
|
411 |
Â
display: inline-block;
|
412 |
Â
}
|
@@ -438,9 +444,6 @@ li.create-menu__itm.companymenuli a.alisting {
|
|
438 |
Â
padding: 12px 25px;
|
439 |
Â
position: relative;
|
440 |
Â
}
|
441 |
-
/*.popup-action {
|
442 |
-
position: relative;
|
443 |
-
}*/
|
444 |
Â
.popup-action:before {
|
445 |
Â
color: #32adbc;
|
446 |
Â
content: "";
|
@@ -478,7 +481,7 @@ li.create-menu__itm.companymenuli a.alisting {
|
|
478 |
Â
.popup-action-dropdown.dropdown-content {
|
479 |
Â
left: auto;
|
480 |
Â
right: 0;
|
481 |
-
top:
|
482 |
Â
z-index: 10;
|
483 |
Â
}
|
484 |
Â
.dropdown:hover .popup-action-dropdown.dropdown-content {
|
@@ -515,7 +518,6 @@ input.components-button.is-button.is-default.is-block.is-primary {
|
|
515 |
Â
}
|
516 |
Â
.top-arrow-box {
|
517 |
Â
position: relative;
|
518 |
-
/*padding-top: 7px;*/
|
519 |
Â
}
|
520 |
Â
.top-arrow-box .top-arrow {
|
521 |
Â
background: #ffffff;
|
@@ -541,7 +543,7 @@ input.components-button.is-button.is-default.is-block.is-primary {
|
|
541 |
Â
line-height: normal;
|
542 |
Â
margin-left: -4px;
|
543 |
Â
position: absolute;
|
544 |
-
top:
|
545 |
Â
transform: rotate(180deg);
|
546 |
Â
z-index: 99;
|
547 |
Â
}
|
115 |
Â
position: relative;
|
116 |
Â
}
|
117 |
Â
|
118 |
+
.dropdown-popup-action {
|
119 |
+
height: 45px;
|
120 |
+
}
|
121 |
+
|
122 |
Â
.dropdown-content {
|
123 |
Â
background-color: #f9f9f9;
|
124 |
Â
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
|
142 |
Â
|
143 |
Â
.dropdown-content div:hover {background-color: #3487fa; color: #fff !important;}
|
144 |
Â
|
145 |
+
.dropdown_items .dropdown-content {
|
146 |
+
width: 180px;
|
147 |
+
}
|
148 |
Â
.dropdown:hover .dropdown-content {
|
149 |
Â
display: block !important;
|
150 |
Â
width: 180px;
|
318 |
Â
padding: 30px;
|
319 |
Â
}
|
320 |
Â
.opinionstage-content-popup-contents .filter {
|
Â
|
|
321 |
Â
width: auto;
|
322 |
Â
}
|
323 |
Â
.opinionstage-content-popup-contents .filter .dropdown .dropbtn {
|
398 |
Â
height: 90px;
|
399 |
Â
width: 15%;
|
400 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
401 |
Â
.opinionstage-content-popup-contents .content__info {
|
402 |
Â
background: transparent;
|
403 |
Â
display: inline-block;
|
409 |
Â
text-overflow: ellipsis;
|
410 |
Â
white-space: nowrap;
|
411 |
Â
}
|
412 |
+
.opinionstage-content-popup-contents .content__info a, .opinionstage-content-popup-contents .content__info a:hover {
|
413 |
+
color: inherit;
|
414 |
+
text-decoration: none;
|
415 |
+
}
|
416 |
Â
.opinionstage-content-popup-contents .content__itm:hover .content__links {
|
417 |
Â
display: inline-block;
|
418 |
Â
}
|
444 |
Â
padding: 12px 25px;
|
445 |
Â
position: relative;
|
446 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
447 |
Â
.popup-action:before {
|
448 |
Â
color: #32adbc;
|
449 |
Â
content: "";
|
481 |
Â
.popup-action-dropdown.dropdown-content {
|
482 |
Â
left: auto;
|
483 |
Â
right: 0;
|
484 |
+
top: 20px;
|
485 |
Â
z-index: 10;
|
486 |
Â
}
|
487 |
Â
.dropdown:hover .popup-action-dropdown.dropdown-content {
|
518 |
Â
}
|
519 |
Â
.top-arrow-box {
|
520 |
Â
position: relative;
|
Â
|
|
521 |
Â
}
|
522 |
Â
.top-arrow-box .top-arrow {
|
523 |
Â
background: #ffffff;
|
543 |
Â
line-height: normal;
|
544 |
Â
margin-left: -4px;
|
545 |
Â
position: absolute;
|
546 |
+
top: 10px;
|
547 |
Â
transform: rotate(180deg);
|
548 |
Â
z-index: 99;
|
549 |
Â
}
|
admin/css/menu-page.css
CHANGED
@@ -7,9 +7,6 @@
|
|
7 |
Â
width: 100%;
|
8 |
Â
-webkit-font-smoothing: antialiased;
|
9 |
Â
}
|
10 |
-
/*#opinionstage-content a {
|
11 |
-
color: #32adbc;
|
12 |
-
}*/
|
13 |
Â
#opinionstage-content .opinionstage-header-wrapper {
|
14 |
Â
background: #232121;
|
15 |
Â
margin-right: 20px;
|
@@ -34,7 +31,6 @@
|
|
34 |
Â
padding: 20px 35px 0;
|
35 |
Â
}
|
36 |
Â
#opinionstage-content .opinionstage-status-content-connected {
|
37 |
-
/*background: url(../images/top-bg.png) no-repeat 0px 0px;*/
|
38 |
Â
color: #fff;
|
39 |
Â
height: 115px;
|
40 |
Â
padding: 30px 30px 0;
|
@@ -130,16 +126,14 @@
|
|
130 |
Â
}
|
131 |
Â
#opinionstage-content .opinionstage-dashboard {
|
132 |
Â
background-color: #fff;
|
133 |
-
/* height: 100vw;*/
|
134 |
Â
margin-right: 20px;
|
Â
|
|
135 |
Â
overflow: hidden;
|
136 |
Â
}
|
137 |
Â
#opinionstage-content .opinionstage-dashboard-left , #opinionstage-content .opinionstage-dashboard-right {
|
138 |
-
float: left;
|
139 |
Â
width: 1000px;
|
140 |
Â
}
|
141 |
Â
#opinionstage-content .opinionstage-dashboard-left {
|
142 |
-
/*margin-right: 40px;*/
|
143 |
Â
margin: 30px;
|
144 |
Â
}
|
145 |
Â
#opinionstage-content .opinionstage-dashboard-section {
|
@@ -159,8 +153,6 @@
|
|
159 |
Â
float: left;
|
160 |
Â
margin: 0;
|
161 |
Â
padding: 10px;
|
162 |
-
/*margin-right: 0;
|
163 |
-
padding: 10px 25px;*/
|
164 |
Â
}
|
165 |
Â
#opinionstage-content .opinionstage-dashboard-section .opinionstage-section-header a:focus {
|
166 |
Â
box-shadow: none;
|
@@ -216,14 +208,10 @@
|
|
216 |
Â
display: table-row;
|
217 |
Â
}
|
218 |
Â
#opinionstage-content .opinionstage-dashboard-section .opinionstage-section-content-wrapper .opinionstage-section-content .opinionstage-section-raw {
|
219 |
-
/*border: none;*/
|
220 |
Â
border-bottom: 1px solid #c8c8c9;
|
221 |
Â
border-left: none;
|
222 |
Â
border-right: none;
|
223 |
Â
}
|
224 |
-
/*#opinionstage-content .opinionstage-dashboard-section .opinionstage-section-content-wrapper .opinionstage-section-content .opinionstage-section-raw:last-child {
|
225 |
-
border-bottom: none;
|
226 |
-
}*/
|
227 |
Â
#opinionstage-content .opinionstage-dashboard-section .opinionstage-section-content .opinionstage-section-raw .opinionstage-section-cell {
|
228 |
Â
display: table-cell;
|
229 |
Â
padding: 20px 0;
|
@@ -288,7 +276,6 @@
|
|
288 |
Â
}
|
289 |
Â
#opinionstage-section-placements .opinionstage-section-cell.opinionstage-btns-cell .opinionstage-edit-settings {
|
290 |
Â
font-size: 19px;
|
291 |
-
/*height: 18px;*/
|
292 |
Â
width: 29px;
|
293 |
Â
}
|
294 |
Â
#opinionstage-section-help .opinionstage-section-content {
|
@@ -379,10 +366,8 @@
|
|
379 |
Â
/* Getting started */
|
380 |
Â
.gettingStartedSection {
|
381 |
Â
background: #fff;
|
382 |
-
height: 100vw;
|
383 |
-
/* width: 100%;
|
384 |
-
max-width: 100%;*/
|
385 |
Â
margin-right: 20px;
|
Â
|
|
386 |
Â
overflow: hidden;
|
387 |
Â
padding: 30px;
|
388 |
Â
}
|
@@ -546,7 +531,6 @@ a.opinionstage-blue-bordered-btn {
|
|
546 |
Â
}
|
547 |
Â
td.action {
|
548 |
Â
width: 30%;
|
549 |
-
/*opacity: 0.7;*/
|
550 |
Â
}
|
551 |
Â
span.os-icon-plugin.icon-os-common-date {
|
552 |
Â
margin-right: 4px;
|
@@ -602,7 +586,6 @@ tr.settingBorderOs {
|
|
602 |
Â
}
|
603 |
Â
div#container .opinionstage-section-header {
|
604 |
Â
width: 100%;
|
605 |
-
/*max-width: 890px;*/
|
606 |
Â
}
|
607 |
Â
.opinionstage-section-title {
|
608 |
Â
float: left;
|
@@ -637,7 +620,6 @@ div#loadMore {
|
|
637 |
Â
cursor: pointer;
|
638 |
Â
font-size: 14px;
|
639 |
Â
line-height: 38px;
|
640 |
-
/*text-transform: uppercase;*/
|
641 |
Â
border: 1px solid #dededd;
|
642 |
Â
border-radius: 3px;
|
643 |
Â
padding: 0 10px;
|
@@ -702,7 +684,6 @@ td.image {
|
|
702 |
Â
|
703 |
Â
.opinionstage-item-view-dashboard {
|
704 |
Â
margin: 30px;
|
705 |
-
float: left;
|
706 |
Â
width: 1000px;
|
707 |
Â
}
|
708 |
Â
.opinionstage-header-inner-container {
|
@@ -752,9 +733,6 @@ td.image {
|
|
752 |
Â
.opinionstage-item-view-dashboard #check tbody .action .opinionstage-edit-content:last-child {
|
753 |
Â
margin-right: 0;
|
754 |
Â
}
|
755 |
-
/*#opinionstage-content .opinionstage-item-title {
|
756 |
-
color: #32373c;
|
757 |
-
}*/
|
758 |
Â
.opinionstage-item-action-container {
|
759 |
Â
float: right;
|
760 |
Â
}
|
@@ -769,7 +747,6 @@ div#loadMore {
|
|
769 |
Â
margin: 0;
|
770 |
Â
}
|
771 |
Â
.opinionstage-placement-dashboard {
|
772 |
-
float: left;
|
773 |
Â
margin: 30px;
|
774 |
Â
width: 1000px;
|
775 |
Â
}
|
7 |
Â
width: 100%;
|
8 |
Â
-webkit-font-smoothing: antialiased;
|
9 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
10 |
Â
#opinionstage-content .opinionstage-header-wrapper {
|
11 |
Â
background: #232121;
|
12 |
Â
margin-right: 20px;
|
31 |
Â
padding: 20px 35px 0;
|
32 |
Â
}
|
33 |
Â
#opinionstage-content .opinionstage-status-content-connected {
|
Â
|
|
34 |
Â
color: #fff;
|
35 |
Â
height: 115px;
|
36 |
Â
padding: 30px 30px 0;
|
126 |
Â
}
|
127 |
Â
#opinionstage-content .opinionstage-dashboard {
|
128 |
Â
background-color: #fff;
|
Â
|
|
129 |
Â
margin-right: 20px;
|
130 |
+
min-height: 800px;
|
131 |
Â
overflow: hidden;
|
132 |
Â
}
|
133 |
Â
#opinionstage-content .opinionstage-dashboard-left , #opinionstage-content .opinionstage-dashboard-right {
|
Â
|
|
134 |
Â
width: 1000px;
|
135 |
Â
}
|
136 |
Â
#opinionstage-content .opinionstage-dashboard-left {
|
Â
|
|
137 |
Â
margin: 30px;
|
138 |
Â
}
|
139 |
Â
#opinionstage-content .opinionstage-dashboard-section {
|
153 |
Â
float: left;
|
154 |
Â
margin: 0;
|
155 |
Â
padding: 10px;
|
Â
|
|
Â
|
|
156 |
Â
}
|
157 |
Â
#opinionstage-content .opinionstage-dashboard-section .opinionstage-section-header a:focus {
|
158 |
Â
box-shadow: none;
|
208 |
Â
display: table-row;
|
209 |
Â
}
|
210 |
Â
#opinionstage-content .opinionstage-dashboard-section .opinionstage-section-content-wrapper .opinionstage-section-content .opinionstage-section-raw {
|
Â
|
|
211 |
Â
border-bottom: 1px solid #c8c8c9;
|
212 |
Â
border-left: none;
|
213 |
Â
border-right: none;
|
214 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
215 |
Â
#opinionstage-content .opinionstage-dashboard-section .opinionstage-section-content .opinionstage-section-raw .opinionstage-section-cell {
|
216 |
Â
display: table-cell;
|
217 |
Â
padding: 20px 0;
|
276 |
Â
}
|
277 |
Â
#opinionstage-section-placements .opinionstage-section-cell.opinionstage-btns-cell .opinionstage-edit-settings {
|
278 |
Â
font-size: 19px;
|
Â
|
|
279 |
Â
width: 29px;
|
280 |
Â
}
|
281 |
Â
#opinionstage-section-help .opinionstage-section-content {
|
366 |
Â
/* Getting started */
|
367 |
Â
.gettingStartedSection {
|
368 |
Â
background: #fff;
|
Â
|
|
Â
|
|
Â
|
|
369 |
Â
margin-right: 20px;
|
370 |
+
min-height: 500px;
|
371 |
Â
overflow: hidden;
|
372 |
Â
padding: 30px;
|
373 |
Â
}
|
531 |
Â
}
|
532 |
Â
td.action {
|
533 |
Â
width: 30%;
|
Â
|
|
534 |
Â
}
|
535 |
Â
span.os-icon-plugin.icon-os-common-date {
|
536 |
Â
margin-right: 4px;
|
586 |
Â
}
|
587 |
Â
div#container .opinionstage-section-header {
|
588 |
Â
width: 100%;
|
Â
|
|
589 |
Â
}
|
590 |
Â
.opinionstage-section-title {
|
591 |
Â
float: left;
|
620 |
Â
cursor: pointer;
|
621 |
Â
font-size: 14px;
|
622 |
Â
line-height: 38px;
|
Â
|
|
623 |
Â
border: 1px solid #dededd;
|
624 |
Â
border-radius: 3px;
|
625 |
Â
padding: 0 10px;
|
684 |
Â
|
685 |
Â
.opinionstage-item-view-dashboard {
|
686 |
Â
margin: 30px;
|
Â
|
|
687 |
Â
width: 1000px;
|
688 |
Â
}
|
689 |
Â
.opinionstage-header-inner-container {
|
733 |
Â
.opinionstage-item-view-dashboard #check tbody .action .opinionstage-edit-content:last-child {
|
734 |
Â
margin-right: 0;
|
735 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
736 |
Â
.opinionstage-item-action-container {
|
737 |
Â
float: right;
|
738 |
Â
}
|
747 |
Â
margin: 0;
|
748 |
Â
}
|
749 |
Â
.opinionstage-placement-dashboard {
|
Â
|
|
750 |
Â
margin: 30px;
|
751 |
Â
width: 1000px;
|
752 |
Â
}
|
admin/views/deactivate-feedback-form.php
CHANGED
@@ -17,6 +17,23 @@ global $wp_version;
|
|
17 |
Â
$plugin = explode('/',$value); // Folder name will be displayed
|
18 |
Â
$plugin_list[] = $plugin[0];
|
19 |
Â
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
20 |
Â
?>
|
21 |
Â
<style type="text/css">
|
22 |
Â
.os-feedback-modal-wrapper {
|
@@ -148,9 +165,10 @@ mixpanel.init("73bec82504e0f14a7dba16aebd26b97d",{
|
|
148 |
Â
$ospEmail = '<?php echo $connectedEmail; ?>';
|
149 |
Â
$ospItemCount = '<?php echo $item_count; ?>';
|
150 |
Â
$pluginVersion="<?php echo OPINIONSTAGE_WIDGET_VERSION ?>";
|
Â
|
|
151 |
Â
|
152 |
Â
mixpanel.track("WordPress Opinion Stage Disconnect",
|
153 |
-
{"reason": reason, "details": reason ,"url": window.location.href,"opinionStagePluginConnect": $opswConnected, "wpVersion": $ospVersion, "osVersion": $pluginVersion, "theme": $ospTheme, "pluginList": $ospPluginList, "email": $ospEmail, 'totalItem': $ospItemCount, },
|
154 |
Â
function(){
|
155 |
Â
window.location = elemOpen.find('a').attr('href');
|
156 |
Â
}
|
17 |
Â
$plugin = explode('/',$value); // Folder name will be displayed
|
18 |
Â
$plugin_list[] = $plugin[0];
|
19 |
Â
}
|
20 |
+
|
21 |
+
if ($wp_version < 5) {
|
22 |
+
if ( function_exists( 'register_block_type' ) && is_plugin_active( 'gutenberg/gutenberg.php') ) {
|
23 |
+
$editor = 'Gutenberg + Classic';
|
24 |
+
}
|
25 |
+
else {
|
26 |
+
$editor = 'Classic';
|
27 |
+
}
|
28 |
+
}
|
29 |
+
else {
|
30 |
+
if ( is_plugin_active( 'classic-editor/classic-editor.php') ) {
|
31 |
+
$editor = 'Gutenberg + Classic';
|
32 |
+
}
|
33 |
+
else {
|
34 |
+
$editor = 'Gutenberg';
|
35 |
+
}
|
36 |
+
}
|
37 |
Â
?>
|
38 |
Â
<style type="text/css">
|
39 |
Â
.os-feedback-modal-wrapper {
|
165 |
Â
$ospEmail = '<?php echo $connectedEmail; ?>';
|
166 |
Â
$ospItemCount = '<?php echo $item_count; ?>';
|
167 |
Â
$pluginVersion="<?php echo OPINIONSTAGE_WIDGET_VERSION ?>";
|
168 |
+
$oseditor = '<?php echo $editor; ?>';
|
169 |
Â
|
170 |
Â
mixpanel.track("WordPress Opinion Stage Disconnect",
|
171 |
+
{"reason": reason, "details": reason ,"url": window.location.href,"opinionStagePluginConnect": $opswConnected, "wpVersion": $ospVersion, "osVersion": $pluginVersion, "theme": $ospTheme, "pluginList": $ospPluginList, "email": $ospEmail, 'totalItem': $ospItemCount, 'editor': $oseditor, },
|
172 |
Â
function(){
|
173 |
Â
window.location = elemOpen.find('a').attr('href');
|
174 |
Â
}
|
admin/views/getting_started.php
CHANGED
@@ -43,5 +43,38 @@ defined( 'ABSPATH' ) or die();
|
|
43 |
Â
<a href="https://help.opinionstage.com/wordpress-plugin/how-to-use-the-wordpress-plugin?utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8" target="_blank"><div class="gettingTemplateTutorial">GETTING STARTED <br/>TUTORIALS</div></a>
|
44 |
Â
</div>
|
45 |
Â
</div>
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
46 |
Â
<?php } ?>
|
47 |
Â
</div>
|
43 |
Â
<a href="https://help.opinionstage.com/wordpress-plugin/how-to-use-the-wordpress-plugin?utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8" target="_blank"><div class="gettingTemplateTutorial">GETTING STARTED <br/>TUTORIALS</div></a>
|
44 |
Â
</div>
|
45 |
Â
</div>
|
46 |
+
|
47 |
+
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
|
48 |
+
<script type="text/javascript">
|
49 |
+
var aElems = document.getElementsByTagName('a');
|
50 |
+
|
51 |
+
for (var i = 0, len = aElems.length; i < len; i++) {
|
52 |
+
aElems[i].onclick = function(e) {
|
53 |
+
e.preventDefault();
|
54 |
+
var href = jQuery(this).attr('href');
|
55 |
+
var target = jQuery(this).attr('target');
|
56 |
+
|
57 |
+
swal({
|
58 |
+
title: "Leave without connecting?",
|
59 |
+
text: "To use this plugin you need to first connect WordPress with Opinion Stage.",
|
60 |
+
icon: "warning",
|
61 |
+
buttons: ["Cancel", "Leave"],
|
62 |
+
})
|
63 |
+
.then((willDelete) => {
|
64 |
+
if (willDelete) {
|
65 |
+
if(target !== undefined) {
|
66 |
+
window.open(href, target);
|
67 |
+
}
|
68 |
+
else {
|
69 |
+
window.location.href = href;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
else {
|
73 |
+
jQuery('#os-email').focus();
|
74 |
+
}
|
75 |
+
});
|
76 |
+
};
|
77 |
+
}
|
78 |
+
</script>
|
79 |
Â
<?php } ?>
|
80 |
Â
</div>
|
admin/views/my_placements.php
CHANGED
@@ -59,7 +59,7 @@ defined( 'ABSPATH' ) or die();
|
|
59 |
Â
<div class="example">Add a content popup to your site</div>
|
60 |
Â
</div>
|
61 |
Â
<div class="opinionstage-section-cell opinionstage-btns-cell">
|
62 |
-
<a href="<?php echo opinionstage_flyout_edit_url('content'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-content <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">
|
63 |
Â
<a href="<?php echo opinionstage_flyout_edit_url('settings'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-settings <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">
|
64 |
Â
<div class="os-icon-plugin icon-os-common-settings"></div>
|
65 |
Â
</a>
|
@@ -84,7 +84,7 @@ defined( 'ABSPATH' ) or die();
|
|
84 |
Â
<div class="example">Add a content section to all posts</div>
|
85 |
Â
</div>
|
86 |
Â
<div class="opinionstage-section-cell opinionstage-btns-cell">
|
87 |
-
<a href="<?php echo opinionstage_article_placement_edit_url('content'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-content <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">
|
88 |
Â
<a href="<?php echo opinionstage_article_placement_edit_url('settings'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-settings <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">
|
89 |
Â
<div class="os-icon-plugin icon-os-common-settings"></div>
|
90 |
Â
</a>
|
@@ -117,7 +117,7 @@ defined( 'ABSPATH' ) or die();
|
|
117 |
Â
</div>
|
118 |
Â
</div>
|
119 |
Â
<div class="opinionstage-section-cell opinionstage-btns-cell">
|
120 |
-
<a href="<?php echo opinionstage_sidebar_placement_edit_url('content'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-content <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">
|
121 |
Â
<a href="<?php echo opinionstage_sidebar_placement_edit_url('settings'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-settings <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">
|
122 |
Â
<div class="os-icon-plugin icon-os-common-settings"></div>
|
123 |
Â
</a>
|
59 |
Â
<div class="example">Add a content popup to your site</div>
|
60 |
Â
</div>
|
61 |
Â
<div class="opinionstage-section-cell opinionstage-btns-cell">
|
62 |
+
<a href="<?php echo opinionstage_flyout_edit_url('content'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-content <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">SELECT ITEM</a>
|
63 |
Â
<a href="<?php echo opinionstage_flyout_edit_url('settings'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-settings <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">
|
64 |
Â
<div class="os-icon-plugin icon-os-common-settings"></div>
|
65 |
Â
</a>
|
84 |
Â
<div class="example">Add a content section to all posts</div>
|
85 |
Â
</div>
|
86 |
Â
<div class="opinionstage-section-cell opinionstage-btns-cell">
|
87 |
+
<a href="<?php echo opinionstage_article_placement_edit_url('content'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-content <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">SELECT ITEM</a>
|
88 |
Â
<a href="<?php echo opinionstage_article_placement_edit_url('settings'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-settings <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">
|
89 |
Â
<div class="os-icon-plugin icon-os-common-settings"></div>
|
90 |
Â
</a>
|
117 |
Â
</div>
|
118 |
Â
</div>
|
119 |
Â
<div class="opinionstage-section-cell opinionstage-btns-cell">
|
120 |
+
<a href="<?php echo opinionstage_sidebar_placement_edit_url('content'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-content <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">SELECT ITEM</a>
|
121 |
Â
<a href="<?php echo opinionstage_sidebar_placement_edit_url('settings'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-settings <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">
|
122 |
Â
<div class="os-icon-plugin icon-os-common-settings"></div>
|
123 |
Â
</a>
|
admin/views/settings_track.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Â
// block direct access to plugin PHP files:
|
3 |
Â
defined( 'ABSPATH' ) or die(1);
|
4 |
Â
|
5 |
-
if(isset($_POST['submit_tracking']) && $_POST['submit_tracking'] == '
|
6 |
Â
if(isset($_POST['opinionstage_allow_tracking']) && $_POST['opinionstage_allow_tracking'] == 'yes'){
|
7 |
Â
update_option('oswp_tracking_user_site_data', 'yes');
|
8 |
Â
}else{
|
2 |
Â
// block direct access to plugin PHP files:
|
3 |
Â
defined( 'ABSPATH' ) or die(1);
|
4 |
Â
|
5 |
+
if(isset($_POST['submit_tracking']) && $_POST['submit_tracking'] == 'SAVE CHANGES'){
|
6 |
Â
if(isset($_POST['opinionstage_allow_tracking']) && $_POST['opinionstage_allow_tracking'] == 'yes'){
|
7 |
Â
update_option('oswp_tracking_user_site_data', 'yes');
|
8 |
Â
}else{
|
admin/views/view_my_items.php
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
Â
// block direct access to plugin PHP files:
|
3 |
Â
defined( 'ABSPATH' ) or die(1); ?>
|
4 |
Â
|
5 |
-
<!-- <div class="wrap"> -->
|
6 |
Â
<div id="opinionstage-content">
|
7 |
Â
<div class="opinionstage-header-wrapper">
|
8 |
Â
<?php if ( $os_client_logged_in ) { ?>
|
@@ -48,12 +47,12 @@ defined( 'ABSPATH' ) or die(1); ?>
|
|
48 |
Â
</div>
|
49 |
Â
<p class="result_progress" style="display: block; font-size: 16px; text-align: center;">Loading...</p>
|
50 |
Â
<table id="check"></table>
|
Â
|
|
51 |
Â
<div id="loadMore" class="btn btn_aqua btn_full-width" style="display: none;">Click for more</div>
|
52 |
Â
<div id="showLess" style="display: none;">Show less</div>
|
53 |
Â
</div>
|
54 |
Â
</div>
|
55 |
Â
</div>
|
56 |
-
<!-- </div> -->
|
57 |
Â
<script type="text/javascript">
|
58 |
Â
jQuery(document).ready(function($){
|
59 |
Â
$.ajax({
|
@@ -86,7 +85,7 @@ defined( 'ABSPATH' ) or die(1); ?>
|
|
86 |
Â
var previewBlockOsView = dropdownOptions.data[i].attributes['landing-page-url'];
|
87 |
Â
var previewBlockOsEdit = dropdownOptions.data[i].attributes['edit-url'];
|
88 |
Â
var previewBlockOsStatistics = dropdownOptions.data[i].attributes['stats-url'];
|
89 |
-
var viewtext = '<tbody id="count"><tr class="settingBorderOs"><td class="image"><div class="content-item-image quiz"><img height="90" src="'+previewBlockOsImageUrl+'" width="120"><div class="content-item-label">'+previewBlockOsType+'</div></div></td><td class="long"><div style="position: relative;height: 85px;"><a href="'+previewBlockOsEdit+'" class="opinionstage-item-title" target="_blank">'+previewBlockOsTitle+'</a><table><tbody><tr><td><span class="os-icon-plugin icon-os-common-date"></span><div class="label">'+previewBlockOsDate+'</div></td></tr></tbody></table></div></td><td class="action"><div class="opinionstage-item-action-container"><a href="'+previewBlockOsView+'" class="opinionstage-blue-bordered-btn opinionstage-edit-content " target="_blank"> View </a><a href="'+previewBlockOsEdit+'" class="opinionstage-blue-bordered-btn opinionstage-edit-content " target="_blank"> Edit </a><a href="'+previewBlockOsStatistics+'" class="opinionstage-blue-bordered-btn opinionstage-edit-content " target="_blank"> Statistics </div></a></td></tr></tbody>';
|
90 |
Â
$('.result_progress').css('display', 'none');
|
91 |
Â
$(viewtext).appendTo('#container table#check');
|
92 |
Â
}
|
@@ -94,28 +93,10 @@ defined( 'ABSPATH' ) or die(1); ?>
|
|
94 |
Â
},
|
95 |
Â
complete: function(data) {
|
96 |
Â
size_li = $("table#check tbody#count").size();
|
97 |
-
|
98 |
-
setTimeout(function(){$('#showLess').trigger('click');},500);
|
99 |
-
}
|
100 |
-
// Show the div in 5s
|
101 |
-
var countItemOS = 10;
|
102 |
-
if(dropdownOptions.data.length > countItemOS){
|
103 |
-
$("#loadMore").delay(2000).fadeIn(500);
|
104 |
-
}
|
105 |
-
x=10;
|
106 |
-
$('table#check ttbody#count:lt('+x+')').show();
|
107 |
-
$('#loadMore').click(function () {
|
108 |
-
x= (x+10 <= size_li) ? x+10 : size_li;
|
109 |
-
$('table#check tbody#count:lt('+x+')').show(500);
|
110 |
-
if(size_li == x){
|
111 |
-
$("#loadMore").hide(500);
|
112 |
-
}
|
113 |
-
});
|
114 |
-
$('#showLess').live( 'click', function () {
|
115 |
-
x=(x-0<0) ? 10 : x-0;
|
116 |
-
$('table#check tbody#count').not(':lt('+x+')').hide();
|
117 |
-
});
|
118 |
Â
|
Â
|
|
Â
|
|
119 |
Â
var data = {
|
120 |
Â
'action': 'opinionstage_ajax_item_count',
|
121 |
Â
'oswp_item_count' : dropdownOptions.data.length
|
@@ -123,23 +104,37 @@ defined( 'ABSPATH' ) or die(1); ?>
|
|
123 |
Â
|
124 |
Â
jQuery.post(ajaxurl, data, function(response) {
|
125 |
Â
if(response){
|
126 |
-
|
127 |
Â
}
|
128 |
Â
});
|
129 |
Â
|
130 |
Â
jQuery('#itemList').on('change', function() {
|
131 |
Â
var selectedValue = this.value;
|
132 |
Â
var contentLabel = jQuery(".content-item-label");
|
Â
|
|
133 |
Â
|
Â
|
|
134 |
Â
contentLabel.each(function() {
|
Â
|
|
135 |
Â
if(selectedValue != 'all' && selectedValue != jQuery( this ).text().toLowerCase()){
|
136 |
-
|
Â
|
|
137 |
Â
}
|
138 |
Â
else {
|
139 |
Â
jQuery("#searchItem").val('');
|
140 |
-
|
Â
|
|
Â
|
|
141 |
Â
}
|
142 |
Â
});
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
143 |
Â
});
|
144 |
Â
|
145 |
Â
$("#searchItem").on("keyup",function search(e) {
|
@@ -151,22 +146,26 @@ defined( 'ABSPATH' ) or die(1); ?>
|
|
151 |
Â
|
152 |
Â
listTitle.each(function() {
|
153 |
Â
var title = jQuery( this ).text().toLowerCase();
|
Â
|
|
Â
|
|
154 |
Â
if ( dropdownValue == 'all' ) {
|
155 |
Â
if(!title.includes(searchItem)) {
|
156 |
-
|
157 |
Â
}
|
158 |
Â
else {
|
159 |
-
|
160 |
Â
}
|
161 |
Â
}
|
162 |
Â
else {
|
163 |
Â
contentList.each(function() {
|
164 |
Â
if(dropdownValue == jQuery( this ).text().toLowerCase()){
|
165 |
-
if(
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
Â
|
|
Â
|
|
170 |
Â
}
|
171 |
Â
}
|
172 |
Â
});
|
@@ -180,5 +179,45 @@ defined( 'ABSPATH' ) or die(1); ?>
|
|
180 |
Â
}
|
181 |
Â
});
|
182 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
183 |
Â
});
|
184 |
Â
</script>
|
2 |
Â
// block direct access to plugin PHP files:
|
3 |
Â
defined( 'ABSPATH' ) or die(1); ?>
|
4 |
Â
|
Â
|
|
5 |
Â
<div id="opinionstage-content">
|
6 |
Â
<div class="opinionstage-header-wrapper">
|
7 |
Â
<?php if ( $os_client_logged_in ) { ?>
|
47 |
Â
</div>
|
48 |
Â
<p class="result_progress" style="display: block; font-size: 16px; text-align: center;">Loading...</p>
|
49 |
Â
<table id="check"></table>
|
50 |
+
<p class="no_item" style="display: none; font-size: 15px; text-align: center;">No items found</p>
|
51 |
Â
<div id="loadMore" class="btn btn_aqua btn_full-width" style="display: none;">Click for more</div>
|
52 |
Â
<div id="showLess" style="display: none;">Show less</div>
|
53 |
Â
</div>
|
54 |
Â
</div>
|
55 |
Â
</div>
|
Â
|
|
56 |
Â
<script type="text/javascript">
|
57 |
Â
jQuery(document).ready(function($){
|
58 |
Â
$.ajax({
|
85 |
Â
var previewBlockOsView = dropdownOptions.data[i].attributes['landing-page-url'];
|
86 |
Â
var previewBlockOsEdit = dropdownOptions.data[i].attributes['edit-url'];
|
87 |
Â
var previewBlockOsStatistics = dropdownOptions.data[i].attributes['stats-url'];
|
88 |
+
var viewtext = '<tbody id="count"><tr class="settingBorderOs"><td class="image"><a href="'+previewBlockOsView+'" target="_blank"><div class="content-item-image quiz"><img height="90" src="'+previewBlockOsImageUrl+'" width="120"><div class="content-item-label">'+previewBlockOsType+'</div></div></a></td><td class="long"><div style="position: relative;height: 85px;"><a href="'+previewBlockOsEdit+'" class="opinionstage-item-title" target="_blank">'+previewBlockOsTitle+'</a><table><tbody><tr><td><span class="os-icon-plugin icon-os-common-date"></span><div class="label">'+previewBlockOsDate+'</div></td></tr></tbody></table></div></td><td class="action"><div class="opinionstage-item-action-container"><a href="'+previewBlockOsView+'" class="opinionstage-blue-bordered-btn opinionstage-edit-content " target="_blank"> View </a><a href="'+previewBlockOsEdit+'" class="opinionstage-blue-bordered-btn opinionstage-edit-content " target="_blank"> Edit </a><a href="'+previewBlockOsStatistics+'" class="opinionstage-blue-bordered-btn opinionstage-edit-content " target="_blank"> Statistics </div></a></td></tr></tbody>';
|
89 |
Â
$('.result_progress').css('display', 'none');
|
90 |
Â
$(viewtext).appendTo('#container table#check');
|
91 |
Â
}
|
93 |
Â
},
|
94 |
Â
complete: function(data) {
|
95 |
Â
size_li = $("table#check tbody#count").size();
|
96 |
+
dropdownDataLength = dropdownOptions.data.length;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
97 |
Â
|
98 |
+
console.log(size_li + '' + dropdownDataLength);
|
99 |
+
loadMore(size_li, dropdownDataLength, "all");
|
100 |
Â
var data = {
|
101 |
Â
'action': 'opinionstage_ajax_item_count',
|
102 |
Â
'oswp_item_count' : dropdownOptions.data.length
|
104 |
Â
|
105 |
Â
jQuery.post(ajaxurl, data, function(response) {
|
106 |
Â
if(response){
|
107 |
+
|
108 |
Â
}
|
109 |
Â
});
|
110 |
Â
|
111 |
Â
jQuery('#itemList').on('change', function() {
|
112 |
Â
var selectedValue = this.value;
|
113 |
Â
var contentLabel = jQuery(".content-item-label");
|
114 |
+
var item_count = 0;
|
115 |
Â
|
116 |
+
jQuery('.no_item').css('display', 'none');
|
117 |
Â
contentLabel.each(function() {
|
118 |
+
getContainer = jQuery( this ).parent().parent().parent().parent();
|
119 |
Â
if(selectedValue != 'all' && selectedValue != jQuery( this ).text().toLowerCase()){
|
120 |
+
getContainer.parent().css('display', 'none');
|
121 |
+
getContainer.parent().removeClass('countItem');
|
122 |
Â
}
|
123 |
Â
else {
|
124 |
Â
jQuery("#searchItem").val('');
|
125 |
+
getContainer.parent().css('display', 'table-row-group');
|
126 |
+
getContainer.parent().addClass('countItem');
|
127 |
+
item_count = item_count + 1;
|
128 |
Â
}
|
129 |
Â
});
|
130 |
+
|
131 |
+
if (item_count == 0) {
|
132 |
+
jQuery('.no_item').css('display', 'block');
|
133 |
+
}
|
134 |
+
|
135 |
+
size = $("table#check tbody.countItem").size();
|
136 |
+
$("#loadMore").fadeOut(500);
|
137 |
+
loadMore(size, item_count, "filter");
|
138 |
Â
});
|
139 |
Â
|
140 |
Â
$("#searchItem").on("keyup",function search(e) {
|
146 |
Â
|
147 |
Â
listTitle.each(function() {
|
148 |
Â
var title = jQuery( this ).text().toLowerCase();
|
149 |
+
outerContainer = jQuery( this ).parent().parent().parent().parent();
|
150 |
+
|
151 |
Â
if ( dropdownValue == 'all' ) {
|
152 |
Â
if(!title.includes(searchItem)) {
|
153 |
+
outerContainer.css('display', 'none');
|
154 |
Â
}
|
155 |
Â
else {
|
156 |
+
outerContainer.css('display', 'table-row-group');
|
157 |
Â
}
|
158 |
Â
}
|
159 |
Â
else {
|
160 |
Â
contentList.each(function() {
|
161 |
Â
if(dropdownValue == jQuery( this ).text().toLowerCase()){
|
162 |
+
if (outerContainer.hasClass('countItem')) {
|
163 |
+
if(!title.includes(searchItem)) {
|
164 |
+
outerContainer.css('display', 'none');
|
165 |
+
}
|
166 |
+
else {
|
167 |
+
outerContainer.css('display', 'table-row-group');
|
168 |
+
}
|
169 |
Â
}
|
170 |
Â
}
|
171 |
Â
});
|
179 |
Â
}
|
180 |
Â
});
|
181 |
Â
|
182 |
+
|
183 |
+
function loadMore(size, dataLength, item) {
|
184 |
+
if(dataLength == size && dataLength > 10){
|
185 |
+
setTimeout(function(){$('#showLess').trigger('click');},500);
|
186 |
+
}
|
187 |
+
// Show the div in 5s
|
188 |
+
console.log(dataLength + ' ' + size + ' ' + item);
|
189 |
+
var countItemOS = 10;
|
190 |
+
if(dataLength > countItemOS){
|
191 |
+
$("#loadMore").delay(2000).fadeIn(500);
|
192 |
+
}
|
193 |
+
|
194 |
+
x=10;
|
195 |
+
$('table#check ttbody#count:lt('+x+')').show();
|
196 |
+
$('#loadMore').click(function () {
|
197 |
+
x= (x+10 <= size) ? x+10 : size;
|
198 |
+
|
199 |
+
if (item == 'all') {
|
200 |
+
$('table#check tbody#count:lt('+x+')').show(500);
|
201 |
+
}
|
202 |
+
else {
|
203 |
+
$('table#check tbody#countItem:lt('+x+')').show(500);
|
204 |
+
}
|
205 |
+
|
206 |
+
if(size == x){
|
207 |
+
$("#loadMore").hide(500);
|
208 |
+
}
|
209 |
+
});
|
210 |
+
$('#showLess').live( 'click', function () {
|
211 |
+
console.log(x);
|
212 |
+
x=(x-0<0) ? 10 : x-0;
|
213 |
+
console.log(x);
|
214 |
+
if (item == 'all') {
|
215 |
+
$('table#check tbody#count').not(':lt('+x+')').hide();
|
216 |
+
}
|
217 |
+
else {
|
218 |
+
$('table#check tbody#countItem').not(':lt('+x+')').hide();
|
219 |
+
}
|
220 |
+
});
|
221 |
+
}
|
222 |
Â
});
|
223 |
Â
</script>
|
gutenberg/.editorconfig
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
# This file is for unifying the coding style for different editors and IDEs
|
2 |
-
# editorconfig.org
|
3 |
-
|
4 |
-
# WordPress Coding Standards
|
5 |
-
# https://make.wordpress.org/core/handbook/coding-standards/
|
6 |
-
|
7 |
-
root = true
|
8 |
-
|
9 |
-
[*]
|
10 |
-
charset = utf-8
|
11 |
-
end_of_line = lf
|
12 |
-
insert_final_newline = true
|
13 |
-
trim_trailing_whitespace = true
|
14 |
-
indent_style = tab
|
15 |
-
|
16 |
-
[*.yml]
|
17 |
-
indent_style = space
|
18 |
-
indent_size = 2
|
19 |
-
|
20 |
-
[*.md]
|
21 |
-
trim_trailing_whitespace = false
|
1 |
+
# This file is for unifying the coding style for different editors and IDEs
|
2 |
+
# editorconfig.org
|
3 |
+
|
4 |
+
# WordPress Coding Standards
|
5 |
+
# https://make.wordpress.org/core/handbook/coding-standards/
|
6 |
+
|
7 |
+
root = true
|
8 |
+
|
9 |
+
[*]
|
10 |
+
charset = utf-8
|
11 |
+
end_of_line = lf
|
12 |
+
insert_final_newline = true
|
13 |
+
trim_trailing_whitespace = true
|
14 |
+
indent_style = tab
|
15 |
+
|
16 |
+
[*.yml]
|
17 |
+
indent_style = space
|
18 |
+
indent_size = 2
|
19 |
+
|
20 |
+
[*.md]
|
21 |
+
trim_trailing_whitespace = false
|
gutenberg/.eslintignore
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
**/*.min.js
|
2 |
-
**/*.build.js
|
3 |
-
**/node_modules/**
|
4 |
-
**/vendor/**
|
5 |
-
build
|
6 |
-
coverage
|
7 |
-
cypress
|
8 |
-
node_modules
|
9 |
-
vendor
|
1 |
+
**/*.min.js
|
2 |
+
**/*.build.js
|
3 |
+
**/node_modules/**
|
4 |
+
**/vendor/**
|
5 |
+
build
|
6 |
+
coverage
|
7 |
+
cypress
|
8 |
+
node_modules
|
9 |
+
vendor
|
gutenberg/.eslintrc.json
CHANGED
@@ -1,192 +1,192 @@
|
|
1 |
-
{
|
2 |
-
"root": true,
|
3 |
-
"parser": "babel-eslint",
|
4 |
-
"extends": [
|
5 |
-
"wordpress",
|
6 |
-
"plugin:react/recommended",
|
7 |
-
"plugin:jsx-a11y/recommended",
|
8 |
-
"plugin:jest/recommended"
|
9 |
-
],
|
10 |
-
"env": {
|
11 |
-
"browser": false,
|
12 |
-
"es6": true,
|
13 |
-
"node": true,
|
14 |
-
"mocha": true,
|
15 |
-
"jest/globals": true
|
16 |
-
},
|
17 |
-
"parserOptions": {
|
18 |
-
"sourceType": "module",
|
19 |
-
"ecmaFeatures": {
|
20 |
-
"jsx": true
|
21 |
-
}
|
22 |
-
},
|
23 |
-
"globals": {
|
24 |
-
"wp": true,
|
25 |
-
"wpApiSettings": true,
|
26 |
-
"window": true,
|
27 |
-
"document": true
|
28 |
-
},
|
29 |
-
"plugins": ["react", "jsx-a11y", "jest"],
|
30 |
-
"settings": {
|
31 |
-
"react": {
|
32 |
-
"pragma": "wp"
|
33 |
-
}
|
34 |
-
},
|
35 |
-
"rules": {
|
36 |
-
"array-bracket-spacing": ["error", "always"],
|
37 |
-
"brace-style": ["error", "1tbs"],
|
38 |
-
"camelcase": ["error", { "properties": "never" }],
|
39 |
-
"comma-dangle": ["error", "always-multiline"],
|
40 |
-
"comma-spacing": "error",
|
41 |
-
"comma-style": "error",
|
42 |
-
"computed-property-spacing": ["error", "always"],
|
43 |
-
"constructor-super": "error",
|
44 |
-
"dot-notation": "error",
|
45 |
-
"eol-last": "error",
|
46 |
-
"eqeqeq": "error",
|
47 |
-
"func-call-spacing": "error",
|
48 |
-
"indent": ["error", "tab", { "SwitchCase": 1 }],
|
49 |
-
"jsx-a11y/label-has-for": [
|
50 |
-
"error",
|
51 |
-
{
|
52 |
-
"required": "id"
|
53 |
-
}
|
54 |
-
],
|
55 |
-
"jsx-a11y/media-has-caption": "off",
|
56 |
-
"jsx-a11y/no-noninteractive-tabindex": "off",
|
57 |
-
"jsx-a11y/role-has-required-aria-props": "off",
|
58 |
-
"jsx-quotes": "error",
|
59 |
-
"key-spacing": "error",
|
60 |
-
"keyword-spacing": "error",
|
61 |
-
"lines-around-comment": "off",
|
62 |
-
"no-alert": "error",
|
63 |
-
"no-bitwise": "error",
|
64 |
-
"no-caller": "error",
|
65 |
-
"no-console": "error",
|
66 |
-
"no-const-assign": "error",
|
67 |
-
"no-debugger": "error",
|
68 |
-
"no-dupe-args": "error",
|
69 |
-
"no-dupe-class-members": "error",
|
70 |
-
"no-dupe-keys": "error",
|
71 |
-
"no-duplicate-case": "error",
|
72 |
-
"no-duplicate-imports": "error",
|
73 |
-
"no-else-return": "error",
|
74 |
-
"no-eval": "error",
|
75 |
-
"no-extra-semi": "error",
|
76 |
-
"no-fallthrough": "error",
|
77 |
-
"no-lonely-if": "error",
|
78 |
-
"no-mixed-operators": "error",
|
79 |
-
"no-mixed-spaces-and-tabs": "error",
|
80 |
-
"no-multiple-empty-lines": ["error", { "max": 1 }],
|
81 |
-
"no-multi-spaces": "error",
|
82 |
-
"no-multi-str": "off",
|
83 |
-
"no-negated-in-lhs": "error",
|
84 |
-
"no-nested-ternary": "error",
|
85 |
-
"no-redeclare": "error",
|
86 |
-
"no-restricted-syntax": [
|
87 |
-
"error",
|
88 |
-
{
|
89 |
-
"selector":
|
90 |
-
"ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]",
|
91 |
-
"message": "Path access on WordPress dependencies is not allowed."
|
92 |
-
},
|
93 |
-
{
|
94 |
-
"selector": "ImportDeclaration[source.value=/^blocks$/]",
|
95 |
-
"message": "Use @wordpress/blocks as import path instead."
|
96 |
-
},
|
97 |
-
{
|
98 |
-
"selector": "ImportDeclaration[source.value=/^components$/]",
|
99 |
-
"message": "Use @wordpress/components as import path instead."
|
100 |
-
},
|
101 |
-
{
|
102 |
-
"selector": "ImportDeclaration[source.value=/^date$/]",
|
103 |
-
"message": "Use @wordpress/date as import path instead."
|
104 |
-
},
|
105 |
-
{
|
106 |
-
"selector": "ImportDeclaration[source.value=/^editor$/]",
|
107 |
-
"message": "Use @wordpress/editor as import path instead."
|
108 |
-
},
|
109 |
-
{
|
110 |
-
"selector": "ImportDeclaration[source.value=/^element$/]",
|
111 |
-
"message": "Use @wordpress/element as import path instead."
|
112 |
-
},
|
113 |
-
{
|
114 |
-
"selector": "ImportDeclaration[source.value=/^i18n$/]",
|
115 |
-
"message": "Use @wordpress/i18n as import path instead."
|
116 |
-
},
|
117 |
-
{
|
118 |
-
"selector": "ImportDeclaration[source.value=/^data$/]",
|
119 |
-
"message": "Use @wordpress/data as import path instead."
|
120 |
-
},
|
121 |
-
{
|
122 |
-
"selector": "ImportDeclaration[source.value=/^utils$/]",
|
123 |
-
"message": "Use @wordpress/utils as import path instead."
|
124 |
-
},
|
125 |
-
{
|
126 |
-
"selector":
|
127 |
-
"CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])",
|
128 |
-
"message": "Translate function arguments must be string literals."
|
129 |
-
},
|
130 |
-
{
|
131 |
-
"selector":
|
132 |
-
"CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])",
|
133 |
-
"message": "Translate function arguments must be string literals."
|
134 |
-
},
|
135 |
-
{
|
136 |
-
"selector":
|
137 |
-
"CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])",
|
138 |
-
"message": "Translate function arguments must be string literals."
|
139 |
-
}
|
140 |
-
],
|
141 |
-
"no-shadow": "error",
|
142 |
-
"no-undef": "error",
|
143 |
-
"no-undef-init": "error",
|
144 |
-
"no-unreachable": "error",
|
145 |
-
"no-unsafe-negation": "error",
|
146 |
-
"no-unused-expressions": "error",
|
147 |
-
"no-unused-vars": "error",
|
148 |
-
"no-useless-computed-key": "error",
|
149 |
-
"no-useless-constructor": "error",
|
150 |
-
"no-useless-return": "error",
|
151 |
-
"no-var": "error",
|
152 |
-
"no-whitespace-before-property": "error",
|
153 |
-
"object-curly-spacing": ["error", "always"],
|
154 |
-
"padded-blocks": ["error", "never"],
|
155 |
-
"prefer-const": "error",
|
156 |
-
"quote-props": ["error", "as-needed"],
|
157 |
-
"react/display-name": "off",
|
158 |
-
"react/jsx-curly-spacing": [
|
159 |
-
"error",
|
160 |
-
{
|
161 |
-
"when": "always",
|
162 |
-
"children": true
|
163 |
-
}
|
164 |
-
],
|
165 |
-
"react/jsx-equals-spacing": "error",
|
166 |
-
"react/jsx-indent": ["error", "tab"],
|
167 |
-
"react/jsx-indent-props": ["error", "tab"],
|
168 |
-
"react/jsx-key": "error",
|
169 |
-
"react/jsx-tag-spacing": "error",
|
170 |
-
"react/no-children-prop": "off",
|
171 |
-
"react/no-find-dom-node": "warn",
|
172 |
-
"react/prop-types": "off",
|
173 |
-
"semi": "error",
|
174 |
-
"semi-spacing": "error",
|
175 |
-
"space-before-blocks": ["error", "always"],
|
176 |
-
"space-before-function-paren": ["error", "never"],
|
177 |
-
"space-in-parens": ["error", "always"],
|
178 |
-
"space-infix-ops": ["error", { "int32Hint": false }],
|
179 |
-
"space-unary-ops": [
|
180 |
-
"error",
|
181 |
-
{
|
182 |
-
"overrides": {
|
183 |
-
"!": true
|
184 |
-
}
|
185 |
-
}
|
186 |
-
],
|
187 |
-
"template-curly-spacing": ["error", "always"],
|
188 |
-
"valid-jsdoc": ["error", { "requireReturn": false }],
|
189 |
-
"valid-typeof": "error",
|
190 |
-
"yoda": "off"
|
191 |
-
}
|
192 |
-
}
|
1 |
+
{
|
2 |
+
"root": true,
|
3 |
+
"parser": "babel-eslint",
|
4 |
+
"extends": [
|
5 |
+
"wordpress",
|
6 |
+
"plugin:react/recommended",
|
7 |
+
"plugin:jsx-a11y/recommended",
|
8 |
+
"plugin:jest/recommended"
|
9 |
+
],
|
10 |
+
"env": {
|
11 |
+
"browser": false,
|
12 |
+
"es6": true,
|
13 |
+
"node": true,
|
14 |
+
"mocha": true,
|
15 |
+
"jest/globals": true
|
16 |
+
},
|
17 |
+
"parserOptions": {
|
18 |
+
"sourceType": "module",
|
19 |
+
"ecmaFeatures": {
|
20 |
+
"jsx": true
|
21 |
+
}
|
22 |
+
},
|
23 |
+
"globals": {
|
24 |
+
"wp": true,
|
25 |
+
"wpApiSettings": true,
|
26 |
+
"window": true,
|
27 |
+
"document": true
|
28 |
+
},
|
29 |
+
"plugins": ["react", "jsx-a11y", "jest"],
|
30 |
+
"settings": {
|
31 |
+
"react": {
|
32 |
+
"pragma": "wp"
|
33 |
+
}
|
34 |
+
},
|
35 |
+
"rules": {
|
36 |
+
"array-bracket-spacing": ["error", "always"],
|
37 |
+
"brace-style": ["error", "1tbs"],
|
38 |
+
"camelcase": ["error", { "properties": "never" }],
|
39 |
+
"comma-dangle": ["error", "always-multiline"],
|
40 |
+
"comma-spacing": "error",
|
41 |
+
"comma-style": "error",
|
42 |
+
"computed-property-spacing": ["error", "always"],
|
43 |
+
"constructor-super": "error",
|
44 |
+
"dot-notation": "error",
|
45 |
+
"eol-last": "error",
|
46 |
+
"eqeqeq": "error",
|
47 |
+
"func-call-spacing": "error",
|
48 |
+
"indent": ["error", "tab", { "SwitchCase": 1 }],
|
49 |
+
"jsx-a11y/label-has-for": [
|
50 |
+
"error",
|
51 |
+
{
|
52 |
+
"required": "id"
|
53 |
+
}
|
54 |
+
],
|
55 |
+
"jsx-a11y/media-has-caption": "off",
|
56 |
+
"jsx-a11y/no-noninteractive-tabindex": "off",
|
57 |
+
"jsx-a11y/role-has-required-aria-props": "off",
|
58 |
+
"jsx-quotes": "error",
|
59 |
+
"key-spacing": "error",
|
60 |
+
"keyword-spacing": "error",
|
61 |
+
"lines-around-comment": "off",
|
62 |
+
"no-alert": "error",
|
63 |
+
"no-bitwise": "error",
|
64 |
+
"no-caller": "error",
|
65 |
+
"no-console": "error",
|
66 |
+
"no-const-assign": "error",
|
67 |
+
"no-debugger": "error",
|
68 |
+
"no-dupe-args": "error",
|
69 |
+
"no-dupe-class-members": "error",
|
70 |
+
"no-dupe-keys": "error",
|
71 |
+
"no-duplicate-case": "error",
|
72 |
+
"no-duplicate-imports": "error",
|
73 |
+
"no-else-return": "error",
|
74 |
+
"no-eval": "error",
|
75 |
+
"no-extra-semi": "error",
|
76 |
+
"no-fallthrough": "error",
|
77 |
+
"no-lonely-if": "error",
|
78 |
+
"no-mixed-operators": "error",
|
79 |
+
"no-mixed-spaces-and-tabs": "error",
|
80 |
+
"no-multiple-empty-lines": ["error", { "max": 1 }],
|
81 |
+
"no-multi-spaces": "error",
|
82 |
+
"no-multi-str": "off",
|
83 |
+
"no-negated-in-lhs": "error",
|
84 |
+
"no-nested-ternary": "error",
|
85 |
+
"no-redeclare": "error",
|
86 |
+
"no-restricted-syntax": [
|
87 |
+
"error",
|
88 |
+
{
|
89 |
+
"selector":
|
90 |
+
"ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]",
|
91 |
+
"message": "Path access on WordPress dependencies is not allowed."
|
92 |
+
},
|
93 |
+
{
|
94 |
+
"selector": "ImportDeclaration[source.value=/^blocks$/]",
|
95 |
+
"message": "Use @wordpress/blocks as import path instead."
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"selector": "ImportDeclaration[source.value=/^components$/]",
|
99 |
+
"message": "Use @wordpress/components as import path instead."
|
100 |
+
},
|
101 |
+
{
|
102 |
+
"selector": "ImportDeclaration[source.value=/^date$/]",
|
103 |
+
"message": "Use @wordpress/date as import path instead."
|
104 |
+
},
|
105 |
+
{
|
106 |
+
"selector": "ImportDeclaration[source.value=/^editor$/]",
|
107 |
+
"message": "Use @wordpress/editor as import path instead."
|
108 |
+
},
|
109 |
+
{
|
110 |
+
"selector": "ImportDeclaration[source.value=/^element$/]",
|
111 |
+
"message": "Use @wordpress/element as import path instead."
|
112 |
+
},
|
113 |
+
{
|
114 |
+
"selector": "ImportDeclaration[source.value=/^i18n$/]",
|
115 |
+
"message": "Use @wordpress/i18n as import path instead."
|
116 |
+
},
|
117 |
+
{
|
118 |
+
"selector": "ImportDeclaration[source.value=/^data$/]",
|
119 |
+
"message": "Use @wordpress/data as import path instead."
|
120 |
+
},
|
121 |
+
{
|
122 |
+
"selector": "ImportDeclaration[source.value=/^utils$/]",
|
123 |
+
"message": "Use @wordpress/utils as import path instead."
|
124 |
+
},
|
125 |
+
{
|
126 |
+
"selector":
|
127 |
+
"CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])",
|
128 |
+
"message": "Translate function arguments must be string literals."
|
129 |
+
},
|
130 |
+
{
|
131 |
+
"selector":
|
132 |
+
"CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])",
|
133 |
+
"message": "Translate function arguments must be string literals."
|
134 |
+
},
|
135 |
+
{
|
136 |
+
"selector":
|
137 |
+
"CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])",
|
138 |
+
"message": "Translate function arguments must be string literals."
|
139 |
+
}
|
140 |
+
],
|
141 |
+
"no-shadow": "error",
|
142 |
+
"no-undef": "error",
|
143 |
+
"no-undef-init": "error",
|
144 |
+
"no-unreachable": "error",
|
145 |
+
"no-unsafe-negation": "error",
|
146 |
+
"no-unused-expressions": "error",
|
147 |
+
"no-unused-vars": "error",
|
148 |
+
"no-useless-computed-key": "error",
|
149 |
+
"no-useless-constructor": "error",
|
150 |
+
"no-useless-return": "error",
|
151 |
+
"no-var": "error",
|
152 |
+
"no-whitespace-before-property": "error",
|
153 |
+
"object-curly-spacing": ["error", "always"],
|
154 |
+
"padded-blocks": ["error", "never"],
|
155 |
+
"prefer-const": "error",
|
156 |
+
"quote-props": ["error", "as-needed"],
|
157 |
+
"react/display-name": "off",
|
158 |
+
"react/jsx-curly-spacing": [
|
159 |
+
"error",
|
160 |
+
{
|
161 |
+
"when": "always",
|
162 |
+
"children": true
|
163 |
+
}
|
164 |
+
],
|
165 |
+
"react/jsx-equals-spacing": "error",
|
166 |
+
"react/jsx-indent": ["error", "tab"],
|
167 |
+
"react/jsx-indent-props": ["error", "tab"],
|
168 |
+
"react/jsx-key": "error",
|
169 |
+
"react/jsx-tag-spacing": "error",
|
170 |
+
"react/no-children-prop": "off",
|
171 |
+
"react/no-find-dom-node": "warn",
|
172 |
+
"react/prop-types": "off",
|
173 |
+
"semi": "error",
|
174 |
+
"semi-spacing": "error",
|
175 |
+
"space-before-blocks": ["error", "always"],
|
176 |
+
"space-before-function-paren": ["error", "never"],
|
177 |
+
"space-in-parens": ["error", "always"],
|
178 |
+
"space-infix-ops": ["error", { "int32Hint": false }],
|
179 |
+
"space-unary-ops": [
|
180 |
+
"error",
|
181 |
+
{
|
182 |
+
"overrides": {
|
183 |
+
"!": true
|
184 |
+
}
|
185 |
+
}
|
186 |
+
],
|
187 |
+
"template-curly-spacing": ["error", "always"],
|
188 |
+
"valid-jsdoc": ["error", { "requireReturn": false }],
|
189 |
+
"valid-typeof": "error",
|
190 |
+
"yoda": "off"
|
191 |
+
}
|
192 |
+
}
|
gutenberg/.gitignore
CHANGED
@@ -1,85 +1,85 @@
|
|
1 |
-
# Packages #
|
2 |
-
############
|
3 |
-
*.7z
|
4 |
-
*.dmg
|
5 |
-
*.gz
|
6 |
-
*.bz2
|
7 |
-
*.iso
|
8 |
-
*.jar
|
9 |
-
*.rar
|
10 |
-
*.tar
|
11 |
-
*.zip
|
12 |
-
*.tgz
|
13 |
-
*.map
|
14 |
-
|
15 |
-
# Logs and databases #
|
16 |
-
######################
|
17 |
-
*.log
|
18 |
-
*.sql
|
19 |
-
|
20 |
-
# OS generated files #
|
21 |
-
######################
|
22 |
-
**.DS_Store*
|
23 |
-
ehthumbs.db
|
24 |
-
Icon?
|
25 |
-
Thumbs.db
|
26 |
-
._*
|
27 |
-
|
28 |
-
# Vim generated files #
|
29 |
-
######################
|
30 |
-
*.un~
|
31 |
-
|
32 |
-
# SASS #
|
33 |
-
##########
|
34 |
-
**/.sass-cache
|
35 |
-
**/.sass-cache/*
|
36 |
-
**/.map
|
37 |
-
|
38 |
-
# Composer #
|
39 |
-
##########
|
40 |
-
vendors/composer/
|
41 |
-
!assets/js/vendor/
|
42 |
-
wpcs/
|
43 |
-
composer.lock
|
44 |
-
|
45 |
-
# Bower #
|
46 |
-
##########
|
47 |
-
assets/bower_components/*
|
48 |
-
|
49 |
-
# Codekit #
|
50 |
-
##########
|
51 |
-
/codekit-config.json
|
52 |
-
*.codekit
|
53 |
-
**.codekit-cache/*
|
54 |
-
|
55 |
-
# NPM #
|
56 |
-
##########
|
57 |
-
node_modules
|
58 |
-
**/node_modules/**
|
59 |
-
|
60 |
-
# Compiled Files and Build Dirs #
|
61 |
-
##########
|
62 |
-
/README.html
|
63 |
-
|
64 |
-
# PhpStrom Project Files #
|
65 |
-
.idea/
|
66 |
-
library/vendors/composer
|
67 |
-
assets/img/.DS_Store
|
68 |
-
assets/sass/HTML
|
69 |
-
assets/sass/Rails
|
70 |
-
HTML
|
71 |
-
Rails
|
72 |
-
|
73 |
-
# CGB
|
74 |
-
.idea/
|
75 |
-
.vscode/
|
76 |
-
node_modules/
|
77 |
-
.DS_Store
|
78 |
-
*.tgz
|
79 |
-
my-app*
|
80 |
-
template/src/__tests__/__snapshots__/
|
81 |
-
lerna-debug.log
|
82 |
-
npm-debug.log*
|
83 |
-
yarn-debug.log*
|
84 |
-
yarn-error.log*
|
85 |
Â
/.changelog
|
1 |
+
# Packages #
|
2 |
+
############
|
3 |
+
*.7z
|
4 |
+
*.dmg
|
5 |
+
*.gz
|
6 |
+
*.bz2
|
7 |
+
*.iso
|
8 |
+
*.jar
|
9 |
+
*.rar
|
10 |
+
*.tar
|
11 |
+
*.zip
|
12 |
+
*.tgz
|
13 |
+
*.map
|
14 |
+
|
15 |
+
# Logs and databases #
|
16 |
+
######################
|
17 |
+
*.log
|
18 |
+
*.sql
|
19 |
+
|
20 |
+
# OS generated files #
|
21 |
+
######################
|
22 |
+
**.DS_Store*
|
23 |
+
ehthumbs.db
|
24 |
+
Icon?
|
25 |
+
Thumbs.db
|
26 |
+
._*
|
27 |
+
|
28 |
+
# Vim generated files #
|
29 |
+
######################
|
30 |
+
*.un~
|
31 |
+
|
32 |
+
# SASS #
|
33 |
+
##########
|
34 |
+
**/.sass-cache
|
35 |
+
**/.sass-cache/*
|
36 |
+
**/.map
|
37 |
+
|
38 |
+
# Composer #
|
39 |
+
##########
|
40 |
+
vendors/composer/
|
41 |
+
!assets/js/vendor/
|
42 |
+
wpcs/
|
43 |
+
composer.lock
|
44 |
+
|
45 |
+
# Bower #
|
46 |
+
##########
|
47 |
+
assets/bower_components/*
|
48 |
+
|
49 |
+
# Codekit #
|
50 |
+
##########
|
51 |
+
/codekit-config.json
|
52 |
+
*.codekit
|
53 |
+
**.codekit-cache/*
|
54 |
+
|
55 |
+
# NPM #
|
56 |
+
##########
|
57 |
+
node_modules
|
58 |
+
**/node_modules/**
|
59 |
+
|
60 |
+
# Compiled Files and Build Dirs #
|
61 |
+
##########
|
62 |
+
/README.html
|
63 |
+
|
64 |
+
# PhpStrom Project Files #
|
65 |
+
.idea/
|
66 |
+
library/vendors/composer
|
67 |
+
assets/img/.DS_Store
|
68 |
+
assets/sass/HTML
|
69 |
+
assets/sass/Rails
|
70 |
+
HTML
|
71 |
+
Rails
|
72 |
+
|
73 |
+
# CGB
|
74 |
+
.idea/
|
75 |
+
.vscode/
|
76 |
+
node_modules/
|
77 |
+
.DS_Store
|
78 |
+
*.tgz
|
79 |
+
my-app*
|
80 |
+
template/src/__tests__/__snapshots__/
|
81 |
+
lerna-debug.log
|
82 |
+
npm-debug.log*
|
83 |
+
yarn-debug.log*
|
84 |
+
yarn-error.log*
|
85 |
Â
/.changelog
|
gutenberg/form/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),s=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}return r("next")})}}var o,a,i,s,c,l,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),d=(n.n(f),wp.i18n.__),h=wp.blocks.registerBlockType,g=wp.components,v=g.SelectControl,b=(g.TextControl,wp.editor.RichText,!1);h("opinion-stage/block-os-form",{title:d("Form"),icon:"editor-justify",category:"opinion-stage",keywords:[d("Opinion Stage Form"),d("Opinion Stage Form")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=form&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,b=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<b.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(b[n].attributes["landing-page-url"]),l=r.pathname;if(t==l){o=b[n].attributes.title,a=b[n].attributes["image-url"],i=b[n].attributes["landing-page-url"],s=b[n].attributes["edit-url"],c=b[n].attributes["stats-url"];break}}}}),d=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),O=wp.element.createElement(v,{id:"selectID",options:l,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var h=osGutenData.onCreateButtonClickOs+"?w_type=form&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",g=function(e){window.open(h,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var w=osGutenData.callbackUrlOs,y=w,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),k=function(e){window.location.replace(y)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopupform , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("p",{className:"components-heading"},"Please connect WordPress to Opinion Stage to start adding forms"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:k},"Connect")),wp.element.createElement("span",null));if(0==b)l=[{value:"Select",label:"Select a form"},{value:"refresh",label:"Refresh"}],t();else{l=[{value:"Select",label:"Select a form"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<b.length;x++){l[l.length]={value:b[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:b[x].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(b[x].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=b[x].attributes.title,a=b[x].attributes["image-url"],i=b[x].attributes["landing-page-url"],s=b[x].attributes["edit-url"],c=b[x].attributes["stats-url"];var L=b[x].id}}}"refresh"==u&&t();var O=wp.element.createElement(v,{id:"selectID",options:l,value:u,onChange:f,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopupform").live("click",function(e){console.log("oswpLauncherContentPopupform"),e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none"),console.log("test")}})});var S=wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopupform",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"form"},"Select a Form"),wp.element.createElement("input",{type:"button",value:"Create a New Form",className:"components-button is-button is-default is-block is-primary",onClick:g}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},O,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:d})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),L="os-widget-"+L,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(S=wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:s,target:"_blank"}," Edit "),wp.element.createElement("a",{href:c,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:d})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Form: ",o)))),O=wp.element.createElement(v,{id:"selectID",options:l,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},S)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-form-wrapper","data-type":"form","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),s=new f(r||[]);return i._invoke=l(e,n,s),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,o,a,i){var s=r(e[n],e,o);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"===typeof l&&b.call(l,"__await")?Promise.resolve(l.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(l).then(function(e){c.value=e,a(c)},i)}i(s.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function l(e,t,n){var o=N;return function(a,i){if(o===O)throw new Error("Generator is already running");if(o===S){if("throw"===a)throw i;return h()}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var c=u(s,n);if(c){if(c===T)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=S,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=O;var l=r(e,t,n);if("normal"===l.type){if(o=n.done?S:L,l.arg===T)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=S,n.method="throw",n.arg=l.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,u(e,t),"throw"===t.method))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,T;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,T):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=g,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:g,done:!0}}var g,v=Object.prototype,b=v.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",k=w.toStringTag||"@@toStringTag",x="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(x&&(e.exports=_));_=t.regeneratorRuntime=x?e.exports:{},_.wrap=n;var N="suspendedStart",L="suspendedYield",O="executing",S="completed",T={},C={};C[y]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(d([])));j&&j!==v&&b.call(j,y)&&(C=j);var A=i.prototype=o.prototype=Object.create(C);a.prototype=A.constructor=i,i.constructor=a,i[k]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,k in e||(e[k]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},s(c.prototype),c.prototype[E]=function(){return this},_.AsyncIterator=c,_.async=function(e,t,r,o){var a=new c(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},s(A),A[k]="Generator",A[y]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&b.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=b.call(o,"catchLoc"),s=b.call(o,"finallyLoc");if(i&&s){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=g),T}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});n(1)},function(t,e,n){"use strict";function r(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,n){function r(o,i){try{var a=e[o](i),s=a.value}catch(t){return void n(t)}if(!a.done)return Promise.resolve(s).then(function(t){r("next",t)},function(t){r("throw",t)});t(s)}return r("next")})}}var o=n(2),i=n.n(o),a=n(5),s=(n.n(a),n(6)),c=(n.n(s),wp.i18n.__),l=wp.blocks.registerBlockType,u=wp.components,m=(u.SelectControl,u.TextControl,wp.editor.RichText,!1);l("opinion-stage/block-os-form",{title:c("Form"),icon:"editor-justify",category:"opinion-stage",keywords:[c("Opinion Stage Form"),c("Opinion Stage Form")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"},insertItemImage:{source:"attribute",attribute:"data-image-url",selector:"div[data-image-url]"},insertItemOsTitle:{source:"attribute",attribute:"data-title-url",selector:"div[data-title-url]"},insertItemOsView:{source:"attribute",attribute:"data-view-url",selector:"div[data-view-url]"},insertItemOsEdit:{source:"attribute",attribute:"data-edit-url",selector:"div[data-edit-url]"},insertItemOsStatistics:{source:"attribute",attribute:"data-statistics-url",selector:"div[data-statistics-url]"}},edit:function(t){var e=t.attributes,n=e.embedUrl,o=(e.lockEmbed,e.buttonText),a=e.insertItemImage,s=e.insertItemOsTitle,c=e.insertItemOsView,l=e.insertItemOsEdit,u=e.insertItemOsStatistics,p=(t.setAttributes,osGutenData.callbackUrlOs),f=p,d=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),h=function(e){window.verifyOSInsert=function(e){var n=this;t.setAttributes({embedUrl:e,buttonText:"Change"});var a=osGutenData.OswpPluginVersion,s=osGutenData.OswpClientToken,c=osGutenData.OswpFetchDataUrl+"?type=form&page=1&per_page=99";fetch(c,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":a,"OSWP-Client-Token":s}}).then(function(){var e=r(i.a.mark(function e(r){var a;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.json();case 2:a=e.sent,a=a.data,m=a,t.setAttributes({buttonText:o});case 6:case"end":return e.stop()}},e,n)}));return function(t){return e.apply(this,arguments)}}()).catch(function(t){console.log("ERROR: "+t.message)})}},g=function(e){t.setAttributes({embedUrl:"",buttonText:"Embed",lockEmbed:!1,insertItemImage:!1,insertItemOsTitle:!1,insertItemOsView:!1,insertItemOsEdit:!1,insertItemOsStatistics:!1})},v=function(t){window.location.replace(f)},b=osGutenData.onCreateButtonClickOs+"?w_type=contact_form&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",w=function(t){window.open(b,"_blank").focus()};if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:t.className},wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:d,alt:""})),wp.element.createElement("p",{className:"components-heading"},"Please connect WordPress to Opinion Stage to start adding forms"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:v},"Connect")),wp.element.createElement("div",null));if($(document).ready(function(){$("span#oswpLauncherContentPopupform").live("click",function(t){t.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var e=$(this).attr("data-os-block");$("button#dropbtn span").text(e);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==e){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(t){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none")}})}),0!=m)for(var y=0;y<m.length;y++){var E=function(t){var e=document.createElement("a");return e.href=t,e}(m[y].attributes["landing-page-url"]),x=E.pathname;if(n==x){t.setAttributes({lockEmbed:!0,buttonText:"Change"}),t.setAttributes({insertItemImage:m[y].attributes["image-url"]}),t.setAttributes({insertItemOsTitle:m[y].attributes.title}),t.setAttributes({insertItemOsView:m[y].attributes["landing-page-url"]}),t.setAttributes({insertItemOsEdit:m[y].attributes["edit-url"]}),t.setAttributes({insertItemOsStatistics:m[y].attributes["stats-url"]});break}}var k=wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:d,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopupform",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"form",onClick:h},"Select a Form"),wp.element.createElement("input",{type:"button",value:"Create a New form",className:"components-button is-button is-default is-block is-primary",onClick:w}),wp.element.createElement("span",null));return""!=n&&n?"Embed"==o||"Change"==o&&(k=wp.element.createElement("div",{className:"os-form-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:d,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:s,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:c,target:"_blank"}," View "),wp.element.createElement("a",{href:l,target:"_blank"}," Edit "),wp.element.createElement("a",{href:u,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:o,className:"components-button is-button is-default is-large left-align",onClick:g})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Form: ",s))),wp.element.createElement("span",null))):""==n||"undefined"===jQuery.type(n)||t.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:t.className},k,wp.element.createElement("span",null))},save:function(t){var e=t.attributes,n=e.embedUrl,r=e.lockEmbed,o=e.buttonText,i=e.insertItemImage,a=e.insertItemOsTitle,s=e.insertItemOsView,c=e.insertItemOsEdit,l=e.insertItemOsStatistics;return wp.element.createElement("div",{class:"os-form-wrapper","data-type":"form","data-image-url":i,"data-title-url":a,"data-view-url":s,"data-statistics-url":l,"data-edit-url":c,"data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]',wp.element.createElement("span",null))}})},function(t,e,n){t.exports=n(3)},function(t,e,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,i=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,t.exports=n(4),o)r.regeneratorRuntime=i;else try{delete r.regeneratorRuntime}catch(t){r.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";function n(t,e,n,r){var i=e&&e.prototype instanceof o?e:o,a=Object.create(i.prototype),s=new f(r||[]);return a._invoke=l(t,n,s),a}function r(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function o(){}function i(){}function a(){}function s(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function c(t){function e(n,o,i,a){var s=r(t[n],t,o);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"===typeof l&&b.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,i,a)},function(t){e("throw",t,i,a)}):Promise.resolve(l).then(function(t){c.value=t,i(c)},a)}a(s.arg)}function n(t,n){function r(){return new Promise(function(r,o){e(t,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function l(t,e,n){var o=_;return function(i,a){if(o===L)throw new Error("Generator is already running");if(o===N){if("throw"===i)throw a;return h()}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var c=u(s,n);if(c){if(c===T)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===_)throw o=N,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=L;var l=r(t,e,n);if("normal"===l.type){if(o=n.done?N:I,l.arg===T)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=N,n.method="throw",n.arg=l.arg)}}}function u(t,e){var n=t.iterator[e.method];if(n===g){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=g,u(t,e),"throw"===e.method))return T;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=r(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,T;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=g),e.delegate=null,T):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,T)}function m(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function p(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function f(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(m,this),this.reset(!0)}function d(t){if(t){var e=t[y];if(e)return e.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(b.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=g,e.done=!0,e};return r.next=r}}return{next:h}}function h(){return{value:g,done:!0}}var g,v=Object.prototype,b=v.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",x=w.toStringTag||"@@toStringTag",k="object"===typeof t,O=e.regeneratorRuntime;if(O)return void(k&&(t.exports=O));O=e.regeneratorRuntime=k?t.exports:{},O.wrap=n;var _="suspendedStart",I="suspendedYield",L="executing",N="completed",T={},P={};P[y]=function(){return this};var S=Object.getPrototypeOf,j=S&&S(S(d([])));j&&j!==v&&b.call(j,y)&&(P=j);var C=a.prototype=o.prototype=Object.create(P);i.prototype=C.constructor=a,a.constructor=i,a[x]=i.displayName="GeneratorFunction",O.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===i||"GeneratorFunction"===(e.displayName||e.name))},O.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,x in t||(t[x]="GeneratorFunction")),t.prototype=Object.create(C),t},O.awrap=function(t){return{__await:t}},s(c.prototype),c.prototype[E]=function(){return this},O.AsyncIterator=c,O.async=function(t,e,r,o){var i=new c(n(t,e,r,o));return O.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},s(C),C[x]="Generator",C[y]=function(){return this},C.toString=function(){return"[object Generator]"},O.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},O.values=d,f.prototype={constructor:f,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(p),!t)for(var e in this)"t"===e.charAt(0)&&b.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=g)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,r){return i.type="throw",i.arg=t,n.next=e,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw t;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=b.call(o,"catchLoc"),s=b.call(o,"finallyLoc");if(a&&s){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),T},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),p(n),T}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;p(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:d(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=g),T}}}(function(){return this}()||Function("return this")())},function(t,e){},function(t,e){}]);
|
gutenberg/form/src/.DS_Store
CHANGED
Binary file
|
gutenberg/form/src/block/block.js
CHANGED
@@ -6,13 +6,12 @@ const { registerBlockType } = wp.blocks;
|
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
-
var dropdownOptions
|
10 |
-
var
|
11 |
-
var
|
12 |
-
var
|
13 |
-
var
|
14 |
-
var
|
15 |
-
var options;
|
16 |
Â
|
17 |
Â
registerBlockType( 'opinion-stage/block-os-form', {
|
18 |
Â
title: __( 'Form' ),
|
@@ -21,18 +20,13 @@ var options;
|
|
21 |
Â
keywords: [
|
22 |
Â
__( 'Opinion Stage Form' ),
|
23 |
Â
__( 'Opinion Stage Form' ),
|
24 |
-
],
|
25 |
Â
attributes: {
|
26 |
Â
embedUrl: {
|
27 |
Â
source: 'attribute',
|
28 |
Â
attribute: 'data-test-url',
|
29 |
Â
selector: 'div[data-test-url]'
|
30 |
-
},
|
31 |
-
oswpUrlShortcode: {
|
32 |
-
source: 'attribute',
|
33 |
-
attribute: 'data-test-url',
|
34 |
-
selector: 'div[data-test-url]'
|
35 |
-
},
|
36 |
Â
lockEmbed: {
|
37 |
Â
source: 'attribute',
|
38 |
Â
attribute: 'data-lock-embed',
|
@@ -42,175 +36,132 @@ var options;
|
|
42 |
Â
source: 'attribute',
|
43 |
Â
attribute: 'data-button-text',
|
44 |
Â
selector: 'div[data-button-text]'
|
45 |
-
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
46 |
Â
},
|
47 |
Â
edit: function( props ) {
|
48 |
-
|
49 |
-
|
50 |
-
if(val == ''){
|
51 |
-
props.setAttributes({ embedUrl: '' });
|
52 |
-
}else if(val != ''){
|
53 |
-
props.setAttributes({ embedUrl: val });
|
54 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
55 |
-
var getLandingPageUrlOs = function(href) {
|
56 |
-
var locationUrlOS = document.createElement("a");
|
57 |
-
locationUrlOS.href = href;
|
58 |
-
return locationUrlOS;
|
59 |
-
};
|
60 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
61 |
-
var matchValue = locationUrlOS.pathname;
|
62 |
-
if(val == matchValue){
|
63 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
64 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
-
break;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}else{
|
72 |
-
}
|
73 |
-
};
|
74 |
-
const onEmbedButtonClick = event => {
|
75 |
-
if( event.target.value == "Embed" ){
|
76 |
-
if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
|
77 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
-
}else{
|
79 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
-
}
|
82 |
-
}else{
|
83 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
-
}
|
85 |
-
};
|
86 |
-
|
87 |
-
window.verifyOSInsert = function(widget){
|
88 |
-
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
-
var myOpts = document.getElementById('selectID').options;
|
90 |
-
for(var i = 0; i < myOpts.length; i++){
|
91 |
-
if(myOpts[i].value == widget){
|
92 |
-
myOpts[i].defaultSelected = true;
|
93 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
-
break;
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=form&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
-
const onCreateButtonClick = value => {
|
101 |
-
// Open Create new form link in new page
|
102 |
-
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
103 |
-
};
|
104 |
-
|
105 |
-
if(!buttonText){
|
106 |
-
props.setAttributes({ buttonText: 'Embed' });
|
107 |
-
}
|
108 |
Â
|
Â
|
|
109 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
110 |
Â
var callback_url = getCallBackUrlOs;
|
111 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
113 |
Â
const onConnectOSWPButtonClick = value => {
|
114 |
-
// Open Connect to opinionstage
|
115 |
Â
window.location.replace(callback_url);
|
116 |
Â
};
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
'Accept':'application/vnd.api+json',
|
126 |
-
'Content-Type':'application/vnd.api+json',
|
127 |
-
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
128 |
-
'OSWP-Client-Token': opinionStageClientToken
|
129 |
-
},
|
130 |
-
})
|
131 |
-
.then(async res => {
|
132 |
-
var data = await res.json();
|
133 |
-
data = data.data;
|
134 |
-
dropdownOptions = data;
|
135 |
-
// force reprinting instead!!
|
136 |
-
props.setAttributes({ buttonText: 'Embed'});
|
137 |
-
props.setAttributes({ buttonText: buttonText});
|
138 |
-
if(buttonText == 'Change' && embedUrl !='Select'){
|
139 |
-
props.setAttributes({ embedUrl: embedUrl });
|
140 |
-
}else{
|
141 |
-
props.setAttributes({ embedUrl: 'Select' });
|
142 |
-
}
|
143 |
-
})
|
144 |
-
.catch(function(err) {
|
145 |
-
console.log('ERROR: ' + err.message);
|
146 |
-
});
|
147 |
-
}
|
148 |
Â
// Checking for Opinion Stage connection
|
149 |
Â
if(osGutenData.isOsConnected == ''){
|
150 |
-
|
151 |
-
$('span#oswpLauncherContentPopupform , #owspLaunchInputCreate').live('click', function(e) {
|
152 |
-
e.preventDefault();
|
153 |
-
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
154 |
-
});
|
155 |
-
});
|
156 |
Â
return (
|
157 |
Â
<div className={ props.className }>
|
158 |
Â
<div className="os-form-wrapper components-placeholder">
|
159 |
Â
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
160 |
Â
<p className="components-heading">Please connect WordPress to Opinion Stage to start adding forms</p>
|
161 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
162 |
-
</div>
|
Â
|
|
163 |
Â
</div>
|
164 |
Â
);
|
165 |
-
}else{
|
166 |
-
|
167 |
-
options = [{value:'Select',label:'Select a form'},{value:'refresh',label:'Refresh'}];
|
168 |
-
OsPolulateList();
|
169 |
-
}else{
|
170 |
-
options = [{value:'Select',label:'Select a form'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
171 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
172 |
-
options[options.length] = {
|
173 |
-
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
174 |
-
label: dropdownOptions[i].attributes['title'],
|
175 |
-
};
|
176 |
-
var getLandingPageUrlOs = function(href) {
|
177 |
-
var locationUrlOS = document.createElement("a");
|
178 |
-
locationUrlOS.href = href;
|
179 |
-
return locationUrlOS;
|
180 |
-
};
|
181 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
182 |
-
var matchValue = locationUrlOS.pathname;
|
183 |
-
if(embedUrl == matchValue){
|
184 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
185 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
186 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
187 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
188 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
189 |
-
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
190 |
-
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
if(embedUrl == 'refresh'){
|
195 |
-
OsPolulateList();
|
196 |
-
}
|
197 |
-
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
198 |
Â
$(document).ready(function () {
|
199 |
-
|
200 |
-
$('.content__list').css('display', 'none');
|
201 |
Â
$('span#oswpLauncherContentPopupform').live('click', function(e) {
|
202 |
Â
e.preventDefault();
|
203 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
204 |
Â
var text = $(this).attr('data-os-block');
|
205 |
Â
$("button#dropbtn span").text(text);
|
206 |
-
var inputs = $(".filter__itm");
|
207 |
Â
for(var i = 0; i < inputs.length; i++){
|
208 |
-
if($(inputs[i]).text() == text){
|
209 |
-
setTimeout(function(){$(inputs[i]).trigger('click');},1000);
|
210 |
Â
setTimeout(function(){
|
211 |
-
|
212 |
-
|
213 |
-
|
Â
|
|
Â
|
|
Â
|
|
214 |
Â
$('button.content__links-itm').live('click', function(e) {
|
215 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
216 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
@@ -220,83 +171,89 @@ var options;
|
|
220 |
Â
else {
|
221 |
Â
$('.progress_message').css('display', 'block');
|
222 |
Â
$('.content__list').css('display', 'none');
|
223 |
-
console.log('test');
|
224 |
Â
}
|
225 |
Â
}
|
226 |
Â
});
|
227 |
Â
});
|
228 |
Â
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
255 |
Â
if(buttonText == 'Embed'){
|
256 |
Â
contentViewEditStatOs
|
257 |
-
}else if(buttonText == 'Change'){
|
258 |
Â
contentViewEditStatOs = (
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
271 |
Â
</div>
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
</div>
|
277 |
-
</div>
|
278 |
-
);
|
279 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
280 |
Â
}
|
281 |
-
}else if(embedUrl == '
|
282 |
Â
contentViewEditStatOs
|
283 |
Â
}else{
|
284 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
285 |
Â
contentViewEditStatOs
|
286 |
Â
}
|
287 |
-
|
288 |
-
|
289 |
-
return (
|
290 |
Â
<div className={ props.className }>
|
291 |
-
{contentViewEditStatOs}
|
Â
|
|
292 |
Â
</div>
|
293 |
Â
);
|
294 |
Â
}
|
295 |
Â
},
|
296 |
-
save: function( {attributes: {embedUrl,
|
297 |
Â
return (
|
298 |
-
<div class="os-form-wrapper"
|
299 |
-
[os-widget path="{
|
Â
|
|
300 |
Â
</div>
|
301 |
Â
);
|
302 |
Â
},
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
+
var dropdownOptions = false;
|
10 |
+
var insertItemImage = false;
|
11 |
+
var insertItemOsTitle = false;
|
12 |
+
var insertItemOsView = false;
|
13 |
+
var insertItemOsEdit = false;
|
14 |
+
var insertItemOsStatistics = false;
|
Â
|
|
15 |
Â
|
16 |
Â
registerBlockType( 'opinion-stage/block-os-form', {
|
17 |
Â
title: __( 'Form' ),
|
20 |
Â
keywords: [
|
21 |
Â
__( 'Opinion Stage Form' ),
|
22 |
Â
__( 'Opinion Stage Form' ),
|
23 |
+
],
|
24 |
Â
attributes: {
|
25 |
Â
embedUrl: {
|
26 |
Â
source: 'attribute',
|
27 |
Â
attribute: 'data-test-url',
|
28 |
Â
selector: 'div[data-test-url]'
|
29 |
+
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
30 |
Â
lockEmbed: {
|
31 |
Â
source: 'attribute',
|
32 |
Â
attribute: 'data-lock-embed',
|
36 |
Â
source: 'attribute',
|
37 |
Â
attribute: 'data-button-text',
|
38 |
Â
selector: 'div[data-button-text]'
|
39 |
+
},
|
40 |
+
insertItemImage: {
|
41 |
+
source: 'attribute',
|
42 |
+
attribute: 'data-image-url',
|
43 |
+
selector: 'div[data-image-url]'
|
44 |
+
},
|
45 |
+
insertItemOsTitle: {
|
46 |
+
source: 'attribute',
|
47 |
+
attribute: 'data-title-url',
|
48 |
+
selector: 'div[data-title-url]'
|
49 |
+
},
|
50 |
+
insertItemOsView: {
|
51 |
+
source: 'attribute',
|
52 |
+
attribute: 'data-view-url',
|
53 |
+
selector: 'div[data-view-url]'
|
54 |
+
},
|
55 |
+
insertItemOsEdit: {
|
56 |
+
source: 'attribute',
|
57 |
+
attribute: 'data-edit-url',
|
58 |
+
selector: 'div[data-edit-url]'
|
59 |
+
},
|
60 |
+
insertItemOsStatistics: {
|
61 |
+
source: 'attribute',
|
62 |
+
attribute: 'data-statistics-url',
|
63 |
+
selector: 'div[data-statistics-url]'
|
64 |
+
}
|
65 |
Â
},
|
66 |
Â
edit: function( props ) {
|
67 |
+
// Setting Attributes
|
68 |
+
let {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage,insertItemOsTitle,insertItemOsView,insertItemOsEdit,insertItemOsStatistics}, setAttributes} = props;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
69 |
Â
|
70 |
+
// Fetching Localized variables
|
71 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
72 |
Â
var callback_url = getCallBackUrlOs;
|
73 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
74 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
75 |
+
|
76 |
+
// Select Button Click functionality
|
77 |
+
const onSelectButtonClick = value => {
|
78 |
+
window.verifyOSInsert = function(widget){
|
79 |
+
props.setAttributes({ embedUrl: widget, buttonText:'Change' });
|
80 |
+
|
81 |
+
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
82 |
+
var opinionStageClientToken = osGutenData.OswpClientToken;
|
83 |
+
var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=form&page=1&per_page=99';
|
84 |
+
fetch(opinionstageFetchDataUrl, {
|
85 |
+
method: "GET",
|
86 |
+
headers: {
|
87 |
+
'Accept':'application/vnd.api+json',
|
88 |
+
'Content-Type':'application/vnd.api+json',
|
89 |
+
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
90 |
+
'OSWP-Client-Token': opinionStageClientToken
|
91 |
+
},
|
92 |
+
})
|
93 |
+
.then(async res => {
|
94 |
+
var data = await res.json();
|
95 |
+
data = data.data;
|
96 |
+
dropdownOptions = data;
|
97 |
+
// force reprinting instead!!
|
98 |
+
props.setAttributes({ buttonText: buttonText});
|
99 |
+
|
100 |
+
})
|
101 |
+
.catch(function(err) {
|
102 |
+
console.log('ERROR: ' + err.message);
|
103 |
+
});
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
// Change Button Click functionality
|
108 |
+
const onChangeButtonClick = value => {
|
109 |
+
props.setAttributes({
|
110 |
+
embedUrl: '',
|
111 |
+
buttonText:'Embed',
|
112 |
+
lockEmbed: false,
|
113 |
+
insertItemImage: false,
|
114 |
+
insertItemOsTitle: false,
|
115 |
+
insertItemOsView: false,
|
116 |
+
insertItemOsEdit: false,
|
117 |
+
insertItemOsStatistics: false
|
118 |
+
});
|
119 |
+
}
|
120 |
+
|
121 |
+
// Connect to Opinionstage Callback Url
|
122 |
Â
const onConnectOSWPButtonClick = value => {
|
Â
|
|
123 |
Â
window.location.replace(callback_url);
|
124 |
Â
};
|
125 |
+
|
126 |
+
// Create New Item Url (form)
|
127 |
+
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=contact_form&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
128 |
+
const onCreateButtonClick = value => {
|
129 |
+
// Open Create new form link in new page
|
130 |
+
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
131 |
+
};
|
132 |
+
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
133 |
Â
// Checking for Opinion Stage connection
|
134 |
Â
if(osGutenData.isOsConnected == ''){
|
135 |
+
// Not Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
136 |
Â
return (
|
137 |
Â
<div className={ props.className }>
|
138 |
Â
<div className="os-form-wrapper components-placeholder">
|
139 |
Â
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
140 |
Â
<p className="components-heading">Please connect WordPress to Opinion Stage to start adding forms</p>
|
141 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
142 |
+
</div>
|
143 |
+
<div></div>
|
144 |
Â
</div>
|
145 |
Â
);
|
146 |
+
}else{
|
147 |
+
// Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
148 |
Â
$(document).ready(function () {
|
149 |
+
// Content Popup Launch Working
|
Â
|
|
150 |
Â
$('span#oswpLauncherContentPopupform').live('click', function(e) {
|
151 |
Â
e.preventDefault();
|
152 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
153 |
Â
var text = $(this).attr('data-os-block');
|
154 |
Â
$("button#dropbtn span").text(text);
|
155 |
+
var inputs = $(".filter__itm");
|
156 |
Â
for(var i = 0; i < inputs.length; i++){
|
157 |
+
if($(inputs[i]).text() == text){
|
Â
|
|
158 |
Â
setTimeout(function(){
|
159 |
+
$(inputs[i]).trigger('click');
|
160 |
+
},1000);
|
161 |
+
setTimeout(function(){
|
162 |
+
$('.progress_message').css('display', 'none');
|
163 |
+
$('.content__list').css('display', 'block');
|
164 |
+
},2500);
|
165 |
Â
$('button.content__links-itm').live('click', function(e) {
|
166 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
167 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
171 |
Â
else {
|
172 |
Â
$('.progress_message').css('display', 'block');
|
173 |
Â
$('.content__list').css('display', 'none');
|
Â
|
|
174 |
Â
}
|
175 |
Â
}
|
176 |
Â
});
|
177 |
Â
});
|
178 |
Â
|
179 |
+
// Fetching Ajax Call Result
|
180 |
+
if(dropdownOptions != false){
|
181 |
+
for (var i = 0; i < dropdownOptions.length; i++) {
|
182 |
+
var getLandingPageUrlOs = function(href) {
|
183 |
+
var locationUrlOS = document.createElement("a");
|
184 |
+
locationUrlOS.href = href;
|
185 |
+
return locationUrlOS;
|
186 |
+
};
|
187 |
+
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
188 |
+
var matchValue = locationUrlOS.pathname;
|
189 |
+
if(embedUrl == matchValue){
|
190 |
+
props.setAttributes({lockEmbed: true, buttonText: "Change" });
|
191 |
+
props.setAttributes({ insertItemImage : dropdownOptions[i].attributes['image-url'] });
|
192 |
+
props.setAttributes({ insertItemOsTitle : dropdownOptions[i].attributes['title'] });
|
193 |
+
props.setAttributes({ insertItemOsView : dropdownOptions[i].attributes['landing-page-url'] });
|
194 |
+
props.setAttributes({ insertItemOsEdit : dropdownOptions[i].attributes['edit-url'] });
|
195 |
+
props.setAttributes({ insertItemOsStatistics : dropdownOptions[i].attributes['stats-url'] });
|
196 |
+
break;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
// Content On Editor
|
202 |
+
var contentViewEditStatOs = (
|
203 |
+
<div className="os-form-wrapper components-placeholder">
|
204 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
205 |
+
<span id="oswpLauncherContentPopupform" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="form" onClick={onSelectButtonClick} >Select a Form</span>
|
206 |
+
<input type="button" value="Create a New form" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
207 |
+
<span></span>
|
208 |
+
</div>
|
209 |
+
);
|
210 |
+
|
211 |
+
if(embedUrl != '' && embedUrl){
|
212 |
Â
if(buttonText == 'Embed'){
|
213 |
Â
contentViewEditStatOs
|
214 |
+
}else if(buttonText == 'Change'){
|
215 |
Â
contentViewEditStatOs = (
|
216 |
+
<div className="os-form-wrapper components-placeholder">
|
217 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
218 |
+
<div className="components-preview__block" >
|
219 |
+
<div className="components-preview__leftBlockImage">
|
220 |
+
<img src={insertItemImage} alt={insertItemOsTitle} className="image" />
|
221 |
+
<div className="overlay">
|
222 |
+
<div className="text">
|
223 |
+
<a href={insertItemOsView} target="_blank"> View </a>
|
224 |
+
<a href={insertItemOsEdit} target="_blank"> Edit </a>
|
225 |
+
<a href={insertItemOsStatistics} target="_blank"> Statistics </a>
|
226 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onChangeButtonClick}/>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
<div className="components-preview__rightBlockContent">
|
231 |
+
<div className="components-placeholder__label">Form: {insertItemOsTitle}</div>
|
232 |
Â
</div>
|
233 |
+
</div>
|
234 |
+
<span></span>
|
235 |
+
</div>
|
236 |
+
);
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
237 |
Â
}
|
238 |
+
}else if(embedUrl == '' || jQuery.type(embedUrl) === "undefined"){
|
239 |
Â
contentViewEditStatOs
|
240 |
Â
}else{
|
241 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
242 |
Â
contentViewEditStatOs
|
243 |
Â
}
|
244 |
+
return (
|
Â
|
|
Â
|
|
245 |
Â
<div className={ props.className }>
|
246 |
+
{contentViewEditStatOs}
|
247 |
+
<span></span>
|
248 |
Â
</div>
|
249 |
Â
);
|
250 |
Â
}
|
251 |
Â
},
|
252 |
+
save: function( {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage, insertItemOsTitle, insertItemOsView, insertItemOsEdit, insertItemOsStatistics }} ) {
|
253 |
Â
return (
|
254 |
+
<div class="os-form-wrapper" data-type="form" data-image-url={insertItemImage} data-title-url={insertItemOsTitle} data-view-url={insertItemOsView} data-statistics-url={insertItemOsStatistics} data-edit-url={insertItemOsEdit} data-test-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
255 |
+
[os-widget path="{embedUrl}"]
|
256 |
+
<span></span>
|
257 |
Â
</div>
|
258 |
Â
);
|
259 |
Â
},
|
gutenberg/init.php
CHANGED
@@ -56,24 +56,29 @@ function oswp_gutenberg_enqueue_scripts() {
|
|
56 |
Â
$OswpPluginVersion = OPINIONSTAGE_WIDGET_VERSION;
|
57 |
Â
|
58 |
Â
// Fetch Url For Ajax Call Opinion Stage
|
59 |
-
$FetchUrlOS = '
|
60 |
Â
|
61 |
Â
// Url For Creating New Content OR Template On Opinion Stage
|
62 |
-
$getUrlFormAction = '
|
63 |
Â
|
64 |
Â
// Opninionstge logo image link
|
65 |
Â
$logoImagelinkOs = plugin_dir_url( __FILE__ ) . 'image/os-logo.png';
|
66 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
67 |
Â
// Data to pass to gutenberg editor
|
68 |
Â
$dataToPass = array(
|
69 |
Â
'isOsConnected' => (isset($os_options['uid']) && $os_options['uid'] != '') ? true : false,
|
70 |
-
'onCreateButtonClickOs' => '
|
71 |
Â
'callbackUrlOs' => $adminUrlForOs,
|
72 |
Â
'OswpPluginVersion' => $OswpPluginVersion,
|
73 |
Â
'OswpClientToken' => opinionstage_user_access_token(),
|
74 |
Â
'OswpFetchDataUrl' => $FetchUrlOS,
|
75 |
Â
'getActionUrlOS' => $getUrlFormAction,
|
76 |
Â
'getLogoImageLink' => $logoImagelinkOs,
|
Â
|
|
77 |
Â
);
|
78 |
Â
wp_localize_script( 'opinionStage_poll_oswp_block_js_set', 'osGutenData', $dataToPass );
|
79 |
Â
}
|
56 |
Â
$OswpPluginVersion = OPINIONSTAGE_WIDGET_VERSION;
|
57 |
Â
|
58 |
Â
// Fetch Url For Ajax Call Opinion Stage
|
59 |
+
$FetchUrlOS = OPINIONSTAGE_SERVER_BASE.'/api/wp/v1/my/widgets';
|
60 |
Â
|
61 |
Â
// Url For Creating New Content OR Template On Opinion Stage
|
62 |
+
$getUrlFormAction = OPINIONSTAGE_SERVER_BASE.'/integrations/wordpress/new';
|
63 |
Â
|
64 |
Â
// Opninionstge logo image link
|
65 |
Â
$logoImagelinkOs = plugin_dir_url( __FILE__ ) . 'image/os-logo.png';
|
66 |
Â
|
67 |
+
// Opinionstage view item count
|
68 |
+
$OsOptions = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
69 |
+
|
70 |
+
|
71 |
Â
// Data to pass to gutenberg editor
|
72 |
Â
$dataToPass = array(
|
73 |
Â
'isOsConnected' => (isset($os_options['uid']) && $os_options['uid'] != '') ? true : false,
|
74 |
+
'onCreateButtonClickOs' => OPINIONSTAGE_SERVER_BASE.'/api/wp/redirects/widgets/new',
|
75 |
Â
'callbackUrlOs' => $adminUrlForOs,
|
76 |
Â
'OswpPluginVersion' => $OswpPluginVersion,
|
77 |
Â
'OswpClientToken' => opinionstage_user_access_token(),
|
78 |
Â
'OswpFetchDataUrl' => $FetchUrlOS,
|
79 |
Â
'getActionUrlOS' => $getUrlFormAction,
|
80 |
Â
'getLogoImageLink' => $logoImagelinkOs,
|
81 |
+
'getOsOption' => $OsOptions,
|
82 |
Â
);
|
83 |
Â
wp_localize_script( 'opinionStage_poll_oswp_block_js_set', 'osGutenData', $dataToPass );
|
84 |
Â
}
|
gutenberg/personality/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),s=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}return r("next")})}}var o,a,i,s,l,c,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),d=(n.n(f),wp.i18n.__),h=wp.blocks.registerBlockType,g=wp.components,v=g.SelectControl,b=(g.TextControl,wp.editor.RichText,!1);h("opinion-stage/block-os-personality",{title:d("Personality Quiz"),icon:"smiley",category:"opinion-stage",keywords:[d("Opinion Stage Personality Quiz"),d("Opinion Stage Personality")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=outcome&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,b=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<b.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(b[n].attributes["landing-page-url"]),c=r.pathname;if(t==c){o=b[n].attributes.title,a=b[n].attributes["image-url"],i=b[n].attributes["landing-page-url"],s=b[n].attributes["edit-url"],l=b[n].attributes["stats-url"];break}}}}),d=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),O=wp.element.createElement(v,{id:"selectID",options:c,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var h=osGutenData.onCreateButtonClickOs+"?w_type=outcome&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",g=function(e){window.open(h,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var y=osGutenData.callbackUrlOs,w=y,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),k=function(e){window.location.replace(w)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopuppersonality , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("p",{className:"components-heading"},"Please connect WordPress to Opinion Stage to start adding personality"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:k},"Connect")));if(0==b)c=[{value:"Select",label:"Select a personality"},{value:"refresh",label:"Refresh"}],t();else{c=[{value:"Select",label:"Select a personality"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<b.length;x++){c[c.length]={value:b[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:b[x].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(b[x].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=b[x].attributes.title,a=b[x].attributes["image-url"],i=b[x].attributes["landing-page-url"],s=b[x].attributes["edit-url"],l=b[x].attributes["stats-url"];var L=b[x].id}}}"refresh"==u&&t();var O=wp.element.createElement(v,{id:"selectID",options:c,value:u,onChange:f,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopuppersonality").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none"),console.log("test")}})});var P=wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopuppersonality",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"personality quiz"},"Select a Personality Quiz"),wp.element.createElement("input",{type:"button",value:"Create a New Personality Quiz",className:"components-button is-button is-default is-block is-primary",onClick:g}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},O,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:d})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),L="os-widget-"+L,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(P=wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:s,target:"_blank"}," Edit "),wp.element.createElement("a",{href:l,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:d})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Personality Quiz: ",o)))),O=wp.element.createElement(v,{id:"selectID",options:c,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},P)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-personality-wrapper","data-type":"personality","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),s=new f(r||[]);return i._invoke=c(e,n,s),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function l(e){function t(n,o,a,i){var s=r(e[n],e,o);if("throw"!==s.type){var l=s.arg,c=l.value;return c&&"object"===typeof c&&b.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(c).then(function(e){l.value=e,a(l)},i)}i(s.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function c(e,t,n){var o=N;return function(a,i){if(o===O)throw new Error("Generator is already running");if(o===P){if("throw"===a)throw i;return h()}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var l=u(s,n);if(l){if(l===S)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=P,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=O;var c=r(e,t,n);if("normal"===c.type){if(o=n.done?P:L,c.arg===S)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=P,n.method="throw",n.arg=c.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,u(e,t),"throw"===t.method))return S;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return S}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,S;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,S):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,S)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[w];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=g,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:g,done:!0}}var g,v=Object.prototype,b=v.hasOwnProperty,y="function"===typeof Symbol?Symbol:{},w=y.iterator||"@@iterator",E=y.asyncIterator||"@@asyncIterator",k=y.toStringTag||"@@toStringTag",x="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(x&&(e.exports=_));_=t.regeneratorRuntime=x?e.exports:{},_.wrap=n;var N="suspendedStart",L="suspendedYield",O="executing",P="completed",S={},T={};T[w]=function(){return this};var C=Object.getPrototypeOf,j=C&&C(C(d([])));j&&j!==v&&b.call(j,w)&&(T=j);var A=i.prototype=o.prototype=Object.create(T);a.prototype=A.constructor=i,i.constructor=a,i[k]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,k in e||(e[k]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},s(l.prototype),l.prototype[E]=function(){return this},_.AsyncIterator=l,_.async=function(e,t,r,o){var a=new l(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},s(A),A[k]="Generator",A[w]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&b.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=b.call(o,"catchLoc"),s=b.call(o,"finallyLoc");if(i&&s){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,S):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),S},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),S}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=g),S}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});n(1)},function(t,e,n){"use strict";function r(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,n){function r(i,o){try{var a=e[i](o),s=a.value}catch(t){return void n(t)}if(!a.done)return Promise.resolve(s).then(function(t){r("next",t)},function(t){r("throw",t)});t(s)}return r("next")})}}var i=n(2),o=n.n(i),a=n(5),s=(n.n(a),n(6)),c=(n.n(s),wp.i18n.__),l=wp.blocks.registerBlockType,u=wp.components,p=(u.SelectControl,u.TextControl,wp.editor.RichText,!1);l("opinion-stage/block-os-personality",{title:c("Personality Quiz"),icon:"smiley",category:"opinion-stage",keywords:[c("Opinion Stage Personality Quiz"),c("Opinion Stage Personality")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"},insertItemImage:{source:"attribute",attribute:"data-image-url",selector:"div[data-image-url]"},insertItemOsTitle:{source:"attribute",attribute:"data-title-url",selector:"div[data-title-url]"},insertItemOsView:{source:"attribute",attribute:"data-view-url",selector:"div[data-view-url]"},insertItemOsEdit:{source:"attribute",attribute:"data-edit-url",selector:"div[data-edit-url]"},insertItemOsStatistics:{source:"attribute",attribute:"data-statistics-url",selector:"div[data-statistics-url]"}},edit:function(t){var e=t.attributes,n=e.embedUrl,i=(e.lockEmbed,e.buttonText),a=e.insertItemImage,s=e.insertItemOsTitle,c=e.insertItemOsView,l=e.insertItemOsEdit,u=e.insertItemOsStatistics,m=(t.setAttributes,osGutenData.callbackUrlOs),d=m,f=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),h=function(e){window.verifyOSInsert=function(e){var n=this;t.setAttributes({embedUrl:e,buttonText:"Change"});var a=osGutenData.OswpPluginVersion,s=osGutenData.OswpClientToken,c=osGutenData.OswpFetchDataUrl+"?type=outcome&page=1&per_page=99";fetch(c,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":a,"OSWP-Client-Token":s}}).then(function(){var e=r(o.a.mark(function e(r){var a;return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.json();case 2:a=e.sent,a=a.data,p=a,t.setAttributes({buttonText:i});case 6:case"end":return e.stop()}},e,n)}));return function(t){return e.apply(this,arguments)}}()).catch(function(t){console.log("ERROR: "+t.message)})}},g=function(e){t.setAttributes({embedUrl:"",buttonText:"Embed",lockEmbed:!1,insertItemImage:!1,insertItemOsTitle:!1,insertItemOsView:!1,insertItemOsEdit:!1,insertItemOsStatistics:!1})},v=function(t){window.location.replace(d)},y=osGutenData.onCreateButtonClickOs+"?w_type=outcome&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",b=function(t){window.open(y,"_blank").focus()};if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:t.className},wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("p",{className:"components-heading"},"Please connect WordPress to Opinion Stage to start adding personality"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:v},"Connect")),wp.element.createElement("div",null));if($(document).ready(function(){$("span#oswpLauncherContentPopuppersonality").live("click",function(t){t.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var e=$(this).attr("data-os-block");$("button#dropbtn span").text(e);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==e){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(t){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none")}})}),0!=p)for(var w=0;w<p.length;w++){var E=function(t){var e=document.createElement("a");return e.href=t,e}(p[w].attributes["landing-page-url"]),x=E.pathname;if(n==x){t.setAttributes({lockEmbed:!0,buttonText:"Change"}),t.setAttributes({insertItemImage:p[w].attributes["image-url"]}),t.setAttributes({insertItemOsTitle:p[w].attributes.title}),t.setAttributes({insertItemOsView:p[w].attributes["landing-page-url"]}),t.setAttributes({insertItemOsEdit:p[w].attributes["edit-url"]}),t.setAttributes({insertItemOsStatistics:p[w].attributes["stats-url"]});break}}var k=wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopuppersonality",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"personality quiz",onClick:h},"Select a Personality Quiz"),wp.element.createElement("input",{type:"button",value:"Create a New Personality Quiz",className:"components-button is-button is-default is-block is-primary",onClick:b}),wp.element.createElement("span",null));return""!=n&&n?"Embed"==i||"Change"==i&&(k=wp.element.createElement("div",{className:"os-personality-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:s,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:c,target:"_blank"}," View "),wp.element.createElement("a",{href:l,target:"_blank"}," Edit "),wp.element.createElement("a",{href:u,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:i,className:"components-button is-button is-default is-large left-align",onClick:g})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Personality Quiz: ",s))),wp.element.createElement("span",null))):""==n||"undefined"===jQuery.type(n)||t.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:t.className},k,wp.element.createElement("span",null))},save:function(t){var e=t.attributes,n=e.embedUrl,r=e.lockEmbed,i=e.buttonText,o=e.insertItemImage,a=e.insertItemOsTitle,s=e.insertItemOsView,c=e.insertItemOsEdit,l=e.insertItemOsStatistics;return wp.element.createElement("div",{class:"os-personality-wrapper","data-type":"personality","data-image-url":o,"data-title-url":a,"data-view-url":s,"data-statistics-url":l,"data-edit-url":c,"data-test-url":n,"data-lock-embed":r,"data-button-text":i},'[os-widget path="',n,'"]',wp.element.createElement("span",null))}})},function(t,e,n){t.exports=n(3)},function(t,e,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,t.exports=n(4),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(t){r.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";function n(t,e,n,r){var o=e&&e.prototype instanceof i?e:i,a=Object.create(o.prototype),s=new d(r||[]);return a._invoke=l(t,n,s),a}function r(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function i(){}function o(){}function a(){}function s(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function c(t){function e(n,i,o,a){var s=r(t[n],t,i);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"===typeof l&&y.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,o,a)},function(t){e("throw",t,o,a)}):Promise.resolve(l).then(function(t){c.value=t,o(c)},a)}a(s.arg)}function n(t,n){function r(){return new Promise(function(r,i){e(t,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function l(t,e,n){var i=_;return function(o,a){if(i===L)throw new Error("Generator is already running");if(i===N){if("throw"===o)throw a;return h()}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=u(s,n);if(c){if(c===P)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===_)throw i=N,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=L;var l=r(t,e,n);if("normal"===l.type){if(i=n.done?N:I,l.arg===P)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=N,n.method="throw",n.arg=l.arg)}}}function u(t,e){var n=t.iterator[e.method];if(n===g){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=g,u(t,e),"throw"===e.method))return P;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return P}var i=r(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,P;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=g),e.delegate=null,P):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,P)}function p(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function m(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function d(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(p,this),this.reset(!0)}function f(t){if(t){var e=t[w];if(e)return e.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(y.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=g,e.done=!0,e};return r.next=r}}return{next:h}}function h(){return{value:g,done:!0}}var g,v=Object.prototype,y=v.hasOwnProperty,b="function"===typeof Symbol?Symbol:{},w=b.iterator||"@@iterator",E=b.asyncIterator||"@@asyncIterator",x=b.toStringTag||"@@toStringTag",k="object"===typeof t,O=e.regeneratorRuntime;if(O)return void(k&&(t.exports=O));O=e.regeneratorRuntime=k?t.exports:{},O.wrap=n;var _="suspendedStart",I="suspendedYield",L="executing",N="completed",P={},T={};T[w]=function(){return this};var S=Object.getPrototypeOf,C=S&&S(S(f([])));C&&C!==v&&y.call(C,w)&&(T=C);var j=a.prototype=i.prototype=Object.create(T);o.prototype=j.constructor=a,a.constructor=o,a[x]=o.displayName="GeneratorFunction",O.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===o||"GeneratorFunction"===(e.displayName||e.name))},O.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,x in t||(t[x]="GeneratorFunction")),t.prototype=Object.create(j),t},O.awrap=function(t){return{__await:t}},s(c.prototype),c.prototype[E]=function(){return this},O.AsyncIterator=c,O.async=function(t,e,r,i){var o=new c(n(t,e,r,i));return O.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},s(j),j[x]="Generator",j[w]=function(){return this},j.toString=function(){return"[object Generator]"},O.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},O.values=f,d.prototype={constructor:d,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(m),!t)for(var e in this)"t"===e.charAt(0)&&y.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=g)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,r){return o.type="throw",o.arg=t,n.next=e,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw t;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var a=y.call(i,"catchLoc"),s=y.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,P):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),P},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),m(n),P}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;m(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:f(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=g),P}}}(function(){return this}()||Function("return this")())},function(t,e){},function(t,e){}]);
|
gutenberg/personality/src/.DS_Store
CHANGED
Binary file
|
gutenberg/personality/src/block/block.js
CHANGED
@@ -6,13 +6,12 @@ const { registerBlockType } = wp.blocks;
|
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
-
var dropdownOptions
|
10 |
-
var
|
11 |
-
var
|
12 |
-
var
|
13 |
-
var
|
14 |
-
var
|
15 |
-
var options;
|
16 |
Â
|
17 |
Â
registerBlockType( 'opinion-stage/block-os-personality', {
|
18 |
Â
title: __( 'Personality Quiz' ),
|
@@ -21,18 +20,13 @@ var options;
|
|
21 |
Â
keywords: [
|
22 |
Â
__( 'Opinion Stage Personality Quiz' ),
|
23 |
Â
__( 'Opinion Stage Personality' ),
|
24 |
-
],
|
25 |
Â
attributes: {
|
26 |
Â
embedUrl: {
|
27 |
Â
source: 'attribute',
|
28 |
Â
attribute: 'data-test-url',
|
29 |
Â
selector: 'div[data-test-url]'
|
30 |
-
},
|
31 |
-
oswpUrlShortcode: {
|
32 |
-
source: 'attribute',
|
33 |
-
attribute: 'data-test-url',
|
34 |
-
selector: 'div[data-test-url]'
|
35 |
-
},
|
36 |
Â
lockEmbed: {
|
37 |
Â
source: 'attribute',
|
38 |
Â
attribute: 'data-lock-embed',
|
@@ -42,173 +36,132 @@ var options;
|
|
42 |
Â
source: 'attribute',
|
43 |
Â
attribute: 'data-button-text',
|
44 |
Â
selector: 'div[data-button-text]'
|
45 |
-
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
46 |
Â
},
|
47 |
Â
edit: function( props ) {
|
48 |
-
|
49 |
-
|
50 |
-
if(val == ''){
|
51 |
-
props.setAttributes({ embedUrl: '' });
|
52 |
-
}else if(val != ''){
|
53 |
-
props.setAttributes({ embedUrl: val });
|
54 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
55 |
-
var getLandingPageUrlOs = function(href) {
|
56 |
-
var locationUrlOS = document.createElement("a");
|
57 |
-
locationUrlOS.href = href;
|
58 |
-
return locationUrlOS;
|
59 |
-
};
|
60 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
61 |
-
var matchValue = locationUrlOS.pathname;
|
62 |
-
if(val == matchValue){
|
63 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
64 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
-
break;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}else{
|
72 |
-
}
|
73 |
-
};
|
74 |
-
const onEmbedButtonClick = event => {
|
75 |
-
if( event.target.value == "Embed" ){
|
76 |
-
if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
|
77 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
-
}else{
|
79 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
-
}
|
82 |
-
}else{
|
83 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
-
}
|
85 |
-
};
|
86 |
-
|
87 |
-
window.verifyOSInsert = function(widget){
|
88 |
-
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
-
var myOpts = document.getElementById('selectID').options;
|
90 |
-
for(var i = 0; i < myOpts.length; i++){
|
91 |
-
if(myOpts[i].value == widget){
|
92 |
-
myOpts[i].defaultSelected = true;
|
93 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
-
break;
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=outcome&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
-
const onCreateButtonClick = value => {
|
101 |
-
// Open Create new personality link in new page
|
102 |
-
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
103 |
-
};
|
104 |
-
|
105 |
-
if(!buttonText){
|
106 |
-
props.setAttributes({ buttonText: 'Embed' });
|
107 |
-
}
|
108 |
Â
|
Â
|
|
109 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
110 |
Â
var callback_url = getCallBackUrlOs;
|
111 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
113 |
Â
const onConnectOSWPButtonClick = value => {
|
114 |
-
// Open Connect to opinionstage
|
115 |
Â
window.location.replace(callback_url);
|
116 |
Â
};
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
'Accept':'application/vnd.api+json',
|
126 |
-
'Content-Type':'application/vnd.api+json',
|
127 |
-
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
128 |
-
'OSWP-Client-Token': opinionStageClientToken
|
129 |
-
},
|
130 |
-
})
|
131 |
-
.then(async res => {
|
132 |
-
var data = await res.json();
|
133 |
-
data = data.data;
|
134 |
-
dropdownOptions = data;
|
135 |
-
// force reprinting instead!!
|
136 |
-
props.setAttributes({ buttonText: 'Embed'});
|
137 |
-
props.setAttributes({ buttonText: buttonText});
|
138 |
-
if(buttonText == 'Change' && embedUrl !='Select'){
|
139 |
-
props.setAttributes({ embedUrl: embedUrl });
|
140 |
-
}else{
|
141 |
-
props.setAttributes({ embedUrl: 'Select' });
|
142 |
-
}
|
143 |
-
})
|
144 |
-
.catch(function(err) {
|
145 |
-
console.log('ERROR: ' + err.message);
|
146 |
-
});
|
147 |
-
}
|
148 |
Â
// Checking for Opinion Stage connection
|
149 |
Â
if(osGutenData.isOsConnected == ''){
|
150 |
-
|
151 |
-
$('span#oswpLauncherContentPopuppersonality , #owspLaunchInputCreate').live('click', function(e) {
|
152 |
-
e.preventDefault();
|
153 |
-
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
154 |
-
});
|
155 |
-
});
|
156 |
Â
return (
|
157 |
Â
<div className={ props.className }>
|
158 |
Â
<div className="os-personality-wrapper components-placeholder">
|
159 |
Â
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
160 |
Â
<p className="components-heading">Please connect WordPress to Opinion Stage to start adding personality</p>
|
161 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
162 |
-
</div>
|
Â
|
|
163 |
Â
</div>
|
164 |
Â
);
|
165 |
-
}else{
|
166 |
-
|
167 |
-
options = [{value:'Select',label:'Select a personality'},{value:'refresh',label:'Refresh'}];
|
168 |
-
OsPolulateList();
|
169 |
-
}else{
|
170 |
-
options = [{value:'Select',label:'Select a personality'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
171 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
172 |
-
options[options.length] = {
|
173 |
-
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
174 |
-
label: dropdownOptions[i].attributes['title'],
|
175 |
-
};
|
176 |
-
var getLandingPageUrlOs = function(href) {
|
177 |
-
var locationUrlOS = document.createElement("a");
|
178 |
-
locationUrlOS.href = href;
|
179 |
-
return locationUrlOS;
|
180 |
-
};
|
181 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
182 |
-
var matchValue = locationUrlOS.pathname;
|
183 |
-
if(embedUrl == matchValue){
|
184 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
185 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
186 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
187 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
188 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
189 |
-
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
190 |
-
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
if(embedUrl == 'refresh'){
|
195 |
-
OsPolulateList();
|
196 |
-
}
|
197 |
-
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
198 |
Â
$(document).ready(function () {
|
Â
|
|
199 |
Â
$('span#oswpLauncherContentPopuppersonality').live('click', function(e) {
|
200 |
Â
e.preventDefault();
|
201 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
202 |
Â
var text = $(this).attr('data-os-block');
|
203 |
Â
$("button#dropbtn span").text(text);
|
204 |
-
var inputs = $(".filter__itm");
|
205 |
Â
for(var i = 0; i < inputs.length; i++){
|
206 |
-
if($(inputs[i]).text() == text){
|
207 |
-
setTimeout(function(){$(inputs[i]).trigger('click');},1000);
|
208 |
Â
setTimeout(function(){
|
209 |
-
|
210 |
-
|
211 |
-
|
Â
|
|
Â
|
|
Â
|
|
212 |
Â
$('button.content__links-itm').live('click', function(e) {
|
213 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
214 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
@@ -218,83 +171,89 @@ var options;
|
|
218 |
Â
else {
|
219 |
Â
$('.progress_message').css('display', 'block');
|
220 |
Â
$('.content__list').css('display', 'none');
|
221 |
-
console.log('test');
|
222 |
Â
}
|
223 |
Â
}
|
224 |
Â
});
|
225 |
Â
});
|
226 |
Â
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
253 |
Â
if(buttonText == 'Embed'){
|
254 |
Â
contentViewEditStatOs
|
255 |
-
}else if(buttonText == 'Change'){
|
256 |
Â
contentViewEditStatOs = (
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
269 |
Â
</div>
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
</div>
|
275 |
-
</div>
|
276 |
-
);
|
277 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
278 |
Â
}
|
279 |
-
}else if(embedUrl == '
|
280 |
Â
contentViewEditStatOs
|
281 |
Â
}else{
|
282 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
283 |
Â
contentViewEditStatOs
|
284 |
Â
}
|
285 |
-
|
286 |
-
|
287 |
-
return (
|
288 |
Â
<div className={ props.className }>
|
289 |
-
{contentViewEditStatOs}
|
Â
|
|
290 |
Â
</div>
|
291 |
Â
);
|
292 |
Â
}
|
293 |
Â
},
|
294 |
-
save: function( {attributes: {embedUrl,
|
295 |
Â
return (
|
296 |
-
<div class="os-personality-wrapper"
|
297 |
-
[os-widget path="{
|
Â
|
|
298 |
Â
</div>
|
299 |
Â
);
|
300 |
Â
},
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
+
var dropdownOptions = false;
|
10 |
+
var insertItemImage = false;
|
11 |
+
var insertItemOsTitle = false;
|
12 |
+
var insertItemOsView = false;
|
13 |
+
var insertItemOsEdit = false;
|
14 |
+
var insertItemOsStatistics = false;
|
Â
|
|
15 |
Â
|
16 |
Â
registerBlockType( 'opinion-stage/block-os-personality', {
|
17 |
Â
title: __( 'Personality Quiz' ),
|
20 |
Â
keywords: [
|
21 |
Â
__( 'Opinion Stage Personality Quiz' ),
|
22 |
Â
__( 'Opinion Stage Personality' ),
|
23 |
+
],
|
24 |
Â
attributes: {
|
25 |
Â
embedUrl: {
|
26 |
Â
source: 'attribute',
|
27 |
Â
attribute: 'data-test-url',
|
28 |
Â
selector: 'div[data-test-url]'
|
29 |
+
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
30 |
Â
lockEmbed: {
|
31 |
Â
source: 'attribute',
|
32 |
Â
attribute: 'data-lock-embed',
|
36 |
Â
source: 'attribute',
|
37 |
Â
attribute: 'data-button-text',
|
38 |
Â
selector: 'div[data-button-text]'
|
39 |
+
},
|
40 |
+
insertItemImage: {
|
41 |
+
source: 'attribute',
|
42 |
+
attribute: 'data-image-url',
|
43 |
+
selector: 'div[data-image-url]'
|
44 |
+
},
|
45 |
+
insertItemOsTitle: {
|
46 |
+
source: 'attribute',
|
47 |
+
attribute: 'data-title-url',
|
48 |
+
selector: 'div[data-title-url]'
|
49 |
+
},
|
50 |
+
insertItemOsView: {
|
51 |
+
source: 'attribute',
|
52 |
+
attribute: 'data-view-url',
|
53 |
+
selector: 'div[data-view-url]'
|
54 |
+
},
|
55 |
+
insertItemOsEdit: {
|
56 |
+
source: 'attribute',
|
57 |
+
attribute: 'data-edit-url',
|
58 |
+
selector: 'div[data-edit-url]'
|
59 |
+
},
|
60 |
+
insertItemOsStatistics: {
|
61 |
+
source: 'attribute',
|
62 |
+
attribute: 'data-statistics-url',
|
63 |
+
selector: 'div[data-statistics-url]'
|
64 |
+
}
|
65 |
Â
},
|
66 |
Â
edit: function( props ) {
|
67 |
+
// Setting Attributes
|
68 |
+
let {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage,insertItemOsTitle,insertItemOsView,insertItemOsEdit,insertItemOsStatistics}, setAttributes} = props;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
69 |
Â
|
70 |
+
// Fetching Localized variables
|
71 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
72 |
Â
var callback_url = getCallBackUrlOs;
|
73 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
74 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
75 |
+
|
76 |
+
// Select Button Click functionality
|
77 |
+
const onSelectButtonClick = value => {
|
78 |
+
window.verifyOSInsert = function(widget){
|
79 |
+
props.setAttributes({ embedUrl: widget, buttonText:'Change' });
|
80 |
+
|
81 |
+
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
82 |
+
var opinionStageClientToken = osGutenData.OswpClientToken;
|
83 |
+
var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=outcome&page=1&per_page=99';
|
84 |
+
fetch(opinionstageFetchDataUrl, {
|
85 |
+
method: "GET",
|
86 |
+
headers: {
|
87 |
+
'Accept':'application/vnd.api+json',
|
88 |
+
'Content-Type':'application/vnd.api+json',
|
89 |
+
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
90 |
+
'OSWP-Client-Token': opinionStageClientToken
|
91 |
+
},
|
92 |
+
})
|
93 |
+
.then(async res => {
|
94 |
+
var data = await res.json();
|
95 |
+
data = data.data;
|
96 |
+
dropdownOptions = data;
|
97 |
+
// force reprinting instead!!
|
98 |
+
props.setAttributes({ buttonText: buttonText});
|
99 |
+
|
100 |
+
})
|
101 |
+
.catch(function(err) {
|
102 |
+
console.log('ERROR: ' + err.message);
|
103 |
+
});
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
// Change Button Click functionality
|
108 |
+
const onChangeButtonClick = value => {
|
109 |
+
props.setAttributes({
|
110 |
+
embedUrl: '',
|
111 |
+
buttonText:'Embed',
|
112 |
+
lockEmbed: false,
|
113 |
+
insertItemImage: false,
|
114 |
+
insertItemOsTitle: false,
|
115 |
+
insertItemOsView: false,
|
116 |
+
insertItemOsEdit: false,
|
117 |
+
insertItemOsStatistics: false
|
118 |
+
});
|
119 |
+
}
|
120 |
+
|
121 |
+
// Connect to Opinionstage Callback Url
|
122 |
Â
const onConnectOSWPButtonClick = value => {
|
Â
|
|
123 |
Â
window.location.replace(callback_url);
|
124 |
Â
};
|
125 |
+
|
126 |
+
// Create New Item Url (personality)
|
127 |
+
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=outcome&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
128 |
+
const onCreateButtonClick = value => {
|
129 |
+
// Open Create new personality link in new page
|
130 |
+
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
131 |
+
};
|
132 |
+
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
133 |
Â
// Checking for Opinion Stage connection
|
134 |
Â
if(osGutenData.isOsConnected == ''){
|
135 |
+
// Not Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
136 |
Â
return (
|
137 |
Â
<div className={ props.className }>
|
138 |
Â
<div className="os-personality-wrapper components-placeholder">
|
139 |
Â
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
140 |
Â
<p className="components-heading">Please connect WordPress to Opinion Stage to start adding personality</p>
|
141 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
142 |
+
</div>
|
143 |
+
<div></div>
|
144 |
Â
</div>
|
145 |
Â
);
|
146 |
+
}else{
|
147 |
+
// Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
148 |
Â
$(document).ready(function () {
|
149 |
+
// Content Popup Launch Working
|
150 |
Â
$('span#oswpLauncherContentPopuppersonality').live('click', function(e) {
|
151 |
Â
e.preventDefault();
|
152 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
153 |
Â
var text = $(this).attr('data-os-block');
|
154 |
Â
$("button#dropbtn span").text(text);
|
155 |
+
var inputs = $(".filter__itm");
|
156 |
Â
for(var i = 0; i < inputs.length; i++){
|
157 |
+
if($(inputs[i]).text() == text){
|
Â
|
|
158 |
Â
setTimeout(function(){
|
159 |
+
$(inputs[i]).trigger('click');
|
160 |
+
},1000);
|
161 |
+
setTimeout(function(){
|
162 |
+
$('.progress_message').css('display', 'none');
|
163 |
+
$('.content__list').css('display', 'block');
|
164 |
+
},2500);
|
165 |
Â
$('button.content__links-itm').live('click', function(e) {
|
166 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
167 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
171 |
Â
else {
|
172 |
Â
$('.progress_message').css('display', 'block');
|
173 |
Â
$('.content__list').css('display', 'none');
|
Â
|
|
174 |
Â
}
|
175 |
Â
}
|
176 |
Â
});
|
177 |
Â
});
|
178 |
Â
|
179 |
+
// Fetching Ajax Call Result
|
180 |
+
if(dropdownOptions != false){
|
181 |
+
for (var i = 0; i < dropdownOptions.length; i++) {
|
182 |
+
var getLandingPageUrlOs = function(href) {
|
183 |
+
var locationUrlOS = document.createElement("a");
|
184 |
+
locationUrlOS.href = href;
|
185 |
+
return locationUrlOS;
|
186 |
+
};
|
187 |
+
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
188 |
+
var matchValue = locationUrlOS.pathname;
|
189 |
+
if(embedUrl == matchValue){
|
190 |
+
props.setAttributes({lockEmbed: true, buttonText: "Change" });
|
191 |
+
props.setAttributes({ insertItemImage : dropdownOptions[i].attributes['image-url'] });
|
192 |
+
props.setAttributes({ insertItemOsTitle : dropdownOptions[i].attributes['title'] });
|
193 |
+
props.setAttributes({ insertItemOsView : dropdownOptions[i].attributes['landing-page-url'] });
|
194 |
+
props.setAttributes({ insertItemOsEdit : dropdownOptions[i].attributes['edit-url'] });
|
195 |
+
props.setAttributes({ insertItemOsStatistics : dropdownOptions[i].attributes['stats-url'] });
|
196 |
+
break;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
// Content On Editor
|
202 |
+
var contentViewEditStatOs = (
|
203 |
+
<div className="os-personality-wrapper components-placeholder">
|
204 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
205 |
+
<span id="oswpLauncherContentPopuppersonality" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="personality quiz" onClick={onSelectButtonClick} >Select a Personality Quiz</span>
|
206 |
+
<input type="button" value="Create a New Personality Quiz" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
207 |
+
<span></span>
|
208 |
+
</div>
|
209 |
+
);
|
210 |
+
|
211 |
+
if(embedUrl != '' && embedUrl){
|
212 |
Â
if(buttonText == 'Embed'){
|
213 |
Â
contentViewEditStatOs
|
214 |
+
}else if(buttonText == 'Change'){
|
215 |
Â
contentViewEditStatOs = (
|
216 |
+
<div className="os-personality-wrapper components-placeholder">
|
217 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
218 |
+
<div className="components-preview__block" >
|
219 |
+
<div className="components-preview__leftBlockImage">
|
220 |
+
<img src={insertItemImage} alt={insertItemOsTitle} className="image" />
|
221 |
+
<div className="overlay">
|
222 |
+
<div className="text">
|
223 |
+
<a href={insertItemOsView} target="_blank"> View </a>
|
224 |
+
<a href={insertItemOsEdit} target="_blank"> Edit </a>
|
225 |
+
<a href={insertItemOsStatistics} target="_blank"> Statistics </a>
|
226 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onChangeButtonClick}/>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
<div className="components-preview__rightBlockContent">
|
231 |
+
<div className="components-placeholder__label">Personality Quiz: {insertItemOsTitle}</div>
|
232 |
Â
</div>
|
233 |
+
</div>
|
234 |
+
<span></span>
|
235 |
+
</div>
|
236 |
+
);
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
237 |
Â
}
|
238 |
+
}else if(embedUrl == '' || jQuery.type(embedUrl) === "undefined"){
|
239 |
Â
contentViewEditStatOs
|
240 |
Â
}else{
|
241 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
242 |
Â
contentViewEditStatOs
|
243 |
Â
}
|
244 |
+
return (
|
Â
|
|
Â
|
|
245 |
Â
<div className={ props.className }>
|
246 |
+
{contentViewEditStatOs}
|
247 |
+
<span></span>
|
248 |
Â
</div>
|
249 |
Â
);
|
250 |
Â
}
|
251 |
Â
},
|
252 |
+
save: function( {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage, insertItemOsTitle, insertItemOsView, insertItemOsEdit, insertItemOsStatistics }} ) {
|
253 |
Â
return (
|
254 |
+
<div class="os-personality-wrapper" data-type="personality" data-image-url={insertItemImage} data-title-url={insertItemOsTitle} data-view-url={insertItemOsView} data-statistics-url={insertItemOsStatistics} data-edit-url={insertItemOsEdit} data-test-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
255 |
+
[os-widget path="{embedUrl}"]
|
256 |
+
<span></span>
|
257 |
Â
</div>
|
258 |
Â
);
|
259 |
Â
},
|
gutenberg/poll/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),l=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}var o,a,i,l,s,c,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),d=(n.n(f),wp.i18n.__),h=wp.blocks.registerBlockType,g=wp.components,v=g.SelectControl,b=(g.TextControl,wp.editor.RichText,!1);h("opinion-stage/block-os-poll",{title:d("Poll"),icon:"chart-bar",category:"opinion-stage",keywords:[d("Opinion Stage Poll"),d("Opinion Stage Poll")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=poll&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,b=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<b.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(b[n].attributes["landing-page-url"]),c=r.pathname;if(t==c){o=b[n].attributes.title,a=b[n].attributes["image-url"],i=b[n].attributes["landing-page-url"],l=b[n].attributes["edit-url"],s=b[n].attributes["stats-url"];break}}}}),d=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),O=wp.element.createElement(v,{id:"selectID",options:c,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var h=osGutenData.onCreateButtonClickOs+"?w_type=poll&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",g=function(e){window.open(h,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var w=osGutenData.callbackUrlOs,y=w,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),k=function(e){window.location.replace(y)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopuppoll , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("p",{className:"components-heading"},"Please connect WordPress to Opinion Stage to start adding polls"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:k},"Connect")));if(0==b)c=[{value:"Select",label:"Select a poll"},{value:"refresh",label:"Refresh"}],t();else{c=[{value:"Select",label:"Select a poll"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<b.length;x++){c[c.length]={value:b[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:b[x].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(b[x].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=b[x].attributes.title,a=b[x].attributes["image-url"],i=b[x].attributes["landing-page-url"],l=b[x].attributes["edit-url"],s=b[x].attributes["stats-url"];var L=b[x].id}}}"refresh"==u&&t();var O=wp.element.createElement(v,{id:"selectID",options:c,value:u,onChange:f,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopuppoll").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none"),console.log("test")}})});var P=wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopuppoll",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"poll"},"Select a Poll"),wp.element.createElement("input",{type:"button",value:"Create a New Poll",className:"components-button is-button is-default is-block is-primary",onClick:g}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},O,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:d})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),L="os-widget-"+L,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(P=wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:l,target:"_blank"}," Edit "),wp.element.createElement("a",{href:s,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:d})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Poll: ",o)))),O=wp.element.createElement(v,{id:"selectID",options:c,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},P)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-poll-wrapper","data-type":"poll","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),l=new f(r||[]);return i._invoke=c(e,n,l),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function s(e){function t(n,o,a,i){var l=r(e[n],e,o);if("throw"!==l.type){var s=l.arg,c=s.value;return c&&"object"===typeof c&&b.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(c).then(function(e){s.value=e,a(s)},i)}i(l.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function c(e,t,n){var o=N;return function(a,i){if(o===O)throw new Error("Generator is already running");if(o===P){if("throw"===a)throw i;return h()}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var s=u(l,n);if(s){if(s===S)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=P,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=O;var c=r(e,t,n);if("normal"===c.type){if(o=n.done?P:L,c.arg===S)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=P,n.method="throw",n.arg=c.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,u(e,t),"throw"===t.method))return S;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return S}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,S;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,S):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,S)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=g,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:g,done:!0}}var g,v=Object.prototype,b=v.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",k=w.toStringTag||"@@toStringTag",x="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(x&&(e.exports=_));_=t.regeneratorRuntime=x?e.exports:{},_.wrap=n;var N="suspendedStart",L="suspendedYield",O="executing",P="completed",S={},T={};T[y]=function(){return this};var C=Object.getPrototypeOf,j=C&&C(C(d([])));j&&j!==v&&b.call(j,y)&&(T=j);var A=i.prototype=o.prototype=Object.create(T);a.prototype=A.constructor=i,i.constructor=a,i[k]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,k in e||(e[k]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},l(s.prototype),s.prototype[E]=function(){return this},_.AsyncIterator=s,_.async=function(e,t,r,o){var a=new s(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},l(A),A[k]="Generator",A[y]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&b.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=b.call(o,"catchLoc"),l=b.call(o,"finallyLoc");if(i&&l){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,S):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),S},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),S}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=g),S}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});n(1)},function(t,e,n){"use strict";function r(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,n){function r(o,i){try{var a=e[o](i),s=a.value}catch(t){return void n(t)}if(!a.done)return Promise.resolve(s).then(function(t){r("next",t)},function(t){r("throw",t)});t(s)}return r("next")})}}var o=n(2),i=n.n(o),a=n(5),s=(n.n(a),n(6)),l=(n.n(s),wp.i18n.__),c=wp.blocks.registerBlockType,u=wp.components,p=(u.SelectControl,u.TextControl,wp.editor.RichText,!1);c("opinion-stage/block-os-poll",{title:l("Poll"),icon:"chart-bar",category:"opinion-stage",keywords:[l("Opinion Stage Poll"),l("Opinion Stage Poll")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"},insertItemImage:{source:"attribute",attribute:"data-image-url",selector:"div[data-image-url]"},insertItemOsTitle:{source:"attribute",attribute:"data-title-url",selector:"div[data-title-url]"},insertItemOsView:{source:"attribute",attribute:"data-view-url",selector:"div[data-view-url]"},insertItemOsEdit:{source:"attribute",attribute:"data-edit-url",selector:"div[data-edit-url]"},insertItemOsStatistics:{source:"attribute",attribute:"data-statistics-url",selector:"div[data-statistics-url]"}},edit:function(t){var e=t.attributes,n=e.embedUrl,o=(e.lockEmbed,e.buttonText),a=e.insertItemImage,s=e.insertItemOsTitle,l=e.insertItemOsView,c=e.insertItemOsEdit,u=e.insertItemOsStatistics,m=(t.setAttributes,osGutenData.callbackUrlOs),d=m,f=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),h=function(e){window.verifyOSInsert=function(e){var n=this;t.setAttributes({embedUrl:e,buttonText:"Change"});var a=osGutenData.OswpPluginVersion,s=osGutenData.OswpClientToken,l=osGutenData.OswpFetchDataUrl+"?type=poll&page=1&per_page=99";fetch(l,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":a,"OSWP-Client-Token":s}}).then(function(){var e=r(i.a.mark(function e(r){var a;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.json();case 2:a=e.sent,a=a.data,p=a,t.setAttributes({buttonText:o});case 6:case"end":return e.stop()}},e,n)}));return function(t){return e.apply(this,arguments)}}()).catch(function(t){console.log("ERROR: "+t.message)})}},g=function(e){t.setAttributes({embedUrl:"",buttonText:"Embed",lockEmbed:!1,insertItemImage:!1,insertItemOsTitle:!1,insertItemOsView:!1,insertItemOsEdit:!1,insertItemOsStatistics:!1})},v=function(t){window.location.replace(d)},b=osGutenData.onCreateButtonClickOs+"?w_type=poll&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",w=function(t){window.open(b,"_blank").focus()};if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:t.className},wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("p",{className:"components-heading"},"Please connect WordPress to Opinion Stage to start adding polls"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:v},"Connect")),wp.element.createElement("div",null));if($(document).ready(function(){$("span#oswpLauncherContentPopuppoll").live("click",function(t){t.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var e=$(this).attr("data-os-block");$("button#dropbtn span").text(e);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==e){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(t){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none")}})}),0!=p)for(var y=0;y<p.length;y++){var E=function(t){var e=document.createElement("a");return e.href=t,e}(p[y].attributes["landing-page-url"]),x=E.pathname;if(n==x){t.setAttributes({lockEmbed:!0,buttonText:"Change"}),t.setAttributes({insertItemImage:p[y].attributes["image-url"]}),t.setAttributes({insertItemOsTitle:p[y].attributes.title}),t.setAttributes({insertItemOsView:p[y].attributes["landing-page-url"]}),t.setAttributes({insertItemOsEdit:p[y].attributes["edit-url"]}),t.setAttributes({insertItemOsStatistics:p[y].attributes["stats-url"]});break}}var k=wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopuppoll",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"poll",onClick:h},"Select a Poll"),wp.element.createElement("input",{type:"button",value:"Create a New Poll",className:"components-button is-button is-default is-block is-primary",onClick:w}),wp.element.createElement("span",null));return""!=n&&n?"Embed"==o||"Change"==o&&(k=wp.element.createElement("div",{className:"os-poll-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:s,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:l,target:"_blank"}," View "),wp.element.createElement("a",{href:c,target:"_blank"}," Edit "),wp.element.createElement("a",{href:u,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:o,className:"components-button is-button is-default is-large left-align",onClick:g})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Poll: ",s))),wp.element.createElement("span",null))):""==n||"undefined"===jQuery.type(n)||t.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:t.className},k,wp.element.createElement("span",null))},save:function(t){var e=t.attributes,n=e.embedUrl,r=e.lockEmbed,o=e.buttonText,i=e.insertItemImage,a=e.insertItemOsTitle,s=e.insertItemOsView,l=e.insertItemOsEdit,c=e.insertItemOsStatistics;return wp.element.createElement("div",{class:"os-poll-wrapper","data-type":"poll","data-image-url":i,"data-title-url":a,"data-view-url":s,"data-statistics-url":c,"data-edit-url":l,"data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]',wp.element.createElement("span",null))}})},function(t,e,n){t.exports=n(3)},function(t,e,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,i=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,t.exports=n(4),o)r.regeneratorRuntime=i;else try{delete r.regeneratorRuntime}catch(t){r.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";function n(t,e,n,r){var i=e&&e.prototype instanceof o?e:o,a=Object.create(i.prototype),s=new d(r||[]);return a._invoke=c(t,n,s),a}function r(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function o(){}function i(){}function a(){}function s(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function l(t){function e(n,o,i,a){var s=r(t[n],t,o);if("throw"!==s.type){var l=s.arg,c=l.value;return c&&"object"===typeof c&&b.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,i,a)},function(t){e("throw",t,i,a)}):Promise.resolve(c).then(function(t){l.value=t,i(l)},a)}a(s.arg)}function n(t,n){function r(){return new Promise(function(r,o){e(t,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function c(t,e,n){var o=_;return function(i,a){if(o===L)throw new Error("Generator is already running");if(o===N){if("throw"===i)throw a;return h()}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var l=u(s,n);if(l){if(l===P)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===_)throw o=N,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=L;var c=r(t,e,n);if("normal"===c.type){if(o=n.done?N:I,c.arg===P)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=N,n.method="throw",n.arg=c.arg)}}}function u(t,e){var n=t.iterator[e.method];if(n===g){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=g,u(t,e),"throw"===e.method))return P;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return P}var o=r(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,P;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=g),e.delegate=null,P):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,P)}function p(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function m(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function d(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(p,this),this.reset(!0)}function f(t){if(t){var e=t[y];if(e)return e.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(b.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=g,e.done=!0,e};return r.next=r}}return{next:h}}function h(){return{value:g,done:!0}}var g,v=Object.prototype,b=v.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",x=w.toStringTag||"@@toStringTag",k="object"===typeof t,O=e.regeneratorRuntime;if(O)return void(k&&(t.exports=O));O=e.regeneratorRuntime=k?t.exports:{},O.wrap=n;var _="suspendedStart",I="suspendedYield",L="executing",N="completed",P={},T={};T[y]=function(){return this};var S=Object.getPrototypeOf,C=S&&S(S(f([])));C&&C!==v&&b.call(C,y)&&(T=C);var j=a.prototype=o.prototype=Object.create(T);i.prototype=j.constructor=a,a.constructor=i,a[x]=i.displayName="GeneratorFunction",O.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===i||"GeneratorFunction"===(e.displayName||e.name))},O.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,x in t||(t[x]="GeneratorFunction")),t.prototype=Object.create(j),t},O.awrap=function(t){return{__await:t}},s(l.prototype),l.prototype[E]=function(){return this},O.AsyncIterator=l,O.async=function(t,e,r,o){var i=new l(n(t,e,r,o));return O.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},s(j),j[x]="Generator",j[y]=function(){return this},j.toString=function(){return"[object Generator]"},O.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},O.values=f,d.prototype={constructor:d,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(m),!t)for(var e in this)"t"===e.charAt(0)&&b.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=g)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,r){return i.type="throw",i.arg=t,n.next=e,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw t;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=b.call(o,"catchLoc"),s=b.call(o,"finallyLoc");if(a&&s){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,P):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),P},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),m(n),P}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:f(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=g),P}}}(function(){return this}()||Function("return this")())},function(t,e){},function(t,e){}]);
|
gutenberg/poll/src/.DS_Store
CHANGED
Binary file
|
gutenberg/poll/src/block/block.js
CHANGED
@@ -6,13 +6,12 @@ const { registerBlockType } = wp.blocks;
|
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
-
var dropdownOptions
|
10 |
-
var
|
11 |
-
var
|
12 |
-
var
|
13 |
-
var
|
14 |
-
var
|
15 |
-
var options;
|
16 |
Â
|
17 |
Â
registerBlockType( 'opinion-stage/block-os-poll', {
|
18 |
Â
title: __( 'Poll' ),
|
@@ -27,12 +26,7 @@ var options;
|
|
27 |
Â
source: 'attribute',
|
28 |
Â
attribute: 'data-test-url',
|
29 |
Â
selector: 'div[data-test-url]'
|
30 |
-
},
|
31 |
-
oswpUrlShortcode: {
|
32 |
-
source: 'attribute',
|
33 |
-
attribute: 'data-test-url',
|
34 |
-
selector: 'div[data-test-url]'
|
35 |
-
},
|
36 |
Â
lockEmbed: {
|
37 |
Â
source: 'attribute',
|
38 |
Â
attribute: 'data-lock-embed',
|
@@ -42,173 +36,132 @@ var options;
|
|
42 |
Â
source: 'attribute',
|
43 |
Â
attribute: 'data-button-text',
|
44 |
Â
selector: 'div[data-button-text]'
|
45 |
-
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
46 |
Â
},
|
47 |
Â
edit: function( props ) {
|
48 |
-
|
49 |
-
|
50 |
-
if(val == ''){
|
51 |
-
props.setAttributes({ embedUrl: '' });
|
52 |
-
}else if(val != ''){
|
53 |
-
props.setAttributes({ embedUrl: val });
|
54 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
55 |
-
var getLandingPageUrlOs = function(href) {
|
56 |
-
var locationUrlOS = document.createElement("a");
|
57 |
-
locationUrlOS.href = href;
|
58 |
-
return locationUrlOS;
|
59 |
-
};
|
60 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
61 |
-
var matchValue = locationUrlOS.pathname;
|
62 |
-
if(val == matchValue){
|
63 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
64 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
-
break;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}else{
|
72 |
-
}
|
73 |
-
};
|
74 |
-
const onEmbedButtonClick = event => {
|
75 |
-
if( event.target.value == "Embed" ){
|
76 |
-
if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
|
77 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
-
}else{
|
79 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
-
}
|
82 |
-
}else{
|
83 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
-
}
|
85 |
-
};
|
86 |
-
|
87 |
-
window.verifyOSInsert = function(widget){
|
88 |
-
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
-
var myOpts = document.getElementById('selectID').options;
|
90 |
-
for(var i = 0; i < myOpts.length; i++){
|
91 |
-
if(myOpts[i].value == widget){
|
92 |
-
myOpts[i].defaultSelected = true;
|
93 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
-
break;
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=poll&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
-
const onCreateButtonClick = value => {
|
101 |
-
// Open Create new poll link in new page
|
102 |
-
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
103 |
-
};
|
104 |
-
|
105 |
-
if(!buttonText){
|
106 |
-
props.setAttributes({ buttonText: 'Embed' });
|
107 |
-
}
|
108 |
Â
|
Â
|
|
109 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
110 |
Â
var callback_url = getCallBackUrlOs;
|
111 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
113 |
Â
const onConnectOSWPButtonClick = value => {
|
114 |
-
// Open Connect to opinionstage
|
115 |
Â
window.location.replace(callback_url);
|
116 |
Â
};
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
'Accept':'application/vnd.api+json',
|
126 |
-
'Content-Type':'application/vnd.api+json',
|
127 |
-
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
128 |
-
'OSWP-Client-Token': opinionStageClientToken
|
129 |
-
},
|
130 |
-
})
|
131 |
-
.then(async res => {
|
132 |
-
var data = await res.json();
|
133 |
-
data = data.data;
|
134 |
-
dropdownOptions = data;
|
135 |
-
// force reprinting instead!!
|
136 |
-
props.setAttributes({ buttonText: 'Embed'});
|
137 |
-
props.setAttributes({ buttonText: buttonText});
|
138 |
-
if(buttonText == 'Change' && embedUrl !='Select'){
|
139 |
-
props.setAttributes({ embedUrl: embedUrl });
|
140 |
-
}else{
|
141 |
-
props.setAttributes({ embedUrl: 'Select' });
|
142 |
-
}
|
143 |
-
})
|
144 |
-
.catch(function(err) {
|
145 |
-
console.log('ERROR: ' + err.message);
|
146 |
-
});
|
147 |
-
}
|
148 |
Â
// Checking for Opinion Stage connection
|
149 |
Â
if(osGutenData.isOsConnected == ''){
|
150 |
-
|
151 |
-
$('span#oswpLauncherContentPopuppoll , #owspLaunchInputCreate').live('click', function(e) {
|
152 |
-
e.preventDefault();
|
153 |
-
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
154 |
-
});
|
155 |
-
});
|
156 |
Â
return (
|
157 |
Â
<div className={ props.className }>
|
158 |
Â
<div className="os-poll-wrapper components-placeholder">
|
159 |
Â
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
160 |
Â
<p className="components-heading">Please connect WordPress to Opinion Stage to start adding polls</p>
|
161 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
162 |
-
</div>
|
Â
|
|
163 |
Â
</div>
|
164 |
Â
);
|
165 |
-
}else{
|
166 |
-
|
167 |
-
options = [{value:'Select',label:'Select a poll'},{value:'refresh',label:'Refresh'}];
|
168 |
-
OsPolulateList();
|
169 |
-
}else{
|
170 |
-
options = [{value:'Select',label:'Select a poll'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
171 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
172 |
-
options[options.length] = {
|
173 |
-
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
174 |
-
label: dropdownOptions[i].attributes['title'],
|
175 |
-
};
|
176 |
-
var getLandingPageUrlOs = function(href) {
|
177 |
-
var locationUrlOS = document.createElement("a");
|
178 |
-
locationUrlOS.href = href;
|
179 |
-
return locationUrlOS;
|
180 |
-
};
|
181 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
182 |
-
var matchValue = locationUrlOS.pathname;
|
183 |
-
if(embedUrl == matchValue){
|
184 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
185 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
186 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
187 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
188 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
189 |
-
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
190 |
-
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
if(embedUrl == 'refresh'){
|
195 |
-
OsPolulateList();
|
196 |
-
}
|
197 |
-
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
198 |
Â
$(document).ready(function () {
|
Â
|
|
199 |
Â
$('span#oswpLauncherContentPopuppoll').live('click', function(e) {
|
200 |
Â
e.preventDefault();
|
201 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
202 |
Â
var text = $(this).attr('data-os-block');
|
203 |
Â
$("button#dropbtn span").text(text);
|
204 |
-
var inputs = $(".filter__itm");
|
205 |
Â
for(var i = 0; i < inputs.length; i++){
|
206 |
-
if($(inputs[i]).text() == text){
|
207 |
-
setTimeout(function(){$(inputs[i]).trigger('click');},1000);
|
208 |
Â
setTimeout(function(){
|
209 |
-
|
210 |
-
|
211 |
-
|
Â
|
|
Â
|
|
Â
|
|
212 |
Â
$('button.content__links-itm').live('click', function(e) {
|
213 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
214 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
@@ -218,83 +171,89 @@ var options;
|
|
218 |
Â
else {
|
219 |
Â
$('.progress_message').css('display', 'block');
|
220 |
Â
$('.content__list').css('display', 'none');
|
221 |
-
console.log('test');
|
222 |
Â
}
|
223 |
Â
}
|
224 |
Â
});
|
225 |
Â
});
|
226 |
Â
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
253 |
Â
if(buttonText == 'Embed'){
|
254 |
Â
contentViewEditStatOs
|
255 |
-
}else if(buttonText == 'Change'){
|
256 |
Â
contentViewEditStatOs = (
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
269 |
Â
</div>
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
</div>
|
275 |
-
</div>
|
276 |
-
);
|
277 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
278 |
Â
}
|
279 |
-
}else if(embedUrl == '
|
280 |
Â
contentViewEditStatOs
|
281 |
Â
}else{
|
282 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
283 |
Â
contentViewEditStatOs
|
284 |
Â
}
|
285 |
-
|
286 |
-
|
287 |
-
return (
|
288 |
Â
<div className={ props.className }>
|
289 |
-
{contentViewEditStatOs}
|
Â
|
|
290 |
Â
</div>
|
291 |
Â
);
|
292 |
Â
}
|
293 |
Â
},
|
294 |
-
save: function( {attributes: {embedUrl,
|
295 |
Â
return (
|
296 |
-
<div class="os-poll-wrapper"
|
297 |
-
[os-widget path="{
|
Â
|
|
298 |
Â
</div>
|
299 |
Â
);
|
300 |
Â
},
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
+
var dropdownOptions = false;
|
10 |
+
var insertItemImage = false;
|
11 |
+
var insertItemOsTitle = false;
|
12 |
+
var insertItemOsView = false;
|
13 |
+
var insertItemOsEdit = false;
|
14 |
+
var insertItemOsStatistics = false;
|
Â
|
|
15 |
Â
|
16 |
Â
registerBlockType( 'opinion-stage/block-os-poll', {
|
17 |
Â
title: __( 'Poll' ),
|
26 |
Â
source: 'attribute',
|
27 |
Â
attribute: 'data-test-url',
|
28 |
Â
selector: 'div[data-test-url]'
|
29 |
+
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
30 |
Â
lockEmbed: {
|
31 |
Â
source: 'attribute',
|
32 |
Â
attribute: 'data-lock-embed',
|
36 |
Â
source: 'attribute',
|
37 |
Â
attribute: 'data-button-text',
|
38 |
Â
selector: 'div[data-button-text]'
|
39 |
+
},
|
40 |
+
insertItemImage: {
|
41 |
+
source: 'attribute',
|
42 |
+
attribute: 'data-image-url',
|
43 |
+
selector: 'div[data-image-url]'
|
44 |
+
},
|
45 |
+
insertItemOsTitle: {
|
46 |
+
source: 'attribute',
|
47 |
+
attribute: 'data-title-url',
|
48 |
+
selector: 'div[data-title-url]'
|
49 |
+
},
|
50 |
+
insertItemOsView: {
|
51 |
+
source: 'attribute',
|
52 |
+
attribute: 'data-view-url',
|
53 |
+
selector: 'div[data-view-url]'
|
54 |
+
},
|
55 |
+
insertItemOsEdit: {
|
56 |
+
source: 'attribute',
|
57 |
+
attribute: 'data-edit-url',
|
58 |
+
selector: 'div[data-edit-url]'
|
59 |
+
},
|
60 |
+
insertItemOsStatistics: {
|
61 |
+
source: 'attribute',
|
62 |
+
attribute: 'data-statistics-url',
|
63 |
+
selector: 'div[data-statistics-url]'
|
64 |
+
}
|
65 |
Â
},
|
66 |
Â
edit: function( props ) {
|
67 |
+
// Setting Attributes
|
68 |
+
let {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage,insertItemOsTitle,insertItemOsView,insertItemOsEdit,insertItemOsStatistics}, setAttributes} = props;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
69 |
Â
|
70 |
+
// Fetching Localized variables
|
71 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
72 |
Â
var callback_url = getCallBackUrlOs;
|
73 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
74 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
75 |
+
|
76 |
+
// Select Button Click functionality
|
77 |
+
const onSelectButtonClick = value => {
|
78 |
+
window.verifyOSInsert = function(widget){
|
79 |
+
props.setAttributes({ embedUrl: widget, buttonText:'Change' });
|
80 |
+
|
81 |
+
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
82 |
+
var opinionStageClientToken = osGutenData.OswpClientToken;
|
83 |
+
var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=poll&page=1&per_page=99';
|
84 |
+
fetch(opinionstageFetchDataUrl, {
|
85 |
+
method: "GET",
|
86 |
+
headers: {
|
87 |
+
'Accept':'application/vnd.api+json',
|
88 |
+
'Content-Type':'application/vnd.api+json',
|
89 |
+
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
90 |
+
'OSWP-Client-Token': opinionStageClientToken
|
91 |
+
},
|
92 |
+
})
|
93 |
+
.then(async res => {
|
94 |
+
var data = await res.json();
|
95 |
+
data = data.data;
|
96 |
+
dropdownOptions = data;
|
97 |
+
// force reprinting instead!!
|
98 |
+
props.setAttributes({ buttonText: buttonText});
|
99 |
+
|
100 |
+
})
|
101 |
+
.catch(function(err) {
|
102 |
+
console.log('ERROR: ' + err.message);
|
103 |
+
});
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
// Change Button Click functionality
|
108 |
+
const onChangeButtonClick = value => {
|
109 |
+
props.setAttributes({
|
110 |
+
embedUrl: '',
|
111 |
+
buttonText:'Embed',
|
112 |
+
lockEmbed: false,
|
113 |
+
insertItemImage: false,
|
114 |
+
insertItemOsTitle: false,
|
115 |
+
insertItemOsView: false,
|
116 |
+
insertItemOsEdit: false,
|
117 |
+
insertItemOsStatistics: false
|
118 |
+
});
|
119 |
+
}
|
120 |
+
|
121 |
+
// Connect to Opinionstage Callback Url
|
122 |
Â
const onConnectOSWPButtonClick = value => {
|
Â
|
|
123 |
Â
window.location.replace(callback_url);
|
124 |
Â
};
|
125 |
+
|
126 |
+
// Create New Item Url (Poll)
|
127 |
+
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=poll&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
128 |
+
const onCreateButtonClick = value => {
|
129 |
+
// Open Create new poll link in new page
|
130 |
+
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
131 |
+
};
|
132 |
+
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
133 |
Â
// Checking for Opinion Stage connection
|
134 |
Â
if(osGutenData.isOsConnected == ''){
|
135 |
+
// Not Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
136 |
Â
return (
|
137 |
Â
<div className={ props.className }>
|
138 |
Â
<div className="os-poll-wrapper components-placeholder">
|
139 |
Â
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
140 |
Â
<p className="components-heading">Please connect WordPress to Opinion Stage to start adding polls</p>
|
141 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
142 |
+
</div>
|
143 |
+
<div></div>
|
144 |
Â
</div>
|
145 |
Â
);
|
146 |
+
}else{
|
147 |
+
// Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
148 |
Â
$(document).ready(function () {
|
149 |
+
// Content Popup Launch Working
|
150 |
Â
$('span#oswpLauncherContentPopuppoll').live('click', function(e) {
|
151 |
Â
e.preventDefault();
|
152 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
153 |
Â
var text = $(this).attr('data-os-block');
|
154 |
Â
$("button#dropbtn span").text(text);
|
155 |
+
var inputs = $(".filter__itm");
|
156 |
Â
for(var i = 0; i < inputs.length; i++){
|
157 |
+
if($(inputs[i]).text() == text){
|
Â
|
|
158 |
Â
setTimeout(function(){
|
159 |
+
$(inputs[i]).trigger('click');
|
160 |
+
},1000);
|
161 |
+
setTimeout(function(){
|
162 |
+
$('.progress_message').css('display', 'none');
|
163 |
+
$('.content__list').css('display', 'block');
|
164 |
+
},2500);
|
165 |
Â
$('button.content__links-itm').live('click', function(e) {
|
166 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
167 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
171 |
Â
else {
|
172 |
Â
$('.progress_message').css('display', 'block');
|
173 |
Â
$('.content__list').css('display', 'none');
|
Â
|
|
174 |
Â
}
|
175 |
Â
}
|
176 |
Â
});
|
177 |
Â
});
|
178 |
Â
|
179 |
+
// Fetching Ajax Call Result
|
180 |
+
if(dropdownOptions != false){
|
181 |
+
for (var i = 0; i < dropdownOptions.length; i++) {
|
182 |
+
var getLandingPageUrlOs = function(href) {
|
183 |
+
var locationUrlOS = document.createElement("a");
|
184 |
+
locationUrlOS.href = href;
|
185 |
+
return locationUrlOS;
|
186 |
+
};
|
187 |
+
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
188 |
+
var matchValue = locationUrlOS.pathname;
|
189 |
+
if(embedUrl == matchValue){
|
190 |
+
props.setAttributes({lockEmbed: true, buttonText: "Change" });
|
191 |
+
props.setAttributes({ insertItemImage : dropdownOptions[i].attributes['image-url'] });
|
192 |
+
props.setAttributes({ insertItemOsTitle : dropdownOptions[i].attributes['title'] });
|
193 |
+
props.setAttributes({ insertItemOsView : dropdownOptions[i].attributes['landing-page-url'] });
|
194 |
+
props.setAttributes({ insertItemOsEdit : dropdownOptions[i].attributes['edit-url'] });
|
195 |
+
props.setAttributes({ insertItemOsStatistics : dropdownOptions[i].attributes['stats-url'] });
|
196 |
+
break;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
// Content On Editor
|
202 |
+
var contentViewEditStatOs = (
|
203 |
+
<div className="os-poll-wrapper components-placeholder">
|
204 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
205 |
+
<span id="oswpLauncherContentPopuppoll" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="poll" onClick={onSelectButtonClick} >Select a Poll</span>
|
206 |
+
<input type="button" value="Create a New Poll" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
207 |
+
<span></span>
|
208 |
+
</div>
|
209 |
+
);
|
210 |
+
|
211 |
+
if(embedUrl != '' && embedUrl){
|
212 |
Â
if(buttonText == 'Embed'){
|
213 |
Â
contentViewEditStatOs
|
214 |
+
}else if(buttonText == 'Change'){
|
215 |
Â
contentViewEditStatOs = (
|
216 |
+
<div className="os-poll-wrapper components-placeholder">
|
217 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
218 |
+
<div className="components-preview__block" >
|
219 |
+
<div className="components-preview__leftBlockImage">
|
220 |
+
<img src={insertItemImage} alt={insertItemOsTitle} className="image" />
|
221 |
+
<div className="overlay">
|
222 |
+
<div className="text">
|
223 |
+
<a href={insertItemOsView} target="_blank"> View </a>
|
224 |
+
<a href={insertItemOsEdit} target="_blank"> Edit </a>
|
225 |
+
<a href={insertItemOsStatistics} target="_blank"> Statistics </a>
|
226 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onChangeButtonClick}/>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
<div className="components-preview__rightBlockContent">
|
231 |
+
<div className="components-placeholder__label">Poll: {insertItemOsTitle}</div>
|
232 |
Â
</div>
|
233 |
+
</div>
|
234 |
+
<span></span>
|
235 |
+
</div>
|
236 |
+
);
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
237 |
Â
}
|
238 |
+
}else if(embedUrl == '' || jQuery.type(embedUrl) === "undefined"){
|
239 |
Â
contentViewEditStatOs
|
240 |
Â
}else{
|
241 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
242 |
Â
contentViewEditStatOs
|
243 |
Â
}
|
244 |
+
return (
|
Â
|
|
Â
|
|
245 |
Â
<div className={ props.className }>
|
246 |
+
{contentViewEditStatOs}
|
247 |
+
<span></span>
|
248 |
Â
</div>
|
249 |
Â
);
|
250 |
Â
}
|
251 |
Â
},
|
252 |
+
save: function( {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage, insertItemOsTitle, insertItemOsView, insertItemOsEdit, insertItemOsStatistics }} ) {
|
253 |
Â
return (
|
254 |
+
<div class="os-poll-wrapper" data-type="poll" data-image-url={insertItemImage} data-title-url={insertItemOsTitle} data-view-url={insertItemOsView} data-statistics-url={insertItemOsStatistics} data-edit-url={insertItemOsEdit} data-test-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
255 |
+
[os-widget path="{embedUrl}"]
|
256 |
+
<span></span>
|
257 |
Â
</div>
|
258 |
Â
);
|
259 |
Â
},
|
gutenberg/slideshow/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),s=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}return r("next")})}}var o,a,i,s,l,c,u=n(2),p=n.n(u),m=n(5),d=(n.n(m),n(6)),h=(n.n(d),wp.i18n.__),f=wp.blocks.registerBlockType,g=wp.components,v=g.SelectControl,b=(g.TextControl,wp.editor.RichText,!1);f("opinion-stage/block-os-slideshow",{title:h("Slideshow"),icon:"playlist-video",category:"opinion-stage",keywords:[h("Opinion Stage Slideshow"),h("Opinion Stage Slideshow")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=slideshow&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,b=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),d=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<b.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(b[n].attributes["landing-page-url"]),c=r.pathname;if(t==c){o=b[n].attributes.title,a=b[n].attributes["image-url"],i=b[n].attributes["landing-page-url"],s=b[n].attributes["edit-url"],l=b[n].attributes["stats-url"];break}}}}),h=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),L=wp.element.createElement(v,{id:"selectID",options:c,value:u,onChange:d,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var f=osGutenData.onCreateButtonClickOs+"?w_type=slideshow&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",g=function(e){window.open(f,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var w=osGutenData.callbackUrlOs,y=w,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink);console.log(y);var k=function(e){window.location.replace(y)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopupslideshow , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("p",{className:"components-heading"},"Please connect WordPress to Opinion Stage to start adding slideshows"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:k},"Connect")));if(0==b)c=[{value:"Select",label:"Select a slideshow"},{value:"refresh",label:"Refresh"}],t();else{c=[{value:"Select",label:"Select a slideshow"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<b.length;x++){c[c.length]={value:b[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:b[x].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(b[x].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=b[x].attributes.title,a=b[x].attributes["image-url"],i=b[x].attributes["landing-page-url"],s=b[x].attributes["edit-url"],l=b[x].attributes["stats-url"];var S=b[x].id}}}"refresh"==u&&t();var L=wp.element.createElement(v,{id:"selectID",options:c,value:u,onChange:d,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopupslideshow").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none"),console.log("test")}})});var O=wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopupslideshow",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"slideshow"},"Select a Slideshow"),wp.element.createElement("input",{type:"button",value:"Create a New Slideshow",className:"components-button is-button is-default is-block is-primary",onClick:g}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},L,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:h})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),S="os-widget-"+S,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(O=wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:s,target:"_blank"}," Edit "),wp.element.createElement("a",{href:l,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:h})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Slideshow: ",o)))),L=wp.element.createElement(v,{id:"selectID",options:c,value:u,disabled:!0,onChange:d,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},O)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-slideshow-wrapper","data-type":"slideshow","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),s=new d(r||[]);return i._invoke=c(e,n,s),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function l(e){function t(n,o,a,i){var s=r(e[n],e,o);if("throw"!==s.type){var l=s.arg,c=l.value;return c&&"object"===typeof c&&b.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(c).then(function(e){l.value=e,a(l)},i)}i(s.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function c(e,t,n){var o=N;return function(a,i){if(o===L)throw new Error("Generator is already running");if(o===O){if("throw"===a)throw i;return f()}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var l=u(s,n);if(l){if(l===T)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=O,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=L;var c=r(e,t,n);if("normal"===c.type){if(o=n.done?O:S,c.arg===T)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=O,n.method="throw",n.arg=c.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,u(e,t),"throw"===t.method))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,T;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,T):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function d(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function h(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=g,t.done=!0,t};return r.next=r}}return{next:f}}function f(){return{value:g,done:!0}}var g,v=Object.prototype,b=v.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",k=w.toStringTag||"@@toStringTag",x="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(x&&(e.exports=_));_=t.regeneratorRuntime=x?e.exports:{},_.wrap=n;var N="suspendedStart",S="suspendedYield",L="executing",O="completed",T={},C={};C[y]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(h([])));j&&j!==v&&b.call(j,y)&&(C=j);var A=i.prototype=o.prototype=Object.create(C);a.prototype=A.constructor=i,i.constructor=a,i[k]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,k in e||(e[k]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},s(l.prototype),l.prototype[E]=function(){return this},_.AsyncIterator=l,_.async=function(e,t,r,o){var a=new l(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},s(A),A[k]="Generator",A[y]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=h,d.prototype={constructor:d,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&b.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=b.call(o,"catchLoc"),s=b.call(o,"finallyLoc");if(i&&s){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:h(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=g),T}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});n(1)},function(t,e,n){"use strict";function r(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,n){function r(i,o){try{var a=e[i](o),s=a.value}catch(t){return void n(t)}if(!a.done)return Promise.resolve(s).then(function(t){r("next",t)},function(t){r("throw",t)});t(s)}return r("next")})}}var i=n(2),o=n.n(i),a=n(5),s=(n.n(a),n(6)),c=(n.n(s),wp.i18n.__),l=wp.blocks.registerBlockType,u=wp.components,p=(u.SelectControl,u.TextControl,wp.editor.RichText,!1);l("opinion-stage/block-os-slideshow",{title:c("Slideshow"),icon:"playlist-video",category:"opinion-stage",keywords:[c("Opinion Stage Slideshow"),c("Opinion Stage Slideshow")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"},insertItemImage:{source:"attribute",attribute:"data-image-url",selector:"div[data-image-url]"},insertItemOsTitle:{source:"attribute",attribute:"data-title-url",selector:"div[data-title-url]"},insertItemOsView:{source:"attribute",attribute:"data-view-url",selector:"div[data-view-url]"},insertItemOsEdit:{source:"attribute",attribute:"data-edit-url",selector:"div[data-edit-url]"},insertItemOsStatistics:{source:"attribute",attribute:"data-statistics-url",selector:"div[data-statistics-url]"}},edit:function(t){var e=t.attributes,n=e.embedUrl,i=(e.lockEmbed,e.buttonText),a=e.insertItemImage,s=e.insertItemOsTitle,c=e.insertItemOsView,l=e.insertItemOsEdit,u=e.insertItemOsStatistics,m=(t.setAttributes,osGutenData.callbackUrlOs),d=m,f=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),h=function(e){window.verifyOSInsert=function(e){var n=this;t.setAttributes({embedUrl:e,buttonText:"Change"});var a=osGutenData.OswpPluginVersion,s=osGutenData.OswpClientToken,c=osGutenData.OswpFetchDataUrl+"?type=slideshow&page=1&per_page=99";fetch(c,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":a,"OSWP-Client-Token":s}}).then(function(){var e=r(o.a.mark(function e(r){var a;return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.json();case 2:a=e.sent,a=a.data,p=a,t.setAttributes({buttonText:i});case 6:case"end":return e.stop()}},e,n)}));return function(t){return e.apply(this,arguments)}}()).catch(function(t){console.log("ERROR: "+t.message)})}},g=function(e){t.setAttributes({embedUrl:"",buttonText:"Embed",lockEmbed:!1,insertItemImage:!1,insertItemOsTitle:!1,insertItemOsView:!1,insertItemOsEdit:!1,insertItemOsStatistics:!1})},w=function(t){window.location.replace(d)},v=osGutenData.onCreateButtonClickOs+"?w_type=slideshow&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",b=function(t){window.open(v,"_blank").focus()};if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:t.className},wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("p",{className:"components-heading"},"Please connect WordPress to Opinion Stage to start adding slideshows"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:w},"Connect")),wp.element.createElement("div",null));if($(document).ready(function(){$("span#oswpLauncherContentPopupslideshow").live("click",function(t){t.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var e=$(this).attr("data-os-block");$("button#dropbtn span").text(e);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==e){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(t){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none")}})}),0!=p)for(var y=0;y<p.length;y++){var E=function(t){var e=document.createElement("a");return e.href=t,e}(p[y].attributes["landing-page-url"]),x=E.pathname;if(n==x){t.setAttributes({lockEmbed:!0,buttonText:"Change"}),t.setAttributes({insertItemImage:p[y].attributes["image-url"]}),t.setAttributes({insertItemOsTitle:p[y].attributes.title}),t.setAttributes({insertItemOsView:p[y].attributes["landing-page-url"]}),t.setAttributes({insertItemOsEdit:p[y].attributes["edit-url"]}),t.setAttributes({insertItemOsStatistics:p[y].attributes["stats-url"]});break}}var k=wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopupslideshow",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"slideshow",onClick:h},"Select a Slideshow"),wp.element.createElement("input",{type:"button",value:"Create a New Slideshow",className:"components-button is-button is-default is-block is-primary",onClick:b}),wp.element.createElement("span",null));return""!=n&&n?"Embed"==i||"Change"==i&&(k=wp.element.createElement("div",{className:"os-slideshow-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:s,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:c,target:"_blank"}," View "),wp.element.createElement("a",{href:l,target:"_blank"}," Edit "),wp.element.createElement("a",{href:u,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:i,className:"components-button is-button is-default is-large left-align",onClick:g})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Slideshow: ",s))),wp.element.createElement("span",null))):""==n||"undefined"===jQuery.type(n)||t.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:t.className},k,wp.element.createElement("span",null))},save:function(t){var e=t.attributes,n=e.embedUrl,r=e.lockEmbed,i=e.buttonText,o=e.insertItemImage,a=e.insertItemOsTitle,s=e.insertItemOsView,c=e.insertItemOsEdit,l=e.insertItemOsStatistics;return wp.element.createElement("div",{class:"os-slideshow-wrapper","data-type":"slideshow","data-image-url":o,"data-title-url":a,"data-view-url":s,"data-statistics-url":l,"data-edit-url":c,"data-test-url":n,"data-lock-embed":r,"data-button-text":i},'[os-widget path="',n,'"]',wp.element.createElement("span",null))}})},function(t,e,n){t.exports=n(3)},function(t,e,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,t.exports=n(4),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(t){r.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";function n(t,e,n,r){var o=e&&e.prototype instanceof i?e:i,a=Object.create(o.prototype),s=new d(r||[]);return a._invoke=l(t,n,s),a}function r(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function i(){}function o(){}function a(){}function s(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function c(t){function e(n,i,o,a){var s=r(t[n],t,i);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"===typeof l&&v.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,o,a)},function(t){e("throw",t,o,a)}):Promise.resolve(l).then(function(t){c.value=t,o(c)},a)}a(s.arg)}function n(t,n){function r(){return new Promise(function(r,i){e(t,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function l(t,e,n){var i=_;return function(o,a){if(i===L)throw new Error("Generator is already running");if(i===N){if("throw"===o)throw a;return h()}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=u(s,n);if(c){if(c===T)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===_)throw i=N,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=L;var l=r(t,e,n);if("normal"===l.type){if(i=n.done?N:I,l.arg===T)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=N,n.method="throw",n.arg=l.arg)}}}function u(t,e){var n=t.iterator[e.method];if(n===g){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=g,u(t,e),"throw"===e.method))return T;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var i=r(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,T;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=g),e.delegate=null,T):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,T)}function p(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function m(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function d(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(p,this),this.reset(!0)}function f(t){if(t){var e=t[y];if(e)return e.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(v.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=g,e.done=!0,e};return r.next=r}}return{next:h}}function h(){return{value:g,done:!0}}var g,w=Object.prototype,v=w.hasOwnProperty,b="function"===typeof Symbol?Symbol:{},y=b.iterator||"@@iterator",E=b.asyncIterator||"@@asyncIterator",x=b.toStringTag||"@@toStringTag",k="object"===typeof t,O=e.regeneratorRuntime;if(O)return void(k&&(t.exports=O));O=e.regeneratorRuntime=k?t.exports:{},O.wrap=n;var _="suspendedStart",I="suspendedYield",L="executing",N="completed",T={},S={};S[y]=function(){return this};var P=Object.getPrototypeOf,C=P&&P(P(f([])));C&&C!==w&&v.call(C,y)&&(S=C);var j=a.prototype=i.prototype=Object.create(S);o.prototype=j.constructor=a,a.constructor=o,a[x]=o.displayName="GeneratorFunction",O.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===o||"GeneratorFunction"===(e.displayName||e.name))},O.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,x in t||(t[x]="GeneratorFunction")),t.prototype=Object.create(j),t},O.awrap=function(t){return{__await:t}},s(c.prototype),c.prototype[E]=function(){return this},O.AsyncIterator=c,O.async=function(t,e,r,i){var o=new c(n(t,e,r,i));return O.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},s(j),j[x]="Generator",j[y]=function(){return this},j.toString=function(){return"[object Generator]"},O.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},O.values=f,d.prototype={constructor:d,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(m),!t)for(var e in this)"t"===e.charAt(0)&&v.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=g)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,r){return o.type="throw",o.arg=t,n.next=e,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw t;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var a=v.call(i,"catchLoc"),s=v.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&v.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,T):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),T},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),m(n),T}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;m(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:f(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=g),T}}}(function(){return this}()||Function("return this")())},function(t,e){},function(t,e){}]);
|
gutenberg/slideshow/src/.DS_Store
CHANGED
Binary file
|
gutenberg/slideshow/src/block/block.js
CHANGED
@@ -6,13 +6,12 @@ const { registerBlockType } = wp.blocks;
|
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
-
var dropdownOptions
|
10 |
-
var
|
11 |
-
var
|
12 |
-
var
|
13 |
-
var
|
14 |
-
var
|
15 |
-
var options;
|
16 |
Â
|
17 |
Â
registerBlockType( 'opinion-stage/block-os-slideshow', {
|
18 |
Â
title: __( 'Slideshow' ),
|
@@ -21,18 +20,13 @@ var options;
|
|
21 |
Â
keywords: [
|
22 |
Â
__( 'Opinion Stage Slideshow' ),
|
23 |
Â
__( 'Opinion Stage Slideshow' ),
|
24 |
-
],
|
25 |
Â
attributes: {
|
26 |
Â
embedUrl: {
|
27 |
Â
source: 'attribute',
|
28 |
Â
attribute: 'data-test-url',
|
29 |
Â
selector: 'div[data-test-url]'
|
30 |
-
},
|
31 |
-
oswpUrlShortcode: {
|
32 |
-
source: 'attribute',
|
33 |
-
attribute: 'data-test-url',
|
34 |
-
selector: 'div[data-test-url]'
|
35 |
-
},
|
36 |
Â
lockEmbed: {
|
37 |
Â
source: 'attribute',
|
38 |
Â
attribute: 'data-lock-embed',
|
@@ -42,174 +36,132 @@ var options;
|
|
42 |
Â
source: 'attribute',
|
43 |
Â
attribute: 'data-button-text',
|
44 |
Â
selector: 'div[data-button-text]'
|
45 |
-
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
46 |
Â
},
|
47 |
Â
edit: function( props ) {
|
48 |
-
|
49 |
-
|
50 |
-
if(val == ''){
|
51 |
-
props.setAttributes({ embedUrl: '' });
|
52 |
-
}else if(val != ''){
|
53 |
-
props.setAttributes({ embedUrl: val });
|
54 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
55 |
-
var getLandingPageUrlOs = function(href) {
|
56 |
-
var locationUrlOS = document.createElement("a");
|
57 |
-
locationUrlOS.href = href;
|
58 |
-
return locationUrlOS;
|
59 |
-
};
|
60 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
61 |
-
var matchValue = locationUrlOS.pathname;
|
62 |
-
if(val == matchValue){
|
63 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
64 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
-
break;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}else{
|
72 |
-
}
|
73 |
-
};
|
74 |
-
const onEmbedButtonClick = event => {
|
75 |
-
if( event.target.value == "Embed" ){
|
76 |
-
if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
|
77 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
-
}else{
|
79 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
-
}
|
82 |
-
}else{
|
83 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
-
}
|
85 |
-
};
|
86 |
-
|
87 |
-
window.verifyOSInsert = function(widget){
|
88 |
-
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
-
var myOpts = document.getElementById('selectID').options;
|
90 |
-
for(var i = 0; i < myOpts.length; i++){
|
91 |
-
if(myOpts[i].value == widget){
|
92 |
-
myOpts[i].defaultSelected = true;
|
93 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
-
break;
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=slideshow&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
-
const onCreateButtonClick = value => {
|
101 |
-
// Open Create new slideshow link in new page
|
102 |
-
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
103 |
-
};
|
104 |
-
|
105 |
-
if(!buttonText){
|
106 |
-
props.setAttributes({ buttonText: 'Embed' });
|
107 |
-
}
|
108 |
Â
|
Â
|
|
109 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
110 |
Â
var callback_url = getCallBackUrlOs;
|
111 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
113 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
114 |
Â
const onConnectOSWPButtonClick = value => {
|
115 |
-
// Open Connect to opinionstage
|
116 |
Â
window.location.replace(callback_url);
|
117 |
Â
};
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
'Accept':'application/vnd.api+json',
|
127 |
-
'Content-Type':'application/vnd.api+json',
|
128 |
-
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
129 |
-
'OSWP-Client-Token': opinionStageClientToken
|
130 |
-
},
|
131 |
-
})
|
132 |
-
.then(async res => {
|
133 |
-
var data = await res.json();
|
134 |
-
data = data.data;
|
135 |
-
dropdownOptions = data;
|
136 |
-
// force reprinting instead!!
|
137 |
-
props.setAttributes({ buttonText: 'Embed'});
|
138 |
-
props.setAttributes({ buttonText: buttonText});
|
139 |
-
if(buttonText == 'Change' && embedUrl !='Select'){
|
140 |
-
props.setAttributes({ embedUrl: embedUrl });
|
141 |
-
}else{
|
142 |
-
props.setAttributes({ embedUrl: 'Select' });
|
143 |
-
}
|
144 |
-
})
|
145 |
-
.catch(function(err) {
|
146 |
-
console.log('ERROR: ' + err.message);
|
147 |
-
});
|
148 |
-
}
|
149 |
Â
// Checking for Opinion Stage connection
|
150 |
Â
if(osGutenData.isOsConnected == ''){
|
151 |
-
|
152 |
-
$('span#oswpLauncherContentPopupslideshow , #owspLaunchInputCreate').live('click', function(e) {
|
153 |
-
e.preventDefault();
|
154 |
-
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
155 |
-
});
|
156 |
-
});
|
157 |
Â
return (
|
158 |
Â
<div className={ props.className }>
|
159 |
Â
<div className="os-slideshow-wrapper components-placeholder">
|
160 |
Â
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
161 |
Â
<p className="components-heading">Please connect WordPress to Opinion Stage to start adding slideshows</p>
|
162 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
163 |
-
</div>
|
Â
|
|
164 |
Â
</div>
|
165 |
Â
);
|
166 |
-
}else{
|
167 |
-
|
168 |
-
options = [{value:'Select',label:'Select a slideshow'},{value:'refresh',label:'Refresh'}];
|
169 |
-
OsPolulateList();
|
170 |
-
}else{
|
171 |
-
options = [{value:'Select',label:'Select a slideshow'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
172 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
173 |
-
options[options.length] = {
|
174 |
-
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
175 |
-
label: dropdownOptions[i].attributes['title'],
|
176 |
-
};
|
177 |
-
var getLandingPageUrlOs = function(href) {
|
178 |
-
var locationUrlOS = document.createElement("a");
|
179 |
-
locationUrlOS.href = href;
|
180 |
-
return locationUrlOS;
|
181 |
-
};
|
182 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
183 |
-
var matchValue = locationUrlOS.pathname;
|
184 |
-
if(embedUrl == matchValue){
|
185 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
186 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
187 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
188 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
189 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
190 |
-
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
191 |
-
|
192 |
-
}
|
193 |
-
}
|
194 |
-
}
|
195 |
-
if(embedUrl == 'refresh'){
|
196 |
-
OsPolulateList();
|
197 |
-
}
|
198 |
-
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
199 |
Â
$(document).ready(function () {
|
Â
|
|
200 |
Â
$('span#oswpLauncherContentPopupslideshow').live('click', function(e) {
|
201 |
Â
e.preventDefault();
|
202 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
203 |
Â
var text = $(this).attr('data-os-block');
|
204 |
Â
$("button#dropbtn span").text(text);
|
205 |
-
var inputs = $(".filter__itm");
|
206 |
Â
for(var i = 0; i < inputs.length; i++){
|
207 |
-
if($(inputs[i]).text() == text){
|
208 |
-
setTimeout(function(){$(inputs[i]).trigger('click');},1000);
|
209 |
Â
setTimeout(function(){
|
210 |
-
|
211 |
-
|
212 |
-
|
Â
|
|
Â
|
|
Â
|
|
213 |
Â
$('button.content__links-itm').live('click', function(e) {
|
214 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
215 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
@@ -219,83 +171,89 @@ var options;
|
|
219 |
Â
else {
|
220 |
Â
$('.progress_message').css('display', 'block');
|
221 |
Â
$('.content__list').css('display', 'none');
|
222 |
-
console.log('test');
|
223 |
Â
}
|
224 |
Â
}
|
225 |
Â
});
|
226 |
Â
});
|
227 |
Â
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
254 |
Â
if(buttonText == 'Embed'){
|
255 |
Â
contentViewEditStatOs
|
256 |
-
}else if(buttonText == 'Change'){
|
257 |
Â
contentViewEditStatOs = (
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
270 |
Â
</div>
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
</div>
|
276 |
-
</div>
|
277 |
-
);
|
278 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
279 |
Â
}
|
280 |
-
}else if(embedUrl == '
|
281 |
Â
contentViewEditStatOs
|
282 |
Â
}else{
|
283 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
284 |
Â
contentViewEditStatOs
|
285 |
Â
}
|
286 |
-
|
287 |
-
|
288 |
-
return (
|
289 |
Â
<div className={ props.className }>
|
290 |
-
{contentViewEditStatOs}
|
Â
|
|
291 |
Â
</div>
|
292 |
Â
);
|
293 |
Â
}
|
294 |
Â
},
|
295 |
-
save: function( {attributes: {embedUrl,
|
296 |
Â
return (
|
297 |
-
<div class="os-slideshow-wrapper"
|
298 |
-
[os-widget path="{
|
Â
|
|
299 |
Â
</div>
|
300 |
Â
);
|
301 |
Â
},
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
+
var dropdownOptions = false;
|
10 |
+
var insertItemImage = false;
|
11 |
+
var insertItemOsTitle = false;
|
12 |
+
var insertItemOsView = false;
|
13 |
+
var insertItemOsEdit = false;
|
14 |
+
var insertItemOsStatistics = false;
|
Â
|
|
15 |
Â
|
16 |
Â
registerBlockType( 'opinion-stage/block-os-slideshow', {
|
17 |
Â
title: __( 'Slideshow' ),
|
20 |
Â
keywords: [
|
21 |
Â
__( 'Opinion Stage Slideshow' ),
|
22 |
Â
__( 'Opinion Stage Slideshow' ),
|
23 |
+
],
|
24 |
Â
attributes: {
|
25 |
Â
embedUrl: {
|
26 |
Â
source: 'attribute',
|
27 |
Â
attribute: 'data-test-url',
|
28 |
Â
selector: 'div[data-test-url]'
|
29 |
+
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
30 |
Â
lockEmbed: {
|
31 |
Â
source: 'attribute',
|
32 |
Â
attribute: 'data-lock-embed',
|
36 |
Â
source: 'attribute',
|
37 |
Â
attribute: 'data-button-text',
|
38 |
Â
selector: 'div[data-button-text]'
|
39 |
+
},
|
40 |
+
insertItemImage: {
|
41 |
+
source: 'attribute',
|
42 |
+
attribute: 'data-image-url',
|
43 |
+
selector: 'div[data-image-url]'
|
44 |
+
},
|
45 |
+
insertItemOsTitle: {
|
46 |
+
source: 'attribute',
|
47 |
+
attribute: 'data-title-url',
|
48 |
+
selector: 'div[data-title-url]'
|
49 |
+
},
|
50 |
+
insertItemOsView: {
|
51 |
+
source: 'attribute',
|
52 |
+
attribute: 'data-view-url',
|
53 |
+
selector: 'div[data-view-url]'
|
54 |
+
},
|
55 |
+
insertItemOsEdit: {
|
56 |
+
source: 'attribute',
|
57 |
+
attribute: 'data-edit-url',
|
58 |
+
selector: 'div[data-edit-url]'
|
59 |
+
},
|
60 |
+
insertItemOsStatistics: {
|
61 |
+
source: 'attribute',
|
62 |
+
attribute: 'data-statistics-url',
|
63 |
+
selector: 'div[data-statistics-url]'
|
64 |
+
}
|
65 |
Â
},
|
66 |
Â
edit: function( props ) {
|
67 |
+
// Setting Attributes
|
68 |
+
let {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage,insertItemOsTitle,insertItemOsView,insertItemOsEdit,insertItemOsStatistics}, setAttributes} = props;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
69 |
Â
|
70 |
+
// Fetching Localized variables
|
71 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
72 |
Â
var callback_url = getCallBackUrlOs;
|
73 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
74 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
75 |
+
|
76 |
+
// Select Button Click functionality
|
77 |
+
const onSelectButtonClick = value => {
|
78 |
+
window.verifyOSInsert = function(widget){
|
79 |
+
props.setAttributes({ embedUrl: widget, buttonText:'Change' });
|
80 |
+
|
81 |
+
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
82 |
+
var opinionStageClientToken = osGutenData.OswpClientToken;
|
83 |
+
var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=slideshow&page=1&per_page=99';
|
84 |
+
fetch(opinionstageFetchDataUrl, {
|
85 |
+
method: "GET",
|
86 |
+
headers: {
|
87 |
+
'Accept':'application/vnd.api+json',
|
88 |
+
'Content-Type':'application/vnd.api+json',
|
89 |
+
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
90 |
+
'OSWP-Client-Token': opinionStageClientToken
|
91 |
+
},
|
92 |
+
})
|
93 |
+
.then(async res => {
|
94 |
+
var data = await res.json();
|
95 |
+
data = data.data;
|
96 |
+
dropdownOptions = data;
|
97 |
+
// force reprinting instead!!
|
98 |
+
props.setAttributes({ buttonText: buttonText});
|
99 |
+
|
100 |
+
})
|
101 |
+
.catch(function(err) {
|
102 |
+
console.log('ERROR: ' + err.message);
|
103 |
+
});
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
// Change Button Click functionality
|
108 |
+
const onChangeButtonClick = value => {
|
109 |
+
props.setAttributes({
|
110 |
+
embedUrl: '',
|
111 |
+
buttonText:'Embed',
|
112 |
+
lockEmbed: false,
|
113 |
+
insertItemImage: false,
|
114 |
+
insertItemOsTitle: false,
|
115 |
+
insertItemOsView: false,
|
116 |
+
insertItemOsEdit: false,
|
117 |
+
insertItemOsStatistics: false
|
118 |
+
});
|
119 |
+
}
|
120 |
+
|
121 |
+
// Connect to Opinionstage Callback Url
|
122 |
Â
const onConnectOSWPButtonClick = value => {
|
Â
|
|
123 |
Â
window.location.replace(callback_url);
|
124 |
Â
};
|
125 |
+
|
126 |
+
// Create New Item Url (slideshow)
|
127 |
+
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=slideshow&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
128 |
+
const onCreateButtonClick = value => {
|
129 |
+
// Open Create new slideshow link in new page
|
130 |
+
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
131 |
+
};
|
132 |
+
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
133 |
Â
// Checking for Opinion Stage connection
|
134 |
Â
if(osGutenData.isOsConnected == ''){
|
135 |
+
// Not Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
136 |
Â
return (
|
137 |
Â
<div className={ props.className }>
|
138 |
Â
<div className="os-slideshow-wrapper components-placeholder">
|
139 |
Â
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
140 |
Â
<p className="components-heading">Please connect WordPress to Opinion Stage to start adding slideshows</p>
|
141 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
142 |
+
</div>
|
143 |
+
<div></div>
|
144 |
Â
</div>
|
145 |
Â
);
|
146 |
+
}else{
|
147 |
+
// Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
148 |
Â
$(document).ready(function () {
|
149 |
+
// Content Popup Launch Working
|
150 |
Â
$('span#oswpLauncherContentPopupslideshow').live('click', function(e) {
|
151 |
Â
e.preventDefault();
|
152 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
153 |
Â
var text = $(this).attr('data-os-block');
|
154 |
Â
$("button#dropbtn span").text(text);
|
155 |
+
var inputs = $(".filter__itm");
|
156 |
Â
for(var i = 0; i < inputs.length; i++){
|
157 |
+
if($(inputs[i]).text() == text){
|
Â
|
|
158 |
Â
setTimeout(function(){
|
159 |
+
$(inputs[i]).trigger('click');
|
160 |
+
},1000);
|
161 |
+
setTimeout(function(){
|
162 |
+
$('.progress_message').css('display', 'none');
|
163 |
+
$('.content__list').css('display', 'block');
|
164 |
+
},2500);
|
165 |
Â
$('button.content__links-itm').live('click', function(e) {
|
166 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
167 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
171 |
Â
else {
|
172 |
Â
$('.progress_message').css('display', 'block');
|
173 |
Â
$('.content__list').css('display', 'none');
|
Â
|
|
174 |
Â
}
|
175 |
Â
}
|
176 |
Â
});
|
177 |
Â
});
|
178 |
Â
|
179 |
+
// Fetching Ajax Call Result
|
180 |
+
if(dropdownOptions != false){
|
181 |
+
for (var i = 0; i < dropdownOptions.length; i++) {
|
182 |
+
var getLandingPageUrlOs = function(href) {
|
183 |
+
var locationUrlOS = document.createElement("a");
|
184 |
+
locationUrlOS.href = href;
|
185 |
+
return locationUrlOS;
|
186 |
+
};
|
187 |
+
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
188 |
+
var matchValue = locationUrlOS.pathname;
|
189 |
+
if(embedUrl == matchValue){
|
190 |
+
props.setAttributes({lockEmbed: true, buttonText: "Change" });
|
191 |
+
props.setAttributes({ insertItemImage : dropdownOptions[i].attributes['image-url'] });
|
192 |
+
props.setAttributes({ insertItemOsTitle : dropdownOptions[i].attributes['title'] });
|
193 |
+
props.setAttributes({ insertItemOsView : dropdownOptions[i].attributes['landing-page-url'] });
|
194 |
+
props.setAttributes({ insertItemOsEdit : dropdownOptions[i].attributes['edit-url'] });
|
195 |
+
props.setAttributes({ insertItemOsStatistics : dropdownOptions[i].attributes['stats-url'] });
|
196 |
+
break;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
// Content On Editor
|
202 |
+
var contentViewEditStatOs = (
|
203 |
+
<div className="os-slideshow-wrapper components-placeholder">
|
204 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
205 |
+
<span id="oswpLauncherContentPopupslideshow" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="slideshow" onClick={onSelectButtonClick} >Select a Slideshow</span>
|
206 |
+
<input type="button" value="Create a New Slideshow" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
207 |
+
<span></span>
|
208 |
+
</div>
|
209 |
+
);
|
210 |
+
|
211 |
+
if(embedUrl != '' && embedUrl){
|
212 |
Â
if(buttonText == 'Embed'){
|
213 |
Â
contentViewEditStatOs
|
214 |
+
}else if(buttonText == 'Change'){
|
215 |
Â
contentViewEditStatOs = (
|
216 |
+
<div className="os-slideshow-wrapper components-placeholder">
|
217 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
218 |
+
<div className="components-preview__block" >
|
219 |
+
<div className="components-preview__leftBlockImage">
|
220 |
+
<img src={insertItemImage} alt={insertItemOsTitle} className="image" />
|
221 |
+
<div className="overlay">
|
222 |
+
<div className="text">
|
223 |
+
<a href={insertItemOsView} target="_blank"> View </a>
|
224 |
+
<a href={insertItemOsEdit} target="_blank"> Edit </a>
|
225 |
+
<a href={insertItemOsStatistics} target="_blank"> Statistics </a>
|
226 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onChangeButtonClick}/>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
<div className="components-preview__rightBlockContent">
|
231 |
+
<div className="components-placeholder__label">Slideshow: {insertItemOsTitle}</div>
|
232 |
Â
</div>
|
233 |
+
</div>
|
234 |
+
<span></span>
|
235 |
+
</div>
|
236 |
+
);
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
237 |
Â
}
|
238 |
+
}else if(embedUrl == '' || jQuery.type(embedUrl) === "undefined"){
|
239 |
Â
contentViewEditStatOs
|
240 |
Â
}else{
|
241 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
242 |
Â
contentViewEditStatOs
|
243 |
Â
}
|
244 |
+
return (
|
Â
|
|
Â
|
|
245 |
Â
<div className={ props.className }>
|
246 |
+
{contentViewEditStatOs}
|
247 |
+
<span></span>
|
248 |
Â
</div>
|
249 |
Â
);
|
250 |
Â
}
|
251 |
Â
},
|
252 |
+
save: function( {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage, insertItemOsTitle, insertItemOsView, insertItemOsEdit, insertItemOsStatistics }} ) {
|
253 |
Â
return (
|
254 |
+
<div class="os-slideshow-wrapper" data-type="slideshow" data-image-url={insertItemImage} data-title-url={insertItemOsTitle} data-view-url={insertItemOsView} data-statistics-url={insertItemOsStatistics} data-edit-url={insertItemOsEdit} data-test-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
255 |
+
[os-widget path="{embedUrl}"]
|
256 |
+
<span></span>
|
257 |
Â
</div>
|
258 |
Â
);
|
259 |
Â
},
|
gutenberg/survey/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),s=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}return r("next")})}}var o,a,i,s,c,l,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),d=(n.n(f),wp.i18n.__),h=wp.blocks.registerBlockType,v=wp.components,g=v.SelectControl,b=(v.TextControl,wp.editor.RichText,!1);h("opinion-stage/block-os-survey",{title:d("Survey"),icon:"list-view",category:"opinion-stage",keywords:[d("Opinion Stage Survey"),d("Opinion Stage Survey")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=survey&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,b=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<b.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(b[n].attributes["landing-page-url"]),l=r.pathname;if(t==l){o=b[n].attributes.title,a=b[n].attributes["image-url"],i=b[n].attributes["landing-page-url"],s=b[n].attributes["edit-url"],c=b[n].attributes["stats-url"];break}}}}),d=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),L=wp.element.createElement(g,{id:"selectID",options:l,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var h=osGutenData.onCreateButtonClickOs+"?w_type=survey&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",v=function(e){window.open(h,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var y=osGutenData.callbackUrlOs,w=y,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),k=function(e){window.location.replace(w)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopupsurvey , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("p",{className:"components-heading"},"Please connect WordPress to Opinion Stage to start adding surveys"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:k},"Connect")));if(0==b)l=[{value:"Select",label:"Select a survey"},{value:"refresh",label:"Refresh"}],t();else{l=[{value:"Select",label:"Select a survey"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<b.length;x++){l[l.length]={value:b[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:b[x].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(b[x].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=b[x].attributes.title,a=b[x].attributes["image-url"],i=b[x].attributes["landing-page-url"],s=b[x].attributes["edit-url"],c=b[x].attributes["stats-url"];var S=b[x].id}}}"refresh"==u&&t();var L=wp.element.createElement(g,{id:"selectID",options:l,value:u,onChange:f,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopupsurvey").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none"),console.log("test")}})});var O=wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopupsurvey",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"survey"},"Select a Survey"),wp.element.createElement("input",{type:"button",value:"Create a New Survey",className:"components-button is-button is-default is-block is-primary",onClick:v}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},L,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:d})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),S="os-widget-"+S,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(O=wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:s,target:"_blank"}," Edit "),wp.element.createElement("a",{href:c,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:d})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Survey: ",o)))),L=wp.element.createElement(g,{id:"selectID",options:l,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},O)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-survey-wrapper","data-type":"survey","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),s=new f(r||[]);return i._invoke=l(e,n,s),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,o,a,i){var s=r(e[n],e,o);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"===typeof l&&b.call(l,"__await")?Promise.resolve(l.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(l).then(function(e){c.value=e,a(c)},i)}i(s.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function l(e,t,n){var o=N;return function(a,i){if(o===L)throw new Error("Generator is already running");if(o===O){if("throw"===a)throw i;return h()}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var c=u(s,n);if(c){if(c===T)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=O,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=L;var l=r(e,t,n);if("normal"===l.type){if(o=n.done?O:S,l.arg===T)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=O,n.method="throw",n.arg=l.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===v){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=v,u(e,t),"throw"===t.method))return T;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,T;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=v),t.delegate=null,T):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,T)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[w];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=v,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:v,done:!0}}var v,g=Object.prototype,b=g.hasOwnProperty,y="function"===typeof Symbol?Symbol:{},w=y.iterator||"@@iterator",E=y.asyncIterator||"@@asyncIterator",k=y.toStringTag||"@@toStringTag",x="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(x&&(e.exports=_));_=t.regeneratorRuntime=x?e.exports:{},_.wrap=n;var N="suspendedStart",S="suspendedYield",L="executing",O="completed",T={},C={};C[w]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(d([])));j&&j!==g&&b.call(j,w)&&(C=j);var A=i.prototype=o.prototype=Object.create(C);a.prototype=A.constructor=i,i.constructor=a,i[k]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,k in e||(e[k]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},s(c.prototype),c.prototype[E]=function(){return this},_.AsyncIterator=c,_.async=function(e,t,r,o){var a=new c(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},s(A),A[k]="Generator",A[w]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&b.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=v)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=v),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=b.call(o,"catchLoc"),s=b.call(o,"finallyLoc");if(i&&s){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,T):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),T},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),T}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=v),T}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});n(1)},function(t,e,n){"use strict";function r(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,n){function r(i,o){try{var a=e[i](o),s=a.value}catch(t){return void n(t)}if(!a.done)return Promise.resolve(s).then(function(t){r("next",t)},function(t){r("throw",t)});t(s)}return r("next")})}}var i=n(2),o=n.n(i),a=n(5),s=(n.n(a),n(6)),c=(n.n(s),wp.i18n.__),u=wp.blocks.registerBlockType,l=wp.components,p=(l.SelectControl,l.TextControl,wp.editor.RichText,!1);u("opinion-stage/block-os-survey",{title:c("Survey"),icon:"list-view",category:"opinion-stage",keywords:[c("Opinion Stage Survey"),c("Opinion Stage Survey")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"},insertItemImage:{source:"attribute",attribute:"data-image-url",selector:"div[data-image-url]"},insertItemOsTitle:{source:"attribute",attribute:"data-title-url",selector:"div[data-title-url]"},insertItemOsView:{source:"attribute",attribute:"data-view-url",selector:"div[data-view-url]"},insertItemOsEdit:{source:"attribute",attribute:"data-edit-url",selector:"div[data-edit-url]"},insertItemOsStatistics:{source:"attribute",attribute:"data-statistics-url",selector:"div[data-statistics-url]"}},edit:function(t){var e=t.attributes,n=e.embedUrl,i=(e.lockEmbed,e.buttonText),a=e.insertItemImage,s=e.insertItemOsTitle,c=e.insertItemOsView,u=e.insertItemOsEdit,l=e.insertItemOsStatistics,m=(t.setAttributes,osGutenData.callbackUrlOs),d=m,f=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),h=function(e){window.verifyOSInsert=function(e){var n=this;t.setAttributes({embedUrl:e,buttonText:"Change"});var a=osGutenData.OswpPluginVersion,s=osGutenData.OswpClientToken,c=osGutenData.OswpFetchDataUrl+"?type=survey&page=1&per_page=99";fetch(c,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":a,"OSWP-Client-Token":s}}).then(function(){var e=r(o.a.mark(function e(r){var a;return o.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.json();case 2:a=e.sent,a=a.data,p=a,t.setAttributes({buttonText:i});case 6:case"end":return e.stop()}},e,n)}));return function(t){return e.apply(this,arguments)}}()).catch(function(t){console.log("ERROR: "+t.message)})}},v=function(e){t.setAttributes({embedUrl:"",buttonText:"Embed",lockEmbed:!1,insertItemImage:!1,insertItemOsTitle:!1,insertItemOsView:!1,insertItemOsEdit:!1,insertItemOsStatistics:!1})},g=function(t){window.location.replace(d)},y=osGutenData.onCreateButtonClickOs+"?w_type=survey&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",b=function(t){window.open(y,"_blank").focus()};if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:t.className},wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("p",{className:"components-heading"},"Please connect WordPress to Opinion Stage to start adding surveys"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:g},"Connect")),wp.element.createElement("div",null));if($(document).ready(function(){$("span#oswpLauncherContentPopupsurvey").live("click",function(t){t.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var e=$(this).attr("data-os-block");$("button#dropbtn span").text(e);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==e){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(t){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none")}})}),0!=p)for(var w=0;w<p.length;w++){var E=function(t){var e=document.createElement("a");return e.href=t,e}(p[w].attributes["landing-page-url"]),x=E.pathname;if(n==x){t.setAttributes({lockEmbed:!0,buttonText:"Change"}),t.setAttributes({insertItemImage:p[w].attributes["image-url"]}),t.setAttributes({insertItemOsTitle:p[w].attributes.title}),t.setAttributes({insertItemOsView:p[w].attributes["landing-page-url"]}),t.setAttributes({insertItemOsEdit:p[w].attributes["edit-url"]}),t.setAttributes({insertItemOsStatistics:p[w].attributes["stats-url"]});break}}var k=wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopupsurvey",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"survey",onClick:h},"Select a Survey"),wp.element.createElement("input",{type:"button",value:"Create a New survey",className:"components-button is-button is-default is-block is-primary",onClick:b}),wp.element.createElement("span",null));return""!=n&&n?"Embed"==i||"Change"==i&&(k=wp.element.createElement("div",{className:"os-survey-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:s,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:c,target:"_blank"}," View "),wp.element.createElement("a",{href:u,target:"_blank"}," Edit "),wp.element.createElement("a",{href:l,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:i,className:"components-button is-button is-default is-large left-align",onClick:v})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Survey: ",s))),wp.element.createElement("span",null))):""==n||"undefined"===jQuery.type(n)||t.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:t.className},k,wp.element.createElement("span",null))},save:function(t){var e=t.attributes,n=e.embedUrl,r=e.lockEmbed,i=e.buttonText,o=e.insertItemImage,a=e.insertItemOsTitle,s=e.insertItemOsView,c=e.insertItemOsEdit,u=e.insertItemOsStatistics;return wp.element.createElement("div",{class:"os-survey-wrapper","data-type":"survey","data-image-url":o,"data-title-url":a,"data-view-url":s,"data-statistics-url":u,"data-edit-url":c,"data-test-url":n,"data-lock-embed":r,"data-button-text":i},'[os-widget path="',n,'"]',wp.element.createElement("span",null))}})},function(t,e,n){t.exports=n(3)},function(t,e,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,t.exports=n(4),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(t){r.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";function n(t,e,n,r){var o=e&&e.prototype instanceof i?e:i,a=Object.create(o.prototype),s=new d(r||[]);return a._invoke=u(t,n,s),a}function r(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function i(){}function o(){}function a(){}function s(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function c(t){function e(n,i,o,a){var s=r(t[n],t,i);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"===typeof u&&y.call(u,"__await")?Promise.resolve(u.__await).then(function(t){e("next",t,o,a)},function(t){e("throw",t,o,a)}):Promise.resolve(u).then(function(t){c.value=t,o(c)},a)}a(s.arg)}function n(t,n){function r(){return new Promise(function(r,i){e(t,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function u(t,e,n){var i=_;return function(o,a){if(i===L)throw new Error("Generator is already running");if(i===N){if("throw"===o)throw a;return h()}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=l(s,n);if(c){if(c===T)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===_)throw i=N,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=L;var u=r(t,e,n);if("normal"===u.type){if(i=n.done?N:I,u.arg===T)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=N,n.method="throw",n.arg=u.arg)}}}function l(t,e){var n=t.iterator[e.method];if(n===v){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=v,l(t,e),"throw"===e.method))return T;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return T}var i=r(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,T;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=v),e.delegate=null,T):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,T)}function p(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function m(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function d(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(p,this),this.reset(!0)}function f(t){if(t){var e=t[w];if(e)return e.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(y.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=v,e.done=!0,e};return r.next=r}}return{next:h}}function h(){return{value:v,done:!0}}var v,g=Object.prototype,y=g.hasOwnProperty,b="function"===typeof Symbol?Symbol:{},w=b.iterator||"@@iterator",E=b.asyncIterator||"@@asyncIterator",x=b.toStringTag||"@@toStringTag",k="object"===typeof t,O=e.regeneratorRuntime;if(O)return void(k&&(t.exports=O));O=e.regeneratorRuntime=k?t.exports:{},O.wrap=n;var _="suspendedStart",I="suspendedYield",L="executing",N="completed",T={},S={};S[w]=function(){return this};var P=Object.getPrototypeOf,C=P&&P(P(f([])));C&&C!==g&&y.call(C,w)&&(S=C);var j=a.prototype=i.prototype=Object.create(S);o.prototype=j.constructor=a,a.constructor=o,a[x]=o.displayName="GeneratorFunction",O.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===o||"GeneratorFunction"===(e.displayName||e.name))},O.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,x in t||(t[x]="GeneratorFunction")),t.prototype=Object.create(j),t},O.awrap=function(t){return{__await:t}},s(c.prototype),c.prototype[E]=function(){return this},O.AsyncIterator=c,O.async=function(t,e,r,i){var o=new c(n(t,e,r,i));return O.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},s(j),j[x]="Generator",j[w]=function(){return this},j.toString=function(){return"[object Generator]"},O.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},O.values=f,d.prototype={constructor:d,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(m),!t)for(var e in this)"t"===e.charAt(0)&&y.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=v)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,r){return o.type="throw",o.arg=t,n.next=e,r&&(n.method="next",n.arg=v),!!r}if(this.done)throw t;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var a=y.call(i,"catchLoc"),s=y.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,T):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),T},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),m(n),T}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;m(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:f(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=v),T}}}(function(){return this}()||Function("return this")())},function(t,e){},function(t,e){}]);
|
gutenberg/survey/src/.DS_Store
CHANGED
Binary file
|
gutenberg/survey/src/block/block.js
CHANGED
@@ -6,13 +6,12 @@ const { registerBlockType } = wp.blocks;
|
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
-
var dropdownOptions
|
10 |
-
var
|
11 |
-
var
|
12 |
-
var
|
13 |
-
var
|
14 |
-
var
|
15 |
-
var options;
|
16 |
Â
|
17 |
Â
registerBlockType( 'opinion-stage/block-os-survey', {
|
18 |
Â
title: __( 'Survey' ),
|
@@ -21,18 +20,13 @@ var options;
|
|
21 |
Â
keywords: [
|
22 |
Â
__( 'Opinion Stage Survey' ),
|
23 |
Â
__( 'Opinion Stage Survey' ),
|
24 |
-
],
|
25 |
Â
attributes: {
|
26 |
Â
embedUrl: {
|
27 |
Â
source: 'attribute',
|
28 |
Â
attribute: 'data-test-url',
|
29 |
Â
selector: 'div[data-test-url]'
|
30 |
-
},
|
31 |
-
oswpUrlShortcode: {
|
32 |
-
source: 'attribute',
|
33 |
-
attribute: 'data-test-url',
|
34 |
-
selector: 'div[data-test-url]'
|
35 |
-
},
|
36 |
Â
lockEmbed: {
|
37 |
Â
source: 'attribute',
|
38 |
Â
attribute: 'data-lock-embed',
|
@@ -42,173 +36,132 @@ var options;
|
|
42 |
Â
source: 'attribute',
|
43 |
Â
attribute: 'data-button-text',
|
44 |
Â
selector: 'div[data-button-text]'
|
45 |
-
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
46 |
Â
},
|
47 |
Â
edit: function( props ) {
|
48 |
-
|
49 |
-
|
50 |
-
if(val == ''){
|
51 |
-
props.setAttributes({ embedUrl: '' });
|
52 |
-
}else if(val != ''){
|
53 |
-
props.setAttributes({ embedUrl: val });
|
54 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
55 |
-
var getLandingPageUrlOs = function(href) {
|
56 |
-
var locationUrlOS = document.createElement("a");
|
57 |
-
locationUrlOS.href = href;
|
58 |
-
return locationUrlOS;
|
59 |
-
};
|
60 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
61 |
-
var matchValue = locationUrlOS.pathname;
|
62 |
-
if(val == matchValue){
|
63 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
64 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
-
break;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}else{
|
72 |
-
}
|
73 |
-
};
|
74 |
-
const onEmbedButtonClick = event => {
|
75 |
-
if( event.target.value == "Embed" ){
|
76 |
-
if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
|
77 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
-
}else{
|
79 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
-
}
|
82 |
-
}else{
|
83 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
-
}
|
85 |
-
};
|
86 |
-
|
87 |
-
window.verifyOSInsert = function(widget){
|
88 |
-
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
-
var myOpts = document.getElementById('selectID').options;
|
90 |
-
for(var i = 0; i < myOpts.length; i++){
|
91 |
-
if(myOpts[i].value == widget){
|
92 |
-
myOpts[i].defaultSelected = true;
|
93 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
-
break;
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=survey&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
-
const onCreateButtonClick = value => {
|
101 |
-
// Open Create new survey link in new page
|
102 |
-
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
103 |
-
};
|
104 |
-
|
105 |
-
if(!buttonText){
|
106 |
-
props.setAttributes({ buttonText: 'Embed' });
|
107 |
-
}
|
108 |
Â
|
Â
|
|
109 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
110 |
Â
var callback_url = getCallBackUrlOs;
|
111 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
113 |
Â
const onConnectOSWPButtonClick = value => {
|
114 |
-
// Open Connect to opinionstage
|
115 |
Â
window.location.replace(callback_url);
|
116 |
Â
};
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
'Accept':'application/vnd.api+json',
|
126 |
-
'Content-Type':'application/vnd.api+json',
|
127 |
-
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
128 |
-
'OSWP-Client-Token': opinionStageClientToken
|
129 |
-
},
|
130 |
-
})
|
131 |
-
.then(async res => {
|
132 |
-
var data = await res.json();
|
133 |
-
data = data.data;
|
134 |
-
dropdownOptions = data;
|
135 |
-
// force reprinting instead!!
|
136 |
-
props.setAttributes({ buttonText: 'Embed'});
|
137 |
-
props.setAttributes({ buttonText: buttonText});
|
138 |
-
if(buttonText == 'Change' && embedUrl !='Select'){
|
139 |
-
props.setAttributes({ embedUrl: embedUrl });
|
140 |
-
}else{
|
141 |
-
props.setAttributes({ embedUrl: 'Select' });
|
142 |
-
}
|
143 |
-
})
|
144 |
-
.catch(function(err) {
|
145 |
-
console.log('ERROR: ' + err.message);
|
146 |
-
});
|
147 |
-
}
|
148 |
Â
// Checking for Opinion Stage connection
|
149 |
Â
if(osGutenData.isOsConnected == ''){
|
150 |
-
|
151 |
-
$('span#oswpLauncherContentPopupsurvey , #owspLaunchInputCreate').live('click', function(e) {
|
152 |
-
e.preventDefault();
|
153 |
-
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
154 |
-
});
|
155 |
-
});
|
156 |
Â
return (
|
157 |
Â
<div className={ props.className }>
|
158 |
Â
<div className="os-survey-wrapper components-placeholder">
|
159 |
Â
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
160 |
Â
<p className="components-heading">Please connect WordPress to Opinion Stage to start adding surveys</p>
|
161 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
162 |
-
</div>
|
Â
|
|
163 |
Â
</div>
|
164 |
Â
);
|
165 |
-
}else{
|
166 |
-
|
167 |
-
options = [{value:'Select',label:'Select a survey'},{value:'refresh',label:'Refresh'}];
|
168 |
-
OsPolulateList();
|
169 |
-
}else{
|
170 |
-
options = [{value:'Select',label:'Select a survey'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
171 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
172 |
-
options[options.length] = {
|
173 |
-
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
174 |
-
label: dropdownOptions[i].attributes['title'],
|
175 |
-
};
|
176 |
-
var getLandingPageUrlOs = function(href) {
|
177 |
-
var locationUrlOS = document.createElement("a");
|
178 |
-
locationUrlOS.href = href;
|
179 |
-
return locationUrlOS;
|
180 |
-
};
|
181 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
182 |
-
var matchValue = locationUrlOS.pathname;
|
183 |
-
if(embedUrl == matchValue){
|
184 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
185 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
186 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
187 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
188 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
189 |
-
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
190 |
-
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
if(embedUrl == 'refresh'){
|
195 |
-
OsPolulateList();
|
196 |
-
}
|
197 |
-
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
198 |
Â
$(document).ready(function () {
|
Â
|
|
199 |
Â
$('span#oswpLauncherContentPopupsurvey').live('click', function(e) {
|
200 |
Â
e.preventDefault();
|
201 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
202 |
Â
var text = $(this).attr('data-os-block');
|
203 |
Â
$("button#dropbtn span").text(text);
|
204 |
-
var inputs = $(".filter__itm");
|
205 |
Â
for(var i = 0; i < inputs.length; i++){
|
206 |
-
if($(inputs[i]).text() == text){
|
207 |
-
setTimeout(function(){$(inputs[i]).trigger('click');},1000);
|
208 |
Â
setTimeout(function(){
|
209 |
-
|
210 |
-
|
211 |
-
|
Â
|
|
Â
|
|
Â
|
|
212 |
Â
$('button.content__links-itm').live('click', function(e) {
|
213 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
214 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
@@ -218,83 +171,89 @@ var options;
|
|
218 |
Â
else {
|
219 |
Â
$('.progress_message').css('display', 'block');
|
220 |
Â
$('.content__list').css('display', 'none');
|
221 |
-
console.log('test');
|
222 |
Â
}
|
223 |
Â
}
|
224 |
Â
});
|
225 |
Â
});
|
226 |
Â
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
253 |
Â
if(buttonText == 'Embed'){
|
254 |
Â
contentViewEditStatOs
|
255 |
-
}else if(buttonText == 'Change'){
|
256 |
Â
contentViewEditStatOs = (
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
269 |
Â
</div>
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
</div>
|
275 |
-
</div>
|
276 |
-
);
|
277 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
278 |
Â
}
|
279 |
-
}else if(embedUrl == '
|
280 |
Â
contentViewEditStatOs
|
281 |
Â
}else{
|
282 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
283 |
Â
contentViewEditStatOs
|
284 |
Â
}
|
285 |
-
|
286 |
-
|
287 |
-
return (
|
288 |
Â
<div className={ props.className }>
|
289 |
-
{contentViewEditStatOs}
|
Â
|
|
290 |
Â
</div>
|
291 |
Â
);
|
292 |
Â
}
|
293 |
Â
},
|
294 |
-
save: function( {attributes: {embedUrl,
|
295 |
Â
return (
|
296 |
-
<div class="os-survey-wrapper"
|
297 |
-
[os-widget path="{
|
Â
|
|
298 |
Â
</div>
|
299 |
Â
);
|
300 |
Â
},
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
+
var dropdownOptions = false;
|
10 |
+
var insertItemImage = false;
|
11 |
+
var insertItemOsTitle = false;
|
12 |
+
var insertItemOsView = false;
|
13 |
+
var insertItemOsEdit = false;
|
14 |
+
var insertItemOsStatistics = false;
|
Â
|
|
15 |
Â
|
16 |
Â
registerBlockType( 'opinion-stage/block-os-survey', {
|
17 |
Â
title: __( 'Survey' ),
|
20 |
Â
keywords: [
|
21 |
Â
__( 'Opinion Stage Survey' ),
|
22 |
Â
__( 'Opinion Stage Survey' ),
|
23 |
+
],
|
24 |
Â
attributes: {
|
25 |
Â
embedUrl: {
|
26 |
Â
source: 'attribute',
|
27 |
Â
attribute: 'data-test-url',
|
28 |
Â
selector: 'div[data-test-url]'
|
29 |
+
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
30 |
Â
lockEmbed: {
|
31 |
Â
source: 'attribute',
|
32 |
Â
attribute: 'data-lock-embed',
|
36 |
Â
source: 'attribute',
|
37 |
Â
attribute: 'data-button-text',
|
38 |
Â
selector: 'div[data-button-text]'
|
39 |
+
},
|
40 |
+
insertItemImage: {
|
41 |
+
source: 'attribute',
|
42 |
+
attribute: 'data-image-url',
|
43 |
+
selector: 'div[data-image-url]'
|
44 |
+
},
|
45 |
+
insertItemOsTitle: {
|
46 |
+
source: 'attribute',
|
47 |
+
attribute: 'data-title-url',
|
48 |
+
selector: 'div[data-title-url]'
|
49 |
+
},
|
50 |
+
insertItemOsView: {
|
51 |
+
source: 'attribute',
|
52 |
+
attribute: 'data-view-url',
|
53 |
+
selector: 'div[data-view-url]'
|
54 |
+
},
|
55 |
+
insertItemOsEdit: {
|
56 |
+
source: 'attribute',
|
57 |
+
attribute: 'data-edit-url',
|
58 |
+
selector: 'div[data-edit-url]'
|
59 |
+
},
|
60 |
+
insertItemOsStatistics: {
|
61 |
+
source: 'attribute',
|
62 |
+
attribute: 'data-statistics-url',
|
63 |
+
selector: 'div[data-statistics-url]'
|
64 |
+
}
|
65 |
Â
},
|
66 |
Â
edit: function( props ) {
|
67 |
+
// Setting Attributes
|
68 |
+
let {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage,insertItemOsTitle,insertItemOsView,insertItemOsEdit,insertItemOsStatistics}, setAttributes} = props;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
69 |
Â
|
70 |
+
// Fetching Localized variables
|
71 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
72 |
Â
var callback_url = getCallBackUrlOs;
|
73 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
74 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
75 |
+
|
76 |
+
// Select Button Click functionality
|
77 |
+
const onSelectButtonClick = value => {
|
78 |
+
window.verifyOSInsert = function(widget){
|
79 |
+
props.setAttributes({ embedUrl: widget, buttonText:'Change' });
|
80 |
+
|
81 |
+
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
82 |
+
var opinionStageClientToken = osGutenData.OswpClientToken;
|
83 |
+
var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=survey&page=1&per_page=99';
|
84 |
+
fetch(opinionstageFetchDataUrl, {
|
85 |
+
method: "GET",
|
86 |
+
headers: {
|
87 |
+
'Accept':'application/vnd.api+json',
|
88 |
+
'Content-Type':'application/vnd.api+json',
|
89 |
+
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
90 |
+
'OSWP-Client-Token': opinionStageClientToken
|
91 |
+
},
|
92 |
+
})
|
93 |
+
.then(async res => {
|
94 |
+
var data = await res.json();
|
95 |
+
data = data.data;
|
96 |
+
dropdownOptions = data;
|
97 |
+
// force reprinting instead!!
|
98 |
+
props.setAttributes({ buttonText: buttonText});
|
99 |
+
|
100 |
+
})
|
101 |
+
.catch(function(err) {
|
102 |
+
console.log('ERROR: ' + err.message);
|
103 |
+
});
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
// Change Button Click functionality
|
108 |
+
const onChangeButtonClick = value => {
|
109 |
+
props.setAttributes({
|
110 |
+
embedUrl: '',
|
111 |
+
buttonText:'Embed',
|
112 |
+
lockEmbed: false,
|
113 |
+
insertItemImage: false,
|
114 |
+
insertItemOsTitle: false,
|
115 |
+
insertItemOsView: false,
|
116 |
+
insertItemOsEdit: false,
|
117 |
+
insertItemOsStatistics: false
|
118 |
+
});
|
119 |
+
}
|
120 |
+
|
121 |
+
// Connect to Opinionstage Callback Url
|
122 |
Â
const onConnectOSWPButtonClick = value => {
|
Â
|
|
123 |
Â
window.location.replace(callback_url);
|
124 |
Â
};
|
125 |
+
|
126 |
+
// Create New Item Url (survey)
|
127 |
+
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=survey&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
128 |
+
const onCreateButtonClick = value => {
|
129 |
+
// Open Create new survey link in new page
|
130 |
+
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
131 |
+
};
|
132 |
+
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
133 |
Â
// Checking for Opinion Stage connection
|
134 |
Â
if(osGutenData.isOsConnected == ''){
|
135 |
+
// Not Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
136 |
Â
return (
|
137 |
Â
<div className={ props.className }>
|
138 |
Â
<div className="os-survey-wrapper components-placeholder">
|
139 |
Â
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
140 |
Â
<p className="components-heading">Please connect WordPress to Opinion Stage to start adding surveys</p>
|
141 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
142 |
+
</div>
|
143 |
+
<div></div>
|
144 |
Â
</div>
|
145 |
Â
);
|
146 |
+
}else{
|
147 |
+
// Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
148 |
Â
$(document).ready(function () {
|
149 |
+
// Content Popup Launch Working
|
150 |
Â
$('span#oswpLauncherContentPopupsurvey').live('click', function(e) {
|
151 |
Â
e.preventDefault();
|
152 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
153 |
Â
var text = $(this).attr('data-os-block');
|
154 |
Â
$("button#dropbtn span").text(text);
|
155 |
+
var inputs = $(".filter__itm");
|
156 |
Â
for(var i = 0; i < inputs.length; i++){
|
157 |
+
if($(inputs[i]).text() == text){
|
Â
|
|
158 |
Â
setTimeout(function(){
|
159 |
+
$(inputs[i]).trigger('click');
|
160 |
+
},1000);
|
161 |
+
setTimeout(function(){
|
162 |
+
$('.progress_message').css('display', 'none');
|
163 |
+
$('.content__list').css('display', 'block');
|
164 |
+
},2500);
|
165 |
Â
$('button.content__links-itm').live('click', function(e) {
|
166 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
167 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
171 |
Â
else {
|
172 |
Â
$('.progress_message').css('display', 'block');
|
173 |
Â
$('.content__list').css('display', 'none');
|
Â
|
|
174 |
Â
}
|
175 |
Â
}
|
176 |
Â
});
|
177 |
Â
});
|
178 |
Â
|
179 |
+
// Fetching Ajax Call Result
|
180 |
+
if(dropdownOptions != false){
|
181 |
+
for (var i = 0; i < dropdownOptions.length; i++) {
|
182 |
+
var getLandingPageUrlOs = function(href) {
|
183 |
+
var locationUrlOS = document.createElement("a");
|
184 |
+
locationUrlOS.href = href;
|
185 |
+
return locationUrlOS;
|
186 |
+
};
|
187 |
+
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
188 |
+
var matchValue = locationUrlOS.pathname;
|
189 |
+
if(embedUrl == matchValue){
|
190 |
+
props.setAttributes({lockEmbed: true, buttonText: "Change" });
|
191 |
+
props.setAttributes({ insertItemImage : dropdownOptions[i].attributes['image-url'] });
|
192 |
+
props.setAttributes({ insertItemOsTitle : dropdownOptions[i].attributes['title'] });
|
193 |
+
props.setAttributes({ insertItemOsView : dropdownOptions[i].attributes['landing-page-url'] });
|
194 |
+
props.setAttributes({ insertItemOsEdit : dropdownOptions[i].attributes['edit-url'] });
|
195 |
+
props.setAttributes({ insertItemOsStatistics : dropdownOptions[i].attributes['stats-url'] });
|
196 |
+
break;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
// Content On Editor
|
202 |
+
var contentViewEditStatOs = (
|
203 |
+
<div className="os-survey-wrapper components-placeholder">
|
204 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
205 |
+
<span id="oswpLauncherContentPopupsurvey" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="survey" onClick={onSelectButtonClick} >Select a Survey</span>
|
206 |
+
<input type="button" value="Create a New survey" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
207 |
+
<span></span>
|
208 |
+
</div>
|
209 |
+
);
|
210 |
+
|
211 |
+
if(embedUrl != '' && embedUrl){
|
212 |
Â
if(buttonText == 'Embed'){
|
213 |
Â
contentViewEditStatOs
|
214 |
+
}else if(buttonText == 'Change'){
|
215 |
Â
contentViewEditStatOs = (
|
216 |
+
<div className="os-survey-wrapper components-placeholder">
|
217 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
218 |
+
<div className="components-preview__block" >
|
219 |
+
<div className="components-preview__leftBlockImage">
|
220 |
+
<img src={insertItemImage} alt={insertItemOsTitle} className="image" />
|
221 |
+
<div className="overlay">
|
222 |
+
<div className="text">
|
223 |
+
<a href={insertItemOsView} target="_blank"> View </a>
|
224 |
+
<a href={insertItemOsEdit} target="_blank"> Edit </a>
|
225 |
+
<a href={insertItemOsStatistics} target="_blank"> Statistics </a>
|
226 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onChangeButtonClick}/>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
<div className="components-preview__rightBlockContent">
|
231 |
+
<div className="components-placeholder__label">Survey: {insertItemOsTitle}</div>
|
232 |
Â
</div>
|
233 |
+
</div>
|
234 |
+
<span></span>
|
235 |
+
</div>
|
236 |
+
);
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
237 |
Â
}
|
238 |
+
}else if(embedUrl == '' || jQuery.type(embedUrl) === "undefined"){
|
239 |
Â
contentViewEditStatOs
|
240 |
Â
}else{
|
241 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
242 |
Â
contentViewEditStatOs
|
243 |
Â
}
|
244 |
+
return (
|
Â
|
|
Â
|
|
245 |
Â
<div className={ props.className }>
|
246 |
+
{contentViewEditStatOs}
|
247 |
+
<span></span>
|
248 |
Â
</div>
|
249 |
Â
);
|
250 |
Â
}
|
251 |
Â
},
|
252 |
+
save: function( {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage, insertItemOsTitle, insertItemOsView, insertItemOsEdit, insertItemOsStatistics }} ) {
|
253 |
Â
return (
|
254 |
+
<div class="os-survey-wrapper" data-type="survey" data-image-url={insertItemImage} data-title-url={insertItemOsTitle} data-view-url={insertItemOsView} data-statistics-url={insertItemOsStatistics} data-edit-url={insertItemOsEdit} data-test-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
255 |
+
[os-widget path="{embedUrl}"]
|
256 |
+
<span></span>
|
257 |
Â
</div>
|
258 |
Â
);
|
259 |
Â
},
|
gutenberg/trivia/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(o,a){try{var i=t[o](a),s=i.value}catch(e){return void n(e)}if(!i.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}return r("next")})}}var o,a,i,s,c,l,u=n(2),p=n.n(u),m=n(5),f=(n.n(m),n(6)),d=(n.n(f),wp.i18n.__),h=wp.blocks.registerBlockType,v=wp.components,g=v.SelectControl,b=(v.TextControl,wp.editor.RichText,!1);h("opinion-stage/block-os-trivia",{title:d("Trivia Quiz"),icon:"yes",category:"opinion-stage",keywords:[d("Opinion Stage Trivia Quiz"),d("Opinion Stage Trivia Quiz Insert")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},oswpUrlShortcode:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"}},edit:function(e){function t(){var t=this,n=osGutenData.OswpPluginVersion,o=osGutenData.OswpClientToken,a=osGutenData.OswpFetchDataUrl+"?type=trivia&page=1&per_page=99";fetch(a,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":n,"OSWP-Client-Token":o}}).then(function(){var n=r(p.a.mark(function n(r){var o;return p.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:o=t.sent,o=o.data,b=o,e.setAttributes({buttonText:"Embed"}),e.setAttributes({buttonText:m}),"Change"==m&&"Select"!=u?e.setAttributes({embedUrl:u}):e.setAttributes({embedUrl:"Select"});case 8:case"end":return t.stop()}},n,t)}));return function(e){return n.apply(this,arguments)}}()).catch(function(e){console.log("ERROR: "+e.message)})}var n=e.attributes,u=n.embedUrl,m=(n.oswpUrlShortcode,n.lockEmbed,n.buttonText),f=(e.setAttributes,function(t){if(""==t)e.setAttributes({embedUrl:""});else if(""!=t){e.setAttributes({embedUrl:t});for(var n=0;n<b.length;n++){var r=function(e){var t=document.createElement("a");return t.href=e,t}(b[n].attributes["landing-page-url"]),l=r.pathname;if(t==l){o=b[n].attributes.title,a=b[n].attributes["image-url"],i=b[n].attributes["landing-page-url"],s=b[n].attributes["edit-url"],c=b[n].attributes["stats-url"];break}}}}),d=function(t){"Embed"==t.target.value?""==u||"Select"==u||"createNew"==u||"refresh"==u?e.setAttributes({lockEmbed:!1,buttonText:"Embed"}):(e.setAttributes({lockEmbed:!0,buttonText:"Change"}),L=wp.element.createElement(g,{id:"selectID",options:l,value:u,onChange:f,className:"components-select-control__input"})):e.setAttributes({lockEmbed:!1,buttonText:"Embed"})};window.verifyOSInsert=function(t){e.setAttributes({oswpUrlShortcode:t});for(var n=document.getElementById("selectID").options,r=0;r<n.length;r++)if(n[r].value==t){n[r].defaultSelected=!0,e.setAttributes({lockEmbed:!0,buttonText:"Change",embedUrl:t});break}};var h=osGutenData.onCreateButtonClickOs+"?w_type=quiz&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",v=function(e){window.open(h,"_blank").focus()};m||e.setAttributes({buttonText:"Embed"});var w=osGutenData.callbackUrlOs,y=w,E=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),k=function(e){window.location.replace(y)};if(""==osGutenData.isOsConnected)return $(document).ready(function(){$("span#oswpLauncherContentPopuptrivia , #owspLaunchInputCreate").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500)})}),wp.element.createElement("div",{className:e.className},wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"}," ",wp.element.createElement("img",{src:E,alt:""})," "),wp.element.createElement("p",{className:"components-heading"},"Please connect Wordpress to Opinion Stage to start adding trivia"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:k},"Connect")));if(0==b)l=[{value:"Select",label:"Select a trivia"},{value:"refresh",label:"Refresh"}],t();else{l=[{value:"Select",label:"Select a trivia"},{value:"refresh",label:"Refresh"},{value:"",label:"-----------------"}];for(var x=0;x<b.length;x++){l[l.length]={value:b[x].attributes["landing-page-url"].replace("https://www.opinionstage.com",""),label:b[x].attributes.title};var _=function(e){var t=document.createElement("a");return t.href=e,t}(b[x].attributes["landing-page-url"]),N=_.pathname;if(u==N){o=b[x].attributes.title,a=b[x].attributes["image-url"],i=b[x].attributes["landing-page-url"],s=b[x].attributes["edit-url"],c=b[x].attributes["stats-url"];var T=b[x].id}}}"refresh"==u&&t();var L=wp.element.createElement(g,{id:"selectID",options:l,value:u,onChange:f,className:"components-select-control__input"});$(document).ready(function(){$("span#oswpLauncherContentPopuptrivia").live("click",function(e){e.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var t=$(this).attr("data-os-block");$("button#dropbtn span").text(t);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==t){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(e){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none"),console.log("test")}})});var O=wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopuptrivia",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"trivia quiz"},"Select a Trivia Quiz"),wp.element.createElement("input",{type:"button",value:"Create a New Trivia Quiz",className:"components-button is-button is-default is-block is-primary",onClick:v}),wp.element.createElement("div",{className:"components-placeholder__fieldset"},L,wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large",id:"clickMe",onClick:d})));return function(e,t,n){var r,o=e.getElementsByTagName(t)[0],a=Math.floor((new Date).getTime()/1e6);e.getElementById(n)||(r=e.createElement(t),r.id=n,r.async=1,r.src="https://www.opinionstage.com/assets/loader.js?"+a,o.parentNode.insertBefore(r,o))}(document,"script","os-widget-jssdk"),T="os-widget-"+T,""!=u&&"Select"!=u&&u?"Embed"==m||"Change"==m&&(O=wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:E,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:a,alt:o,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:i,target:"_blank"}," View "),wp.element.createElement("a",{href:s,target:"_blank"}," Edit "),wp.element.createElement("a",{href:c,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:m,className:"components-button is-button is-default is-large left-align",onClick:d})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Trivia Quiz: ",o)))),L=wp.element.createElement(g,{id:"selectID",options:l,value:u,disabled:!0,onChange:f,className:"components-select-control__input"})):"Select"==u||""==u||"refresh"==u||e.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:e.className},O)},save:function(e){var t=e.attributes,n=(t.embedUrl,t.oswpUrlShortcode),r=t.lockEmbed,o=t.buttonText;return wp.element.createElement("div",{class:"os-trivia-wrapper","data-type":"trivia","data-test-url":n,"data-lock-embed":r,"data-button-text":o},'[os-widget path="',n,'"]')}})},function(e,t,n){e.exports=n(3)},function(e,t,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(4),o)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var a=t&&t.prototype instanceof o?t:o,i=Object.create(a.prototype),s=new f(r||[]);return i._invoke=l(e,n,s),i}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function o(){}function a(){}function i(){}function s(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,o,a,i){var s=r(e[n],e,o);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"===typeof l&&b.call(l,"__await")?Promise.resolve(l.__await).then(function(e){t("next",e,a,i)},function(e){t("throw",e,a,i)}):Promise.resolve(l).then(function(e){c.value=e,a(c)},i)}i(s.arg)}function n(e,n){function r(){return new Promise(function(r,o){t(e,n,r,o)})}return o=o?o.then(r,r):r()}var o;this._invoke=n}function l(e,t,n){var o=N;return function(a,i){if(o===L)throw new Error("Generator is already running");if(o===O){if("throw"===a)throw i;return h()}for(n.method=a,n.arg=i;;){var s=n.delegate;if(s){var c=u(s,n);if(c){if(c===S)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===N)throw o=O,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=L;var l=r(e,t,n);if("normal"===l.type){if(o=n.done?O:T,l.arg===S)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=O,n.method="throw",n.arg=l.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===v){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=v,u(e,t),"throw"===t.method))return S;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return S}var o=r(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,S;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=v),t.delegate=null,S):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,S)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[y];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(b.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=v,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:v,done:!0}}var v,g=Object.prototype,b=g.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",k=w.toStringTag||"@@toStringTag",x="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(x&&(e.exports=_));_=t.regeneratorRuntime=x?e.exports:{},_.wrap=n;var N="suspendedStart",T="suspendedYield",L="executing",O="completed",S={},C={};C[y]=function(){return this};var P=Object.getPrototypeOf,j=P&&P(P(d([])));j&&j!==g&&b.call(j,y)&&(C=j);var A=i.prototype=o.prototype=Object.create(C);a.prototype=A.constructor=i,i.constructor=a,i[k]=a.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===a||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,i):(e.__proto__=i,k in e||(e[k]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},s(c.prototype),c.prototype[E]=function(){return this},_.AsyncIterator=c,_.async=function(e,t,r,o){var a=new c(n(e,t,r,o));return _.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},s(A),A[k]="Generator",A[y]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&b.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=v)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=v),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=b.call(o,"catchLoc"),s=b.call(o,"finallyLoc");if(i&&s){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,S):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),S},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),S}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;m(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=v),S}}}(function(){return this}()||Function("return this")())},function(e,t){},function(e,t){}]);
|
1 |
+
!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});n(1)},function(t,e,n){"use strict";function r(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,n){function r(i,a){try{var o=e[i](a),s=o.value}catch(t){return void n(t)}if(!o.done)return Promise.resolve(s).then(function(t){r("next",t)},function(t){r("throw",t)});t(s)}return r("next")})}}var i=n(2),a=n.n(i),o=n(5),s=(n.n(o),n(6)),c=(n.n(s),wp.i18n.__),l=wp.blocks.registerBlockType,u=wp.components,p=(u.SelectControl,u.TextControl,wp.editor.RichText,!1);l("opinion-stage/block-os-trivia",{title:c("Trivia Quiz"),icon:"yes",category:"opinion-stage",keywords:[c("Opinion Stage Trivia Quiz"),c("Opinion Stage Trivia Quiz Insert")],attributes:{embedUrl:{source:"attribute",attribute:"data-test-url",selector:"div[data-test-url]"},lockEmbed:{source:"attribute",attribute:"data-lock-embed",selector:"div[data-lock-embed]"},buttonText:{source:"attribute",attribute:"data-button-text",selector:"div[data-button-text]"},insertItemImage:{source:"attribute",attribute:"data-image-url",selector:"div[data-image-url]"},insertItemOsTitle:{source:"attribute",attribute:"data-title-url",selector:"div[data-title-url]"},insertItemOsView:{source:"attribute",attribute:"data-view-url",selector:"div[data-view-url]"},insertItemOsEdit:{source:"attribute",attribute:"data-edit-url",selector:"div[data-edit-url]"},insertItemOsStatistics:{source:"attribute",attribute:"data-statistics-url",selector:"div[data-statistics-url]"}},edit:function(t){var e=t.attributes,n=e.embedUrl,i=(e.lockEmbed,e.buttonText),o=e.insertItemImage,s=e.insertItemOsTitle,c=e.insertItemOsView,l=e.insertItemOsEdit,u=e.insertItemOsStatistics,m=(t.setAttributes,osGutenData.callbackUrlOs),d=m,f=(osGutenData.getActionUrlOS,osGutenData.getLogoImageLink),h=function(e){window.verifyOSInsert=function(e){var n=this;t.setAttributes({embedUrl:e,buttonText:"Change"});var o=osGutenData.OswpPluginVersion,s=osGutenData.OswpClientToken,c=osGutenData.OswpFetchDataUrl+"?type=trivia&page=1&per_page=99";fetch(c,{method:"GET",headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json","OSWP-Plugin-Version":o,"OSWP-Client-Token":s}}).then(function(){var e=r(a.a.mark(function e(r){var o;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.json();case 2:o=e.sent,o=o.data,p=o,t.setAttributes({buttonText:i});case 6:case"end":return e.stop()}},e,n)}));return function(t){return e.apply(this,arguments)}}()).catch(function(t){console.log("ERROR: "+t.message)})}},v=function(e){t.setAttributes({embedUrl:"",buttonText:"Embed",lockEmbed:!1,insertItemImage:!1,insertItemOsTitle:!1,insertItemOsView:!1,insertItemOsEdit:!1,insertItemOsStatistics:!1})},g=function(t){window.location.replace(d)},b=osGutenData.onCreateButtonClickOs+"?w_type=quiz&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8",w=function(t){window.open(b,"_blank").focus()};if(""==osGutenData.isOsConnected)return wp.element.createElement("div",{className:t.className},wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("p",{className:"components-heading"},"Please connect WordPress to Opinion Stage to start adding trivia"),wp.element.createElement("button",{className:"components-button is-button is-default is-block is-primary",onClick:g},"Connect")),wp.element.createElement("div",null));if($(document).ready(function(){$("span#oswpLauncherContentPopuptrivia").live("click",function(t){t.preventDefault(),setTimeout(function(){$(".editor-post-save-draft").trigger("click")},500);var e=$(this).attr("data-os-block");$("button#dropbtn span").text(e);for(var n=$(".filter__itm"),r=0;r<n.length;r++){if($(n[r]).text()==e){setTimeout(function(){$(n[r]).trigger("click")},1e3),setTimeout(function(){$(".progress_message").css("display","none"),$(".content__list").css("display","block")},2500),$("button.content__links-itm").live("click",function(t){$(".tingle-modal.opinionstage-content-popup").hide(),$(".tingle-modal.opinionstage-content-popup.tingle-modal--visible").hide()});break}$(".progress_message").css("display","block"),$(".content__list").css("display","none")}})}),0!=p)for(var y=0;y<p.length;y++){var E=function(t){var e=document.createElement("a");return e.href=t,e}(p[y].attributes["landing-page-url"]),x=E.pathname;if(n==x){t.setAttributes({lockEmbed:!0,buttonText:"Change"}),t.setAttributes({insertItemImage:p[y].attributes["image-url"]}),t.setAttributes({insertItemOsTitle:p[y].attributes.title}),t.setAttributes({insertItemOsView:p[y].attributes["landing-page-url"]}),t.setAttributes({insertItemOsEdit:p[y].attributes["edit-url"]}),t.setAttributes({insertItemOsStatistics:p[y].attributes["stats-url"]});break}}var k=wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("span",{id:"oswpLauncherContentPopuptrivia",className:"components-button is-button is-default is-block is-primary","data-opinionstage-content-launch":!0,"data-os-block":"trivia quiz",onClick:h},"Select a Trivia Quiz"),wp.element.createElement("input",{type:"button",value:"Create a New Trivia Quiz",className:"components-button is-button is-default is-block is-primary",onClick:w}),wp.element.createElement("span",null));return""!=n&&n?"Embed"==i||"Change"==i&&(k=wp.element.createElement("div",{className:"os-trivia-wrapper components-placeholder"},wp.element.createElement("p",{className:"components-heading"},wp.element.createElement("img",{src:f,alt:""})),wp.element.createElement("div",{className:"components-preview__block"},wp.element.createElement("div",{className:"components-preview__leftBlockImage"},wp.element.createElement("img",{src:o,alt:s,className:"image"}),wp.element.createElement("div",{className:"overlay"},wp.element.createElement("div",{className:"text"},wp.element.createElement("a",{href:c,target:"_blank"}," View "),wp.element.createElement("a",{href:l,target:"_blank"}," Edit "),wp.element.createElement("a",{href:u,target:"_blank"}," Statistics "),wp.element.createElement("input",{type:"button",value:i,className:"components-button is-button is-default is-large left-align",onClick:v})))),wp.element.createElement("div",{className:"components-preview__rightBlockContent"},wp.element.createElement("div",{className:"components-placeholder__label"},"Trivia Quiz: ",s))),wp.element.createElement("span",null))):""==n||"undefined"===jQuery.type(n)||t.setAttributes({buttonText:"Embed"}),wp.element.createElement("div",{className:t.className},k,wp.element.createElement("span",null))},save:function(t){var e=t.attributes,n=e.embedUrl,r=e.lockEmbed,i=e.buttonText,a=e.insertItemImage,o=e.insertItemOsTitle,s=e.insertItemOsView,c=e.insertItemOsEdit,l=e.insertItemOsStatistics;return wp.element.createElement("div",{class:"os-trivia-wrapper","data-type":"trivia","data-image-url":a,"data-title-url":o,"data-view-url":s,"data-statistics-url":l,"data-edit-url":c,"data-test-url":n,"data-lock-embed":r,"data-button-text":i},'[os-widget path="',n,'"]',wp.element.createElement("span",null))}})},function(t,e,n){t.exports=n(3)},function(t,e,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,a=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,t.exports=n(4),i)r.regeneratorRuntime=a;else try{delete r.regeneratorRuntime}catch(t){r.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";function n(t,e,n,r){var a=e&&e.prototype instanceof i?e:i,o=Object.create(a.prototype),s=new d(r||[]);return o._invoke=l(t,n,s),o}function r(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function i(){}function a(){}function o(){}function s(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function c(t){function e(n,i,a,o){var s=r(t[n],t,i);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"===typeof l&&b.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,a,o)},function(t){e("throw",t,a,o)}):Promise.resolve(l).then(function(t){c.value=t,a(c)},o)}o(s.arg)}function n(t,n){function r(){return new Promise(function(r,i){e(t,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function l(t,e,n){var i=_;return function(a,o){if(i===T)throw new Error("Generator is already running");if(i===L){if("throw"===a)throw o;return h()}for(n.method=a,n.arg=o;;){var s=n.delegate;if(s){var c=u(s,n);if(c){if(c===N)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===_)throw i=L,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=T;var l=r(t,e,n);if("normal"===l.type){if(i=n.done?L:I,l.arg===N)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=L,n.method="throw",n.arg=l.arg)}}}function u(t,e){var n=t.iterator[e.method];if(n===v){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=v,u(t,e),"throw"===e.method))return N;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return N}var i=r(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,N;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=v),e.delegate=null,N):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,N)}function p(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function m(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function d(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(p,this),this.reset(!0)}function f(t){if(t){var e=t[y];if(e)return e.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(b.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=v,e.done=!0,e};return r.next=r}}return{next:h}}function h(){return{value:v,done:!0}}var v,g=Object.prototype,b=g.hasOwnProperty,w="function"===typeof Symbol?Symbol:{},y=w.iterator||"@@iterator",E=w.asyncIterator||"@@asyncIterator",x=w.toStringTag||"@@toStringTag",k="object"===typeof t,O=e.regeneratorRuntime;if(O)return void(k&&(t.exports=O));O=e.regeneratorRuntime=k?t.exports:{},O.wrap=n;var _="suspendedStart",I="suspendedYield",T="executing",L="completed",N={},P={};P[y]=function(){return this};var S=Object.getPrototypeOf,C=S&&S(S(f([])));C&&C!==g&&b.call(C,y)&&(P=C);var j=o.prototype=i.prototype=Object.create(P);a.prototype=j.constructor=o,o.constructor=a,o[x]=a.displayName="GeneratorFunction",O.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===a||"GeneratorFunction"===(e.displayName||e.name))},O.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,o):(t.__proto__=o,x in t||(t[x]="GeneratorFunction")),t.prototype=Object.create(j),t},O.awrap=function(t){return{__await:t}},s(c.prototype),c.prototype[E]=function(){return this},O.AsyncIterator=c,O.async=function(t,e,r,i){var a=new c(n(t,e,r,i));return O.isGeneratorFunction(e)?a:a.next().then(function(t){return t.done?t.value:a.next()})},s(j),j[x]="Generator",j[y]=function(){return this},j.toString=function(){return"[object Generator]"},O.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},O.values=f,d.prototype={constructor:d,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(m),!t)for(var e in this)"t"===e.charAt(0)&&b.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=v)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,r){return a.type="throw",a.arg=t,n.next=e,r&&(n.method="next",n.arg=v),!!r}if(this.done)throw t;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var o=b.call(i,"catchLoc"),s=b.call(i,"finallyLoc");if(o&&s){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&b.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,N):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),N},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),m(n),N}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;m(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:f(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=v),N}}}(function(){return this}()||Function("return this")())},function(t,e){},function(t,e){}]);
|
gutenberg/trivia/src/.DS_Store
CHANGED
Binary file
|
gutenberg/trivia/src/block/block.js
CHANGED
@@ -6,13 +6,12 @@ const { registerBlockType } = wp.blocks;
|
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
-
var dropdownOptions
|
10 |
-
var
|
11 |
-
var
|
12 |
-
var
|
13 |
-
var
|
14 |
-
var
|
15 |
-
var options;
|
16 |
Â
|
17 |
Â
registerBlockType( 'opinion-stage/block-os-trivia', {
|
18 |
Â
title: __( 'Trivia Quiz' ),
|
@@ -21,18 +20,13 @@ var options;
|
|
21 |
Â
keywords: [
|
22 |
Â
__( 'Opinion Stage Trivia Quiz' ),
|
23 |
Â
__( 'Opinion Stage Trivia Quiz Insert' ),
|
24 |
-
],
|
25 |
Â
attributes: {
|
26 |
Â
embedUrl: {
|
27 |
Â
source: 'attribute',
|
28 |
Â
attribute: 'data-test-url',
|
29 |
Â
selector: 'div[data-test-url]'
|
30 |
-
},
|
31 |
-
oswpUrlShortcode: {
|
32 |
-
source: 'attribute',
|
33 |
-
attribute: 'data-test-url',
|
34 |
-
selector: 'div[data-test-url]'
|
35 |
-
},
|
36 |
Â
lockEmbed: {
|
37 |
Â
source: 'attribute',
|
38 |
Â
attribute: 'data-lock-embed',
|
@@ -42,173 +36,132 @@ var options;
|
|
42 |
Â
source: 'attribute',
|
43 |
Â
attribute: 'data-button-text',
|
44 |
Â
selector: 'div[data-button-text]'
|
45 |
-
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
46 |
Â
},
|
47 |
Â
edit: function( props ) {
|
48 |
-
|
49 |
-
|
50 |
-
if(val == ''){
|
51 |
-
props.setAttributes({ embedUrl: '' });
|
52 |
-
}else if(val != ''){
|
53 |
-
props.setAttributes({ embedUrl: val });
|
54 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
55 |
-
var getLandingPageUrlOs = function(href) {
|
56 |
-
var locationUrlOS = document.createElement("a");
|
57 |
-
locationUrlOS.href = href;
|
58 |
-
return locationUrlOS;
|
59 |
-
};
|
60 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
61 |
-
var matchValue = locationUrlOS.pathname;
|
62 |
-
if(val == matchValue){
|
63 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
64 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
65 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
66 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
67 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
68 |
-
break;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}else{
|
72 |
-
}
|
73 |
-
};
|
74 |
-
const onEmbedButtonClick = event => {
|
75 |
-
if( event.target.value == "Embed" ){
|
76 |
-
if(embedUrl == '' || embedUrl == 'Select' || embedUrl == 'createNew' || embedUrl == 'refresh'){
|
77 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
78 |
-
}else{
|
79 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change" });
|
80 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
81 |
-
}
|
82 |
-
}else{
|
83 |
-
props.setAttributes({ lockEmbed: false, buttonText: "Embed" });
|
84 |
-
}
|
85 |
-
};
|
86 |
-
|
87 |
-
window.verifyOSInsert = function(widget){
|
88 |
-
props.setAttributes({ oswpUrlShortcode: widget });
|
89 |
-
var myOpts = document.getElementById('selectID').options;
|
90 |
-
for(var i = 0; i < myOpts.length; i++){
|
91 |
-
if(myOpts[i].value == widget){
|
92 |
-
myOpts[i].defaultSelected = true;
|
93 |
-
props.setAttributes({ lockEmbed: true, buttonText: "Change", embedUrl: widget });
|
94 |
-
break;
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=quiz&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
100 |
-
const onCreateButtonClick = value => {
|
101 |
-
// Open Create new trivia link in new page
|
102 |
-
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
103 |
-
};
|
104 |
-
|
105 |
-
if(!buttonText){
|
106 |
-
props.setAttributes({ buttonText: 'Embed' });
|
107 |
-
}
|
108 |
Â
|
Â
|
|
109 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
110 |
Â
var callback_url = getCallBackUrlOs;
|
111 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
112 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
113 |
Â
const onConnectOSWPButtonClick = value => {
|
114 |
-
// Open Connect to opinionstage
|
115 |
Â
window.location.replace(callback_url);
|
116 |
Â
};
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
'Accept':'application/vnd.api+json',
|
126 |
-
'Content-Type':'application/vnd.api+json',
|
127 |
-
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
128 |
-
'OSWP-Client-Token': opinionStageClientToken
|
129 |
-
},
|
130 |
-
})
|
131 |
-
.then(async res => {
|
132 |
-
var data = await res.json();
|
133 |
-
data = data.data;
|
134 |
-
dropdownOptions = data;
|
135 |
-
// force reprinting instead!!
|
136 |
-
props.setAttributes({ buttonText: 'Embed'});
|
137 |
-
props.setAttributes({ buttonText: buttonText});
|
138 |
-
if(buttonText == 'Change' && embedUrl !='Select'){
|
139 |
-
props.setAttributes({ embedUrl: embedUrl });
|
140 |
-
}else{
|
141 |
-
props.setAttributes({ embedUrl: 'Select' });
|
142 |
-
}
|
143 |
-
})
|
144 |
-
.catch(function(err) {
|
145 |
-
console.log('ERROR: ' + err.message);
|
146 |
-
});
|
147 |
-
}
|
148 |
Â
// Checking for Opinion Stage connection
|
149 |
Â
if(osGutenData.isOsConnected == ''){
|
150 |
-
|
151 |
-
$('span#oswpLauncherContentPopuptrivia , #owspLaunchInputCreate').live('click', function(e) {
|
152 |
-
e.preventDefault();
|
153 |
-
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
154 |
-
});
|
155 |
-
});
|
156 |
Â
return (
|
157 |
Â
<div className={ props.className }>
|
158 |
Â
<div className="os-trivia-wrapper components-placeholder">
|
159 |
-
<p className="components-heading"
|
160 |
-
<p className="components-heading">Please connect
|
161 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
162 |
-
</div>
|
Â
|
|
163 |
Â
</div>
|
164 |
Â
);
|
165 |
-
}else{
|
166 |
-
|
167 |
-
options = [{value:'Select',label:'Select a trivia'},{value:'refresh',label:'Refresh'}];
|
168 |
-
OsPolulateList();
|
169 |
-
}else{
|
170 |
-
options = [{value:'Select',label:'Select a trivia'},{value:'refresh',label:'Refresh'},{value:'',label:'-----------------'}];
|
171 |
-
for (var i = 0; i < dropdownOptions.length; i++) {
|
172 |
-
options[options.length] = {
|
173 |
-
value: dropdownOptions[i].attributes['landing-page-url'].replace('https://www.opinionstage.com',''),
|
174 |
-
label: dropdownOptions[i].attributes['title'],
|
175 |
-
};
|
176 |
-
var getLandingPageUrlOs = function(href) {
|
177 |
-
var locationUrlOS = document.createElement("a");
|
178 |
-
locationUrlOS.href = href;
|
179 |
-
return locationUrlOS;
|
180 |
-
};
|
181 |
-
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
182 |
-
var matchValue = locationUrlOS.pathname;
|
183 |
-
if(embedUrl == matchValue){
|
184 |
-
previewBlockOsTitle = dropdownOptions[i].attributes['title'];
|
185 |
-
previewBlockOsImageUrl = dropdownOptions[i].attributes['image-url'];
|
186 |
-
previewBlockOsView = dropdownOptions[i].attributes['landing-page-url'];
|
187 |
-
previewBlockOsEdit = dropdownOptions[i].attributes['edit-url'];
|
188 |
-
previewBlockOsStatistics = dropdownOptions[i].attributes['stats-url'];
|
189 |
-
var previewBlockOsWidgetID = dropdownOptions[i].id;
|
190 |
-
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
if(embedUrl == 'refresh'){
|
195 |
-
OsPolulateList();
|
196 |
-
}
|
197 |
-
var contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} onChange={onDropdownChange} className="components-select-control__input" />);
|
198 |
Â
$(document).ready(function () {
|
Â
|
|
199 |
Â
$('span#oswpLauncherContentPopuptrivia').live('click', function(e) {
|
200 |
Â
e.preventDefault();
|
201 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
202 |
Â
var text = $(this).attr('data-os-block');
|
203 |
Â
$("button#dropbtn span").text(text);
|
204 |
-
var inputs = $(".filter__itm");
|
205 |
Â
for(var i = 0; i < inputs.length; i++){
|
206 |
-
if($(inputs[i]).text() == text){
|
207 |
-
setTimeout(function(){$(inputs[i]).trigger('click');},1000);
|
208 |
Â
setTimeout(function(){
|
209 |
-
|
210 |
-
|
211 |
-
|
Â
|
|
Â
|
|
Â
|
|
212 |
Â
$('button.content__links-itm').live('click', function(e) {
|
213 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
214 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
@@ -218,83 +171,89 @@ var options;
|
|
218 |
Â
else {
|
219 |
Â
$('.progress_message').css('display', 'block');
|
220 |
Â
$('.content__list').css('display', 'none');
|
221 |
-
console.log('test');
|
222 |
Â
}
|
223 |
Â
}
|
224 |
Â
});
|
225 |
Â
});
|
226 |
Â
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
253 |
Â
if(buttonText == 'Embed'){
|
254 |
Â
contentViewEditStatOs
|
255 |
-
}else if(buttonText == 'Change'){
|
256 |
Â
contentViewEditStatOs = (
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
269 |
Â
</div>
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
</div>
|
275 |
-
</div>
|
276 |
-
);
|
277 |
-
contentDropdown = (<SelectControl id="selectID" options={options} value={embedUrl} disabled onChange={onDropdownChange} className="components-select-control__input" />);
|
278 |
Â
}
|
279 |
-
}else if(embedUrl == '
|
280 |
Â
contentViewEditStatOs
|
281 |
Â
}else{
|
282 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
283 |
Â
contentViewEditStatOs
|
284 |
Â
}
|
285 |
-
|
286 |
-
|
287 |
-
return (
|
288 |
Â
<div className={ props.className }>
|
289 |
-
{contentViewEditStatOs}
|
Â
|
|
290 |
Â
</div>
|
291 |
Â
);
|
292 |
Â
}
|
293 |
Â
},
|
294 |
-
save: function( {attributes: {embedUrl,
|
295 |
Â
return (
|
296 |
-
<div class="os-trivia-wrapper"
|
297 |
-
[os-widget path="{
|
Â
|
|
298 |
Â
</div>
|
299 |
Â
);
|
300 |
Â
},
|
6 |
Â
const { SelectControl, TextControl } = wp.components;
|
7 |
Â
const { RichText } = wp.editor ;
|
8 |
Â
|
9 |
+
var dropdownOptions = false;
|
10 |
+
var insertItemImage = false;
|
11 |
+
var insertItemOsTitle = false;
|
12 |
+
var insertItemOsView = false;
|
13 |
+
var insertItemOsEdit = false;
|
14 |
+
var insertItemOsStatistics = false;
|
Â
|
|
15 |
Â
|
16 |
Â
registerBlockType( 'opinion-stage/block-os-trivia', {
|
17 |
Â
title: __( 'Trivia Quiz' ),
|
20 |
Â
keywords: [
|
21 |
Â
__( 'Opinion Stage Trivia Quiz' ),
|
22 |
Â
__( 'Opinion Stage Trivia Quiz Insert' ),
|
23 |
+
],
|
24 |
Â
attributes: {
|
25 |
Â
embedUrl: {
|
26 |
Â
source: 'attribute',
|
27 |
Â
attribute: 'data-test-url',
|
28 |
Â
selector: 'div[data-test-url]'
|
29 |
+
},
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
30 |
Â
lockEmbed: {
|
31 |
Â
source: 'attribute',
|
32 |
Â
attribute: 'data-lock-embed',
|
36 |
Â
source: 'attribute',
|
37 |
Â
attribute: 'data-button-text',
|
38 |
Â
selector: 'div[data-button-text]'
|
39 |
+
},
|
40 |
+
insertItemImage: {
|
41 |
+
source: 'attribute',
|
42 |
+
attribute: 'data-image-url',
|
43 |
+
selector: 'div[data-image-url]'
|
44 |
+
},
|
45 |
+
insertItemOsTitle: {
|
46 |
+
source: 'attribute',
|
47 |
+
attribute: 'data-title-url',
|
48 |
+
selector: 'div[data-title-url]'
|
49 |
+
},
|
50 |
+
insertItemOsView: {
|
51 |
+
source: 'attribute',
|
52 |
+
attribute: 'data-view-url',
|
53 |
+
selector: 'div[data-view-url]'
|
54 |
+
},
|
55 |
+
insertItemOsEdit: {
|
56 |
+
source: 'attribute',
|
57 |
+
attribute: 'data-edit-url',
|
58 |
+
selector: 'div[data-edit-url]'
|
59 |
+
},
|
60 |
+
insertItemOsStatistics: {
|
61 |
+
source: 'attribute',
|
62 |
+
attribute: 'data-statistics-url',
|
63 |
+
selector: 'div[data-statistics-url]'
|
64 |
+
}
|
65 |
Â
},
|
66 |
Â
edit: function( props ) {
|
67 |
+
// Setting Attributes
|
68 |
+
let {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage,insertItemOsTitle,insertItemOsView,insertItemOsEdit,insertItemOsStatistics}, setAttributes} = props;
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
69 |
Â
|
70 |
+
// Fetching Localized variables
|
71 |
Â
var getCallBackUrlOs = osGutenData.callbackUrlOs;
|
72 |
Â
var callback_url = getCallBackUrlOs;
|
73 |
Â
var formActionUrlOS = osGutenData.getActionUrlOS;
|
74 |
Â
var getlogoImageLinkOs = osGutenData.getLogoImageLink;
|
75 |
+
|
76 |
+
// Select Button Click functionality
|
77 |
+
const onSelectButtonClick = value => {
|
78 |
+
window.verifyOSInsert = function(widget){
|
79 |
+
props.setAttributes({ embedUrl: widget, buttonText:'Change' });
|
80 |
+
|
81 |
+
var opinionStageWidgetVersion = osGutenData.OswpPluginVersion;
|
82 |
+
var opinionStageClientToken = osGutenData.OswpClientToken;
|
83 |
+
var opinionstageFetchDataUrl = osGutenData.OswpFetchDataUrl+'?type=trivia&page=1&per_page=99';
|
84 |
+
fetch(opinionstageFetchDataUrl, {
|
85 |
+
method: "GET",
|
86 |
+
headers: {
|
87 |
+
'Accept':'application/vnd.api+json',
|
88 |
+
'Content-Type':'application/vnd.api+json',
|
89 |
+
'OSWP-Plugin-Version':opinionStageWidgetVersion,
|
90 |
+
'OSWP-Client-Token': opinionStageClientToken
|
91 |
+
},
|
92 |
+
})
|
93 |
+
.then(async res => {
|
94 |
+
var data = await res.json();
|
95 |
+
data = data.data;
|
96 |
+
dropdownOptions = data;
|
97 |
+
// force reprinting instead!!
|
98 |
+
props.setAttributes({ buttonText: buttonText});
|
99 |
+
|
100 |
+
})
|
101 |
+
.catch(function(err) {
|
102 |
+
console.log('ERROR: ' + err.message);
|
103 |
+
});
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
// Change Button Click functionality
|
108 |
+
const onChangeButtonClick = value => {
|
109 |
+
props.setAttributes({
|
110 |
+
embedUrl: '',
|
111 |
+
buttonText:'Embed',
|
112 |
+
lockEmbed: false,
|
113 |
+
insertItemImage: false,
|
114 |
+
insertItemOsTitle: false,
|
115 |
+
insertItemOsView: false,
|
116 |
+
insertItemOsEdit: false,
|
117 |
+
insertItemOsStatistics: false
|
118 |
+
});
|
119 |
+
}
|
120 |
+
|
121 |
+
// Connect to Opinionstage Callback Url
|
122 |
Â
const onConnectOSWPButtonClick = value => {
|
Â
|
|
123 |
Â
window.location.replace(callback_url);
|
124 |
Â
};
|
125 |
+
|
126 |
+
// Create New Item Url (trivia)
|
127 |
+
var getOsCreateButtonClickUrl = osGutenData.onCreateButtonClickOs+'?w_type=quiz&utm_source=wordpress&utm_campaign=WPMainPI&utm_medium=link&o=wp35e8';
|
128 |
+
const onCreateButtonClick = value => {
|
129 |
+
// Open Create new trivia link in new page
|
130 |
+
window.open(getOsCreateButtonClickUrl, '_blank').focus();
|
131 |
+
};
|
132 |
+
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
133 |
Â
// Checking for Opinion Stage connection
|
134 |
Â
if(osGutenData.isOsConnected == ''){
|
135 |
+
// Not Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
136 |
Â
return (
|
137 |
Â
<div className={ props.className }>
|
138 |
Â
<div className="os-trivia-wrapper components-placeholder">
|
139 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
140 |
+
<p className="components-heading">Please connect WordPress to Opinion Stage to start adding trivia</p>
|
141 |
Â
<button className="components-button is-button is-default is-block is-primary" onClick={onConnectOSWPButtonClick}>Connect</button>
|
142 |
+
</div>
|
143 |
+
<div></div>
|
144 |
Â
</div>
|
145 |
Â
);
|
146 |
+
}else{
|
147 |
+
// Connected to opinionstage
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
148 |
Â
$(document).ready(function () {
|
149 |
+
// Content Popup Launch Working
|
150 |
Â
$('span#oswpLauncherContentPopuptrivia').live('click', function(e) {
|
151 |
Â
e.preventDefault();
|
152 |
Â
setTimeout(function(){$('.editor-post-save-draft').trigger('click');},500);
|
153 |
Â
var text = $(this).attr('data-os-block');
|
154 |
Â
$("button#dropbtn span").text(text);
|
155 |
+
var inputs = $(".filter__itm");
|
156 |
Â
for(var i = 0; i < inputs.length; i++){
|
157 |
+
if($(inputs[i]).text() == text){
|
Â
|
|
158 |
Â
setTimeout(function(){
|
159 |
+
$(inputs[i]).trigger('click');
|
160 |
+
},1000);
|
161 |
+
setTimeout(function(){
|
162 |
+
$('.progress_message').css('display', 'none');
|
163 |
+
$('.content__list').css('display', 'block');
|
164 |
+
},2500);
|
165 |
Â
$('button.content__links-itm').live('click', function(e) {
|
166 |
Â
$('.tingle-modal.opinionstage-content-popup').hide();
|
167 |
Â
$('.tingle-modal.opinionstage-content-popup.tingle-modal--visible').hide();
|
171 |
Â
else {
|
172 |
Â
$('.progress_message').css('display', 'block');
|
173 |
Â
$('.content__list').css('display', 'none');
|
Â
|
|
174 |
Â
}
|
175 |
Â
}
|
176 |
Â
});
|
177 |
Â
});
|
178 |
Â
|
179 |
+
// Fetching Ajax Call Result
|
180 |
+
if(dropdownOptions != false){
|
181 |
+
for (var i = 0; i < dropdownOptions.length; i++) {
|
182 |
+
var getLandingPageUrlOs = function(href) {
|
183 |
+
var locationUrlOS = document.createElement("a");
|
184 |
+
locationUrlOS.href = href;
|
185 |
+
return locationUrlOS;
|
186 |
+
};
|
187 |
+
var locationUrlOS = getLandingPageUrlOs(dropdownOptions[i].attributes['landing-page-url']);
|
188 |
+
var matchValue = locationUrlOS.pathname;
|
189 |
+
if(embedUrl == matchValue){
|
190 |
+
props.setAttributes({lockEmbed: true, buttonText: "Change" });
|
191 |
+
props.setAttributes({ insertItemImage : dropdownOptions[i].attributes['image-url'] });
|
192 |
+
props.setAttributes({ insertItemOsTitle : dropdownOptions[i].attributes['title'] });
|
193 |
+
props.setAttributes({ insertItemOsView : dropdownOptions[i].attributes['landing-page-url'] });
|
194 |
+
props.setAttributes({ insertItemOsEdit : dropdownOptions[i].attributes['edit-url'] });
|
195 |
+
props.setAttributes({ insertItemOsStatistics : dropdownOptions[i].attributes['stats-url'] });
|
196 |
+
break;
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
// Content On Editor
|
202 |
+
var contentViewEditStatOs = (
|
203 |
+
<div className="os-trivia-wrapper components-placeholder">
|
204 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
205 |
+
<span id="oswpLauncherContentPopuptrivia" className="components-button is-button is-default is-block is-primary" data-opinionstage-content-launch data-os-block="trivia quiz" onClick={onSelectButtonClick} >Select a Trivia Quiz</span>
|
206 |
+
<input type="button" value="Create a New Trivia Quiz" className="components-button is-button is-default is-block is-primary" onClick={onCreateButtonClick} />
|
207 |
+
<span></span>
|
208 |
+
</div>
|
209 |
+
);
|
210 |
+
|
211 |
+
if(embedUrl != '' && embedUrl){
|
212 |
Â
if(buttonText == 'Embed'){
|
213 |
Â
contentViewEditStatOs
|
214 |
+
}else if(buttonText == 'Change'){
|
215 |
Â
contentViewEditStatOs = (
|
216 |
+
<div className="os-trivia-wrapper components-placeholder">
|
217 |
+
<p className="components-heading"><img src={getlogoImageLinkOs} alt=""/></p>
|
218 |
+
<div className="components-preview__block" >
|
219 |
+
<div className="components-preview__leftBlockImage">
|
220 |
+
<img src={insertItemImage} alt={insertItemOsTitle} className="image" />
|
221 |
+
<div className="overlay">
|
222 |
+
<div className="text">
|
223 |
+
<a href={insertItemOsView} target="_blank"> View </a>
|
224 |
+
<a href={insertItemOsEdit} target="_blank"> Edit </a>
|
225 |
+
<a href={insertItemOsStatistics} target="_blank"> Statistics </a>
|
226 |
+
<input type="button" value={buttonText} className="components-button is-button is-default is-large left-align" onClick={onChangeButtonClick}/>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
<div className="components-preview__rightBlockContent">
|
231 |
+
<div className="components-placeholder__label">Trivia Quiz: {insertItemOsTitle}</div>
|
232 |
Â
</div>
|
233 |
+
</div>
|
234 |
+
<span></span>
|
235 |
+
</div>
|
236 |
+
);
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
237 |
Â
}
|
238 |
+
}else if(embedUrl == '' || jQuery.type(embedUrl) === "undefined"){
|
239 |
Â
contentViewEditStatOs
|
240 |
Â
}else{
|
241 |
Â
props.setAttributes({ buttonText: 'Embed'});
|
242 |
Â
contentViewEditStatOs
|
243 |
Â
}
|
244 |
+
return (
|
Â
|
|
Â
|
|
245 |
Â
<div className={ props.className }>
|
246 |
+
{contentViewEditStatOs}
|
247 |
+
<span></span>
|
248 |
Â
</div>
|
249 |
Â
);
|
250 |
Â
}
|
251 |
Â
},
|
252 |
+
save: function( {attributes: {embedUrl, lockEmbed, buttonText, insertItemImage, insertItemOsTitle, insertItemOsView, insertItemOsEdit, insertItemOsStatistics }} ) {
|
253 |
Â
return (
|
254 |
+
<div class="os-trivia-wrapper" data-type="trivia" data-image-url={insertItemImage} data-title-url={insertItemOsTitle} data-view-url={insertItemOsView} data-statistics-url={insertItemOsStatistics} data-edit-url={insertItemOsEdit} data-test-url={embedUrl} data-lock-embed={lockEmbed} data-button-text={buttonText}>
|
255 |
+
[os-widget path="{embedUrl}"]
|
256 |
+
<span></span>
|
257 |
Â
</div>
|
258 |
Â
);
|
259 |
Â
},
|
includes/opinionstage-article-placement-functions.php
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// block direct access to plugin PHP files:
|
4 |
-
defined( 'ABSPATH' ) or die();
|
5 |
-
|
6 |
-
class OpinionStageArticlePlacement {
|
7 |
-
static function initialize() {
|
8 |
-
add_filter($hook = 'the_content', array(__CLASS__, $hook));
|
9 |
-
}
|
10 |
-
// Adds the article placement shortcode to each post
|
11 |
-
static function the_content($content) {
|
12 |
-
global $post;
|
13 |
-
if( !(isset($post) && is_object($post)) ){
|
14 |
-
return $content;
|
15 |
-
}
|
16 |
-
$type = $post->post_type;
|
17 |
-
if (is_front_page() && is_home()) {
|
18 |
-
return $content;
|
19 |
-
}
|
20 |
-
if($type == "post") {
|
21 |
-
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
22 |
-
if (!empty($os_options['article_placement_id']) && $os_options['article_placement_active'] == 'true' && !is_admin() ) {
|
23 |
-
$shortcode = do_shortcode(
|
24 |
-
sprintf(
|
25 |
-
'[osplacement id="%s"]',
|
26 |
-
$os_options['article_placement_id']
|
27 |
-
)
|
28 |
-
);
|
29 |
-
return $content . $shortcode;
|
30 |
-
}
|
31 |
-
}
|
32 |
-
return $content;
|
33 |
-
}
|
34 |
-
|
35 |
-
}
|
36 |
-
return OpinionStageArticlePlacement::initialize();
|
37 |
-
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// block direct access to plugin PHP files:
|
4 |
+
defined( 'ABSPATH' ) or die();
|
5 |
+
|
6 |
+
class OpinionStageArticlePlacement {
|
7 |
+
static function initialize() {
|
8 |
+
add_filter($hook = 'the_content', array(__CLASS__, $hook));
|
9 |
+
}
|
10 |
+
// Adds the article placement shortcode to each post
|
11 |
+
static function the_content($content) {
|
12 |
+
global $post;
|
13 |
+
if( !(isset($post) && is_object($post)) ){
|
14 |
+
return $content;
|
15 |
+
}
|
16 |
+
$type = $post->post_type;
|
17 |
+
if (is_front_page() && is_home()) {
|
18 |
+
return $content;
|
19 |
+
}
|
20 |
+
if($type == "post") {
|
21 |
+
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
22 |
+
if (!empty($os_options['article_placement_id']) && $os_options['article_placement_active'] == 'true' && !is_admin() ) {
|
23 |
+
$shortcode = do_shortcode(
|
24 |
+
sprintf(
|
25 |
+
'[osplacement id="%s"]',
|
26 |
+
$os_options['article_placement_id']
|
27 |
+
)
|
28 |
+
);
|
29 |
+
return $content . $shortcode;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
return $content;
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
36 |
+
return OpinionStageArticlePlacement::initialize();
|
37 |
+
?>
|
includes/opinionstage-functions.php
CHANGED
@@ -1,93 +1,93 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// block direct access to plugin PHP files:
|
4 |
-
defined( 'ABSPATH' ) or die();
|
5 |
-
|
6 |
-
/* --- Wordpress Hooks Implementations --- */
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Initialize the plugin
|
10 |
-
*/
|
11 |
-
function opinionstage_init() {
|
12 |
-
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
13 |
-
$os_options['version'] = OPINIONSTAGE_WIDGET_VERSION;
|
14 |
-
|
15 |
-
// For backward compatibility
|
16 |
-
if ( !isset($os_options['sidebar_placement_active']) ) {
|
17 |
-
$os_options['sidebar_placement_active'] = 'false';
|
18 |
-
}
|
19 |
-
|
20 |
-
update_option(OPINIONSTAGE_OPTIONS_KEY, $os_options);
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Remove the plugin data
|
25 |
-
*/
|
26 |
-
function opinionstage_uninstall() {
|
27 |
-
delete_option(OPINIONSTAGE_OPTIONS_KEY);
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Check if the requested plugin is already available
|
32 |
-
*/
|
33 |
-
function opinionstage_check_plugin_available($plugin_key) {
|
34 |
-
$other_widget = (array) get_option($plugin_key); // Check the key of the other plugin
|
35 |
-
|
36 |
-
// Check if OpinionStage plugin already installed.
|
37 |
-
return (isset($other_widget['uid']) ||
|
38 |
-
isset($other_widget['email']));
|
39 |
-
}
|
40 |
-
/**
|
41 |
-
* Notify about other OpinionStage plugin already available
|
42 |
-
*/
|
43 |
-
function opinionstage_other_plugin_installed_warning() {
|
44 |
-
echo "<div id='opinionstage-warning' class='error'><p><B>".__("Opinion Stage Plugin is already installed")."</B>".__(', please remove "<B>Popup for Interactive Content by Opinion Stage</B>" and use the available "<B>Poll & Quiz tools by Opinion Stage</B>" plugin')."</p></div>";
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Add the flyout embed code to the page header
|
49 |
-
*/
|
50 |
-
function opinionstage_add_flyout() {
|
51 |
-
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
52 |
-
|
53 |
-
if (!empty($os_options['fly_id']) && $os_options['fly_out_active'] == 'true' && !is_admin() ) {
|
54 |
-
// Will be added to the head of the page
|
55 |
-
?>
|
56 |
-
<script type="text/javascript">//<![CDATA[
|
57 |
-
window.AutoEngageSettings = {
|
58 |
-
id : '<?php echo $os_options['fly_id']; ?>'
|
59 |
-
};
|
60 |
-
(function(d, s, id){
|
61 |
-
var js,
|
62 |
-
fjs = d.getElementsByTagName(s)[0],
|
63 |
-
r = Math.floor(new Date().getTime() / 1000000);
|
64 |
-
if (d.getElementById(id)) {return;}
|
65 |
-
js = d.createElement(s); js.id = id; js.async=1;
|
66 |
-
js.src = '<?php echo OPINIONSTAGE_SERVER_BASE; ?>' + '/assets/autoengage.js?' + r;
|
67 |
-
fjs.parentNode.insertBefore(js, fjs);
|
68 |
-
}(document, 'script', 'os-jssdk'));
|
69 |
-
|
70 |
-
//]]></script>
|
71 |
-
|
72 |
-
<?php
|
73 |
-
}
|
74 |
-
}
|
75 |
-
function opinionstage_is_guten_enabled(){
|
76 |
-
$block_editor_oswp = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
|
77 |
-
if($block_editor_oswp == false){
|
78 |
-
if( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ){
|
79 |
-
return true;
|
80 |
-
}else{
|
81 |
-
return false;
|
82 |
-
}
|
83 |
-
}else{
|
84 |
-
global $current_screen;
|
85 |
-
$current_screen = get_current_screen();
|
86 |
-
if( method_exists($current_screen, 'is_block_editor') && $current_screen->is_block_editor() ){
|
87 |
-
return true;
|
88 |
-
}else{
|
89 |
-
return false;
|
90 |
-
}
|
91 |
-
}
|
92 |
-
}
|
93 |
-
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// block direct access to plugin PHP files:
|
4 |
+
defined( 'ABSPATH' ) or die();
|
5 |
+
|
6 |
+
/* --- Wordpress Hooks Implementations --- */
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Initialize the plugin
|
10 |
+
*/
|
11 |
+
function opinionstage_init() {
|
12 |
+
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
13 |
+
$os_options['version'] = OPINIONSTAGE_WIDGET_VERSION;
|
14 |
+
|
15 |
+
// For backward compatibility
|
16 |
+
if ( !isset($os_options['sidebar_placement_active']) ) {
|
17 |
+
$os_options['sidebar_placement_active'] = 'false';
|
18 |
+
}
|
19 |
+
|
20 |
+
update_option(OPINIONSTAGE_OPTIONS_KEY, $os_options);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Remove the plugin data
|
25 |
+
*/
|
26 |
+
function opinionstage_uninstall() {
|
27 |
+
delete_option(OPINIONSTAGE_OPTIONS_KEY);
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Check if the requested plugin is already available
|
32 |
+
*/
|
33 |
+
function opinionstage_check_plugin_available($plugin_key) {
|
34 |
+
$other_widget = (array) get_option($plugin_key); // Check the key of the other plugin
|
35 |
+
|
36 |
+
// Check if OpinionStage plugin already installed.
|
37 |
+
return (isset($other_widget['uid']) ||
|
38 |
+
isset($other_widget['email']));
|
39 |
+
}
|
40 |
+
/**
|
41 |
+
* Notify about other OpinionStage plugin already available
|
42 |
+
*/
|
43 |
+
function opinionstage_other_plugin_installed_warning() {
|
44 |
+
echo "<div id='opinionstage-warning' class='error'><p><B>".__("Opinion Stage Plugin is already installed")."</B>".__(', please remove "<B>Popup for Interactive Content by Opinion Stage</B>" and use the available "<B>Poll & Quiz tools by Opinion Stage</B>" plugin')."</p></div>";
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Add the flyout embed code to the page header
|
49 |
+
*/
|
50 |
+
function opinionstage_add_flyout() {
|
51 |
+
$os_options = (array) get_option(OPINIONSTAGE_OPTIONS_KEY);
|
52 |
+
|
53 |
+
if (!empty($os_options['fly_id']) && $os_options['fly_out_active'] == 'true' && !is_admin() ) {
|
54 |
+
// Will be added to the head of the page
|
55 |
+
?>
|
56 |
+
<script type="text/javascript">//<![CDATA[
|
57 |
+
window.AutoEngageSettings = {
|
58 |
+
id : '<?php echo $os_options['fly_id']; ?>'
|
59 |
+
};
|
60 |
+
(function(d, s, id){
|
61 |
+
var js,
|
62 |
+
fjs = d.getElementsByTagName(s)[0],
|
63 |
+
r = Math.floor(new Date().getTime() / 1000000);
|
64 |
+
if (d.getElementById(id)) {return;}
|
65 |
+
js = d.createElement(s); js.id = id; js.async=1;
|
66 |
+
js.src = '<?php echo OPINIONSTAGE_SERVER_BASE; ?>' + '/assets/autoengage.js?' + r;
|
67 |
+
fjs.parentNode.insertBefore(js, fjs);
|
68 |
+
}(document, 'script', 'os-jssdk'));
|
69 |
+
|
70 |
+
//]]></script>
|
71 |
+
|
72 |
+
<?php
|
73 |
+
}
|
74 |
+
}
|
75 |
+
function opinionstage_is_guten_enabled(){
|
76 |
+
$block_editor_oswp = version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' );
|
77 |
+
if($block_editor_oswp == false){
|
78 |
+
if( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ){
|
79 |
+
return true;
|
80 |
+
}else{
|
81 |
+
return false;
|
82 |
+
}
|
83 |
+
}else{
|
84 |
+
global $current_screen;
|
85 |
+
$current_screen = get_current_screen();
|
86 |
+
if( method_exists($current_screen, 'is_block_editor') && $current_screen->is_block_editor() ){
|
87 |
+
return true;
|
88 |
+
}else{
|
89 |
+
return false;
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
?>
|
includes/opinionstage-sidebar-widget.php
CHANGED
@@ -114,7 +114,7 @@ require_once( plugin_dir_path( __FILE__ ).'opinionstage-client-session.php' );
|
|
114 |
Â
<label for="<?php echo $this->get_field_id('enabled'); ?>">Enabled</label>
|
115 |
Â
</div> -->
|
116 |
Â
<div class="opinionstage-sidebar-config">
|
117 |
-
<a href="<?php echo opinionstage_sidebar_placement_edit_url('content'); ?>" target="_blank" class='opinionstage-blue-bordered-btn opinionstage-edit-content'>
|
118 |
Â
<a href="<?php echo opinionstage_sidebar_placement_edit_url('settings'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-settings <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">
|
119 |
Â
<div class="os-icon icon-os-common-settings"></div>
|
120 |
Â
</a>
|
114 |
Â
<label for="<?php echo $this->get_field_id('enabled'); ?>">Enabled</label>
|
115 |
Â
</div> -->
|
116 |
Â
<div class="opinionstage-sidebar-config">
|
117 |
+
<a href="<?php echo opinionstage_sidebar_placement_edit_url('content'); ?>" target="_blank" class='opinionstage-blue-bordered-btn opinionstage-edit-content'>SELECT ITEM</a>
|
118 |
Â
<a href="<?php echo opinionstage_sidebar_placement_edit_url('settings'); ?>" class='opinionstage-blue-bordered-btn opinionstage-edit-settings <?php echo( $os_client_logged_in ? '' : 'disabled' ) ?>' target="_blank">
|
119 |
Â
<div class="os-icon icon-os-common-settings"></div>
|
120 |
Â
</a>
|
opinionstage-polls.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Â
Plugin Name: Poll, Survey, Form & Quiz Maker by OpinionStage (Deprecated)
|
4 |
Â
Plugin URI: https://www.opinionstage.com
|
5 |
Â
Description: Add a highly engaging poll, survey, quiz or contact form builder to your site. You can add the poll, survey, quiz or form to any post/page or to the sidebar.
|
6 |
-
Version: 19.6.
|
7 |
Â
Author: OpinionStage.com
|
8 |
Â
Author URI: https://www.opinionstage.com
|
9 |
Â
Text Domain: social-polls-by-opinionstage
|
3 |
Â
Plugin Name: Poll, Survey, Form & Quiz Maker by OpinionStage (Deprecated)
|
4 |
Â
Plugin URI: https://www.opinionstage.com
|
5 |
Â
Description: Add a highly engaging poll, survey, quiz or contact form builder to your site. You can add the poll, survey, quiz or form to any post/page or to the sidebar.
|
6 |
+
Version: 19.6.18
|
7 |
Â
Author: OpinionStage.com
|
8 |
Â
Author URI: https://www.opinionstage.com
|
9 |
Â
Text Domain: social-polls-by-opinionstage
|
plugin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Â
Plugin Name: Poll, Survey, Form & Quiz Maker by OpinionStage
|
4 |
Â
Plugin URI: https://www.opinionstage.com
|
5 |
Â
Description: Add a highly engaging poll, survey, quiz or contact form builder to your site. You can add the poll, survey, quiz or form to any post/page or to the sidebar.
|
6 |
-
Version: 19.6.
|
7 |
Â
Author: OpinionStage.com
|
8 |
Â
Author URI: https://www.opinionstage.com
|
9 |
Â
Text Domain: social-polls-by-opinionstage
|
@@ -24,7 +24,7 @@ if ( defined('WP_DEBUG') && true === WP_DEBUG ) {
|
|
24 |
Â
}
|
25 |
Â
}
|
26 |
Â
|
27 |
-
define('OPINIONSTAGE_WIDGET_VERSION', '19.6.
|
28 |
Â
|
29 |
Â
define('OPINIONSTAGE_TEXT_DOMAIN', 'social-polls-by-opinionstage');
|
30 |
Â
|
3 |
Â
Plugin Name: Poll, Survey, Form & Quiz Maker by OpinionStage
|
4 |
Â
Plugin URI: https://www.opinionstage.com
|
5 |
Â
Description: Add a highly engaging poll, survey, quiz or contact form builder to your site. You can add the poll, survey, quiz or form to any post/page or to the sidebar.
|
6 |
+
Version: 19.6.18
|
7 |
Â
Author: OpinionStage.com
|
8 |
Â
Author URI: https://www.opinionstage.com
|
9 |
Â
Text Domain: social-polls-by-opinionstage
|
24 |
Â
}
|
25 |
Â
}
|
26 |
Â
|
27 |
+
define('OPINIONSTAGE_WIDGET_VERSION', '19.6.18');
|
28 |
Â
|
29 |
Â
define('OPINIONSTAGE_TEXT_DOMAIN', 'social-polls-by-opinionstage');
|
30 |
Â
|
readme.txt
CHANGED
@@ -1,685 +1,687 @@
|
|
1 |
-
=== Poll, Survey, Form & Quiz Maker by OpinionStage ===
|
2 |
-
Contributors: OpinionStage.com
|
3 |
-
Donate link: https://www.opinionstage.com
|
4 |
-
Tags: poll, quiz, survey, form, interactive content
|
5 |
-
Requires at least: 2.8
|
6 |
-
Tested up to: 5.1
|
7 |
-
Stable tag: 19.6.
|
8 |
-
|
9 |
-
Add a beautiful & top performing Poll, Survey, Quiz or Form to your site. Create from scratch or use templates. Set it up in Minutes.
|
10 |
-
|
11 |
-
== Description ==
|
12 |
-
|
13 |
-
Looking for a Top-Notch Poll, Survey, Form & Quiz Wordpress Plugin?
|
14 |
-
|
15 |
-
Check out:
|
16 |
-
|
17 |
-
<a href="https://www.opinionstage.com/poll?o=wp35e8" target="_blank">Poll Maker</a> | <a href="https://www.opinionstage.com/templates?utf8=✓&types%5B%5D=poll&o=wp35e8" target="_blank">Poll Examples</a>
|
18 |
-
<a href="https://www.opinionstage.com/quiz?o=wp35e8" target="_blank">Quiz Maker</a> | <a href="https://www.opinionstage.com/templates?utf8=%E2%9C%93&types%5B%5D=personality_quiz&o=wp35e8" target="_blank">Quiz Examples</a>
|
19 |
-
<a href="https://www.opinionstage.com/survey?o=wp35e8" target="_blank">Survey Maker</a> | <a href="https://www.opinionstage.com/templates?utf8=%E2%9C%93&types%5B%5D=survey&o=wp35e8" target="_blank">Survey Examples</a>
|
20 |
-
<a href="https://www.opinionstage.com/form?o=wp35e8" target="_blank">Form Maker</a> | <a href="https://www.opinionstage.com/templates?utf8=%E2%9C%93&types%5B%5D=form&o=wp35e8" target="_blank">Form Examples</a>
|
21 |
-
|
22 |
-
= Why use Opinion Stage? =
|
23 |
-
|
24 |
-
* Boost engagement & traffic - add a poll, survey or quiz to your posts/pages to increases participation, time-on-site & page views. Increase social sharing and viral distribution
|
25 |
-
* Gather more qualified leads - integrate a lead form inside the poll, quiz or survey. This will not only produce more leads, but will also produce qualified leads, as the leads will be associated with the answers of the users.
|
26 |
-
* Generate revenue - take advantage of the high engagement rates to increase revenue from ads inside and outside of the interactive content.
|
27 |
-
* Extract insights - get more insights using interactive polls & surveys designed to maximize participation. Extract actionable insights with a intuitive analytics dashboard.
|
28 |
-
|
29 |
-
= Main Poll WordPress Plugin Features: =
|
30 |
-
|
31 |
-
* Create polls with 4 different layouts (standard, image, thumbnails & head-to-head)
|
32 |
-
* Easily add images & videos into the polls either from your computer or by using an integrated search poll image function
|
33 |
-
* Configure if user can select one or more options when voting on the poll
|
34 |
-
* Allow users to add their own answers to the poll
|
35 |
-
* Block repeat voting in the poll using different mechanisms (e.g. Cookie, IP, etc)
|
36 |
-
* Permit user to vote on the poll once every configured time frame (e.g. every hour, day, etc)
|
37 |
-
* Display a customized message to the user after he votes on the poll
|
38 |
-
* Configure to close the poll at a specified time
|
39 |
-
* Redirect users to different landing pages based on their poll vote
|
40 |
-
* Configure the display order of the poll options (e.g. most votes on top, random)
|
41 |
-
* Configure if the poll results are displayed before voting, after voting or only to the poll creator
|
42 |
-
* Configure how results are displayed to the poll voters (only percentage, number of votes, both, etc)
|
43 |
-
* Integrate ads inside the polls to increase ad-revenue from your site
|
44 |
-
* Configure webhooks for sending the information gathered from your poll to any 3rd party application
|
45 |
-
* Graphic presentations of the poll results including pie & chart bars
|
46 |
-
* View a detailed result table of all poll votes (e.g. vote side, vote timestamp, etc)
|
47 |
-
* Export the poll results to an xls or csv file
|
48 |
-
|
49 |
-
= Main Quiz WordPress Plugin Features: =
|
50 |
-
|
51 |
-
* Create a personality quiz, trivia quiz, score quiz, true/false quiz, assessment quiz, multiple-choice quiz or outcome quiz
|
52 |
-
* Integrate images & videos in the quiz from your computer, from a link or using online search capabilities
|
53 |
-
* Set the main image that is shared when users share the quiz on social networks
|
54 |
-
* Configure to request users to like your facebook page before they view the quiz results
|
55 |
-
* Configure the facebook & twitter sharing message that is displayed when users share the quiz
|
56 |
-
* Configure webhooks for sending all the information gathered in the quiz to any 3rd party application
|
57 |
-
* Integrate ads in the quiz interface to increase your sites ad-revenue potential
|
58 |
-
* Add pixel tracking to the quiz to optimize your ad campaigns
|
59 |
-
* View high level statistics of your quiz including quiz impressions, quiz starts, quiz completions, average time spend on quiz, # of engagements on the quiz & # of leads generated while users participated in the quiz
|
60 |
-
* View the detailed results of each quiz question
|
61 |
-
* View a drop-off report that shows the percentage of users that voted in each quiz question
|
62 |
-
* View a detailed response report that includes all the details of each quiz submission (e.g. detailed answers, timestamp, etc)
|
63 |
-
* Export the quiz results to a xls or csv file
|
64 |
-
* Detailed logic of personality quizzes, including a scoring system for sides and formula for calculating the quiz outcome
|
65 |
-
* Detailed logic for trivia quizzes, including setting the correct answers, displaying explanations after selecting answers, calculating the results and various quiz result display options
|
66 |
-
* Support for randomizing answers in each quiz question to improve validity of results
|
67 |
-
* Support for call-to-action buttons at the end of the quiz
|
68 |
-
* Support sending to different landing pages based on the quiz outcome
|
69 |
-
|
70 |
-
= Main Survey WordPress Plugin Features: =
|
71 |
-
|
72 |
-
* Integrate images & videos to make the survey appealing & engaging. You can either upload images from your computer or use online search to locate free-to-use images
|
73 |
-
* Support both single selection and multiple selection questions and supports allowing users to add their own answer
|
74 |
-
* Support open ended questions of different types
|
75 |
-
* Supports informative cards that can be displayed inside the survey
|
76 |
-
* Supports a call-to-action action at the end of the survey
|
77 |
-
* Supports branch logic that lets you determine which question is asked next based on the answer to the last question
|
78 |
-
* Supports setting variables that can be set based on answers of users (for example saving their name to use in following questions)
|
79 |
-
* Supports social integrations, such as adding a social sharing bar, integrations with facebook like box and facebook comments and twitter message customization
|
80 |
-
* Supports sending submissions via email to the survey creator
|
81 |
-
* Supports webhooks for sending all the gathered information to a 3rd party tool
|
82 |
-
* Naive integrations with mailchimp & hubspot
|
83 |
-
* Integration with pixels to optimize ad-campaigns focused on getting relevant audience to the survey
|
84 |
-
* Overview statistics that include number of views, starts, completions, # of engagement, average time on survey and # of leads gathered
|
85 |
-
* Detailed response table, each response with all the answers and meta data such as timestamp of submission
|
86 |
-
* Graphic display (pie chart & bar chart) of answers to each one of the questions
|
87 |
-
* Drop off report to help optimize the survey for maximum completion rates
|
88 |
-
|
89 |
-
= Main Form WordPress Plugin Features: =
|
90 |
-
|
91 |
-
* Supports Short & long text fields
|
92 |
-
* Supports Email fields including 2 approval checkboxes
|
93 |
-
* Support phone number field
|
94 |
-
* Supports drop-down field
|
95 |
-
* Configure to send an email to form creator on each submission
|
96 |
-
* Support sending all the gathered information to a 3rd party application using webhooks
|
97 |
-
* Supports native integrations with mailchimp and hubspot
|
98 |
-
* View statistics on # of views vs. # of submissions
|
99 |
-
* View all submissions including the all field entries and meta data such as timestamp of submission
|
100 |
-
|
101 |
-
= Placements: =
|
102 |
-
|
103 |
-
* Sidebar placement - add to the site sidebar using a dedicated Opinion Stage sidebar widget
|
104 |
-
* Popup placement - popup when users enter or exit your site using a highly configurable popup component
|
105 |
-
* Articles placement - display at the end of all your posts/pages
|
106 |
-
|
107 |
-
= Language support =
|
108 |
-
|
109 |
-
Opinion Stage supports over 42 languages, missing a language? Let us know!
|
110 |
-
|
111 |
-
= About Opinion Stage: =
|
112 |
-
|
113 |
-
Opinion Stage is a powerful & easy-to-use interactive content (e.g. poll, quiz, survey, forms, etc) creation service. Opinion Stages' highly engaging content formats are used to boost engagement, gather leads, generate revenue and to extract actionable insights. Opinion Stage works with 100,000+ publishers, brands & agenencies, including world-leading publishers, brands & agencies. For more details, visit <a href="https://www.opinionstage.com?o=wp35e8" target="_blank">the Opinion Stage site.</a>
|
114 |
-
|
115 |
-
== Installation ==
|
116 |
-
|
117 |
-
1. Upload the "Poll, Survey, Form & Quiz Maker" plugin to your blog (or search for it) and then install the plugin on your plugins page
|
118 |
-
2. Active it and start creating polls, quizzes, surveys and forms
|
119 |
-
|
120 |
-
== Frequently Asked Questions ==
|
121 |
-
|
122 |
-
= Is Opinion Stage content responsive? =
|
123 |
-
|
124 |
-
Yes, all content (e.g. poll, quiz, survey, form, etc) created with Opinion Stage is fully responsive, and designed to optimaly display on mobile, tablet and desktop
|
125 |
-
|
126 |
-
= What interactive content formats does Opinion Stage support? =
|
127 |
-
|
128 |
-
With Opinion Stage you can create the following content formats: Poll, Poll Sets, Personality Quiz, Trivia Quiz, Survey, Slideshow, Form, Story Article, List. We are constantly adding additional interactive content formats so stay tuned!
|
129 |
-
|
130 |
-
= What is the difference between a Poll and a Survey =
|
131 |
-
|
132 |
-
Polls include one question and are used for getting a quick answer on a question. Polls are often used for gathering opinions, getting feedback, running contents & competitions and generating engagement. Surveys include multiple questions of different types. Surveys are often used to gather feedback and insights. If you are still unsure whether to use a poll or a survey, contact our support team and we'll be happy to help.
|
133 |
-
|
134 |
-
= What customization options do you offer? =
|
135 |
-
|
136 |
-
Opinion Stage offers many built-in customization options such as selecting the color theme, font and sizes. You can also use a CSS override feature to fully match the items to your brand. You can also white label the items and add your own logo.
|
137 |
-
|
138 |
-
|
139 |
-
== Other Notes ==
|
140 |
-
|
141 |
-
== Screenshots ==
|
142 |
-
|
143 |
-
1. **Poll image layout** - example of integrating images in the poll answers to make it more appealing, which results with improved engagement rates.
|
144 |
-
2. **Poll standard layout** - the poll include a lot of features including, selecting if users can select one side or more in the poll, allowing users to add their own answer to the poll, different methods of organizing the poll side order, setting the poll color, setting the poll font, preventing repeat voting in the poll, voting with a social profile in the poll, setting the poll result display, setting an expiry date for the poll, alignment of the poll title, setting the poll width, setting poll sharing bar, and much more
|
145 |
-
3. **poll head to head layout** - example of a head-to-head layout poll
|
146 |
-
4. **Trivia quiz** - example of a Trivia quiz result. Set the correct answer in each of the quiz questions, and following users answers to the quiz, give them a quiz result with the number of correct quiz answers. Trivia quizzes are one of the most engaging type of content.
|
147 |
-
5. **Personality quiz** - example of a personality quiz. Using a personality quiz, you can ask you users different quiz questions, and based on their answers to the quiz questions, offer them different quiz results. Personality quizzes tend to be viral as they produce a lot of social shares.
|
148 |
-
6. **Content creation dashboard** - example of the Opinion Stage interactive content (e.g. poll, quiz, survey, form) creation dashboard
|
149 |
-
7. **Lead form** - example of gathering quality leads while users participate in the polls, quizzes & surveys
|
150 |
-
8. **Report** - example of a poll report screen that includes advanced analysis of results
|
151 |
-
9. **Templates** - dashboard that includes highly effective examples that can be duplicated to your account
|
152 |
-
10. **Popup placement** - display your content in an exit/enter, center/side screen popup
|
153 |
-
|
154 |
-
== Upgrade Notice ==
|
155 |
-
|
156 |
-
N/A
|
157 |
-
|
158 |
-
== Changelog ==
|
159 |
-
= 19.6.
|
160 |
-
*
|
161 |
-
= 19.6.
|
162 |
-
*
|
163 |
-
= 19.6.
|
164 |
-
*
|
165 |
-
= 19.6.
|
166 |
-
* Gutenberg
|
167 |
-
= 19.6.
|
168 |
-
*
|
169 |
-
|
170 |
-
*
|
171 |
-
|
172 |
-
*
|
173 |
-
= 19.6.
|
174 |
-
* readme update
|
175 |
-
|
176 |
-
|
177 |
-
*
|
178 |
-
= 19.6.
|
179 |
-
*
|
180 |
-
= 19.6.
|
181 |
-
*
|
182 |
-
|
183 |
-
|
184 |
-
*
|
185 |
-
= 19.6.
|
186 |
-
*
|
187 |
-
|
188 |
-
|
189 |
-
*
|
190 |
-
|
191 |
-
|
192 |
-
*
|
193 |
-
= 19.6.
|
194 |
-
*
|
195 |
-
= 19.6.
|
196 |
-
*
|
197 |
-
|
198 |
-
|
199 |
-
* Plugin
|
200 |
-
= 19.6.
|
201 |
-
* Plugin
|
202 |
-
|
203 |
-
|
204 |
-
*
|
205 |
-
|
206 |
-
|
207 |
-
*
|
208 |
-
= 19.4.
|
209 |
-
*
|
210 |
-
= 19.4.
|
211 |
-
*
|
212 |
-
|
213 |
-
|
214 |
-
*
|
215 |
-
= 19.3.
|
216 |
-
*
|
217 |
-
|
218 |
-
*
|
219 |
-
|
220 |
-
* small text changes
|
221 |
-
= 19.3.
|
222 |
-
*
|
223 |
-
= 19.3.
|
224 |
-
* readme update
|
225 |
-
= 19.3.
|
226 |
-
*
|
227 |
-
= 19.
|
228 |
-
*
|
229 |
-
= 19.2.
|
230 |
-
* fix
|
231 |
-
= 19.2.
|
232 |
-
*
|
233 |
-
= 19.2.
|
234 |
-
*
|
235 |
-
|
236 |
-
|
237 |
-
*
|
238 |
-
= 19.2.
|
239 |
-
*
|
240 |
-
= 19.2.
|
241 |
-
* adds
|
242 |
-
|
243 |
-
|
244 |
-
*
|
245 |
-
|
246 |
-
|
247 |
-
*
|
248 |
-
= 19.0
|
249 |
-
*
|
250 |
-
= 19.0.
|
251 |
-
* Minor
|
252 |
-
= 19.0.
|
253 |
-
*
|
254 |
-
=
|
255 |
-
*
|
256 |
-
= 18.2.
|
257 |
-
*
|
258 |
-
= 18.
|
259 |
-
*
|
260 |
-
|
261 |
-
|
262 |
-
*
|
263 |
-
= 18.0.
|
264 |
-
*
|
265 |
-
= 18.0.
|
266 |
-
*
|
267 |
-
= 18.0.
|
268 |
-
*
|
269 |
-
|
270 |
-
* Fix
|
271 |
-
*
|
272 |
-
|
273 |
-
* Fix
|
274 |
-
= 18.0.
|
275 |
-
*
|
276 |
-
=
|
277 |
-
*
|
278 |
-
= 17.
|
279 |
-
*
|
280 |
-
|
281 |
-
|
282 |
-
*
|
283 |
-
= 17.
|
284 |
-
*
|
285 |
-
= 17.
|
286 |
-
*
|
287 |
-
|
288 |
-
|
289 |
-
*
|
290 |
-
= 17.
|
291 |
-
*
|
292 |
-
|
293 |
-
|
294 |
-
*
|
295 |
-
|
296 |
-
|
297 |
-
*
|
298 |
-
|
299 |
-
|
300 |
-
*
|
301 |
-
=
|
302 |
-
*
|
303 |
-
= 16.
|
304 |
-
*
|
305 |
-
= 16.
|
306 |
-
*
|
307 |
-
= 16.
|
308 |
-
*
|
309 |
-
= 16.
|
310 |
-
*
|
311 |
-
= 16.
|
312 |
-
*
|
313 |
-
= 16.
|
314 |
-
* Added
|
315 |
-
= 16.
|
316 |
-
*
|
317 |
-
= 16.
|
318 |
-
*
|
319 |
-
= 16.
|
320 |
-
*
|
321 |
-
=
|
322 |
-
*
|
323 |
-
= 15.
|
324 |
-
*
|
325 |
-
= 15.
|
326 |
-
*
|
327 |
-
= 15.
|
328 |
-
* Added support for creating
|
329 |
-
= 15.
|
330 |
-
*
|
331 |
-
= 15.
|
332 |
-
*
|
333 |
-
= 15.
|
334 |
-
*
|
335 |
-
= 15.
|
336 |
-
*
|
337 |
-
= 15.
|
338 |
-
*
|
339 |
-
= 15.
|
340 |
-
*
|
341 |
-
=
|
342 |
-
*
|
343 |
-
= 14.
|
344 |
-
*
|
345 |
-
|
346 |
-
*
|
347 |
-
|
348 |
-
*
|
349 |
-
= 14.
|
350 |
-
* Various
|
351 |
-
= 14.
|
352 |
-
*
|
353 |
-
= 14.
|
354 |
-
*
|
355 |
-
|
356 |
-
*
|
357 |
-
|
358 |
-
*
|
359 |
-
= 14.
|
360 |
-
*
|
361 |
-
= 14.
|
362 |
-
*
|
363 |
-
= 14.
|
364 |
-
*
|
365 |
-
|
366 |
-
|
367 |
-
*
|
368 |
-
|
369 |
-
|
370 |
-
*
|
371 |
-
|
372 |
-
|
373 |
-
*
|
374 |
-
= 13.
|
375 |
-
*
|
376 |
-
= 13.
|
377 |
-
*
|
378 |
-
= 13.
|
379 |
-
*
|
380 |
-
= 13.
|
381 |
-
*
|
382 |
-
|
383 |
-
|
384 |
-
* Support for
|
385 |
-
|
386 |
-
|
387 |
-
*
|
388 |
-
= 13.
|
389 |
-
* Added
|
390 |
-
=
|
391 |
-
*
|
392 |
-
|
393 |
-
|
394 |
-
*
|
395 |
-
= 12.
|
396 |
-
*
|
397 |
-
|
398 |
-
*
|
399 |
-
|
400 |
-
*
|
401 |
-
|
402 |
-
|
403 |
-
*
|
404 |
-
|
405 |
-
|
406 |
-
* Added
|
407 |
-
= 12.
|
408 |
-
* Added
|
409 |
-
= 12.
|
410 |
-
* Added
|
411 |
-
|
412 |
-
*
|
413 |
-
|
414 |
-
*
|
415 |
-
= 12.
|
416 |
-
*
|
417 |
-
|
418 |
-
|
419 |
-
*
|
420 |
-
= 11.
|
421 |
-
*
|
422 |
-
= 11.
|
423 |
-
*
|
424 |
-
= 11.
|
425 |
-
*
|
426 |
-
= 11.
|
427 |
-
*
|
428 |
-
= 11.
|
429 |
-
*
|
430 |
-
= 11.
|
431 |
-
*
|
432 |
-
= 11.
|
433 |
-
*
|
434 |
-
= 11.
|
435 |
-
*
|
436 |
-
= 11.
|
437 |
-
*
|
438 |
-
=
|
439 |
-
*
|
440 |
-
= 10.
|
441 |
-
*
|
442 |
-
= 10.
|
443 |
-
*
|
444 |
-
= 10.
|
445 |
-
*
|
446 |
-
= 10.
|
447 |
-
*
|
448 |
-
= 10.
|
449 |
-
*
|
450 |
-
|
451 |
-
*
|
452 |
-
= 10.
|
453 |
-
*
|
454 |
-
= 10.
|
455 |
-
*
|
456 |
-
= 10.
|
457 |
-
*
|
458 |
-
=
|
459 |
-
*
|
460 |
-
= 9.
|
461 |
-
*
|
462 |
-
= 9.
|
463 |
-
*
|
464 |
-
= 9.
|
465 |
-
*
|
466 |
-
= 9.
|
467 |
-
*
|
468 |
-
= 9.
|
469 |
-
*
|
470 |
-
|
471 |
-
|
472 |
-
*
|
473 |
-
|
474 |
-
|
475 |
-
*
|
476 |
-
|
477 |
-
|
478 |
-
*
|
479 |
-
|
480 |
-
|
481 |
-
*
|
482 |
-
|
483 |
-
|
484 |
-
*
|
485 |
-
|
486 |
-
|
487 |
-
*
|
488 |
-
|
489 |
-
|
490 |
-
*
|
491 |
-
|
492 |
-
|
493 |
-
*
|
494 |
-
|
495 |
-
|
496 |
-
*
|
497 |
-
|
498 |
-
|
499 |
-
*
|
500 |
-
|
501 |
-
|
502 |
-
*
|
503 |
-
|
504 |
-
|
505 |
-
*
|
506 |
-
|
507 |
-
*
|
508 |
-
|
509 |
-
*
|
510 |
-
|
511 |
-
* Poll
|
512 |
-
|
513 |
-
*
|
514 |
-
=
|
515 |
-
*
|
516 |
-
|
517 |
-
|
518 |
-
*
|
519 |
-
= 7.
|
520 |
-
*
|
521 |
-
= 7.
|
522 |
-
*
|
523 |
-
|
524 |
-
|
525 |
-
*
|
526 |
-
= 7.
|
527 |
-
*
|
528 |
-
= 7.
|
529 |
-
*
|
530 |
-
= 7.
|
531 |
-
*
|
532 |
-
= 7.
|
533 |
-
*
|
534 |
-
= 7.
|
535 |
-
*
|
536 |
-
=
|
537 |
-
*
|
538 |
-
|
539 |
-
*
|
540 |
-
|
541 |
-
* Fix
|
542 |
-
|
543 |
-
* Fix
|
544 |
-
|
545 |
-
*
|
546 |
-
|
547 |
-
|
548 |
-
*
|
549 |
-
|
550 |
-
|
551 |
-
*
|
552 |
-
= 6.
|
553 |
-
*
|
554 |
-
|
555 |
-
|
556 |
-
*
|
557 |
-
|
558 |
-
|
559 |
-
* New
|
560 |
-
|
561 |
-
|
562 |
-
* New
|
563 |
-
|
564 |
-
|
565 |
-
*
|
566 |
-
=
|
567 |
-
* Added
|
568 |
-
= 5.
|
569 |
-
* Added
|
570 |
-
|
571 |
-
*
|
572 |
-
|
573 |
-
*
|
574 |
-
= 5.
|
575 |
-
*
|
576 |
-
= 5.
|
577 |
-
* Improvements & fixes on poll
|
578 |
-
|
579 |
-
|
580 |
-
*
|
581 |
-
= 5.
|
582 |
-
*
|
583 |
-
|
584 |
-
|
585 |
-
*
|
586 |
-
|
587 |
-
|
588 |
-
*
|
589 |
-
|
590 |
-
|
591 |
-
*
|
592 |
-
|
593 |
-
*
|
594 |
-
*
|
595 |
-
|
596 |
-
*
|
597 |
-
|
598 |
-
|
599 |
-
*
|
600 |
-
= 4.
|
601 |
-
*
|
602 |
-
|
603 |
-
*
|
604 |
-
|
605 |
-
*
|
606 |
-
|
607 |
-
*
|
608 |
-
|
609 |
-
*
|
610 |
-
|
611 |
-
*
|
612 |
-
*
|
613 |
-
|
614 |
-
*
|
615 |
-
|
616 |
-
|
617 |
-
*
|
618 |
-
|
619 |
-
*
|
620 |
-
*
|
621 |
-
* Poll
|
622 |
-
|
623 |
-
*
|
624 |
-
|
625 |
-
|
626 |
-
*
|
627 |
-
|
628 |
-
|
629 |
-
*
|
630 |
-
=
|
631 |
-
*
|
632 |
-
|
633 |
-
* Poll
|
634 |
-
|
635 |
-
*
|
636 |
-
=
|
637 |
-
*
|
638 |
-
= 2.
|
639 |
-
*
|
640 |
-
|
641 |
-
*
|
642 |
-
|
643 |
-
*
|
644 |
-
|
645 |
-
|
646 |
-
* Additional customizations
|
647 |
-
|
648 |
-
|
649 |
-
*
|
650 |
-
= 2.
|
651 |
-
*
|
652 |
-
|
653 |
-
*
|
654 |
-
|
655 |
-
*
|
656 |
-
|
657 |
-
*
|
658 |
-
|
659 |
-
*
|
660 |
-
|
661 |
-
*
|
662 |
-
|
663 |
-
*
|
664 |
-
|
665 |
-
*
|
666 |
-
*
|
667 |
-
*
|
668 |
-
*
|
669 |
-
|
670 |
-
* Support for
|
671 |
-
|
672 |
-
*
|
673 |
-
|
674 |
-
*
|
675 |
-
|
676 |
-
*
|
677 |
-
|
678 |
-
*
|
679 |
-
|
680 |
-
* Added
|
681 |
-
* Added
|
682 |
-
|
683 |
-
*
|
684 |
-
= 1.0.
|
685 |
-
*
|
Â
|
|
Â
|
1 |
+
=== Poll, Survey, Form & Quiz Maker by OpinionStage ===
|
2 |
+
Contributors: OpinionStage.com
|
3 |
+
Donate link: https://www.opinionstage.com
|
4 |
+
Tags: poll, quiz, survey, form, interactive content
|
5 |
+
Requires at least: 2.8
|
6 |
+
Tested up to: 5.1
|
7 |
+
Stable tag: 19.6.18
|
8 |
+
|
9 |
+
Add a beautiful & top performing Poll, Survey, Quiz or Form to your site. Create from scratch or use templates. Set it up in Minutes.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
Looking for a Top-Notch Poll, Survey, Form & Quiz Wordpress Plugin?
|
14 |
+
|
15 |
+
Check out:
|
16 |
+
|
17 |
+
<a href="https://www.opinionstage.com/poll?o=wp35e8" target="_blank">Poll Maker</a> | <a href="https://www.opinionstage.com/templates?utf8=✓&types%5B%5D=poll&o=wp35e8" target="_blank">Poll Examples</a>
|
18 |
+
<a href="https://www.opinionstage.com/quiz?o=wp35e8" target="_blank">Quiz Maker</a> | <a href="https://www.opinionstage.com/templates?utf8=%E2%9C%93&types%5B%5D=personality_quiz&o=wp35e8" target="_blank">Quiz Examples</a>
|
19 |
+
<a href="https://www.opinionstage.com/survey?o=wp35e8" target="_blank">Survey Maker</a> | <a href="https://www.opinionstage.com/templates?utf8=%E2%9C%93&types%5B%5D=survey&o=wp35e8" target="_blank">Survey Examples</a>
|
20 |
+
<a href="https://www.opinionstage.com/form?o=wp35e8" target="_blank">Form Maker</a> | <a href="https://www.opinionstage.com/templates?utf8=%E2%9C%93&types%5B%5D=form&o=wp35e8" target="_blank">Form Examples</a>
|
21 |
+
|
22 |
+
= Why use Opinion Stage? =
|
23 |
+
|
24 |
+
* Boost engagement & traffic - add a poll, survey or quiz to your posts/pages to increases participation, time-on-site & page views. Increase social sharing and viral distribution
|
25 |
+
* Gather more qualified leads - integrate a lead form inside the poll, quiz or survey. This will not only produce more leads, but will also produce qualified leads, as the leads will be associated with the answers of the users.
|
26 |
+
* Generate revenue - take advantage of the high engagement rates to increase revenue from ads inside and outside of the interactive content.
|
27 |
+
* Extract insights - get more insights using interactive polls & surveys designed to maximize participation. Extract actionable insights with a intuitive analytics dashboard.
|
28 |
+
|
29 |
+
= Main Poll WordPress Plugin Features: =
|
30 |
+
|
31 |
+
* Create polls with 4 different layouts (standard, image, thumbnails & head-to-head)
|
32 |
+
* Easily add images & videos into the polls either from your computer or by using an integrated search poll image function
|
33 |
+
* Configure if user can select one or more options when voting on the poll
|
34 |
+
* Allow users to add their own answers to the poll
|
35 |
+
* Block repeat voting in the poll using different mechanisms (e.g. Cookie, IP, etc)
|
36 |
+
* Permit user to vote on the poll once every configured time frame (e.g. every hour, day, etc)
|
37 |
+
* Display a customized message to the user after he votes on the poll
|
38 |
+
* Configure to close the poll at a specified time
|
39 |
+
* Redirect users to different landing pages based on their poll vote
|
40 |
+
* Configure the display order of the poll options (e.g. most votes on top, random)
|
41 |
+
* Configure if the poll results are displayed before voting, after voting or only to the poll creator
|
42 |
+
* Configure how results are displayed to the poll voters (only percentage, number of votes, both, etc)
|
43 |
+
* Integrate ads inside the polls to increase ad-revenue from your site
|
44 |
+
* Configure webhooks for sending the information gathered from your poll to any 3rd party application
|
45 |
+
* Graphic presentations of the poll results including pie & chart bars
|
46 |
+
* View a detailed result table of all poll votes (e.g. vote side, vote timestamp, etc)
|
47 |
+
* Export the poll results to an xls or csv file
|
48 |
+
|
49 |
+
= Main Quiz WordPress Plugin Features: =
|
50 |
+
|
51 |
+
* Create a personality quiz, trivia quiz, score quiz, true/false quiz, assessment quiz, multiple-choice quiz or outcome quiz
|
52 |
+
* Integrate images & videos in the quiz from your computer, from a link or using online search capabilities
|
53 |
+
* Set the main image that is shared when users share the quiz on social networks
|
54 |
+
* Configure to request users to like your facebook page before they view the quiz results
|
55 |
+
* Configure the facebook & twitter sharing message that is displayed when users share the quiz
|
56 |
+
* Configure webhooks for sending all the information gathered in the quiz to any 3rd party application
|
57 |
+
* Integrate ads in the quiz interface to increase your sites ad-revenue potential
|
58 |
+
* Add pixel tracking to the quiz to optimize your ad campaigns
|
59 |
+
* View high level statistics of your quiz including quiz impressions, quiz starts, quiz completions, average time spend on quiz, # of engagements on the quiz & # of leads generated while users participated in the quiz
|
60 |
+
* View the detailed results of each quiz question
|
61 |
+
* View a drop-off report that shows the percentage of users that voted in each quiz question
|
62 |
+
* View a detailed response report that includes all the details of each quiz submission (e.g. detailed answers, timestamp, etc)
|
63 |
+
* Export the quiz results to a xls or csv file
|
64 |
+
* Detailed logic of personality quizzes, including a scoring system for sides and formula for calculating the quiz outcome
|
65 |
+
* Detailed logic for trivia quizzes, including setting the correct answers, displaying explanations after selecting answers, calculating the results and various quiz result display options
|
66 |
+
* Support for randomizing answers in each quiz question to improve validity of results
|
67 |
+
* Support for call-to-action buttons at the end of the quiz
|
68 |
+
* Support sending to different landing pages based on the quiz outcome
|
69 |
+
|
70 |
+
= Main Survey WordPress Plugin Features: =
|
71 |
+
|
72 |
+
* Integrate images & videos to make the survey appealing & engaging. You can either upload images from your computer or use online search to locate free-to-use images
|
73 |
+
* Support both single selection and multiple selection questions and supports allowing users to add their own answer
|
74 |
+
* Support open ended questions of different types
|
75 |
+
* Supports informative cards that can be displayed inside the survey
|
76 |
+
* Supports a call-to-action action at the end of the survey
|
77 |
+
* Supports branch logic that lets you determine which question is asked next based on the answer to the last question
|
78 |
+
* Supports setting variables that can be set based on answers of users (for example saving their name to use in following questions)
|
79 |
+
* Supports social integrations, such as adding a social sharing bar, integrations with facebook like box and facebook comments and twitter message customization
|
80 |
+
* Supports sending submissions via email to the survey creator
|
81 |
+
* Supports webhooks for sending all the gathered information to a 3rd party tool
|
82 |
+
* Naive integrations with mailchimp & hubspot
|
83 |
+
* Integration with pixels to optimize ad-campaigns focused on getting relevant audience to the survey
|
84 |
+
* Overview statistics that include number of views, starts, completions, # of engagement, average time on survey and # of leads gathered
|
85 |
+
* Detailed response table, each response with all the answers and meta data such as timestamp of submission
|
86 |
+
* Graphic display (pie chart & bar chart) of answers to each one of the questions
|
87 |
+
* Drop off report to help optimize the survey for maximum completion rates
|
88 |
+
|
89 |
+
= Main Form WordPress Plugin Features: =
|
90 |
+
|
91 |
+
* Supports Short & long text fields
|
92 |
+
* Supports Email fields including 2 approval checkboxes
|
93 |
+
* Support phone number field
|
94 |
+
* Supports drop-down field
|
95 |
+
* Configure to send an email to form creator on each submission
|
96 |
+
* Support sending all the gathered information to a 3rd party application using webhooks
|
97 |
+
* Supports native integrations with mailchimp and hubspot
|
98 |
+
* View statistics on # of views vs. # of submissions
|
99 |
+
* View all submissions including the all field entries and meta data such as timestamp of submission
|
100 |
+
|
101 |
+
= Placements: =
|
102 |
+
|
103 |
+
* Sidebar placement - add to the site sidebar using a dedicated Opinion Stage sidebar widget
|
104 |
+
* Popup placement - popup when users enter or exit your site using a highly configurable popup component
|
105 |
+
* Articles placement - display at the end of all your posts/pages
|
106 |
+
|
107 |
+
= Language support =
|
108 |
+
|
109 |
+
Opinion Stage supports over 42 languages, missing a language? Let us know!
|
110 |
+
|
111 |
+
= About Opinion Stage: =
|
112 |
+
|
113 |
+
Opinion Stage is a powerful & easy-to-use interactive content (e.g. poll, quiz, survey, forms, etc) creation service. Opinion Stages' highly engaging content formats are used to boost engagement, gather leads, generate revenue and to extract actionable insights. Opinion Stage works with 100,000+ publishers, brands & agenencies, including world-leading publishers, brands & agencies. For more details, visit <a href="https://www.opinionstage.com?o=wp35e8" target="_blank">the Opinion Stage site.</a>
|
114 |
+
|
115 |
+
== Installation ==
|
116 |
+
|
117 |
+
1. Upload the "Poll, Survey, Form & Quiz Maker" plugin to your blog (or search for it) and then install the plugin on your plugins page
|
118 |
+
2. Active it and start creating polls, quizzes, surveys and forms
|
119 |
+
|
120 |
+
== Frequently Asked Questions ==
|
121 |
+
|
122 |
+
= Is Opinion Stage content responsive? =
|
123 |
+
|
124 |
+
Yes, all content (e.g. poll, quiz, survey, form, etc) created with Opinion Stage is fully responsive, and designed to optimaly display on mobile, tablet and desktop
|
125 |
+
|
126 |
+
= What interactive content formats does Opinion Stage support? =
|
127 |
+
|
128 |
+
With Opinion Stage you can create the following content formats: Poll, Poll Sets, Personality Quiz, Trivia Quiz, Survey, Slideshow, Form, Story Article, List. We are constantly adding additional interactive content formats so stay tuned!
|
129 |
+
|
130 |
+
= What is the difference between a Poll and a Survey =
|
131 |
+
|
132 |
+
Polls include one question and are used for getting a quick answer on a question. Polls are often used for gathering opinions, getting feedback, running contents & competitions and generating engagement. Surveys include multiple questions of different types. Surveys are often used to gather feedback and insights. If you are still unsure whether to use a poll or a survey, contact our support team and we'll be happy to help.
|
133 |
+
|
134 |
+
= What customization options do you offer? =
|
135 |
+
|
136 |
+
Opinion Stage offers many built-in customization options such as selecting the color theme, font and sizes. You can also use a CSS override feature to fully match the items to your brand. You can also white label the items and add your own logo.
|
137 |
+
|
138 |
+
|
139 |
+
== Other Notes ==
|
140 |
+
|
141 |
+
== Screenshots ==
|
142 |
+
|
143 |
+
1. **Poll image layout** - example of integrating images in the poll answers to make it more appealing, which results with improved engagement rates.
|
144 |
+
2. **Poll standard layout** - the poll include a lot of features including, selecting if users can select one side or more in the poll, allowing users to add their own answer to the poll, different methods of organizing the poll side order, setting the poll color, setting the poll font, preventing repeat voting in the poll, voting with a social profile in the poll, setting the poll result display, setting an expiry date for the poll, alignment of the poll title, setting the poll width, setting poll sharing bar, and much more
|
145 |
+
3. **poll head to head layout** - example of a head-to-head layout poll
|
146 |
+
4. **Trivia quiz** - example of a Trivia quiz result. Set the correct answer in each of the quiz questions, and following users answers to the quiz, give them a quiz result with the number of correct quiz answers. Trivia quizzes are one of the most engaging type of content.
|
147 |
+
5. **Personality quiz** - example of a personality quiz. Using a personality quiz, you can ask you users different quiz questions, and based on their answers to the quiz questions, offer them different quiz results. Personality quizzes tend to be viral as they produce a lot of social shares.
|
148 |
+
6. **Content creation dashboard** - example of the Opinion Stage interactive content (e.g. poll, quiz, survey, form) creation dashboard
|
149 |
+
7. **Lead form** - example of gathering quality leads while users participate in the polls, quizzes & surveys
|
150 |
+
8. **Report** - example of a poll report screen that includes advanced analysis of results
|
151 |
+
9. **Templates** - dashboard that includes highly effective examples that can be duplicated to your account
|
152 |
+
10. **Popup placement** - display your content in an exit/enter, center/side screen popup
|
153 |
+
|
154 |
+
== Upgrade Notice ==
|
155 |
+
|
156 |
+
N/A
|
157 |
+
|
158 |
+
== Changelog ==
|
159 |
+
= 19.6.18 =
|
160 |
+
* bugfixes
|
161 |
+
= 19.6.17 =
|
162 |
+
* UI looks & feel revamp
|
163 |
+
= 19.6.16 =
|
164 |
+
* Support 5.1 and Readme updates
|
165 |
+
= 19.6.15 =
|
166 |
+
* Gutenberg fixes and improvements
|
167 |
+
= 19.6.14 =
|
168 |
+
* Gutenberg fix
|
169 |
+
= 19.6.13 =
|
170 |
+
* My Items page
|
171 |
+
* updated Content Popup
|
172 |
+
* Design update
|
173 |
+
= 19.6.12 =
|
174 |
+
* readme update
|
175 |
+
= 19.6.11 =
|
176 |
+
* readme update
|
177 |
+
* analytics setup
|
178 |
+
= 19.6.10 =
|
179 |
+
* navigation links update
|
180 |
+
= 19.6.9 =
|
181 |
+
* add support for new editor Gutenberg
|
182 |
+
= 19.6.8 =
|
183 |
+
* readme changes
|
184 |
+
* add admin loader
|
185 |
+
= 19.6.7 =
|
186 |
+
* new getting started experience
|
187 |
+
= 19.6.6 =
|
188 |
+
* WordPress 5.0 compatibility
|
189 |
+
* Readme update
|
190 |
+
= 19.6.5 =
|
191 |
+
* Assets loading fix
|
192 |
+
* Readme update
|
193 |
+
= 19.6.4 =
|
194 |
+
* Permission fix on sub pages
|
195 |
+
= 19.6.3 =
|
196 |
+
* Icon set fix
|
197 |
+
= 19.6.2 =
|
198 |
+
* Double page bug fix
|
199 |
+
* Plugin renamed
|
200 |
+
= 19.6.1 =
|
201 |
+
* Plugin rename: improved fix
|
202 |
+
= 19.6.0 =
|
203 |
+
* Plugin filename fix
|
204 |
+
* Backward Compatibility added
|
205 |
+
= 19.5.0 =
|
206 |
+
* New navigation added
|
207 |
+
* Fixed placements issue
|
208 |
+
= 19.4.2 =
|
209 |
+
* better AJAX handling
|
210 |
+
= 19.4.1 =
|
211 |
+
* fix deactivation issue
|
212 |
+
= 19.4.0 =
|
213 |
+
* stability fixes
|
214 |
+
* added deactivate screen
|
215 |
+
= 19.3.5 =
|
216 |
+
* more updates to readme.txt file
|
217 |
+
= 19.3.4 =
|
218 |
+
* rename plugin
|
219 |
+
* update to readme.txt file
|
220 |
+
* small text changes
|
221 |
+
= 19.3.3 =
|
222 |
+
* small text changes
|
223 |
+
= 19.3.2 =
|
224 |
+
* readme update
|
225 |
+
= 19.3.1 =
|
226 |
+
* readme update
|
227 |
+
= 19.3.0 =
|
228 |
+
* add Story support
|
229 |
+
= 19.2.7 =
|
230 |
+
* fix PHP installations older than 5.4
|
231 |
+
= 19.2.6 =
|
232 |
+
* fix links to content
|
233 |
+
= 19.2.5 =
|
234 |
+
* minor text updates
|
235 |
+
= 19.2.4 =
|
236 |
+
* tested up to 4.9 WordPress version
|
237 |
+
* Minor textual changes
|
238 |
+
= 19.2.3 =
|
239 |
+
* fix content popup video placing issue
|
240 |
+
= 19.2.2 =
|
241 |
+
* adds video intro
|
242 |
+
= 19.2.1 =
|
243 |
+
* adds ability to sign in from content popup
|
244 |
+
* various UI/UX issues fixes
|
245 |
+
= 19.2.0 =
|
246 |
+
* content popup UI/UX improvements
|
247 |
+
* login/logout UI/UX
|
248 |
+
= 19.1.0 =
|
249 |
+
* content popup UI/UX improvements
|
250 |
+
= 19.0.2 =
|
251 |
+
* Minor textual changes
|
252 |
+
= 19.0.1 =
|
253 |
+
* Minor logging changes
|
254 |
+
= 19.0.0 =
|
255 |
+
* New feature: post editor integration
|
256 |
+
= 18.2.1 =
|
257 |
+
* Minor changes
|
258 |
+
= 18.2.0 =
|
259 |
+
* Support for 4.8 WP version
|
260 |
+
= 18.1.0 =
|
261 |
+
* Minor styling fixes
|
262 |
+
* Widgets embedding refactor
|
263 |
+
= 18.0.5 =
|
264 |
+
* sidebar widget fix
|
265 |
+
= 18.0.4 =
|
266 |
+
* prevent internal font icon leak into site area
|
267 |
+
= 18.0.3 =
|
268 |
+
* Minor fixes
|
269 |
+
= 18.0.2 =
|
270 |
+
* Fix sidebar widget settings style
|
271 |
+
* Add SlideShow
|
272 |
+
* Fix ContactForm icon
|
273 |
+
* Fix video tutorials help link
|
274 |
+
= 18.0.1 =
|
275 |
+
* Fix menu page styling
|
276 |
+
= 18.0.0 =
|
277 |
+
* Add a slider content format
|
278 |
+
= 17.9.0 =
|
279 |
+
* Additional survey features based on client requests
|
280 |
+
= 17.8.0 =
|
281 |
+
* Improvements of quiz/survey reporting
|
282 |
+
* Various minor bug fixes
|
283 |
+
= 17.7.0 =
|
284 |
+
* Responses table improvements, language fixes, advanced editing in after vote notifications
|
285 |
+
= 17.6.0 =
|
286 |
+
* Various fixes & optimizations
|
287 |
+
= 17.5.0 =
|
288 |
+
* Display comment after user votes
|
289 |
+
* Additional advanced reports
|
290 |
+
= 17.4.0 =
|
291 |
+
* Add new charts to the poll, quiz & survey reports
|
292 |
+
= 17.3.0 =
|
293 |
+
* Display an explanation after voting in polls
|
294 |
+
* Fixed bug with IP blocking
|
295 |
+
= 17.2.0 =
|
296 |
+
* New drop-off report
|
297 |
+
* Async sending of leads
|
298 |
+
= 17.1.0 =
|
299 |
+
* Add CSS override to all content types
|
300 |
+
* Support GTM integrations
|
301 |
+
= 17.0.0 =
|
302 |
+
* Improved quiz/survey reporting capabilities
|
303 |
+
= 16.9.0 =
|
304 |
+
* Added support for pixel tracking
|
305 |
+
= 16.8.0 =
|
306 |
+
* Support for WordPress 4.7
|
307 |
+
= 16.7.0 =
|
308 |
+
* Improve support for high volume lead configurations
|
309 |
+
= 16.6.0 =
|
310 |
+
* Text changes and bug fixes
|
311 |
+
= 16.5.0 =
|
312 |
+
* Various minor fixes & optimizations
|
313 |
+
= 16.4.0 =
|
314 |
+
* Added ad refresh mechanism
|
315 |
+
= 16.3.0 =
|
316 |
+
* Added verification for the placements ids in the connection callback function
|
317 |
+
= 16.2.0 =
|
318 |
+
* Various minor improvements & bug fixes
|
319 |
+
= 16.1.0 =
|
320 |
+
* Added chatbot tool integration
|
321 |
+
= 16.0.0 =
|
322 |
+
* Updated help for new features
|
323 |
+
= 15.9.0 =
|
324 |
+
* Rebranded Quiz name to Outcome, removed the section entry
|
325 |
+
= 15.8.0 =
|
326 |
+
* Resolved an issue with the font
|
327 |
+
= 15.7.0 =
|
328 |
+
* Added support for creating Contact Form Builders, added to plugin name
|
329 |
+
= 15.6.0 =
|
330 |
+
* Added support for creating surveys, renamed plugin
|
331 |
+
= 15.5.0 =
|
332 |
+
* Support WP 4.5
|
333 |
+
= 15.4.0 =
|
334 |
+
* Added the option to add a content section
|
335 |
+
= 15.3.0 =
|
336 |
+
* Modified API path
|
337 |
+
= 15.2.0 =
|
338 |
+
* Various optimizations
|
339 |
+
= 15.1.0 =
|
340 |
+
* Security fix to limit accses to dashboard
|
341 |
+
= 15.0.0 =
|
342 |
+
* Various optimizations
|
343 |
+
= 14.9.0 =
|
344 |
+
* Added the option to embed using a fixed width
|
345 |
+
= 14.8.0 =
|
346 |
+
* Modified sidebar widget management UI
|
347 |
+
* Replaced dashboard top navigation links with more prominent 'my content' link
|
348 |
+
* Added 'list' to the plugin name
|
349 |
+
= 14.7.0 =
|
350 |
+
* Various small optimizations
|
351 |
+
= 14.6.0 =
|
352 |
+
* Various UI modifications - added top navigation links, dashboard UI is now more responsive.
|
353 |
+
= 14.5.0 =
|
354 |
+
* Renamed style to avoid css caching issues
|
355 |
+
= 14.4.0 =
|
356 |
+
* Complete ui revamp
|
357 |
+
* Removed obsolete polls insertion popup and tinymce integration
|
358 |
+
* Handling compatibility issues with other plugin
|
359 |
+
= 14.3.0 =
|
360 |
+
* Various Poll, Survey, Quiz, Slideshow, Form & Story Article improvements
|
361 |
+
= 14.2.0 =
|
362 |
+
* Not showing recommendations by default when embedding Trivia quiz and Personality quiz via the widget shortcode
|
363 |
+
= 14.1.0 =
|
364 |
+
* Added support for disabling FB comments, sharing buttons and recommendations for Trivia quiz and Personality quiz via the widget shortcode
|
365 |
+
= 14.0.0 =
|
366 |
+
* Improved polls & quizzes creation help file
|
367 |
+
* Various small issues
|
368 |
+
= 13.9.0 =
|
369 |
+
* Added creation links for trivia quiz, personality quiz and lists
|
370 |
+
* Added a link for content discovery
|
371 |
+
= 13.8.0 =
|
372 |
+
* Support creating a quiz draft
|
373 |
+
* Added quiz tips and quiz best practices
|
374 |
+
= 13.7.0 =
|
375 |
+
* Better name for widget following feedback
|
376 |
+
= 13.6.0 =
|
377 |
+
* Added personality quizzes
|
378 |
+
= 13.5.0 =
|
379 |
+
* Renamed plugin to better reflect the Contact Form Builder
|
380 |
+
= 13.4.0 =
|
381 |
+
* Added shortcodes for trivia and personality quizzes
|
382 |
+
= 13.3.0 =
|
383 |
+
* Various Trivia Quiz enhancements & fixes
|
384 |
+
* Support for iframe embeds
|
385 |
+
= 13.2.0 =
|
386 |
+
* Support for Basque & Vietnamese languages
|
387 |
+
* Trivia Quiz beta
|
388 |
+
= 13.1.0 =
|
389 |
+
* Added support for quick addition of any language
|
390 |
+
= 13.0.0 =
|
391 |
+
* Added text domain
|
392 |
+
= 12.9.0 =
|
393 |
+
* Poll discovery mechanism improvements
|
394 |
+
* Additional tracking capabilities
|
395 |
+
= 12.8.0 =
|
396 |
+
* Various bug fixes
|
397 |
+
= 12.7.0 =
|
398 |
+
* CSS modifications to better align with desired coding standards. Reverted css file name change.
|
399 |
+
* Minor text changes
|
400 |
+
* Not using PHP 4 Style Constructors any more
|
401 |
+
= 12.6.0 =
|
402 |
+
* Fixed broken links to dashboard
|
403 |
+
* Renamed css file
|
404 |
+
= 12.5.0 =
|
405 |
+
* Modified css structure
|
406 |
+
* Added an option to enable/disable sidebar widget directly via the widget box
|
407 |
+
= 12.4.0 =
|
408 |
+
* Added a control switch for the Sidebar placement
|
409 |
+
= 12.3.0 =
|
410 |
+
* Added Sidebar placement as a widget
|
411 |
+
= 12.2.0 =
|
412 |
+
* Added the option to connect the plugin to Opinion Stage account
|
413 |
+
* Added plug & play integration for fly-out placement
|
414 |
+
* Replaced the option of adding polls to all posts with plug & play article section placement
|
415 |
+
= 12.1.0 =
|
416 |
+
* Additional fix for supporting SSL
|
417 |
+
= 12.0.0 =
|
418 |
+
* Support for SSL when voting with social profiles
|
419 |
+
* revamp of content recommendation mechanism
|
420 |
+
= 11.9.0 =
|
421 |
+
* Poll Placement improvements
|
422 |
+
= 11.8.0 =
|
423 |
+
* Plugin minor changes
|
424 |
+
= 11.7.0 =
|
425 |
+
* Image cropping
|
426 |
+
= 11.6.0 =
|
427 |
+
* New poll recommendation design
|
428 |
+
= 11.5.0 =
|
429 |
+
* resolve conflicts
|
430 |
+
= 11.4.0 =
|
431 |
+
* Fixed compatibility issues
|
432 |
+
= 11.3.0 =
|
433 |
+
* First Trivia poll Poll, Survey, Quiz, Slideshow, Form & Story Article Version
|
434 |
+
= 11.2.0 =
|
435 |
+
* Various functionality & usability improvements
|
436 |
+
= 11.1.0 =
|
437 |
+
* Head-to-Head Poll - new revamped UI (first Poll, Survey, Quiz, Slideshow, Form & Story Article Version)
|
438 |
+
= 11.0.0 =
|
439 |
+
* New look & feel settings
|
440 |
+
= 10.9.0 =
|
441 |
+
* Allow disabling global poll section for specific posts
|
442 |
+
= 10.8.0 =
|
443 |
+
* Texts changes
|
444 |
+
= 10.7.0 =
|
445 |
+
* New options for adding polls or sets to all posts
|
446 |
+
= 10.6.0 =
|
447 |
+
* Poll sets and poll placements - improved interface
|
448 |
+
= 10.5.0 =
|
449 |
+
* Ad integrations (optional) - revamped interface
|
450 |
+
= 10.4.0 =
|
451 |
+
* Added UI support for social logins
|
452 |
+
= 10.3.0 =
|
453 |
+
* New UI for Multiple Choice Polls
|
454 |
+
= 10.2.0 =
|
455 |
+
* Various stability fixes
|
456 |
+
= 10.1.0 =
|
457 |
+
* Post vote actions
|
458 |
+
= 10.0.0 =
|
459 |
+
* Contact Form Builder improvements
|
460 |
+
= 9.9.0 =
|
461 |
+
* Various fixes
|
462 |
+
= 9.8.0 =
|
463 |
+
* Poll discovery first Poll, Survey, Quiz, Slideshow, Form & Story Article Version
|
464 |
+
= 9.7.0 =
|
465 |
+
* Placements first Poll, Survey, Quiz, Slideshow, Form & Story Article Version
|
466 |
+
= 9.6.0 =
|
467 |
+
* Various fixes
|
468 |
+
= 9.5.0 =
|
469 |
+
* Smart containers first Poll, Survey, Quiz, Slideshow, Form & Story Article Version
|
470 |
+
= 9.4.0 =
|
471 |
+
* Allow users to add their own answers
|
472 |
+
* Head2Head polls - mobile optimizations
|
473 |
+
= 9.3.0 =
|
474 |
+
* Support adding custom texts to the interface
|
475 |
+
* Solve minor UI issues
|
476 |
+
= 9.2.0 =
|
477 |
+
* Support displaying ads before showing the results
|
478 |
+
* Support reordering the sides of the poll
|
479 |
+
= 9.1.0 =
|
480 |
+
* Added the option to add Facebook comments to the polls
|
481 |
+
* Improvements to poll creation flow
|
482 |
+
= 9.0.0 =
|
483 |
+
* New poll head-to-head themes
|
484 |
+
* Poll UI optimizations
|
485 |
+
= 8.9.0 =
|
486 |
+
* Various additions and improvements to the poll style studio
|
487 |
+
* Support for wide pages
|
488 |
+
= 8.8.0 =
|
489 |
+
* Improved poll built-in UI styles
|
490 |
+
* New capabilities to poll style studio
|
491 |
+
= 8.7.0 =
|
492 |
+
* Improved poll reports
|
493 |
+
* Various minor improvements
|
494 |
+
= 8.6.0 =
|
495 |
+
* Poll perContact Form Builderance improvements for peek scenarios
|
496 |
+
* New banner type ad unit
|
497 |
+
= 8.5.0 =
|
498 |
+
* Improve process of adding polls to site
|
499 |
+
* Improve returning traffic tracking mechanism
|
500 |
+
= 8.4.0 =
|
501 |
+
* Add first of poll discovery feature
|
502 |
+
* Resolve issue with image addition
|
503 |
+
= 8.3.0 =
|
504 |
+
* Add the option to integrate advertisement into the polls for generating revenue
|
505 |
+
* Optimizations for poll display in mobile environments
|
506 |
+
= 8.2.0 =
|
507 |
+
* Enhancements on contact generation feature
|
508 |
+
* Mobile polls improvements
|
509 |
+
* Additions to default poll settings
|
510 |
+
= 8.1.0 =
|
511 |
+
* Poll discovery - first Poll, Survey, Quiz, Slideshow, Form & Story Article Version
|
512 |
+
* Poll sets improvements
|
513 |
+
* Poll perContact Form Builderance improvements
|
514 |
+
= 8.0.0 =
|
515 |
+
* Added an account report dashboard
|
516 |
+
= 7.9.0 =
|
517 |
+
* Resolved paypal integration issues
|
518 |
+
* Resolved facebook page integration issues
|
519 |
+
= 7.8.0 =
|
520 |
+
* Renamed plugin to better reflect the Contact Form Builder
|
521 |
+
= 7.7.0 =
|
522 |
+
* Fixed 2 poll display issues
|
523 |
+
= 7.6.0 =
|
524 |
+
* Added the ability to insert a shortcode of a set of polls
|
525 |
+
* Added a widget for a container and for a set of polls
|
526 |
+
= 7.5.0 =
|
527 |
+
* Created a widget for easily adding polls to site
|
528 |
+
= 7.4.0 =
|
529 |
+
* Poll Contact Form Builder optimizations
|
530 |
+
= 7.3.0 =
|
531 |
+
* Resolved 2 issues with polls on mobile
|
532 |
+
= 7.2.0 =
|
533 |
+
* Add external integration with 3rd parties via API/XML mechanism
|
534 |
+
= 7.1.0 =
|
535 |
+
* Support collecting emails from poll voters
|
536 |
+
= 7.0.0 =
|
537 |
+
* Fixed potential collisions with other plugins
|
538 |
+
= 6.9.0 =
|
539 |
+
* First of Poll Sets
|
540 |
+
* First of redirect after poll vote
|
541 |
+
* Fix related to languages in poll display
|
542 |
+
= 6.8.0 =
|
543 |
+
* Fix issue with Mobile voting
|
544 |
+
* Fix for iframe embed of poll
|
545 |
+
* Fix for uploading images from computer
|
546 |
+
= 6.7.0 =
|
547 |
+
* Added Czech language & fix for Polish
|
548 |
+
* Add poll images via URL
|
549 |
+
= 6.6.0 =
|
550 |
+
* Improve poll login screen in mobile
|
551 |
+
* Fixes for poll container
|
552 |
+
= 6.5.0 =
|
553 |
+
* Fix issues with voting on iphone/ipad (iOS7)
|
554 |
+
= 6.4.0 =
|
555 |
+
* New poll container
|
556 |
+
* Improvements to the poll optimization dashboard
|
557 |
+
= 6.3.0 =
|
558 |
+
* New graphs for the new reports page
|
559 |
+
* New languages - Romanian, Polish, Indonesian, Danish
|
560 |
+
= 6.2.0 =
|
561 |
+
* New Poll navigation bar
|
562 |
+
* New languages - Dutch, Albanian, Lithuanian
|
563 |
+
= 6.1.0 =
|
564 |
+
* New dashboard and site header
|
565 |
+
* Poll was translated to the following languages - Swedish, Turkish, Chinese, Japanese, Korean
|
566 |
+
= 6.0.0 =
|
567 |
+
* Added the option to login to Opinion Stage with a email/user-name and password combination
|
568 |
+
= 5.9.0 =
|
569 |
+
* Added geographic location filter to poll results dashboard
|
570 |
+
= 5.8.0 =
|
571 |
+
* Added time filter to poll results dashboard
|
572 |
+
* New design for on site poll page
|
573 |
+
* Various improvements & fixes on poll results dashboard
|
574 |
+
= 5.7.0 =
|
575 |
+
* Added the option to block repeat voting in polls by IP
|
576 |
+
= 5.6.0 =
|
577 |
+
* Improvements & fixes on poll studio
|
578 |
+
= 5.5.0 =
|
579 |
+
* Improvements & fixes on poll reporting statistics
|
580 |
+
* Improvements & fixes on poll core flows
|
581 |
+
= 5.4.0 =
|
582 |
+
* Added to the poll results screen the following poll stats: poll engagement stats, poll social stats & poll traffic stats
|
583 |
+
= 5.3.0 =
|
584 |
+
* Add a clone function that allows to easily create multiple polls from the same template
|
585 |
+
* Add the option to schedule when the poll will be closed
|
586 |
+
= 5.2.0 =
|
587 |
+
* Revamp of the poll social sharing settings
|
588 |
+
* revamp of add poll to website screen
|
589 |
+
= 5.1.0 =
|
590 |
+
* Add Facebook comments to polls added to Facebook pages
|
591 |
+
* Add the option to preview the poll in different widths
|
592 |
+
= 5.0.0 =
|
593 |
+
* Improvements to poll style studio
|
594 |
+
* Added option to configure head to head polls not to show results before voting
|
595 |
+
* Added the option to configure all types of polls not to show results to voters
|
596 |
+
* Extended width support of head to head polls to 250-740 pxls
|
597 |
+
= 4.7.1 =
|
598 |
+
* Additional social filters added to the poll interface & poll report
|
599 |
+
* Optimize poll sharing scenarios
|
600 |
+
= 4.7.0 =
|
601 |
+
* Improvements on poll sharing scenarios
|
602 |
+
= 4.6.0 =
|
603 |
+
* Add polls to Facebook pages in 2-clicks feature added
|
604 |
+
* Enhanced poll reporting that includes poll result filters
|
605 |
+
* Brightcove video Contact Form Builderat now supported in the polls
|
606 |
+
= 4.5.5 =
|
607 |
+
* Added support for Google+ poll login
|
608 |
+
* Fixed a presentation issue with polls and https sites
|
609 |
+
* Fixed issue with poll display on Facebook pages
|
610 |
+
= 4.5.0 =
|
611 |
+
* Localize polls for Russian and French
|
612 |
+
* New design for poll social login dialogue
|
613 |
+
* Polls now auto-detect https environments
|
614 |
+
* Various minor fixes and improvements to poll functionality
|
615 |
+
= 4.4.0 =
|
616 |
+
* Polls are now localized for Portuguese
|
617 |
+
* Various minor bug fixes
|
618 |
+
= 4.3.0 =
|
619 |
+
* Multiple sided polls are supported for 150 widths and above
|
620 |
+
* Head-to-head polls are supported for 300 widths and above
|
621 |
+
* Poll style studio was improved to included many more poll style options
|
622 |
+
* New improved poll dashboard
|
623 |
+
* Poll showcase was improved to include more poll examples and detailed explanations
|
624 |
+
= 4.2.0 =
|
625 |
+
* Multi-sided polls support addition of multimedia (video and image)
|
626 |
+
* Both head-to-head and multi-sided polls - Multimedia support auto-fit for different width (e.g mobile environment)
|
627 |
+
= 4.1.0 =
|
628 |
+
* Multi-sided polls support addition of multimedia (video and image)
|
629 |
+
* Both head-to-head and multi-sided polls - Multimedia support auto-fit for different width (e.g mobile environment)
|
630 |
+
= 4.0.0 =
|
631 |
+
* UI improvements for the polls (filters, border etc)
|
632 |
+
= 3.1.0 =
|
633 |
+
* Poll creator can select number of allowed poll answers
|
634 |
+
* FB poll sharing flow optimizations
|
635 |
+
* Poll results can be shown from the Opinion-Stage poll dashboard
|
636 |
+
= 3.0.0 =
|
637 |
+
* New hybrid voting method added to the polls, allowing users to vote either via a social profile or completely anonymously
|
638 |
+
= 2.9.0 =
|
639 |
+
* Added support for anonymous poll voting
|
640 |
+
= 2.8.0 =
|
641 |
+
* Improved editing process of polls by adding a preview to the poll editing screen
|
642 |
+
* Additional layout customizations for polls - hide top bars, add bottom padding
|
643 |
+
* Polls can now be reset
|
644 |
+
= 2.7.0 =
|
645 |
+
* Additional poll languages support (German, Italian, Serbian)
|
646 |
+
* Additional poll customizations for the vote sharing process
|
647 |
+
= 2.6.0 =
|
648 |
+
* Additional customizations options to the poll: Define which poll filters to show, poll social sharing bar removal
|
649 |
+
* Hiding vote option can be enabled / disabled by poll creator
|
650 |
+
= 2.5.0 =
|
651 |
+
* Added support for multiple selection polls
|
652 |
+
= 2.4.0 =
|
653 |
+
* Better support for hiding user votes in the poll
|
654 |
+
* Improved embed options to support both dynamic and constant width for the polls
|
655 |
+
* Polls can now be closed from the Opinion-Stage dashboard
|
656 |
+
= 2.3.0 =
|
657 |
+
* Improved creation flow of polls
|
658 |
+
* Added basic report per poll in the Opinion Stage polls dashboard
|
659 |
+
* Added account report in Opinion-Stage poll dashboard
|
660 |
+
= 2.2.0 =
|
661 |
+
* Polls are now localized for Arabic
|
662 |
+
* Better support for sidebar polls (300px)
|
663 |
+
* Supporting longer side texts in polls
|
664 |
+
= 2.1.0 =
|
665 |
+
* Polls are now displayed properly in mobile environments
|
666 |
+
* Additional built-in poll themes
|
667 |
+
* When clicking on poll participants, the user is now redirected to their social network profile
|
668 |
+
* Polls are now localized for Spanish
|
669 |
+
* You can now set whether you would like to display the number of votes in the poll
|
670 |
+
* Support for election polls (e.g. poll results displayed in points, add a minimum cliff, etc)
|
671 |
+
= 2.0.0 =
|
672 |
+
* Support for multiple sided polls
|
673 |
+
* Added the option to configure the URL in which the poll will be hosted. This will allow to direct additional traffic from social network shares and emails back to the location where the poll is hosted
|
674 |
+
* Added the option to set the order in which the poll results are displayed. You can either set it so that the poll sides are located in the order they were configured or set them so that the side with the most votes is displayed on top
|
675 |
+
= 1.2.0 =
|
676 |
+
* Poll width can now be set, supported poll widths are 400-620 pxl
|
677 |
+
* Poll widget Contact Form Builder optimizations for high traffic polling deployments
|
678 |
+
* Support customized color themes for the polls
|
679 |
+
= 1.1.0 =
|
680 |
+
* Added an optional gender filter to the poll, so that poll results can be viewed by gender
|
681 |
+
* Added a central dashboard for managing all polls
|
682 |
+
* Added the option to display a detailed text description of the poll question to the poll widget
|
683 |
+
* Added the ability to configure which image is shared when sharing the poll or the poll vote on Facebook
|
684 |
+
= 1.0.1 =
|
685 |
+
* Improvements in the poll embed flow to ease insertion of polls
|
686 |
+
= 1.0.0 =
|
687 |
+
* First social poll version
|