1/* 2 * To change this license header, choose License Headers in Project Properties. 3 * To change this template file, choose Tools | Templates 4 * and open the template in the editor. 5 */ 6 7$(document).on("click",".image_pop",function() { 8 $('.imagepreview').attr('src', $(this).attr('src')); 9 $('#imagemodal').modal('show'); 10}); 11 12$(document).ready(function() { 13 14 //BACK BUTTON 15 $(document).on("click","#bo_back_btn",function() { 16 window.history.back(); 17 }); 18 19 loadDataTables(); 20 21 22}); 23 24function loadDataTables(){ 25 26 var vars_to_get = [ 27 'TABELA_CARREGANDO', 28 'TABELA_NUM_REGISTOS', 29 'TABELA_SEM_REGISTOS', 30 'TABELA_INFO_COM_REGISTOS', 31 'TABELA_INFO_SEM_REGISTOS', 32 'TABELA_INFO_FILTRO', 33 'TABELA_PROCURA', 34 'TABELA_PAGINACAO_PRIMEIRA', 35 'TABELA_PAGINACAO_ANTERIOR', 36 'TABELA_PAGINACAO_SEGUINTE', 37 'TABELA_PAGINACAO_ULTIMA' 38 ] 39 var varResult = get_text_from_var(vars_to_get); 40 var resultObj = jQuery.parseJSON(varResult); 41 42 if ( $('.defaultDataTable').length > 0 ){ 43 44 $('.defaultDataTable').DataTable({ 45 "paging": true, 46 "info": true, 47 "searching": true, 48 "lengthChange": false, 49 "responsive": false, 50 "scrollX": true, 51 "dom": 'Bfrtip', 52 //"autoWidth": false, 53 "language": { 54 "sProcessing": resultObj.TABELA_CARREGANDO, 55 "sLengthMenu": resultObj.TABELA_NUM_REGISTOS, 56 "sZeroRecords": resultObj.TABELA_SEM_REGISTOS, 57 "sInfo": resultObj.TABELA_INFO_COM_REGISTOS, 58 "sInfoEmpty": resultObj.TABELA_INFO_SEM_REGISTOS, 59 "sInfoFiltered": resultObj.TABELA_INFO_FILTRO, 60 "sInfoPostFix": "", 61 "sSearch": resultObj.TABELA_PROCURA, 62 "sUrl": "", 63 "oPaginate": { 64 "sFirst": resultObj.TABELA_PAGINACAO_PRIMEIRA, 65 "sPrevious": resultObj.TABELA_PAGINACAO_ANTERIOR, 66 "sNext": resultObj.TABELA_PAGINACAO_SEGUINTE, 67 "sLast": resultObj.TABELA_PAGINACAO_ULTIMA 68 } 69 }, 70 "rowReorder": false, 71 //"order": [[1, 'asc'],[2, 'asc']] 72 "order": [[0, 'asc']], 73 "buttons": [ 74 'copy', 'csv', 'excel', 'pdf' 75 ] 76 }); 77 78 } 79} 80 81function animateCSSjQuery(element, animationName, delayClass, callback) { 82 const node = element[0] 83 node.classList.add('animated', animationName, delayClass) 84 85 function handleAnimationEnd() { 86 node.classList.remove('animated', animationName, delayClass) 87 node.removeEventListener('animationend', handleAnimationEnd) 88 89 if (typeof callback === 'function') callback() 90 } 91 92 node.addEventListener('animationend', handleAnimationEnd) 93} 94 95 96function loadMasks(){ 97 98 $('.input_date').mask('0000-00-00'); 99 $('.input_date_f1').mask('00/00/0000', {placeholder: "__/__/____"}); 100 $('.input_time').mask('00:00:00', {placeholder: "__:__:__"}); 101 $('.input_date_time').mask('0000-00-00 00:00:00', {placeholder: "____-__-__ __:__:__"}); 102 $('.input_date_time_simple').mask('0000-00-00 00:00', {placeholder: "____-__-__ __:__"}); 103 $('.input_zip_code').mask('0000-000'); 104 $('.input_phone').mask('000000000'); 105 $('.input_phone_351').mask('+351-000000000'); 106 $('.input_NIF').mask('000000000'); 107 $('.input_money').mask('000.000.000.000.000,00', {reverse: true}); 108 109 110} 111 112//UPDATE COUNTDOWNS 113function updateCountDowns(){ 114 115 var nowDate = new Date(); 116 117 $('.datetime_countdown').each(function(){ 118 var gameDateString = $(this).attr('data-data'); 119 var gameDate = new Date(gameDateString); 120 121 if(gameDate > nowDate){ 122 var timeLeftMS = gameDate - nowDate; 123 var timeLeftConvert = convertMS(timeLeftMS); 124 125 $(this).find(".cd_d").html(timeLeftConvert.day); 126 $(this).find(".cd_h").html(timeLeftConvert.hour); 127 $(this).find(".cd_m").html(timeLeftConvert.minute); 128 $(this).find(".cd_s").html(timeLeftConvert.seconds); 129 }else{ 130 $(this).find(".cd_d").html(0); 131 $(this).find(".cd_h").html(0); 132 $(this).find(".cd_m").html(0); 133 $(this).find(".cd_s").html(0); 134 } 135 136 }); 137} 138 139//convert MS to days, hours, minutes, seconds 140function convertMS( milliseconds ) { 141 var day, hour, minute, seconds; 142 seconds = Math.floor(milliseconds / 1000); 143 minute = Math.floor(seconds / 60); 144 seconds = seconds % 60; 145 hour = Math.floor(minute / 60); 146 minute = minute % 60; 147 day = Math.floor(hour / 24); 148 hour = hour % 24; 149 return { 150 day: day, 151 hour: hour, 152 minute: minute, 153 seconds: seconds 154 }; 155} 156 157//Get Countdown remaining time 158function getTimeRemaining(endtime) { 159 var t = Date.parse(endtime) - Date.parse(new Date()); 160 var seconds = Math.floor((t / 1000) % 60); 161 var minutes = Math.floor((t / 1000 / 60) % 60); 162 var hours = Math.floor((t / (1000 * 60 * 60)) % 24); 163 var days = Math.floor(t / (1000 * 60 * 60 * 24)); 164 return { 165 'total': t, 166 'days': days, 167 'hours': hours, 168 'minutes': minutes, 169 'seconds': seconds 170 }; 171} 172 173//Initialize Countdown 174function initializeClock(id, endtime) { 175 var clock = document.getElementById(id); 176 var daysSpan = clock.querySelector('#simple-countdown_days'); 177 var hoursSpan = clock.querySelector('#simple-countdown_hours'); 178 var minutesSpan = clock.querySelector('#simple-countdown_minutes'); 179 var secondsSpan = clock.querySelector('#simple-countdown_seconds'); 180 181 function updateClock() { 182 var t = getTimeRemaining(endtime); 183 184 daysSpan.innerHTML = t.days; 185 hoursSpan.innerHTML = ('0' + t.hours).slice(-2); 186 minutesSpan.innerHTML = ('0' + t.minutes).slice(-2); 187 secondsSpan.innerHTML = ('0' + t.seconds).slice(-2); 188 189 if (t.total <= 0) { 190 clearInterval(timeinterval); 191 daysSpan.innerHTML = ('0'); 192 hoursSpan.innerHTML = ('0'); 193 minutesSpan.innerHTML = ('0'); 194 secondsSpan.innerHTML = ('0'); 195 } 196 } 197 198 updateClock(); 199 var timeinterval = setInterval(updateClock, 1000); 200} 201 202function modal_show(title, body){ 203 $('.main_modal_title').html(title); 204 $('.main_modal_body').html(body); 205 $('#main_modal').modal('show'); 206} 207 208 209//enable unchecking a radio button 210 211$(document).on('mouseup', '.radioEnableUncheck', function(e){ 212// alert($(this).is(':checked') ); 213 if( $(this).is(':checked') ){ 214 var thisRadio = $(this); 215 setTimeout(function(){ 216 thisRadio.prop('checked', false); 217 }, 100) 218 } 219}); 220 221//end enable unchecking a radio button 222 223 224//add max size label to inputs type file
225 226function labelMaxSize(){ 227 $('input[type="file"]').each(function(){ 228 $(this).after('<br><small>(Tamanho máximo permitido 1.5MB)</small>'); 229 // <small>(Tamanho máximo permitido 2MB)</small> 230 }); 231} 232 233//end add max size label to inputs type file
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.