Base
This commit is contained in:
30
resources/js/app.js
Normal file
30
resources/js/app.js
Normal file
@ -0,0 +1,30 @@
|
||||
require('./bootstrap');
|
||||
|
||||
var autocomplete = require('jquery-ui/ui/widgets/autocomplete');
|
||||
|
||||
$(document).ready(function() {
|
||||
$('form:first').find('*').filter(':input:visible:first').focus();
|
||||
|
||||
$('.dropdown-submenu>a').on("click", function(e) {
|
||||
$(this).next('ul').toggle();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
||||
|
||||
require('./jquery.filterTable');
|
||||
require('./binaryIndexOf');
|
||||
|
||||
require('jquery.rut');
|
||||
|
||||
String.prototype.ucwords = function() {
|
||||
str = this.toLowerCase();
|
||||
return str.replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g,
|
||||
function(s) {
|
||||
return s.toUpperCase();
|
||||
});
|
||||
};
|
||||
|
||||
require('./chart');
|
||||
|
||||
window.zxcvbn = require('zxcvbn');
|
28
resources/js/binaryIndexOf.js
Normal file
28
resources/js/binaryIndexOf.js
Normal file
@ -0,0 +1,28 @@
|
||||
function binaryIndexOf(searchElement) {
|
||||
'use strict';
|
||||
|
||||
var minIndex = 0;
|
||||
var maxIndex = this.length - 1;
|
||||
var currentIndex;
|
||||
var currentElement;
|
||||
var resultIndex;
|
||||
|
||||
while (minIndex <= maxIndex) {
|
||||
resultIndex = currentIndex = (minIndex + maxIndex) / 2 | 0;
|
||||
currentElement = this[currentIndex];
|
||||
|
||||
if (currentElement < searchElement) {
|
||||
minIndex = currentIndex + 1;
|
||||
}
|
||||
else if (currentElement > searchElement) {
|
||||
maxIndex = currentIndex - 1;
|
||||
}
|
||||
else {
|
||||
return currentIndex;
|
||||
}
|
||||
}
|
||||
|
||||
return ~maxIndex;
|
||||
}
|
||||
|
||||
Array.prototype.binaryIndexOf = binaryIndexOf;
|
11
resources/js/bootstrap.js
vendored
Normal file
11
resources/js/bootstrap.js
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
/**
|
||||
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
|
||||
* for JavaScript based Bootstrap features such as modals and tabs. This
|
||||
* code may be modified to fit the specific needs of your application.
|
||||
*/
|
||||
|
||||
window.$ = window.jQuery = require('jquery');
|
||||
|
||||
require('bootstrap');
|
||||
require('bootstrap-3-typeahead');
|
2
resources/js/chart.js
Normal file
2
resources/js/chart.js
Normal file
@ -0,0 +1,2 @@
|
||||
window.Chart = require('chart.js');
|
||||
require('chartjs-plugin-barchart-background');
|
68
resources/js/jquery.filterTable.js
Normal file
68
resources/js/jquery.filterTable.js
Normal file
@ -0,0 +1,68 @@
|
||||
(function($) {
|
||||
$.fn.filterTable = function(options)
|
||||
{
|
||||
var input = this;
|
||||
|
||||
var excludeFilter = function(row, col, headers, excludes) {
|
||||
var exclude = false;
|
||||
var cols = $(headers.get(row)).find('th');
|
||||
|
||||
if (excludes.indexOf($(cols.get(col)).html().toUpperCase()) > -1) {
|
||||
exclude = true;
|
||||
}
|
||||
|
||||
return exclude;
|
||||
}
|
||||
|
||||
this.keyup(function(e) {
|
||||
var settings = $.extend({
|
||||
"table": "filteredTable",
|
||||
"excludes": [],
|
||||
"height": 1
|
||||
}, options);
|
||||
var id_table = settings.table;
|
||||
var excludes = settings.excludes;
|
||||
var height = settings.height;
|
||||
|
||||
for (i = 0; i < excludes.length; i ++) {
|
||||
excludes[i] = excludes[i].toUpperCase();
|
||||
}
|
||||
|
||||
var filter = input.val().toUpperCase();
|
||||
var table = $('#' + id_table);
|
||||
var rows = table.find('tbody tr');
|
||||
var headers = table.find('thead tr');
|
||||
|
||||
if (filter == '') {
|
||||
rows.css('display', '');
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < rows.length; i += height) {
|
||||
var cols;
|
||||
var found = false;
|
||||
for (n = 0; n < height; n ++) {
|
||||
cols = $(rows.get(i + n)).find('td');
|
||||
$.each(cols, function(j, e) {
|
||||
if (excludeFilter(n, j, headers, excludes)) {
|
||||
return;
|
||||
}
|
||||
if ($(this).html().toUpperCase().indexOf(filter) > -1) {
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (found) {
|
||||
for (n = 0; n < height; n ++) {
|
||||
$(rows.get(i + n)).css('display', '');
|
||||
}
|
||||
} else {
|
||||
for (n = 0; n < height; n ++) {
|
||||
$(rows.get(i + n)).css('display', 'none');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return this;
|
||||
}
|
||||
}(jQuery));
|
Reference in New Issue
Block a user