File manager - Edit - /home/wwwroot/camplus.hk/master.camplus.hk/public_html/assets/global/scripts/911347/js.tar
Back
camplus-datatable.js 0000755 00000016024 15060011660 0010466 0 ustar 00 // Remove the formatting to get integer data for summation function intVal ( i ) { return typeof i === 'string' ? i.replace(/[\$,]/g, '')*1 : typeof i === 'number' ? i : 0; }; function column_sum(i) { // Total over all pages var api=$( '#data_table' ).DataTable(); console.log(api) total = api .column( i ) .data() .reduce( function (a, b) { return intVal(a) + intVal(b); }, 0 ); return total; } function column_length() { // Total over all pages var api=$( '#data_table' ).DataTable(); total = api .data() .length return total; } function checkboxEnable(enable) { if (enable) { return [ { // set default column settings 'orderable': true, 'targets': [0] }, { "searchable": true, "targets": [0] }, { "className": "dt-right", //"targets": [2] } ] } else { return [ { // set default column settings 'orderable': false, 'targets': [0] }, { "searchable": false, "targets": [0] }, { "className": "dt-right", //"targets": [2] } ] } } function initTable(enable = false) { // var chinese = { // "processing": "處理中...", // "loadingRecords": "載入中...", // "lengthMenu": "顯示 _MENU_ 項結果", // "zeroRecords": "沒有符合的結果", // "info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項", // "infoEmpty": "顯示第 0 至 0 項結果,共 0 項", // "infoFiltered": "(從 _MAX_ 項結果中過濾)", // "infoPostFix": "", // "search": "搜尋:", // "paginate": { // "first": "第一頁", // "previous": "上一頁", // "next": "下一頁", // "last": "最後一頁" // }, // "aria": { // "sortAscending": ": 升冪排列", // "sortDescending": ": 降冪排列" // } // }; // var english = { // "sEmptyTable": "No data available in table", // "sInfo": "Showing _START_ to _END_ of _TOTAL_ entries", // "sInfoEmpty": "Showing 0 to 0 of 0 entries", // "sInfoFiltered": "(filtered from _MAX_ total entries)", // "sInfoPostFix": "", // "sInfoThousands": ",", // "sLengthMenu": "Show _MENU_ entries", // "sLoadingRecords": "Loading...", // "sProcessing": "Processing...", // "sSearch": "Search:", // "sZeroRecords": "No matching records found", // "oPaginate": { // "sFirst": "First", // "sLast": "Last", // "sNext": "Next", // "sPrevious": "Previous" // }, // "oAria": { // "sSortAscending": ": activate to sort column ascending", // "sSortDescending": ": activate to sort column descending" // } // }; // var currentLang = english $('#data_table').DataTable({ //Use the plugin from: https://github.com/jhyland87/DataTables-Hide-Empty-Columns //add the plugin to: assets/custom/datatables/HideEmptyColumns/dataTables.hideEmptyColumns.min.js hideEmptyCols: true, // Internationalisation. For more info refer to http://datatables.net/manual/i18n // if($.cookie("language") == "ch") { // currentLang = chinese; // } else { // currentLang = english; // } // Or you can use remote translation file //"language": { // url: '//cdn.datatables.net/plug-ins/3cfcc339e89/i18n/Portuguese.json' //}, // Uncomment below line("dom" parameter) to fix the dropdown overflow issue in the datatable cells. The default datatable layout // setup uses scrollable div(table-scrollable) with overflow:auto to enable vertical scroll(see: assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js). // So when dropdowns used the scrollable div should be removed. //"dom": "<'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r>t<'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>", // "oLanguage": currentLang, "bStateSave": true, // save datatable state(pagination, sort, etc) in cookie. "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] // change per page values here ], // set the initial value "pageLength": 20, "pagingType": "bootstrap_full_number", "columnDefs": checkboxEnable(enable), "order": [ [1, "asc"] ], initComplete: function () { var table_completed = $('#data_table').DataTable(); $("#data_table thead tr:first th").each( function ( i, v ) { if($(v).data('filter') == 1){ var select = $('<select class="'+$(this).data('type')+' select2"><option value="">- All -</option></select>') .appendTo( $(this).empty() ) .on( 'change', function () { var val = $(this).val(); table_completed.column( i ) .search( val ? '^'+$(this).val()+'$' : val, true, false ) .draw(); } ); table_completed.column( i ).data().unique().sort().each( function ( d, j ) { var val = $('<div/>').html(d).text(); select.append( '<option value="' + val + '">' + val + '</option>' ) }); } else{ if(i==0) { } } }); } // set first column as a default sort by asc }); var table = $('#data_table').dataTable(); table.find('.group-checkable').change(function () { var set = jQuery(this).attr("data-set"); var checked = jQuery(this).is(":checked"); jQuery(set).each(function () { if (checked) { $(this).prop("checked", true); $(this).parents('tr').addClass("active"); } else { $(this).prop("checked", false); $(this).parents('tr').removeClass("active"); } }); }); table.on('change', 'tbody tr .checkboxes', function () { $(this).parents('tr').toggleClass("active"); }); } function captionBadge() { if ( $.fn.DataTable.isDataTable( '#data_table' ) ) { var cols = column_length(); $('.caption').first().append(' <span class="badge datatables_count"> '+ cols + '</span>') } else { console.log('waiting 300 for init'); setTimeout(captionBadge,1000); } } decodeJSON.js 0000755 00000000250 15060011660 0007012 0 ustar 00 self.addEventListener('message', function(e) { console.log('working') var section = JSON.parse(e.data); self.postMessage(section); self.close(); }, false); form-validation.js 0000755 00000005041 15060011660 0010173 0 ustar 00 var FormValidation = function () { // validation using icons var handleValidation = function() { // for more info visit the official plugin documentation: // http://docs.jquery.com/Plugins/Validation var form2 = $('#form_validation'); var error2 = $('.alert-danger', form2); var success2 = $('.alert-success', form2); form2.validate({ errorElement: 'span', //default input error message container errorClass: 'help-block help-block-error', // default input error message class focusInvalid: false, // do not focus the last invalid input ignore: "", // validate all fields including form hidden input invalidHandler: function (event, validator) { //display error alert on form submit success2.hide(); error2.show(); App.scrollTo(error2, -200); }, errorPlacement: function (error, element) { // render error placement for each input type var icon = $(element).parent('.input-icon').children('i'); icon.removeClass('fa-check').addClass("fa-warning"); icon.attr("data-original-title", error.text()).tooltip({'container': 'body'}); }, highlight: function (element) { // hightlight error inputs $(element) .closest('.form-group').removeClass("has-success").addClass('has-error'); // set error class to the control group }, unhighlight: function (element) { // revert the change done by hightlight }, success: function (label, element) { var icon = $(element).parent('.input-icon').children('i'); $(element).closest('.form-group').removeClass('has-error').addClass('has-success'); // set success class to the control group icon.removeClass("fa-warning").addClass("fa-check"); }, submitHandler: function (form) { success2.show(); error2.hide(); form[0].submit(); // submit the form } }); } return { //main function to initiate the module init: function () { handleValidation(); } }; }(); jQuery(document).ready(function() { FormValidation.init(); }); jquery.quicksearch.js 0000755 00000010123 15060011660 0010715 0 ustar 00 (function($, window, document, undefined) { $.fn.quicksearch = function (target, opt) { var timeout, cache, rowcache, jq_results, val = '', e = this, options = $.extend({ delay: 100, selector: null, stripeRows: null, loader: null, noResults: '', matchedResultsCount: 0, bind: 'keyup', onBefore: function () { return; }, onAfter: function () { return; }, show: function () { this.style.display = ""; }, hide: function () { this.style.display = "none"; }, prepareQuery: function (val) { return val.toLowerCase().split(' '); }, testQuery: function (query, txt, _row) { for (var i = 0; i < query.length; i += 1) { if (txt.indexOf(query[i]) === -1) { return false; } } return true; } }, opt); this.go = function () { var i = 0, numMatchedRows = 0, noresults = true, query = options.prepareQuery(val), val_empty = (val.replace(' ', '').length === 0); for (var i = 0, len = rowcache.length; i < len; i++) { if (val_empty || options.testQuery(query, cache[i], rowcache[i])) { options.show.apply(rowcache[i]); noresults = false; numMatchedRows++; } else { options.hide.apply(rowcache[i]); } } if (noresults) { this.results(false); } else { this.results(true); this.stripe(); } this.matchedResultsCount = numMatchedRows; this.loader(false); options.onAfter(); return this; }; /* * External API so that users can perform search programatically. * */ this.search = function (submittedVal) { val = submittedVal; e.trigger(); }; /* * External API to get the number of matched results as seen in * https://github.com/ruiz107/quicksearch/commit/f78dc440b42d95ce9caed1d087174dd4359982d6 * */ this.currentMatchedResults = function() { return this.matchedResultsCount; }; this.stripe = function () { if (typeof options.stripeRows === "object" && options.stripeRows !== null) { var joined = options.stripeRows.join(' '); var stripeRows_length = options.stripeRows.length; jq_results.not(':hidden').each(function (i) { $(this).removeClass(joined).addClass(options.stripeRows[i % stripeRows_length]); }); } return this; }; this.strip_html = function (input) { var output = input.replace(new RegExp('<[^<]+\>', 'g'), ""); output = $.trim(output.toLowerCase()); return output; }; this.results = function (bool) { if (typeof options.noResults === "string" && options.noResults !== "") { if (bool) { $(options.noResults).hide(); } else { $(options.noResults).show(); } } return this; }; this.loader = function (bool) { if (typeof options.loader === "string" && options.loader !== "") { (bool) ? $(options.loader).show() : $(options.loader).hide(); } return this; }; this.cache = function () { jq_results = $(target); if (typeof options.noResults === "string" && options.noResults !== "") { jq_results = jq_results.not(options.noResults); } var t = (typeof options.selector === "string") ? jq_results.find(options.selector) : $(target).not(options.noResults); cache = t.map(function () { return e.strip_html(this.innerHTML); }); rowcache = jq_results.map(function () { return this; }); /* * Modified fix for sync-ing "val". * Original fix https://github.com/michaellwest/quicksearch/commit/4ace4008d079298a01f97f885ba8fa956a9703d1 * */ val = val || this.val() || ""; return this.go(); }; this.trigger = function () { this.loader(true); options.onBefore(); window.clearTimeout(timeout); timeout = window.setTimeout(function () { e.go(); }, options.delay); return this; }; this.cache(); this.results(true); this.stripe(); this.loader(false); return this.each(function () { /* * Changed from .bind to .on. * */ $(this).on(options.bind, function () { val = $(this).val(); e.trigger(); }); }); }; }(jQuery, this, document)); leave_sub_filter.js 0000755 00000005615 15060011660 0010421 0 ustar 00 // set date format function formatDate(date) { var d = new Date(date), month = '' + (d.getMonth() + 1), day = '' + d.getDate(), year = d.getFullYear(); if (month.length < 2) month = '0' + month; if (day.length < 2) day = '0' + day; return [year, month, day].join('-'); } // find free teacher perticuler date and cycle day $("#cycle_day").change(function(){ var date=$("#date").val(); var weekday=$("#cycle_day").val(); var str_class_sub=""; var freeteacher_list=""; $('#classsubjectlist').html("LOADING..."); $.ajax({ type: "POST", url: BASE_URL + "leave_sub/leave/getClassSubstitution/"+ date + '/' + weekday, dataType: "json", success: function(data) { console.log(data); for($i=0;$i<data.length;$i++) { for($j=0;$j<data[$i].length;$j++) { str_class_sub +=' <label class="mt-checkbox mt-checkbox-outline ">('+data[$i][$j]['time_from']+' - ' + data[$i][$j]['time_to'] + ') ' + data[$i][$j]['classtitile'] +' '+ data[$i][$j]['name_eng'] +' '+ data[$i][$j]['title'] +' - '+ data[$i][$j]['username'] +'<input class="checker" type="checkbox" id="classsubject" value="'+data[$i][$j]['id']+'" name="lesson_id[]" /> <span></span> </label>'; } } if(str_class_sub.length==0){ str_class_sub = "There is no class require subsitute"; } $('#classsubjectlist').html(str_class_sub); $('#freeteacherlist').html(''); } }); }); // find perticuler lessons free teachers $("#classsubjectlist").on("click", "#classsubject", function() { freeteachers_list(); }); // check other filetring criteria $("#filtering_criteria").on("click", "#filters", function() { freeteachers_list(); }); function freeteachers_list() { $('#freeteacherlist').html('LOADING...'); var weekday=$("#cycle_day").val(); if(weekday=="") { alert('Please pick a day'); return; } $('#freeteacherlist').html(''); // clear free teacher list var date=$("#date").val(); // alert(date); var filters=""; $('#filtering_criteria input[type=checkbox]:checked').each(function(){ filters +=$(this).val() + '_'; }); if(filters) { }else { filters="none_none"; } var lession_id=""; $('#classsubjectlist input[type=checkbox]:checked').each(function(){ lession_id +=$(this).val() + '_'; }); var freeteacher_list=""; $.ajax({ type: "POST", url: BASE_URL + "leave_sub/leave/getFreeTeachers/"+lession_id+'/'+filters+'/'+date+'/'+weekday, dataType: "json", success: function(data) { for($i=0;$i<data.length;$i++) { freeteacher_list +='<label> <input type="radio" name="t_uid[]" value='+data[$i]['id'] +' class="icheck"> ' + data[$i]['username'] +' ('+ data[$i]['marks'] +') </label>'; } $('#freeteacherlist').html(freeteacher_list); $('.createSubstitutionForm').validate(); } }) }
| ver. 1.4 |
Github
|
.
| PHP 7.2.34 | Generation time: 0.14 |
proxy
|
phpinfo
|
Settings