1 2 3 4/** 5 * initializeScripts() 6 * Fonction principale JS réinitialisable. 7 * Appelée au chargement et après chaque injection AJAX. 8 */ 9function initializeScripts() { 10 11/** Affiche le loader global + verrouille le scroll. Auto-off après 60s. */ 12function AppLoaderOn() { 13 $("#AppLoader").removeClass("AppLoaderOff"); 14 $("#AppLoader").addClass("AppLoaderOn"); 15 $("html").addClass("AppLoaderOnHtml"); 16 $("body").addClass("AppLoaderOnBody"); 17 setTimeout(function() { 18 AppLoaderOff(); // Sécurité : éteint le loader après 60s si pas de retour 19 }, 60000); 20} 21 22/** Masque le loader global et déverrouille le scroll. */ 23function AppLoaderOff() { 24 $("#AppLoader").removeClass("AppLoaderOn"); 25 $("html").removeClass("AppLoaderOnHtml"); 26 $("body").removeClass("AppLoaderOnBody"); 27 $("#AppLoader").addClass("AppLoaderOff"); 28} 29 30// Filtre alphabétique de la page auteurs/ 31// Chaque bouton a id=LETTRE. attr-alpha sur .auteur-card = 1ère lettre du nom. 32$(".auteur-alpha").click(function() { 33 var selected_letter = this.id; 34 if (selected_letter == 'all') { 35 location.href = "https://www.editionsddb.fr/auteurs/"; // Afficher tous 36 } 37 $('.auteur-card').each(function(index, value) { 38 var auteur_letter = $(this).attr('attr-alpha'); 39 if (selected_letter == auteur_letter) { 40 $(this).css('display', 'block'); 41 } else { 42 $(this).css('display', 'none'); 43 } 44 }); 45}); 46 47$(document).ready(function() { 48 AppLoaderOff(); // Ãteint le loader dès que le DOM est prêt 49 50 // Affiche le loader lors de tout clic sur un lien de navigation 51 $(".getLoad").click(function() { 52 AppLoaderOn(); 53 }); 54 55 // ââ Gestion des préférences newsletter / mail papier ââââââââââââââââââ 56 $(".ns-unsubscribe").click(function() { location.href = "?ns=unsubscribe"; }); 57 $(".ns-subscribe").click(function() { location.href = "?ns=subscribe"; }); 58 $(".pp-unsubscribe").click(function() { location.href = "?pp=unsubscribe"; }); 59 $(".pp-subscribe").click(function() { location.href = "?pp=subscribe"; }); 60 $(".rp-unsubscribe").click(function() { location.href = "?rp=unsubscribe"; }); 61 $(".rp-subscribe").click(function() { location.href = "?rp=subscribe"; }); 62 63 // ââ Panier : ajout depuis la fiche produit ââââââââââââââââââââââââââââ 64 // Lit #product_id et #quantity (fiche produit unique) 65 $(".add_to_cart").click(function() { 66 AppLoaderOn(); 67 var product_id = $('#product_id').val(); 68 var quantity = $('#quantity').val(); 69 $.post("https://www.editionsddb.fr/call-js/", { action: "add_to_cart", product_id: product_id, quantity: quantity }); 70 }); 71 72 // ââ Panier : ajout depuis la grille (card_add_to_cart) âââââââââââââââ 73 // id de l'élément = LIV_N_ID ; quantité dans #quantity_{id} 74 $(".cart_add_to_cart").click(function() { 75 AppLoaderOn(); 76 var product_id = this.id; 77 var quantity = $('#quantity_'+this.id).val(); 78 $.post( "https://www.editionsddb.fr/call-js/", { action: "add_to_cart2", product_id: product_id, quantity: quantity } ); 79 }); 80 81 $(".cart_add_to_cart2").click(function(){ 82 AppLoaderOn(); 83 var product_id = this.id; 84 var quantity = $('#quantity_'+this.id).val(); 85 $.post( "https://www.editionsddb.fr/call-js/", { action: "add_to_cart2", product_id: product_id, quantity: quantity } ); 86 }); 87 88 $(".dropdown-product-remove").click(function(){ 89 AppLoaderOn(); 90 var product_id = this.id 91 $.post( "https://www.editionsddb.fr/call-js/", { action: "remove-product", product_id: product_id} ); 92 }); 93 94 $(".cart-product-remove").click(function(){ 95 AppLoaderOn(); 96 var product_id = this.id 97 $.post( "https://www.editionsddb.fr/call-js/", { action: "remove-product", product_id: product_id} ); 98 });
99 100 $(".cart-product-remove-all").click(function(){ 101 AppLoaderOn(); 102 $.post( "https://www.editionsddb.fr/call-js/", { action: "remove-product-all"} ); 103 }); 104 105 $(".form-address-select").click(function(){ 106 AppLoaderOn(); 107 var address_id = this.id; 108 $.post( "https://www.editionsddb.fr/call-js/", { action: "address_select", address_id: address_id} ); 109 }); 110 111 $(".form-address-edit").click(function(){ 112 AppLoaderOn(); 113 var address_id = this.id; 114 $.post( "https://www.editionsddb.fr/call-js/", { action: "address_edit", address_id: address_id} ); 115 }); 116 117 $(".form-address-delete").click(function(){ 118 AppLoaderOn(); 119 var address_id = this.id; 120 $.post( "https://www.editionsddb.fr/call-js/", { action: "address_delete", address_id: address_id} ); 121 }); 122 123 $(".change-passwd-btn").click(function(){ 124 AppLoaderOn(); 125 var address_id = this.id; 126 var passwd1 = $('#passwd1_'+this.id).val(); 127 var passwd2 = $('#passwd2_'+this.id).val(); 128 var passwd3 = $('#passwd3_'+this.id).val(); 129 $.post( "https://www.editionsddb.fr/call-js/", { action: "change-passwd", passwd1: passwd1, passwd2: passwd2, passwd3: passwd3} ); 130 }); 131 132 $(".update-address-billing").submit(function(e) { 133 AppLoaderOn(); 134 e.preventDefault(); 135 var actionurl = 'https://www.editionsddb.fr/call-js/'; 136 $.ajax({
137 url: actionurl, 138 type: 'post', 139 dataType: 'application/json', 140 data: $(".update-address-billing").serialize() 141 }); 142 $(document).ajaxStop(function () { 143 location.href = "?process=shipping"; 144 }); 145 }); 146 147 $(".add-address-shipping").submit(function(e) { 148 AppLoaderOn(); 149 e.preventDefault(); 150 var actionurl = 'https://www.editionsddb.fr/call-js/'; 151 $.ajax({ 152 url: actionurl, 153 type: 'post', 154 dataType: 'application/json', 155 data: $(".add-address-shipping").serialize() 156 }); 157 $(document).ajaxStop(function () { 158 location.href = "?process=shipping"; 159 }); 160 }); 161 162 163 $(".account-update-address-billing").submit(function(e) { 164 AppLoaderOn(); 165 e.preventDefault(); 166 var actionurl = 'https://www.editionsddb.fr/call-js/'; 167 $.ajax({ 168 url: actionurl, 169 type: 'post', 170 dataType: 'application/json', 171 data: $(".account-update-address-billing").serialize() 172 }); 173 $(document).ajaxStop(function () { 174 location.href = "?process=success"; 175 }); 176 }); 177 178 $(".account-add-address-shipping").submit(function(e) { 179 AppLoaderOn(); 180 e.preventDefault(); 181 var actionurl = 'https://www.editionsddb.fr/call-js/'; 182 $.ajax({
183 url: actionurl, 184 type: 'post', 185 dataType: 'application/json', 186 data: $(".account-add-address-shipping").serialize() 187 }); 188 $(document).ajaxStop(function () { 189 location.href = "?process=success"; 190 }); 191 }); 192 193 $(".edit-address-shipping").submit(function(e) { 194 AppLoaderOn(); 195 e.preventDefault(); 196 var actionurl = 'https://www.editionsddb.fr/call-js/'; 197 $.ajax({ 198 url: actionurl, 199 type: 'post', 200 dataType: 'application/json', 201 data: $(".edit-address-shipping").serialize() 202 }); 203 $(document).ajaxStop(function () { 204 location.href = "?process=shipping"; 205 }); 206 }); 207 208 $(".account-edit-address-shipping").submit(function(e) { 209 AppLoaderOn(); 210 e.preventDefault(); 211 var actionurl = 'https://www.editionsddb.fr/call-js/'; 212 $.ajax({ 213 url: actionurl, 214 type: 'post', 215 dataType: 'application/json', 216 data: $(".account-edit-address-shipping").serialize() 217 }); 218 $(document).ajaxStop(function () { 219 location.href = "?process=end"; 220 }); 221 }); 222 223 $(".change-login").submit(function(e) { 224 AppLoaderOn(); 225 e.preventDefault(); 226 var actionurl = 'https://www.editionsddb.fr/call-js/'; 227 228 $.ajax({
229 url: actionurl, 230 type: 'post', 231 dataType: 'application/json', 232 data: $(".change-login").serialize() 233 }); 234 $(document).ajaxStop(function () { 235 location.href = "?process=confirmation_send"; 236 }); 237 }); 238 239 // ââ Sélection du mode de paiement (finalisation commande) ââââââââââââ 240 // .collapsed = accordéon Bootstrap ; id = cb/ch/vi/di 241 // Met à jour #pmethod et affiche le libellé #p_{pmethod} 242 $(".collapsed").click(function() { 243 var mt_id = this.id; 244 $(".icon-check").addClass("d-none"); 245 $("#" + mt_id + " > i").removeClass("d-none"); 246 $("#pmethod").val(mt_id); 247 $(".pmethod").addClass("d-none"); 248 $("#p_" + mt_id).removeClass("d-none"); 249 }); 250 251 // ââ Activation du bouton "Continuer" (CGV + mode paiement requis) ââââ 252 $(".ctrl_btn").click(function() { 253 var pmethod = $("#pmethod").val(); 254 if ($("#cgv").is(':checked') && pmethod != '') { 255 $("#btn-end_com").attr('disabled', false); 256 } else { 257 $("#btn-end_com").attr('disabled', true); 258 } 259 }); 260 261 // Synchronise le textarea commentaire vers le champ caché du formulaire 262 $('#btn-end_com').click(function() { 263 var texteCommande = $('#COM_CH_TEXTECOMMANDE').val(); 264 $('#COM_CH_TEXTECOMMANDE_FORM').val(texteCommande); 265 }); 266 267 // ââ Affichage des détails d'une commande (account-orders) ââââââââââââ 268 // .com-btn-details id=COM_N_ID â masque tous, affiche #com_details_{id} 269 $(".com-btn-details").click(function() { 270 var com_dt_id = this.id; 271 $(".com-details").addClass("d-none"); 272 $("#com_details_" + com_dt_id).removeClass("d-none"); 273 }); 274 275 // ââ Inscription newsletter (formulaire footer) ââââââââââââââââââââââââ 276 // POST call-js/ avec les données sérialisées â affiche .form-newsletter-alert 277 $("#form-newsletter-form").submit(function(e) { 278 e.preventDefault(); 279 var actionurl = 'https://www.editionsddb.fr/call-js/'; 280 $.ajax({
281 url: actionurl, 282 type: 'post', 283 dataType: 'application/json', 284 data: $("#form-newsletter-form").serialize() 285 }); 286 // Affiche le message de confirmation après l'envoi AJAX 287 $(document).ajaxStop(function() { 288 $(".form-newsletter-alert").removeClass("d-none"); 289 }); 290 }); 291 292}); // Fin $(document).ready() 293 294} // Fin initializeScripts() 295 296// Appel initial au chargement de la page 297initializeScripts();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.