PageSourceSearch

https://pgs-mobile.de/js/jnoty.js

js pgs-mobile.de collected 2026-10-06 18:11:45 UTC 12,089 bytes, 257 lines download raw bytes

vendor: 4,859 bytes, lines 1-116
1(function($) {
2    /** jnoty Wrapper - Establish a base jnoty Container for compatibility with older releases. **/
3    $.jnoty = function( m , o ) {
4        // To maintain compatibility with older version that only supported one instance we'll create the base container.
5        if ( $('#jnoty').length === 0 )
6            $('<div id="jnoty"></div>').addClass( (o && o.position) ? o.position : $.jnoty.defaults.position ).appendTo( (o && o.appendTo) ? o.appendTo : $.jnoty.defaults.appendTo );
7
8        // Create a notification on the container.
9        $('#jnoty').jnoty(m,o);
10    };
11
12
13    /** Raise jnoty Notification on a jnoty Container **/
14    $.fn.jnoty = function( m , o ) {
15        // Short hand for passing in just an object to this method
16        if ( o === undefined && $.isPlainObject(m) ) {
17            o = m;
18            m = o.mesage;
19        }
20
21        if ( $.isFunction(this.each) ) {
22            var args = arguments;
23
24            return this.each(function() {
25                /** Create a jnoty Instance on the Container if it does not exist **/
26                if ( $(this).data('jnoty.instance') === undefined ) {
27                    $(this).data('jnoty.instance', $.extend( new $.fn.jnoty(), { notifications: [], element: null, interval: null } ));
28                    $(this).data('jnoty.instance').startup( this );
29                }
30
31                /** Optionally call jnoty instance methods, or just raise a normal notification **/
32                if ( $.isFunction($(this).data('jnoty.instance')[m]) ) {
33                    $(this).data('jnoty.instance')[m].apply( $(this).data('jnoty.instance') , $.makeArray(args).slice(1) );
34                } else {
35                    $(this).data('jnoty.instance').create( m , o );
36                }
37            });
38        }
39    };
40
41    $.extend( $.fn.jnoty.prototype , {
42
43        /** Default jnoty Settings **/
44        defaults: {
45            pool:               0,
46            header:             '',
47            group:              '',
48            sticky:             false,
49            position:           'top-right',
50            appendTo:           'body',
51            glue:               'after',
52            theme:              'default',
53            themeState:         'highlight',
54            corners:            '10px',
55            check:              250,
56            life:               3000,
57            closeDuration:      'normal',
58            openDuration:       'normal',
59            easing:             'swing',
60            closer:             false,
61            closeTemplate:      '&times;',
62            closerTemplate:     '<div>[ close all ]</div>',
63            log:                function() {},
64            beforeOpen:         function() {},
65            afterOpen:          function() {},
66            open:               function() {},
67            beforeClose:        function() {},
68            close:              function() {},
69            click:              function() {},
70            animateOpen:        {
71                opacity:        'show'
72            },
73            animateClose:       {
74                opacity:        'hide'
75            }
76        },
77
78        notifications: [],
79
80        /** jnoty Container Node **/
81        element:                null,
82
83        /** Interval Function **/
84        interval:               null,
85
86        /** Create a Notification **/
87        create: function( message , options ) {
88            var o = $.extend({}, this.defaults, options);
89
90            /* To keep backward compatibility with 1.24 and earlier, honor 'speed' if the user has set it */
91            if (typeof o.speed !== 'undefined') {
92                o.openDuration = o.speed;
93                o.closeDuration = o.speed;
94            }
95
96            this.notifications.push({ message: message , options: o });
97
98            o.log.apply( this.element , [this.element,message,o] );
99        },
100
101        render: function( n ) {
102            var self = this;
103            var message = n.message;
104            var o = n.options;
105
106            // Support for jQuery theme-states, if this is not used it displays a widget header
107            o.themeState = (o.themeState === '') ? '' : 'ui-state-' + o.themeState;
108
109            var notification = $('<div/>')
110                .addClass('jGrowl-notification alert ' + o.themeState + ' ui-corner-all' + ((o.group !== undefined && o.group !== '') ? ' ' + o.group : ''))
111                .append($('<button/>').addClass('jGrowl-close').html(o.closeTemplate))
112                .append($('<div/>').addClass('jGrowl-header').html(o.header))
113                .append($('<div/>').addClass('jGrowl-message').html(message))
114                .data("jGrowl", o).addClass(o.theme).children('.jGrowl-close').bind("click.jGrowl", function() {
115                    $(this).parent().trigger('jGrowl.beforeClose');
116                    return false;
117                })
118                .parent();
119
120            var notification = $('<div/>')
121                .addClass('jnoty-container ' + o.themeState + '')
122                .append($('<button/>').addClass('jnoty-close').html(o.closeTemplate))
123                .append($('<div/>').addClass('jnoty-content')
124                    .append($('<div/>').addClass('jnoty-header')
125                        .append($('<span/>').addClass('jnoty-icon')
126                            .append($('<i/>').addClass(o.icon)))
127                        .append($('<span/>').addClass('jnoty-title').html(o.header)))
128                    .append($('<div/>').addClass('jnoty-message').html(message)))
129                .data("jnoty", o).addClass(o.theme).children('.jnoty-close').bind("click.jnoty", function () {
130                    $(this).parent().trigger('jnoty.beforeClose');
131                    return !1
132                }).parent();
133
134
135            /** Notification Actions **/
136            $(notification).bind("mouseover.jnoty", function() {
137                $('.jnoty-notification', self.element).data("jnoty.pause", true);
138            }).bind("mouseout.jnoty", function() {
139                $('.jnoty-notification', self.element).data("jnoty.pause", false);
140            }).bind('jnoty.beforeOpen', function() {
141                if ( o.beforeOpen.apply( notification , [notification,message,o,self.element] ) !== false ) {
142                    $(this).trigger('jnoty.open');
143                }
144            }).bind('jnoty.open', function() {
145                if ( o.open.apply( notification , [notification,message,o,self.element] ) !== false ) {
146                    if ( o.glue == 'after' ) {
147                        $('.jnoty-container:last', self.element).after(notification);
148                    } else {
149                        $('.jnoty-container:first', self.element).before(notification);
150                    }
151
152                    $(this).animate(o.animateOpen, o.openDuration, o.easing, function() {
153                        // Fixes some anti-aliasing issues with IE filters.
154                        if ($.support.opacity === false)
155                            this.style.removeAttribute('filter');
156
157                        if ( $(this).data("jnoty") !== null && typeof $(this).data("jnoty") !== 'undefined') // Happens when a notification is closing before it's open.
158                            $(this).data("jnoty").created = new Date();
159
160                        $(this).trigger('jGrowl.afterOpen');
161                    });
162                }
163            }).bind('jnoty.afterOpen', function() {
164                o.afterOpen.apply( notification , [notification,message,o,self.element] );
165            }).bind('click', function() {
166                o.click.apply( notification, [notification,message,o,self.element] );
167            }).bind('jnoty.beforeClose', function() {
168                if ( o.beforeClose.apply( notification , [notification,message,o,self.element] ) !== false )
169                    $(this).trigger('jnoty.close');
170            }).bind('jnoty.close', function() {
171                // Pause the notification, lest during the course of animation another close event gets called.
172                $(this).data('jnoty.pause', true);
173                $(this).animate(o.animateClose, o.closeDuration, o.easing, function() {
174                    if ( $.isFunction(o.close) ) {
175                        if ( o.close.apply( notification , [notification,message,o,self.element] ) !== false )
176                            $(this).remove();
177                    } else {
178                        $(this).remove();
179                    }
180                });
181            }).trigger('jnoty.beforeOpen');
182
183            /** Optional Corners Plugin **/
184            if ( o.corners !== '' && $.fn.corner !== undefined ) $(notification).corner( o.corners );
185
186            /** Add a Global Closer if more than one notification exists **/
187            if ($('.jnoty-container:parent', self.element).length > 1 &&
188                $('.jnoty-closer', self.element).length === 0 && this.defaults.closer !== false ) {
189                $(this.defaults.closerTemplate).addClass('jnoty-closer ' + this.defaults.themeState + ' ui-corner-all').addClass(this.defaults.theme)
190                    .appendTo(self.element).animate(this.defaults.animateOpen, this.defaults.speed, this.defaults.easing)
191                    .bind("click.jnoty", function() {
192                        $(this).siblings().trigger("jnoty.beforeClose");
193
194                        if ( $.isFunction( self.defaults.closer ) ) {
195                            self.defaults.closer.apply( $(this).parent()[0] , [$(this).parent()[0]] );
196                        }
197                    });
198            }
199        },
200
201        /** Update the jnoty Container, removing old jnoty notifications **/
202        update: function() {
203            $(this.element).find('.jnoty-container:parent').each( function() {
204                if ($(this).data("jnoty") !== undefined && $(this).data("jnoty").created !== undefined &&
205                    ($(this).data("jnoty").created.getTime() + parseInt($(this).data("jnoty").life, 10))  < (new Date()).getTime() &&
206                    $(this).data("jnoty").sticky !== true &&
207                    ($(this).data("jnoty.pause") === undefined || $(this).data("jnoty.pause") !== true) ) {
208
209                    // Pause the notification, lest during the course of animation another close event gets called.
210                    $(this).trigger('jnoty.beforeClose');
211                }
212            });
213
214            if (this.notifications.length > 0 &&
215                (this.defaults.pool === 0 || $(this.element).find('.jnoty-container:parent').length < this.defaults.pool) )
216                this.render( this.notifications.shift() );
217
218            if ($(this.element).find('.jnoty-container:parent').length < 2 ) {
219                $(this.element).find('.jnoty-closer').animate(this.defaults.animateClose, this.defaults.speed, this.defaults.easing, function() {
220                    $(this).remove();
221                });
222            }
223        },
224
225        /** Setup the jnoty Notification Container **/
226        startup: function(e) {
227            this.element = $(e).addClass('jnoty').append('<div class="jnoty-container"></div>');
228            this.interval = setInterval( function() {
229                // some error in chage ^^
230                var instance = $(e).data('jnoty.instance');
231                if (undefined !== instance) {
232                    instance.update();
233                }
234            }, parseInt(this.defaults.check, 10));
235        },
236
237        /** Shutdown jnoty, removing it and clearing the interval **/
238        shutdown: function() {
239            $(this.element).removeClass('jnoty')
240                .find('.jnoty-container').trigger('jnoty.close')
241                .parent().empty()
242            ;
243
244            clearInterval(this.interval);
245        },
246
247        close: function() {
248            $(this.element).find('.jnoty-container').each(function(){
249                $(this).trigger('jnoty.beforeClose');
250            });
251        }
252    });
253
254    /** Reference the Defaults Object for compatibility with older versions of jnoty **/
255    $.jnoty.defaults = $.fn.jnoty.prototype.defaults;
256
257})(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.