PageSourceSearch

https://www.lagap.org/wp-content/plugins/ctl-wp-studio/classes/ext…theme-bootstrap-toasts/js/front.js?ver=2724

js lagap.org collected 2026-10-02 19:00:53 UTC 3,425 bytes, 107 lines download raw bytes

1var CTL_TOASTS = function(){
2    
3};
4
5var g_oToasts = new CTL_TOASTS();
6
7jQuery(document).ready(function(){
8    //g_oToasts.onCheckUserNotifications();
9    
10    g_oToasts.showToasts();
11    
12    jQuery(document).on("click", ".ctl-theme-bootstrap-toasts-content .close", function(){
13        var oNodeToast = jQuery(this).closest(".toast");
14        
15        oNodeToast.removeClass( "animate__fadeInRight");
16        oNodeToast.addClass( "animate__fadeOutRight"); 
17
18        oNodeToast.fadeOut(1000, function(){
19            oNodeToast.remove();
20        });
21    });
22});
23
24CTL_TOASTS.prototype.showToasts = function(){
25    jQuery(".toast.animated").each(function(){
26        if ( !jQuery(this).hasClass("animate__fadeInRight")){
27            jQuery(this).addClass("animate__fadeInRight");
28        }
29    });    
30};
31
32CTL_TOASTS.prototype.appendToast = function( szTitle, szMessage, szCode, szClass, bAutoClose ){
33    var guid = g_oCTLWPStudio.makeCode(4); 
34    jQuery(".ctl-theme-bootstrap-toasts-content").append(
35            this.buildToast( szTitle, szMessage, szCode, szClass, guid ) );            
36    this.showToasts();
37
38    if ( bAutoClose === true ){
39        setTimeout(function(){
40            jQuery("#"+guid).find(".close").click();
41        }, 5000);        
42    }
43};
44
45CTL_TOASTS.prototype.buildToast = function( szTitle, szMessage, szCode, szUserClasses, guid ){
46    var html = '';
47
48    szClass = 'toast animated animate__animated';
49
50    if (szUserClasses){
51        szClass += ' ' + szUserClasses;
52    }
53    
54    if ( szCode ){
55        szMessage = '<div class="alert alert-' + szCode + '">' + szMessage + '</div>';
56    }
57
58    html += '<div id="'+guid+'" class="'+szClass+'" role="alert" aria-live="assertive" aria-atomic="true">';
59        html += '<div class="toast-header">';
60            //html += '<img src="..." class="rounded mr-2" alt="...">';
61            html += '<strong class="mr-auto">'+szTitle+'</strong>';
62            html += '<small class="text-muted"></small>';
63            html += '<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="' +
64                    g_oCTLThemeBootstrapToastsLocalizationFront["Close"] + '">';
65                html += '<span aria-hidden="true">&times;</span>';
66            html += '</button>';
67        html += '</div>';
68        html += '<div class="toast-body">';
69            html += szMessage;
70        html += '</div>';
71    html += '</div>';
72    
73    return html;
74};
75
76
77
78CTL_TOASTS.prototype.onCheckUserNotifications = function(){
79    var oParent = this;
80    
81    jQuery.post(
82        g_oCTLWPStudio._oLangCommon["ajaxurl"],{                
83            'action'           : 'ctl-wp-studio',
84            'execute'          : 'ctl-theme-bootstrap-toasts',
85            'extension-action' : 'user-notification'
86        }      
87    ).done( function(response){
88        var aData = JSON.parse(response);
89
90        for( var i = 0; i < aData.notifications.length; i++ ){
91            var oNotification = aData.notifications[i];
92            
93            oParent.appendToast(
94                        oNotification["title"],
95                        oNotification["message"],
96                        oNotification["url"],
97                        oNotification["code"],
98                        oNotification["class"]);
99        }
100
101    }).fail( function(){            
102        setTimeout( function(){
103            oParent.onCheckUserNotifications();
104        }, 5000);
105    });
106
107};

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.