'use strict'; (function () { // Add class. /*function plainAddClass (el) { if (el.classList) el.classList.add(className); else el.className += ' ' + className; }*/ // Remove class. /*function plainRemoveClass (el) { if (el.classList) el.classList.remove(className); else el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' '); }*/ // Set attribute. /*function plainAttr (el, type, val) { el.setAttribute(type, val); }*/ var allVideos = document.querySelectorAll('.video-trigger'); if (allVideos.length) { Array.prototype.forEach.call(allVideos, function(el, i){ el.onclick = function (e) { var iframe = e.target.nextElementSibling; iframe.setAttribute('src', 'https://www.youtube.com/embed/'+ this.id +'?autoplay=1&rel=0'); iframe.style.display = 'block'; this.style.display = 'none'; } }); } function winPopup(url, wid, hit){ var w1 = screen.width; var h1 = screen.height; var center = (w1 - wid) / 2; var middle = (h1 - hit) / 2; window.open(url,'Samata Sainik Dal','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width='+wid+',height='+hit+',screenX=0,screenY=0,left='+ center +',top='+ middle +''); return false; } var allSharingButtons = document.querySelectorAll('.social-share a'); if (allSharingButtons.length) { Array.prototype.forEach.call(allSharingButtons, function(el, i){ el.onclick = function (e) { e.preventDefault(); e.stopPropagation(); return winPopup(this.href, 600, 450); } }); } })();