1var site = null 2var activeContentsIds = null 3 4var platforms = [] 5var platformsForRegistration = [] 6 7$(function() { 8 if (site.path === "tuamc" && site.locale === 'pt-PT') { 9 $('link[rel="shortcut icon"]').attr("href","/static/img/tuamc/favicon_pt.ico"); 10 } 11 12 // console.log('Initialize') 13 const containers = document.getElementsByClassName('contentsContainer') 14 Array.prototype.forEach.call(containers, function(container) { 15 container.addEventListener("scroll", containerScroll); 16 containerScroll({target: container}) 17 }) 18 19 var returnPath = encodeURIComponent(window.location.pathname || '/') 20 $(".videoLink").each(function() { 21 var $this = $(this); 22 var _href = $this.attr("href"); 23 $this.attr("href", _href + "?bp="+returnPath); 24 }); 25 26 // Auth 27 initializeAuth() 28 29 // load channels 30 loadChannels() 31 32 // load active contents 33 loadActiveContents() 34 35 // load platforms 36 getPlatforms().then(() => { 37 document.dispatchEvent(new Event('platformsReady'))}) 38 39 // OJO !! Se inicializa en inea 77 ?? 40 passTypes = { '1': 'Estreno', '2': 'Destacado', '3': 'Ãltimo pase' } 41 if (site && site.lang=='pt') { 42 passTypes = { '1': 'Estreia', '2': 'Destacado', '3': 'Ãltimo pase' } 43 } 44 45}) 46 47function getCanal(canal) { 48 // Map channels 49 const channelMap = { 50 'El Gourmet' : 'Canal Cocina', 51 'Historia y Actualidad' : 'Historia', 52 'Planet Horror' : 'DARK' 53 } 54 return channelMap[canal] || canal; 55} 56 57function getPlatforms() { 58 return new Promise((resolve, reject) => { 59 const query = new Parse.Query(Parse.Object.extend("Platform")) 60 query.equalTo('active', true) 61 query.notContainedIn('externalId', ['12714', '12526', '12803','12533']) 62 query.ascending('order') 63 query.find().then((items) => { 64 platforms = items 65 resolve(items) 66 }, (error) => { 67 console.log('Error retriving platforms: ', error) 68 reject(error) 69 }); 70 }) 71} 72 73function getPlatformsForRegistration() { 74 return new Promise((resolve, reject) => { 75 const query = new Parse.Query(Parse.Object.extend("Platform")) 76 query.equalTo('displayOnRegistrationForm', true) 77 query.ascending('order') 78 // displayOnDetailsPage 79 query.find().then((items) => { 80 platformsForRegistration = items 81 resolve(items) 82 }, (error) => { 83 console.log('Error retriving platforms: ', error) 84 reject(error) 85 }); 86 }) 87} 88 89var passTypes = { '1': 'Estreno', '2': 'Destacado', '3': 'Ãltimo pase' } 90if (site && site.lang=='pt') { 91 passTypes = { '1': 'Estreia', '2': 'Destacado', '3': 'Ãltimo pase' } 92} 93 94function toggleClass(identifier, className) { 95 $(identifier).toggleClass(className) 96} 97 98function closeDialesMenu() { 99 $('.dialesMenu').removeClass('display-diales-menu'); 100 $('#dialesOverlay').remove(); 101} 102 103function toggleDialesMenu(identifier, className) { 104 const isOpen = $(identifier).hasClass(className); 105 106 if (isOpen) { 107 // Close menu 108 $(identifier).removeClass(className); 109 $('#dialesOverlay').remove(); 110 } else { 111 // Open menu 112 $(identifier).addClass(className); 113 114 // Create transparent overlay to catch all outside clicks 115 if ($('#dialesOverlay').length === 0) { 116 const overlay = $('<div id="dialesOverlay"></div>').css({ 117 position: 'fixed', 118 top: 0, 119 left: 0, 120 right: 0, 121 bottom: 0, 122 zIndex: 15, // Below menu (z-index 20) but above rest of page 123 background: 'transparent' 124 }); 125 126 overlay.on('click touchstart', function(e) { 127 e.stopPropagation(); 128 closeDialesMenu(); 129 }); 130 131 $('body').append(overlay); 132 } 133 } 134} 135 136function closeCanalesMenu() { 137 $('.canalesMenu').removeClass('display-canales-menu'); 138 $('#canalesOverlay').remove(); 139} 140 141function toggleCanalesMenu(identifier, className) { 142 const isOpen = $(identifier).hasClass(className); 143 144 if (isOpen) { 145 // Close menu 146 $(identifier).removeClass(className); 147 $('#canalesOverlay').remove(); 148 } else { 149 // Open menu 150 $(identifier).addClass(className); 151 152 // Create transparent overlay to catch all outside clicks 153 if ($('#canalesOverlay').length === 0) {
154 const overlay = $('<div id="canalesOverlay"></div>').css({ 155 position: 'fixed', 156 top: 0, 157 left: 0, 158 right: 0, 159 bottom: 0, 160 zIndex: 15, // Below menu (z-index 20) but above rest of page 161 background: 'transparent' 162 }); 163 164 overlay.on('click touchstart', function(e) { 165 e.stopPropagation(); 166 closeDialesMenu(); 167 }); 168 169 $('body').append(overlay); 170 } 171 } 172 173 // Smooth scroll to diales menu on mobile when opening 174 if (window.innerWidth <= 768 && $(identifier).hasClass(className)) { 175 setTimeout(() => { 176 const dialesElement = $(identifier).closest('li.sub')[0]; // Get the parent li element 177 const innerMenu = $('.innerMenu.display-menu')[0]; 178 179 if (dialesElement && innerMenu) { 180 // Scroll so the diales section is at the top of the mobile menu 181 // This will hide previous menu items (AMC Club, Blog, Destacados, Guia TV) 182 innerMenu.scrollTo({ 183 top: dialesElement.offsetTop, 184 behavior: 'smooth' 185 }); 186 } 187 }, 100); // Small delay to ensure the menu has expanded 188 } 189} 190 191function toggleHidden(identifier) { 192 $(identifier).toggleClass('hidden') 193} 194 195function toggleMenu() { 196 $('.innerMenu').toggleClass('display-menu') 197 $('#btnCloseMenu').toggleClass('hidden') 198} 199 200function goBack() { 201 history.back() 202} 203 204function showModal(element, callback) { 205 $(element).removeClass('hidden') 206 $(element+' .modal-bg').css('opacity', "0") 207 setTimeout(() => { 208 $(element+' .modal-bg').animate({ 209 opacity: 1 210 }, 300) 211 }, 10); 212 $(element+' .modal-card').animate({ 213 top: '+=100', 214 }, 10, function () { 215 $(element+' .modal-card').animate({ 216 top: '-=100', 217 opacity: 1 218 }, 300, function () { 219 if (callback) { callback() } 220 setTimeout(() => { 221 $(element+' .modal-card').removeAttr('style') 222 }, 300); 223 }) 224 }) 225} 226 227function hideModal(element, callback) { 228 $(element+' .modal-bg').css('opacity', "1") 229 $(element+' .modal-bg').animate({ 230 opacity: 0 231 }, 300) 232 $(element+' .modal-card').animate({ 233 top: '+=100', 234 }, 300, function () { 235 $(element).addClass('hidden') 236 if (callback) { callback() } 237 setTimeout(() => { 238 $(element+' .modal-card').removeAttr('style') 239 }, 300); 240 }) 241} 242 243function containerScroll(event) { 244 if (!event.target.getElementsByClassName('content') || event.target.getElementsByClassName('content').length == 0) { return } 245 var gap = event.target.getElementsByClassName('content')[0].clientWidth 246 247 const left = event.target.scrollLeft 248 const right = event.target.scrollWidth - event.target.clientWidth - left 249 250 const le = event.target.parentNode.getElementsByClassName('leftBlur')[0] 251 const re = event.target.parentNode.getElementsByClassName('rightBlur')[0] 252 253 left <= 0 ? le.classList.add("offset-0") : le.classList.remove("offset-0") 254 right <= 0 ? re.classList.add("offset-0") : re.classList.remove("offset-0") 255 256 left < gap ? le.classList.add("offset-pre-gap") : le.classList.remove("offset-pre-gap") 257 right < gap ? re.classList.add("offset-pre-gap") : re.classList.remove("offset-pre-gap") 258} 259 260function leftPressed(event) { 261 const containerParent = event.parentNode.parentNode 262 const offset = containerParent.clientWidth / 2 263 264 const contents = containerParent.getElementsByClassName('contentsContainer')[0] 265 266 var sl = contents.scrollLeft - offset 267 if (sl < 0) { sl = 0 } 268 contents.scrollLeft = sl 269} 270 271function rightPressed(event) { 272 const containerParent = event.parentNode.parentNode 273 const offset = containerParent.clientWidth / 2 274 275 const contents = containerParent.getElementsByClassName('contentsContainer')[0] 276 277 var sl = contents.scrollLeft + offset 278 const right = contents.scrollWidth - contents.clientWidth - sl 279 if (right < 0) { sl += right } 280 contents.scrollLeft = sl 281} 282 283function contentSelected(slug, type) { 284 console.log('contentSelected: ', slug, type) 285 var url = '/' 286 if (type === 'film') { 287 url += 'peliculas/' + slug 288 } else if (type === 'show') { 289 url += 'series/' + slug 290 } else if (type === 'episode') { 291 url += 'episodios/' + slug 292 } 293 window.open(url, "_self") 294} 295 296async function loadChannels() { 297 const channels = await getChannels() 298 .catch((err) => { 299 console.log('error loading channels: ', err) 300 return 301 }) 302 303 // load footer 304 var html = ''
305 channels.forEach((item) => { 306 if (item.get('displayInHeader')) { 307 html += `<li class="subMenuItem px-4"> 308 <a class="flex" href="${item.get('url')}" title="${item.get('name')}"> 309 <div class="flex items-center"> 310 <img class="self-center" alt="${item.get('name')}" src="${item.get('logo') ? item.get('logo').url() : ''}" /> 311 </div> 312 </a> 313 </li>` 314 } 315 }); 316 $('#footerChannels').html(html) 317 $('#headerChannels').html(html) 318 319 // load header 320 html = '' 321 channels.forEach((item) => { 322 if (item.get('displayInHeader')) { 323 html += ` 324 <li class="subMenuItem flex p-4"> 325 <a class="flex" href="${item.get('url')}" title="${item.get('name')}"> 326 <div class="flex items-center"> 327 <img class="self-center" alt="${item.get('name')}" src="${item.get('logo') ? item.get('logo').url() : ''}" /> 328 </div> 329 </a> 330 </li>` 331 } 332 }); 333 $('#menuChannels').html(html) 334 335 // load streaming 336 html = '' 337 channels.forEach((item) => { 338 if (item.get('displayInStreaming')) { 339 html += ` 340 <li class="subMenuItem flex p-4"> 341 <a class="flex" href="${item.get('url')}" title="${item.get('name')}"> 342 <div class="flex items-center"> 343 <img class="self-center" alt="${item.get('name')}" src="${item.get('logo') ? item.get('logo').url() : ''}" /> 344 </div> 345 </a> 346 </li>` 347 } 348 }); 349 $('#streamingChannels').html(html) 350} 351 352function getChannels() { 353 return new Promise((resolve, reject) => { 354 const query = new Parse.Query(Parse.Object.extend("Channel")) 355 query.equalTo('active', true) 356 query.ascending('order') 357 query.find().then((items) => { 358 resolve(items) 359 }, (error) => { 360 reject(error) 361 }) 362 }) 363} 364 365async function loadActiveContents() { 366 const query = new Parse.Query(Parse.Object.extend('SitesActiveContents')) 367 query.equalTo('site', site.pointer) 368 const activeContents = await query.first() 369 if (activeContents) { 370 activeContentsIds = activeContents.get('contents') 371 } 372} 373 374window.onscroll = function() { 375 const headerHeight = 84 376 const el = document.getElementById('menu') 377 window.scrollY > headerHeight ? el.classList.add("navBarOnScroll") : el.classList.remove("navBarOnScroll") 378 379 // Guide 380 const dateSelector = 220 381 const guideEl = document.getElementById('activeDay') 382 if (guideEl) { 383 window.scrollY > dateSelector ? guideEl.classList.add("activeDayOnScroll") : guideEl.classList.remove("activeDayOnScroll") 384 } 385}; 386 387var getUrlParameter = function getUrlParameter(sParam) { 388 var sPageURL = window.location.search.substring(1), 389 sURLVariables = sPageURL.split('&'), 390 sParameterName, 391 i; 392 393 for (i = 0; i < sURLVariables.length; i++) { 394 sParameterName = sURLVariables[i].split('='); 395 396 if (sParameterName[0] === sParam) { 397 return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); 398 } 399 } 400 return false; 401};
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.