PageSourceSearch

https://www.respublika.lt/scripts/news.js

js respublika.lt collected 2026-10-02 05:19:28 UTC 7,858 bytes, 256 lines download raw bytes

1var news_coment_form_submitted = false;
2
3function paywallCheck() {
4    if (getCookie('resessionid')) {
5	$jQuery_1_10_1.get('news.php?user', function(data) {if (data) {
6	    document.getElementById("mobile_menu_login_button").style.display = "none";
7	    document.getElementById("desktop_menu_login_button").style.display = "none";
8	    document.getElementById("mobile_menu_profile_button").style.display = "";
9	    document.getElementById("mobile_menu_logout_button").style.display = "";
10	    document.getElementById("desktop_menu_logout_button").style.display = "inline-block";
11	    document.getElementById("desktop_menu_profile_button").style.display = "inline";
12	    document.getElementById("desktop_menu_profile_button_separator").style.display = "inline";
13	    
14	    // User data
15	    var userData = JSON.parse(data);
16	    
17	    // Remove ads if needed
18	    if (userData.noads == 1){ 
19	        removeAds();
20	    }
21	    // Run specific ads
22	    else {
23		if (typeof globalThis.setupadCatheter === 'function') {
24		    setupadCatheter();
25		}
26		if (typeof globalThis.adViads112051 === 'function') {
27		    adViads112051();
28		}
29		if (typeof globalThis.adViads111895 === 'function') {
30		    adViads111895();
31		}
32		if (typeof globalThis.adKwords === 'function') {
33		    adKwords();
34		}
35	    }
36	    
37	    return true;
38	    };
39	}); 
40    }
41    return false;
42}
43
44function getArticle(id) {
45    if (getCookie('resessionid')) {
46
47	// Article
48	$jQuery_1_10_1.get('news.php?article='+id, function(data) {if (data) {
49
50	    // Remove description_p1
51	    description_p1 = document.getElementById("description_p1");
52	    description_p1.classList.remove("description_p1_paywalled");
53	    description_p1.remove();
54
55	    // Load article
56	    var newsData = JSON.parse(data);
57	    article_p2 = document.getElementById('p2');
58    	    article_p2.innerHTML = newsData.description;
59
60	}
61	else {
62	    let p2paywallContainer = document.querySelector('#p2_paywall_container');
63	    if (typeof(p2paywallContainer) !== 'undefined' && p2paywallContainer !== null) {
64		p2paywallContainer.style.display = "";
65	    }
66	};
67    }); 
68    }
69    else {
70	let p2paywallContainer = document.querySelector('#p2_paywall_container');
71	if (typeof(p2paywallContainer) !== 'undefined' && p2paywallContainer !== null) {
72	    p2paywallContainer.style.display = "";
73	}
74    }	
75
76// Gallery
77//	$jQuery_1_10_1.get('news.php?gallery='+id, function(data) {if (data) {
78//	    const photos = JSON.parse(data);
79//	    const test = photos.forEach(mfunction);
80//	    
81//	    };
82//        });
83    
84}
85
86function removeAds() {
87
88    // Remove ads
89    document.querySelectorAll(".mobile_banner").forEach(el => el.remove());
90    document.querySelectorAll(".desktop_banner").forEach(el => el.remove());
91    document.querySelectorAll(".banner_sticky").forEach(el => el.remove());
92    document.querySelectorAll(".onnetwork_container").forEach(el => el.remove());
93    document.querySelectorAll(".viads").forEach(el => el.remove());
94    document.getElementById("respublika.lt_sticky_bottom").remove();
95    let article_p2 = document.getElementById("p2"); 
96    if (article_p2 !== null) {
97	article_p2.style.paddingTop = "3%";
98    }
99
100}
101
102function mfunction(photo) {
103
104//    console.log(photo);
105//    const photos_path = "/uploads/img/catalog/1/";
106
107
108   // Show newest news block
109//   block_item_newest = document.getElementById("block_item_newest");
110//   block_item_newest.style.display = '';
111
112    // Set main photo
113//    main_photo = document.getElementById('item_main_photo');
114//    main_photo.style.backgroundImage  = "url('"+photos_path+photo['photo']+"')";
115    
116    // Set main photo title
117//    main_photo_title = document.getElementById('item_main_photo_title');
118//    main_photo_title.innerHTML = photo['photo_title'];
119    
120    // Gallery
121    //const swiperGalleryWrapper = document.getElementById('swiperGalleryWrapper');
122    //const swiperSlide = 
123//	'<div oncontextmenu="return false" class="swiper-slide swiper-lazy" data-background="/uploads/img/catalog/1/' + photo['photo'] + '">' +
124//	'<div class="swiper-lazy-preloader"></div><div id="titlebar" style="position:absolute; bottom:1%; width:100%; z-index:4; padding:10px; background-color:rgba(0, 0, 0, 0.25);"><div id="titlebar-title" class="swiper-no-swiping" style="color:#FFFFFF; font-weight:bold; font-size:12px;">({$counter}/{$rowset|@count}) ' + photo['photo_title'] + '</div>' +
125//	'</div></div>';
126//    swiperGalleryWrapper.innerHTML = swiperGalleryWrapper.innerHTML + swiperSlide;
127    
128    // Gallery thumbs
129    //const swiperGalleryThumbsWrapper = document.getElementById('swiperGalleryThumbsWrapper');
130    //const swiperSlideThumb = '<div oncontextmenu="return false" class="swiper-slide" style="background-image:url(/uploads/img/catalog/1/' + photo['photo_for_gallery'] + '); background-size: cover; background-position-y: top;"></div>';
131    //swiperGalleryThumbsWrapper.innerHTML = swiperGalleryThumbsWrapper.innerHTML + swiperSlideThumb;
132    
133}
134
135function postNewsComent(comment_id) {
136	//if (news_coment_form_submitted != true){
137	//$_('news_coment_form').submit();
138	//$_('news_coment_form_' + comment_id).submit();
139	console.log('Posting comment...');
140	
141	if (document.getElementById("main_block") !== null) {
142	    document.getElementById("main_block").style.display = "none";
143	}
144	
145	// UUID
146	var du = new DeviceUUID().parse();
147	var dua = [
148	    du.language,
149	    du.platform,
150	    du.os,
151	    du.cpuCores,
152	    du.isAuthoritative,
153	    du.silkAccelerated,
154	    du.isKindleFire,
155	    du.isDesktop,
156	    du.isMobile,
157	    du.isTablet,
158	    du.isWindows,
159	    du.isLinux,
160	    du.isLinux64,
161	    du.isMac,
162	    du.isiPad,
163	    du.isiPhone,
164	    du.isiPod,
165	    du.isSmartTV,
166	    du.pixelDepth,
167	    du.isTouchScreen
168	];
169	var uuid = du.hashMD5(dua.join(':'));
170	if (comment_id == 0) {
171	    document.getElementById('com_fid').value = uuid;
172	}
173	else {
174	    document.getElementById('com_fid_' + comment_id).value = uuid;
175	}
176	
177	// Post
178	document.getElementById('news_coment_form_' + comment_id).submit(); 
179	//news_coment_form_submitted = true;
180  //}
181}
182function setPreloader(src, dest) {
183  Element.setStyle(dest, {
184        'opacity': 0.6,
185        'filter': 'alpha(opacity=60)',
186        'width': Element.getWidth(src) + 'px',
187        'height': (Element.getHeight(src)+10) + 'px',
188        'top': /*getY(src) +*/ '0px',
189        'left': /*getX(src) + */'0px',
190        'overflow': 'visible',
191        'z-index': '1',
192        'position': 'absolute'
193      });
194  dest.style.display = '';
195}
196
197function getNewsBlocksTotal() {
198	var total = 0;
199
200	for (;;) {
201		if (!$_('bl_' + (total+1))) {
202			break;
203		}
204		total++;
205	}
206	return total;
207}
208
209function sizeBlocks() {
210	var total = getNewsBlocksTotal();	
211	for (var index = 1; index < total; index += 2) {
212		sizeBlock(index, index + 1);
213	}
214}
215
216function sizeHomeBlocks() {
217	var total = getNewsBlocksTotal();	
218	var half = total / 2;
219	for (var index = 1;; index++) {
220		if (index > half) {
221			break;
222		}
223		sizeBlock(index, half + index);
224	}	
225}
226
227function sizeBlock(index_left, index_right) {
228	bl_head = $_('bl_' + index_left + '_header');
229	br_head = $_('bl_' + index_right + '_header');
230	if (!br_head) {
231		return false;
232	}
233	bl_h = bl_head.offsetHeight;
234	br_h = br_head.offsetHeight;
235	bl_head.style.height = br_head.style.height = (br_h > bl_h ? br_h : bl_h) + "px";
236	
237	bl = $_('bl_' + index_left);
238	br = $_('bl_' + index_right);																				
239	bl_h = bl.offsetHeight;
240	br_h = br.offsetHeight;
241	bl.style.height = br.style.height = ((br_h > bl_h ? br_h : bl_h) - 31) + "px";
242}
243
244function setNewsLoadObserve(sizer) {
245	var listener = function() {			
246		this.sizer();
247	}; 
248	listener.sizer = sizer;
249	if (navigator.appName=='Microsoft Internet Explorer') {
250		if (navigator.appVersion.indexOf('MSIE 6.0') == -1) {
251			//Event.observe(window, 'load', listener.bind(listener)); 
252        }
253	} else {
254		//Event.observe(window, 'load', listener.bind(listener));
255	}
256}

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.