PluginProbe
Taboola / trunk
Taboola vtrunk
1.0.4 1.0.5 1.0.6 1.0.8 2.0.1 2.0.2 2.1.0 2.1.1 2.2.2 2.2.3 3.0.0 3.0.1 3.0.2 3.1.0 trunk 1.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.2 1.0.3
← All changes | settings.php +422 -663 2.1.0trunk View file →
@@ -1,5 +1,4 @@
1 -<!-- Latest font-awesome include-->
2 1 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
3 2
4 3 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
5 4 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
@@ -5,442 +4,38 @@
5 4 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
6 5 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
7 6
8 7 <style>
9 -
10 - a {
11 - color: rgb(68,114,196);
12 - text-decoration: none;
13 - font-weight: bold;
14 - }
15 -
16 - .taboola-container {
17 - padding: 20px;
18 - padding-left: 0;
19 - font-size: 14px;
20 - background-color: #FAF9F6;
21 - font-family: Roboto,Lato,Hind -apple-system,Helvetica Neue,sans-serif;
22 - }
23 -
24 - .settings_block {
25 - background-color: #fff;
26 - border: 1px solid #d4d9df;
27 - border-radius: 8px;
28 - margin-top: 10px;
29 - width: 50%;
30 - }
31 -
32 - .settings_block.widget_settings_block { /* Give the widget settings block some extra space at the end */
33 - padding-bottom: 15px;
34 - }
35 -
36 - .settings_block input {
37 - border-color: #ccc; /* Most of the inputs are styled via jQuery. This is for any others - e.g. #publisher-id */
38 - }
39 -
40 - .publisher_welcome_massage{
41 - float: right;
42 - width: 36%;
43 - padding: 20px 10px 10px 0px;
44 - margin: 40px 6% 0 0;
45 - background: #FFFACD;
46 - border: 1px solid #d4d9df;
47 - border-radius: 20px;
48 - }
49 -
50 - .switch_style{
51 - margin : 10px 10px 20px 10px;
52 - }
53 -
54 - .style_box1, .pub_id{
55 - padding: 10px 10px 0px 20px;
56 - }
57 -
58 - .statement{
59 - padding: 10px 10px 10px 20px;
60 - }
61 -
62 - .widget_below, .widget_below_mid, .widget_below_mid_selector, .widget_below_home, .widget_below_home_selector{
63 - width: 50%;
64 - float: left;
65 - padding: 5px 0px 0px 20px;
66 - }
67 -
68 - .mode_style, .mode_style_mid, .mode_style_home, .mode_style_home_selector{
69 - width: 50%;
70 - padding: 0px 0px 3px 20px;
71 - float:left;
72 - }
73 -
74 - .placement_style, .placement_style_mid, .placement_style_home_occurrence,.placement_style_home {
75 - padding: 0px 0px 8px 0px;
76 - width: 50%;
77 - float: right;
78 - }
79 -
80 - .widget_below_mid_selector{
81 - padding: 8px 0px 0px 0px;
82 - }
83 -
84 - .placement_below_mid_occurrence,.mode_style_mid_selector {
85 - padding: 0px 0px 8px 20px;
86 - }
87 -
88 - .heading_mid_home{
89 - padding: 20px 0px 8px 20px;
90 - }
91 -
92 - #mid_occurrence_div, #mid_css_selector_div {
93 - width: 50%;
94 - float: left;
95 - margin: 19px 0px 0px 0px;
96 - }
97 -
98 - /* slider button CSS */
99 -
100 - .switch {
101 - position: relative;
102 - display: inline-block;
103 - width: 45px;
104 - height: 20px;
105 - float: right;
106 - }
107 -
108 - .switch input {
109 - opacity: 0;
110 - width: 0;
111 - height: 0;
112 - }
113 -
114 - .slider {
115 - position: absolute;
116 - cursor: pointer;
117 - top: 0;
118 - left: 0;
119 - right: -1px;
120 - bottom: 0;
121 - background-color: #ccc;
122 - -webkit-transition: .4s;
123 - transition: .4s;
124 - }
125 -
126 - .slider:before {
127 - position: absolute;
128 - content: "";
129 - height: 18px;
130 - width: 18px;
131 - left: 1px;
132 - bottom: 1px;
133 - background-color: white;
134 - -webkit-transition: .4s;
135 - transition: .4s;
136 - }
137 -
138 - input:checked + .slider {
139 - background-color: #0f4c81;
140 - }
141 -
142 - input:focus + .slider {
143 - box-shadow: 0 0 1px #0f4c81;
144 - }
145 -
146 - input:checked + .slider:before {
147 - -webkit-transform: translateX(26px);
148 - -ms-transform: translateX(26px);
149 - transform: translateX(26px);
150 - }
151 -
152 - /* Rounded sliders */
153 -
154 - .slider.round {
155 - border-radius: 34px;
156 - }
157 -
158 - .slider.round:before {
159 - border-radius: 50%;
160 - }
161 -
162 - /* slider button CSS */
163 -
164 - .request_link {
165 - float: right;
166 - margin-right: 10px;
167 - line-height: 26px;
168 - }
169 -
170 -/* hide and position tooltip */
171 -
172 - .tooltip div{
173 - visibility: hidden;
174 - width: auto;
175 - display: inline-block;
176 - background: #0f4c81;
177 - color: #ffffff;
178 - font-weight: normal;
179 - font-size: 12px;
180 - border-radius: 6px;
181 - padding: 5px;
182 - margin-left: 5px;
183 - max-width: 350px;
184 - position: absolute;
185 - z-index: 999;
186 - transition-delay: 0.25s;
187 - }
188 -
189 - .tooltip div a:hover{
190 - text-decoration: underline;
191 - }
192 -
193 - .tooltip{
194 - opacity: 1 !important;
195 - font-size: 13px !important;
196 - display: contents !important;
197 - }
198 -
199 - .tooltip:hover div{
200 - visibility: visible;
201 - transition-delay: 0.5s;
202 - }
203 -
204 - .tooltip div a{
205 - text-decoration: none;
206 - font-weight: bold;
207 - color: #fff;
208 - }
209 -
210 - .label-success {
211 - background: #a4fba6 !important;
212 - border: 1px solid #d2f2d4;
213 - border-radius: 10px;
214 - padding: 10px 30px 20px 10px;
215 - font-size: 14px;
216 - display: block;
217 - margin-top: 10px;
218 - color: green;
219 - width: 50%;
220 - }
221 - .label-error {
222 - background: #ffbaba;
223 - border: 1px solid #ffbaba;
224 - border-radius: 10px;
225 - padding: 10px 30px 20px 10px;
226 - font-size: 14px;
227 - display: block;
228 - margin-top: 10px;
229 - color: red;
230 - width: 50%;
231 - }
232 -
233 - .label-error ul {
234 - list-style-position: inside;
235 - list-style-type: disc;
236 - text-indent: 2em;
237 - }
238 -
239 - .label-error p {
240 - font-size: 14px;
241 - }
242 -
243 - .change_button{
244 - float: right;
245 - }
246 -
247 - .apply_button{
248 - /* margin-top: 20px; */
249 - background-color: #0f4c81;
250 - color: #fff;
251 - padding: 0.8rem 1rem;
252 - border-radius: 7px;
253 - border: transparent;
254 - float: right;
255 - }
256 -
257 - .apply_button:hover {
258 - background-color: #1261A0;
259 - cursor: pointer;
260 - }
261 -
262 - .helpTooltip__icon___1XWGN,
263 - .helpTooltip__icon___1XWGN_read{
264 - color: #b8c1ca;
265 - width: 1em;
266 - height: 1em;
267 - margin: 4px;
268 - }
269 -
270 - .helpTooltip__icon___1XWGN_read{
271 - margin-top: 4px;
272 - }
273 -
274 - .helpTooltip__icon___1XWGN_first{
275 - color: #b8c1ca;
276 - width: 1em;
277 - height: 1em;
278 - }
279 -
280 - .checkbox_read{
281 - padding: 0px 0px 5px 20px;
282 - float: left;
283 - }
284 -
285 - label:hover{
286 - cursor: default;
287 - }
288 -
289 - ::placeholder{
290 - color: #DEDEDE;
291 - }
292 -
293 - .widget_h2,.general_h2{
294 - font-size: 18px;
295 - font-weight: 500;
296 - }
297 -
298 - .list_l1{
299 - border-top: 1px solid #DEDEDE;
300 - margin: 30px 20px 0px 0px;
301 - margin-left: 14%;
302 - }
303 -
304 - .theme_image{
305 - width: 50%;
306 - }
307 -
308 - .welcome_heading{
309 - margin-left: 8%;
310 - font-size: 1.5em;
311 - }
312 -
313 - .first_p,
314 - .second_p{
315 - margin-left: 14%;
316 - font-size: 14px;
317 - }
318 -
319 - .list_l1 p{
320 - font-size: 13px;
321 - }
322 -
323 - input#publisher-id,
324 - input#first_bc_placement,
325 - input#mid_placement,
326 - input#home_placement{
327 - width: 36%;
328 - }
329 -
330 - input#first_bc_widget_id,
331 - input#mid_widget_id,
332 - input#mid_location_string,
333 - input#home_widget_id,
334 - input#home_location_string{
335 - width: 77%;
336 - }
337 -
338 - label{
339 - font-weight: normal !important;
340 - }
341 -
342 - label#pub_id{
343 - color: #000000;
344 - }
345 -
346 - input#out_of_content_enabled {
347 - height: 16px;
348 - width: 16px;
349 - }
350 -
351 - input[type=checkbox]:checked::before {
352 - width: 1.8rem !important;
353 - }
354 -
355 - input[type=checkbox]:focus {
356 - outline: none !important;
357 - outline-offset: 0px !important;
358 - }
359 -
360 - input[type=checkbox]{
361 - margin: -5px 0 0;
362 - }
363 -
364 - #homepage{
365 - display: none;
366 - }
367 -
368 - #show-advanced-settings{
369 - text-decoration: none;
370 - color: #666666;
371 - margin-top: 5px;
372 - cursor: pointer;
373 - float: left;
374 - width: 50%;
375 - font-family: Roboto, Lato, "Hind -apple-system", "Helvetica Neue", sans-serif;
376 - font-style: italic;
377 - }
378 -
379 - #advanced-settings-main{
380 - margin: 10px 0px 0px 10px;
381 - width: 49%;
382 - }
383 -
384 - div#mid_article {
385 - padding-bottom: 100px;
386 - }
387 -
388 - #mid_css_selector_div{
389 - display: none;
390 - }
391 -
392 - input.highlight {
393 - border: 1px solid orange !important;
394 - }
395 -
396 - #rightrail-banner{
397 - border: 1px solid #d4d9df;
398 - border-radius: 10px;
399 - background: rgba(51, 125, 247, 0.1);
400 - padding: 10px;
401 -
402 - width: 95%;
403 - margin: auto;
404 - /* color: #0f4c81; */
405 - }
406 -
407 - #right-rail{
408 - padding-top: 10px;
409 - }
410 -
411 - hr {
412 - border-top: 1px solid lightgray;
413 - }
414 -
8 + <?php include 'css/main.css'; ?>
415 9 </style>
416 10
417 -<?php
418 -
419 -// $short_version =strlen(TABOOLA_PLUGIN_VERSION) == 5 ? substr(TABOOLA_PLUGIN_VERSION,0,3) : ""; // E.g. '2.1.0' => '2.1' (else '')
420 -
421 -?>
422 -
423 - <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
424 - <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> -->
425 -
426 -
427 11 <div class="taboola-container">
428 12 <div class="theme_image">
429 13 <img src='<?php echo $this->plugin_url.'img/taboola.png' ?>' style='width:150px;'/>
430 14 </div>
431 15
432 - <h2 style="font-size:1.7em;">Taboola WordPress Plugin 2</h2>
16 + <h2 style="font-size:1.7em;">Taboola WordPress Plugin</h2>
433 17
434 -<!-- errors/success message -->
18 + <h2 class="nav-tab-wrapper">
19 + <a href="#tab1" class="nav-tab" id="tab1-link">Web</a>
20 + <a href="#tab2" class="nav-tab" id="tab2-link">Web Push</a>
21 + </h2>
435 22
436 - <?php
437 - if($_SERVER['REQUEST_METHOD'] == 'POST' && count($taboola_errors) == 0){
23 +<?php
24 + if($_SERVER['REQUEST_METHOD'] == 'POST' && count($taboola_errors) == 0 && $taboola_save_error == ''){
438 25 echo "<div class='label-success'>";
439 26 echo "<h3 style='color:green;'>Changes applied!</h3>";
440 27 echo "<span>Verify the new changes by browsing to your site.</span>";
441 28 echo "</div>";
442 29 }
30 +
31 + if($taboola_save_error != ''){
32 + echo "<div class='label-error'>";
33 + echo "<h3 style='color:red;'>Settings were not saved</h3>";
34 + echo "<p>".esc_html($taboola_save_error)."</p>";
35 + echo "<p><b>All values</b> have been reverted to the last successful save.</p>";
36 + echo "</div>";
37 + }
443 38
444 39 if(count($taboola_errors) > 0){
445 40 echo "<div class='label-error'>";
446 41 echo "<h3 style='color:red;'>Missing or incorrect values</h3>";
@@ -457,33 +52,50 @@
457 52 ?>
458 53
459 54 <script>
460 55 function setEnabledDisabled(divID, chkToggle) {
461 - /*
462 - JS function for form.
463 - Enables/disables fields for the given section ('divID'), depending on whether 'chkToggle' is checked.
464 - */
465 -
466 56 var applyColor = (chkToggle.checked ? "#000" : "#666");
467 -
468 - // Set all labels in that section ('divID') to the relevant color.
469 57 $(divID).find("label").css("color", applyColor);
470 -
471 - // Disable (/enable) all input fields in that section ('divID'), except for 'chkToggle'.
472 - // Once done, apply a gray border color.
473 58 $(divID).find("input").not("#" + chkToggle.id).prop("disabled", !chkToggle.checked).css("borderColor", "#ccc");
474 59 $(divID).find("select").not("#" + chkToggle.id).prop("disabled", !chkToggle.checked).css("borderColor", "#ccc");
60 + }
61 +</script>
475 62
63 +<script>
64 +jQuery(document).ready(function($) {
65 + function showTab(tabId) {
66 + $('.nav-tab').removeClass('nav-tab-active');
67 + $('.tab-content').removeClass('active').hide();
68 +
69 + $('a[href="' + tabId + '"]').addClass('nav-tab-active');
70 + $(tabId).addClass('active').show();
476 71 }
72 +
73 + $('.nav-tab').click(function(e) {
74 + e.preventDefault();
75 + var tabId = $(this).attr('href');
76 + window.location.hash = tabId;
77 + $('#active_tab').val(tabId);
78 + showTab(tabId);
79 + });
80 +
81 + var hash = window.location.hash;
82 + if (hash) {
83 + showTab(hash);
84 + $('#active_tab').val(hash);
85 + } else {
86 + showTab('#tab1');
87 + }
88 +
89 + $('form').submit(function() {
90 + var activeTab = $('.nav-tab.nav-tab-active').attr('href');
91 + $('#active_tab').val(activeTab);
92 + });
93 +});
477 94 </script>
478 95
479 96 <script>
480 97 $(document).ready(function(){
481 - // On page load:
482 - if ($('#mid_paragraph_ui_mode').val() == 'Other') {
483 - $("#mid_css_selector_div").show();
484 - }
485 -
486 98 if ($('#home_enabled').prop("checked") === true) {
487 99 $("#homepage").show();
488 100 var ad = $('#show-advanced-settings');
489 101 ad.text("<< Hide advanced settings");
@@ -492,9 +104,8 @@
492 104 </script>
493 105
494 106 <script>
495 107 $(document).ready(function(){
496 - // On clicking 'Advanced settings'
497 108 $("#show-advanced-settings").click(function() {
498 109 $("#homepage").slideToggle("fast");
499 110 var ad = $('#show-advanced-settings');
500 111 ad.text() == "Show advanced settings >>" ? ad.text("<< Hide advanced settings") : ad.text("Show advanced settings >>");
@@ -501,44 +112,10 @@
501 112 });
502 113 });
503 114 </script>
504 115
505 -
506 -<script>
507 -$(document).ready(function(){
508 -
509 - // On selecting an item in the dropdown:
510 - $('#mid_paragraph_ui_mode').on('change', function(e){
511 - e.preventDefault();
512 - if ( this.value == 'Other')
513 - {
514 - $("#mid_css_selector_div").show();
515 -
516 - // Highlight relevant fields:
517 - $("#mid_location_string, #mid_occurrence").addClass('highlight');
518 - setTimeout(() => $("#mid_occurrence, #mid_location_string").removeClass('highlight'), 1500);
519 -
520 - }
521 - else
522 - {
523 - $("#mid_location_string").val("p"); // Set it back to the default value of 'p'
524 - $("#mid_css_selector_div").hide();
525 -
526 - // Highlight the 'occurrence' field:
527 - $("#mid_occurrence").addClass('highlight');
528 - setTimeout(() => $("#mid_occurrence").removeClass('highlight'), 1000);
529 - }
530 - });
531 -
532 -});
533 -</script>
534 -
535 -
536 -
537 -<!-- Welcome Massage -->
538 -
539 - <div class="publisher_welcome_massage">
540 - <h2 class="welcome_heading">Welcome to Taboola WordPress Plugin 2!</h2>
116 +<div class="publisher_welcome_massage">
117 + <h2 class="welcome_heading">Welcome to Taboola WordPress Plugin</h2>
541 118 <p class="first_p">For detailed instructions, see the <a href="https://developers.taboola.com/web-integrations/docs/wordpress-plugin-managing-placements" target='_blank'>Taboola Dev Center.</a></p>
542 119 <p class="second_p"><b>Stuck? Need a hand?</b> Feel free to reach out via our <a href="https://developers.taboola.com/web-integrations/discuss" target='_blank'>Online Community</a>.</p>
543 120 <div class="list_l1">
544 121 <p>Usage of this plugin is subject to <b>Taboola's</b> <a href="https://www.taboola.com/policies/platform-terms-of-service" target='_blank'>terms of service.</a></p>
@@ -544,161 +121,266 @@
544 121 <p>Usage of this plugin is subject to <b>Taboola's</b> <a href="https://www.taboola.com/policies/platform-terms-of-service" target='_blank'>terms of service.</a></p>
545 122 </div>
546 123 </div>
547 124
548 -<!-- Welcome Massage-->
549 -
550 - <form method="POST">
551 -
552 - <?php
553 - // Generate a nonce and pass it via a hidden field
125 +<form method="POST">
126 +<?php
554 127 $my_nonce = wp_create_nonce( 'my_plugin_update_field_action' );
555 - ?>
128 +?>
129 +<input type="hidden" name="my_plugin_nonce" value="<?php echo esc_attr( $my_nonce ); ?>"/>
130 +<input type="hidden" id="active_tab" name="active_tab" value="#tab1"/>
556 131
557 - <input type="hidden" name="my_plugin_nonce" value="<?php echo esc_attr( $my_nonce ); ?>"/>
558 132
559 - <h2 class="general_h2">General Settings</h2>
560 -
561 - <div class="settings_block">
562 - <div class="style_box1"><label id="pub_id">Publisher ID :</label>
563 - <div class="tooltip">
564 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
565 - <!-- <img class="helpTooltip__icon___1XWGN" src='<?php echo $this->plugin_url.'img/tooltip_image.svg' ?>'/> -->
566 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN_first">
567 - <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
568 - </g>
569 - </svg>
570 - <!-- <div id="arrow" ></div> -->
571 - <div>Your Publisher ID, as provided by Taboola.</div>
133 +<div id="tab1" class="tab-content">
134 + <h2 class="general_h2">General Settings</h2>
135 +
136 + <div class="settings_block">
137 + <div class="style_box1"><label id="pub_id">Publisher ID :</label>
138 + <div class="tooltip">
139 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN_first">
140 + <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
141 + </g>
142 + </svg>
143 + <div>Your Publisher ID, as provided by Taboola.</div>
144 + </div>
572 145 </div>
146 + <div class="pub_id">
147 + <input id="publisher-id" type="text" name="publisher_id" placeholder="publisher" value="<?php echo !empty($settings->publisher_id) ? strip_tags($settings->publisher_id) : '' ?>"/>
148 + </div>
149 + <div class="statement">
150 + <label style="color: #000000; padding-">
151 + Don't have an account with taboola? <a href='http://taboola.com/contact' target='_blank'>Contact us</a> to get started.
152 + </label>
153 + </div>
573 154 </div>
574 - <div class="pub_id">
575 - <input id="publisher-id" type="text" name="publisher_id" placeholder="publisher" value="<?php echo !empty($settings->publisher_id) ? strip_tags($settings->publisher_id) : '' ?>"/>
155 +
156 + <h2 class="widget_h2">Taboola Units</h2>
157 + <div id="below_article" class="settings_block widget_settings_block">
158 + <div class="switch_style">
159 + <label class="switch">
160 + <input id="first_bc_enabled" type="checkbox" <?php echo !empty($settings->first_bc_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#below_article', this)" name="first_bc_enabled" />
161 + <span class="slider round"></span>
162 + </label>
163 + <b style="font-size:15px;">Below-article</b>
576 164 </div>
577 - <div class="statement">
578 - <label style="color: #000000; padding-">
579 - Don't have an account with taboola? <a href='http://taboola.com/contact' target='_blank'>Contact us</a> to get started.
580 - </label>
165 + <div class="label_below">
166 + <div class="mode_style">
167 + <label id="first_bc_widget_id_label" style="float:left;">Mode (Widget ID):</label>
168 + <div class="tooltip">
169 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
170 + <g fill="none" fill-rule="evenodd">
171 + <path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
172 + </g>
173 + </svg>
174 + <div>Your <i>below-article</i> Mode (Widget ID), as provided by Taboola. </div>
175 + </div>
176 + </div>
177 + <div class="placement_style">
178 + <label id="first_bc_placement_label" style="float:left;">Placement Name:</label>
179 + <div class='tooltip'>
180 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
181 + <g fill="none" fill-rule="evenodd">
182 + <path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
183 + </g>
184 + </svg>
185 + <div>Your <i>below-article</i> Placement Name, as provided by Taboola. <br>
186 + <br> When upgrading from v1, fill in 'below-article'. <br>
187 + <br> For more information, reach out via our <a href="https://developers.taboola.com/web-integrations/discuss" target='_blank'>Online Community</a>, or contact Taboola Support.
188 + </div>
189 + </div>
190 + </div>
581 191 </div>
582 - </div>
583 -
584 -
585 -<!-- Below Article Widget -->
586 - <h2 class="widget_h2">Taboola Units</h2>
587 - <div id="below_article" class="settings_block widget_settings_block">
588 - <div class="switch_style">
589 - <label class="switch">
590 - <input id="first_bc_enabled" type="checkbox" <?php echo !empty($settings->first_bc_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#below_article', this)" name="first_bc_enabled" />
591 - <span class="slider round"></span>
592 - </label>
593 - <b style="font-size:15px;">Below-article</b>
594 - </div>
595 - <div class="label_below">
596 - <div class="mode_style">
597 - <label id="first_bc_widget_id_label" style="float:left;">Mode (Widget ID):</label>
598 - <div class="tooltip">
599 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
600 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
601 - <g fill="none" fill-rule="evenodd">
602 - <path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
603 - </g>
604 - </svg>
605 - <div>Your <i>below-article</i> Mode (Widget ID), as provided by Taboola. </div>
606 - </div>
192 + <div class="input_below">
193 + <div class="widget_below">
194 + <input id="first_bc_widget_id" type="text" value="<?php echo !empty($settings->first_bc_widget_id) ? strip_tags($settings->first_bc_widget_id) : "" ?>" name="first_bc_widget_id" placeholder="Widget ID" />
195 + </div>
196 + <div class="placement_below">
197 + <input type="text" id="first_bc_placement" value="<?php echo !empty($settings->first_bc_placement) ? strip_tags($settings->first_bc_placement) : "" ?>" name="first_bc_placement" placeholder="Placement Name" />
198 + </div>
607 199 </div>
608 - <div class="placement_style">
609 - <label id="first_bc_placement_label" style="float:left;">Placement Name:</label>
610 - <div class='tooltip'>
611 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
612 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
613 - <g fill="none" fill-rule="evenodd">
200 + <br />
201 + <div class='location_section'>
202 + <div class='checkbox_read'>
203 + <input id="out_of_content_enabled" type="checkbox" <?php echo !empty($settings->out_of_content_enabled) ? "checked='checked'" : "" ?> name="out_of_content_enabled" />
204 + <label id="out_of_content_enabled_label">Place the feed/widget just after the article container (required for <b>Read More</b>)</label>
205 + </div>
206 + <div class='tooltip'>
207 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN_read">
208 + <g fill="none" fill-rule="evenodd">
614 209 <path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
615 - </g>
210 + </g>
616 211 </svg>
617 - <div>Your <i>below-article</i> Placement Name, as provided by Taboola. <br>
618 - <br> When upgrading from v1, fill in 'below-article'. <br>
619 - <br> For more information, reach out via our <a href="https://developers.taboola.com/web-integrations/discuss" target='_blank'>Online Community</a>, or contact Taboola Support.
212 + <div>
213 + Required in order for Taboola to activate <i>Read More</i>.<br><br>
214 + Read More buttons can boost audience engagement significantly, especially on mobile devices.<br><br>
215 + For more information, see the <a href="https://developers.taboola.com/web-integrations/docs/wordpress-plugin-managing-placements#below-article-widget" target='_blank'>Taboola Dev Center</a>.</div>
620 216 </div>
621 - </div>
622 217 </div>
623 - </div>
624 - <div class="input_below">
625 - <div class="widget_below">
626 - <input id="first_bc_widget_id" type="text" value="<?php echo !empty($settings->first_bc_widget_id) ? strip_tags($settings->first_bc_widget_id) : "" ?>" name="first_bc_widget_id" placeholder="Widget ID" />
627 218 </div>
628 - <div class="placement_below">
629 - <input type="text" id="first_bc_placement" value="<?php echo !empty($settings->first_bc_placement) ? strip_tags($settings->first_bc_placement) : "" ?>" name="first_bc_placement" placeholder="Placement Name" />
630 - </div>
631 - </div>
632 219
633 - <!-- Below Article Widget -->
634 - <!-- Advanced Settings -->
635 - <br />
636 - <div class='location_section'>
637 - <div class='checkbox_read'>
638 - <input id="out_of_content_enabled" type="checkbox" <?php echo !empty($settings->out_of_content_enabled) ? "checked='checked'" : "" ?> name="out_of_content_enabled" />
639 - <label id="out_of_content_enabled_label">Place the feed/widget just after the article container (required for <b>Read More</b>)</label>
640 - </div>
220 + <div id="mid_article" class="settings_block widget_settings_block">
221 + <div class="switch_style">
222 + <label class="switch">
223 + <input id="mid_enabled" type="checkbox" <?php echo !empty($settings->mid_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#mid_article', this)" name="mid_enabled"/>
224 + <span class="slider round"></span>
225 + </label>
226 + <b style="font-size:15px;">Mid-article</b>
227 + </div>
228 +
229 + <div id="mid-article-widgets-container">
230 + <?php
231 + $mid_widgets = !empty($settings->mid_widgets) ? json_decode($settings->mid_widgets) : array();
232 + if (empty($mid_widgets)) {
233 + $mid_widgets = array(new stdClass());
234 + }
235 + foreach ($mid_widgets as $index => $widget) {
236 + ?>
237 + <div class="mid-article-widget" style="border: 1px solid #ddd; padding: 10px; margin-top: 10px; border-radius: 5px;">
238 + <h4 style="font-size: 14px; font-weight: bold;">Mid-Article Widget #<?php echo $index + 1; ?></h4>
239 + <div style="display: flex; flex-wrap: wrap;">
240 + <div style="flex: 1; min-width: 250px; padding-right: 10px;">
241 + <label>Mode (Widget ID):</label>
242 + <input class="widefat" type="text" name="mid_widget_id[]" value="<?php echo esc_attr($widget->widget_id ?? ''); ?>" placeholder="thumbnails-mid1" />
243 + </div>
244 + <div style="flex: 1; min-width: 250px;">
245 + <label>Placement Name:</label>
246 + <input class="widefat" type="text" name="mid_placement[]" value="<?php echo esc_attr($widget->placement ?? ''); ?>" placeholder="Mid Article Thumbnails" />
247 + </div>
248 + </div>
249 + <div class='heading_mid_home'><label style="float:left;">Position the widget immediately below the element:</label>
641 250 <div class='tooltip'>
642 - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN_read">
643 - <g fill="none" fill-rule="evenodd">
644 - <path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
645 - </g>
646 - </svg>
647 - <div>
648 - Required in order for Taboola to activate <i>Read More</i>.<br><br>
649 - Read More buttons can boost audience engagement significantly, especially on mobile devices.<br><br>
650 - For more information, see the <a href="https://developers.taboola.com/web-integrations/docs/wordpress-plugin-managing-placements#below-article-widget" target='_blank'>Taboola Dev Center</a>.</div>
251 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
252 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
253 + <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
254 + </g>
255 + </svg>
256 + <div>The widget will be placed <i>just beneath</i> this element.<br><br>
257 + To target an element, 2 pieces of information are needed:<br><br>
258 + i) A CSS selector - e.g. <i>p</i> (for paragraph).<br>
259 + ii) An occurrence - e.g. 1st, 2nd, 3rd, etc.<br><br>
260 + For more information, see the <a href="https://developers.taboola.com/web-integrations/docs/wordpress-plugin-managing-placements" target='_blank'>Taboola Dev Center</a>.
261 + </div>
651 262 </div>
652 - </div>
653 263 </div>
654 -<!-- Advanced Settings -->
655 264
656 -<!-- Mid Article Widget -->
265 + <div style="display: flex; flex-wrap: wrap; margin-top: 10px;">
266 + <div style="flex: 1; min-width: 200px; padding-right: 10px;">
267 + <label>Position:</label>
268 + <select class="widefat mid-widget-type-selector" name="mid_paragraph_ui_mode[]">
269 + <option value="Paragraph" <?php echo !isset($widget->location_string) || $widget->location_string === 'p' ? 'selected' : ''; ?>>Paragraph</option>
270 + <option value="Other" <?php echo isset($widget->location_string) && $widget->location_string !== 'p' ? 'selected' : ''; ?>>Other (Custom)</option>
271 + </select>
272 + </div>
273 + <div style="flex: 1; min-width: 150px; padding-right: 10px;" class="mid-css-selector-container">
274 + <label>CSS selector:</label>
275 + <input class="widefat" type="text" name="mid_location_string[]" value="<?php echo esc_attr($widget->location_string ?? 'p'); ?>" />
276 + </div>
277 + <div style="flex: 1; min-width: 150px;">
278 + <label>Paragraph/Element Number:</label>
279 + <input class="widefat" type="number" name="mid_location_string_occurrence[]" value="<?php echo esc_attr($widget->occurrence ?? '1'); ?>" min="1" style="width:80px;">
280 + </div>
281 + </div>
282 + <button type="button" class="button remove-mid-widget" style="margin-top: 10px;">Remove Widget</button>
283 + </div>
284 + <?php } ?>
285 + </div>
286 + <button type="button" id="add-mid-widget" class="button button-primary" style="margin-top: 15px;">+ Add Another Mid-Article Widget</button>
287 + </div>
288 + <div id="right-rail" class="settings_block widget_settings_block">
289 + <label id="right-rail-label"><b style="font-size:15px;margin-left: 10px;">Right-rail (sidebar)</b> </label>
290 + <div style="font-size:14px;margin: 5px 10px 10px 10px;">You can insert a <b>Taboola</b> unit in your website <b>sidebar</b> (if your <b>WordPress</b> theme provides one):</div>
657 291
658 -<div id="mid_article" class="settings_block widget_settings_block">
659 - <div class="switch_style">
660 - <label class="switch">
661 - <input id="mid_enabled" type="checkbox" <?php echo !empty($settings->mid_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#mid_article', this)" name="mid_enabled"/>
662 - <span class="slider round"></span>
663 - </label>
664 - <b style="font-size:15px;">Mid-article</b>
665 - </div>
292 + <div id="rightrail-banner">
293 + 1. In the <b>sidebar menu</b> (<i>left</i>) select <b>Appearance</b> > <b>Widgets</b>, or click <a href="widgets.php" target="_blank">here</a> to open the <b>Widgets</b> panel. </br>
294 + 2. Click on the <span style="font-size: 18px; font-weight:bold">+</span> icon (<i>top, left</i>) and type in <b>"Taboola".</b></br>
295 + 3. Drag the <b>Taboola</b> widget to the desired position in the sidebar (<i>right</i>).</br>
296 + 4. Enter the <b>Widget ID (Mode)</b>, as provided by <b>Taboola</b>.</br>
297 + 5. Click on <b>Update</b> (<i>top, right</i>) to save your changes.</br>
298 + 6. Browse to your website and verify that the newly added unit displays correctly.</br>
299 + <hr>
300 + To <b>watch a demo</b> of the above steps, see our <a href="https://developers.taboola.com/web-integrations/docs/sidebar-widget" target="_blank">online docs</a>.
301 + </div>
302 + </div>
303 +<div id="category_widget" class="settings_block widget_settings_block">
304 + <div class="switch_style">
305 + <label class="switch">
306 + <input id="category_enabled"
307 + type="checkbox"
308 + <?php echo !empty($settings->category_enabled) ? "checked='checked'" : "" ?>
309 + onclick="setEnabledDisabled('#category_widget', this)"
310 + name="category_enabled"/>
311 + <span class="slider round"></span>
312 + </label>
313 + <b style="font-size:15px;float: left;">Category (Section Page)</b>
314 + <div class='tooltip'>
315 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
316 + <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
317 + </g>
318 + </svg>
319 + <div>Settings will be applied to all 'Category/Section' pages on your site.</div>
320 + </div>
321 + </div>
666 322
667 - <div>
668 - <div class="mode_style_mid"><label id="mid_widget_id_label" style="float:left;">Mode (Widget ID):</label>
323 + <div class="label_below">
324 +
325 + <div class="mode_style">
326 + <label id="category_widget_id_label" style="float:left;">Mode (Widget ID):</label>
669 327 <div class='tooltip'>
670 328 <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
671 329 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
672 330 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
673 - </g>
331 + </g>
674 332 </svg>
675 - <div>Your <i>mid-article</i> Mode (Widget ID), as provided by Taboola.</div>
333 + <div>Your <i>category</i> Mode (Widget ID), as provided by Taboola.</div>
676 334 </div>
677 335 </div>
678 - <div class="placement_style_mid"><label id="mid_placement_label" style="float:left;">Placement Name:</label>
336 +
337 + <div class="placement_style"><label id="category_placement_label" style="float:left;">Placement Name:</label>
679 338 <div class='tooltip'>
680 339 <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
681 340 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
682 341 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
683 - </g>
342 + </g>
684 343 </svg>
685 - <div>Your <i>mid-article</i> Placement Name, as provided by Taboola.</div>
344 + <div>Your <i>category</i> Placement Name, as provided by Taboola.</div>
686 345 </div>
687 346 </div>
688 347 </div>
689 - <div>
690 - <div class="widget_below_mid">
691 - <input id="mid_widget_id" type="text" value="<?php echo !empty($settings->mid_widget_id) ? strip_tags($settings->mid_widget_id) : "" ?>" name="mid_widget_id" placeholder="Widget ID" />
348 +
349 +
350 + <div class="input_below">
351 + <div class="widget_below">
352 + <input id="category_widget_id" type="text"
353 + value="<?php echo !empty($settings->category_widget_id) ? strip_tags($settings->category_widget_id) : '' ?>"
354 + name="category_widget_id" placeholder="Widget ID"/>
355 + </div>
356 + <div class="placement_below">
357 + <input id="category_placement" type="text"
358 + value="<?php echo !empty($settings->category_placement) ? strip_tags($settings->category_placement) : '' ?>"
359 + name="category_placement" placeholder="Placement Name"/>
360 + </div>
361 + </div>
362 +
363 + <div class='heading_mid_home'><label style="float:left;">Position the widget immediately below the element:</label>
364 + <div class='tooltip'>
365 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
366 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
367 + <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
368 + </g>
369 + </svg>
370 + <div>The widget will be placed <i>just beneath</i> this element.<br><br>
371 + To target an element, 2 pieces of information are needed:<br><br>
372 + i) A CSS selector - e.g. <i>p</i> (for paragraph).<br>
373 + ii) An occurrence - e.g. 1st, 2nd, 3rd, etc.<br><br>
374 + For more information, see the <a href="https://developers.taboola.com/web-integrations/docs/wordpress-plugin-managing-placements" target='_blank'>Taboola Dev Center</a>.
692 375 </div>
693 - <div class="placement_below_mid">
694 - <input id = "mid_placement" type="text" value="<?php echo !empty($settings->mid_placement) ? strip_tags($settings->mid_placement) : "" ?>" name="mid_placement" placeholder="Placement Name" />
695 - </div>
696 376 </div>
377 + </div>
697 378
698 - <div id="mid_occurrence_div">
699 - <div class="mode_style_mid_selector"><label id="mid_location_string_label" style="float:left;">Position the widget below:</label>
700 - <div class='tooltip'>
379 + <div class="home_occurrence">
380 + <div class="mode_style_home_selector">
381 + <label id="category_location_string_label" style="float:left;">CSS selector&nbsp;:</label>
382 + <div class='tooltip'>
701 383 <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
702 384 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
703 385 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
704 386 </g>
@@ -703,71 +385,46 @@
703 385 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
704 386 </g>
705 387 </svg>
706 388 <div>
707 - Enter the paragraph number to target. <br>
708 - E.g. To target the <b>5th</b> paragraph, fill in <i>5</i>.<br><br>
709 - ----<br>
710 - <i>Advanced</i> - to use a <b>custom</b> selector:<br><br>
711 - 1) Choose 'Other'. <br>
712 - 2) Fill in a selector (<i>right</i>), and an occurrence (<i>left</i>).
389 + The element to target - e.g.:<br><br>
390 + <i>section</i> - to target a <i>section</i>.<br>
391 + <i>#my-id</i> - to target an <i>ID</i> of "my-id".<br>
392 + <i>.my-class</i> - to target a <i>class</i> of "my-class".
713 393 </div>
714 394 </div>
715 - </div>
716 - <div class="placement_below_mid_occurrence">
717 - <select name="mid_paragraph_ui_mode" id="mid_paragraph_ui_mode">
718 - <option value="Paragraph" <?php echo (!empty($settings->mid_paragraph_ui_mode) && $settings->mid_paragraph_ui_mode == "Paragraph") ? "selected" : ""?> >Paragraph</option>
719 - <option value="Other" <?php echo (!empty($settings->mid_paragraph_ui_mode) && $settings->mid_paragraph_ui_mode == "Other") ? "selected" : ""?>>Other</option>
720 - </select>&nbsp;
721 - <input type="number" id="mid_occurrence" value="<?php echo !empty($settings->mid_location_string_occurrence) ? $settings->mid_location_string_occurrence : "1" ?>" name="mid_location_string_occurrence" placeholder="" style="width:65px;">
722 - </div>
723 -
724 - </div>
725 - <div id="mid_css_selector_div">
726 -
727 - <div class="placement_style_mid_occurrence"><label id="mid_occurrence_label" style="float:left;">CSS selector :</label>
728 - <div class='tooltip'>
395 +
396 + </div>
397 + <div class="placement_style_home_occurrence">
398 + <label id="category_occurrence_label" style="float:left;">Occurrence&nbsp;:</label>
399 + <div class='tooltip'>
400 + <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
729 401 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
730 402 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
731 403 </g>
732 404 </svg>
733 - <div>
734 - <i>Advanced</i> - fill in a selector to target - e.g.:<br><br>
735 - <i>#my-id</i> - to target an <i>ID</i> of "my-id".<br>
736 - <i>.my-class</i> - to target a <i>class</i> of "my-class".
737 - </div>
405 + <div>For a <b>non-unique</b> selector - e.g. <i>section</i> - fill in the <b>occurrence</b> to target.<br><br>
406 + E.g. To target the <b>2nd</b> section, fill in <i>2</i>. <br><br>
407 + For a <b>unique</b> selector - e.g. <i>#my-id</i> - leave the default value of '1'.</div>
738 408 </div>
739 - </div>
740 - <div class="widget_below_mid_selector">
741 - <input id = "mid_location_string" type="text" value="<?php echo !empty($settings->mid_location_string) ? strip_tags($settings->mid_location_string) : "p" ?>" name="mid_location_string" placeholder="E.g. p for paragraph" />
742 - </div>
743 - </div>
409 +
410 + </div>
744 411 </div>
745 -<!-- Mid Article Widget -->
746 412
747 -<!-- Right Rail Article Widget -->
748 -
749 -<div id="right-rail" class="settings_block widget_settings_block">
750 - <label id="right-rail-label"><b style="font-size:15px;margin-left: 10px;">Right-rail (sidebar)</b> </label>
751 - <div style="font-size:14px;margin: 5px 10px 10px 10px;">You can insert a <b>Taboola</b> unit in your website <b>sidebar</b> (if your <b>WordPress</b> theme provides one):</div>
752 -
753 - <div id="rightrail-banner">
754 - 1. In the <b>sidebar menu</b> (<i>left</i>) select <b>Appearance</b> > <b>Widgets</b>, or click <a href="widgets.php" target="_blank">here</a> to open the <b>Widgets</b> panel. </br>
755 - 2. Click on the <span style="font-size: 18px; font-weight:bold">+</span> icon (<i>top, left</i>) and type in <b>"Taboola".</b></br>
756 - 3. Drag the <b>Taboola</b> widget to the desired position in the sidebar (<i>right</i>).</br>
757 - 4. Enter the <b>Widget ID (Mode)</b>, as provided by <b>Taboola</b>.</br>
758 - 5. Click on <b>Update</b> (<i>top, right</i>) to save your changes.</br>
759 - 6. Browse to your website and verify that the newly added unit displays correctly.</br>
760 - <hr>
761 - To <b>watch a demo</b> of the above steps, see our <a href="https://developers.taboola.com/web-integrations/docs/sidebar-widget" target="_blank">online docs</a>.
413 + <div class="home_placement">
414 + <div class="widget_below_home_selector">
415 + <input id="category_location_string" type="text"
416 + value="<?php echo !empty($settings->category_location_string) ? strip_tags($settings->category_location_string) : '' ?>"
417 + name="category_location_string" placeholder="e.g. #content"/>
418 + </div>
419 + <div class="placement_below_home_Occurrence">
420 + <input id="category_occurrence" type="number" min="1"
421 + value="<?php echo !empty($settings->category_location_string_occurrence) ? $settings->category_location_string_occurrence : '1' ?>"
422 + name="category_location_string_occurrence"
423 + style="width:65px;">
424 + </div>
762 425 </div>
763 426 </div>
764 -
765 -<!-- Right Rail Article Widget -->
766 -
767 -<!-- Homepage mid widget -->
768 -
769 -
770 427 <div id="homepage" class="settings_block widget_settings_block">
771 428 <div class="switch_style">
772 429 <label class="switch">
773 430 <input id="home_enabled" type="checkbox" <?php echo !empty($settings->home_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#homepage', this)" name="home_enabled"/>
@@ -775,9 +432,8 @@
775 432 </label>
776 433 <div>
777 434 <b style="font-size:15px;float: left;">Homepage (front page)</b>
778 435 <div class='tooltip'>
779 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
780 436 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
781 437 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
782 438 </g>
783 439 </svg>
@@ -788,9 +444,8 @@
788 444
789 445 <div>
790 446 <div class="mode_style_home"><label id="home_widget_id_label" style="float:left;">Mode (Widget ID):</label>
791 447 <div class='tooltip'>
792 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
793 448 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
794 449 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
795 450 </g>
796 451 </svg>
@@ -798,9 +453,8 @@
798 453 </div>
799 454 </div>
800 455 <div class="placement_style_home"><label id="home_placement_label" style="float:left;">Placement Name:</label>
801 456 <div class='tooltip'>
802 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
803 457 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
804 458 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
805 459 </g>
806 460 </svg>
@@ -818,9 +472,8 @@
818 472 </div>
819 473
820 474 <div class='heading_mid_home'><label style="float:left;">Position the widget immediately below the element:</label>
821 475 <div class='tooltip'>
822 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
823 476 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
824 477 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
825 478 </g>
826 479 </svg>
@@ -836,9 +489,8 @@
836 489
837 490 <div class="home_occurrence">
838 491 <div class="mode_style_home_selector"><label id="home_location_string_label" style="float:left;">CSS selector :</label>
839 492 <div class='tooltip'>
840 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
841 493 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
842 494 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
843 495 </g>
844 496 </svg>
@@ -851,9 +503,8 @@
851 503 </div>
852 504 </div>
853 505 <div class="placement_style_home_occurrence"><label id="home_occurrence_label" style="float:left;">Occurrence :</label>
854 506 <div class='tooltip'>
855 - <!-- <i class="fa fa-question-circle" aria-hidden="true"></i> -->
856 507 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN">
857 508 <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
858 509 </g>
859 510 </svg>
@@ -871,8 +522,9 @@
871 522 <input type="number" id="home_occurrence" value="<?php echo !empty($settings->home_location_string_occurrence) ? $settings->home_location_string_occurrence : "1" ?>" name="home_location_string_occurrence" placeholder="" style="width:65px;">
872 523 </div>
873 524 </div>
874 525 </div>
526 +
875 527 <div id="advanced-settings-main">
876 528 <a id="show-advanced-settings">Show advanced settings >></a>
877 529 <div class="change_button">
878 530 <input class='apply_button' type="submit" value="Apply Changes"/>
@@ -878,10 +530,48 @@
878 530 <input class='apply_button' type="submit" value="Apply Changes"/>
879 531 </div>
880 532 </div>
881 533
882 -<!-- Homepage mid widget -->
534 +</div>
883 535
536 +<div id="tab2" class="tab-content" style="display: none;">
537 +<h2 class="general_h2">General Setting</h2>
538 +<div id="web_push" class="settings_block widget_settings_block">
539 + <div class="style_box1"><label id="pub_id">Web Push Account ID:</label>
540 + <div class="tooltip">
541 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="helpTooltip__icon___1XWGN_first">
542 + <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm-1 15.505v.99c0 .291.226.505.505.505h.99c.291 0 .505-.226.505-.505v-.99a.497.497 0 0 0-.505-.505h-.99a.497.497 0 0 0-.505.505zm4.07-6.255c.57-.57.93-1.37.93-2.25 0-2.21-1.79-4-4-4S8 6.79 8 9h2c0-1.1.9-2 2-2s2 .9 2 2c0 .55-.22 1.05-.59 1.41l-1.24 1.26C11.45 12.4 11 13.4 11 14.5v.5h2c0-1.5.45-2.1 1.17-2.83l.9-.92z"></path>
543 + </g>
544 + </svg>
545 + <div>Your SC web-push numeric account ID, as provided by Taboola.<br>
546 + This integration is only for sponsored web-push <br> <br>
547 + The header script and service worker will only be injected if the publisher already has the taboola widget running on their site.
548 + </div>
549 + </div>
550 + <div class="switch_style_push">
551 + <label class="switch">
552 + <input id="web_push_enabled" type="checkbox" <?php echo !empty($settings->web_push_enabled) ? "checked='checked'" : "" ?> onclick="setEnabledDisabled('#web_push', this)" name="web_push_enabled" />
553 + <span class="slider round"></span>
554 + </label>
555 + </div>
556 + </div>
557 + <div class="web_push_id">
558 + <input type="number" id="publisher_id_push" value="<?php echo !empty($settings->publisher_id_push) ? strip_tags($settings->publisher_id_push) : "" ?>" name="publisher_id_push" placeholder="Publisher ID Web Push" />
559 + </div>
560 + <div class="statement">
561 + <label style="color: #000000; padding-">
562 + Don't have an account with taboola? <a href='http://taboola.com/contact' target='_blank'>Contact us</a> to get started.
563 + </label>
564 + </div>
565 +</div>
566 +
567 + <div id="advanced-settings-main">
568 + <div class="change_button">
569 + <input class='apply_button' type="submit" value="Apply Changes"/>
570 + </div>
571 + </div>
572 +</div>
573 +
884 574 </form>
885 575 <div style='clear:both'></div>
886 576
887 577 <?php
@@ -889,33 +579,102 @@
889 579 $userDetails = wp_get_current_user();
890 580 $detailsString = $userDetails->first_name." ".$userDetails->last_name;
891 581 ?>
892 582 <img src="https://logs-01.loggly.com/inputs/d14862f3-64ad-49ca-b28d-1b5d155414ec.gif?source=wp&type=settings&pub=<?=$logPublisher?>&user=<?=urlencode($detailsString)?>&email=<?=urlencode($userDetails->user_email)?>&url=<?=urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}")?>"/>
893 - <!-- <form name="install_log" style="display:none;" method="post" action="http://logs-01.loggly.com/inputs/d14862f3-64ad-49ca-b28d-1b5d155414ec/tag/http/">
894 - <input name="tim" type="hidden" value="<?=date("H:i:s.000")?>">
895 - <input name="pub" type="hidden" value="<?=$logPublisher?>">
896 - <input name="data" type="hideen" value="WORDPRESS_PLUGIN_INSTALL|<?="//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}|{$detailsString}"?>">
897 - </form> -->
898 583 </div>
899 584
900 585 <script>
901 -
902 - // Set enabled/disabled appearance upon page load
903 - // (Function is defined earlier on the page.)
904 586 setEnabledDisabled('#below_article', document.getElementById("first_bc_enabled"));
905 587 setEnabledDisabled('#mid_article', document.getElementById("mid_enabled"));
906 588 setEnabledDisabled('#homepage', document.getElementById("home_enabled"));
589 + setEnabledDisabled('#web_push', document.getElementById("web_push_enabled"));
590 + setEnabledDisabled('#category_widget',document.getElementById('category_enabled'));
591 +</script>
907 592
593 +<script>
594 +jQuery(document).ready(function($) {
595 + let widgetCounter = $('#mid-article-widgets-container .mid-article-widget').length;
596 +
597 + // Function to set the initial correct view for widgets
598 + function initializeWidgetView() {
599 + $('#mid-article-widgets-container .mid-widget-type-selector').each(function() {
600 + var container = $(this).closest('.mid-article-widget');
601 + var selectorInputContainer = container.find('.mid-css-selector-container');
602 +
603 + if ($(this).val() === 'Paragraph') {
604 + selectorInputContainer.hide();
605 + } else {
606 + selectorInputContainer.show();
607 + }
608 + });
609 + }
610 +
611 + // Call the function on page load to fix the initial view
612 + initializeWidgetView();
613 +
614 + // Add a new mid-article widget section
615 + $('#add-mid-widget').on('click', function() {
616 + widgetCounter++;
617 + var widgetHtml = `
618 + <div class="mid-article-widget" style="border: 1px solid #ddd; padding: 10px; margin-top: 10px; border-radius: 5px;">
619 + <h4 style="font-size: 14px; font-weight: bold;">Mid-Article Widget #${widgetCounter}</h4>
620 + <div style="display: flex; flex-wrap: wrap;">
621 + <div style="flex: 1; min-width: 250px; padding-right: 10px;">
622 + <label>Mode (Widget ID):</label>
623 + <input class="widefat" type="text" name="mid_widget_id[]" placeholder="thumbnails-mid1" />
624 + </div>
625 + <div style="flex: 1; min-width: 250px;">
626 + <label>Placement Name:</label>
627 + <input class="widefat" type="text" name="mid_placement[]" placeholder="Mid Article Thumbnails" />
628 + </div>
629 + </div>
630 + <div style="display: flex; flex-wrap: wrap; margin-top: 10px;">
631 + <div style="flex: 1; min-width: 200px; padding-right: 10px;">
632 + <label>Position below:</label>
633 + <select class="widefat mid-widget-type-selector" name="mid_paragraph_ui_mode[]">
634 + <option value="Paragraph" selected>Paragraph</option>
635 + <option value="Other">Other (Custom)</option>
636 + </select>
637 + </div>
638 + <div style="flex: 1; min-width: 150px; padding-right: 10px; display:none;" class="mid-css-selector-container">
639 + <label>CSS selector:</label>
640 + <input class="widefat" type="text" name="mid_location_string[]" value="p" />
641 + </div>
642 + <div style="flex: 1; min-width: 150px;">
643 + <label>Paragraph/Element Number:</label>
644 + <input class="widefat" type="number" name="mid_location_string_occurrence[]" value="1" min="1" style="width:80px;">
645 + </div>
646 + </div>
647 + <button type="button" class="button remove-mid-widget" style="margin-top: 10px;">Remove Widget</button>
648 + </div>`;
649 + $('#mid-article-widgets-container').append(widgetHtml);
650 + });
651 +
652 + // Remove a mid-article widget section
653 + $('#mid-article-widgets-container').on('click', '.remove-mid-widget', function() {
654 + $(this).closest('.mid-article-widget').remove();
655 + $('#mid-article-widgets-container .mid-article-widget').each(function(index) {
656 + $(this).find('h4').text(`Mid-Article Widget #${index + 1}`);
657 + });
658 + widgetCounter = $('#mid-article-widgets-container .mid-article-widget').length;
659 + });
660 +
661 + // Handle the show/hide for the CSS selector field on change
662 + $('#mid-article-widgets-container').on('change', '.mid-widget-type-selector', function() {
663 + var container = $(this).closest('.mid-article-widget');
664 + var selectorInputContainer = container.find('.mid-css-selector-container');
665 + var selectorInput = selectorInputContainer.find('input');
666 +
667 + if ($(this).val() === 'Paragraph') {
668 + selectorInputContainer.hide();
669 + selectorInput.val('p');
670 + } else {
671 + selectorInputContainer.show();
672 + }
673 + });
674 +});
908 675 </script>
909 676
910 677 <script>
911 -
912 - // Fadeouts for error/success messages
913 678 setTimeout(function(){jQuery('.label-success').fadeOut()}, 5000);
914 679 setTimeout(function(){jQuery('.label-error').fadeOut()}, 8000);
915 -
916 - // PC
917 - // window.onload = function(){
918 - // document.forms['install_log'].submit()
919 - // }
920 -
921 680 </script>