PageSourceSearch

https://www.emiratesskills.ae/_catalogs/masterpage/ESkills/common/js/script.js

js emiratesskills.ae collected 2026-10-05 09:51:46 UTC 31,605 bytes, 1,011 lines download raw bytes

1/**********Apend coyrights after any copied text************/
2function addLink() {
3    //Get the selected text and append the extra info
4    var currentYear = (new Date).getFullYear();
5    var selection = window.getSelection(), 
6        pagelink = '<br /><br /> All Rights Reserved ACTVET © '+ currentYear +' '+document.location.href,
7        copytext = selection + pagelink,
8        newdiv = document.createElement('div');
9
10    //hide the newly created container
11    newdiv.style.position = 'absolute';
12    newdiv.style.left = '-99999px';
13
14    //insert the container, fill it with the extended text, and define the new selection
15    document.body.appendChild(newdiv);
16    newdiv.innerHTML = copytext;
17    selection.selectAllChildren(newdiv);
18
19    window.setTimeout(function () {
20        document.body.removeChild(newdiv);
21    }, 100);
22}
23
24document.addEventListener('copy', addLink);
25    
26/*********** Helper Functions ***********/
27(function($) {
28    $.fn.hasScrollBar = function() {
29        return this.get(0).scrollHeight > this.height();
30    }
31})(jQuery); 
32
33
34//Theming from Cookies
35function getCookie(name)
36		  {
37		    var re = new RegExp(name + "=([^;]+)");
38		    var value = re.exec(document.cookie);
39		    return (value != null) ? unescape(value[1]) : null;
40		  }	
41var inverseColors = function(){
42		 		  
43		  	if(getCookie("themeColors") == "default" || getCookie("themeColors")== null)
44		  	{	
45		  			$('[id$=defaultTheme]').attr('href','/_catalogs/masterpage/ESkills/common/css/theme-inversed.css');
46		  			$('[src*="/_catalogs/masterpage/ESkills/common/images/date-icon.png"]').attr("src","/_catalogs/masterpage/ESkills/common/images/inverse-date-icon.png");
47                    $('[src*="/_catalogs/masterpage/ESkills/common/images/why_pic.png"]').attr("src","/_catalogs/masterpage/ESkills/common/images/why-pic-inv.png");
48					if($('.defaultImage').length > 0){
49						$('.defaultImage').hide();
50						$('.inversedImage').show(); 
51					}
52
53					 
54			
55					document.cookie = "themeColors=inverse;path=/";
56	
57			}
58			else
59		  	{
60		  		$('[id$=defaultTheme]').attr('href','/_catalogs/masterpage/ESkills/common/css/theme.css');
61		  		$('[src*="/_catalogs/masterpage/ESkills/common/images/why_pic-inv.png"]').attr("src","/_catalogs/masterpage/ESkills/common/images/why_pic.png");
62				$('[src*="/_catalogs/masterpage/ESkills/common/images/inverse-date-icon.png"]').attr("src","/_catalogs/masterpage/ESkills/common/images/date-icon.png");
63					if($('.inversedImage').length > 0){
64						$('.defaultImage').show();
65						$('.inversedImage').hide(); 
66					}
67
68
69
70
71
72					document.cookie = "themeColors=default;path=/";
73			}
74
75}
76
77function closeMenu(){
78	$( "header.main-header .navbar-default .navbar-toggle" ).trigger( "click" );
79	return false;
80}
81
82/***************** Custom Acc for Home page (H not V) ***************/
83function customAccordion(){
84	console.log("Horizontal Acc.");
85	$('.side-content').each(function(){
86			$(this).append('<div class="data-wrap"></div>');
87			var data = $(this).find('.skill-list, p, h6');
88			$(this).find('.data-wrap').append(data);
89	});
90	$('.data-wrap').hide();
91}
92/*$(window).resize(function(){
93	var windowWidth = $(window).width();
94	if(windowWidth < 768){
95		customAccordion();
96	}
97});*/
98
99
100
101$('document').ready(function(){ /* Doc Ready start */
102/* detect if IOS
103if(!!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform)){
104	$('.video-item > video').css('height','100%');
105}*/
106var ua = navigator.userAgent.toLowerCase(); 
107if (ua.indexOf('safari') != -1) { 
108  if (ua.indexOf('chrome') > -1) {
109    console.log("Chrome")
110  } else {
111  	$('.video-item > video').css('height','100%');
112    console.log("Safari");
113  }
114}
115
116
117/* Media gellery download link */
118$('.download-media').click(function(e){
119	e.stopPropagation();
120});
121
122
123/**** Winners previous win ****/
124if($('.winners-wrapper').length > 0){
125	$('.winner-previous').each(function(){
126		if($(this).find('.prev-win-group').css('display') == "block"){
127			$(this).find('.no-prev-win').hide();
128		}else{
129			$(this).find('.no-prev-win').show();
130		}
131	})
132}
133
134/**** List of previous competitions ****/
135if($('.prev-comp-winners').length > 0){
136		if($('.alert-warning').css('display') == "block"){
137			$(this).find('.prev-comp-winners').hide();
138		}else{
139			$(this).find('.prev-comp-winners').show();
140		}
141}
142
143
144$(window).on('orientationchange', function() {
145  $('.carousel-home-main').slick('resize');
146});
147$( window ).resize(function() {
148if ($("input").is(":focus")) {}
149else{
150		var windowWidth = $(window).width();
151		if (windowWidth < 3000){
152			$('#s4-workspace').scroll(function() {
153				if ( $('#s4-workspace').scrollTop() > 300 ) {
154					$('a.back-to-top').fadeIn('slow');
155				} else {
156					$('a.back-to-top').fadeOut('slow');
157				}
158			});
159		}}
160});
161
162/********** Logo Hover *********
163$('.ms-siteicon-img').hover(
164  function() {
165    $( this ).attr('src','/_catalogs/masterpage/ESkills/common/images/ES_Logo.png');
166  }, function() {
167    $( this ).attr('src','/_catalogs/masterpage/ESkills/common/images/eskills-logo.png');
168  }
169);
170$('.ms-siteicon-actvet').hover(
171  function() {
172    $( this ).attr('src','/_catalogs/masterpage/ESkills/common/images/actvet-logo-colored.png');
173  }, function() {
174    $( this ).attr('src','/_catalogs/masterpage/ESkills/common/images/actvet-logo.png');
175  }
176);*/    
177
178/************* Up Button *************/
179$('a.back-to-top').click(function() {
180	$('#s4-workspace').animate({
181		scrollTop: 0
182	}, 700);
183	return false;
184});
185
186
187
188if(_spPageContextInfo.currentLanguage!=1033){
189	$('footer .subscribe-btn').val('أشترك');
190}
191
192	/****************Mobile Menu*************/
193	$( window ).resize(function() {
194	if ($("input").is(":focus")) {}
195	else{
196		var windowWidth = $(window).width();
197		if (windowWidth < 768) {
198			$('header .navbar-collapse').addClass('mobile-menu');
199			$('.mobile-menu a.dynamic-children').on('click',function(e){
200				e.stopPropagation();
201				$(this).next('ul.dynamic').slideToggle();
202			});
203		}
204		else{
205			$('header .navbar-collapse').removeClass('mobile-menu');
206		}}
207	});
208	
209/******* Touch Devices *******/
210var windowWidth = $(window).width();
211if (Modernizr.touchevents && windowWidth < 1281){
212   console.log('Touch');
213//   $("body").addClass("touch-device");
214   var addedInput = $('<i class="fa fa-info touch-more-info" aria-hidden="true"></i>');
215   if($('.stories-list').length>0){
216   		addedInput.clone().appendTo($('.stories-list > li'));
217   		$('.stories-list > li').css('position','relative');
218   		$('.story-item .touch-more-info').on('click', function(){
219			$(this).parent().toggleClass('hovered');
220		});
221		$('.stories-list').addClass("touch");
222
223   		
224   		
225   }
226   if($('.related-albums').length>0){
227   		addedInput.clone().appendTo($('.related-albums > div'));
228   		$('.related-albums > div').css('position','relative');
229   }
230   if($('.elibrary-item').length>0){
231   		addedInput.clone().appendTo($('.elibrary-item > div'));
232   		$('.elibrary-item > div').css('position','relative');
233   }
234} else {
235   console.log('not touch');
236}
237$('.related-albums > div .touch-more-info').on('click', function(){
238	$(this).parent().toggleClass('hovered');
239});
240$('.elibrary-item > div .touch-more-info').on('click', function(){
241	//$(this).parent().parent().off('hover');
242	$(this).parent().find('a').toggleClass('hovered');
243});
244
245
246
247/*****************Removing webpart titles tooltips***********/
248$('.js-webpart-titleCell').attr('title','');
249/*****************************************/
250$('.eskills-filters  .date-picker table input[type="text"]').attr('readonly','true');
251/************* story details popup **************/
252
253$('[id*="successStoryData"] [id*="ImagesDiv"] img').click(function(){
254	var clonedObj = $(this).clone();
255	clonedObj.attr("src", $(this).attr('src').replace('RenditionID=',' '));
256	clonedObj.attr('class', ' ');
257	$('.story-popup-img .gallery-image').append(clonedObj);
258	$('.story-popup').show();
259});     
260$('.story-popup .close-btn').click(function(){
261	$('.story-popup').hide();
262	$('.story-popup-img .gallery-image img').remove();
263});
264
265
266$('.announcement-item .ann-text').dotdotdot({height:60,watch: true});
267$('.media-list .skill-item p').trimLines( { 'maxLines': 3});
268$('.team-item .member-details .name').trimLines( { 'maxLines': 2});
269$('.member-details .skill').trimLines( { 'maxLines': 2});
270
271
272
273
274
275/* Stories listing */
276$('.stories-listing .story-item .desc').trimLines( { 'maxLines': 3});
277//$('.story-Name').dotdotdot({height:60,watch: true});
278$('a[href="/#"]').attr('href','#');
279
280
281var windowWidth = $(window).width();
282if ( 750 < windowWidth <= 800) {
283$('.our-stories .story-details > .story-Name').dotdotdot({height:30,watch: true});
284$('.our-stories .story-Desc').dotdotdot({height:30,watch: true});
285
286
287
288}else{
289$('.story-Name').dotdotdot({height:60,watch: true});
290$('.our-stories .story-Desc').trimLines( { 'maxLines': 2});
291}
292
293
294
295
296$('.side-content h4').on('click', function() {
297 $(this).siblings('.data-wrap').addClass('selected');
298 $('.data-wrap.active:not(.selected)').removeClass('active');
299     $(this).siblings('.data-wrap').toggleClass('active');
300     $(this).siblings('.data-wrap').removeClass('selected');
301});
302/******************************************************/
303/* skils listing */
304$('.skill-item p').dotdotdot({height:72,watch: true});
305
306/***********NewsLetter popover********/
307setTimeout(function(){
308	if (getCookie("dontShowNewsLetter")) {
309   		}
310   		else{
311		$('.popover-subscribe').show('slow');
312		document.cookie = "dontShowNewsLetter=true";
313	}
314}, 3000);
315setTimeout(function(){
316  if ($(".popover-email:focus").length == 0) 
317   {
318   		$('.popover-subscribe').hide('slow');
319   }
320    }, 12000);
321
322$('.close-popover').click(function(e){
323e.stopPropagation();
324	$('.popover-subscribe').hide('slow');
325	document.cookie = "dontShowNewsLetter=true";
326});
327
328
329/**************************** E-library Handling No Image items **************************/
330if($('.elibrary-item').length > 0){
331		$('.elibrary-item').each(function(i, obj) {
332		    if($(this).find('input[type="hidden"]').val() == "False"){
333				$(this).find('img').css('opacity','0');
334			}
335		});
336	} 
337
338/****************** Winners *******************/
339var ul = $('.yearsHeaders'); 
340ul.children().each(function(i,li){ul.prepend(li)});
341
342$('.yearsHeaders li.currentYear').siblings().hide();
343
344if($('.yearsHeaders li.currentYear').next().length>0){
345	$('.yearsHeaders li.currentYear').next().addClass('nextYear');
346	$('.yearsHeaders li.currentYear').next().show();
347}else{
348	var spacefiller = "<li class='nextYear filler'><a>0000</a></li>";
349	$('.yearsHeaders').append(spacefiller);
350	$('.yearsHeaders li.currentYear').next().show();
351}
352if($('.yearsHeaders li.currentYear').prev().length>0){
353	$('.yearsHeaders li.currentYear').prev().addClass('prevYear');
354	$('.yearsHeaders li.currentYear').prev().show();
355}else{
356	var spacefiller = "<li class='prevYear filler'><a>0000</a></li>";
357	//spacefiller.insertBefore('.yearsHeaders li.currentYear');
358	$('.yearsHeaders li.currentYear').before( spacefiller );
359	$('.yearsHeaders li.currentYear').prev().show();
360}
361
362/************Media Resources*******/
363if($('.media-tools').length>0){
364$('.media-tools').parent('li').addClass('col-md-4').addClass('col-sm-6').addClass('col-lg-3').parent('.dfwp-list').addClass('row').addClass('flexed').parent().addClass('media-tool-group');
365 
366}
367
368/*********** Accordion ***********/
369 if($('.actvet-accordion').length > 0){
370	  
371	    $('.actvet-accordion .accordion-item .acc-head').click(function(){
372	   		$(this).siblings(".acc-data").slideToggle();
373	    	$(this).parent('.accordion-item').toggleClass('item-opened');
374	    	$('.winner-winner-item .medal-carousel .winner-medal-').remove();
375	    	if($(this).siblings(".acc-data").is( ".win-data" ) ){
376	    		if($('html').attr('dir') == 'rtl'){
377	    			$(this).siblings(".acc-data").find(".winner-images").slick({
378						arrows: false,dots: true,infinite: false,rtl: true
379					});
380					$(this).siblings(".acc-data").find(".prev-win-group").slick({
381						arrows: true,dots: false,infinite: false,rtl: true
382					});
383					$(this).siblings(".acc-data").find(".medal-carousel").slick({
384						arrows: true,dots: false,infinite: false,rtl: true
385					});
386	    		}
387	    		else{
388		    		$(this).siblings(".acc-data").find(".winner-images").slick({
389						arrows: false,dots: true,infinite: false
390					});
391					$(this).siblings(".acc-data").find(".prev-win-group").slick({
392						arrows: true,dots: false,infinite: false 
393					});
394					$(this).siblings(".acc-data").find(".medal-carousel").slick({
395						arrows: true,dots: false,infinite: false 
396					});
397				}
398	    	}
399	    	
400	    });
401	    
402    }
403
404/*********** default image in Latest Related Downloads ***********/
405 if($(".related-downloads").length > 0){
406 setTimeout(function(){ 
407 	$(".related-downloads .slick-slide").each(function(){
408		if($(this).find("input[id$='hdnImageExist']").val()=='False'){
409			$(this).find("img").attr("src","/_catalogs/masterpage/ESkills/common/images/default-icon.jpg");
410
411
412		}
413
414    });
415 }, 1000);
416}
417
418/********Detect If page In edit mode***********/
419var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;
420if (inDesignMode == "1")
421{
422    $('body').addClass('edit-mode');
423 }
424
425/*our stories title split*/
426if($('.our-stories .ms-webpart-titleText:first-child span').length>0){
427	$('.our-stories .ms-webpart-titleText:first-child span').each(function(){
428     var me = $(this);
429     me.html(me.html().replace(/(\w+)./, '<div class="first-word">$1</div>'));
430});}
431//Home page scripts 
432			
433	if($(".main").length>0 && $('.edit-mode').length <= 0){
434	// setting the heights of slides for the 100% height to work
435	$("#DeltaPlaceHolderMain").css('display','block');
436	$("#DeltaPlaceHolderMain,.carousel-home-main ,  .carousel-home-main .item, .carousel-details, .carousel-image").height($("#s4-workspace").height()); // make the placeholdermain DIV height equals the s4-workspace height to give div class="main" the rela height of the page
437	$( window ).resize(function() {	if ($("input").is(":focus")) {}
438	else{
439	 	$("#DeltaPlaceHolderMain , .carousel-home-main ,  .carousel-home-main .item, .carousel-details, .carousel-image").height($("#s4-workspace").height()); // adjust the height on resize
440	 
441}
442	});
443//howToJoin	
444function howToJoin(){
445	if($(".page-how.section").length>0){
446		if($(window).height()<= 768){
447		var remaningHeight=$(".page-how.section").height()-$(".how-to-circle .icon-area-top").height()-$(".how-to-circle .link-item > h3").height();
448		var textHeight=remaningHeight/2;
449		$(".how-to-circle .link-item p.description").dotdotdot({height:textHeight,watch: true});
450		}
451	}
452}
453$(window).resize(function() {
454if ($("input").is(":focus")) {}
455	else{
456
457howToJoin();
458}
459});
460
461howToJoin();
462	
463	
464	var windowWidth = $(window).width();
465	
466		//onepage scorll was here
467		//one page scroller
468	if(!navigator.userAgent.match(/Android/i)){
469
470		$(".main").onepage_scroll({ 
471		responsiveFallback: 3000,  
472		loop: false,
473		beforeMove: function(index) {
474	
475		
476	      if($('.main section.active:first-child').length<=0 && $(window).width()>=3000)
477			{
478			$('header').hide();
479			}
480			else{
481			$('header').show('slow');
482			}
483		}
484		//,
485//		afterMove: function(index) {
486//			 if($('.main section.active:last-child').length>0){
487//			 $('.onepage-wrapper').css('z-index',0);
488//			 }
489//			 else{
490//			  $('.onepage-wrapper').css('z-index',1);
491//			 }
492//		}
493		});  
494	}
495	else if(navigator.userAgent.match(/Android/i) && windowWidth < 1281)
496		{
497			//alert("android 1280");
498			console.log("android");
499			
500		}
501	}
502	
503	// initiate the reveal lightbox
504	$(".slick-lightbox-trigger").on('click',function(){
505		$('#highlight').html($(this).siblings(".full-details").html());
506	});	  
507	//fix scroll in touch device 
508		$('.main').off('touchstart swipeDown swipeUp'); 
509 
510
511if($('.inner-page').length>0){
512$('body').addClass('inner-body');
513}
514else{ 
515$('body').addClass('home-body');
516}
517  if($('[id$="divcountdownTimer"]').children().length<=0){
518 $('[id$="divcountdownTimer"]').remove();
519  }
520
521 /********HomePage titles***********/
522  
523$('.main .ms-webpart-chrome-title h2 span').not('.soical .ms-webpart-chrome-title h2 span').each(function(){
524     var me = $(this);
525     //me.html(me.html().replace(/^(\w+)/, '<div class="first-word">$1</div>'));
526     var node = me.contents().filter(function () { return this.nodeType == 3 }).first(),
527	        text = node.text();
528	        if(text.split(' ').length>1)
529	        {
530	        first = text.slice(0, text.indexOf(" "));
531	    
532	    if (!node.length)
533	        return;
534	    
535	    node[0].nodeValue = text.slice(first.length);
536	    node.before('<div class="first-word">' + first + '</div>');}
537});
538
539if($('.how-to-circle .link-item>h3>a').length>0){
540//$('.how-to-circle .link-item>h3>a').each(function(){
541//     var me = $(this);
542//     me.html(me.html().replace(/^(\w+)/, '<div class="first-word">$1</div>'));
543//});
544//}
545
546	$('.how-to-circle .link-item>h3>a').each(function(){
547		var me = $(this);
548	    var node = me.contents().filter(function () { return this.nodeType == 3 }).first(),
549	        text = node.text(),
550	        first = text.slice(0, text.indexOf(" "));
551	    
552	    if (!node.length)
553	        return;
554	    
555	    node[0].nodeValue = text.slice(first.length);
556	    node.before('<span class="first-word">' + first + '</span>');
557    });
558
559}
560
561if($('.soical .social-title').length>0){
562	$('.soical .social-title').each(function(){
563		var me = $(this);
564	    var node = me.contents().filter(function () { return this.nodeType == 3 }).first(),
565	        text = node.text(),
566	        first = text.slice(0, text.indexOf(" "));
567	    
568	    if (!node.length)
569	        return;
570	    
571	    node[0].nodeValue = text.slice(first.length);
572	    node.before('<div class="first-word">' + first + '</div>');
573    });
574
575}
576
577
578if($('.competition-data .description').length>0){
579$('.competition-data .description').each(function(){
580var competiton =$(this).text().split(':');
581$(this).html("<span>"+competiton[0] + ":</span><h3>" + competiton[1]+"</h3>");	  
582});
583}
584
585 
586 
587/*cookies*/
588if(getCookie("themeColors"))
589		  	{
590				if(getCookie("themeColors") == "default" || getCookie("themeColors")== null)
591			  	{
592									}
593				else
594			  	{	
595			  	
596					$('[id$=defaultTheme]').attr('href','/_catalogs/masterpage/ESkills/common/css/theme-inversed.css');
597					$('[src*="/_catalogs/masterpage/ESkills/common/images/why_pic.png"]').attr("src","/_catalogs/masterpage/ESkills/common/images/why-pic-inv.png");
598
599					//$('.ms-siteicon-img').attr('src','/_catalogs/masterpage/ESkills/common/images/logo-accessibility.png');
600					$('.ms-siteicon-actvet').attr('src','/_catalogs/masterpage/ESkills/common/images/inverse-actvet-logo.png');
601							
602					$('[src*="/_catalogs/masterpage/ESkills/common/images/date-icon.png"]').attr("src","/_catalogs/masterpage/ESkills/common/images/inverse-date-icon.png");
603					if($('.defaultImage').length > 0){
604						$('.defaultImage').hide();
605						$('.inversedImage').show(); 
606					}
607
608
609				 }
610			}
611			else{
612				document.cookie = "themeColors=default;path=/";
613		  		
614			}
615
616/*************Logo to reference root language site**********/
617if(_spPageContextInfo.currentLanguage==1033){
618$('[href="/"]').attr('href','/en');}
619else{
620$('[href="/"]').attr('href','/ar');}
621 
622
623
624$( window ).resize(function() {
625if ($("input").is(":focus")) {}
626	else{
627
628/*Triming*/
629	$(".campuses-list li").each(function(){
630//	    $(this).find(".album-title-hidden").dotdotdot({height:70,watch: true});
631		 $(this).find(".album-title-hidden").trimLines( { 'maxLines': 2});
632		var new_title= $(this).find(".album-title-hidden").text();
633		 $(this).find("div.flip-area-cntnr .album-title span").text(new_title);
634    });
635
636	var windowWidth = $(window).width();
637	if (windowWidth < 768) {
638		//$(".mid-area").css('border','1px red solid');
639		$(".search-div").appendTo( ".mobile-search" );
640/*		$(".lang-switch").appendTo( ".navbar-collapse" );*/
641		$(".mid-area").insertBefore( ".eskills-wrapper" );
642		$(".mid-area").addClass('col-xs-12');
643
644	}else{
645		$(".mid-area").insertBefore( ".actvet-wrapper" );
646		$(".mid-area").removeClass('col-xs-12');
647		$(".search-div").appendTo( "header .top-level" );
648/*		$(".lang-switch").appendTo( "header .top-level" );*/
649		if($('.campuses-details').length>0){
650			setTimeout(function(){
651			$('.side-menu-area').css('margin-top',$('.campuses-details .title-text').height());
652			}, 200); 
653		}
654	}
655	}
656});
657
658/******** Floating Menu ***********/
659$('.sb-social .email a').attr('onclick','');
660$('.floating-menu ul li > a').click(function () {
661    $(this).parent('li').siblings('li').removeClass('selected');
662
663    $(this).parent('li').toggleClass('selected');
664 });
665$("body").not('.floating-menu').click(function () {
666    $('.floating-menu ul li').removeClass('selected');});
667
668$(".floating-menu").click(function (e) {
669    e.stopPropagation();
670});
671
672
673/*************Media Gallery Upper Links*****************/
674if ($('.albums-list').length>0) {
675	var flickrToolTip = "Follow our Flickr account!";
676    var youTubeToolTip = "Subscribe to our YouTube channel!";
677    $('.dfwp-list li').hover(function () {
678    	$(this).find('.link-item').toggle();
679    });
680}
681
682
683
684    /***************video*********/
685     $('.open-video').click(function () { $('.video-cntnr').clone().appendTo('.video-popup');  $('.popup-overlay').show(); });
686        $('.close-btn').click(function () {
687            $('.video-popup .video-cntnr').remove();
688            $('.popup-overlay').hide();
689        });
690        
691    var windowWidth = $(window).width();
692	if (windowWidth < 769) {
693		$(".videos-cntnr video").on("pause", function (e) {
694		  console.log('paused');
695		  $('.page-video .ms-webpart-chrome-title').show();
696		  $('.videos-cntnr .show-all').show();
697		});
698		$(".videos-cntnr video").on("stop", function (e) {
699		  console.log('stopped');
700		  $('.page-video .ms-webpart-chrome-title').show();
701		  $('.videos-cntnr .show-all').show();
702		});
703		$(".videos-cntnr video").on("play", function (e) {
704		  console.log('played');
705		  $('.page-video .ms-webpart-chrome-title').hide();
706		  $('.videos-cntnr .show-all').hide();
707		});
708	}
709	
710	$('.video-item span:empty').hide();
711      
712/**************Media Gallery Popup************/
713$('.gallery-list .gallery-item').each(function(){
714
715	if($(this).siblings('.mediaType').val() == "VideoMediaGalleryCT")
716	{
717		$(this).parent().addClass('video-thumb');
718		$(this).parent().siblings('.download-media').addClass('hidden');
719	}
720	
721	if($(this).siblings('.mediaType').val() == "AlbumMediaCT")
722	{		
723		$(this).siblings('.link-inner-album').addClass('visible');
724		$(this).addClass('hidden');
725		$(this).siblings('.download-media').addClass('hidden');
726	}
727	else
728	{
729	$(this).siblings('.link-inner-album').addClass('hidden');
730
731
732	}
733
734
735});
736$('.gallery-popup .close-btn').click(function(){
737	$(this).closest('.popup-overlay').hide();
738	$('.gallery-carousel').slick('unslick');
739});
740$('.gallery-carousel #media_type').each(function(){
741	if($(this).val()=='VideoMediaGalleryCT')
742	{
743		$(this).siblings('.gallery-image').remove();
744	}
745	else{
746		$(this).siblings('.gallery-video').remove();
747	}
748});
749   
750  /************** To stop the video if the carousel changed slide ************/
751$('.gallery-carousel').on('afterChange', function(event, slick){
752	var vid = document.getElementsByTagName("video");
753	for (var i = 0; i < vid.length; i++) {
754		vid[i].pause(); 
755	}	
756});
757
758if($('.gallery-carousel>div').length<=1)
759{
760$('.gallery-carousel .gallery-image img, .gallery-carousel .gallery-video video').css('visibility','visible');
761}  
762    
763/*********Forms*************/
764var n = function (t) {
765    "" != t.val() ? t.addClass("edited") : t.removeClass("edited")
766}
767$('body').on({
768    keydown: function (t) {
769        n($(this))
770
771    }
772}, '.form-control');
773$('body').on({
774    blur: function (t) {
775        n($(this))
776
777    }
778}, '.form-control');
779
780$(".form-control").each(function () {
781    $(this).val().length > 0 && $(this).addClass("edited")
782});
783
784
785/******** Search ***********/
786 
787	$(".ms-srch-sb-searchLink").click(function(e){
788
789		if($(".search-wrap .ms-textSmall.ms-srch-sb-prompt").width() > 0 && $('header  #SearchBox input[type=text]').val() != '' && $('header  #SearchBox input[type=text]').val() != null ){
790			$(".search-wrap .ms-textSmall.ms-srch-sb-prompt").animate({width: '0px'},200);
791			$("header .ms-srch-sb").css('border','0');
792
793		}else{
794		e.preventDefault();
795			$(".search-wrap .ms-textSmall.ms-srch-sb-prompt").animate({width: '213px'},200); 
796			$("header .ms-srch-sb").css('background','transparent').css('border','0px');
797		if(getCookie("themeColors") == "default" || getCookie("themeColors")== null){
798				$("header .ms-srch-sb").css('border','1px solid #fff');
799			}else{
800				$("header .ms-srch-sb").css('border','1px solid #fff');
801			}
802		}
803		
804	 });
805
806/***********NewsLetter popover********/
807setTimeout(function(){
808	if (getCookie("dontShowNewsLetter")) {
809   		}
810   		else{
811		$('.popover-subscribe').show('slow');
812		document.cookie = "dontShowNewsLetter=true";
813	}
814}, 3000);
815setTimeout(function(){
816  if ($(".popover-email:focus").length == 0) 
817   {
818   		$('.popover-subscribe').hide('slow');
819   }
820    }, 12000);
821
822$('.close-popover').click(function(e){
823e.stopPropagation();
824	$('.popover-subscribe').hide('slow');
825	document.cookie = "dontShowNewsLetter=true";
826});
827
828
829/*********** Not Supported Browser Message ********/
830setTimeout(function(){
831	if (getCookie("dontShowSupportedMessage")) {
832			$('.notSupported').hide();
833   		}
834   		else{
835		
836		//document.cookie = "dontShowSupportedMessage=true";
837	}
838}, 3000);
839$('.close-alert').click(function(){
840	$('.notSupported').hide('slow');
841	document.cookie = "dontShowSupportedMessage=true";
842});
843
844/******* Touch Devices *******/
845if (Modernizr.touchevents){
846   console.log('Touch');
847   var $addedInput = $('<i class="fa fa-info touch-more-info" aria-hidden="true"></i>');
848   if($('.campuses-list').length>0){
849   		$addedInput.appendTo($('.campuses-list > li'));
850   		$('.campuses-list > li').css('position','relative');
851   }else if($('.discover-skills').length>0){
852   		$addedInput.appendTo($('.discover-skills > li'));
853   		$('.discover-skills > li').css('position','relative');
854   }
855} else {
856   console.log('not touch');
857   
858}
859
860$('.discover-skills > li .touch-more-info').on('click', function(){
861	$(this).parent().toggleClass('hovered');
862});
863$('.campuses-list > li .touch-more-info').on('click', function(){
864	$(this).parent().toggleClass('hovered');
865});
866
867/************** News and Press releases **************/
868$(".news-list .news-text").dotdotdot({height:60,watch: true});
869
870if($('[id$="hdnPressOpened"]').length>0)
871{
872if($('[id$="hdnPressOpened"]').val()== 'True')
873{
874$('.nav-tabs li').removeClass('active');
875$('#press-tab').parent('li').addClass('active');
876$('[id$=divNews]').removeClass('in active');
877$('[id$=divPressReleases]').addClass('in active');
878$(".press-list .press-text").dotdotdot({height:60,watch: true});//.trimLines( { 'maxLines': 3 } );
879
880}
881$('#news-tab').parent('li').click(function(){
882	$('[id$="hdnPressOpened"]').val('False');
883});
884}
885$('#press-tab').parent('li').click(function(){
886	$(".press-list .press-text").dotdotdot({height:60,watch: true});//.trimLines( { 'maxLines': 3 } );
887}
888);
889
890/***Experts***/
891if($('.expert-item').length>0){
892$(".expert-item .member-details .name").dotdotdot({height:60,watch: true});
893$(".expert-item .member-details .cateogry").dotdotdot({height:30,watch: true});
894$(".expert-item .member-details .skill").dotdotdot({height:60,watch: true});
895}
896if($('[id$="hdnExpertsOpened"]').length>0)
897{
898if($('[id$="hdnExpertsOpened"]').val()== 'True')
899{
900$('.nav-tabs li').removeClass('active');
901$('#experts-tab').parent('li').addClass('active');
902$('[id$=divTeam]').removeClass('in active');
903$('[id$=divExperts]').addClass('in active');
904}
905$('#team-tab').parent('li').click(function(){
906	$('[id$="hdnExpertsOpened"]').val('False');
907});
908}
909
910/********Announcements**********/
911$('.announcement-item .announcement-date > span').html(function(i, v) {
912    return v.replace(/\s(.*?)\s/, ' <span>$1</span> ');
913});	
914
915/**************************** Press Release Details Handling No Images Situation **************************/
916if($('.press-release-details').length > 0){
917	$('.press-release-details .text-content img[src=""]').parent().hide();
918}
919
920/*if($('.press-release-details').length>0 || $('.news-press-listing').length>0 || $('.albums-list').length>0 || $('.media-gallery-inner').length>0 ){
921     var me = $('.inner-page .inner-title');
922     var node = me.contents().filter(function () { return this.nodeType == 3 }).first(),
923	        text = node.text();
924	        if(text.split(' ').length>1)
925	        {
926	        first = text.slice(0, text.indexOf(" "));
927	    
928	    if (!node.length)
929	        return;
930	    
931	    node[0].nodeValue = text.slice(first.length);
932	    node.before('<div class="first-word">' + first + '</div>');}
933
934}*/
935
936/********************************************/
937$(".albums-list h3").each(function(){
938   $(this).dotdotdot({
939       height:40
940    });
941});
942
943/****************trim highlight***********************/
944$('.carousel-details-inner .carousel-title').dotdotdot({height:110,watch: true});
945$('.carousel-details-inner .carousel-desc').dotdotdot({height:78,watch: true});
946}); /* Doc Ready end */
947
948
949/********Font Handling***********/
950function increaseFont() {
951    if (parseInt($("body").css("font-size")) < 16) {
952        var newSize = parseInt($("body").css("font-size")) + 1;
953        $("body").css("font-size", newSize);
954        $('.decrease-font').prop('disabled', false);
955    }
956    else {
957        $('.increase-font').prop('disabled', true);
958    }
959}
960function decreaseFont() {
961    if (parseInt($("body").css("font-size")) > 12) {
962        var newSize = parseInt($("body").css("font-size")) - 1;
963        $("body").css("font-size", newSize);
964        $('.increase-font').prop('disabled', false);
965    }
966    else {
967        $('.decrease-font').prop('disabled', true);
968    }
969}
970function setdefaultFont() {
971    $('body').css('font-size', '14px');
972}
973
974/*********ZayedLogo***********
975$(document).ready(function() {
976
977        $language = _spPageContextInfo.currentCultureName;
978
979        // If it's german, I'll get german links
980        if ($language == "en-US") {
981            $('.zayedlogo-wrapper').html('<img src="/_catalogs/masterpage/ESkills/common/images/zayed_logo.png" alt="Emirates Skills" class="ms-siteicon-img" />');
982        } else {
983        // And if not, it will target to the english page
984            $('.zayedlogo-wrapper').html('<img src="/_catalogs/masterpage/ESkills/common/images/zayed_logo_ar.png" alt="Emirates Skills" class="ms-siteicon-img" />');
985        }
986
987    });
988*/
989
990/************* Up Button *************/
991$('#s4-workspace').scroll(function() {
992	if ( $('#s4-workspace').scrollTop() > 300 ) {
993		$('a.back-to-top').fadeIn('slow');
994	} else {
995		$('a.back-to-top').fadeOut('slow');
996	}
997	/*******Fixed top menu****/
998    
999});
1000$('a.back-to-top').click(function() {
1001
1002	$('#s4-workspace').clearQueue().animate({
1003		scrollTop: 0
1004	}, 700);
1005	return false;
1006});
1007
1008
1009
1010
1011

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.