1// AUDIO FADER 2 var audioElements = document.querySelectorAll("audio"), i, // get all audio elements 3 audioWrappers = []; // holds our wrapper object 4 // bind common handler for each audio element in page: 5 for(i = 0; i < audioElements.length; i++) { 6 audioWrappers.push(new AudioFader(audioElements[i])); // create wrapper 7 audioElements[i].addEventListener("play", playHandler); // add handler 8 } 9 // common handler for play 10 function playHandler() { 11 if(!$.cookie("emailAlerta")) { 12 abrirAlerta(); 13 } 14 // this = element triggering the even - fade-out all others but ours 15 for(var i = 0, w; w = audioWrappers[i]; i++) { 16 if (this !== w.audio) { 17 w.fadeOut(500, 1) 18 } else { 19 if($('[controleAlerta]').attr('controleAlerta') == 1) { 20 w.fadeOut(100, 1); 21 } else { 22 w.fadeIn(500, 1); 23 } 24 } 25 } 26 } 27 // wrapper 28 function AudioFader(audio) { 29 var isPausing = false; 30 this.audio = audio; // expose so we can compare 31 this.fadeIn = function(time, dst) { // fade-in (time in ms, dst volume) 32 isPausing = false; 33 audio.play(); // play
34 if (audio.volume === dst) return; // hasn't been faded-out 35 var startTime = Date.now(); // start-time 36 (function loop() { 37 var t = (Date.now() - startTime) / time; // normalize t [0, 1] 38 audio.volume = Math.min(1, t) * dst; // set volume, max 1 39 if (!isPausing && t < dst) // loop if t to go and not pausing 40 requestAnimationFrame(loop); 41 })(); 42 }; 43 this.fadeOut = function(time, src) { // fade-out (time in ms, src volume) 44 isPausing = true; 45 if (audio.paused) return; // exit if already paused 46 audio.volume = src; // start with src volume 47 var startTime = Date.now(); 48 (function loop() { 49 var t = (Date.now() - startTime) / time; 50 audio.volume = Math.max(0, 1 - t) * src; // t is 0..1, so reverse 1-t 51 if (isPausing && t < 1) requestAnimationFrame(loop); 52 else { 53 audio.pause(); // eventually pause 54 audio.volume = 0; // mute volume 55 } 56 })(); 57 }; 58 } 59 60// MODAL INSCRIÃÃO 61 function abrirAlerta() { 62 if($('[controleAlerta]').attr('controleAlerta') == 1) { 63 $('#modalAudioAlerta').modal('show'); 64 return false; 65 } else { 66 console.log("controleAlerta = 0"); 67 } 68 } 69 70// SET COOKIE 71 function setCookie(cname, cvalue, exdays) { 72 var d = new Date(); 73 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 74 var expires = "expires="+ d.toUTCString(); 75 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 76 } 77 78// LOADER CONTEÃDO 79 $(document).on('click', '[loaderConteudo]', function() { 80 ID = $(this).attr('loaderConteudo'); 81 $.ajax({ 82 type: "POST", 83 dataType: "html", 84 url: API_SITE+'conteudos', 85 data: {acao: "loader", ID: ID }, 86 success: function(html) { 87 $('[modalConteudo_div]').html(html); 88 $('#modalConteudo').modal('show'); 89 }, 90 error: function(data) { 91 ajaxErro(); 92 } 93 }); 94 })
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.