PageSourceSearch

https://www.olioptik.cz/olioptik/rsmenu.js

js olioptik.cz collected 2026-10-08 00:24:28 UTC 4,436 bytes, 130 lines download raw bytes

1( function( $ ) {
2$( document ).ready(function() {
3$('#rsmenu').prepend('<div id="menu-button">Menu</div>');
4	$('#rsmenu #menu-button').on('click', function(){
5		var menu = $(this).next('ul');
6		if (menu.hasClass('open')) {
7			menu.removeClass('open');
8		}
9		else {
10			menu.addClass('open');
11		}
12	});
13	velikost();	
14	// resizeimages();
15
16	// odstranìní width + height z obrázkù
17  $('#portmain img').removeAttr('width height');
18	
19 	// bxslider se spousti jen tehdy, pokud je v kodu div r_slider
20 	if ( $( "#r_slider" ).length ) {	
21 		var r_sl = $('#r_slider').detach();
22  	r_sl.insertAfter("h1");	
23  	$('.bxslider').bxSlider({
24  		auto: true,
25  		autoControls: false,
26  		pager: false,
27  		controls: true,
28  		captions: false,
29		});
30	}
31});
32
33// velikost ... pøi zmìnì velikosti pøepíná menu na responzivní (posunuje div)
34
35function velikost() {
36  var mql = window.matchMedia("screen and (max-width: 923px)")
37	if (mql.matches){ // if media query matches
38		
39 		var rmenu = $('#rsmenu').detach();
40  	rmenu.prependTo("#mobnav");
41
42 	}	
43	else{
44	 		var rmenu = $('#rsmenu').detach();
45  		rmenu.appendTo("#rsmenu_kotva");			
46	}
47};
48
49// resizeimages ... upravuje velikosti obrazku v obsahustranky
50// momentalne nepouzivam, je z prvni generace responzivity
51// nyní nastaveno ve stylech + javascriptem odstrenene width a height
52
53function resizeimages() {
54 if ( ( $( "#obsahstranky" ).length ) && ( $( "#noresizeimages" ).length <= 0 ) ) {		// otestujeme, ¾e je na strance div #obsahstranky
55  var mql = window.matchMedia("screen and (max-width: 1760px)")
56	if (mql.matches){ // if media query matches
57		var max = 100;
58		$('#obsahstranky img').each(function() {
59		 var width = $(this).width();
60     var height = $(this).height();
61     var pomw =  $(this).width();						// pomocna sirka - dam si tam pak originalni sirku
62     if (( width > 0 ) && ( height > 0)) {
63    	// naplníme atributy orig_w, orig_h
64    	if (($(this).attr('orig_w') == undefined) || ($(this).attr('orig_h') == undefined)) {
65				 $(this).attr('orig_w', $(this).width() );
66				 $(this).attr('orig_h', $(this).height() );
67				 if (( $( "#obsahstranky" ).attr('mobil') == undefined ) || ( $( "#obsahstranky" ).attr('mobil') == 0 )) {		// nastavime priznak, ¾e se neco zmensovalo
68				    $( "#obsahstranky" ).attr('mobil',1);
69				 }
70			} else {
71					width  = $(this).attr('orig_w');
72      		height = $(this).attr('orig_h');
73      		pomw =  width;
74			};   	
75
76    	max = $(this).parent().width();
77
78    	var obsahsirka = Math.round( $('#obsahstranky').width()-10 );
79			if (( obsahsirka < max ) && ( obsahsirka > 0)) {
80				max = obsahsirka;
81			};
82    	// alert(max);
83    	if ( max <= 0 ) { 
84    		max = 150
85    	};
86    	
87    	if ( (( width > max) && ( max > 0)) || ( pomw > width ) ) {
88    			// var img_real_width, img_real_height, new_height;
89    			// img_real_width = $(this).width();
90          // img_real_height = $(this).height();
91      	  // new_height = Math.round(img_real_height / ( img_real_width / max ));
92      	  new_height = Math.round(height / ( width / max ));
93      	  $(this).width(max);
94      	  $(this).height(new_height);
95    	};
96    	// $(this).removeAttr('height');
97     } // width > 0
98		});		
99 	}	
100	else{
101	 	if (( $( "#obsahstranky" ).attr('mobil') !== undefined ) && ( $( "#obsahstranky" ).attr('mobil') !== 1 )) {		// je nastaven priznak, ¾e se neco zmensovalo
102	 		// $( "#obsahstranky" ).removeAttr( "mobil" );
103	 		$( "#obsahstranky" ).attr('mobil',0);
104	 		$('#obsahstranky img').each(function() {
105				 if (($(this).attr('orig_w') !== undefined ) && ($(this).attr('orig_h') !== undefined )) {	
106					$(this).width($(this).attr('orig_w'));
107      	  $(this).height($(this).attr('orig_h'));
108					//	$(this).css('width', 'initial'); // tohle taky funguje, ale dava to nativni velikost, ne velikost uvedenou v html kodu
109					//	$(this).css('height', 'initial');	
110				 		
111    			// $(this).width($(this).get(0).naturalWidth); // tohle funguje, ale dava to nativni velikost, ne velikost uvedenou v html kodu
112    			// $(this).height($(this).get(0).naturalHeight);
113    		 }	
114				
115    	}); // konec each	
116    	
117		} 
118
119	} // if (mql.matches)
120 } // if ( $( "#obsahstranky" ).length )
121};
122
123// --------------- obsluha pøi zmìnách velikosti okna --------------------
124
125$( window ).resize(function() {
126	velikost();
127//	resizeimages();
128});
129
130} )( 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.