PageSourceSearch

http://tvr1.tvr.ro/js-canal/functions.js

js tvr.ro collected 2026-09-24 09:12:57 UTC 12,437 bytes, 460 lines download raw bytes

1// ========== TABLE OF CONTENTS =========== //
2//
3// 1. Page Loader 
4// 2. Text fitting for headlines
5// 3. Parallax
6// 4. Calendar
7// 5. Navbar
8// 6. Sidenav
9// 7. Sidebar Newsfeed-1
10// 8. Sidebar Newsfeed-2
11// 9. Sidebar Newsfeed-3
12// 10. Sidebar Newsfeed-4
13// 11. Sidebar Newsfeed-5
14// 12. Sidebar Newsfeed-6
15// 13. News Ticker
16// 14. To Top Button
17// 15. Owl Carousel - News Slider & Schedule Slider
18// 16. Owl Carousel - Big Gallery Slider-1	
19// 17. Owl Carousel - Big Gallery Slider-2
20// 18. Owl Carousel - Big Gallery Slider-3
21// 19. Owl Carousel - Small Gallery Slider
22// 20. Clock
23// 21. Subscribe Form
24// 22. Exchange Rates
25// 23. Currency Converter
26// 24. Sidebar Weather
27// 25. Fitvids
28// 26. Sidebar Scroll
29//
30// ======================================= //
31
32(function($) {
33    "use strict";
34	
35	/* 1. Page Loader */	
36	$(".loader-item").delay(700).fadeOut();
37	$("#pageloader").delay(1200).fadeOut("slow");
38
39	/* 2. Text fitting for headlines */	
40	$('.extra-large-caption').fitText(1.5, { minFontSize: '26px', maxFontSize: '80px' });
41	$('.large-caption').fitText(1.5, { minFontSize: '26px', maxFontSize: '60px' });
42	$('.medium-caption').fitText(2, { minFontSize: '20px', maxFontSize: '30px' });
43	$('.small-caption').fitText(2.4, { minFontSize: '20px', maxFontSize: '26px' });
44	$('.extra-small-caption').fitText(2.4, { minFontSize: '16px', maxFontSize: '22px' });
45	$('.error-msg').fitText(2, { minFontSize: '36px', maxFontSize: '90px' });
46	
47	/* 3. Parallax */
48	function parallaxInit() {
49		$('.img-overlay1', '#parallax-section').parallax("100%", 0.8);
50	}
51	parallaxInit();
52
53	/* 4. Calendar */
54	$('#calendar').datepicker();
55
56	/* 5. Navbar */
57	// headroom
58	$("#fixed-navbar").headroom({
59		tolerance : 5,
60		offset: $('#main-section').offset().top,
61		classes: {
62			pinned: "headroom-pinned",
63			unpinned: "headroom-unpinned"
64		}
65	});
66	
67	// affix
68	$('#fixed-navbar').affix({
69		offset: {
70			top: $('#fixed-navbar').offset().top
71		}
72	});
73	
74	/* 6. Sidenav */
75	$('[data-sidenav]').sidenav();
76	$('.navbar-toggle').attr( 'id', $('#sidenav-toggle').attr('id') );
77	
78	// headroom
79	$("#mobile-nav").headroom({
80		offset: $('#main-section').offset().top,
81		classes: {
82			pinned: "headroom-pinned",
83			unpinned: "headroom-unpinned"
84		}
85	});
86	// Affix
87	$('#mobile-nav').affix({
88		offset: {
89        top: $('.top-menu').height()
90      }
91	});
92
93	/* 7. Sidebar Newsfeed-1 */
94	$('.newsfeed-1').easyTicker({
95		direction: 'up',
96		easing: 'easeOutSine',
97		speed: 'slow',
98		interval: 5000,
99		height: 'auto',
100		visible: 3,
101		mousePause: 1,
102	});
103
104	/* 8. Sidebar Newsfeed-2 */
105	$('.newsfeed-2').easyTicker({
106		direction: 'up',
107		easing: 'easeOutSine',
108		speed: 'slow',
109		interval: 5000,
110		height: 'auto',
111		visible: 4,
112		mousePause: 1,
113	});
114
115	/* 9. Sidebar Newsfeed-3 */
116	$('.newsfeed-3').easyTicker({
117		direction: 'up',
118		easing: 'easeOutSine',
119		speed: 'slow',
120		interval: 5000,
121		height: 'auto',
122		visible: 5,
123		mousePause: 1,
124	});
125
126	/* 10. Sidebar Newsfeed-4 */
127	$('.newsfeed-4').easyTicker({
128		direction: 'up',
129		easing: 'easeOutSine',
130		speed: 'slow',
131		interval: 3000,
132		height: 'auto',
133		visible: 6,
134		mousePause: 1,
135	});
136
137	/* 11. Sidebar Newsfeed-5 */
138	$('.newsfeed-5').easyTicker({
139		direction: 'up',
140		easing: 'easeOutSine',
141		speed: 'slow',
142		interval: 3000,
143		height: 'auto',
144		visible: 7,
145		mousePause: 1,
146	});
147
148	/* 12. Sidebar Newsfeed-6 */
149	$('.newsfeed-6').easyTicker({
150		direction: 'up',
151		easing: 'easeOutSine',
152		speed: 'slow',
153		interval: 3000,
154		height: 'auto',
155		visible: 8,
156		mousePause: 1,
157	});
158
159	/* 13. News Ticker */
160	$('.newsticker').easyTicker({
161		direction: 'up',
162		easing: 'easeOutSine',
163		speed: 'slow',
164		interval: 4000,
165		height: 'auto',
166		visible: 1,
167		mousePause: 1,
168		controls: {
169			up: '.up',
170			down: '.down'
171		}
172	});
173
174	/* 14. To Top Button */
175	$().UItoTop({
176		easingType: 'easeOutQuart'
177	});
178
179	/* 15. Owl Carousel - News Slider & Schedule Slider */
180	$("#news-slider,#sidebar-schedule-slider").owlCarousel({
181		autoPlay: 5000,
182		stopOnHover: true,
183		navigation: true,
184		navigationText: ["<i class='fa-angle-left'></i>", "<i class='fa-angle-right'></i>"],
185		paginationSpeed: 1000,
186		goToFirstSpeed: 2000,
187		singleItem: true,
188		autoHeight: true,
189		transitionStyle: "fade"
190	});
191
192	/* 16. Owl Carousel - Big Gallery Slider-1 */
193	$("#big-gallery-slider-1").owlCarousel({
194		navigation: true,
195		navigationText: ["<i class='fa-angle-left'></i>", "<i class='fa-angle-right'></i>"],
196		items: 3 // 3 visible items
197	});
198
199	/* 17. Owl Carousel - Big Gallery Slider-2 */
200	$("#big-gallery-slider-2").owlCarousel({
201		navigation: true,
202		navigationText: ["<i class='fa-angle-left'></i>", "<i class='fa-angle-right'></i>"],
203		items: 4 // 4 visible items
204	});
205
206	/* 18. Owl Carousel - Big Gallery Slider-3 */
207	$("#big-gallery-slider-3").owlCarousel({
208		navigation: true,
209		navigationText: ["<i class='fa-angle-left'></i>", "<i class='fa-angle-right'></i>"],
210		items: 5 // 5 visible items
211	});
212
213	/* 19. Owl Carousel - Small Gallery Slider */
214	$("#small-gallery-slider").owlCarousel({
215		navigation: true,
216		navigationText: ["<i class='fa-angle-left'></i>", "<i class='fa-angle-right'></i>"],
217		items: 4, // 4 items above 1400px browser width
218		itemsDesktop: [1400, 3], // 3 items between 1400px and 901px
219		itemsDesktopSmall: [900, 2], // 2 items betweem 900px and 601px
220		itemsTablet: [600, 1], // 1 items between 600 and 0
221		itemsMobile: false // itemsMobile disabled - inherit from itemsTablet option
222	});
223	
224	/* 20. Clock */
225	function getDate() {
226		var date = new Date();
227		var weekday = date.getDay();
228		var month = date.getMonth();
229		var day = date.getDate();
230		var year = date.getFullYear();
231		var hour = date.getHours();
232		var minutes = date.getMinutes();
233		var seconds = date.getSeconds();
234		if (hour < 10) hour = "0" + hour;
235		if (minutes < 10) minutes = "0" + minutes;
236		if (seconds < 10) seconds = "0" + seconds;
237		var monthNames = ["January", "February", "Sep", "April", "May", "June", "July", "August",
238			"September", "October", "December", "December"
239		];
240		var weekdayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
241			"Saturday"
242		];
243		var ampm = " PM ";
244		if (hour < 12) ampm = " AM ";
245		if (hour > 12) hour -= 12;
246		var showDate = weekdayNames[weekday] + ", " + monthNames[month] + " " + day + ", " + year;
247		var showTime = hour + ":" + minutes + ":" + seconds + ampm;
248		document.getElementById('date').innerHTML = showDate;
249		document.getElementById('time').innerHTML = showTime;
250		requestAnimationFrame(getDate);
251	}
252	getDate();
253
254	/* 21. Subscribe Form */
255	$('#subscribeForm').ketchup().submit(function() {
256		if ($(this).ketchup('isValid')) {
257			var action = $(this).attr('action');
258			$.ajax({
259				url: action,
260				type: 'POST',
261				data: {
262					email: $('#address').val()
263				},
264				success: function(data) {
265					$('#result').html(data);
266				},
267				error: function() {
268					$('#result').html('Sorry, an error occurred.');
269				}
270			});
271		}
272		return false;
273	});
274
275	/* 22. Exchange Rates */
276	$.getJSON("https://api.fixer.io/latest?base=USD", function(data) {
277		var cDate = data.date;
278		$('#cdate').append(' ' + cDate);
279		$('#euro').append(" " + data.rates.EUR);
280		$('#pound').append(" " + data.rates.GBP);
281		$('#yen').append(" " + data.rates.JPY);
282		$('#franc').append(" " + data.rates.CHF);
283		$('#cdollar').append(" " + data.rates.CAD);
284		$('#adollar').append(" " + data.rates.AUD);
285		$('#ron').append(" " + data.rates.RON);
286		$('#rub').append(" " + data.rates.RUB);
287	});
288
289	/* 23. Currency Converter */
290	$.get('http://api.fixer.io/latest?base=ZAR', function(data) {
291		var countryObject = data.rates;
292		for (var key in countryObject) {
293			if (countryObject.hasOwnProperty(key)) {
294				$('select').append('<option val="' + key + '">' + key + '</option>');
295			}
296		}
297		$('.convertFrom').change(function() {
298			var thisValue = $('.convertFrom .selectpicker').val();
299			$.get('http://api.fixer.io/latest?base=' + thisValue, function(newData) {
300				countryObject = newData.rates;
301			});
302		});
303		$('form').on('submit', function(e) {
304			e.preventDefault();
305			var convertingTo = $('.convertTo .selectpicker').val(),
306				toRate = countryObject[convertingTo],
307				amount = $('.currencyValue').val();
308			var calculation = amount * toRate;
309			if (calculation === 0) {
310				$('.output').html('Please enter a valid amount.');
311			} else {
312				$('.output').html(parseFloat(calculation).toFixed(3));
313			}
314		});
315	});
316
317	/* 24. Sidebar Weather */
318	var currWeather = {};
319	$(document).ready(function() {
320		currWeather = getLocationAndWeather('imperial');
321		$('.btn').click(switchScale);
322	});
323
324	function switchScale() {
325		if ($('.btn>.switch').text() === 'C') {
326			$('.btn>.switch').text('F');
327			$('.btn').blur();
328			getLocationAndWeather('imperial');
329		} else {
330			$('.btn>.switch').text('C');
331			$('.btn').blur();
332			getLocationAndWeather('metric');
333		}
334	}
335
336	function getLocationAndWeather(scale) {
337		return getWeather({
338			lat: -37.817011,
339			long: 144.955882
340		}, scale);
341	}
342
343	function getWeather(location, scale) {
344		$.getJSON('http://api.openweathermap.org/data/2.5/weather', {
345			APPID: '7c58f952e569d33ed1fdf52bad9b6f10',
346			lat: location.lat,
347			lon: location.long,
348			units: scale
349		}, function(results) {
350			var wthr = {
351				city: results.name,
352				wind_speed: (parseFloat(results.wind.speed) * 2.2369362920544).toFixed(1),
353				type: results.weather[0].main,
354				humidity: results.main.humidity,
355				temp: results.main.temp
356			};
357			setWeather(wthr, scale);
358			return wthr;
359		});
360	}
361
362	function setWeather(weather, scale) {
363		$('.weather-city-text', '#weather').text(weather.city);
364		$('#type').text(weather.type);
365		$('#humidity').text('Humidity: ' + weather.humidity + '%');
366		var spdUnit = 'm/s';
367		if (scale === 'imperial') spdUnit = 'mph';
368		$('#wind').text('Wind: ' + weather.wind_speed + spdUnit);
369		$('.temperature', '#weather').text(weather.temp);
370		setWeatherType(weather.type);
371	}
372
373	function setWeatherType(wType) {
374		var icons = {
375			Clear: ['wi-day-sunny', '#CFD8DC'],
376			Rain: ['wi-rain', '#CFD8DC'],
377			Clouds: ['wi-cloudy', '#CFD8DC'],
378			Mist: ['wi-fog', '#CFD8DC'],
379			Thunderstorm: ['wi-thunderstorm', '#CFD8DC'],
380			Snow: ['wi-snow', '#CFD8DC']
381		};
382		var $iconElem = $('.weather-icon', '#weather');
383		//Change the icon
384		$iconElem.removeClass('wi-day-sunny wi-rain wi-cloudy wi-fog wi-thunderstorm wi-snow')
385		        .addClass(icons[wType][0])
386		        .css({
387			           'color': icons[wType][1]
388		           });
389	}
390
391	/* 25. FitVids plugin for readjusting video sizes */
392	    $(".video-container").fitVids();
393
394	/* 26. Sidebar Scroll */
395	$(".sidebar-scroll").mCustomScrollbar({
396		setWidth: false,
397		setHeight: 876,
398		setTop: 0,
399		setLeft: 0,
400		axis: "y",
401		scrollbarPosition: "outside",
402		scrollInertia: 950,
403		autoDraggerLength: true,
404		autoHideScrollbar: false,
405		autoExpandScrollbar: false,
406		alwaysShowScrollbar: 0,
407		snapAmount: null,
408		snapOffset: 0,
409		mouseWheel: {
410			enable: true,
411			scrollAmount: 200,
412			axis: "y",
413			preventDefault: false,
414			deltaFactor: "auto",
415			normalizeDelta: true,
416			invert: false,
417			disableOver: ["select", "option", "keygen", "datalist", "textarea"]
418		},
419		scrollButtons: {
420			enable: false,
421			scrollType: "stepless",
422			scrollAmount: "auto"
423		},
424		keyboard: {
425			enable: true,
426			scrollType: "stepless",
427			scrollAmount: "auto"
428		},
429		contentTouchScroll: 25,
430		advanced: {
431			autoExpandHorizontalScroll: false,
432			autoScrollOnFocus: "input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",
433			updateOnContentResize: true,
434			updateOnImageLoad: true,
435			updateOnSelectorChange: false,
436			releaseDraggableSelectors: false
437		},
438		theme: "light",
439		callbacks: {
440			onInit: false,
441			onScrollStart: false,
442			onScroll: false,
443			onTotalScroll: false,
444			onTotalScrollBack: false,
445			whileScrolling: false,
446			onTotalScrollOffset: 0,
447			onTotalScrollBackOffset: 0,
448			alwaysTriggerOffsets: true,
449			onOverflowY: false,
450
451			onOverflowX: false,
452			onOverflowYNone: false,
453			onOverflowXNone: false
454		},
455		live: false,
456		liveSelector: null
457	});
458
459})(jQuery);
460

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.