1(function () { 2 // polyfill 3 4 if ('NodeList' in window && !NodeList.prototype.forEach) { 5 console.info('polyfill for IE11'); 6 NodeList.prototype.forEach = function (callback, thisArg) { 7 thisArg = thisArg || window; 8 for (var i = 0; i < this.length; i++) { 9 callback.call(thisArg, this[i], i, this); 10 } 11 }; 12 } 13 // Source: https://github.com/jserz/js_piece/blob/master/DOM/ParentNode/prepend()/prepend().md 14 (function (arr) { 15 arr.forEach(function (item) { 16 if (item.hasOwnProperty('prepend')) { 17 return; 18 } 19 Object.defineProperty(item, 'prepend', { 20 configurable: true, 21 enumerable: true, 22 writable: true, 23 value: function prepend() { 24 var argArr = Array.prototype.slice.call(arguments), 25 docFrag = document.createDocumentFragment(); 26 27 argArr.forEach(function (argItem) { 28 var isNode = argItem instanceof Node; 29 docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem))); 30 }); 31 32 this.insertBefore(docFrag, this.firstChild); 33 } 34 }); 35 }); 36 })([Element.prototype, Document.prototype, DocumentFragment.prototype]); 37 38 // browser detect 39 navigator.who = (function () { 40 var ua = navigator.userAgent, 41 tem, 42 M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; 43 if (/trident/i.test(M[1])) { 44 tem = /\brv[ :]+(\d+)/g.exec(ua) || []; 45 return 'IE ' + (tem[1] || ''); 46 } 47 if (M[1] === 'Chrome') { 48 tem = ua.match(/\b(OPR|Edge)\/(\d+)/); 49 if (tem != null) return tem.slice(1).join(' ').replace('OPR', 'Opera'); 50 } 51 M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']; 52 if ((tem = ua.match(/version\/(\d+)/i)) != null) M.splice(1, 1, tem[1]); 53 return M.join(' '); 54 })(); 55 56 // is check mobile and tablet 57 navigator.isMobileTablet = (function () { 58 var check = false; 59 (function (a) { 60 if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; 61 })(navigator.userAgent || navigator.vendor || window.opera); 62 return check; 63 })(); 64 65 // is actual mobile check 66 navigator.isMobile = (function () { 67 var check = false; 68 (function (a) { 69 if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
69sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; 70 })(navigator.userAgent || navigator.vendor || window.opera); 71 return check; 72 })(); 73 /** 74 * utm params conditions 75 */ 76 jQuery('[data-learn-login-btn]').length && jQuery('[data-learn-login-btn]').on('click', function(event){ 77 event.preventDefault(); 78 var link = jQuery(this).attr('href'); 79 var utmCampaign = UTILITIES.getParamValueByName("utm_campaign", C_URL) || "login-button" ; 80 var utmSource = UTILITIES.getParameterByName("utm_source", C_URL) || "website" ; 81 var utmCategory = UTILITIES.getParamValueByName("mx_Page_Category", C_URL) || "Home" ; 82 if(utmCampaign){ 83 link = UTILITIES.replaceAll('ENCODED_UTM_CAMPAIGN',utmCampaign,link); 84 } 85 if(utmSource){ 86 link = UTILITIES.replaceAll('ENCODED_UTM_SOURCE',utmSource,link); 87 } 88 89 if(utmCategory){ 90 link = UTILITIES.replaceAll('ENCODED_PAGE_CATEGORY',utmCategory,link); 91 } 92 jQuery(this).attr('href', link); 93 if(typeof(cleverTapProdTrigger) !== "undefined"){ 94 cleverTapProdTrigger('homepage_login_button'); 95 } 96 setTimeout(function(){ 97 window.location.href=link; 98 }, 400) 99 }); 100 101 var youtubeLinks = jQuery(".announcement-banner a[href*='youtube.com']"); 102 youtubeLinks.each(function() { 103 jQuery(this).attr("data-toggle", "popup"); 104 jQuery(this).attr("data-target","#yt-video-player"); 105 jQuery(this).attr("data-yt-video-player", ""); 106 107 }); 108 109 110 111 var RAG_WIDTH = window.innerWidth; 112 var RAG_HEIGHT = window.innerHeight; 113 var isMobile = RAG_WIDTH < 768 ? 1 : 0; 114 window.addEventListener("resize", function () { 115 RAG_WIDTH = window.innerWidth; 116 RAG_HEIGHT = window.innerHeight; 117 isMobile = RAG_WIDTH < 768 ? 1 : 0; 118 }); 119 var HOME = { 120 onScrollEvent: function () { 121 var header = document.getElementById('primary-top-navbar'); 122 var offsetContant = 2; 123 window.onscroll = function (e) { 124 if (this.oldScroll > this.scrollY) { 125 // up 126 } else { 127 // down 128 // for lazy 129 RAG_SCROLL_TOP = (window.scrollY || window.pageYOffset) + window.innerHeight + 0; 130 } 131 this.oldScroll = this.scrollY; 132 133 // irrespective of scroll direction 134 insideScrollEvent(this); 135 } 136 137 insideScrollEvent(); 138 139 function insideScrollEvent(ele) { 140 ele = (typeof ele !== 'undefined') ? ele : window; 141 if (ele.scrollY < offsetContant) header.className = header.className.replace(/\ animate\b/g, ""); 142 else if (header.className.indexOf('animate') == -1) header.className += ' animate'; 143 } 144 }, 145 146 carousel: function () { 147 var slider = document.querySelectorAll('.carousel'); 148 var slidesViewCount = slider.find; 149 var indicators = document.querySelectorAll('.carousel .carousel-indicators li'); 150 var leftControle = document.querySelector(".carousel-controles.left"); 151 var rightControle = document.querySelector(".carousel-controles.right"); 152 153 function slideAction(control) { 154 // alert('left'); 155 // 1st - active right 156 // 0th - prev right 157 // 158 // alert('right'); 159 // 1st - active left 160 // 2nd - next left 161 // 162 try { 163 var dir = control == 'left' ? 'right' : 'left'; 164 var dir_regualar_exp = control == 'left' ? /\ right\b/g : /\ left\b/g; 165 var toDir = control == 'left' ? 'prev' : 'next'; 166 var toDir_reg = control == 'left' ? /\ prev\b/g : /\ next\b/g; 167 168 $slides = document.querySelectorAll('.carousel .item'); 169 $slidesCount = $slides.length; 170 $active = document.querySelectorAll('.carousel .item.active')[0]; 171 $aboutToActive = $active.previousElementSibling; 172 if (!$aboutToActive) $aboutToActive = $slides[$slidesCount - 1]; 173 174 $aboutToActive.className += ' ' + toDir; 175 $aboutToActive.offsetWidth; // force reflow 176 $active.className += ' ' + dir; 177 178 $aboutToActive.className += ' ' + dir; 179 } catch (error) { 180 // error 181 } 182 183 function carouselSlide() { 184 try { 185 $active.className = $active.className.replace(/\ active\b/g, ''); 186 $active.className = $active.className.replace(dir_regualar_exp, ''); 187 $aboutToActive.className = $aboutToActive.className.replace(dir_regualar_exp, ''); 188 $aboutToActive.className = $aboutToActive.className.replace(toDir_reg, ''); 189 190 $aboutToActive.className = $aboutToActive.className.replace(/\ active\b/g, ''); 191 $aboutToActive.className += ' active'; 192
193 $slides.forEach(function (item, i) { 194 if (item.className.indexOf('active') != -1) { 195 $activeIndex = i; 196 } 197 }); 198 $indicators = document.querySelectorAll('.carousel .carousel-indicators li'); 199 $activeIndicator = document.querySelectorAll('.carousel .carousel-indicators li.active')[0]; 200 $activeIndicator.className = $activeIndicator.className.replace(/\active\b/g, ''); 201 $indicators[$activeIndex].className += 'active'; 202 } catch (error) { 203 204 } 205 } 206 207 try { 208 if (HOME.transitionEnd()) { 209 $active.addEventListener(HOME.transitionEnd(), function (e) { 210 carouselSlide(); 211 }) 212 } else { 213 carouselSlide(); 214 } 215 } catch (error) { 216 217 } 218 } 219 220 if (!leftControle) return; 221 leftControle.addEventListener("click", function () { 222 slideAction('left'); 223 }); 224 225 if (!rightControle) return; 226 rightControle.addEventListener("click", function () { 227 slideAction('right'); 228 }); 229 }, 230 231 navigatorDetect: function () { 232 var ua = navigator.userAgent, 233 tem, 234 M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; 235 if (/trident/i.test(M[1])) { 236 tem = /\brv[ :]+(\d+)/g.exec(ua) || []; 237 return 'IE ' + (tem[1] || ''); 238 } 239 if (M[1] === 'Chrome') { 240 tem = ua.match(/\b(OPR|Edge)\/(\d+)/); 241 if (tem != null) return tem.slice(1).join(' ').replace('OPR', 'Opera'); 242 } 243 244 M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']; 245 246 if ((tem = ua.match(/version\/(\d+)/i)) != null) M.splice(1, 1, tem[1]); 247 return M.join(' '); 248 }, 249 250 transitionEnd: function () { 251 var el = document.createElement('div') //what the hack is bootstrap 252 var transEndEventNames = { 253 WebkitTransition: 'webkitTransitionEnd', 254 MozTransition: 'transitionend', 255 OTransition: 'oTransitionEnd otransitionend', 256 transition: 'transitionend' 257 } 258 for (var name in transEndEventNames) { 259 if (el.style[name] !== undefined) { 260 return transEndEventNames[name]; 261 } 262 } 263 return false // explicit for ie8 ( ._.) 264 }, 265 266 popupClose: function (popupId) { 267 var ifr = document.querySelector('#yt-video-player .popup-body iframe'); 268 if (ifr != null) ifr.parentNode.removeChild(ifr); 269 270 var popup = document.querySelector(popupId); 271 popup.style.display = 'none'; 272 273 // body 274 var b = document.body.className.split(' '); 275 if (b.indexOf('popup-open') != -1) { 276 b.splice(b.indexOf('popup-open'), 1); 277 } 278 document.body.className = b.join(' '); 279 }, 280 281 popupOpen: function (popupId) { 282 var popup = document.querySelector(popupId); 283 var arr = popup.className.split(' '); 284 285 // for close operation 286 popup.addEventListener('click', function (event) { 287 event.preventDefault(); 288 HOME.popupClose(popupId); 289 }) 290 291 // body 292 var b = document.body.className.split(' '); 293 if (b.indexOf('popup-open') == -1) { 294 b.push('popup-open'); 295 } 296 document.body.className = b.join(' '); 297 298 if (arr.indexOf('vm') != -1) { 299 popup.style.display = 'table'; 300 } else { 301 popup.style.display = 'block'; 302 } 303 }, 304 305 getChildren: function (n, skipMe) { 306 var r = []; 307 for (; n; n = n.nextSibling) 308 if (n.nodeType == 1 && n != skipMe) 309 r.push(n); 310 return r; 311 }, 312 313 getSiblings: function (n) { 314 return getChildren(n.parentNode.firstChild, n); 315 }, 316 317 animate: function (elem, style, unit, from, to, time, prop) { 318 if (!elem) { 319 return; 320 } 321 var start = new Date().getTime(), 322 timer = setInterval(function () { 323 var step = Math.min(1, (new Date().getTime() - start) / time); 324 if (prop) { 325 elem[style] = (from + step * (to - from)) + unit; 326 } else { 327 elem.style[style] = (from + step * (to - from)) + unit; 328 } 329 if (step === 1) { 330 clearInterval(timer); 331 } 332 }, 25); 333 if (prop) { 334 elem[style] = from + unit; 335 } else { 336 elem.style[style] = from + unit; 337 } 338 }, 339 340 getParameterByName: function (name, entairString) { 341 entairString = !entairString ? window.location.search : '?' + entairString; 342 var res = new RegExp('[\?&]' + name.replace(/\[/g, '\\\[').replace(/\]/g, '\\\]') + '(?:=([^&#]*))?(?:[&#]|$)').exec(entairString); 343 return res ? (res[1] ? decodeURIComponent(res[1].replace(/\+/g, ' ')) : '') : null; 344 }, 345 346 youtubeVideoPopup: function () { 347 // formate: <a href="http://www.youtube.com/watch?v=rjGWHJQkIYs" class="wp-tabs-video-block" target="_blank" data-yt-video-popup="1" data-yt-url=""> 348 var yt = document.querySelectorAll('[data-yt-video-player]').forEach(function (item, i) { 349 item.addEventListener('click', function (event) { 350 event.preventDefault(); 351 var ytUrl = this.getAttribute('href') || this.getAttribute('data-yt-url'); 352 var ytId = HOME.getParameterByName('v', ytUrl); 353 var ytSrc = "https://www.youtube.com/embed/" + ytId + "?autoplay=1&rel=0"; 354 355 var yti = document.createElement('iframe'); 356 yti.src = ytSrc; 357 yti.allowfullscreen = ''; 358 yti.width = 455; 359 yti.height = 256; 360 yti.style.borderWidth = 0; 361 362 // document.querySelector('#yt-video-player .popup-body').innerHTML = yti; 363 var ifr = document.querySelector('#yt-video-player .popup-body iframe'); 364 if (ifr != null) ifr.parentNode.removeChild(ifr); 365 document.querySelector('#yt-video-player .popup-body').appendChild(yti); 366 367 368 // ga 369 if (GA_FLAG) { 370 371 // for engaging videos 372 var gasss = item.getAttribute('data-ga-engaging-videos'); 373 if (gasss) { 374 ga('send', 'event', 'Engaging Video Links', 'video click', 'Engaging Video Link: ' + gasss); 375 } 376 377 } 378 379 }) 380 }) 381 }, 382 383 getParamValueByName: function (name, url) { 384 name = name.replace(/[\[\]]/g, '\\$&'); 385 var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), 386 results = regex.exec(url); 387 if (!results) return ''; 388 if (!results[2]) return ''; 389 return decodeURIComponent(results[2].replace(/\+/g, ' ')); 390 }, 391 392 UTMCarryForWord: function () { 393 // utm carryforword --------------------------------------------- 394 var utmReferer = document.referrer; 395 if (utmReferer) { 396 if ((utmReferer.indexOf('.byjus') == -1 || utmReferer.indexOf('.byjusweb') == -1) && HOME.getParamValueByName('utm_campaign', URL)) { 397 localStorage.setItem('UTM', URL); 398 } else if (HOME.getParamValueByName('utm_campaign', URL)) { 399 localStorage.setItem('UTM', URL); 400 } else if ((utmReferer.indexOf('.byjus') != -1 || utmReferer.indexOf('.byjusweb') == -1) && localStorage.getItem('UTM')) { 401 localStorage.setItem('UTM', localStorage.getItem('UTM')); 402 } else { 403 localStorage.setItem('UTM', ''); 404 } 405 } else { 406 if (HOME.getParamValueByName('utm_campaign', URL)) { 407 localStorage.setItem('UTM', URL); 408 } else { 409 localStorage.setItem('UTM', ''); 410 } 411 } 412 // end utm carryforword ----------------------------------------- 413 }, 414 415 studentUrlAttacher: function () { 416 document.querySelectorAll('[data-student-source-medium]').forEach(function (item) { 417 var sourceMedium = item.getAttribute('data-student-source-medium'); 418 var sourceMode = item.getAttribute('data-student-source-mode') ? item.getAttribute('data-student-source-mode') : null; 419 var sourceAuth = item.getAttribute('data-student-source-auth') ? item.getAttribute('data-student-source-auth') : 'oauth/authorize'; 420 var sourceSetAttr = item.getAttribute('data-student-set-to-attr') ? item.getAttribute('data-student-set-to-attr') : 'href'; 421 item.setAttribute(sourceSetAttr, HOME.studentUrlBuilder(sourceMedium, sourceMode, sourceAuth)); // setting student url 422 }); 423 }, 424 425 // to build studentUrl 426 studentUrlBuilder: function (sourceMedium, sourceMode, sourceAuth) { 427 var hostName = window.location.host; 428 var studentsAuthUrl = 'https://students' + (hostName !== 'byjus.com' ? '-staging' : '') + '.byjus.com/' + (sourceAuth ? sourceAuth : ''); //auth_url 429 430 var studentsCallBackUrl = 'https://learn' + (hostName !== 'byjus.com' ? '-staging' : '') + '.byjus.com/callback'; //callback_url 431 if (sourceMedium === 'homePageNewTopRegister') { 432 studentsCallBackUrl = 'https://learn' + ((hostName !== 'byjus.com') ? '-staging' : '') + '.byjus.com'; 433 } 434 435 var clientId = (hostName != 'byjus.com') ? '2979e85921c80d97050353a570107342ab6e87e1882f63a3a24286299ceb7020' : '1f267a0cb39bfe566e0218659508cb1949be4bdea023351a989a1b80b7d0c460'; //client_id 436 437 var referrer = document.referrer; 438 var url = window.location.href; 439 440 var referrerParams = '' + 441 'mx_Source_of_Lead=' + 'ByjusWeb' + '&' + 442 'mx_Campaign_Type=' + (HOME.getParamValueByName('utm_campaign', url) ? 'Paid' : 'Organic') + '&' + 443 'SourceMedium=' + sourceMedium + '&' + 444 'mx_Page_Category=' + 'byjusHome' + '&' + 445 'Website=' + window.location.origin + '&' + 446 'SourceIPAddress=' + '' + '&' + 447 'SourceReferrerURL=' + referrer + '&' + 448 'mx_ad_Id=' + HOME.getParamValueByName('ad_id', url) + '&' + 449 'mx_adset_id=' + HOME.getParamValueByName('adset_id', url) + '&' + 450 'mx_pid=' + HOME.getParamValueByName('pid', url) + '&' + 451 'mx_site_id=' + HOME.getParamValueByName('site_id', url) + '&' + 452 'SourceCampaign=' + HOME.getParamValueByName('utm_campaign', url) + '&' + 453 'mx_Source_Campaign_Id=' + HOME.getParamValueByName('utm_campaign_id', url) + '&' + 454 'mx_utm_Term=' + HOME.getParamValueByName('utm_Term', url) + '&' + 455 'SourceContent=' + HOME.getParamValueByName('utm_content', url); // to build referrer params 456 457 var referrerFinalParams = '' + 458 'referrer=' + referrerParams + '&' + 459 'utm_campaign=' + HOME.getParamValueByName('utm_campaign', url) + '&' + 460 'utm_source=' + 'ByjusWeb' + '&' + 461 'utm_medium=' + sourceMedium; // to build referrer final params 462 463 var finalParams = '' +
464 'redirect_uri=' + studentsCallBackUrl + '?' + referrerFinalParams + '&' + 465 'client_id=' + clientId + '&' + 466 'response_type=' + 'token' + '&' + 467 'scope=' + 'profile manage_doubts'; // to build final url params 468 469 return studentsAuthUrl + '?' + (sourceMode ? 'mode=' + sourceMode + '&' : '') + finalParams + '&' + referrerFinalParams; 470 }, 471 472 callAirtelAPI : function(api_url){ 473 jQuery.ajax({ 474 type: 'GET', 475 url: api_url, 476 contentType: false, 477 crossDomain: true, 478 cache: false, 479 processData: false, 480 success: function (data) { 481 if (data) { 482 // console.log("Success"); 483 } 484 }, 485 fail: function () { 486 // console.log("Failed"); 487 } 488 }); 489 }, 490 491 onPageLoadFunctions: function () { 492 HOME.onScrollEvent(); 493 494 HOME.carousel(); 495 496 HOME.youtubeVideoPopup(); 497 498 HOME.UTMCarryForWord(); 499 500 501 HOME.studentUrlAttacher(); // Students url attacher 502 503 var utmCampaign = HOME.getParamValueByName('utm_campaign',C_URL); 504 505 //This api will call only if utm_campaign is airtel 506 if (utmCampaign && utmCampaign == "airtel") { 507 HOME.callAirtelAPI(BASE_URL + 'wp-json/spidy/v1/airtel_api_landing/?wp-json_allow'); 508 } 509 510 // app store 511 document.querySelectorAll('[data-app-store]').forEach(function (appbtn, index) { 512 appbtn.addEventListener('click', function (event) { 513 event.preventDefault(); 514 var appName = appbtn.getAttribute('data-app-store'); 515 var redirectDesktopUrl = appbtn.getAttribute('href'); 516 var redirectMobileUrl = appbtn.getAttribute('data-m-href'); 517 GA_FLAG && ga('send', 'event', appName +' download app', 'Download app Button click', 'Download app Button type: ' + appName); 518 window.location.href = navigator.isMobileTablet ? redirectMobileUrl : redirectDesktopUrl; 519 }); 520 }); 521 522 // popup 523 document.querySelectorAll('[data-toggle="popup"]').forEach(function (pbtn, index) { 524 // event.preventDefault(); 525 pbtn.addEventListener('click', function (event) { 526 527 event.preventDefault(); 528 var popupId = pbtn.getAttribute('data-target'); 529 var popup = document.querySelector(popupId); 530 popup.addEventListener('click', function (event) { 531 event.preventDefault(); 532 HOME.popupClose(popupId); 533 }) 534 535 var popupInner = popup.querySelector('.popup-content'); 536 popupInner.addEventListener('click', function (event) { 537 event.stopPropagation(); 538 }); 539 540 // for menu slide 541 var sm = document.querySelector('#top-navbar-collapse'); 542 var sm_arr = sm.className.split(' '); 543 var sm_c_i = sm_arr.indexOf('animate'); 544 if (sm_c_i != -1) { 545 sm_arr.splice(sm_c_i, 1); 546 sm.className = sm_arr.join(' '); 547 } 548 549 HOME.popupOpen(popupId); 550 }) 551 }); 552 553 // next item 554 555 // scroll to ele 556 document.querySelectorAll('[data-scroll-to]').forEach(function (item, index) { 557 item.addEventListener('click', function (event) { 558 event.preventDefault(); 559 var targetEleId = item.getAttribute('href') 560 var toSec = document.querySelector(targetEleId); 561 var toSecOffset = toSec.offsetTop; 562 var offH = RAG_WIDTH > 767 ? 76 : 57; 563 toSecOffset = toSecOffset - offH; 564 var scrollingEle = Math.round(document.scrollingElement.scrollTop); 565 if (scrollingEle != toSecOffset) { 566 window.scrollTop = toSecOffset; 567 var wind = document.scrollingElement || document.documentElement; 568 wind.scrollTop = toSecOffset; 569 } 570 }); 571 }); 572 573 // for demo counselling popup 574 // popup 575 document.querySelectorAll('[free-counselling-popup]').forEach(function (pbtn, index) { 576 pbtn.addEventListener('click', function (event) { 577 var type = this.getAttribute('free-counselling-popup'); 578 var gfec = document.getElementById('gfec-items'); 579 var oldifr = document.querySelector('#gfec-items iframe'); 580 if (oldifr != null) oldifr.parentNode.removeChild(oldifr); 581 var srcUrl = (type === 'fc') ? HOME.studentUrlBuilder('homePageNewFreeconseling', 'popup', null) : HOME.studentUrlBuilder('homePageNewFreeDemo', 'popup', null); 582 var ifrm = document.createElement("iframe"); 583 ifrm.setAttribute("src", srcUrl); 584 ifrm.width = "360"; 585 ifrm.height = "352"; 586 ifrm.className = "iframe"; 587 ifrm.allow = 'geolocation'; 588 ifrm.setAttribute("frameborder", 0); 589 gfec.prepend(ifrm); 590 591 HOME.popupOpen('#get-free-expert-counselling-popup'); 592 GA_FLAG && ga("send", "event", "BTLA Register Form", "BTLA Register Form Click", "Get Free Expert Counselling Form"); 593 }); 594 }); 595 596 // ga 597 if (GA_FLAG) { 598 document.querySelectorAll('#primary-top-navbar a') && document.querySelectorAll('#primary-top-navbar a').forEach(function (item, index) { 599 ga('send', 'event', 'Top Bar', 'navigation link click', 'link name: ' + item.innerText); 600 }); 601 } 602 try { 603 document.querySelector('[data-ga-sharukan]').addEventListener("click", function () { 604 ga('send', 'event', 'Video 1', 'video 1 click', 'video 1: Sharukh khan, position: top banner'); 605 }); 606 } catch (error) { 607 // error 608 } 609 try { 610 var classes = ['testimonial-link'];
611 classes.forEach(function (ele) { 612 document.querySelectorAll('.' + ele).forEach(function (element, index) { 613 element.addEventListener('click', function () { 614 var link = element.getAttribute('detail-link'); 615 location.replace(link); 616 }); 617 }); 618 }); 619 } catch (error) { 620 // error 621 } 622 } 623 } 624 625 HOME.onPageLoadFunctions(); 626 arrowScrollHandler(); 627 animationAccordingIos(CDN+'byjusweb/img/landing-pages/btla-home/'); // if ios < 14 then put static image 628 629 //GA Event on BOOK FREE CLASS click on nav in Home page 630 if(jQuery("[data-book-free-class-nav-event]").length){ 631 jQuery("[data-book-free-class-nav-event]").click(function() { 632 GA_FLAG && ga("send", "event","Book Free Class Primary Nav Click","Book Free Class Primary Nav Link Click", "URL: " + C_URL); 633 }); 634 } 635 636 jQuery(function () { 637 jQuery('[data-toggle="popover"]').popover({ trigger: 'click'}); 638 }); 639 640 641 //open image as Popup modal on click of View a sample Progress Report btn 642 jQuery("[data-img-popup-btn]").click(function() { 643 if(!jQuery('#myModal').length) { 644 var htmlString = '<div id="myModal" class="sample-progress-report-modal fade">'+ 645 '<img class="lazy sample-progress-report-modal-content" id="popupImg" src="https://cdn1.byjus.com/byjusweb/img/landing-pages/btla-home/sample-progress-card-view.png">'+ 646 '<div id="sample-progress-report-modal-caption"></div>'+ 647 '</div>'; 648 jQuery('[data-progess-report-card]').after(htmlString); 649 jQuery('#myModal').modal('show'); 650 } else { 651 jQuery('#myModal').modal('show'); 652 } 653 654 // jQuery(document).on('click') 655 GA_FLAG && ga("send", "event","BTLA Home Page","BTLA_PReport Click", "BTLA_PReport click"); 656 }); 657 658 imageLoadOnScroll(); // load image on Scroll 659})(); 660 661function iOSversion() { 662 if (/iP(hone|od|ad)/.test(navigator.platform)) { 663 var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/); 664 return parseInt(v[1], 10); 665 } 666 } 667 668function animationAccordingIos(imagePath) { 669 var version = iOSversion(); 670 if(typeof iPhoneOsVersionSupported !== 'undefined' && version < iPhoneOsVersionSupported) { 671 jQuery('[lottie-replaced-mobile-img="engaging-video-lessons"]').attr("src", imagePath+'Engaging Video Lessons.png') 672 jQuery('[lottie-replaced-mobile-img="personalased-learning-journey"]').attr("src", imagePath+'Personalased Learning Journey.png') 673 jQuery('[lottie-replaced-mobile-img="adaptive-tools"]').attr("src", imagePath+'Adaptive tools.png') 674 jQuery('[lottie-replaced-mobile-img="unlimited-practice"]').attr("src", imagePath+'Unlimited Practice.png') 675 jQuery('[lottie-replaced-mobile-img="one-on-one-guidance"]').attr("src", imagePath+'One on One guidance.png') 676 jQuery('[lottie-replaced-mobile-img="comprehensive-study"]').attr("src", imagePath+'Comprehensive Study.png') 677 jQuery('[lottie-mobile]').removeClass('visible-xs').addClass('hidden'); 678 } 679} 680 681function arrowScrollHandler() { 682 // left and right arrow functionality 683 var buttonLeft = jQuery('[data-slide="prev"]'); 684 var buttonRight = jQuery('[data-slide="next"]'); 685 var latestNewsEle = jQuery('[data-horizontal-scroll-wrapper]'); 686 var cardsCount = latestNewsEle.children('div').length; 687 var slideCardsCount = 3; 688 var slideCardsCountTablet = 2; 689 if(IS_MOBILE) { 690 slideCardsCount = 1; 691 slideCardsCountTablet = 1; 692 } 693 694 var slideCount = Math.round(cardsCount / slideCardsCount); 695 var slideCountTablet = Math.round(cardsCount / slideCardsCountTablet); 696 var cardWidth = latestNewsEle.children('div').first().outerWidth(); 697 698 cardSpacing = 20; 699 slideCounter = 1; //slides counter 700 slideWidth = (cardWidth * slideCardsCount) + (cardSpacing * slideCardsCount); 701 slideWidthTablet = (cardWidth * slideCardsCountTablet) + (cardSpacing * slideCardsCountTablet); 702 703 if (!IS_WINDOW_BELLOW_992) { 704 buttonRight.on('click', onRight); 705 buttonLeft.on('click', onLeft); 706 } else { 707 buttonRight.on('click', onRightTablet); 708 buttonLeft.on('click', onLeftTablet); 709 } 710 buttonLeft.addClass("disable"); 711 buttonLeft.addClass('opacity-50'); 712 713 function onLeft() { 714 var scrollSize = 0; 715 if (slideCounter == slideCount) { //last slide 716 scrollSize = slideWidth; 717 } else { 718 scrollSize = slideCounter * slideWidth; 719 buttonLeft.addClass("disable"); 720 buttonLeft.addClass('opacity-50'); 721 } 722 latestNewsEle.animate({ 723 scrollLeft: '-=' + scrollSize 724 }, 0); 725 buttonRight.removeClass("disable"); 726 if(slideCounter>1 && slideCounter<7) { 727 slideCounter--; 728 } 729 } 730 731 function onRight() { 732 if(slideCounter >0 && slideCounter<3) { 733 slideCounter++; 734 } 735 var scrollSize = 0; 736 if (slideCounter == slideCount) { //last slide 737 scrollSize = slideCounter * slideWidth; 738 buttonRight.addClass("disable"); 739 } else { 740 scrollSize = slideWidth; 741 } 742 latestNewsEle.animate({ 743 scrollLeft: '+=' + scrollSize 744 }, 0); 745 buttonLeft.removeClass("disable"); 746 } 747 748 function onLeftTablet() { 749 var scrollSize = 0; 750 if(slideCounter>1 && slideCounter<5) { 751 slideCounter--; 752 } 753 scrollSize = slideWidthTablet;
754 if (slideCounter == slideCardsCountTablet - 1) { //last slide 755 buttonLeft.addClass("disable"); 756 buttonLeft.addClass('opacity-50'); 757 } 758 latestNewsEle.animate({ 759 scrollLeft: '-=' + scrollSize 760 }, 0); 761 buttonRight.removeClass("disable"); 762 buttonRight.attr("src", 'https://cdn1.byjus.com/home/right-angle.svg'); 763 } 764 765 function onRightTablet() { 766 if(slideCounter >0 && slideCounter<4) { 767 slideCounter++; 768 } 769 var scrollSize = 0; 770 scrollSize = slideWidthTablet; 771 if (slideCounter == slideCountTablet) { //last slide 772 buttonRight.addClass("disable"); 773 } 774 latestNewsEle.animate({ 775 scrollLeft: '+=' + scrollSize 776 }, 0); 777 buttonLeft.removeClass("disable"); 778 } 779 780 jQuery('[data-horizontal-scroll-wrapper]').scroll(function (event) { 781 var latestNewsEle = jQuery('[data-horizontal-scroll-wrapper]'); 782 var newsScrollWidth = latestNewsEle.prop('scrollWidth'); 783 var newsOuterWidth = latestNewsEle.outerWidth(); 784 if(latestNewsEle.scrollLeft()) { 785 buttonLeft.removeClass("disable"); 786 buttonRight.removeClass("disable"); 787 buttonLeft.attr("src", 'https://cdn1.byjus.com/home/right-angle.svg'); 788 buttonRight.attr("src", 'https://cdn1.byjus.com/home/right-angle.svg'); 789 } 790 791 if (Math.trunc(latestNewsEle.scrollLeft()) === newsScrollWidth-newsOuterWidth) { 792 buttonRight.addClass("disable"); 793 buttonRight.addClass('opacity-50'); 794 } else if (latestNewsEle.scrollLeft() === 0) { 795 buttonLeft.addClass("disable"); 796 buttonLeft.addClass('opacity-50'); 797 } 798 }); 799 } 800 801 function imageLoadOnScroll() { 802 jQuery(window).on('scroll', function(event) { 803 jQuery('body').find("img.on-scroll").each(function () { 804 var imageSelector = jQuery(this); 805 imageSelector.attr("src", imageSelector.attr("data-src")).removeAttr("data-src").removeClass("on-scroll"); 806 }); 807 }); 808 } 809 810/* Home page banner Banner interval */ 811jQuery(document).ready(function () { 812 var bannerHome = jQuery('.home-page-banner-change'); 813 if(bannerHome && bannerHome.length > 1) { 814 var bannerHomeDefault = 0; 815 setInterval(function () { 816 var bannerBlockEq = bannerHome.eq(bannerHomeDefault); 817 if(bannerBlockEq.hasClass('active')){ 818 bannerHomeDefault++; 819 } 820 bannerHome.removeClass('active').eq(bannerHomeDefault).addClass('active'); 821 bannerHomeDefault++; 822 if (bannerHomeDefault >= bannerHome.length ) { 823 bannerHomeDefault = 0; 824 } 825 }, 5000); 826 } 827});
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.