PageSourceSearch

https://montessoriparatodos.es/modules/mrshopmailnotifications/js/mrshopmailnotifications.js

js montessoriparatodos.es collected 2026-10-03 23:15:01 UTC 6,036 bytes, 164 lines download raw bytes

1/**
2 * 2007-2019 PrestaShop
3 *
4 * NOTICE OF LICENSE
5 *
6 * This source file is subject to the Academic Free License (AFL 3.0)
7 * that is bundled with this package in the file LICENSE.txt.
8 * It is also available through the world-wide-web at this URL:
9 * http://opensource.org/licenses/afl-3.0.php
10 * If you did not receive a copy of the license and are unable to
11 * obtain it through the world-wide-web, please send an email
12 * to [email protected] so we can send you a copy immediately.
13 *
14 * DISCLAIMER
15 *
16 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
17 * versions in the future. If you wish to customize PrestaShop for your
18 * needs please refer to http://www.prestashop.com for more information.
19 *
20 * @author    PrestaShop SA <[email protected]>
21 * @copyright 2007-2019 PrestaShop SA
22 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
23 * International Registered Trademark & Property of PrestaShop SA
24 */
25
26function openBootstrapModal(title, element, inner, idProduct, idProductAttribute) {
27    inner = typeof inner !== 'undefined' ? inner : false;
28
29    modal = '<div id="mrshopmailnotification-form-modal-' + idProduct + '-' + idProductAttribute + '" class="modal fade" role="dialog"> ' +
30        '<div class="modal-dialog">' +
31        '<div class="modal-content"> ';
32
33    if (title) {
34        modal += '<div class="modal-header"> ' +
35            '<h5 class="modal-title">' + title + '</h5> ' +
36            '<button type="button" class="close" data-dismiss="modal" aria-label="'+ closeLabel +'"> ' +
37            '<span aria-hidden="true">&times;</span> ' +
38            '</button> ' +
39            '</div> ' +
40            '<div class="modal-body">';
41    }
42
43    modal += (inner) ? element.html() : element;
44
45    if (title) {
46        modal += '</div> ' +
47            '<div class="modal-footer"> ' +
48            '<button type="button" class="btn btn-secondary" data-dismiss="modal">'+ closeLabel +'</button> ' +
49            '</div> ';
50    }
51
52    modal += '</div> ' +
53        '</div> ' +
54        '</div>';
55
56
57    $(modal).modal('show');
58    setTimeout(function () {
59        $('#mrshopmailnotification-form-modal').on('hidden.bs.modal', function () {
60            $(this).remove();
61        });
62    }, 500);
63}
64
65
66function addNotification(idProduct, idProductAttribute, customerMail) {
67    notifyMeButton = $('#open-mrshopmailnotification-form-modal-' + idProduct + '-' + idProductAttribute);
68    notifyMeButton.addClass('disabled');
69    $.ajax({
70        type: 'POST',
71        url: $('div.js-mrshopmailnotification').data('url'),
72        data: 'id_product=' + idProduct + '&id_product_attribute=' + idProductAttribute + '&customer_email=' + customerMail,
73        success: function (resp) {
74            resp = JSON.parse(resp);
75            if (!!$.prototype.fancybox) {
76                parent.jQuery.fancybox.close();
77            } else {
78                $('#mrshopmailnotification-form-modal-' + idProduct + '-' + idProductAttribute + '.modal').modal('hide');
79            }
80            if (!resp.error) {
81                notifyMeButton.addClass('disabled').removeAttr("onclick").contents().last()[0].textContent = enabledAlertLabel;
82            } else {
83                notifyMeButton.removeClass('disabled');
84            }
85            setTimeout(function () {
86                if (!!$.prototype.fancybox) {
87                    if (typeof openAlertMessage == 'function')
88                        openAlertMessage(moduleName, resp.message, false, closeLabel);
89                    else {
90                        $.fancybox({
91                            content: '<div class="fc-content">' +
92                            '<h3>' + moduleName + '</h3>' +
93                            '<p>' + resp.message + '</p>' +
94                            '</div>'
95                        });
96                    }
97                } else {
98                    openBootstrapModal(moduleName, resp.message);
99                }
100
101            }, 500);
102        }
103    });
104    return false;
105}
106
107function removeNotification(el) {
108    $(el).addClass('disabled').attr('disabled', true);
109    var idProduct = $(el).data('id-product');
110    var idProductAttribute = $(el).data('id-product-attribute');
111    $.ajax({
112        type: 'POST',
113        url: $(el).data('url'),
114        data: 'id_product=' + idProduct + '&id_product_attribute=' + idProductAttribute,
115        success: function (resp) {
116            resp = JSON.parse(resp);
117            if (resp) {
118                if ($(el).parents('#alert-product').length > 0) {
119                    $(el).parents('#alert-product').fadeOut('slow');
120                } else {
121                    $(el).parents('li').fadeOut('slow');
122                }
123
124            }
125        }
126    });
127    return false;
128}
129
130function styleRemoveNotification() {
131    removeNotificationButton = $('.js-remove-email-alert');
132    if (removeNotificationButton.length > 0) {
133        removeNotificationButton.each(function () {
134            if (typeof is17 === 'undefined') {
135                var is17 = true;
136            }
137            if (is17) {
138                $(this).next().prepend($(this));
139            } else {
140                $(this).next().find('>li').prepend($(this));
141            }
142        });
143    }
144}
145
146
147$(document).ready(function () {
148    styleRemoveNotification();
149    $('body').on('click', '[id^=open-mrshopmailnotification-form-modal]:not([onClick])', function (e) {
150        var mrshopmailnotification = $(this).find('~[id^=mrshopmailnotification-form-modal]');
151        e.preventDefault();
152        if (!!$.prototype.fancybox) {
153            $.fancybox.open(mrshopmailnotification, {
154                smallBtn: false,
155                buttons: [],
156                animationDuration: 200,
157                animationEffect: 'material'
158            });
159        } else {
160            var ids = $(this).parent('.js-mrshopmailnotification').find('> input[type=hidden]');
161            openBootstrapModal(false, mrshopmailnotification, true, ids[0].value, ids[1].value);
162        }
163    });
164});

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.