Changeset 3318658
- Timestamp:
- 06/27/2025 09:26:17 AM (9 months ago)
- Location:
- helloasso
- Files:
-
- 8 edited
- 1 copied
-
tags/1.1.21 (copied) (copied from helloasso/trunk)
-
tags/1.1.21/README.txt (modified) (2 diffs)
-
tags/1.1.21/admin/class-hello-asso-admin.php (modified) (4 diffs)
-
tags/1.1.21/admin/js/hello-asso-admin.js (modified) (2 diffs)
-
tags/1.1.21/hello-asso.php (modified) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/class-hello-asso-admin.php (modified) (4 diffs)
-
trunk/admin/js/hello-asso-admin.js (modified) (2 diffs)
-
trunk/hello-asso.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
helloasso/tags/1.1.21/README.txt
r3316366 r3318658 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.2.34 8 Stable tag: 1.1.2 08 Stable tag: 1.1.21 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 81 81 82 82 == Changelog == 83 84 = 1.1.21 = 85 * Déplacement des appels API en back pour éviter les erreurs CORS 83 86 84 87 = 1.1.20 = -
helloasso/tags/1.1.21/admin/class-hello-asso-admin.php
r3316366 r3318658 442 442 public function loadAjax() 443 443 { 444 445 444 add_action('wp_ajax_ha_ajax', 'ha_ajax'); 446 445 add_action('wp_ajax_nopriv_ha_ajax', 'ha_ajax'); 446 add_action('wp_ajax_ha_search_campaign', 'ha_search_campaign'); 447 add_action('wp_ajax_nopriv_ha_search_campaign', 'ha_search_campaign'); 447 448 448 449 function sanitizeArray($data = array()) … … 462 463 } 463 464 465 function ha_search_campaign() 466 { 467 check_ajax_referer('helloassosecuritytoken11', 'security'); 468 469 if (!is_user_logged_in() || !current_user_can('manage_options')) { 470 wp_die('Vous n\'avez pas les droits nécessaires pour exécuter cette action.'); 471 } 472 473 $value = sanitize_text_field($_POST['value']); 474 475 if (empty($value)) { 476 wp_send_json_error('Le champ est vide.'); 477 return; 478 } 479 480 $url = parse_url($value); 481 $sandbox = false; 482 $nameAsso = ''; 483 484 if ($url !== false) { 485 $domain = $url['host']; 486 487 if ($domain == 'helloasso-sandbox.com' || $domain == 'www.helloasso-sandbox.com') { 488 $sandbox = true; 489 } 490 491 if ($domain != 'helloasso.com' && $domain != 'www.helloasso.com' && $domain != 'helloasso-sandbox.com' && $domain != 'www.helloasso-sandbox.com') { 492 $nameAsso = ''; 493 } else { 494 $slug = explode('/', $value); 495 $nameAsso = isset($slug[4]) ? $slug[4] : ''; 496 } 497 } else { 498 $nameAsso = sanitize_title_with_dashes($value); 499 } 500 501 if (empty($nameAsso)) { 502 wp_send_json_error('URL ou nom d\'association invalide.'); 503 return; 504 } 505 506 $apiUrl = $sandbox ? 'https://api.helloasso-sandbox.com' : 'https://api.helloasso.com'; 507 $body = array( 508 'grant_type' => 'client_credentials', 509 'client_id' => $sandbox ? '3732d11d-e73a-40a2-aa28-a54fa1aa76be' : '049A416C-5820-45FE-B645-1D06FB4AA622', 510 'client_secret' => $sandbox ? 'vOsIvf7T496A5/LGeTG6Uq7CNdFydh8s' : 'I+YF/JjLrcE1+iPEFul+BBJDWIil+1g5' 511 ); 512 513 $token_response = ha_curl_post($apiUrl . '/oauth2/token', $body); 514 515 if ($token_response === false) { 516 wp_send_json_error('Erreur de connexion à l\'API HelloAsso.'); 517 return; 518 } 519 520 $token_data = json_decode($token_response, true); 521 522 if (!isset($token_data['access_token'])) { 523 wp_send_json_error('Erreur d\'authentification avec l\'API HelloAsso.'); 524 return; 525 } 526 527 $bearer_token = $token_data['access_token']; 528 529 $org_response = ha_curl_get($apiUrl . '/v5/organizations/' . $nameAsso, $bearer_token); 530 531 if ($org_response === false) { 532 wp_send_json_error('Erreur lors de la récupération des informations de l\'organisation.'); 533 return; 534 } 535 536 $org_data = json_decode($org_response, true); 537 538 if (!isset($org_data['name'])) { 539 wp_send_json_error('Organisation non trouvée.'); 540 return; 541 } 542 543 $asso_name = $org_data['name']; 544 $all_campaigns = array(); 545 $total_count = 0; 546 547 for ($i = 1; $i <= 5; $i++) { 548 $campaign_response = ha_curl_get($apiUrl . '/v5/organizations/' . $nameAsso . '/forms?pageSize=20&pageIndex=' . $i, $bearer_token); 549 550 if ($campaign_response === false) { 551 continue; 552 } 553 554 $campaign_data = json_decode($campaign_response, true); 555 556 if (isset($campaign_data['data']) && is_array($campaign_data['data'])) { 557 $count = count($campaign_data['data']); 558 $total_count += $count; 559 $all_campaigns = array_merge($all_campaigns, $campaign_data['data']); 560 561 if (isset($campaign_data['pagination']['totalCount']) && $total_count >= $campaign_data['pagination']['totalCount']) { 562 break; 563 } 564 } 565 566 usleep(1250000); 567 } 568 569 if (empty($all_campaigns)) { 570 wp_send_json_error('Aucune campagne trouvée pour cette organisation.'); 571 return; 572 } 573 574 $result = array( 575 'success' => true, 576 'asso_name' => $asso_name, 577 'campaigns' => $all_campaigns, 578 'total_count' => $total_count, 579 'slug' => $nameAsso 580 ); 581 582 wp_send_json($result); 583 } 584 585 function ha_curl_post($url, $data) 586 { 587 $ch = curl_init(); 588 589 curl_setopt($ch, CURLOPT_URL, $url); 590 curl_setopt($ch, CURLOPT_POST, true); 591 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); 592 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 593 curl_setopt($ch, CURLOPT_TIMEOUT, 30); 594 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 595 curl_setopt($ch, CURLOPT_HTTPHEADER, array( 596 'Content-Type: application/x-www-form-urlencoded' 597 )); 598 599 $response = curl_exec($ch); 600 $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 601 $error = curl_error($ch); 602 603 curl_close($ch); 604 605 if ($error || $http_code !== 200) { 606 return false; 607 } 608 609 return $response; 610 } 611 612 function ha_curl_get($url, $bearer_token = null) 613 { 614 $ch = curl_init(); 615 616 curl_setopt($ch, CURLOPT_URL, $url); 617 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 618 curl_setopt($ch, CURLOPT_TIMEOUT, 30); 619 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 620 621 $headers = array(); 622 if ($bearer_token) { 623 $headers[] = 'Authorization: Bearer ' . $bearer_token; 624 } 625 626 if (!empty($headers)) { 627 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 628 } 629 630 $response = curl_exec($ch); 631 $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 632 $error = curl_error($ch); 633 634 curl_close($ch); 635 636 if ($error || $http_code !== 200) { 637 return false; 638 } 639 640 return $response; 641 } 642 464 643 function ha_ajax() 465 644 { … … 467 646 468 647 if (! is_user_logged_in() || ! current_user_can('manage_options')) { 469 wp_die('Vous n ’avez pas les droits nécessaires pour exécuter cette action.');648 wp_die('Vous n\'avez pas les droits nécessaires pour exécuter cette action.'); 470 649 } 471 650 … … 494 673 } elseif (isset($_POST['slug']) && is_numeric($_POST['error']) && is_array($campaign) && isset($_POST['increase']) && $_POST['increase'] > 1) { 495 674 $currentCampain = get_option('ha-campaign'); 496 // increade current campain with campain497 675 $campaign = array_merge($currentCampain, $campaign); 498 676 update_option('ha-campaign', $campaign); -
helloasso/tags/1.1.21/admin/js/hello-asso-admin.js
r3316366 r3318658 1 (function ($) {2 'use strict';3 4 /**5 * All of the code for your admin-facing JavaScript source6 * should reside in this file.7 *8 * Note: It has been assumed you will write jQuery code here, so the9 * $ function reference has been prepared for usage within the scope10 * of this function.11 *12 * This enables you to define handlers, for when the DOM is ready:13 *14 * $(function() {15 *16 * });17 *18 * When the window is loaded:19 *20 * $( window ).load(function() {21 *22 * });23 *24 * ...and/or other possibilities.25 *26 * Ideally, it is not considered best practise to attach more than a27 * single DOM-ready or window-load handler for a particular page.28 * Although scripts in the WordPress core, Plugins and Themes may be29 * practising this, we should strive to set a better example in our own work.30 */31 32 jQuery(document).ready(function() {33 34 var url = window.location.href,35 hash = url.split('#')[1];36 37 if (hash == 'ha-popup') {38 window.location.hash = "";39 jQuery("#ha-popup").hide();40 }41 var campaign = jQuery('.ha-campaign-info');42 var sidebar = jQuery('.ha-campaign-right');43 var close = jQuery('.ha-campaign-right .close-campaign-viewer');44 45 campaign.click(function() {46 sidebar.css({47 "-webkit-transform": "translate(0, 0)",48 "transform": "translate(0, 0)"49 })50 return false;51 })52 53 close.click(function() {54 sidebar.css({55 "-webkit-transform": "translate(100%, 0)",56 "transform": "translate(100%, 0)"57 })58 return false;59 })60 })1 (function($) { 2 'use strict'; 3 4 /** 5 * All of the code for your admin-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 32 jQuery(document).ready(function() { 33 34 var url = window.location.href, 35 hash = url.split('#')[1]; 36 37 if (hash == 'ha-popup') { 38 window.location.hash = ""; 39 jQuery("#ha-popup").hide(); 40 } 41 var campaign = jQuery('.ha-campaign-info'); 42 var sidebar = jQuery('.ha-campaign-right'); 43 var close = jQuery('.ha-campaign-right .close-campaign-viewer'); 44 45 campaign.click(function() { 46 sidebar.css({ 47 "-webkit-transform": "translate(0, 0)", 48 "transform": "translate(0, 0)" 49 }) 50 return false; 51 }) 52 53 close.click(function() { 54 sidebar.css({ 55 "-webkit-transform": "translate(100%, 0)", 56 "transform": "translate(100%, 0)" 57 }) 58 return false; 59 }) 60 }) 61 61 62 62 })(jQuery); 63 63 64 64 function ha_dropdown() { 65 document.getElementById("ha-dropdown").classList.toggle("ha-show");65 document.getElementById("ha-dropdown").classList.toggle("ha-show"); 66 66 } 67 67 68 68 // Close the dropdown menu if the user clicks outside of it 69 window.onclick = function (event) { 70 if (!jQuery(event.target).hasClass('ha-open-dropdown')) { 71 var dropdowns = document.getElementsByClassName("ha-dropdown-content"); 72 var i; 73 for (i = 0; i < dropdowns.length; i++) { 74 var openDropdown = dropdowns[i]; 75 if (openDropdown.classList.contains('ha-show')) { 76 openDropdown.classList.remove('ha-show'); 77 } 78 } 79 } 80 } 81 82 function parseUrl(str) { 83 try { 84 var url = new URL(str); 85 } catch (TypeError) { 86 return null; 87 } 88 return url; 69 window.onclick = function(event) { 70 if (!jQuery(event.target).hasClass('ha-open-dropdown')) { 71 var dropdowns = document.getElementsByClassName("ha-dropdown-content"); 72 var i; 73 for (i = 0; i < dropdowns.length; i++) { 74 var openDropdown = dropdowns[i]; 75 if (openDropdown.classList.contains('ha-show')) { 76 openDropdown.classList.remove('ha-show'); 77 } 78 } 79 } 89 80 } 90 81 91 82 const haResetInput = () => { 92 jQuery(".ha-search").val('');93 haCheckInput();83 jQuery(".ha-search").val(''); 84 haCheckInput(); 94 85 } 95 86 96 87 const haCheckInput = () => { 97 const value = jQuery(".ha-search").val(); 98 99 if (value == '') { 100 jQuery('.searchCampaign').attr('disabled', true); 101 } 102 else { 103 jQuery('.searchCampaign').attr('disabled', false); 104 } 105 } 106 107 function toSeoUrl(url) { 108 return url.toString() // Convert to string 109 .normalize('NFD') // Change diacritics 110 .replace(/'/g, '-') // Replace apostrophe 111 .replace(/[\u0300-\u036f]/g, '') // Remove illegal characters 112 .replace(/\s+/g, '-') // Change whitespace to dashes 113 .toLowerCase() // Change to lowercase 114 .replace(/&/g, '-') // Replace ampersand 115 .replace(/[^a-z0-9\-]/g, '') // Remove anything that is not a letter, number or dash 116 .replace(/-+/g, '-') // Remove duplicate dashes 117 .replace(/^-*/, '') // Remove starting dashes 118 .replace(/-*$/, ''); // Remove trailing dashes 88 const value = jQuery(".ha-search").val(); 89 90 if (value == '') { 91 jQuery('.searchCampaign').attr('disabled', true); 92 } else { 93 jQuery('.searchCampaign').attr('disabled', false); 94 } 119 95 } 120 96 121 97 const searchCampaign = () => { 122 const value = jQuery(".ha-search").val(); 123 124 if (value == '') { 125 jQuery('.ha-error span').html('Le champ est vide.'); 126 } 127 else { 128 var url = parseUrl(value); 129 var sandbox = false; 130 if (url != null) { 131 var domain = url.hostname; 132 133 if (domain == 'helloasso-sandbox.com' || domain == 'www.helloasso-sandbox.com') { 134 sandbox = true; 135 } 136 137 if (domain != 'helloasso.com' && domain != 'www.helloasso.com' && domain != 'helloasso-sandbox.com' && domain != 'www.helloasso-sandbox.com') { 138 var nameAsso = ''; 139 } 140 else { 141 var slug = value.split('/'); 142 var nameAsso = slug[4]; 143 } 144 } 145 else { 146 var nameAsso = toSeoUrl(value); 147 } 148 149 if (nameAsso != '') { 150 var apiUrl = 'https://api.helloasso.com'; 151 var body = { 152 grant_type: 'client_credentials', 153 client_id: '049A416C-5820-45FE-B645-1D06FB4AA622', 154 client_secret: 'I+YF/JjLrcE1+iPEFul+BBJDWIil+1g5' 155 }; 156 157 if (sandbox) { 158 apiUrl = 'https://api.helloasso-sandbox.com'; 159 body.client_id = '3732d11d-e73a-40a2-aa28-a54fa1aa76be'; 160 body.client_secret = 'vOsIvf7T496A5/LGeTG6Uq7CNdFydh8s'; 161 } 162 163 jQuery('.ha-error').hide(); 164 jQuery('.ha-sync').hide(); 165 166 jQuery.ajax({ 167 url: apiUrl + '/oauth2/token', 168 type: 'POST', 169 dataType: 'json', 170 timeout: 30000, 171 contentType: 'application/x-www-form-urlencoded; charset=UTF-8', 172 data: body, 173 beforeSend: function (result) { 174 jQuery('.ha-loader').show(); 175 jQuery('.ha-message').hide(); 176 jQuery(".searchCampaign").html('<svg class="ldi-igf6j3" width="140px" height="50px" style="margin-top:-15px;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" style="background: none;"><!--?xml version="1.0" encoding="utf-8"?--><!--Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)--><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" style="transform-origin: 50px 50px 0px;" xml:space="preserve"><g style="transform-origin: 50px 50px 0px;"><g style="transform-origin: 50px 50px 0px; transform: scale(0.6);"><g style="transform-origin: 50px 50px 0px;"><g><style type="text/css" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -1s; animation-direction: normal;">.st0{fill:#F4E6C8;} .st1{opacity:0.8;fill:#849B87;} .st2{fill:#D65A62;} .st3{fill:#E15C64;} .st4{fill:#F47E5F;} .st5{fill:#F7B26A;} .st6{fill:#FEE8A2;} .st7{fill:#ACBD81;} .st8{fill:#F5E169;} .st9{fill:#F0AF6B;} .st10{fill:#EA7C60;} .st11{fill:#A8B980;} .st12{fill:#829985;} .st13{fill:#798AAE;} .st14{fill:#8672A7;} .st15{fill:#CC5960;} .st16{fill:#E17A5F;} .st17{fill:#849B87;} .st18{opacity:0.8;fill:#E15C64;} .st19{opacity:0.8;fill:#F7B26A;} .st20{fill:#79A5B5;} .st21{opacity:0.8;fill:#79A5B4;} .st22{fill:#666766;}</style><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.923077s; animation-direction: normal;"><circle class="st2" cx="20" cy="50" r="10" fill="#ffffff" style="fill: rgb(255, 255, 255);"></circle></g><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.846154s; animation-direction: normal;"><circle class="st10" cx="50" cy="50" r="10" fill="#b3e9cd" style="fill: rgb(179, 233, 205);"></circle></g><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.769231s; animation-direction: normal;"><circle class="st9" cx="80" cy="50" r="10" fill="#86ecb6" style="fill: rgb(134, 236, 182);"></circle></g><metadata xmlns:d="https://loading.io/stock/" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.692308s; animation-direction: normal;"><d:name class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.615385s; animation-direction: normal;">ellipse</d:name><d:tags class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.538462s; animation-direction: normal;">dot,point,circle,waiting,typing,sending,message,ellipse,spinner</d:tags><d:license class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.461538s; animation-direction: normal;">cc-by</d:license><d:slug class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.384615s; animation-direction: normal;">igf6j3</d:slug></metadata></g></g></g></g><style type="text/css" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.307692s; animation-direction: normal;">@keyframes ld-fade {0% {opacity: 1;}100% { opacity: 0; }}@-webkit-keyframes ld-fade { 0% { opacity: 1; }100% {opacity: 0;} }.ld.ld-fade { -webkit-animation: ld-fade 1s infinite linear; animation: ld-fade 1s infinite linear;}</style></svg></svg>'); 177 178 }, 179 complete: function (result) { 180 }, 181 success: function (result) { 182 183 var bearerToken = result.access_token; 184 jQuery.ajax({ 185 url: apiUrl + `/v5/organizations/${nameAsso}`, 186 type: 'GET', 187 timeout: 30000, 188 headers: { 189 'Authorization': 'Bearer ' + bearerToken 190 }, 191 dataType: "json", 192 complete: function (ha) { 193 194 }, 195 success: function (result2) { 196 197 var assoName = result2.name; 198 let totalCount = 0; 199 for (let i = 1; i <= 5; i++) { 200 201 setTimeout(function () { 202 console.log(i); 203 204 205 jQuery.ajax({ 206 url: apiUrl + `/v5/organizations/${nameAsso}/forms?pageSize=20&pageIndex=${i}`, 207 type: 'GET', 208 timeout: 30000, 209 headers: { 210 'Authorization': 'Bearer ' + bearerToken 211 }, 212 dataType: "json", 213 complete: function (result) { 214 jQuery('.ha-loader').hide(); 215 }, 216 success: function (result3) { 217 let count = result3.data.length; 218 totalCount += count; 219 console.log(result3); 220 console.log(count); 221 222 223 jQuery.ajax({ 224 url: adminAjax.ajaxurl, 225 method: 'POST', 226 data: { action: 'ha_ajax', 'name': assoName, 'campaign': result3.data, 'slug': nameAsso, 'error': 0, 'security': adminAjax.ajax_nonce, 'increase': i }, 227 success: function (data) { 228 229 if (totalCount == result3.pagination.totalCount) { 230 location.reload(); 231 } 232 233 }, 234 error: function (data) { 235 console.log(data) 236 } 237 }); 238 }, 239 error: function (xhr, ajaxOptions, thrownError) { 240 241 if (ajaxOptions == "timeout") { 242 jQuery('.ha-no-sync').show(); 243 jQuery(".searchCampaign").html('Synchroniser'); 244 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 245 } 246 else { 247 if (xhr.status == 404) { 248 jQuery.ajax({ 249 url: adminAjax.ajaxurl, 250 method: 'POST', 251 data: { action: 'ha_ajax', 'campaign': '', 'slug': nameAsso, 'error': 1, 'security': adminAjax.ajax_nonce }, 252 success: function (data) { 253 254 location.reload(); 255 256 }, 257 error: function (data) { 258 } 259 }); 260 } 261 else if (xhr.status == 500) { 262 jQuery('.ha-no-sync').show(); 263 jQuery(".searchCampaign").html('Synchroniser'); 264 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 265 } 266 } 267 }, 268 }); 269 270 }, i * 1250) 271 } 272 273 274 275 276 }, 277 error: function (xhr, ajaxOptions, thrownError) { 278 279 if (ajaxOptions == "timeout") { 280 jQuery('.ha-no-sync').show(); 281 jQuery(".searchCampaign").html('Synchroniser'); 282 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 283 } 284 else { 285 if (xhr.status == 404) { 286 jQuery.ajax({ 287 url: adminAjax.ajaxurl, 288 method: 'POST', 289 data: { action: 'ha_ajax', 'campaign': '', 'slug': nameAsso, 'error': 1, 'security': adminAjax.ajax_nonce }, 290 success: function (data) { 291 292 location.reload(); 293 294 }, 295 error: function (data) { 296 } 297 }); 298 } 299 else if (xhr.status == 500) { 300 jQuery('.ha-no-sync').show(); 301 jQuery(".searchCampaign").html('Synchroniser'); 302 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 303 } 304 } 305 306 }, 307 }); 308 }, 309 error: function (xhr, ajaxOptions, thrownError) { 310 jQuery('.ha-error').show(); 311 jQuery('.ha-loader').hide(); 312 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 313 jQuery(".searchCampaign").html('Synchroniser'); 314 }, 315 }); 316 } 317 else { 318 jQuery('.ha-no-valid').fadeIn(); 319 jQuery('.ha-message').hide(); 320 } 321 } 98 const value = jQuery(".ha-search").val(); 99 100 if (value == '') { 101 jQuery('.ha-error span').html('Le champ est vide.'); 102 return; 103 } 104 105 jQuery('.ha-error').hide(); 106 jQuery('.ha-sync').hide(); 107 jQuery('.ha-loader').show(); 108 jQuery('.ha-message').hide(); 109 jQuery(".searchCampaign").html('<svg class="ldi-igf6j3" width="140px" height="50px" style="margin-top:-15px;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" style="background: none;"><!--?xml version="1.0" encoding="utf-8"?--><!--Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)--><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" style="transform-origin: 50px 50px 0px;" xml:space="preserve"><g style="transform-origin: 50px 50px 0px;"><g style="transform-origin: 50px 50px 0px; transform: scale(0.6);"><g style="transform-origin: 50px 50px 0px;"><g><style type="text/css" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -1s; animation-direction: normal;">.st0{fill:#F4E6C8;} .st1{opacity:0.8;fill:#849B87;} .st2{fill:#D65A62;} .st3{fill:#E15C64;} .st4{fill:#F47E5F;} .st5{fill:#F7B26A;} .st6{fill:#FEE8A2;} .st7{fill:#ACBD81;} .st8{fill:#F5E169;} .st9{fill:#F0AF6B;} .st10{fill:#EA7C60;} .st11{fill:#A8B980;} .st12{fill:#829985;} .st13{fill:#798AAE;} .st14{fill:#8672A7;} .st15{fill:#CC5960;} .st16{fill:#E17A5F;} .st17{fill:#849B87;} .st18{opacity:0.8;fill:#E15C64;} .st19{opacity:0.8;fill:#F7B26A;} .st20{fill:#79A5B5;} .st21{opacity:0.8;fill:#79A5B4;} .st22{fill:#666766;}</style><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.923077s; animation-direction: normal;"><circle class="st2" cx="20" cy="50" r="10" fill="#ffffff" style="fill: rgb(255, 255, 255);"></circle></g><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.846154s; animation-direction: normal;"><circle class="st10" cx="50" cy="50" r="10" fill="#b3e9cd" style="fill: rgb(179, 233, 205);"></circle></g><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.769231s; animation-direction: normal;"><circle class="st9" cx="80" cy="50" r="10" fill="#86ecb6" style="fill: rgb(134, 236, 182);"></circle></g><metadata xmlns:d="https://loading.io/stock/" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.692308s; animation-direction: normal;"><d:name class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.615385s; animation-direction: normal;">ellipse</d:name><d:tags class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.538462s; animation-direction: normal;">dot,point,circle,waiting,typing,sending,message,ellipse,spinner</d:tags><d:license class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.461538s; animation-direction: normal;">cc-by</d:license><d:slug class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.384615s; animation-direction: normal;">igf6j3</d:slug></metadata></g></g></g></g><style type="text/css" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.307692s; animation-direction: normal;">@keyframes ld-fade {0% {opacity: 1;}100% { opacity: 0; }}@-webkit-keyframes ld-fade { 0% { opacity: 1; }100% {opacity: 0;} }.ld.ld-fade { -webkit-animation: ld-fade 1s infinite linear; animation: ld-fade 1s infinite linear;}</style></svg></svg>'); 110 111 jQuery.ajax({ 112 url: adminAjax.ajaxurl, 113 method: 'POST', 114 data: { 115 action: 'ha_search_campaign', 116 value: value, 117 security: adminAjax.ajax_nonce 118 }, 119 success: function(response) { 120 jQuery('.ha-loader').hide(); 121 jQuery(".searchCampaign").html('Synchroniser'); 122 123 if (response.success) { 124 jQuery.ajax({ 125 url: adminAjax.ajaxurl, 126 method: 'POST', 127 data: { 128 action: 'ha_ajax', 129 'name': response.asso_name, 130 'campaign': response.campaigns, 131 'slug': response.slug, 132 'error': 0, 133 'security': adminAjax.ajax_nonce, 134 'increase': 1 135 }, 136 success: function(data) { 137 location.reload(); 138 }, 139 error: function(data) { 140 console.log(data); 141 jQuery('.ha-error').show(); 142 jQuery('.ha-error span').html('Erreur lors de la sauvegarde des campagnes.'); 143 } 144 }); 145 } else { 146 jQuery('.ha-error').show(); 147 jQuery('.ha-error span').html(response.data || 'Erreur lors de la recherche des campagnes.'); 148 } 149 }, 150 error: function(xhr, status, error) { 151 jQuery('.ha-loader').hide(); 152 jQuery(".searchCampaign").html('Synchroniser'); 153 jQuery('.ha-error').show(); 154 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 155 } 156 }); 322 157 } 323 158 324 159 const actionTinyMce = data => { 325 jQuery(data).parent().clone().prependTo(".ha-campaign-viewer");326 jQuery(".ha-campaign-viewer").find('.ha-focus').removeAttr('onclick');327 jQuery(".ha-campaign-list").hide();328 jQuery(".ha-campaign-viewer").show();329 jQuery(".ha-return").show();330 jQuery(".ha-return").prependTo(".ha-campaign-viewer");331 jQuery(".ha-return:not(:eq(0))").hide();332 var haPopup = document.getElementById('ha-popup');333 haPopup.scrollTop = 0;160 jQuery(data).parent().clone().prependTo(".ha-campaign-viewer"); 161 jQuery(".ha-campaign-viewer").find('.ha-focus').removeAttr('onclick'); 162 jQuery(".ha-campaign-list").hide(); 163 jQuery(".ha-campaign-viewer").show(); 164 jQuery(".ha-return").show(); 165 jQuery(".ha-return").prependTo(".ha-campaign-viewer"); 166 jQuery(".ha-return:not(:eq(0))").hide(); 167 var haPopup = document.getElementById('ha-popup'); 168 haPopup.scrollTop = 0; 334 169 } 335 170 336 171 const haReturn = () => { 337 jQuery(".ha-campaign-viewer").find('.ha-focus').parent().remove();338 jQuery(".ha-campaign-list").show();339 jQuery(".ha-campaign-viewer").hide();340 jQuery(".ha-return").fadeOut();172 jQuery(".ha-campaign-viewer").find('.ha-focus').parent().remove(); 173 jQuery(".ha-campaign-list").show(); 174 jQuery(".ha-campaign-viewer").hide(); 175 jQuery(".ha-return").fadeOut(); 341 176 } 342 177 343 178 const loadViewCampaign = (url, type) => { 344 jQuery.get({ 345 url, 346 success: function (data) { 347 if (type == 'error_1') { 348 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 349 jQuery(".displayNoneTinyMce").css({ "display": "none" }); 350 } 351 else if (type == 'error_2') { 352 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 353 jQuery(".displayNoneTinyMce").css({ "display": "none" }); 354 } 355 else { 356 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 357 jQuery(".ha-footer").css({ "display": "none" }); 358 jQuery(".ha-logo-footer").css({ "display": "none" }); 359 jQuery('.ha-campaign-viewer').css({ "display": "none" }); 360 jQuery('.close-campaign-viewer').css({ "display": "none" }); 361 } 362 363 var haPopup = document.getElementById('ha-popup'); 364 haPopup.scrollTop = 0; 365 } 366 }); 179 jQuery.get({ 180 url, 181 success: function(data) { 182 if (type == 'error_1') { 183 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 184 jQuery(".displayNoneTinyMce").css({ "display": "none" }); 185 } else if (type == 'error_2') { 186 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 187 jQuery(".displayNoneTinyMce").css({ "display": "none" }); 188 } else { 189 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 190 jQuery(".ha-footer").css({ "display": "none" }); 191 jQuery(".ha-logo-footer").css({ "display": "none" }); 192 jQuery('.ha-campaign-viewer').css({ "display": "none" }); 193 jQuery('.close-campaign-viewer').css({ "display": "none" }); 194 } 195 196 var haPopup = document.getElementById('ha-popup'); 197 haPopup.scrollTop = 0; 198 } 199 }); 367 200 } 368 201 369 202 function insertIframeInTinyMce(data) { 370 var type = jQuery(data).attr('data-type'); 371 var url = jQuery('.lastUrlWidget').val(); 372 var height = "70px"; 373 if (type == "widget-bouton") { 374 height = "70px"; 375 } 376 else if (type == "widget") { 377 height = "750px"; 378 } 379 else if (type == "widget-vignette") { 380 height = "450px"; 381 } 382 else { 383 type = ""; 384 } 385 386 if (!url.startsWith('https://www.helloasso.com/') && !url.startsWith('https://www.helloasso-sandbox.com/')) { 387 url = ""; 388 } 389 var shortcode = '[helloasso campaign="' + url + '" type="' + type + '" height="' + height + '"]'; 390 jQuery('#ha-popup').hide(); 391 window.location.hash = ''; 392 var numItems = jQuery('.ha-input-shortcode').length; 393 394 if (numItems > 0) { 395 396 jQuery(".ha-input-shortcode").each(function () { 397 var element = jQuery(this); 398 if (element.val() == "") { 399 jQuery(this).val(shortcode); 400 jQuery(this).focus(); 401 } 402 }); 403 } 404 else { 405 if (tinyMCE && tinyMCE.activeEditor) { 406 tinyMCE.activeEditor.selection.setContent(shortcode); 407 } else { 408 jQuery('.wp-editor-area').val(jQuery('.wp-editor-area').val() + ' ' + shortcode); 409 } 410 } 411 412 413 return false; 203 var type = jQuery(data).attr('data-type'); 204 var url = jQuery('.lastUrlWidget').val(); 205 var height = "70px"; 206 if (type == "widget-bouton") { 207 height = "70px"; 208 } else if (type == "widget") { 209 height = "750px"; 210 } else if (type == "widget-vignette") { 211 height = "450px"; 212 } else { 213 type = ""; 214 } 215 216 if (!url.startsWith('https://www.helloasso.com/') && !url.startsWith('https://www.helloasso-sandbox.com/')) { 217 url = ""; 218 } 219 var shortcode = '[helloasso campaign="' + url + '" type="' + type + '" height="' + height + '"]'; 220 jQuery('#ha-popup').hide(); 221 window.location.hash = ''; 222 var numItems = jQuery('.ha-input-shortcode').length; 223 224 if (numItems > 0) { 225 226 jQuery(".ha-input-shortcode").each(function() { 227 var element = jQuery(this); 228 if (element.val() == "") { 229 jQuery(this).val(shortcode); 230 jQuery(this).focus(); 231 } 232 }); 233 } else { 234 if (tinyMCE && tinyMCE.activeEditor) { 235 tinyMCE.activeEditor.selection.setContent(shortcode); 236 } else { 237 jQuery('.wp-editor-area').val(jQuery('.wp-editor-area').val() + ' ' + shortcode); 238 } 239 } 240 241 242 return false; 414 243 } 415 244 416 245 417 246 function openShortcodesCampaign(data) { 418 jQuery('.ha-campaign-info').removeClass('ha-focus');419 jQuery('.ha-campaign-info').find('svg').attr('stroke', '#777D9C');420 421 var el = data;422 jQuery(el).addClass('ha-focus');423 jQuery(el).find('svg').attr('stroke', '#49D38A');424 425 var url = jQuery(el).attr('data-url');426 url = url.replace(/widget/, '');427 var type = jQuery(el).attr('data-type');428 429 jQuery('.lastUrlWidget').val(url);430 jQuery(".ha-description-viewer").fadeOut();431 jQuery(".ha-shortcodes-viewer").fadeIn();432 jQuery("#vueBouton").attr('src', url + 'widget-bouton/');433 434 if (type == "Donation") {435 jQuery(".vignette").hide();436 } else {437 jQuery(".vignette").show();438 jQuery("#vueVignette").attr('src', url + 'widget-vignette/');439 }440 441 442 jQuery("#vueVignetteHorizontale").attr('src', url + '/widget-vignette-horizontale/');443 jQuery("#vueForm").attr('src', url + 'widget/');247 jQuery('.ha-campaign-info').removeClass('ha-focus'); 248 jQuery('.ha-campaign-info').find('svg').attr('stroke', '#777D9C'); 249 250 var el = data; 251 jQuery(el).addClass('ha-focus'); 252 jQuery(el).find('svg').attr('stroke', '#49D38A'); 253 254 var url = jQuery(el).attr('data-url'); 255 url = url.replace(/widget/, ''); 256 var type = jQuery(el).attr('data-type'); 257 258 jQuery('.lastUrlWidget').val(url); 259 jQuery(".ha-description-viewer").fadeOut(); 260 jQuery(".ha-shortcodes-viewer").fadeIn(); 261 jQuery("#vueBouton").attr('src', url + 'widget-bouton/'); 262 263 if (type == "Donation") { 264 jQuery(".vignette").hide(); 265 } else { 266 jQuery(".vignette").show(); 267 jQuery("#vueVignette").attr('src', url + 'widget-vignette/'); 268 } 269 270 271 jQuery("#vueVignetteHorizontale").attr('src', url + '/widget-vignette-horizontale/'); 272 jQuery("#vueForm").attr('src', url + 'widget/'); 444 273 } 445 274 446 275 const haCopy = data => { 447 jQuery(data).find('.ha-tooltip').animate({ opacity: 1 }, 500, function () { 448 setInterval(function () { 449 jQuery(data).find('.ha-tooltip').css('opacity', '0'); 450 }, 3000); 451 }); 452 jQuery('.lastShortcode').remove(); 453 jQuery(data).after('<input type="text" class="lastShortcode" id="lastShortcode" />'); 454 455 var toCopy = document.getElementById('lastShortcode'); 456 var type = jQuery(data).attr('data-type'); 457 var url = jQuery('.lastUrlWidget').val(); 458 459 var height = "70px"; 460 if (type == "widget-bouton") { 461 height = "70px"; 462 } 463 else if (type == "widget") { 464 height = "750px"; 465 } 466 else if (type == "widget-vignette") { 467 height = "450px"; 468 } 469 470 jQuery('.lastShortcode').val('[helloasso campaign="' + url + '" type="' + type + '" height="' + height + '"]'); 471 472 toCopy.select(); 473 document.execCommand('copy'); 474 return false; 276 jQuery(data).find('.ha-tooltip').animate({ opacity: 1 }, 500, function() { 277 setInterval(function() { 278 jQuery(data).find('.ha-tooltip').css('opacity', '0'); 279 }, 3000); 280 }); 281 jQuery('.lastShortcode').remove(); 282 jQuery(data).after('<input type="text" class="lastShortcode" id="lastShortcode" />'); 283 284 var toCopy = document.getElementById('lastShortcode'); 285 var type = jQuery(data).attr('data-type'); 286 var url = jQuery('.lastUrlWidget').val(); 287 288 var height = "70px"; 289 if (type == "widget-bouton") { 290 height = "70px"; 291 } else if (type == "widget") { 292 height = "750px"; 293 } else if (type == "widget-vignette") { 294 height = "450px"; 295 } 296 297 jQuery('.lastShortcode').val('[helloasso campaign="' + url + '" type="' + type + '" height="' + height + '"]'); 298 299 toCopy.select(); 300 document.execCommand('copy'); 301 return false; 475 302 } 476 303 … … 486 313 * 487 314 */ 488 (function (t, e) { "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.Typed = e() : t.Typed = e() })(this, function () { return function (t) { function e(n) { if (s[n]) return s[n].exports; var i = s[n] = { exports: {}, id: n, loaded: !1 }; return t[n].call(i.exports, i, i.exports, e), i.loaded = !0, i.exports } var s = {}; return e.m = t, e.c = s, e.p = "", e(0) }([function (t, e, s) { "use strict"; function n(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } Object.defineProperty(e, "__esModule", { value: !0 }); var i = function () { function t(t, e) { for (var s = 0; s < e.length; s++) { var n = e[s]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } }(), r = s(1), o = s(3), a = function () { function t(e, s) { n(this, t), r.initializer.load(this, s, e), this.begin() } return i(t, [{ key: "toggle", value: function () { this.pause.status ? this.start() : this.stop() } }, { key: "stop", value: function () { this.typingComplete || this.pause.status || (this.toggleBlinking(!0), this.pause.status = !0, this.options.onStop(this.arrayPos, this)) } }, { key: "start", value: function () { this.typingComplete || this.pause.status && (this.pause.status = !1, this.pause.typewrite ? this.typewrite(this.pause.curString, this.pause.curStrPos) : this.backspace(this.pause.curString, this.pause.curStrPos), this.options.onStart(this.arrayPos, this)) } }, { key: "destroy", value: function () { this.reset(!1), this.options.onDestroy(this) } }, { key: "reset", value: function () { var t = arguments.length <= 0 || void 0 === arguments[0] || arguments[0]; clearInterval(this.timeout), this.replaceText(""), this.cursor && this.cursor.parentNode && (this.cursor.parentNode.removeChild(this.cursor), this.cursor = null), this.strPos = 0, this.arrayPos = 0, this.curLoop = 0, t && (this.insertCursor(), this.options.onReset(this), this.begin()) } }, { key: "begin", value: function () { var t = this; this.typingComplete = !1, this.shuffleStringsIfNeeded(this), this.insertCursor(), this.bindInputFocusEvents && this.bindFocusEvents(), this.timeout = setTimeout(function () { t.currentElContent && 0 !== t.currentElContent.length ? t.backspace(t.currentElContent, t.currentElContent.length) : t.typewrite(t.strings[t.sequence[t.arrayPos]], t.strPos) }, this.startDelay) } }, { key: "typewrite", value: function (t, e) { var s = this; this.fadeOut && this.el.classList.contains(this.fadeOutClass) && (this.el.classList.remove(this.fadeOutClass), this.cursor && this.cursor.classList.remove(this.fadeOutClass)); var n = this.humanizer(this.typeSpeed), i = 1; return this.pause.status === !0 ? void this.setPauseStatus(t, e, !0) : void (this.timeout = setTimeout(function () { e = o.htmlParser.typeHtmlChars(t, e, s); var n = 0, r = t.substr(e); if ("^" === r.charAt(0) && /^\^\d+/.test(r)) { var a = 1; r = /\d+/.exec(r)[0], a += r.length, n = parseInt(r), s.temporaryPause = !0, s.options.onTypingPaused(s.arrayPos, s), t = t.substring(0, e) + t.substring(e + a), s.toggleBlinking(!0) } if ("`" === r.charAt(0)) { for (; "`" !== t.substr(e + i).charAt(0) && (i++, !(e + i > t.length));); var u = t.substring(0, e), l = t.substring(u.length + 1, e + i), c = t.substring(e + i + 1); t = u + l + c, i-- } s.timeout = setTimeout(function () { s.toggleBlinking(!1), e === t.length ? s.doneTyping(t, e) : s.keepTyping(t, e, i), s.temporaryPause && (s.temporaryPause = !1, s.options.onTypingResumed(s.arrayPos, s)) }, n) }, n)) } }, { key: "keepTyping", value: function (t, e, s) { 0 === e && (this.toggleBlinking(!1), this.options.preStringTyped(this.arrayPos, this)), e += s; var n = t.substr(0, e); this.replaceText(n), this.typewrite(t, e) } }, { key: "doneTyping", value: function (t, e) { var s = this; this.options.onStringTyped(this.arrayPos, this), this.toggleBlinking(!0), this.arrayPos === this.strings.length - 1 && (this.complete(), this.loop === !1 || this.curLoop === this.loopCount) || (this.timeout = setTimeout(function () { s.backspace(t, e) }, this.backDelay)) } }, { key: "backspace", value: function (t, e) { var s = this; if (this.pause.status === !0) return void this.setPauseStatus(t, e, !0); if (this.fadeOut) return this.initFadeOut(); this.toggleBlinking(!1); var n = this.humanizer(this.backSpeed); this.timeout = setTimeout(function () { e = o.htmlParser.backSpaceHtmlChars(t, e, s); var n = t.substr(0, e); if (s.replaceText(n), s.smartBackspace) { var i = s.strings[s.arrayPos + 1]; i && n === i.substr(0, e) ? s.stopNum = e : s.stopNum = 0 } e > s.stopNum ? (e--, s.backspace(t, e)) : e <= s.stopNum && (s.arrayPos++, s.arrayPos === s.strings.length ? (s.arrayPos = 0, s.options.onLastStringBackspaced(), s.shuffleStringsIfNeeded(), s.begin()) : s.typewrite(s.strings[s.sequence[s.arrayPos]], e)) }, n) } }, { key: "complete", value: function () { this.options.onComplete(this), this.loop ? this.curLoop++ : this.typingComplete = !0 } }, { key: "setPauseStatus", value: function (t, e, s) { this.pause.typewrite = s, this.pause.curString = t, this.pause.curStrPos = e } }, { key: "toggleBlinking", value: function (t) { this.cursor && (this.pause.status || this.cursorBlinking !== t && (this.cursorBlinking = t, t ? this.cursor.classList.add("typed-cursor--blink") : this.cursor.classList.remove("typed-cursor--blink"))) } }, { key: "humanizer", value: function (t) { return Math.round(Math.random() * t / 2) + t } }, { key: "shuffleStringsIfNeeded", value: function () { this.shuffle && (this.sequence = this.sequence.sort(function () { return Math.random() - .5 })) } }, { key: "initFadeOut", value: function () { var t = this; return this.el.className += " " + this.fadeOutClass, this.cursor && (this.cursor.className += " " + this.fadeOutClass), setTimeout(function () { t.arrayPos++, t.replaceText(""), t.strings.length > t.arrayPos ? t.typewrite(t.strings[t.sequence[t.arrayPos]], 0) : (t.typewrite(t.strings[0], 0), t.arrayPos = 0) }, this.fadeOutDelay) } }, { key: "replaceText", value: function (t) { this.attr ? this.el.setAttribute(this.attr, t) : this.isInput ? this.el.value = t : "html" === this.contentType ? this.el.innerHTML = t : this.el.textContent = t } }, { key: "bindFocusEvents", value: function () { var t = this; this.isInput && (this.el.addEventListener("focus", function (e) { t.stop() }), this.el.addEventListener("blur", function (e) { t.el.value && 0 !== t.el.value.length || t.start() })) } }, { key: "insertCursor", value: function () { this.showCursor && (this.cursor || (this.cursor = document.createElement("span"), this.cursor.className = "typed-cursor", this.cursor.innerHTML = this.cursorChar, this.el.parentNode && this.el.parentNode.insertBefore(this.cursor, this.el.nextSibling))) } }]), t }(); e["default"] = a, t.exports = e["default"] }, function (t, e, s) { "use strict"; function n(t) { return t && t.__esModule ? t : { "default": t } } function i(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } Object.defineProperty(e, "__esModule", { value: !0 }); var r = Object.assign || function (t) { for (var e = 1; e < arguments.length; e++) { var s = arguments[e]; for (var n in s) Object.prototype.hasOwnProperty.call(s, n) && (t[n] = s[n]) } return t }, o = function () { function t(t, e) { for (var s = 0; s < e.length; s++) { var n = e[s]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } }(), a = s(2), u = n(a), l = function () { function t() { i(this, t) } return o(t, [{ key: "load", value: function (t, e, s) { if ("string" == typeof s ? t.el = document.querySelector(s) : t.el = s, t.options = r({}, u["default"], e), t.isInput = "input" === t.el.tagName.toLowerCase(), t.attr = t.options.attr, t.bindInputFocusEvents = t.options.bindInputFocusEvents, t.showCursor = !t.isInput && t.options.showCursor, t.cursorChar = t.options.cursorChar, t.cursorBlinking = !0, t.elContent = t.attr ? t.el.getAttribute(t.attr) : t.el.textContent, t.contentType = t.options.contentType, t.typeSpeed = t.options.typeSpeed, t.startDelay = t.options.startDelay, t.backSpeed = t.options.backSpeed, t.smartBackspace = t.options.smartBackspace, t.backDelay = t.options.backDelay, t.fadeOut = t.options.fadeOut, t.fadeOutClass = t.options.fadeOutClass, t.fadeOutDelay = t.options.fadeOutDelay, t.isPaused = !1, t.strings = t.options.strings.map(function (t) { return t.trim() }), "string" == typeof t.options.stringsElement ? t.stringsElement = document.querySelector(t.options.stringsElement) : t.stringsElement = t.options.stringsElement, t.stringsElement) { t.strings = [], t.stringsElement.style.display = "none"; var n = Array.prototype.slice.apply(t.stringsElement.children), i = n.length; if (i) for (var o = 0; o < i; o += 1) { var a = n[o]; t.strings.push(a.innerHTML.trim()) } } t.strPos = 0, t.arrayPos = 0, t.stopNum = 0, t.loop = t.options.loop, t.loopCount = t.options.loopCount, t.curLoop = 0, t.shuffle = t.options.shuffle, t.sequence = [], t.pause = { status: !1, typewrite: !0, curString: "", curStrPos: 0 }, t.typingComplete = !1; for (var o in t.strings) t.sequence[o] = o; t.currentElContent = this.getCurrentElContent(t), t.autoInsertCss = t.options.autoInsertCss, this.appendAnimationCss(t) } }, { key: "getCurrentElContent", value: function (t) { var e = ""; return e = t.attr ? t.el.getAttribute(t.attr) : t.isInput ? t.el.value : "html" === t.contentType ? t.el.innerHTML : t.el.textContent } }, { key: "appendAnimationCss", value: function (t) { var e = "data-typed-js-css"; if (t.autoInsertCss && (t.showCursor || t.fadeOut) && !document.querySelector("[" + e + "]")) { var s = document.createElement("style"); s.type = "text/css", s.setAttribute(e, !0); var n = ""; t.showCursor && (n += "\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n "), t.fadeOut && (n += "\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n "), 0 !== s.length && (s.innerHTML = n, document.body.appendChild(s)) } } }]), t }(); e["default"] = l; var c = new l; e.initializer = c }, function (t, e) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var s = { strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"], stringsElement: null, typeSpeed: 0, startDelay: 0, backSpeed: 0, smartBackspace: !0, shuffle: !1, backDelay: 700, fadeOut: !1, fadeOutClass: "typed-fade-out", fadeOutDelay: 500, loop: !1, loopCount: 1 / 0, showCursor: !0, cursorChar: "|", autoInsertCss: !0, attr: null, bindInputFocusEvents: !1, contentType: "html", onComplete: function (t) { }, preStringTyped: function (t, e) { }, onStringTyped: function (t, e) { }, onLastStringBackspaced: function (t) { }, onTypingPaused: function (t, e) { }, onTypingResumed: function (t, e) { }, onReset: function (t) { }, onStop: function (t, e) { }, onStart: function (t, e) { }, onDestroy: function (t) { } }; e["default"] = s, t.exports = e["default"] }, function (t, e) { "use strict"; function s(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } Object.defineProperty(e, "__esModule", { value: !0 }); var n = function () { function t(t, e) { for (var s = 0; s < e.length; s++) { var n = e[s]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } }(), i = function () { function t() { s(this, t) } return n(t, [{ key: "typeHtmlChars", value: function (t, e, s) { if ("html" !== s.contentType) return e; var n = t.substr(e).charAt(0); if ("<" === n || "&" === n) { var i = ""; for (i = "<" === n ? ">" : ";"; t.substr(e + 1).charAt(0) !== i && (e++, !(e + 1 > t.length));); e++ } return e } }, { key: "backSpaceHtmlChars", value: function (t, e, s) { if ("html" !== s.contentType) return e; var n = t.substr(e).charAt(0); if (">" === n || ";" === n) { var i = ""; for (i = ">" === n ? "<" : "&"; t.substr(e - 1).charAt(0) !== i && (e--, !(e < 0));); e-- } return e } }]), t }(); e["default"] = i; var r = new i; e.htmlParser = r }]) }); 315 (function(t, e) { "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.Typed = e() : t.Typed = e() })(this, function() { 316 return function(t) { 317 function e(n) { if (s[n]) return s[n].exports; var i = s[n] = { exports: {}, id: n, loaded: !1 }; return t[n].call(i.exports, i, i.exports, e), i.loaded = !0, i.exports } 318 var s = {}; 319 return e.m = t, e.c = s, e.p = "", e(0) 320 }([function(t, e, s) { 321 "use strict"; 322 323 function n(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } 324 Object.defineProperty(e, "__esModule", { value: !0 }); 325 var i = function() { 326 function t(t, e) { 327 for (var s = 0; s < e.length; s++) { 328 var n = e[s]; 329 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) 330 } 331 } 332 return function(e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } 333 }(), 334 r = s(1), 335 o = s(3), 336 a = function() { 337 function t(e, s) { n(this, t), r.initializer.load(this, s, e), this.begin() } 338 return i(t, [{ key: "toggle", value: function() { this.pause.status ? this.start() : this.stop() } }, { key: "stop", value: function() { this.typingComplete || this.pause.status || (this.toggleBlinking(!0), this.pause.status = !0, this.options.onStop(this.arrayPos, this)) } }, { key: "start", value: function() { this.typingComplete || this.pause.status && (this.pause.status = !1, this.pause.typewrite ? this.typewrite(this.pause.curString, this.pause.curStrPos) : this.backspace(this.pause.curString, this.pause.curStrPos), this.options.onStart(this.arrayPos, this)) } }, { key: "destroy", value: function() { this.reset(!1), this.options.onDestroy(this) } }, { 339 key: "reset", 340 value: function() { 341 var t = arguments.length <= 0 || void 0 === arguments[0] || arguments[0]; 342 clearInterval(this.timeout), this.replaceText(""), this.cursor && this.cursor.parentNode && (this.cursor.parentNode.removeChild(this.cursor), this.cursor = null), this.strPos = 0, this.arrayPos = 0, this.curLoop = 0, t && (this.insertCursor(), this.options.onReset(this), this.begin()) 343 } 344 }, { 345 key: "begin", 346 value: function() { 347 var t = this; 348 this.typingComplete = !1, this.shuffleStringsIfNeeded(this), this.insertCursor(), this.bindInputFocusEvents && this.bindFocusEvents(), this.timeout = setTimeout(function() { t.currentElContent && 0 !== t.currentElContent.length ? t.backspace(t.currentElContent, t.currentElContent.length) : t.typewrite(t.strings[t.sequence[t.arrayPos]], t.strPos) }, this.startDelay) 349 } 350 }, { 351 key: "typewrite", 352 value: function(t, e) { 353 var s = this; 354 this.fadeOut && this.el.classList.contains(this.fadeOutClass) && (this.el.classList.remove(this.fadeOutClass), this.cursor && this.cursor.classList.remove(this.fadeOutClass)); 355 var n = this.humanizer(this.typeSpeed), 356 i = 1; 357 return this.pause.status === !0 ? void this.setPauseStatus(t, e, !0) : void(this.timeout = setTimeout(function() { 358 e = o.htmlParser.typeHtmlChars(t, e, s); 359 var n = 0, 360 r = t.substr(e); 361 if ("^" === r.charAt(0) && /^\^\d+/.test(r)) { 362 var a = 1; 363 r = /\d+/.exec(r)[0], a += r.length, n = parseInt(r), s.temporaryPause = !0, s.options.onTypingPaused(s.arrayPos, s), t = t.substring(0, e) + t.substring(e + a), s.toggleBlinking(!0) 364 } 365 if ("`" === r.charAt(0)) { 366 for (; 367 "`" !== t.substr(e + i).charAt(0) && (i++, !(e + i > t.length));); 368 var u = t.substring(0, e), 369 l = t.substring(u.length + 1, e + i), 370 c = t.substring(e + i + 1); 371 t = u + l + c, i-- 372 } 373 s.timeout = setTimeout(function() { s.toggleBlinking(!1), e === t.length ? s.doneTyping(t, e) : s.keepTyping(t, e, i), s.temporaryPause && (s.temporaryPause = !1, s.options.onTypingResumed(s.arrayPos, s)) }, n) 374 }, n)) 375 } 376 }, { 377 key: "keepTyping", 378 value: function(t, e, s) { 379 0 === e && (this.toggleBlinking(!1), this.options.preStringTyped(this.arrayPos, this)), e += s; 380 var n = t.substr(0, e); 381 this.replaceText(n), this.typewrite(t, e) 382 } 383 }, { 384 key: "doneTyping", 385 value: function(t, e) { 386 var s = this; 387 this.options.onStringTyped(this.arrayPos, this), this.toggleBlinking(!0), this.arrayPos === this.strings.length - 1 && (this.complete(), this.loop === !1 || this.curLoop === this.loopCount) || (this.timeout = setTimeout(function() { s.backspace(t, e) }, this.backDelay)) 388 } 389 }, { 390 key: "backspace", 391 value: function(t, e) { 392 var s = this; 393 if (this.pause.status === !0) return void this.setPauseStatus(t, e, !0); 394 if (this.fadeOut) return this.initFadeOut(); 395 this.toggleBlinking(!1); 396 var n = this.humanizer(this.backSpeed); 397 this.timeout = setTimeout(function() { 398 e = o.htmlParser.backSpaceHtmlChars(t, e, s); 399 var n = t.substr(0, e); 400 if (s.replaceText(n), s.smartBackspace) { 401 var i = s.strings[s.arrayPos + 1]; 402 i && n === i.substr(0, e) ? s.stopNum = e : s.stopNum = 0 403 } 404 e > s.stopNum ? (e--, s.backspace(t, e)) : e <= s.stopNum && (s.arrayPos++, s.arrayPos === s.strings.length ? (s.arrayPos = 0, s.options.onLastStringBackspaced(), s.shuffleStringsIfNeeded(), s.begin()) : s.typewrite(s.strings[s.sequence[s.arrayPos]], e)) 405 }, n) 406 } 407 }, { key: "complete", value: function() { this.options.onComplete(this), this.loop ? this.curLoop++ : this.typingComplete = !0 } }, { key: "setPauseStatus", value: function(t, e, s) { this.pause.typewrite = s, this.pause.curString = t, this.pause.curStrPos = e } }, { key: "toggleBlinking", value: function(t) { this.cursor && (this.pause.status || this.cursorBlinking !== t && (this.cursorBlinking = t, t ? this.cursor.classList.add("typed-cursor--blink") : this.cursor.classList.remove("typed-cursor--blink"))) } }, { key: "humanizer", value: function(t) { return Math.round(Math.random() * t / 2) + t } }, { key: "shuffleStringsIfNeeded", value: function() { this.shuffle && (this.sequence = this.sequence.sort(function() { return Math.random() - .5 })) } }, { key: "initFadeOut", value: function() { var t = this; return this.el.className += " " + this.fadeOutClass, this.cursor && (this.cursor.className += " " + this.fadeOutClass), setTimeout(function() { t.arrayPos++, t.replaceText(""), t.strings.length > t.arrayPos ? t.typewrite(t.strings[t.sequence[t.arrayPos]], 0) : (t.typewrite(t.strings[0], 0), t.arrayPos = 0) }, this.fadeOutDelay) } }, { key: "replaceText", value: function(t) { this.attr ? this.el.setAttribute(this.attr, t) : this.isInput ? this.el.value = t : "html" === this.contentType ? this.el.innerHTML = t : this.el.textContent = t } }, { 408 key: "bindFocusEvents", 409 value: function() { 410 var t = this; 411 this.isInput && (this.el.addEventListener("focus", function(e) { t.stop() }), this.el.addEventListener("blur", function(e) { t.el.value && 0 !== t.el.value.length || t.start() })) 412 } 413 }, { key: "insertCursor", value: function() { this.showCursor && (this.cursor || (this.cursor = document.createElement("span"), this.cursor.className = "typed-cursor", this.cursor.innerHTML = this.cursorChar, this.el.parentNode && this.el.parentNode.insertBefore(this.cursor, this.el.nextSibling))) } }]), t 414 }(); 415 e["default"] = a, t.exports = e["default"] 416 }, function(t, e, s) { 417 "use strict"; 418 419 function n(t) { return t && t.__esModule ? t : { "default": t } } 420 421 function i(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } 422 Object.defineProperty(e, "__esModule", { value: !0 }); 423 var r = Object.assign || function(t) { for (var e = 1; e < arguments.length; e++) { var s = arguments[e]; for (var n in s) Object.prototype.hasOwnProperty.call(s, n) && (t[n] = s[n]) } return t }, 424 o = function() { 425 function t(t, e) { 426 for (var s = 0; s < e.length; s++) { 427 var n = e[s]; 428 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) 429 } 430 } 431 return function(e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } 432 }(), 433 a = s(2), 434 u = n(a), 435 l = function() { 436 function t() { i(this, t) } 437 return o(t, [{ 438 key: "load", 439 value: function(t, e, s) { 440 if ("string" == typeof s ? t.el = document.querySelector(s) : t.el = s, t.options = r({}, u["default"], e), t.isInput = "input" === t.el.tagName.toLowerCase(), t.attr = t.options.attr, t.bindInputFocusEvents = t.options.bindInputFocusEvents, t.showCursor = !t.isInput && t.options.showCursor, t.cursorChar = t.options.cursorChar, t.cursorBlinking = !0, t.elContent = t.attr ? t.el.getAttribute(t.attr) : t.el.textContent, t.contentType = t.options.contentType, t.typeSpeed = t.options.typeSpeed, t.startDelay = t.options.startDelay, t.backSpeed = t.options.backSpeed, t.smartBackspace = t.options.smartBackspace, t.backDelay = t.options.backDelay, t.fadeOut = t.options.fadeOut, t.fadeOutClass = t.options.fadeOutClass, t.fadeOutDelay = t.options.fadeOutDelay, t.isPaused = !1, t.strings = t.options.strings.map(function(t) { return t.trim() }), "string" == typeof t.options.stringsElement ? t.stringsElement = document.querySelector(t.options.stringsElement) : t.stringsElement = t.options.stringsElement, t.stringsElement) { 441 t.strings = [], t.stringsElement.style.display = "none"; 442 var n = Array.prototype.slice.apply(t.stringsElement.children), 443 i = n.length; 444 if (i) 445 for (var o = 0; o < i; o += 1) { 446 var a = n[o]; 447 t.strings.push(a.innerHTML.trim()) 448 } 449 } 450 t.strPos = 0, t.arrayPos = 0, t.stopNum = 0, t.loop = t.options.loop, t.loopCount = t.options.loopCount, t.curLoop = 0, t.shuffle = t.options.shuffle, t.sequence = [], t.pause = { status: !1, typewrite: !0, curString: "", curStrPos: 0 }, t.typingComplete = !1; 451 for (var o in t.strings) t.sequence[o] = o; 452 t.currentElContent = this.getCurrentElContent(t), t.autoInsertCss = t.options.autoInsertCss, this.appendAnimationCss(t) 453 } 454 }, { key: "getCurrentElContent", value: function(t) { var e = ""; return e = t.attr ? t.el.getAttribute(t.attr) : t.isInput ? t.el.value : "html" === t.contentType ? t.el.innerHTML : t.el.textContent } }, { 455 key: "appendAnimationCss", 456 value: function(t) { 457 var e = "data-typed-js-css"; 458 if (t.autoInsertCss && (t.showCursor || t.fadeOut) && !document.querySelector("[" + e + "]")) { 459 var s = document.createElement("style"); 460 s.type = "text/css", s.setAttribute(e, !0); 461 var n = ""; 462 t.showCursor && (n += "\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n "), t.fadeOut && (n += "\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n "), 0 !== s.length && (s.innerHTML = n, document.body.appendChild(s)) 463 } 464 } 465 }]), t 466 }(); 467 e["default"] = l; 468 var c = new l; 469 e.initializer = c 470 }, function(t, e) { 471 "use strict"; 472 Object.defineProperty(e, "__esModule", { value: !0 }); 473 var s = { strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"], stringsElement: null, typeSpeed: 0, startDelay: 0, backSpeed: 0, smartBackspace: !0, shuffle: !1, backDelay: 700, fadeOut: !1, fadeOutClass: "typed-fade-out", fadeOutDelay: 500, loop: !1, loopCount: 1 / 0, showCursor: !0, cursorChar: "|", autoInsertCss: !0, attr: null, bindInputFocusEvents: !1, contentType: "html", onComplete: function(t) {}, preStringTyped: function(t, e) {}, onStringTyped: function(t, e) {}, onLastStringBackspaced: function(t) {}, onTypingPaused: function(t, e) {}, onTypingResumed: function(t, e) {}, onReset: function(t) {}, onStop: function(t, e) {}, onStart: function(t, e) {}, onDestroy: function(t) {} }; 474 e["default"] = s, t.exports = e["default"] 475 }, function(t, e) { 476 "use strict"; 477 478 function s(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } 479 Object.defineProperty(e, "__esModule", { value: !0 }); 480 var n = function() { 481 function t(t, e) { 482 for (var s = 0; s < e.length; s++) { 483 var n = e[s]; 484 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) 485 } 486 } 487 return function(e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } 488 }(), 489 i = function() { 490 function t() { s(this, t) } 491 return n(t, [{ 492 key: "typeHtmlChars", 493 value: function(t, e, s) { 494 if ("html" !== s.contentType) return e; 495 var n = t.substr(e).charAt(0); 496 if ("<" === n || "&" === n) { 497 var i = ""; 498 for (i = "<" === n ? ">" : ";"; t.substr(e + 1).charAt(0) !== i && (e++, !(e + 1 > t.length));); 499 e++ 500 } 501 return e 502 } 503 }, { 504 key: "backSpaceHtmlChars", 505 value: function(t, e, s) { 506 if ("html" !== s.contentType) return e; 507 var n = t.substr(e).charAt(0); 508 if (">" === n || ";" === n) { 509 var i = ""; 510 for (i = ">" === n ? "<" : "&"; t.substr(e - 1).charAt(0) !== i && (e--, !(e < 0));); 511 e-- 512 } 513 return e 514 } 515 }]), t 516 }(); 517 e["default"] = i; 518 var r = new i; 519 e.htmlParser = r 520 }]) 521 }); 489 522 //# sourceMappingURL=typed.min.js.map -
helloasso/tags/1.1.21/hello-asso.php
r3316366 r3318658 17 17 * Plugin URI: https://centredaide.helloasso.com/s/article/paiement-en-ligne-wordpress-integrer-vos-campagnes-helloasso 18 18 * Description: HelloAsso est la solution gratuite des associations pour collecter des paiements et des dons sur internet. 19 * Version: 1.1.2 019 * Version: 1.1.21 20 20 * Author: HelloAsso 21 21 * Author URI: https://helloasso.com … … 37 37 * Rename this for your plugin and update it as you release new versions. 38 38 */ 39 define('HELLO_ASSO_VERSION', '1.1.2 0');39 define('HELLO_ASSO_VERSION', '1.1.21'); 40 40 41 41 /** -
helloasso/trunk/README.txt
r3316366 r3318658 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.2.34 8 Stable tag: 1.1.2 08 Stable tag: 1.1.21 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 81 81 82 82 == Changelog == 83 84 = 1.1.21 = 85 * Déplacement des appels API en back pour éviter les erreurs CORS 83 86 84 87 = 1.1.20 = -
helloasso/trunk/admin/class-hello-asso-admin.php
r3316366 r3318658 442 442 public function loadAjax() 443 443 { 444 445 444 add_action('wp_ajax_ha_ajax', 'ha_ajax'); 446 445 add_action('wp_ajax_nopriv_ha_ajax', 'ha_ajax'); 446 add_action('wp_ajax_ha_search_campaign', 'ha_search_campaign'); 447 add_action('wp_ajax_nopriv_ha_search_campaign', 'ha_search_campaign'); 447 448 448 449 function sanitizeArray($data = array()) … … 462 463 } 463 464 465 function ha_search_campaign() 466 { 467 check_ajax_referer('helloassosecuritytoken11', 'security'); 468 469 if (!is_user_logged_in() || !current_user_can('manage_options')) { 470 wp_die('Vous n\'avez pas les droits nécessaires pour exécuter cette action.'); 471 } 472 473 $value = sanitize_text_field($_POST['value']); 474 475 if (empty($value)) { 476 wp_send_json_error('Le champ est vide.'); 477 return; 478 } 479 480 $url = parse_url($value); 481 $sandbox = false; 482 $nameAsso = ''; 483 484 if ($url !== false) { 485 $domain = $url['host']; 486 487 if ($domain == 'helloasso-sandbox.com' || $domain == 'www.helloasso-sandbox.com') { 488 $sandbox = true; 489 } 490 491 if ($domain != 'helloasso.com' && $domain != 'www.helloasso.com' && $domain != 'helloasso-sandbox.com' && $domain != 'www.helloasso-sandbox.com') { 492 $nameAsso = ''; 493 } else { 494 $slug = explode('/', $value); 495 $nameAsso = isset($slug[4]) ? $slug[4] : ''; 496 } 497 } else { 498 $nameAsso = sanitize_title_with_dashes($value); 499 } 500 501 if (empty($nameAsso)) { 502 wp_send_json_error('URL ou nom d\'association invalide.'); 503 return; 504 } 505 506 $apiUrl = $sandbox ? 'https://api.helloasso-sandbox.com' : 'https://api.helloasso.com'; 507 $body = array( 508 'grant_type' => 'client_credentials', 509 'client_id' => $sandbox ? '3732d11d-e73a-40a2-aa28-a54fa1aa76be' : '049A416C-5820-45FE-B645-1D06FB4AA622', 510 'client_secret' => $sandbox ? 'vOsIvf7T496A5/LGeTG6Uq7CNdFydh8s' : 'I+YF/JjLrcE1+iPEFul+BBJDWIil+1g5' 511 ); 512 513 $token_response = ha_curl_post($apiUrl . '/oauth2/token', $body); 514 515 if ($token_response === false) { 516 wp_send_json_error('Erreur de connexion à l\'API HelloAsso.'); 517 return; 518 } 519 520 $token_data = json_decode($token_response, true); 521 522 if (!isset($token_data['access_token'])) { 523 wp_send_json_error('Erreur d\'authentification avec l\'API HelloAsso.'); 524 return; 525 } 526 527 $bearer_token = $token_data['access_token']; 528 529 $org_response = ha_curl_get($apiUrl . '/v5/organizations/' . $nameAsso, $bearer_token); 530 531 if ($org_response === false) { 532 wp_send_json_error('Erreur lors de la récupération des informations de l\'organisation.'); 533 return; 534 } 535 536 $org_data = json_decode($org_response, true); 537 538 if (!isset($org_data['name'])) { 539 wp_send_json_error('Organisation non trouvée.'); 540 return; 541 } 542 543 $asso_name = $org_data['name']; 544 $all_campaigns = array(); 545 $total_count = 0; 546 547 for ($i = 1; $i <= 5; $i++) { 548 $campaign_response = ha_curl_get($apiUrl . '/v5/organizations/' . $nameAsso . '/forms?pageSize=20&pageIndex=' . $i, $bearer_token); 549 550 if ($campaign_response === false) { 551 continue; 552 } 553 554 $campaign_data = json_decode($campaign_response, true); 555 556 if (isset($campaign_data['data']) && is_array($campaign_data['data'])) { 557 $count = count($campaign_data['data']); 558 $total_count += $count; 559 $all_campaigns = array_merge($all_campaigns, $campaign_data['data']); 560 561 if (isset($campaign_data['pagination']['totalCount']) && $total_count >= $campaign_data['pagination']['totalCount']) { 562 break; 563 } 564 } 565 566 usleep(1250000); 567 } 568 569 if (empty($all_campaigns)) { 570 wp_send_json_error('Aucune campagne trouvée pour cette organisation.'); 571 return; 572 } 573 574 $result = array( 575 'success' => true, 576 'asso_name' => $asso_name, 577 'campaigns' => $all_campaigns, 578 'total_count' => $total_count, 579 'slug' => $nameAsso 580 ); 581 582 wp_send_json($result); 583 } 584 585 function ha_curl_post($url, $data) 586 { 587 $ch = curl_init(); 588 589 curl_setopt($ch, CURLOPT_URL, $url); 590 curl_setopt($ch, CURLOPT_POST, true); 591 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); 592 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 593 curl_setopt($ch, CURLOPT_TIMEOUT, 30); 594 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 595 curl_setopt($ch, CURLOPT_HTTPHEADER, array( 596 'Content-Type: application/x-www-form-urlencoded' 597 )); 598 599 $response = curl_exec($ch); 600 $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 601 $error = curl_error($ch); 602 603 curl_close($ch); 604 605 if ($error || $http_code !== 200) { 606 return false; 607 } 608 609 return $response; 610 } 611 612 function ha_curl_get($url, $bearer_token = null) 613 { 614 $ch = curl_init(); 615 616 curl_setopt($ch, CURLOPT_URL, $url); 617 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 618 curl_setopt($ch, CURLOPT_TIMEOUT, 30); 619 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 620 621 $headers = array(); 622 if ($bearer_token) { 623 $headers[] = 'Authorization: Bearer ' . $bearer_token; 624 } 625 626 if (!empty($headers)) { 627 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 628 } 629 630 $response = curl_exec($ch); 631 $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 632 $error = curl_error($ch); 633 634 curl_close($ch); 635 636 if ($error || $http_code !== 200) { 637 return false; 638 } 639 640 return $response; 641 } 642 464 643 function ha_ajax() 465 644 { … … 467 646 468 647 if (! is_user_logged_in() || ! current_user_can('manage_options')) { 469 wp_die('Vous n ’avez pas les droits nécessaires pour exécuter cette action.');648 wp_die('Vous n\'avez pas les droits nécessaires pour exécuter cette action.'); 470 649 } 471 650 … … 494 673 } elseif (isset($_POST['slug']) && is_numeric($_POST['error']) && is_array($campaign) && isset($_POST['increase']) && $_POST['increase'] > 1) { 495 674 $currentCampain = get_option('ha-campaign'); 496 // increade current campain with campain497 675 $campaign = array_merge($currentCampain, $campaign); 498 676 update_option('ha-campaign', $campaign); -
helloasso/trunk/admin/js/hello-asso-admin.js
r3316366 r3318658 1 (function ($) {2 'use strict';3 4 /**5 * All of the code for your admin-facing JavaScript source6 * should reside in this file.7 *8 * Note: It has been assumed you will write jQuery code here, so the9 * $ function reference has been prepared for usage within the scope10 * of this function.11 *12 * This enables you to define handlers, for when the DOM is ready:13 *14 * $(function() {15 *16 * });17 *18 * When the window is loaded:19 *20 * $( window ).load(function() {21 *22 * });23 *24 * ...and/or other possibilities.25 *26 * Ideally, it is not considered best practise to attach more than a27 * single DOM-ready or window-load handler for a particular page.28 * Although scripts in the WordPress core, Plugins and Themes may be29 * practising this, we should strive to set a better example in our own work.30 */31 32 jQuery(document).ready(function() {33 34 var url = window.location.href,35 hash = url.split('#')[1];36 37 if (hash == 'ha-popup') {38 window.location.hash = "";39 jQuery("#ha-popup").hide();40 }41 var campaign = jQuery('.ha-campaign-info');42 var sidebar = jQuery('.ha-campaign-right');43 var close = jQuery('.ha-campaign-right .close-campaign-viewer');44 45 campaign.click(function() {46 sidebar.css({47 "-webkit-transform": "translate(0, 0)",48 "transform": "translate(0, 0)"49 })50 return false;51 })52 53 close.click(function() {54 sidebar.css({55 "-webkit-transform": "translate(100%, 0)",56 "transform": "translate(100%, 0)"57 })58 return false;59 })60 })1 (function($) { 2 'use strict'; 3 4 /** 5 * All of the code for your admin-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 32 jQuery(document).ready(function() { 33 34 var url = window.location.href, 35 hash = url.split('#')[1]; 36 37 if (hash == 'ha-popup') { 38 window.location.hash = ""; 39 jQuery("#ha-popup").hide(); 40 } 41 var campaign = jQuery('.ha-campaign-info'); 42 var sidebar = jQuery('.ha-campaign-right'); 43 var close = jQuery('.ha-campaign-right .close-campaign-viewer'); 44 45 campaign.click(function() { 46 sidebar.css({ 47 "-webkit-transform": "translate(0, 0)", 48 "transform": "translate(0, 0)" 49 }) 50 return false; 51 }) 52 53 close.click(function() { 54 sidebar.css({ 55 "-webkit-transform": "translate(100%, 0)", 56 "transform": "translate(100%, 0)" 57 }) 58 return false; 59 }) 60 }) 61 61 62 62 })(jQuery); 63 63 64 64 function ha_dropdown() { 65 document.getElementById("ha-dropdown").classList.toggle("ha-show");65 document.getElementById("ha-dropdown").classList.toggle("ha-show"); 66 66 } 67 67 68 68 // Close the dropdown menu if the user clicks outside of it 69 window.onclick = function (event) { 70 if (!jQuery(event.target).hasClass('ha-open-dropdown')) { 71 var dropdowns = document.getElementsByClassName("ha-dropdown-content"); 72 var i; 73 for (i = 0; i < dropdowns.length; i++) { 74 var openDropdown = dropdowns[i]; 75 if (openDropdown.classList.contains('ha-show')) { 76 openDropdown.classList.remove('ha-show'); 77 } 78 } 79 } 80 } 81 82 function parseUrl(str) { 83 try { 84 var url = new URL(str); 85 } catch (TypeError) { 86 return null; 87 } 88 return url; 69 window.onclick = function(event) { 70 if (!jQuery(event.target).hasClass('ha-open-dropdown')) { 71 var dropdowns = document.getElementsByClassName("ha-dropdown-content"); 72 var i; 73 for (i = 0; i < dropdowns.length; i++) { 74 var openDropdown = dropdowns[i]; 75 if (openDropdown.classList.contains('ha-show')) { 76 openDropdown.classList.remove('ha-show'); 77 } 78 } 79 } 89 80 } 90 81 91 82 const haResetInput = () => { 92 jQuery(".ha-search").val('');93 haCheckInput();83 jQuery(".ha-search").val(''); 84 haCheckInput(); 94 85 } 95 86 96 87 const haCheckInput = () => { 97 const value = jQuery(".ha-search").val(); 98 99 if (value == '') { 100 jQuery('.searchCampaign').attr('disabled', true); 101 } 102 else { 103 jQuery('.searchCampaign').attr('disabled', false); 104 } 105 } 106 107 function toSeoUrl(url) { 108 return url.toString() // Convert to string 109 .normalize('NFD') // Change diacritics 110 .replace(/'/g, '-') // Replace apostrophe 111 .replace(/[\u0300-\u036f]/g, '') // Remove illegal characters 112 .replace(/\s+/g, '-') // Change whitespace to dashes 113 .toLowerCase() // Change to lowercase 114 .replace(/&/g, '-') // Replace ampersand 115 .replace(/[^a-z0-9\-]/g, '') // Remove anything that is not a letter, number or dash 116 .replace(/-+/g, '-') // Remove duplicate dashes 117 .replace(/^-*/, '') // Remove starting dashes 118 .replace(/-*$/, ''); // Remove trailing dashes 88 const value = jQuery(".ha-search").val(); 89 90 if (value == '') { 91 jQuery('.searchCampaign').attr('disabled', true); 92 } else { 93 jQuery('.searchCampaign').attr('disabled', false); 94 } 119 95 } 120 96 121 97 const searchCampaign = () => { 122 const value = jQuery(".ha-search").val(); 123 124 if (value == '') { 125 jQuery('.ha-error span').html('Le champ est vide.'); 126 } 127 else { 128 var url = parseUrl(value); 129 var sandbox = false; 130 if (url != null) { 131 var domain = url.hostname; 132 133 if (domain == 'helloasso-sandbox.com' || domain == 'www.helloasso-sandbox.com') { 134 sandbox = true; 135 } 136 137 if (domain != 'helloasso.com' && domain != 'www.helloasso.com' && domain != 'helloasso-sandbox.com' && domain != 'www.helloasso-sandbox.com') { 138 var nameAsso = ''; 139 } 140 else { 141 var slug = value.split('/'); 142 var nameAsso = slug[4]; 143 } 144 } 145 else { 146 var nameAsso = toSeoUrl(value); 147 } 148 149 if (nameAsso != '') { 150 var apiUrl = 'https://api.helloasso.com'; 151 var body = { 152 grant_type: 'client_credentials', 153 client_id: '049A416C-5820-45FE-B645-1D06FB4AA622', 154 client_secret: 'I+YF/JjLrcE1+iPEFul+BBJDWIil+1g5' 155 }; 156 157 if (sandbox) { 158 apiUrl = 'https://api.helloasso-sandbox.com'; 159 body.client_id = '3732d11d-e73a-40a2-aa28-a54fa1aa76be'; 160 body.client_secret = 'vOsIvf7T496A5/LGeTG6Uq7CNdFydh8s'; 161 } 162 163 jQuery('.ha-error').hide(); 164 jQuery('.ha-sync').hide(); 165 166 jQuery.ajax({ 167 url: apiUrl + '/oauth2/token', 168 type: 'POST', 169 dataType: 'json', 170 timeout: 30000, 171 contentType: 'application/x-www-form-urlencoded; charset=UTF-8', 172 data: body, 173 beforeSend: function (result) { 174 jQuery('.ha-loader').show(); 175 jQuery('.ha-message').hide(); 176 jQuery(".searchCampaign").html('<svg class="ldi-igf6j3" width="140px" height="50px" style="margin-top:-15px;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" style="background: none;"><!--?xml version="1.0" encoding="utf-8"?--><!--Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)--><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" style="transform-origin: 50px 50px 0px;" xml:space="preserve"><g style="transform-origin: 50px 50px 0px;"><g style="transform-origin: 50px 50px 0px; transform: scale(0.6);"><g style="transform-origin: 50px 50px 0px;"><g><style type="text/css" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -1s; animation-direction: normal;">.st0{fill:#F4E6C8;} .st1{opacity:0.8;fill:#849B87;} .st2{fill:#D65A62;} .st3{fill:#E15C64;} .st4{fill:#F47E5F;} .st5{fill:#F7B26A;} .st6{fill:#FEE8A2;} .st7{fill:#ACBD81;} .st8{fill:#F5E169;} .st9{fill:#F0AF6B;} .st10{fill:#EA7C60;} .st11{fill:#A8B980;} .st12{fill:#829985;} .st13{fill:#798AAE;} .st14{fill:#8672A7;} .st15{fill:#CC5960;} .st16{fill:#E17A5F;} .st17{fill:#849B87;} .st18{opacity:0.8;fill:#E15C64;} .st19{opacity:0.8;fill:#F7B26A;} .st20{fill:#79A5B5;} .st21{opacity:0.8;fill:#79A5B4;} .st22{fill:#666766;}</style><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.923077s; animation-direction: normal;"><circle class="st2" cx="20" cy="50" r="10" fill="#ffffff" style="fill: rgb(255, 255, 255);"></circle></g><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.846154s; animation-direction: normal;"><circle class="st10" cx="50" cy="50" r="10" fill="#b3e9cd" style="fill: rgb(179, 233, 205);"></circle></g><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.769231s; animation-direction: normal;"><circle class="st9" cx="80" cy="50" r="10" fill="#86ecb6" style="fill: rgb(134, 236, 182);"></circle></g><metadata xmlns:d="https://loading.io/stock/" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.692308s; animation-direction: normal;"><d:name class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.615385s; animation-direction: normal;">ellipse</d:name><d:tags class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.538462s; animation-direction: normal;">dot,point,circle,waiting,typing,sending,message,ellipse,spinner</d:tags><d:license class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.461538s; animation-direction: normal;">cc-by</d:license><d:slug class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.384615s; animation-direction: normal;">igf6j3</d:slug></metadata></g></g></g></g><style type="text/css" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.307692s; animation-direction: normal;">@keyframes ld-fade {0% {opacity: 1;}100% { opacity: 0; }}@-webkit-keyframes ld-fade { 0% { opacity: 1; }100% {opacity: 0;} }.ld.ld-fade { -webkit-animation: ld-fade 1s infinite linear; animation: ld-fade 1s infinite linear;}</style></svg></svg>'); 177 178 }, 179 complete: function (result) { 180 }, 181 success: function (result) { 182 183 var bearerToken = result.access_token; 184 jQuery.ajax({ 185 url: apiUrl + `/v5/organizations/${nameAsso}`, 186 type: 'GET', 187 timeout: 30000, 188 headers: { 189 'Authorization': 'Bearer ' + bearerToken 190 }, 191 dataType: "json", 192 complete: function (ha) { 193 194 }, 195 success: function (result2) { 196 197 var assoName = result2.name; 198 let totalCount = 0; 199 for (let i = 1; i <= 5; i++) { 200 201 setTimeout(function () { 202 console.log(i); 203 204 205 jQuery.ajax({ 206 url: apiUrl + `/v5/organizations/${nameAsso}/forms?pageSize=20&pageIndex=${i}`, 207 type: 'GET', 208 timeout: 30000, 209 headers: { 210 'Authorization': 'Bearer ' + bearerToken 211 }, 212 dataType: "json", 213 complete: function (result) { 214 jQuery('.ha-loader').hide(); 215 }, 216 success: function (result3) { 217 let count = result3.data.length; 218 totalCount += count; 219 console.log(result3); 220 console.log(count); 221 222 223 jQuery.ajax({ 224 url: adminAjax.ajaxurl, 225 method: 'POST', 226 data: { action: 'ha_ajax', 'name': assoName, 'campaign': result3.data, 'slug': nameAsso, 'error': 0, 'security': adminAjax.ajax_nonce, 'increase': i }, 227 success: function (data) { 228 229 if (totalCount == result3.pagination.totalCount) { 230 location.reload(); 231 } 232 233 }, 234 error: function (data) { 235 console.log(data) 236 } 237 }); 238 }, 239 error: function (xhr, ajaxOptions, thrownError) { 240 241 if (ajaxOptions == "timeout") { 242 jQuery('.ha-no-sync').show(); 243 jQuery(".searchCampaign").html('Synchroniser'); 244 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 245 } 246 else { 247 if (xhr.status == 404) { 248 jQuery.ajax({ 249 url: adminAjax.ajaxurl, 250 method: 'POST', 251 data: { action: 'ha_ajax', 'campaign': '', 'slug': nameAsso, 'error': 1, 'security': adminAjax.ajax_nonce }, 252 success: function (data) { 253 254 location.reload(); 255 256 }, 257 error: function (data) { 258 } 259 }); 260 } 261 else if (xhr.status == 500) { 262 jQuery('.ha-no-sync').show(); 263 jQuery(".searchCampaign").html('Synchroniser'); 264 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 265 } 266 } 267 }, 268 }); 269 270 }, i * 1250) 271 } 272 273 274 275 276 }, 277 error: function (xhr, ajaxOptions, thrownError) { 278 279 if (ajaxOptions == "timeout") { 280 jQuery('.ha-no-sync').show(); 281 jQuery(".searchCampaign").html('Synchroniser'); 282 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 283 } 284 else { 285 if (xhr.status == 404) { 286 jQuery.ajax({ 287 url: adminAjax.ajaxurl, 288 method: 'POST', 289 data: { action: 'ha_ajax', 'campaign': '', 'slug': nameAsso, 'error': 1, 'security': adminAjax.ajax_nonce }, 290 success: function (data) { 291 292 location.reload(); 293 294 }, 295 error: function (data) { 296 } 297 }); 298 } 299 else if (xhr.status == 500) { 300 jQuery('.ha-no-sync').show(); 301 jQuery(".searchCampaign").html('Synchroniser'); 302 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 303 } 304 } 305 306 }, 307 }); 308 }, 309 error: function (xhr, ajaxOptions, thrownError) { 310 jQuery('.ha-error').show(); 311 jQuery('.ha-loader').hide(); 312 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 313 jQuery(".searchCampaign").html('Synchroniser'); 314 }, 315 }); 316 } 317 else { 318 jQuery('.ha-no-valid').fadeIn(); 319 jQuery('.ha-message').hide(); 320 } 321 } 98 const value = jQuery(".ha-search").val(); 99 100 if (value == '') { 101 jQuery('.ha-error span').html('Le champ est vide.'); 102 return; 103 } 104 105 jQuery('.ha-error').hide(); 106 jQuery('.ha-sync').hide(); 107 jQuery('.ha-loader').show(); 108 jQuery('.ha-message').hide(); 109 jQuery(".searchCampaign").html('<svg class="ldi-igf6j3" width="140px" height="50px" style="margin-top:-15px;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" style="background: none;"><!--?xml version="1.0" encoding="utf-8"?--><!--Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)--><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" style="transform-origin: 50px 50px 0px;" xml:space="preserve"><g style="transform-origin: 50px 50px 0px;"><g style="transform-origin: 50px 50px 0px; transform: scale(0.6);"><g style="transform-origin: 50px 50px 0px;"><g><style type="text/css" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -1s; animation-direction: normal;">.st0{fill:#F4E6C8;} .st1{opacity:0.8;fill:#849B87;} .st2{fill:#D65A62;} .st3{fill:#E15C64;} .st4{fill:#F47E5F;} .st5{fill:#F7B26A;} .st6{fill:#FEE8A2;} .st7{fill:#ACBD81;} .st8{fill:#F5E169;} .st9{fill:#F0AF6B;} .st10{fill:#EA7C60;} .st11{fill:#A8B980;} .st12{fill:#829985;} .st13{fill:#798AAE;} .st14{fill:#8672A7;} .st15{fill:#CC5960;} .st16{fill:#E17A5F;} .st17{fill:#849B87;} .st18{opacity:0.8;fill:#E15C64;} .st19{opacity:0.8;fill:#F7B26A;} .st20{fill:#79A5B5;} .st21{opacity:0.8;fill:#79A5B4;} .st22{fill:#666766;}</style><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.923077s; animation-direction: normal;"><circle class="st2" cx="20" cy="50" r="10" fill="#ffffff" style="fill: rgb(255, 255, 255);"></circle></g><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.846154s; animation-direction: normal;"><circle class="st10" cx="50" cy="50" r="10" fill="#b3e9cd" style="fill: rgb(179, 233, 205);"></circle></g><g class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.769231s; animation-direction: normal;"><circle class="st9" cx="80" cy="50" r="10" fill="#86ecb6" style="fill: rgb(134, 236, 182);"></circle></g><metadata xmlns:d="https://loading.io/stock/" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.692308s; animation-direction: normal;"><d:name class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.615385s; animation-direction: normal;">ellipse</d:name><d:tags class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.538462s; animation-direction: normal;">dot,point,circle,waiting,typing,sending,message,ellipse,spinner</d:tags><d:license class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.461538s; animation-direction: normal;">cc-by</d:license><d:slug class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.384615s; animation-direction: normal;">igf6j3</d:slug></metadata></g></g></g></g><style type="text/css" class="ld ld-fade" style="transform-origin: 50px 50px 0px; animation-duration: 1s; animation-delay: -0.307692s; animation-direction: normal;">@keyframes ld-fade {0% {opacity: 1;}100% { opacity: 0; }}@-webkit-keyframes ld-fade { 0% { opacity: 1; }100% {opacity: 0;} }.ld.ld-fade { -webkit-animation: ld-fade 1s infinite linear; animation: ld-fade 1s infinite linear;}</style></svg></svg>'); 110 111 jQuery.ajax({ 112 url: adminAjax.ajaxurl, 113 method: 'POST', 114 data: { 115 action: 'ha_search_campaign', 116 value: value, 117 security: adminAjax.ajax_nonce 118 }, 119 success: function(response) { 120 jQuery('.ha-loader').hide(); 121 jQuery(".searchCampaign").html('Synchroniser'); 122 123 if (response.success) { 124 jQuery.ajax({ 125 url: adminAjax.ajaxurl, 126 method: 'POST', 127 data: { 128 action: 'ha_ajax', 129 'name': response.asso_name, 130 'campaign': response.campaigns, 131 'slug': response.slug, 132 'error': 0, 133 'security': adminAjax.ajax_nonce, 134 'increase': 1 135 }, 136 success: function(data) { 137 location.reload(); 138 }, 139 error: function(data) { 140 console.log(data); 141 jQuery('.ha-error').show(); 142 jQuery('.ha-error span').html('Erreur lors de la sauvegarde des campagnes.'); 143 } 144 }); 145 } else { 146 jQuery('.ha-error').show(); 147 jQuery('.ha-error span').html(response.data || 'Erreur lors de la recherche des campagnes.'); 148 } 149 }, 150 error: function(xhr, status, error) { 151 jQuery('.ha-loader').hide(); 152 jQuery(".searchCampaign").html('Synchroniser'); 153 jQuery('.ha-error').show(); 154 jQuery('.ha-error span').html('Service momentanément indisponible.<br/>Veuillez réessayer plus tard ou contacter le support HelloAsso.'); 155 } 156 }); 322 157 } 323 158 324 159 const actionTinyMce = data => { 325 jQuery(data).parent().clone().prependTo(".ha-campaign-viewer");326 jQuery(".ha-campaign-viewer").find('.ha-focus').removeAttr('onclick');327 jQuery(".ha-campaign-list").hide();328 jQuery(".ha-campaign-viewer").show();329 jQuery(".ha-return").show();330 jQuery(".ha-return").prependTo(".ha-campaign-viewer");331 jQuery(".ha-return:not(:eq(0))").hide();332 var haPopup = document.getElementById('ha-popup');333 haPopup.scrollTop = 0;160 jQuery(data).parent().clone().prependTo(".ha-campaign-viewer"); 161 jQuery(".ha-campaign-viewer").find('.ha-focus').removeAttr('onclick'); 162 jQuery(".ha-campaign-list").hide(); 163 jQuery(".ha-campaign-viewer").show(); 164 jQuery(".ha-return").show(); 165 jQuery(".ha-return").prependTo(".ha-campaign-viewer"); 166 jQuery(".ha-return:not(:eq(0))").hide(); 167 var haPopup = document.getElementById('ha-popup'); 168 haPopup.scrollTop = 0; 334 169 } 335 170 336 171 const haReturn = () => { 337 jQuery(".ha-campaign-viewer").find('.ha-focus').parent().remove();338 jQuery(".ha-campaign-list").show();339 jQuery(".ha-campaign-viewer").hide();340 jQuery(".ha-return").fadeOut();172 jQuery(".ha-campaign-viewer").find('.ha-focus').parent().remove(); 173 jQuery(".ha-campaign-list").show(); 174 jQuery(".ha-campaign-viewer").hide(); 175 jQuery(".ha-return").fadeOut(); 341 176 } 342 177 343 178 const loadViewCampaign = (url, type) => { 344 jQuery.get({ 345 url, 346 success: function (data) { 347 if (type == 'error_1') { 348 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 349 jQuery(".displayNoneTinyMce").css({ "display": "none" }); 350 } 351 else if (type == 'error_2') { 352 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 353 jQuery(".displayNoneTinyMce").css({ "display": "none" }); 354 } 355 else { 356 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 357 jQuery(".ha-footer").css({ "display": "none" }); 358 jQuery(".ha-logo-footer").css({ "display": "none" }); 359 jQuery('.ha-campaign-viewer').css({ "display": "none" }); 360 jQuery('.close-campaign-viewer').css({ "display": "none" }); 361 } 362 363 var haPopup = document.getElementById('ha-popup'); 364 haPopup.scrollTop = 0; 365 } 366 }); 179 jQuery.get({ 180 url, 181 success: function(data) { 182 if (type == 'error_1') { 183 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 184 jQuery(".displayNoneTinyMce").css({ "display": "none" }); 185 } else if (type == 'error_2') { 186 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 187 jQuery(".displayNoneTinyMce").css({ "display": "none" }); 188 } else { 189 jQuery('.content-tab').html(jQuery(data).find('.ha-page-content').html()); 190 jQuery(".ha-footer").css({ "display": "none" }); 191 jQuery(".ha-logo-footer").css({ "display": "none" }); 192 jQuery('.ha-campaign-viewer').css({ "display": "none" }); 193 jQuery('.close-campaign-viewer').css({ "display": "none" }); 194 } 195 196 var haPopup = document.getElementById('ha-popup'); 197 haPopup.scrollTop = 0; 198 } 199 }); 367 200 } 368 201 369 202 function insertIframeInTinyMce(data) { 370 var type = jQuery(data).attr('data-type'); 371 var url = jQuery('.lastUrlWidget').val(); 372 var height = "70px"; 373 if (type == "widget-bouton") { 374 height = "70px"; 375 } 376 else if (type == "widget") { 377 height = "750px"; 378 } 379 else if (type == "widget-vignette") { 380 height = "450px"; 381 } 382 else { 383 type = ""; 384 } 385 386 if (!url.startsWith('https://www.helloasso.com/') && !url.startsWith('https://www.helloasso-sandbox.com/')) { 387 url = ""; 388 } 389 var shortcode = '[helloasso campaign="' + url + '" type="' + type + '" height="' + height + '"]'; 390 jQuery('#ha-popup').hide(); 391 window.location.hash = ''; 392 var numItems = jQuery('.ha-input-shortcode').length; 393 394 if (numItems > 0) { 395 396 jQuery(".ha-input-shortcode").each(function () { 397 var element = jQuery(this); 398 if (element.val() == "") { 399 jQuery(this).val(shortcode); 400 jQuery(this).focus(); 401 } 402 }); 403 } 404 else { 405 if (tinyMCE && tinyMCE.activeEditor) { 406 tinyMCE.activeEditor.selection.setContent(shortcode); 407 } else { 408 jQuery('.wp-editor-area').val(jQuery('.wp-editor-area').val() + ' ' + shortcode); 409 } 410 } 411 412 413 return false; 203 var type = jQuery(data).attr('data-type'); 204 var url = jQuery('.lastUrlWidget').val(); 205 var height = "70px"; 206 if (type == "widget-bouton") { 207 height = "70px"; 208 } else if (type == "widget") { 209 height = "750px"; 210 } else if (type == "widget-vignette") { 211 height = "450px"; 212 } else { 213 type = ""; 214 } 215 216 if (!url.startsWith('https://www.helloasso.com/') && !url.startsWith('https://www.helloasso-sandbox.com/')) { 217 url = ""; 218 } 219 var shortcode = '[helloasso campaign="' + url + '" type="' + type + '" height="' + height + '"]'; 220 jQuery('#ha-popup').hide(); 221 window.location.hash = ''; 222 var numItems = jQuery('.ha-input-shortcode').length; 223 224 if (numItems > 0) { 225 226 jQuery(".ha-input-shortcode").each(function() { 227 var element = jQuery(this); 228 if (element.val() == "") { 229 jQuery(this).val(shortcode); 230 jQuery(this).focus(); 231 } 232 }); 233 } else { 234 if (tinyMCE && tinyMCE.activeEditor) { 235 tinyMCE.activeEditor.selection.setContent(shortcode); 236 } else { 237 jQuery('.wp-editor-area').val(jQuery('.wp-editor-area').val() + ' ' + shortcode); 238 } 239 } 240 241 242 return false; 414 243 } 415 244 416 245 417 246 function openShortcodesCampaign(data) { 418 jQuery('.ha-campaign-info').removeClass('ha-focus');419 jQuery('.ha-campaign-info').find('svg').attr('stroke', '#777D9C');420 421 var el = data;422 jQuery(el).addClass('ha-focus');423 jQuery(el).find('svg').attr('stroke', '#49D38A');424 425 var url = jQuery(el).attr('data-url');426 url = url.replace(/widget/, '');427 var type = jQuery(el).attr('data-type');428 429 jQuery('.lastUrlWidget').val(url);430 jQuery(".ha-description-viewer").fadeOut();431 jQuery(".ha-shortcodes-viewer").fadeIn();432 jQuery("#vueBouton").attr('src', url + 'widget-bouton/');433 434 if (type == "Donation") {435 jQuery(".vignette").hide();436 } else {437 jQuery(".vignette").show();438 jQuery("#vueVignette").attr('src', url + 'widget-vignette/');439 }440 441 442 jQuery("#vueVignetteHorizontale").attr('src', url + '/widget-vignette-horizontale/');443 jQuery("#vueForm").attr('src', url + 'widget/');247 jQuery('.ha-campaign-info').removeClass('ha-focus'); 248 jQuery('.ha-campaign-info').find('svg').attr('stroke', '#777D9C'); 249 250 var el = data; 251 jQuery(el).addClass('ha-focus'); 252 jQuery(el).find('svg').attr('stroke', '#49D38A'); 253 254 var url = jQuery(el).attr('data-url'); 255 url = url.replace(/widget/, ''); 256 var type = jQuery(el).attr('data-type'); 257 258 jQuery('.lastUrlWidget').val(url); 259 jQuery(".ha-description-viewer").fadeOut(); 260 jQuery(".ha-shortcodes-viewer").fadeIn(); 261 jQuery("#vueBouton").attr('src', url + 'widget-bouton/'); 262 263 if (type == "Donation") { 264 jQuery(".vignette").hide(); 265 } else { 266 jQuery(".vignette").show(); 267 jQuery("#vueVignette").attr('src', url + 'widget-vignette/'); 268 } 269 270 271 jQuery("#vueVignetteHorizontale").attr('src', url + '/widget-vignette-horizontale/'); 272 jQuery("#vueForm").attr('src', url + 'widget/'); 444 273 } 445 274 446 275 const haCopy = data => { 447 jQuery(data).find('.ha-tooltip').animate({ opacity: 1 }, 500, function () { 448 setInterval(function () { 449 jQuery(data).find('.ha-tooltip').css('opacity', '0'); 450 }, 3000); 451 }); 452 jQuery('.lastShortcode').remove(); 453 jQuery(data).after('<input type="text" class="lastShortcode" id="lastShortcode" />'); 454 455 var toCopy = document.getElementById('lastShortcode'); 456 var type = jQuery(data).attr('data-type'); 457 var url = jQuery('.lastUrlWidget').val(); 458 459 var height = "70px"; 460 if (type == "widget-bouton") { 461 height = "70px"; 462 } 463 else if (type == "widget") { 464 height = "750px"; 465 } 466 else if (type == "widget-vignette") { 467 height = "450px"; 468 } 469 470 jQuery('.lastShortcode').val('[helloasso campaign="' + url + '" type="' + type + '" height="' + height + '"]'); 471 472 toCopy.select(); 473 document.execCommand('copy'); 474 return false; 276 jQuery(data).find('.ha-tooltip').animate({ opacity: 1 }, 500, function() { 277 setInterval(function() { 278 jQuery(data).find('.ha-tooltip').css('opacity', '0'); 279 }, 3000); 280 }); 281 jQuery('.lastShortcode').remove(); 282 jQuery(data).after('<input type="text" class="lastShortcode" id="lastShortcode" />'); 283 284 var toCopy = document.getElementById('lastShortcode'); 285 var type = jQuery(data).attr('data-type'); 286 var url = jQuery('.lastUrlWidget').val(); 287 288 var height = "70px"; 289 if (type == "widget-bouton") { 290 height = "70px"; 291 } else if (type == "widget") { 292 height = "750px"; 293 } else if (type == "widget-vignette") { 294 height = "450px"; 295 } 296 297 jQuery('.lastShortcode').val('[helloasso campaign="' + url + '" type="' + type + '" height="' + height + '"]'); 298 299 toCopy.select(); 300 document.execCommand('copy'); 301 return false; 475 302 } 476 303 … … 486 313 * 487 314 */ 488 (function (t, e) { "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.Typed = e() : t.Typed = e() })(this, function () { return function (t) { function e(n) { if (s[n]) return s[n].exports; var i = s[n] = { exports: {}, id: n, loaded: !1 }; return t[n].call(i.exports, i, i.exports, e), i.loaded = !0, i.exports } var s = {}; return e.m = t, e.c = s, e.p = "", e(0) }([function (t, e, s) { "use strict"; function n(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } Object.defineProperty(e, "__esModule", { value: !0 }); var i = function () { function t(t, e) { for (var s = 0; s < e.length; s++) { var n = e[s]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } }(), r = s(1), o = s(3), a = function () { function t(e, s) { n(this, t), r.initializer.load(this, s, e), this.begin() } return i(t, [{ key: "toggle", value: function () { this.pause.status ? this.start() : this.stop() } }, { key: "stop", value: function () { this.typingComplete || this.pause.status || (this.toggleBlinking(!0), this.pause.status = !0, this.options.onStop(this.arrayPos, this)) } }, { key: "start", value: function () { this.typingComplete || this.pause.status && (this.pause.status = !1, this.pause.typewrite ? this.typewrite(this.pause.curString, this.pause.curStrPos) : this.backspace(this.pause.curString, this.pause.curStrPos), this.options.onStart(this.arrayPos, this)) } }, { key: "destroy", value: function () { this.reset(!1), this.options.onDestroy(this) } }, { key: "reset", value: function () { var t = arguments.length <= 0 || void 0 === arguments[0] || arguments[0]; clearInterval(this.timeout), this.replaceText(""), this.cursor && this.cursor.parentNode && (this.cursor.parentNode.removeChild(this.cursor), this.cursor = null), this.strPos = 0, this.arrayPos = 0, this.curLoop = 0, t && (this.insertCursor(), this.options.onReset(this), this.begin()) } }, { key: "begin", value: function () { var t = this; this.typingComplete = !1, this.shuffleStringsIfNeeded(this), this.insertCursor(), this.bindInputFocusEvents && this.bindFocusEvents(), this.timeout = setTimeout(function () { t.currentElContent && 0 !== t.currentElContent.length ? t.backspace(t.currentElContent, t.currentElContent.length) : t.typewrite(t.strings[t.sequence[t.arrayPos]], t.strPos) }, this.startDelay) } }, { key: "typewrite", value: function (t, e) { var s = this; this.fadeOut && this.el.classList.contains(this.fadeOutClass) && (this.el.classList.remove(this.fadeOutClass), this.cursor && this.cursor.classList.remove(this.fadeOutClass)); var n = this.humanizer(this.typeSpeed), i = 1; return this.pause.status === !0 ? void this.setPauseStatus(t, e, !0) : void (this.timeout = setTimeout(function () { e = o.htmlParser.typeHtmlChars(t, e, s); var n = 0, r = t.substr(e); if ("^" === r.charAt(0) && /^\^\d+/.test(r)) { var a = 1; r = /\d+/.exec(r)[0], a += r.length, n = parseInt(r), s.temporaryPause = !0, s.options.onTypingPaused(s.arrayPos, s), t = t.substring(0, e) + t.substring(e + a), s.toggleBlinking(!0) } if ("`" === r.charAt(0)) { for (; "`" !== t.substr(e + i).charAt(0) && (i++, !(e + i > t.length));); var u = t.substring(0, e), l = t.substring(u.length + 1, e + i), c = t.substring(e + i + 1); t = u + l + c, i-- } s.timeout = setTimeout(function () { s.toggleBlinking(!1), e === t.length ? s.doneTyping(t, e) : s.keepTyping(t, e, i), s.temporaryPause && (s.temporaryPause = !1, s.options.onTypingResumed(s.arrayPos, s)) }, n) }, n)) } }, { key: "keepTyping", value: function (t, e, s) { 0 === e && (this.toggleBlinking(!1), this.options.preStringTyped(this.arrayPos, this)), e += s; var n = t.substr(0, e); this.replaceText(n), this.typewrite(t, e) } }, { key: "doneTyping", value: function (t, e) { var s = this; this.options.onStringTyped(this.arrayPos, this), this.toggleBlinking(!0), this.arrayPos === this.strings.length - 1 && (this.complete(), this.loop === !1 || this.curLoop === this.loopCount) || (this.timeout = setTimeout(function () { s.backspace(t, e) }, this.backDelay)) } }, { key: "backspace", value: function (t, e) { var s = this; if (this.pause.status === !0) return void this.setPauseStatus(t, e, !0); if (this.fadeOut) return this.initFadeOut(); this.toggleBlinking(!1); var n = this.humanizer(this.backSpeed); this.timeout = setTimeout(function () { e = o.htmlParser.backSpaceHtmlChars(t, e, s); var n = t.substr(0, e); if (s.replaceText(n), s.smartBackspace) { var i = s.strings[s.arrayPos + 1]; i && n === i.substr(0, e) ? s.stopNum = e : s.stopNum = 0 } e > s.stopNum ? (e--, s.backspace(t, e)) : e <= s.stopNum && (s.arrayPos++, s.arrayPos === s.strings.length ? (s.arrayPos = 0, s.options.onLastStringBackspaced(), s.shuffleStringsIfNeeded(), s.begin()) : s.typewrite(s.strings[s.sequence[s.arrayPos]], e)) }, n) } }, { key: "complete", value: function () { this.options.onComplete(this), this.loop ? this.curLoop++ : this.typingComplete = !0 } }, { key: "setPauseStatus", value: function (t, e, s) { this.pause.typewrite = s, this.pause.curString = t, this.pause.curStrPos = e } }, { key: "toggleBlinking", value: function (t) { this.cursor && (this.pause.status || this.cursorBlinking !== t && (this.cursorBlinking = t, t ? this.cursor.classList.add("typed-cursor--blink") : this.cursor.classList.remove("typed-cursor--blink"))) } }, { key: "humanizer", value: function (t) { return Math.round(Math.random() * t / 2) + t } }, { key: "shuffleStringsIfNeeded", value: function () { this.shuffle && (this.sequence = this.sequence.sort(function () { return Math.random() - .5 })) } }, { key: "initFadeOut", value: function () { var t = this; return this.el.className += " " + this.fadeOutClass, this.cursor && (this.cursor.className += " " + this.fadeOutClass), setTimeout(function () { t.arrayPos++, t.replaceText(""), t.strings.length > t.arrayPos ? t.typewrite(t.strings[t.sequence[t.arrayPos]], 0) : (t.typewrite(t.strings[0], 0), t.arrayPos = 0) }, this.fadeOutDelay) } }, { key: "replaceText", value: function (t) { this.attr ? this.el.setAttribute(this.attr, t) : this.isInput ? this.el.value = t : "html" === this.contentType ? this.el.innerHTML = t : this.el.textContent = t } }, { key: "bindFocusEvents", value: function () { var t = this; this.isInput && (this.el.addEventListener("focus", function (e) { t.stop() }), this.el.addEventListener("blur", function (e) { t.el.value && 0 !== t.el.value.length || t.start() })) } }, { key: "insertCursor", value: function () { this.showCursor && (this.cursor || (this.cursor = document.createElement("span"), this.cursor.className = "typed-cursor", this.cursor.innerHTML = this.cursorChar, this.el.parentNode && this.el.parentNode.insertBefore(this.cursor, this.el.nextSibling))) } }]), t }(); e["default"] = a, t.exports = e["default"] }, function (t, e, s) { "use strict"; function n(t) { return t && t.__esModule ? t : { "default": t } } function i(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } Object.defineProperty(e, "__esModule", { value: !0 }); var r = Object.assign || function (t) { for (var e = 1; e < arguments.length; e++) { var s = arguments[e]; for (var n in s) Object.prototype.hasOwnProperty.call(s, n) && (t[n] = s[n]) } return t }, o = function () { function t(t, e) { for (var s = 0; s < e.length; s++) { var n = e[s]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } }(), a = s(2), u = n(a), l = function () { function t() { i(this, t) } return o(t, [{ key: "load", value: function (t, e, s) { if ("string" == typeof s ? t.el = document.querySelector(s) : t.el = s, t.options = r({}, u["default"], e), t.isInput = "input" === t.el.tagName.toLowerCase(), t.attr = t.options.attr, t.bindInputFocusEvents = t.options.bindInputFocusEvents, t.showCursor = !t.isInput && t.options.showCursor, t.cursorChar = t.options.cursorChar, t.cursorBlinking = !0, t.elContent = t.attr ? t.el.getAttribute(t.attr) : t.el.textContent, t.contentType = t.options.contentType, t.typeSpeed = t.options.typeSpeed, t.startDelay = t.options.startDelay, t.backSpeed = t.options.backSpeed, t.smartBackspace = t.options.smartBackspace, t.backDelay = t.options.backDelay, t.fadeOut = t.options.fadeOut, t.fadeOutClass = t.options.fadeOutClass, t.fadeOutDelay = t.options.fadeOutDelay, t.isPaused = !1, t.strings = t.options.strings.map(function (t) { return t.trim() }), "string" == typeof t.options.stringsElement ? t.stringsElement = document.querySelector(t.options.stringsElement) : t.stringsElement = t.options.stringsElement, t.stringsElement) { t.strings = [], t.stringsElement.style.display = "none"; var n = Array.prototype.slice.apply(t.stringsElement.children), i = n.length; if (i) for (var o = 0; o < i; o += 1) { var a = n[o]; t.strings.push(a.innerHTML.trim()) } } t.strPos = 0, t.arrayPos = 0, t.stopNum = 0, t.loop = t.options.loop, t.loopCount = t.options.loopCount, t.curLoop = 0, t.shuffle = t.options.shuffle, t.sequence = [], t.pause = { status: !1, typewrite: !0, curString: "", curStrPos: 0 }, t.typingComplete = !1; for (var o in t.strings) t.sequence[o] = o; t.currentElContent = this.getCurrentElContent(t), t.autoInsertCss = t.options.autoInsertCss, this.appendAnimationCss(t) } }, { key: "getCurrentElContent", value: function (t) { var e = ""; return e = t.attr ? t.el.getAttribute(t.attr) : t.isInput ? t.el.value : "html" === t.contentType ? t.el.innerHTML : t.el.textContent } }, { key: "appendAnimationCss", value: function (t) { var e = "data-typed-js-css"; if (t.autoInsertCss && (t.showCursor || t.fadeOut) && !document.querySelector("[" + e + "]")) { var s = document.createElement("style"); s.type = "text/css", s.setAttribute(e, !0); var n = ""; t.showCursor && (n += "\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n "), t.fadeOut && (n += "\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n "), 0 !== s.length && (s.innerHTML = n, document.body.appendChild(s)) } } }]), t }(); e["default"] = l; var c = new l; e.initializer = c }, function (t, e) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var s = { strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"], stringsElement: null, typeSpeed: 0, startDelay: 0, backSpeed: 0, smartBackspace: !0, shuffle: !1, backDelay: 700, fadeOut: !1, fadeOutClass: "typed-fade-out", fadeOutDelay: 500, loop: !1, loopCount: 1 / 0, showCursor: !0, cursorChar: "|", autoInsertCss: !0, attr: null, bindInputFocusEvents: !1, contentType: "html", onComplete: function (t) { }, preStringTyped: function (t, e) { }, onStringTyped: function (t, e) { }, onLastStringBackspaced: function (t) { }, onTypingPaused: function (t, e) { }, onTypingResumed: function (t, e) { }, onReset: function (t) { }, onStop: function (t, e) { }, onStart: function (t, e) { }, onDestroy: function (t) { } }; e["default"] = s, t.exports = e["default"] }, function (t, e) { "use strict"; function s(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } Object.defineProperty(e, "__esModule", { value: !0 }); var n = function () { function t(t, e) { for (var s = 0; s < e.length; s++) { var n = e[s]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } }(), i = function () { function t() { s(this, t) } return n(t, [{ key: "typeHtmlChars", value: function (t, e, s) { if ("html" !== s.contentType) return e; var n = t.substr(e).charAt(0); if ("<" === n || "&" === n) { var i = ""; for (i = "<" === n ? ">" : ";"; t.substr(e + 1).charAt(0) !== i && (e++, !(e + 1 > t.length));); e++ } return e } }, { key: "backSpaceHtmlChars", value: function (t, e, s) { if ("html" !== s.contentType) return e; var n = t.substr(e).charAt(0); if (">" === n || ";" === n) { var i = ""; for (i = ">" === n ? "<" : "&"; t.substr(e - 1).charAt(0) !== i && (e--, !(e < 0));); e-- } return e } }]), t }(); e["default"] = i; var r = new i; e.htmlParser = r }]) }); 315 (function(t, e) { "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.Typed = e() : t.Typed = e() })(this, function() { 316 return function(t) { 317 function e(n) { if (s[n]) return s[n].exports; var i = s[n] = { exports: {}, id: n, loaded: !1 }; return t[n].call(i.exports, i, i.exports, e), i.loaded = !0, i.exports } 318 var s = {}; 319 return e.m = t, e.c = s, e.p = "", e(0) 320 }([function(t, e, s) { 321 "use strict"; 322 323 function n(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } 324 Object.defineProperty(e, "__esModule", { value: !0 }); 325 var i = function() { 326 function t(t, e) { 327 for (var s = 0; s < e.length; s++) { 328 var n = e[s]; 329 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) 330 } 331 } 332 return function(e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } 333 }(), 334 r = s(1), 335 o = s(3), 336 a = function() { 337 function t(e, s) { n(this, t), r.initializer.load(this, s, e), this.begin() } 338 return i(t, [{ key: "toggle", value: function() { this.pause.status ? this.start() : this.stop() } }, { key: "stop", value: function() { this.typingComplete || this.pause.status || (this.toggleBlinking(!0), this.pause.status = !0, this.options.onStop(this.arrayPos, this)) } }, { key: "start", value: function() { this.typingComplete || this.pause.status && (this.pause.status = !1, this.pause.typewrite ? this.typewrite(this.pause.curString, this.pause.curStrPos) : this.backspace(this.pause.curString, this.pause.curStrPos), this.options.onStart(this.arrayPos, this)) } }, { key: "destroy", value: function() { this.reset(!1), this.options.onDestroy(this) } }, { 339 key: "reset", 340 value: function() { 341 var t = arguments.length <= 0 || void 0 === arguments[0] || arguments[0]; 342 clearInterval(this.timeout), this.replaceText(""), this.cursor && this.cursor.parentNode && (this.cursor.parentNode.removeChild(this.cursor), this.cursor = null), this.strPos = 0, this.arrayPos = 0, this.curLoop = 0, t && (this.insertCursor(), this.options.onReset(this), this.begin()) 343 } 344 }, { 345 key: "begin", 346 value: function() { 347 var t = this; 348 this.typingComplete = !1, this.shuffleStringsIfNeeded(this), this.insertCursor(), this.bindInputFocusEvents && this.bindFocusEvents(), this.timeout = setTimeout(function() { t.currentElContent && 0 !== t.currentElContent.length ? t.backspace(t.currentElContent, t.currentElContent.length) : t.typewrite(t.strings[t.sequence[t.arrayPos]], t.strPos) }, this.startDelay) 349 } 350 }, { 351 key: "typewrite", 352 value: function(t, e) { 353 var s = this; 354 this.fadeOut && this.el.classList.contains(this.fadeOutClass) && (this.el.classList.remove(this.fadeOutClass), this.cursor && this.cursor.classList.remove(this.fadeOutClass)); 355 var n = this.humanizer(this.typeSpeed), 356 i = 1; 357 return this.pause.status === !0 ? void this.setPauseStatus(t, e, !0) : void(this.timeout = setTimeout(function() { 358 e = o.htmlParser.typeHtmlChars(t, e, s); 359 var n = 0, 360 r = t.substr(e); 361 if ("^" === r.charAt(0) && /^\^\d+/.test(r)) { 362 var a = 1; 363 r = /\d+/.exec(r)[0], a += r.length, n = parseInt(r), s.temporaryPause = !0, s.options.onTypingPaused(s.arrayPos, s), t = t.substring(0, e) + t.substring(e + a), s.toggleBlinking(!0) 364 } 365 if ("`" === r.charAt(0)) { 366 for (; 367 "`" !== t.substr(e + i).charAt(0) && (i++, !(e + i > t.length));); 368 var u = t.substring(0, e), 369 l = t.substring(u.length + 1, e + i), 370 c = t.substring(e + i + 1); 371 t = u + l + c, i-- 372 } 373 s.timeout = setTimeout(function() { s.toggleBlinking(!1), e === t.length ? s.doneTyping(t, e) : s.keepTyping(t, e, i), s.temporaryPause && (s.temporaryPause = !1, s.options.onTypingResumed(s.arrayPos, s)) }, n) 374 }, n)) 375 } 376 }, { 377 key: "keepTyping", 378 value: function(t, e, s) { 379 0 === e && (this.toggleBlinking(!1), this.options.preStringTyped(this.arrayPos, this)), e += s; 380 var n = t.substr(0, e); 381 this.replaceText(n), this.typewrite(t, e) 382 } 383 }, { 384 key: "doneTyping", 385 value: function(t, e) { 386 var s = this; 387 this.options.onStringTyped(this.arrayPos, this), this.toggleBlinking(!0), this.arrayPos === this.strings.length - 1 && (this.complete(), this.loop === !1 || this.curLoop === this.loopCount) || (this.timeout = setTimeout(function() { s.backspace(t, e) }, this.backDelay)) 388 } 389 }, { 390 key: "backspace", 391 value: function(t, e) { 392 var s = this; 393 if (this.pause.status === !0) return void this.setPauseStatus(t, e, !0); 394 if (this.fadeOut) return this.initFadeOut(); 395 this.toggleBlinking(!1); 396 var n = this.humanizer(this.backSpeed); 397 this.timeout = setTimeout(function() { 398 e = o.htmlParser.backSpaceHtmlChars(t, e, s); 399 var n = t.substr(0, e); 400 if (s.replaceText(n), s.smartBackspace) { 401 var i = s.strings[s.arrayPos + 1]; 402 i && n === i.substr(0, e) ? s.stopNum = e : s.stopNum = 0 403 } 404 e > s.stopNum ? (e--, s.backspace(t, e)) : e <= s.stopNum && (s.arrayPos++, s.arrayPos === s.strings.length ? (s.arrayPos = 0, s.options.onLastStringBackspaced(), s.shuffleStringsIfNeeded(), s.begin()) : s.typewrite(s.strings[s.sequence[s.arrayPos]], e)) 405 }, n) 406 } 407 }, { key: "complete", value: function() { this.options.onComplete(this), this.loop ? this.curLoop++ : this.typingComplete = !0 } }, { key: "setPauseStatus", value: function(t, e, s) { this.pause.typewrite = s, this.pause.curString = t, this.pause.curStrPos = e } }, { key: "toggleBlinking", value: function(t) { this.cursor && (this.pause.status || this.cursorBlinking !== t && (this.cursorBlinking = t, t ? this.cursor.classList.add("typed-cursor--blink") : this.cursor.classList.remove("typed-cursor--blink"))) } }, { key: "humanizer", value: function(t) { return Math.round(Math.random() * t / 2) + t } }, { key: "shuffleStringsIfNeeded", value: function() { this.shuffle && (this.sequence = this.sequence.sort(function() { return Math.random() - .5 })) } }, { key: "initFadeOut", value: function() { var t = this; return this.el.className += " " + this.fadeOutClass, this.cursor && (this.cursor.className += " " + this.fadeOutClass), setTimeout(function() { t.arrayPos++, t.replaceText(""), t.strings.length > t.arrayPos ? t.typewrite(t.strings[t.sequence[t.arrayPos]], 0) : (t.typewrite(t.strings[0], 0), t.arrayPos = 0) }, this.fadeOutDelay) } }, { key: "replaceText", value: function(t) { this.attr ? this.el.setAttribute(this.attr, t) : this.isInput ? this.el.value = t : "html" === this.contentType ? this.el.innerHTML = t : this.el.textContent = t } }, { 408 key: "bindFocusEvents", 409 value: function() { 410 var t = this; 411 this.isInput && (this.el.addEventListener("focus", function(e) { t.stop() }), this.el.addEventListener("blur", function(e) { t.el.value && 0 !== t.el.value.length || t.start() })) 412 } 413 }, { key: "insertCursor", value: function() { this.showCursor && (this.cursor || (this.cursor = document.createElement("span"), this.cursor.className = "typed-cursor", this.cursor.innerHTML = this.cursorChar, this.el.parentNode && this.el.parentNode.insertBefore(this.cursor, this.el.nextSibling))) } }]), t 414 }(); 415 e["default"] = a, t.exports = e["default"] 416 }, function(t, e, s) { 417 "use strict"; 418 419 function n(t) { return t && t.__esModule ? t : { "default": t } } 420 421 function i(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } 422 Object.defineProperty(e, "__esModule", { value: !0 }); 423 var r = Object.assign || function(t) { for (var e = 1; e < arguments.length; e++) { var s = arguments[e]; for (var n in s) Object.prototype.hasOwnProperty.call(s, n) && (t[n] = s[n]) } return t }, 424 o = function() { 425 function t(t, e) { 426 for (var s = 0; s < e.length; s++) { 427 var n = e[s]; 428 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) 429 } 430 } 431 return function(e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } 432 }(), 433 a = s(2), 434 u = n(a), 435 l = function() { 436 function t() { i(this, t) } 437 return o(t, [{ 438 key: "load", 439 value: function(t, e, s) { 440 if ("string" == typeof s ? t.el = document.querySelector(s) : t.el = s, t.options = r({}, u["default"], e), t.isInput = "input" === t.el.tagName.toLowerCase(), t.attr = t.options.attr, t.bindInputFocusEvents = t.options.bindInputFocusEvents, t.showCursor = !t.isInput && t.options.showCursor, t.cursorChar = t.options.cursorChar, t.cursorBlinking = !0, t.elContent = t.attr ? t.el.getAttribute(t.attr) : t.el.textContent, t.contentType = t.options.contentType, t.typeSpeed = t.options.typeSpeed, t.startDelay = t.options.startDelay, t.backSpeed = t.options.backSpeed, t.smartBackspace = t.options.smartBackspace, t.backDelay = t.options.backDelay, t.fadeOut = t.options.fadeOut, t.fadeOutClass = t.options.fadeOutClass, t.fadeOutDelay = t.options.fadeOutDelay, t.isPaused = !1, t.strings = t.options.strings.map(function(t) { return t.trim() }), "string" == typeof t.options.stringsElement ? t.stringsElement = document.querySelector(t.options.stringsElement) : t.stringsElement = t.options.stringsElement, t.stringsElement) { 441 t.strings = [], t.stringsElement.style.display = "none"; 442 var n = Array.prototype.slice.apply(t.stringsElement.children), 443 i = n.length; 444 if (i) 445 for (var o = 0; o < i; o += 1) { 446 var a = n[o]; 447 t.strings.push(a.innerHTML.trim()) 448 } 449 } 450 t.strPos = 0, t.arrayPos = 0, t.stopNum = 0, t.loop = t.options.loop, t.loopCount = t.options.loopCount, t.curLoop = 0, t.shuffle = t.options.shuffle, t.sequence = [], t.pause = { status: !1, typewrite: !0, curString: "", curStrPos: 0 }, t.typingComplete = !1; 451 for (var o in t.strings) t.sequence[o] = o; 452 t.currentElContent = this.getCurrentElContent(t), t.autoInsertCss = t.options.autoInsertCss, this.appendAnimationCss(t) 453 } 454 }, { key: "getCurrentElContent", value: function(t) { var e = ""; return e = t.attr ? t.el.getAttribute(t.attr) : t.isInput ? t.el.value : "html" === t.contentType ? t.el.innerHTML : t.el.textContent } }, { 455 key: "appendAnimationCss", 456 value: function(t) { 457 var e = "data-typed-js-css"; 458 if (t.autoInsertCss && (t.showCursor || t.fadeOut) && !document.querySelector("[" + e + "]")) { 459 var s = document.createElement("style"); 460 s.type = "text/css", s.setAttribute(e, !0); 461 var n = ""; 462 t.showCursor && (n += "\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n "), t.fadeOut && (n += "\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n "), 0 !== s.length && (s.innerHTML = n, document.body.appendChild(s)) 463 } 464 } 465 }]), t 466 }(); 467 e["default"] = l; 468 var c = new l; 469 e.initializer = c 470 }, function(t, e) { 471 "use strict"; 472 Object.defineProperty(e, "__esModule", { value: !0 }); 473 var s = { strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"], stringsElement: null, typeSpeed: 0, startDelay: 0, backSpeed: 0, smartBackspace: !0, shuffle: !1, backDelay: 700, fadeOut: !1, fadeOutClass: "typed-fade-out", fadeOutDelay: 500, loop: !1, loopCount: 1 / 0, showCursor: !0, cursorChar: "|", autoInsertCss: !0, attr: null, bindInputFocusEvents: !1, contentType: "html", onComplete: function(t) {}, preStringTyped: function(t, e) {}, onStringTyped: function(t, e) {}, onLastStringBackspaced: function(t) {}, onTypingPaused: function(t, e) {}, onTypingResumed: function(t, e) {}, onReset: function(t) {}, onStop: function(t, e) {}, onStart: function(t, e) {}, onDestroy: function(t) {} }; 474 e["default"] = s, t.exports = e["default"] 475 }, function(t, e) { 476 "use strict"; 477 478 function s(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } 479 Object.defineProperty(e, "__esModule", { value: !0 }); 480 var n = function() { 481 function t(t, e) { 482 for (var s = 0; s < e.length; s++) { 483 var n = e[s]; 484 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) 485 } 486 } 487 return function(e, s, n) { return s && t(e.prototype, s), n && t(e, n), e } 488 }(), 489 i = function() { 490 function t() { s(this, t) } 491 return n(t, [{ 492 key: "typeHtmlChars", 493 value: function(t, e, s) { 494 if ("html" !== s.contentType) return e; 495 var n = t.substr(e).charAt(0); 496 if ("<" === n || "&" === n) { 497 var i = ""; 498 for (i = "<" === n ? ">" : ";"; t.substr(e + 1).charAt(0) !== i && (e++, !(e + 1 > t.length));); 499 e++ 500 } 501 return e 502 } 503 }, { 504 key: "backSpaceHtmlChars", 505 value: function(t, e, s) { 506 if ("html" !== s.contentType) return e; 507 var n = t.substr(e).charAt(0); 508 if (">" === n || ";" === n) { 509 var i = ""; 510 for (i = ">" === n ? "<" : "&"; t.substr(e - 1).charAt(0) !== i && (e--, !(e < 0));); 511 e-- 512 } 513 return e 514 } 515 }]), t 516 }(); 517 e["default"] = i; 518 var r = new i; 519 e.htmlParser = r 520 }]) 521 }); 489 522 //# sourceMappingURL=typed.min.js.map -
helloasso/trunk/hello-asso.php
r3316366 r3318658 17 17 * Plugin URI: https://centredaide.helloasso.com/s/article/paiement-en-ligne-wordpress-integrer-vos-campagnes-helloasso 18 18 * Description: HelloAsso est la solution gratuite des associations pour collecter des paiements et des dons sur internet. 19 * Version: 1.1.2 019 * Version: 1.1.21 20 20 * Author: HelloAsso 21 21 * Author URI: https://helloasso.com … … 37 37 * Rename this for your plugin and update it as you release new versions. 38 38 */ 39 define('HELLO_ASSO_VERSION', '1.1.2 0');39 define('HELLO_ASSO_VERSION', '1.1.21'); 40 40 41 41 /**
Note: See TracChangeset
for help on using the changeset viewer.