PageSourceSearch

https://tofas.com.tr/_catalogs/masterpage/scripts/site.js

js tofas.com.tr collected 2026-09-24 19:35:02 UTC 20,000 bytes, 774 lines download raw bytes

1'use strict';
2
3function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
5/**
6 * Created by muammer.dagidir on 10.1.2018.
7 */
8
9var tofas = tofas || {};
10
11tofas.variables = {};
12
13tofas.page = {
14	modal: {
15		itemTag: $('[data-modal]'),
16		contentTag: $('[data-modal-content]'),
17		closeTag: $('[data-modal-close]'),
18		backdropTag: $('[data-modal-backdrop]'),
19		videoTag: $('[data-modal-video]'),
20		init: function init() {
21			tofas.page.modal.openClick();
22			tofas.page.modal.closeClick();
23			tofas.page.modal.backdropClick();
24			tofas.page.modal.esc();
25			$(window).resize(tofas.page.modal.openClick);
26		},
27		openClick: function openClick() {
28			tofas.page.modal.itemTag.on('click', function () {
29				var attr = $(this).attr('data-modal');
30				tofas.page.modal.close();
31				tofas.page.modal.open(attr);
32			});
33		},
34		closeClick: function closeClick() {
35			tofas.page.modal.closeTag.click(function () {
36				tofas.page.modal.close();
37			});
38		},
39		open: function open(attr) {
40			tofas.page.modal.allVideoPause();
41			tofas.page.modal.itemTag.removeClass('opened');
42			$('[data-modal-content="' + attr + '"]').addClass('opened');
43		},
44		close: function close() {
45			tofas.page.modal.contentTag.removeClass('opened');
46			tofas.page.modal.mute();
47		},
48		mute: function mute() {
49			if (tofas.page.modal.videoTag.length > 0) {
50				tofas.page.modal.videoTag.each(function () {
51					$(this)[0].pause();
52				});
53			}
54		},
55		backdropClick: function backdropClick() {
56			tofas.page.modal.backdropTag.click(function () {
57				tofas.page.modal.close();
58			});
59		},
60		esc: function esc() {
61			$(document).keydown(function (e) {
62				if (e.keyCode === 27) {
63					tofas.page.modal.close();
64				}
65			});
66		},
67		allVideoPause: function allVideoPause() {
68			if ($('.slider-video').length > 0) {
69				$('.slider-video').each(function () {
70					if ($(this).hasClass('video-opened')) {
71						$(this).removeClass('video-opened');
72						$(this).html('');
73					}
74				});
75			}
76		}
77	},
78	tab: {
79		selectbox: $('[data-tab-select]'),
80		container: $('[data-tab]'),
81		title: $('[data-tab-title]'),
82		content: $('[data-tab-content]'),
83		image: $('[data-tab-image]'),
84		init: function init() {
85			tofas.page.tab.title.click(function () {
86				var data = $(this).attr('data-tab-title');
87				tofas.page.tab.passive();
88				$(this).addClass('active');
89				$('[data-tab-content="' + data + '"]').addClass('open');
90				if ($('[data-tab-image]').length > 0) {
91					$('[data-tab-image="' + data + '"]').addClass('active');
92				}
93			});
94		},
95		passive: function passive() {
96			tofas.page.tab.title.removeClass('active');
97			tofas.page.tab.image.removeClass('active');
98			tofas.page.tab.content.removeClass('open');
99		},
100		select: function select() {
101			tofas.page.tab.passive();
102			if (tofas.page.tab.selectbox.length > 0) {
103				$('[data-tab-content="' + tofas.page.tab.selectbox.val() + '"]').addClass('open');
104				$('[data-tab-title="' + tofas.page.tab.selectbox.val() + '"]').addClass('active');
105				if (tofas.page.tab.image.length > 0) {
106					$('[data-tab-image="' + tofas.page.tab.selectbox.val() + '"]').addClass('active');
107				}
108			}
109		}
110	},
111	accordion: {
112		itemTag: $('[data-accordion-title]'),
113		contentTag: $('[data-accordion-content]'),
114		init: function init() {
115			tofas.page.accordion.click();
116		},
117		click: function click() {
118			tofas.page.accordion.itemTag.click(function () {
119				tofas.page.accordion.close();
120				tofas.page.accordion.open($(this));
121			});
122		},
123		open: function open(_this) {
124			var attr = _this.attr('data-accordion-title');
125			_this.addClass('active');
126			$('[data-accordion-content="' + attr + '"]').addClass('open');
127		},
128		close: function close() {
129			tofas.page.accordion.itemTag.removeClass('active');
130			tofas.page.accordion.contentTag.removeClass('open');
131		}
132	},
133	forms: {
134		init: function init() {
135			tofas.page.forms.menuSelect();
136			tofas.page.forms.selectbox();
137			tofas.page.forms.datepicker();
138			document.addEventListener('click', tofas.page.forms.closeAllSelect());
139		},
140		selectbox: function selectbox() {
141			var x, i, j, selElmnt, a, b, c;
142			x = document.getElementsByClassName('custom-select-menu');
143			if(x.lenght>4)
144				return;
145			var d = '<span class="err"></span>';
146			for (i = 0; i < x.length; i++) {
147				selElmnt = x[i].getElementsByTagName('select')[0];
148				a = document.createElement('DIV');
149				a.setAttribute('class', 'select-selected');
150				a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
151				x[i].appendChild(a);
152				b = document.createElement('DIV');
153				b.setAttribute('class', 'select-items select-hide');
154				for (j = 1; j < selElmnt.length; j++) {
155					c = document.createElement('DIV');
156					c.innerHTML = selElmnt.options[j].innerHTML;
157					c.addEventListener('click', function (e) {
158						var i, s, h;
159						s = this.parentNode.parentNode.getElementsByTagName('select')[0];
160						h = this.parentNode.previousSibling;
161						for (i = 0; i < s.length; i++) {
162							if (s.options[i].innerHTML == this.innerHTML) {
163								s.selectedIndex = i;
164								h.innerHTML = this.innerHTML;
165								break;
166							}
167						}
168						tofas.page.tab.select();
169						tofas.page.press.select(s.value);
170						h.click();
171					});
172					b.appendChild(c);
173				}
174				x[i].appendChild(b);
175
176				var error = document.createElement('DIV');
177				error.setAttribute('class', 'err');
178				var msg = x[i].getAttribute('error-msg');
179				error.innerHTML = msg;
180				x[i].appendChild(error);
181				a.addEventListener('click', function (e) {
182					e.stopPropagation();
183					tofas.page.forms.closeAllSelect(this);
184					this.nextSibling.classList.toggle('select-hide');
185					this.classList.toggle('select-arrow-active');
186				});
187			}
188		},
189		closeAllSelect: function closeAllSelect(el) {
190			var x,
191			    y,
192			    i,
193			    arrNo = [];
194			x = document.getElementsByClassName('select-items');
195			y = document.getElementsByClassName('select-selected');
196			for (i = 0; i < y.length; i++) {
197				if (el == y[i]) {
198					arrNo.push(i);
199				} else {
200					y[i].classList.remove('select-arrow-active');
201				}
202			}
203			for (i = 0; i < x.length; i++) {
204				if (arrNo.indexOf(i)) {
205					x[i].classList.add('select-hide');
206				}
207			}
208		},
209		menuSelect: function menuSelect() {
210			var select = $('[data-menu-select]');
211			if (select.length > 0) {
212				select.change(function () {
213					window.location = select.val();
214				});
215			}
216		},
217		datepicker: function datepicker() {
218			if ($('input.date').length > 0) {
219				$('input.date').focus(function () {
220					$(this).attr('type', 'date');
221				});
222				$('input.date').focusout(function () {
223					$(this).attr('type', 'text');
224				});
225			}
226		}
227	},
228	home: {
229		init: function init(){
230			//console.log(11111);
231			var elem = document.getElementById("Tofas_50_yil_filmi_rev_21704");
232			if(!elem){return;}
233			if (elem.requestFullscreen) {
234			  elem.requestFullscreen();
235			} else if (elem.mozRequestFullScreen) {
236			  elem.mozRequestFullScreen();
237			} else if (elem.webkitRequestFullscreen) {
238			  elem.webkitRequestFullscreen();
239			}
240		}
241	},
242	arge: {
243		init: function init() {
244			tofas.page.arge.carousel();
245			tofas.page.arge.detailButton();
246		},
247		carousel: function carousel() {
248			$('[data-arge-carousel]').slick({
249				dots: true,
250				infinite: false,
251				slidesToShow: 4,
252				slidesToScroll: 4,
253				arrows: true,
254				prevArrow: '<button class="slick-prev" aria-label="" type="button"></button>',
255				nextArrow: '<button class="slick-next" aria-label="" type="button"></button>',
256				responsive: [{
257					breakpoint: 1330,
258					settings: {
259						slidesToShow: 3,
260						slidesToScroll: 3,
261						infinite: false,
262						dots: true
263					}
264				}, {
265					breakpoint: 1024,
266					settings: {
267						slidesToShow: 2,
268						slidesToScroll: 2,
269						infinite: false,
270						dots: true,
271						arrows: false
272					}
273				}, {
274					breakpoint: 600,
275					settings: {
276						arrows: false,
277						slidesToShow: 2,
278						slidesToScroll: 2
279					}
280				}, {
281					breakpoint: 480,
282					settings: {
283						arrows: false,
284						slidesToShow: 1,
285						slidesToScroll: 1
286					}
287				}]
288			});
289		},
290		detailButton: function detailButton() {
291			$('[data-button]').click(function () {
292				var ID = $(this).attr('data-button'),
293				    detail = $(this).attr('data-text'),
294				    close = $(this).attr('data-close');
295				if ($('[data-content="' + ID + '"]').hasClass('opened')) {
296					$('[data-content="' + ID + '"]').removeClass('opened');
297					$(this).removeClass('opened');
298					$(this).find('.page-button_text').html(detail);
299					if ($('[data-item]').length > 0) {
300						$('[data-item="' + ID + '"]').removeClass('active');
301					}
302				} else {
303					$('[data-content="' + ID + '"]').addClass('opened');
304					$(this).addClass('opened');
305					$(this).find('.page-button_text').html(close);
306					if ($('[data-item]').length > 0) {
307						$('[data-item="' + ID + '"]').addClass('active');
308					}
309				}
310			});
311		}
312	},
313	sustainability: {
314		init: function init() {
315			tofas.page.sustainability.chart();
316		},
317		chart: function chart() {
318			if ($('#bar-chart').length > 0) {
319				new Chart(document.getElementById('bar-chart'), {
320					type: 'bar',
321					data: {
322						labels: [2013, 2014, 2015, 2016, 2017, 2018],
323						datasets: [{
324							label: '',
325							backgroundColor: '#af9572',
326							data: [4.60, 4.77, 4.69, 3.90, 3.76, 3.86]
327						}]
328					},
329					options: {
330						tooltips: {
331							enabled: true
332						},
333						legend: {
334							display: false
335						},
336						title: {
337							display: true,
338							text: ''
339						},
340						scales: {
341							xAxes: [{
342								gridLines: {
343									display: false,
344									drawBorder: false
345								}
346							}],
347							yAxes: [{
348								display: false,
349								gridLines: {
350									display: false,
351									drawBorder: false
352								}
353							}]
354						}
355					}
356				});
357			}
358		}
359	},
360	press: {
361		selectItem: $('[data-redirect-select]'),
362		videoSliderItem: $('[data-press-video-slider]'),
363		init: function init() {
364			tofas.page.press.videoSlider();
365		},
366		videoSlider: function videoSlider() {
367			tofas.page.press.videoSliderItem.slick({
368				autoplay: false,
369				infinite: false,
370				slidesToShow: 1,
371				slidesToScroll: 1,
372				arrows: true,
373				fade: false,
374				dots: false,
375				adaptiveHeight: false,
376				responsive: [{
377					breakpoint: 992,
378					settings: {
379						adaptiveHeight: true,
380						dots: true,
381						arrows: false,
382						slidesToShow: 1,
383						slidesToScroll: 1
384					}
385				}]
386			});
387		},
388		select: function select(url) {
389			if (tofas.page.press.selectItem.length > 0) {
390				//console.log(url);
391				window.location = url;
392			}
393		}
394	},
395	career: {
396		init: function init() {
397			tofas.page.career.filter();
398			tofas.page.career.gridbox();
399		},
400		filter: function filter() {
401			$('[data-filter]').click(function () {
402				var attr = $(this).attr('data-filter');
403				tofas.page.career.hide(attr);
404				tofas.page.career.show(attr);
405				tofas.page.career.active($(this));
406			});
407		},
408		hide: function hide(attr) {
409			if (attr != '') {
410				$('[data-filter-id]').hide();
411			}
412		},
413		show: function show(attr) {
414			if (attr == '') {
415				$('[data-filter-id]').show();
416			} else {
417				$('[data-filter-id="' + attr + '"]').show();
418			}
419		},
420		active: function active(_this) {
421			$('[data-filter]').removeClass('active');
422			_this.addClass('active');
423		},
424		gridbox: function gridbox() {
425			if ($('.grid').length > 0) {
426				$('.grid').isotope({
427					itemSelector: '.grid-item',
428					percentPosition: true,
429					masonry: {
430						columnWidth: '.grid-sizer'
431					}
432				});
433			}
434		}
435	},
436	timeline: {
437		init: function init() {
438			tofas.page.timeline.calc();
439			$(window).on('resize', function () {
440				tofas.page.timeline.calc();
441			});
442		},
443		calc: function calc() {
444			//var data =  [],
445			//selector = [];
446			var el = $('[data-timeline-content]');
447			el.each(function (index) {
448				var subItemCount = $(this).find('[data-timeline-box]').length;
449				var subItemWidth = $(this).find('[data-timeline-box]').width();
450				var contentWidth = subItemCount * subItemWidth + subItemCount * 50;
451				if (window.matchMedia('(min-width: 991px)').matches) {
452					$(this).width(contentWidth);
453				} else {
454					$(this).width('100%');
455				}
456			});
457		}
458	},
459	contact: _defineProperty({
460		init: function init() {
461			tofas.page.contact.map();
462		},
463		map: function map() {
464			var locations = [['Genel Müdürlük', 41.0696625, 29.010739, 4], ['Fabrika', 40.2613941, 29.0713591, 5]];
465			if (document.getElementById('map')) {
466				var map = new google.maps.Map(document.getElementById('map'), {
467					zoom: 7,
468					center: new google.maps.LatLng(41.0696625, 29.010739),
469					disableDefaultUI: true,
470					styles: [{
471						'featureType': 'administrative',
472						'elementType': 'labels',
473						'stylers': [{
474							'visibility': 'on'
475						}, {
476							'gamma': '1.82'
477						}]
478					}, {
479						'featureType': 'administrative',
480						'elementType': 'labels.text.fill',
481						'stylers': [{
482							'visibility': 'on'
483						}, {
484							'gamma': '1.96'
485						}, {
486							'lightness': '-9'
487						}]
488					}, {
489						'featureType': 'administrative',
490						'elementType': 'labels.text.stroke',
491						'stylers': [{
492							'visibility': 'off'
493						}]
494					}, {
495						'featureType': 'landscape',
496						'elementType': 'all',
497						'stylers': [{
498							'visibility': 'on'
499						}, {
500							'lightness': '25'
501						}, {
502							'gamma': '1.00'
503						}, {
504							'saturation': '-100'
505						}]
506					}, {
507						'featureType': 'poi.business',
508						'elementType': 'all',
509						'stylers': [{
510							'visibility': 'off'
511						}]
512					}, {
513						'featureType': 'poi.park',
514						'elementType': 'all',
515						'stylers': [{
516							'visibility': 'off'
517						}]
518					}, {
519						'featureType': 'road',
520						'elementType': 'geometry.stroke',
521						'stylers': [{
522							'visibility': 'off'
523						}]
524					}, {
525						'featureType': 'road',
526						'elementType': 'labels.icon',
527						'stylers': [{
528							'visibility': 'off'
529						}]
530					}, {
531						'featureType': 'road.highway',
532						'elementType': 'geometry',
533						'stylers': [{
534							'hue': '#ffaa00'
535						}, {
536							'saturation': '-43'
537						}, {
538							'visibility': 'on'
539						}]
540					}, {
541						'featureType': 'road.highway',
542						'elementType': 'geometry.stroke',
543						'stylers': [{
544							'visibility': 'off'
545						}]
546					}, {
547						'featureType': 'road.highway',
548						'elementType': 'labels',
549						'stylers': [{
550							'visibility': 'simplified'
551						}, {
552							'hue': '#ffaa00'
553						}, {
554							'saturation': '-70'
555						}]
556					}, {
557						'featureType': 'road.highway.controlled_access',
558						'elementType': 'labels',
559						'stylers': [{
560							'visibility': 'on'
561						}]
562					}, {
563						'featureType': 'road.arterial',
564						'elementType': 'all',
565						'stylers': [{
566							'visibility': 'on'
567						}, {
568							'saturation': '-100'
569						}, {
570							'lightness': '30'
571						}]
572					}, {
573						'featureType': 'road.local',
574						'elementType': 'all',
575						'stylers': [{
576							'saturation': '-100'
577						}, {
578							'lightness': '40'
579						}, {
580							'visibility': 'off'
581						}]
582					}, {
583						'featureType': 'transit.station.airport',
584						'elementType': 'geometry.fill',
585						'stylers': [{
586							'visibility': 'on'
587						}, {
588							'gamma': '0.80'
589						}]
590					}, {
591						'featureType': 'water',
592						'elementType': 'all',
593						'stylers': [{
594							'visibility': 'off'
595						}]
596					}]
597				});
598				var marker, i;
599				for (i = 0; i < locations.length; i++) {
600					marker = new google.maps.Marker({
601						position: new google.maps.LatLng(locations[i][1], locations[i][2]),
602						map: map,
603						icon: '/images/mapmarker.png'
604					});
605				}
606			}
607		}
608	}, 'map', function map() {
609		var locations = [['Fabrika', 40.2613941, 29.0713591, 5]];
610		if (document.getElementById('registermap')) {
611			var map = new google.maps.Map(document.getElementById('registermap'), {
612				zoom: 7,
613				center: new google.maps.LatLng(40.2613941, 29.0713591),
614				disableDefaultUI: true,
615				styles: [{
616					'featureType': 'administrative',
617					'elementType': 'labels',
618					'stylers': [{
619						'visibility': 'on'
620					}, {
621						'gamma': '1.82'
622					}]
623				}, {
624					'featureType': 'administrative',
625					'elementType': 'labels.text.fill',
626					'stylers': [{
627						'visibility': 'on'
628					}, {
629						'gamma': '1.96'
630					}, {
631						'lightness': '-9'
632					}]
633				}, {
634					'featureType': 'administrative',
635					'elementType': 'labels.text.stroke',
636					'stylers': [{
637						'visibility': 'off'
638					}]
639				}, {
640					'featureType': 'landscape',
641					'elementType': 'all',
642					'stylers': [{
643						'visibility': 'on'
644					}, {
645						'lightness': '25'
646					}, {
647						'gamma': '1.00'
648					}, {
649						'saturation': '-100'
650					}]
651				}, {
652					'featureType': 'poi.business',
653					'elementType': 'all',
654					'stylers': [{
655						'visibility': 'off'
656					}]
657				}, {
658					'featureType': 'poi.park',
659					'elementType': 'all',
660					'stylers': [{
661						'visibility': 'off'
662					}]
663				}, {
664					'featureType': 'road',
665					'elementType': 'geometry.stroke',
666					'stylers': [{
667						'visibility': 'off'
668					}]
669				}, {
670					'featureType': 'road',
671					'elementType': 'labels.icon',
672					'stylers': [{
673						'visibility': 'off'
674					}]
675				}, {
676					'featureType': 'road.highway',
677					'elementType': 'geometry',
678					'stylers': [{
679						'hue': '#ffaa00'
680					}, {
681						'saturation': '-43'
682					}, {
683						'visibility': 'on'
684					}]
685				}, {
686					'featureType': 'road.highway',
687					'elementType': 'geometry.stroke',
688					'stylers': [{
689						'visibility': 'off'
690					}]
691				}, {
692					'featureType': 'road.highway',
693					'elementType': 'labels',
694					'stylers': [{
695						'visibility': 'simplified'
696					}, {
697						'hue': '#ffaa00'
698					}, {
699						'saturation': '-70'
700					}]
701				}, {
702					'featureType': 'road.highway.controlled_access',
703					'elementType': 'labels',
704					'stylers': [{
705						'visibility': 'on'
706					}]
707				}, {
708					'featureType': 'road.arterial',
709					'elementType': 'all',
710					'stylers': [{
711						'visibility': 'on'
712					}, {
713						'saturation': '-100'
714					}, {
715						'lightness': '30'
716					}]
717				}, {
718					'featureType': 'road.local',
719					'elementType': 'all',
720					'stylers': [{
721						'saturation': '-100'
722					}, {
723						'lightness': '40'
724					}, {
725						'visibility': 'off'
726					}]
727				}, {
728					'featureType': 'transit.station.airport',
729					'elementType': 'geometry.fill',
730					'stylers': [{
731						'visibility': 'on'
732					}, {
733						'gamma': '0.80'
734					}]
735				}, {
736					'featureType': 'water',
737					'elementType': 'all',
738					'stylers': [{
739						'visibility': 'off'
740					}]
741				}]
742			});
743			var marker, i;
744			for (i = 0; i < locations.length; i++) {
745				marker = new google.maps.Marker({
746					position: new google.maps.LatLng(locations[i][1], locations[i][2]),
747					map: map,
748					icon: '/images/mapmarker.png'
749				});
750			}
751		}
752	})
753
754	/* init */
755
756};tofas.page.modal.init();
757tofas.page.tab.init();
758tofas.page.accordion.init();
759tofas.page.forms.init();
760tofas.page.arge.init();
761tofas.page.sustainability.init();
762tofas.page.press.init();
763tofas.page.career.init();
764tofas.page.timeline.init();
765tofas.page.contact.init();
766
767tofas.page.home.init();
768
769$(function () {
770	$('#datepicker').datepicker({
771		minDate: new Date()
772	});
773});
774//# sourceMappingURL=site.js.map

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.