PageSourceSearch

https://uzdrowisko-naleczow.pl/wp-content/plugins/better-weather/js/betterweather.js?ver=3.1.0

js uzdrowisko-naleczow.pl collected 2026-10-09 17:04:41 UTC 7,734 bytes, 213 lines download raw bytes

1/**
2 * BetterWeather v3
3 * Author: BetterStudio (http://themeforest.net/user/Better-Studio?ref=Better-Studio)
4 * @license BetterStudio
5*/
6(function($){
7    $.betterWeather = function(el, options){
8        var base = this;
9        base.$el = $(el);
10        base.el = el;
11        base.$el.data("betterWeather", base);
12
13        // Template Initialized
14        base.templateInitialized = false;
15
16        // Detecting retina
17        base.retina = window.devicePixelRatio > 1;
18
19        base.init = function(){
20
21            // Init svg icon
22            base.initIcons();
23
24            // widget mode init
25            if(  base.$el.hasClass( 'better-weather') ){
26                base.prettifyIconSize();
27                $( window ).resize(function() {
28                    base.prettifyIconSize();
29                });
30            }
31
32            // Hide loader after EQ init
33            setTimeout(function(){
34                base.helper.hideLoader();
35            }, 600);
36
37        };
38
39        base.initIcons = function(){
40
41            if( ! base.$el.hasClass( 'animated-icons' ) ) {
42                return;
43            }
44                // Prepare icons for widget
45            if( base.$el.hasClass( 'better-weather' ) ){
46
47                // Base Icon Manager
48                if( base.helper.isCanvasSupported() ){
49                    base.skycons = new Skycons({
50                        "color" : base.$el.data('font-color'),
51                        "dropShadow" : true
52                    });
53                }
54
55                // Big icon
56                if( base.$el.hasClass( 'style-normal' ) ){
57                    var _id = '#' + base.$el.attr('id') +'-summary-icon';
58                    $( _id ).attr( 'height', base.helper.getCorrectSize( 85 )).attr( 'width', base.helper.getCorrectSize( 85 ));
59                    base.skycons.set( base.$el.attr('id') +'-summary-icon' , $( _id ).data( 'icon' ) );
60                    base.skycons.play();
61                }else{
62                    var _id = '#' + base.$el.attr('id') +'-summary-icon';
63                    $( _id ).attr( 'height', base.helper.getCorrectSize( 55 )).attr( 'width', base.helper.getCorrectSize( 55 ));
64                    base.skycons.set( base.$el.attr('id') +'-summary-icon' , $( _id ).data( 'icon' ) );
65                    base.skycons.play();
66                }
67
68
69                // Days icons
70                if( base.$el.hasClass( 'have-next-days' ) ){
71
72                    var _id = '#' + base.$el.attr('id');
73
74                    // Day 1 icon
75                    $( _id + '-day1-icon' ).attr( 'height', base.helper.getCorrectSize( 17 )).attr( 'width', base.helper.getCorrectSize( 17 ));
76                    base.skycons.set( base.$el.attr('id') + '-day1-icon' , $( _id +'-day1-icon' ).data( 'icon' ) );
77                    base.skycons.play();
78
79                    // Day 2 icon
80                    $( _id + '-day2-icon' ).attr( 'height', base.helper.getCorrectSize( 17 )).attr( 'width', base.helper.getCorrectSize( 17 ));
81                    base.skycons.set( base.$el.attr('id') + '-day2-icon' , $( _id +'-day2-icon' ).data( 'icon' ) );
82                    base.skycons.play();
83
84                    // Day 3 icon
85                    $( _id + '-day3-icon' ).attr( 'height', base.helper.getCorrectSize( 17 )).attr( 'width', base.helper.getCorrectSize( 17 ));
86                    base.skycons.set( base.$el.attr('id') + '-day3-icon' , $( _id +'-day3-icon' ).data( 'icon' ) );
87                    base.skycons.play();
88
89                    // Day 4 icon
90                    $( _id + '-day4-icon' ).attr( 'height', base.helper.getCorrectSize( 17 )).attr( 'width', base.helper.getCorrectSize( 17 ));
91                    base.skycons.set( base.$el.attr('id') + '-day4-icon' , $( _id +'-day4-icon' ).data( 'icon' ) );
92                    base.skycons.play();
93                }
94
95            } else if( base.$el.hasClass( 'better-weather-inline' ) ){ // Prepare icons for inline style
96
97                // Base Icon Manager
98                if( base.helper.isCanvasSupported() ){
99                    base.skycons = new Skycons({
100                        "color" : base.$el.data('font-color'),
101                        "dropShadow" : false
102                    });
103                }
104
105                var _w = '', _h ='';
106                switch ( base.$el.data('inline-size') ){
107                    case 'small':
108                        _h = _w = 18;
109                        break;
110                    case 'medium':
111                        _h = _w = 30;
112                        break;
113                    case 'large':
114                        _h = _w = 55;
115                        break;
116                }
117
118                $( '#' + base.$el.attr('id') +'-summary-icon' ).attr( 'height', _h ).attr( 'width', _w );
119                base.skycons.set( base.$el.attr('id') +'-summary-icon' , $( '#' + base.$el.attr('id') + '-summary-icon').data( 'icon' ) );
120                base.skycons.play();
121
122            }
123
124
125        };
126
127        base.prettifyIconSize = function(){
128
129            var _w = base.$el.width();
130            var $_icon = base.$el.find('.bw_summary .bw_icon');
131
132            if( $_icon.hasClass( 'hw_static-icon' ) ){
133                return;
134            }
135
136            switch( true ){
137
138                case _w <= 70:
139                    base.helper.updateIconSize( $_icon , 28 , 28 );
140                    break;
141
142                case _w <= 100:
143                    base.helper.updateIconSize( $_icon , 35 , 35 );
144
145                    break;
146
147                case _w <= 200:
148                    base.helper.updateIconSize( $_icon , 40 , 40 );
149                    break;
150
151                case _w <= 400:
152                    if( base.$el.hasClass( 'style-modern' ) ){
153                        base.helper.updateIconSize( $_icon , 55 , 55 );
154                    }else if( base.$el.hasClass( 'style-modern' ) ){
155                        base.helper.updateIconSize( $_icon , 70 , 70 );
156                    }
157                    break;
158
159                case _w <= 1170:
160                    base.helper.updateIconSize( $_icon , 35 , 35 );
161                    break;
162            }
163
164        };
165
166        base.helper = {
167            getCorrectSize: function( value ){
168                if( base.retina ){
169                    return value * 2;
170                }
171                else{
172                    return value;
173                }
174            },
175            updateIconSize: function( $_icon , width , height ){
176                $_icon.attr( 'width' , base.helper.getCorrectSize(width));
177                $_icon.attr( 'height' , base.helper.getCorrectSize(height));
178                $_icon.css( "width" , width+'px' );
179                $_icon.css( "height" , height+'px' );
180            },
181            hideLoader: function(){
182                base.$el.find('.bw-loader').remove();
183            },
184            isCanvasSupported: function() {
185                var elem = document.createElement('canvas');
186                return !!(elem.getContext && elem.getContext('2d')) ;
187            }
188        };
189
190        // Hack for element query on local/cross domain
191        if (typeof elementQuery == 'function') {
192            elementQuery({
193                ".better-weather": {"max-width": ["2000px", "1170px", "970px", "900px", "830px", "650px", "550px", "440px", "400px", "350px", "300px", "250px", "200px", "170px", "120px", "100px", "50px"]},
194            });
195        }
196
197        base.init();
198    };
199
200    $.fn.betterWeather = function(options){
201        return this.each( function(){
202            new $.betterWeather(this, options);
203        });
204    };
205})(jQuery);
206
207(function( $ ) {
208
209    $('.better-weather, .better-weather-inline').each(function(){
210        $(this).betterWeather();
211    });
212
213})( 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.