1(function ($, Drupal, window, document, drupalSettings) { 2 Drupal.behaviors.lazy_load = { 3 attach: function (context, settings) { 4 statesInfo = drupalSettings.statesInfo; 5 var selectStateFromMap; 6 var SelectedState; 7 let $description; 8 $description = jQuery(".description"); 9 // getStateName("Andhra Pradesh"); 10 // getStateLogo("Andhra Pradesh"); 11 12 var shiftPositionObject = { 13 'IN-GA': { 14 x: 1, 15 y: 30 16 }, 17 'IN-MN': { 18 x: -5, 19 y: 30 20 }, 21 'IN-NL': { 22 x: -5, 23 y: 30 24 }, 25 'IN-AS': { 26 x: -5, 27 y: 18 28 }, 29 'IN-ML': { 30 x: 1, 31 y: 25 32 }, 33 'IN-MZ': { 34 x: 1, 35 y: 25 36 }, 37 'IN-TR': { 38 x: 1, 39 y: 30 40 }, 41 'IN-SK': { 42 x: 1, 43 y: 30 44 }, 45 'IN-AR': { 46 x: -5, 47 y: 20 48 }, 49 'IN-WB': { 50 x: 1, 51 y: -25 52 }, 53 'IN-BR': { 54 x: 1, 55 y: 10 56 }, 57 'IN-JH': { 58 x: 8, 59 y: 10 60 }, 61 'IN-AP': { 62 x: 20, 63 y: -20 64 }, 65 'IN-KL': { 66 x: 1, 67 y: 10 68 }, 69 'IN-KA': { 70 x: 1, 71 y: -25 72 }, 73 'IN-MH': { 74 x: 15, 75 y: 5 76 }, 77 'IN-MP': { 78 x: 5, 79 y: -15 80 }, 81 'IN-HR': { 82 x: 1, 83 y: 15 84 }, 85 'IN-UT': { 86 x: 1, 87 y: 15 88 }, 89 'IN-PB': { 90 x: 1, 91 y: 10 92 }, 93 'IN-HP': { 94 x: 1, 95 y: 15 96 }, 97 'IN-JK': { 98 x: 10, 99 y: 20 100 }, 101 'IN-LAD': { 102 x: -13, 103 y: -1 104 }, 105 'IN-UP': { 106 x: 5, 107 y: -5 108 }, 109 'IN-TG': { 110 x: 5, 111 y: 10 112 }, 113 'IN-DL': { 114 x: 1, 115 y: 32 116 }, 117 'IN-LD': { 118 x: 8, 119 y: 30 120 } 121 }; 122 123 jQuery('.enabled').hover(function () { 124 stopAutoAnim(); 125 $description.addClass('active'); 126 $description.html(jQuery(this).attr('title')); 127 }, function () { 128 var listOfPaths = jQuery('.enabled'); 129 listOfPaths.map(function (currentPath) { 130 if (jQuery(listOfPaths[currentPath]).hasClass('selected')) { 131 $description.html(jQuery(this).attr('title')); 132 mouseEneter(listOfPaths[currentPath]); 133 } 134 }) 135 }); 136 137 jQuery('.enabled').click(clickedAnimation); 138 139 jQuery('.india-map-details').on('mouseenter', function (e) { 140 stopAutoAnim(); 141 }); 142 143 jQuery('.india-map').on('mouseenter', function (e) { 144 stopAutoAnim(); 145 }); 146 147 jQuery('.state .left_side .state_box').on('mouseenter', function (e) { 148 stopAutoAnim(); 149 }); 150 151 jQuery('.state .left_side').on('mouseleave', function (e) { 152 startAutoAnim(); 153 }); 154 jQuery('.india-map').on('mouseleave', function (e) { 155 startAutoAnim(); 156 }); 157 158 jQuery('.enabled').on('mouseenter', function (e) { 159 mouseEneter(e); 160 }); 161 162 jQuery('.india-map').on('mouseleave', function (e) { 163 var _autoAnim = setTimeout(function () { 164 clearTimeout(_autoAnim); 165 }, 0); 166 }); 167 168 var autoStart = null; 169 var index = 0; 170 171 function stopAutoAnim() { 172 autoStart && clearInterval(autoStart); 173 } 174 175 function startAutoAnim() { 176 stopAutoAnim(); 177 autoStart = setInterval(function () { 178 var listOfStates = ['IN-AN', 'IN-AP', 'IN-AR', 'IN-AS', 'IN-BR', 'IN-CH', 'IN-CT', 'IN-DD', 'IN-DL','IN-DN', 'IN-GA', 'IN-GJ', 'IN-HR', 'IN-HP', 'IN-JK', 'IN-JH', 'IN-KA', 'IN-KL', 'IN-LAD', 'IN-MP', 'IN-MH', 'IN-MN', 'IN-ML', 'IN-MZ', 'IN-NL', 'IN-OR', 'IN-PB', 'IN-PY', 'IN-RJ', 'IN-SK', 'IN-TN', 'IN-TG', 'IN-TR', 'IN-UP', 'IN-UT', 'IN-UP', 'IN-WB']; 179 var listOfPaths = jQuery('.enabled'); 180 listOfPaths.map(function (currentPath) { 181 if (jQuery(listOfPaths[currentPath]).attr('id') === listOfStates[index]) { 182 jQuery(listOfPaths[currentPath]).trigger('click'); 183 $description.addClass('active'); 184 $description.html(jQuery(this).attr('title')); 185 mouseEneter(listOfPaths[currentPath]); 186 } 187 }); 188 index++; 189 if (index >= listOfStates.length) { 190 index = 0; 191 } 192 }, 5000); 193 } 194 195 // startAutoAnim(); 196 197 function clickedAnimation() { 198 jQuery('.IN-LD').find('.enabled').prev().removeClass('makeVisible'); 199 jQuery('.IN-LD').find('.enabled').removeClass('selected'); 200 jQuery(this).addClass('selected'); 201 jQuery('.enabled.dis').removeClass('selected'); 202 jQuery(this).prev().addClass('makeVisible'); 203 jQuery(this).parent().siblings().find('.enabled').prev().removeClass('makeVisible'); 204 jQuery(this).parent().siblings().find('.enabled').removeClass('selected'); 205 selectStateFromMap = jQuery(this).attr('title'); 206 var parent = document.querySelector('#selectState'); 207 var child1 = parent.querySelector('.selectBox-label'); 208 let obj = statesInfo.find(o => o.title.includes(selectStateFromMap)); 209 if (!obj) { 210 jQuery(this).addClass("dis"); 211 } 212 if (!jQuery(this).hasClass("dis")) { 213 child1.innerText = selectStateFromMap; 214 } 215 else { 216 jQuery(".description.active").text("Coming Soon"); 217 } 218 219 jQuery('.state-name').html(selectStateFromMap); 220 if (jQuery(this).attr('id') != 'IN-LD') { 221 jQuery(this).parent().appendTo('#map-parent'); 222 } 223 if (!jQuery(this).hasClass("dis")) { 224 if(["IN-DN" , "IN-DD"].includes(jQuery(this).attr('id'))) { 225 selectStateFromMap = "Dadra and Nagar Haveli and Daman and Diu" 226 } 227 getStateName(selectStateFromMap); 228 getStateLogo(selectStateFromMap); 229 } 230 } 231 232 function mouseEneter(e) { 233 var id = (e.hasOwnProperty('currentTarget') && e.currentTarget.id) || jQuery(e).attr('id'); 234 var idElem = document.getElementById(id); 235 var clientReact = idElem.getBoundingClientRect(); 236 var description = document.querySelector('.description'); 237 var descPosition = description.getBoundingClientRect(); 238 var isSmallState = shiftPositionObject[id] || 0; 239 if(id === "IN-DN"){ 240 jQuery(description).css({ 241 left: "881px", 242 top: "1921px", 243 }); 244 } 245 else if (id === "IN-DD") { 246 jQuery(description).css({ 247 left: "861px", 248 top: "1901px" 249 }); 250 } 251 else { 252 jQuery(description).css({ 253 left: clientReact.x + clientReact.width / 2 - descPosition.width / 2 - ((isSmallState && isSmallState.x) || isSmallState), 254 top: document.documentElement.scrollTop + (clientReact.y - 110) - ((isSmallState && isSmallState.y) || isSmallState) 255 }); 256 } 257 258 } 259 260 261 // Post API to get state id by passing state name. 262 function getStateName(stateName) { 263 SelectedState = stateName; 264 jQuery.ajax({ 265 url: "/gateway/form-builder/state/fetch-by-name", 266 type: "POST", 267 data: JSON.stringify({ 268 'name': stateName, 269 }), 270 dataType: "json", 271 contentType: "application/json", 272 success: function (response) { 273 if (response.data != null) { 274 getStateApprovals(response.data.id); 275 } 276 }, 277 error: function (err) { 278 console.log(err); 279 } 280 }); 281 } 282 283 // // Post API to get state specific approvals by passing state id. 284 function getStateApprovals(stateId) { 285 jQuery.ajax({ 286 url: "/gateway/form-builder/marketplace/state-license-summary-list", 287 type: "POST", 288 data: JSON.stringify({ 289 "start": 0, 290 "length": 20, 291 "searchTag": "", 292 "filters": 293 { 294 "state_id": [stateId], 295 "authority_id": [] 296 } 297 }), 298 dataType: "json", 299 contentType: "application/json", 300 success: function (response) { 301 var approvalBox = ""; 302 303 jQuery.each(response.data, function (key, valueObj) { 304 var approvalUrlLink = "portal/approval-details"; 305 if (valueObj.stateUrlTitle) { 306 approvalUrlLink += "/" + valueObj.stateUrlTitle; 307 } 308 if (valueObj.authorityUrlTitle) { 309 approvalUrlLink += "/" + valueObj.authorityUrlTitle; 310 } 311 if (valueObj.urlTitle) { 312 approvalUrlLink += "/" + valueObj.urlTitle; 313 } 314 approvalBox += ` 315 <div class="state_single"> 316 <h3>${valueObj.authorityName}</h3> 317 <h4 class="show-read-more">${valueObj.licenseName}</h4> 318 <div class="stateHover"> 319 <h3 class="pb5">${valueObj.authorityName}</h3> 320 <a href=" ${approvalUrlLink} " data-id=${valueObj.licenseId}> 321 <div class="h4outer"> 322 <h4>${valueObj.licenseName}</h4> 323 </div> 324 </a> 325 <div class="button-group"> 326 <a class="button" data-id=${valueObj.licenseId}>Add to Dashboard</a> 327 </div> 328 </div> 329 </div>`; 330 }); 331 332 // Data upto 3 line 333 jQuery(document).ajaxComplete(function () { 334 jQuery(".state_single h4").text(function (index, currentText) { 335 var maxLength = 85; 336 if (currentText.length >= maxLength) { 337 return currentText.substring(0, maxLength) + "..."; 338 } else { 339 return currentText 340 } 341 }); 342 }); 343 344 // Get state most popular approval count 345 var approvalsAndAuthorities = document.getElementsByClassName('state-count'); 346 var stateRedirect; 347 var searchIndex = statesInfo.findIndex((stateData) => stateData.title == SelectedState); 348 jQuery(".selectBox-dropdown-menu .stateList:first-child a").attr("href", statesInfo[0]['urlAlias']); 349 stateRedirect = statesInfo[searchIndex]['urlAlias']; 350 approvalsAndAuthorities[0].innerHTML = response.count + ' ' + 'Approvals'; 351 approvalsAndAuthorities[1].innerHTML = `<a href="${stateRedirect}"> View All ${response.count} Approvals</a>`; 352 if (jQuery('#state').hasClass('slick-initialized')) { 353 jQuery('#state').slick('unslick'); 354 } 355 jQuery("#state").html(approvalBox); 356 if (approvalBox.length) { 357 getSlick(); 358 jQuery('.slick-slider').slick('setPosition'); 359 } 360 }, 361 error: function (err) { 362 console.log(err); 363 }, 364 }); 365 } 366 jQuery(document).ajaxComplete(function () { 367 jQuery('.stateHover .h4outer h4').hover(function () { 368 jQuery(this).first().once().append('<div class="exploreLinkBtn"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 58.665 58.652"> <path id="Shape_9_copy_5" data-name="Shape 9 copy 5" class="cls-1" d="M1495.2,5545.758l-.3-.266a1.007,1.007,0,0,1,.047-1.544l2.142-1.681a1.007,1.007,0,0,1,1.281.029l.209.181a24.616,24.616,0,1,0-8.427-20.973h25.783l-9.338-7.328a1.006,1.006,0,0,1-.17-1.412l1.657-2.11a1.006,1.006,0,0,1,1.413-.17l15.654,12.285a1.375,1.375,0,0,1,0,2.165l-15.654,12.285a1.007,1.007,0,0,1-1.413-.171l-1.657-2.108a1.008,1.008,0,0,1,.17-1.414l9.336-7.326h-30.564a.029.029,0,0,1-.029-.029v-1.747c0-17.061,13.967-30.812,31-29.851a29.326,29.326,0,1,1-21.146,51.185Z"transform="translate(-1485.338 -5494.526)"/></svg> </div>'); 369 }, function () { 370 jQuery(this).first().once().children('.exploreLinkBtn').remove(); 371 }); 372 }); 373 374 // Get API to get state specific logo. 375 function getStateLogo(stateName) { 376 jQuery.ajax({ 377 url: "/api/get-state-logo/" + stateName, 378 type: "GET", 379 success: function (response) { 380 if (response.length) { 381 jQuery('.state-logo').html('<img src= "' + response[0].Image + '" width="80" height="80" alt="state-logo"/>'); 382 } 383 }, 384 error: function (err) { 385 console.log(err); 386 }, 387 }); 388 } 389 390 // Slick initialised for state approvals. 391 function getSlick() { 392 jQuery('#state').slick({ 393 infinite: false, 394 slidesToShow: 2, 395 slidesToScroll: 1, 396 rows: 2, 397 responsive: [ 398 { 399 breakpoint: 991, 400 settings: { 401 slidesToShow: 2, 402 } 403 }, 404 { 405 breakpoint: 767, 406 settings: "unslick", 407 } 408 ] 409 }); 410 } 411 412 jQuery('#mySelect').on('change', function () { 413 var link = jQuery(this).val(); 414 localStorage.setItem('stateLink', link); 415 getStateName(this.value); 416 selectStateFromMap = this.value; 417 jQuery(this).addClass('selected'); 418 var searchIndex = statesInfo.findIndex((stateData) => stateData.value == SelectedState); 419 window.location = statesInfo[searchIndex]['urlAlias']; 420 }); 421 422 if ('IntersectionObserver' in window) { 423 // IntersectionObserver initialization code 424 const mapBlock = document.querySelectorAll("#block-stateapprovalsmap"); 425 const blockOptions = { 426 root: null, 427 threshold: 0.5 428 }; 429 const mapObserver = new IntersectionObserver((entries, mapObserver) => {
430 entries.forEach(entry => { 431 if (!entry.isIntersecting) { 432 return; 433 } 434 else { 435 getStateName(statesInfo[0]['title']); 436 getStateLogo(statesInfo[0]['title']); 437 startAutoAnim(); 438 mapObserver.unobserve(entry.target); 439 } 440 }) 441 }, blockOptions) 442 mapBlock.forEach(image => { 443 var b = mapObserver.observe(image); 444 }) 445 446 } else { 447 // make lazy loading elements to be loaded right away 448 getStateName(statesInfo[0]['title']); 449 getStateLogo(statesInfo[0]['title']); 450 startAutoAnim(); 451 } 452 453 } 454 } 455})(jQuery, Drupal, this, this.document, drupalSettings); 456 457 458
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.