PageSourceSearch

https://itspdf.com/assets/js/jquery-toast.js

js itspdf.com collected 2026-09-26 06:12:08 UTC 1,795 bytes, 76 lines download raw bytes

1(function(window, $){
2    "use strict"
3  
4    var defaultConfig = {
5      type: '',
6      autoDismiss: false,
7      container: '#toasts',
8      autoDismissDelay: 5000,
9      transitionDuration: 100,
10      rtransitionDuration: 500
11    }
12  
13    $.toast = function(config){
14      var size = arguments.length
15      var isString = typeof(config) === 'string'
16      
17      if(isString && size === 1){
18        config = {
19          message: config
20        };
21      }
22  
23      if(isString && size === 2){
24        config = {
25          message: arguments[1],
26          type: arguments[0]
27        }
28      }
29      
30      return new toast(config)
31    }
32  
33    var toast = function(config){
34      config = $.extend({}, defaultConfig, config)
35      // show "x" or not
36      var close = '×'
37      
38      // toast template
39      var toast = $([
40        '<div class="toast error d-flex align-items-center ' + config.type + '">',
41        '<p>' + config.message + '</p>',
42        '<div class="close">' + close + '</div>',
43        '</div>'
44      ].join(''))
45      
46      // handle dismiss
47      toast.find('.close').on('click', function(){
48        var toast = $(this).parent()
49  
50        toast.addClass('hide')
51  
52        setTimeout(function(){
53          toast.remove();
54        }, config.rtransitionDuration)
55      });
56      
57      // append toast to toasts container
58      $(config.container).empty();
59      $(config.container).append(toast)
60      
61      // transition in
62      setTimeout(function(){
63        toast.addClass('show');
64      }, config.transitionDuration)
65  
66      // if auto-dismiss, start counting
67      if(config.autoDismiss){
68        setTimeout(function(){
69          toast.find('.close').click()
70        }, config.autoDismissDelay)
71      }
72  
73      return this
74    }
75    
76  })(window, jQuery)

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.