PageSourceSearch

https://veja.abril.com.br/wp-content/themes/abril-master2/assets/js/abril_scripts.js?ver=2026.09.28

js abril.com.br collected 2026-10-01 07:02:43 UTC 8,273 bytes, 302 lines download raw bytes

1/* SCRIPT ORDENA FILA */
2var AbrilScriptsExec = (function () {
3  var listFunction = [];
4  var directFunction = [];
5  var listFunctionInline = [];
6  var listFunctionOrder = [];
7  let indiceFunction = 0;
8  let indiceExec = 0;
9  let count_fila = 0;
10
11  function init(){
12    console.log("###### INIT FILA ######");
13    orderFunctionList();
14    console.log(listFunction);
15
16    //execFunction();
17    return
18  }
19
20  function getFunctionList( func ){
21    console.log("+++++++  FILA  ++++++++");
22    console.log(listFunction);
23    return execFunctionList( func );
24  }  
25
26  function verifyFunctionListLoad(){
27    console.log("$$$$ VERIFICA ESTADO DA LISTA PARA EXECUCAO $$$$");
28    //console.log(listFunctionOrder);
29    let loaded = true;
30    listFunctionOrder.forEach( obj => {
31      //console.log("ESTADO DA FILA " + obj.name + " " + obj.load)
32      if( !obj.load ){
33        loaded = false;
34      }
35    } );
36
37    if(!loaded){
38      return;
39    }
40    return execList();
41  }  
42
43  function execList( limit = 1 ){
44    console.log("+++++++  PROCESSA FILA  ++++++++");
45  
46    if( count_fila >= limit ){
47      console.log("+++++++  COUNT "+ count_fila+"  ++++++++");
48      console.log("+++++++  INTERRONPE PROCESSA FILA JA EXECUTADA  ++++++++");
49      return;
50    }
51    console.log(listFunctionOrder);
52    listFunctionOrder.forEach( obj => {
53      //console.log("+++++++  COUNT "+ count_fila+"  ++++++++");
54      if( obj.exec && obj.status == "" && obj.load == true && indiceExec == 0 ){
55        console.log("+++++++  EXECUTANDO ITEM DA FILA: "+ obj.name +"  ++++++++");
56        indiceExec = 1;
57        obj.status = "exec";
58        execFunction( obj.name );
59        count_fila = count_fila + 1;
60      }
61    } );
62    sendEvent();
63    return;
64  }  
65
66  function execNextList( limit = 1 ){
67    console.log("+++++++  PROCESSA PRÓXIMO DA FILA  ++++++++");
68  
69    if( count_fila >= limit + 1 ){
70      console.log("+++++++  COUNT "+ count_fila+"  ++++++++");
71      console.log("+++++++  INTERRONPE PRÓXIMO DA FILA JA EXECUTADA  ++++++++");
72      return;
73    }
74    console.log(listFunctionOrder);
75    listFunctionOrder.forEach( obj => {
76      //console.log("+++++++  COUNT "+ count_fila+"  ++++++++");
77      if( obj.exec && obj.status == "" && obj.load == true  ){
78        console.log("+++++++  EXECUTANDO ITEM DA FILA: "+ obj.name +"  ++++++++");
79        obj.status = "exec";
80        execFunction( obj.name );
81        count_fila = count_fila + 1;
82      }
83    } );
84    sendEvent();
85    return;
86  }    
87
88  function execFunctionList( func ){
89    console.log("+++++++  PROCESSA FILA  ++++++++");
90    console.log("+++++++  check "+func+"  ++++++++");
91    console.log(listFunctionOrder);
92    listFunctionOrder.forEach( obj => {
93      //console.log(obj.name);
94      if( obj.exec && obj.status == ""){
95        obj.status = "exec"
96        execFunction( obj.name );
97      }
98    } );
99    return;
100  }
101
102  function checkExecFunctionList( func ){
103    let statusFunc = false;
104    listFunctionOrder.every( obj => {
105      //console.log(obj.name + " = " + func);
106      if( obj.status == "exec" && obj.name == func){
107        statusFunc = true;
108        console.log("##### STATUS LI 1" );
109        return;
110      }
111      if( obj.status == "exec" && obj.name != func){
112        statusFunc = false;
113        console.log("##### STATUS LI 2" );
114        return;
115      }      
116      if( obj.status == "" && obj.name != func){
117        statusFunc = true;
118        console.log("##### STATUS LI 3" );
119        return;
120      }
121    } );
122    console.log("##### STATUS LI FINAL " + statusFunc);
123    return statusFunc;
124  }  
125
126    function checkStatusOnboardingListExec( func ){
127    AbrilScriptsExec.showList();
128    console.log("# checklist Onboarding " + func );
129    let statusFunc = false;
130    for (var i = 0; i < listFunctionOrder.length ; i++) {
131      if( ( listFunctionOrder[i].status == "" || listFunctionOrder[i].status == "exec" ) && listFunctionOrder[i].name != func){
132        break;
133      }
134      if( ( listFunctionOrder[i].status == "" || listFunctionOrder[i].status == "exec" ) && listFunctionOrder[i].name == func){
135        statusFunc = true;
136        break;
137      }
138    }
139    console.log("##### STATUS ONBOARDING " + statusFunc);
140    return statusFunc;
141  } 
142
143  function addFunctionList( obj ){
144    listFunction.push(obj);
145    orderFunctionList();
146    return 
147  }
148
149  function addFunctionDirect( obj ){
150    directFunction.push(obj);
151    return 
152  }
153
154  function setLoadStatus( func ){
155    console.log("##### FUCNTION CARREGADA " + func + " #########" );
156    listFunctionOrder.forEach( obj => {
157      if( obj.name == func){
158        obj.load = true; 
159        console.log("LOAD " + func); 
160      }
161    } );
162    console.log("#### FUCNTION STATUS ATUALIZAO " + func + " #########");
163    //console.log(listFunctionOrder);
164    return verifyFunctionListLoad();
165  }
166
167  function setFuncStatus( func, status ){
168    listFunctionOrder.forEach( obj => {
169      if( obj.name == func){
170        obj.status = status; 
171        console.log("EXEC STATUS " + func); 
172      }
173    } );
174    console.log(listFunctionOrder);
175    return sendEvent();
176  }        
177
178  function removeFunctionList( func ){
179    console.log("###### REMOVENDO FUNCTION DA LISTA " + func)
180    listFunctionOrder.forEach( obj => {
181      //console.log(" REMOVENDO 2 " + func)
182      if( obj.name == func && obj.status == ""){
183        obj.status = "cancel"
184        
185      }
186    } );
187    //console.log(listFunctionOrder);
188    return 
189  }  
190
191  function orderFunctionList( ){
192    listFunctionOrder = listFunction.sort((a,b)=>{
193      return  b.ordem - a.ordem;
194    })
195    listFunctionOrder.reverse();
196    //console.log("##### ORDENA FILA #####");
197    //console.log(listFunctionOrder);
198    return;
199
200  }
201
202  function execFunction( func ){
203
204    return eval( func + "()");
205    //return listFunctionOrder.forEach( obj => eval(obj.name + "()") );
206  }
207
208  function   createCookieListControl(name){
209    var d = '';
210    var value = true;
211    d = new Date();
212    d.setTime( d.getTime() + (1000*60*60*24)) ; 
213    expires = "expires="+ d.toUTCString();
214    document.cookie = name+"="+value+";" + expires + ";domain=.abril.com.br;path=/";
215  }
216
217  function checkCookieListControl(name,func = ""){
218      var nameEQ = name + "=";
219      var ca = document.cookie.split(";");
220      for (var i = 0; i < ca.length; i++) {
221        var c = ca[i];
222        while (c.charAt(0) == " ") c = c.substring(1, c.length);
223        if (c.indexOf(nameEQ) == 0) {
224          return true;
225        }
226      }
227   
228    return false;
229  } 
230
231  function eraseCookieList(name) {
232    document.cookie =
233    name + "=;domain=abril.com.br; path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;";
234  } 
235
236  function showList(name) {
237    return console.log(listFunctionOrder);
238  } 
239
240  function sendEvent() {
241
242    if( typeof gaSendEvent == "undefined" ){
243      return;
244    }
245
246    listFunctionOrder.forEach( obj => {
247      if( obj.status == "" ){
248        console.log("+++++++  SEND EVENT: "+ obj.label +"  ++++++++");
249        /**/
250            gaSendEvent({
251              "category": "Controle de inibição",
252              "action": "Bloqueio de modal",
253              "label": obj.label
254            });
255      }
256    } );
257
258    return;
259  }   
260
261  function checkDirectExec(func){
262    if( directFunction.indexOf(func) != -1 )
263      {  
264         return true;
265      }
266      return false;
267  }
268
269/*
270monta a fila a ser exec com status vazio
271ordena fila
272carrega arquivos e atualiza status
273checa se todos da fila foram carregados
274executa fila
275
276*/
277
278  return {
279    init: init,
280    listFunction: listFunction,
281    directFunction: directFunction,
282    addFunctionList: addFunctionList,
283    addFunctionDirect: addFunctionDirect,
284    removeFunctionList: removeFunctionList,
285    getFunctionList:getFunctionList,
286    execFunction: execFunction,
287    execNextList: execNextList,
288    setLoadStatus: setLoadStatus,
289    createCookieListControl: createCookieListControl,
290    checkCookieListControl: checkCookieListControl,
291    verifyFunctionListLoad: verifyFunctionListLoad,
292    eraseCookieList: eraseCookieList,
293    showList: showList,
294    setFuncStatus: setFuncStatus,
295    checkExecFunctionList: checkExecFunctionList,
296    checkStatusOnboardingListExec: checkStatusOnboardingListExec,
297    checkDirectExec: checkDirectExec,
298  };
299})();   
300
301AbrilScriptsExec.init(); 
302/* SCRIPT ORDENA FILA */

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.