dari laptop
This commit is contained in:
BIN
public/kapella/js/.DS_Store
vendored
Normal file
BIN
public/kapella/js/.DS_Store
vendored
Normal file
Binary file not shown.
352
public/kapella/js/chart.js
Normal file
352
public/kapella/js/chart.js
Normal file
@@ -0,0 +1,352 @@
|
||||
$(function() {
|
||||
/* ChartJS
|
||||
* -------
|
||||
* Data and config for chartjs
|
||||
*/
|
||||
'use strict';
|
||||
var data = {
|
||||
labels: ["2013", "2014", "2014", "2015", "2016", "2017"],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [10, 19, 3, 5, 2, 3],
|
||||
backgroundColor: [
|
||||
'rgba(255, 99, 132, 0.2)',
|
||||
'rgba(54, 162, 235, 0.2)',
|
||||
'rgba(255, 206, 86, 0.2)',
|
||||
'rgba(75, 192, 192, 0.2)',
|
||||
'rgba(153, 102, 255, 0.2)',
|
||||
'rgba(255, 159, 64, 0.2)'
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(255,99,132,1)',
|
||||
'rgba(54, 162, 235, 1)',
|
||||
'rgba(255, 206, 86, 1)',
|
||||
'rgba(75, 192, 192, 1)',
|
||||
'rgba(153, 102, 255, 1)',
|
||||
'rgba(255, 159, 64, 1)'
|
||||
],
|
||||
borderWidth: 1,
|
||||
fill: false
|
||||
}]
|
||||
};
|
||||
var multiLineData = {
|
||||
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
|
||||
datasets: [{
|
||||
label: 'Dataset 1',
|
||||
data: [12, 19, 3, 5, 2, 3],
|
||||
borderColor: [
|
||||
'#587ce4'
|
||||
],
|
||||
borderWidth: 2,
|
||||
fill: false
|
||||
},
|
||||
{
|
||||
label: 'Dataset 2',
|
||||
data: [5, 23, 7, 12, 42, 23],
|
||||
borderColor: [
|
||||
'#ede190'
|
||||
],
|
||||
borderWidth: 2,
|
||||
fill: false
|
||||
},
|
||||
{
|
||||
label: 'Dataset 3',
|
||||
data: [15, 10, 21, 32, 12, 33],
|
||||
borderColor: [
|
||||
'#f44252'
|
||||
],
|
||||
borderWidth: 2,
|
||||
fill: false
|
||||
}
|
||||
]
|
||||
};
|
||||
var options = {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero: true
|
||||
}
|
||||
}]
|
||||
},
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
elements: {
|
||||
point: {
|
||||
radius: 0
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
var doughnutPieData = {
|
||||
datasets: [{
|
||||
data: [30, 40, 30],
|
||||
backgroundColor: [
|
||||
'rgba(255, 99, 132, 0.5)',
|
||||
'rgba(54, 162, 235, 0.5)',
|
||||
'rgba(255, 206, 86, 0.5)',
|
||||
'rgba(75, 192, 192, 0.5)',
|
||||
'rgba(153, 102, 255, 0.5)',
|
||||
'rgba(255, 159, 64, 0.5)'
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(255,99,132,1)',
|
||||
'rgba(54, 162, 235, 1)',
|
||||
'rgba(255, 206, 86, 1)',
|
||||
'rgba(75, 192, 192, 1)',
|
||||
'rgba(153, 102, 255, 1)',
|
||||
'rgba(255, 159, 64, 1)'
|
||||
],
|
||||
}],
|
||||
|
||||
// These labels appear in the legend and in the tooltips when hovering different arcs
|
||||
labels: [
|
||||
'Pink',
|
||||
'Blue',
|
||||
'Yellow',
|
||||
]
|
||||
};
|
||||
var doughnutPieOptions = {
|
||||
responsive: true,
|
||||
animation: {
|
||||
animateScale: true,
|
||||
animateRotate: true
|
||||
}
|
||||
};
|
||||
var areaData = {
|
||||
labels: ["2013", "2014", "2015", "2016", "2017"],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [12, 19, 3, 5, 2, 3],
|
||||
backgroundColor: [
|
||||
'rgba(255, 99, 132, 0.2)',
|
||||
'rgba(54, 162, 235, 0.2)',
|
||||
'rgba(255, 206, 86, 0.2)',
|
||||
'rgba(75, 192, 192, 0.2)',
|
||||
'rgba(153, 102, 255, 0.2)',
|
||||
'rgba(255, 159, 64, 0.2)'
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(255,99,132,1)',
|
||||
'rgba(54, 162, 235, 1)',
|
||||
'rgba(255, 206, 86, 1)',
|
||||
'rgba(75, 192, 192, 1)',
|
||||
'rgba(153, 102, 255, 1)',
|
||||
'rgba(255, 159, 64, 1)'
|
||||
],
|
||||
borderWidth: 1,
|
||||
fill: true, // 3: no fill
|
||||
}]
|
||||
};
|
||||
|
||||
var areaOptions = {
|
||||
plugins: {
|
||||
filler: {
|
||||
propagate: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var multiAreaData = {
|
||||
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
||||
datasets: [{
|
||||
label: 'Facebook',
|
||||
data: [8, 11, 13, 15, 12, 13, 16, 15, 13, 19, 11, 14],
|
||||
borderColor: ['rgba(255, 99, 132, 0.5)'],
|
||||
backgroundColor: ['rgba(255, 99, 132, 0.5)'],
|
||||
borderWidth: 1,
|
||||
fill: true
|
||||
},
|
||||
{
|
||||
label: 'Twitter',
|
||||
data: [7, 17, 12, 16, 14, 18, 16, 12, 15, 11, 13, 9],
|
||||
borderColor: ['rgba(54, 162, 235, 0.5)'],
|
||||
backgroundColor: ['rgba(54, 162, 235, 0.5)'],
|
||||
borderWidth: 1,
|
||||
fill: true
|
||||
},
|
||||
{
|
||||
label: 'Linkedin',
|
||||
data: [6, 14, 16, 20, 12, 18, 15, 12, 17, 19, 15, 11],
|
||||
borderColor: ['rgba(255, 206, 86, 0.5)'],
|
||||
backgroundColor: ['rgba(255, 206, 86, 0.5)'],
|
||||
borderWidth: 1,
|
||||
fill: true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var multiAreaOptions = {
|
||||
plugins: {
|
||||
filler: {
|
||||
propagate: true
|
||||
}
|
||||
},
|
||||
elements: {
|
||||
point: {
|
||||
radius: 0
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
gridLines: {
|
||||
display: false
|
||||
}
|
||||
}],
|
||||
yAxes: [{
|
||||
gridLines: {
|
||||
display: false
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
var scatterChartData = {
|
||||
datasets: [{
|
||||
label: 'First Dataset',
|
||||
data: [{
|
||||
x: -10,
|
||||
y: 0
|
||||
},
|
||||
{
|
||||
x: 0,
|
||||
y: 3
|
||||
},
|
||||
{
|
||||
x: -25,
|
||||
y: 5
|
||||
},
|
||||
{
|
||||
x: 40,
|
||||
y: 5
|
||||
}
|
||||
],
|
||||
backgroundColor: [
|
||||
'rgba(255, 99, 132, 0.2)'
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(255,99,132,1)'
|
||||
],
|
||||
borderWidth: 1
|
||||
},
|
||||
{
|
||||
label: 'Second Dataset',
|
||||
data: [{
|
||||
x: 10,
|
||||
y: 5
|
||||
},
|
||||
{
|
||||
x: 20,
|
||||
y: -30
|
||||
},
|
||||
{
|
||||
x: -25,
|
||||
y: 15
|
||||
},
|
||||
{
|
||||
x: -10,
|
||||
y: 5
|
||||
}
|
||||
],
|
||||
backgroundColor: [
|
||||
'rgba(54, 162, 235, 0.2)',
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(54, 162, 235, 1)',
|
||||
],
|
||||
borderWidth: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
var scatterChartOptions = {
|
||||
scales: {
|
||||
xAxes: [{
|
||||
type: 'linear',
|
||||
position: 'bottom'
|
||||
}]
|
||||
}
|
||||
}
|
||||
// Get context with jQuery - using jQuery's .get() method.
|
||||
if ($("#barChart").length) {
|
||||
var barChartCanvas = $("#barChart").get(0).getContext("2d");
|
||||
// This will get the first returned node in the jQuery collection.
|
||||
var barChart = new Chart(barChartCanvas, {
|
||||
type: 'bar',
|
||||
data: data,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
if ($("#lineChart").length) {
|
||||
var lineChartCanvas = $("#lineChart").get(0).getContext("2d");
|
||||
var lineChart = new Chart(lineChartCanvas, {
|
||||
type: 'line',
|
||||
data: data,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
if ($("#linechart-multi").length) {
|
||||
var multiLineCanvas = $("#linechart-multi").get(0).getContext("2d");
|
||||
var lineChart = new Chart(multiLineCanvas, {
|
||||
type: 'line',
|
||||
data: multiLineData,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
if ($("#areachart-multi").length) {
|
||||
var multiAreaCanvas = $("#areachart-multi").get(0).getContext("2d");
|
||||
var multiAreaChart = new Chart(multiAreaCanvas, {
|
||||
type: 'line',
|
||||
data: multiAreaData,
|
||||
options: multiAreaOptions
|
||||
});
|
||||
}
|
||||
|
||||
if ($("#doughnutChart").length) {
|
||||
var doughnutChartCanvas = $("#doughnutChart").get(0).getContext("2d");
|
||||
var doughnutChart = new Chart(doughnutChartCanvas, {
|
||||
type: 'doughnut',
|
||||
data: doughnutPieData,
|
||||
options: doughnutPieOptions
|
||||
});
|
||||
}
|
||||
|
||||
if ($("#pieChart").length) {
|
||||
var pieChartCanvas = $("#pieChart").get(0).getContext("2d");
|
||||
var pieChart = new Chart(pieChartCanvas, {
|
||||
type: 'pie',
|
||||
data: doughnutPieData,
|
||||
options: doughnutPieOptions
|
||||
});
|
||||
}
|
||||
|
||||
if ($("#areaChart").length) {
|
||||
var areaChartCanvas = $("#areaChart").get(0).getContext("2d");
|
||||
var areaChart = new Chart(areaChartCanvas, {
|
||||
type: 'line',
|
||||
data: areaData,
|
||||
options: areaOptions
|
||||
});
|
||||
}
|
||||
|
||||
if ($("#scatterChart").length) {
|
||||
var scatterChartCanvas = $("#scatterChart").get(0).getContext("2d");
|
||||
var scatterChart = new Chart(scatterChartCanvas, {
|
||||
type: 'scatter',
|
||||
data: scatterChartData,
|
||||
options: scatterChartOptions
|
||||
});
|
||||
}
|
||||
|
||||
if ($("#browserTrafficChart").length) {
|
||||
var doughnutChartCanvas = $("#browserTrafficChart").get(0).getContext("2d");
|
||||
var doughnutChart = new Chart(doughnutChartCanvas, {
|
||||
type: 'doughnut',
|
||||
data: browserTrafficData,
|
||||
options: doughnutPieOptions
|
||||
});
|
||||
}
|
||||
});
|
||||
1172
public/kapella/js/dashboard.js
Normal file
1172
public/kapella/js/dashboard.js
Normal file
File diff suppressed because it is too large
Load Diff
12
public/kapella/js/file-upload.js
Normal file
12
public/kapella/js/file-upload.js
Normal file
@@ -0,0 +1,12 @@
|
||||
(function($) {
|
||||
'use strict';
|
||||
$(function() {
|
||||
$('.file-upload-browse').on('click', function() {
|
||||
var file = $(this).parent().parent().parent().find('.file-upload-default');
|
||||
file.trigger('click');
|
||||
});
|
||||
$('.file-upload-default').on('change', function() {
|
||||
$(this).parent().find('.form-control').val($(this).val().replace(/C:\\fakepath\\/i, ''));
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
117
public/kapella/js/jquery.cookie.js
Normal file
117
public/kapella/js/jquery.cookie.js
Normal file
@@ -0,0 +1,117 @@
|
||||
/*!
|
||||
* jQuery Cookie Plugin v1.4.1
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2013 Klaus Hartl
|
||||
* Released under the MIT license
|
||||
*/
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// CommonJS
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
var pluses = /\+/g;
|
||||
|
||||
function encode(s) {
|
||||
return config.raw ? s : encodeURIComponent(s);
|
||||
}
|
||||
|
||||
function decode(s) {
|
||||
return config.raw ? s : decodeURIComponent(s);
|
||||
}
|
||||
|
||||
function stringifyCookieValue(value) {
|
||||
return encode(config.json ? JSON.stringify(value) : String(value));
|
||||
}
|
||||
|
||||
function parseCookieValue(s) {
|
||||
if (s.indexOf('"') === 0) {
|
||||
// This is a quoted cookie as according to RFC2068, unescape...
|
||||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
||||
}
|
||||
|
||||
try {
|
||||
// Replace server-side written pluses with spaces.
|
||||
// If we can't decode the cookie, ignore it, it's unusable.
|
||||
// If we can't parse the cookie, ignore it, it's unusable.
|
||||
s = decodeURIComponent(s.replace(pluses, ' '));
|
||||
return config.json ? JSON.parse(s) : s;
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function read(s, converter) {
|
||||
var value = config.raw ? s : parseCookieValue(s);
|
||||
return $.isFunction(converter) ? converter(value) : value;
|
||||
}
|
||||
|
||||
var config = $.cookie = function (key, value, options) {
|
||||
|
||||
// Write
|
||||
|
||||
if (value !== undefined && !$.isFunction(value)) {
|
||||
options = $.extend({}, config.defaults, options);
|
||||
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setTime(+t + days * 864e+5);
|
||||
}
|
||||
|
||||
return (document.cookie = [
|
||||
encode(key), '=', stringifyCookieValue(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// Read
|
||||
|
||||
var result = key ? undefined : {};
|
||||
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all. Also prevents odd result when
|
||||
// calling $.cookie().
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
|
||||
for (var i = 0, l = cookies.length; i < l; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var name = decode(parts.shift());
|
||||
var cookie = parts.join('=');
|
||||
|
||||
if (key && key === name) {
|
||||
// If second argument (value) is a function it's a converter...
|
||||
result = read(cookie, value);
|
||||
break;
|
||||
}
|
||||
|
||||
// Prevent storing a cookie that we couldn't decode.
|
||||
if (!key && (cookie = read(cookie)) !== undefined) {
|
||||
result[name] = cookie;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
config.defaults = {};
|
||||
|
||||
$.removeCookie = function (key, options) {
|
||||
if ($.cookie(key) === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Must not alter options, thus extending a fresh object...
|
||||
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
||||
return !$.cookie(key);
|
||||
};
|
||||
|
||||
}));
|
||||
10
public/kapella/js/select2.js
Normal file
10
public/kapella/js/select2.js
Normal file
@@ -0,0 +1,10 @@
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
if ($(".js-example-basic-single").length) {
|
||||
$(".js-example-basic-single").select2();
|
||||
}
|
||||
if ($(".js-example-basic-multiple").length) {
|
||||
$(".js-example-basic-multiple").select2();
|
||||
}
|
||||
})(jQuery);
|
||||
126
public/kapella/js/template.js
Normal file
126
public/kapella/js/template.js
Normal file
@@ -0,0 +1,126 @@
|
||||
(function($) {
|
||||
'use strict';
|
||||
$(function() {
|
||||
var body = $('body');
|
||||
var contentWrapper = $('.content-wrapper');
|
||||
var scroller = $('.container-scroller');
|
||||
var footer = $('.footer');
|
||||
var sidebar = $('.sidebar');
|
||||
|
||||
//Add active class to nav-link based on url dynamically
|
||||
//Active class can be hard coded directly in html file also as required
|
||||
|
||||
function addActiveClass(element) {
|
||||
if (current === "") {
|
||||
//for root url
|
||||
if (element.attr('href').indexOf("index.html") !== -1) {
|
||||
element.parents('.nav-item').last().addClass('active');
|
||||
if (element.parents('.sub-menu').length) {
|
||||
element.closest('.collapse').addClass('show');
|
||||
element.addClass('active');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//for other url
|
||||
if (element.attr('href').indexOf(current) !== -1) {
|
||||
element.parents('.nav-item').last().addClass('active');
|
||||
if (element.parents('.sub-menu').length) {
|
||||
element.closest('.collapse').addClass('show');
|
||||
element.addClass('active');
|
||||
}
|
||||
if (element.parents('.submenu-item').length) {
|
||||
element.addClass('active');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var current = location.pathname.split("/").slice(-1)[0].replace(/^\/|\/$/g, '');
|
||||
$('.nav li a', sidebar).each(function() {
|
||||
var $this = $(this);
|
||||
addActiveClass($this);
|
||||
})
|
||||
|
||||
$('.horizontal-menu .nav li a').each(function() {
|
||||
var $this = $(this);
|
||||
addActiveClass($this);
|
||||
})
|
||||
|
||||
//Close other submenu in sidebar on opening any
|
||||
|
||||
sidebar.on('show.bs.collapse', '.collapse', function() {
|
||||
sidebar.find('.collapse.show').collapse('hide');
|
||||
});
|
||||
|
||||
|
||||
//Change sidebar and content-wrapper height
|
||||
applyStyles();
|
||||
|
||||
function applyStyles() {
|
||||
//Applying perfect scrollbar
|
||||
if (!body.hasClass("rtl")) {
|
||||
if ($('.settings-panel .tab-content .tab-pane.scroll-wrapper').length) {
|
||||
const settingsPanelScroll = new PerfectScrollbar('.settings-panel .tab-content .tab-pane.scroll-wrapper');
|
||||
}
|
||||
if ($('.chats').length) {
|
||||
const chatsScroll = new PerfectScrollbar('.chats');
|
||||
}
|
||||
if (body.hasClass("sidebar-fixed")) {
|
||||
if($('#sidebar').length) {
|
||||
var fixedSidebarScroll = new PerfectScrollbar('#sidebar .nav');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('[data-toggle="minimize"]').on("click", function() {
|
||||
if ((body.hasClass('sidebar-toggle-display')) || (body.hasClass('sidebar-absolute'))) {
|
||||
body.toggleClass('sidebar-hidden');
|
||||
} else {
|
||||
body.toggleClass('sidebar-icon-only');
|
||||
}
|
||||
});
|
||||
|
||||
//checkbox and radios
|
||||
$(".form-check label,.form-radio label").append('<i class="input-helper"></i>');
|
||||
|
||||
//Horizontal menu in mobile
|
||||
$('[data-toggle="horizontal-menu-toggle"]').on("click", function() {
|
||||
$(".horizontal-menu .bottom-navbar").toggleClass("header-toggled");
|
||||
});
|
||||
// Horizontal menu navigation in mobile menu on click
|
||||
var navItemClicked = $('.horizontal-menu .page-navigation >.nav-item');
|
||||
navItemClicked.on("click", function(event) {
|
||||
if(window.matchMedia('(max-width: 991px)').matches) {
|
||||
if(!($(this).hasClass('show-submenu'))) {
|
||||
navItemClicked.removeClass('show-submenu');
|
||||
}
|
||||
$(this).toggleClass('show-submenu');
|
||||
}
|
||||
})
|
||||
|
||||
$(window).scroll(function() {
|
||||
if(window.matchMedia('(min-width: 992px)').matches) {
|
||||
var header = $('.horizontal-menu');
|
||||
if ($(window).scrollTop() >= 70) {
|
||||
$(header).addClass('fixed-on-scroll');
|
||||
} else {
|
||||
$(header).removeClass('fixed-on-scroll');
|
||||
}
|
||||
}
|
||||
});
|
||||
if ($.cookie('kapella-free-banner')!="true") {
|
||||
document.querySelector('#proBanner').classList.add('d-flex');
|
||||
}
|
||||
else {
|
||||
document.querySelector('#proBanner').classList.add('d-none');
|
||||
}
|
||||
document.querySelector('#bannerClose').addEventListener('click',function() {
|
||||
document.querySelector('#proBanner').classList.add('d-none');
|
||||
document.querySelector('#proBanner').classList.remove('d-flex');
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + 24 * 60 * 60 * 1000);
|
||||
$.cookie('kapella-free-banner', "true", { expires: date });
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
60
public/kapella/js/typeahead.js
Normal file
60
public/kapella/js/typeahead.js
Normal file
@@ -0,0 +1,60 @@
|
||||
(function($) {
|
||||
'use strict';
|
||||
var substringMatcher = function(strs) {
|
||||
return function findMatches(q, cb) {
|
||||
var matches, substringRegex;
|
||||
|
||||
// an array that will be populated with substring matches
|
||||
matches = [];
|
||||
|
||||
// regex used to determine if a string contains the substring `q`
|
||||
var substrRegex = new RegExp(q, 'i');
|
||||
|
||||
// iterate through the pool of strings and for any string that
|
||||
// contains the substring `q`, add it to the `matches` array
|
||||
for (var i = 0; i < strs.length; i++) {
|
||||
if (substrRegex.test(strs[i])) {
|
||||
matches.push(strs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
cb(matches);
|
||||
};
|
||||
};
|
||||
|
||||
var states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',
|
||||
'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii',
|
||||
'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana',
|
||||
'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',
|
||||
'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire',
|
||||
'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota',
|
||||
'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island',
|
||||
'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont',
|
||||
'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'
|
||||
];
|
||||
|
||||
$('#the-basics .typeahead').typeahead({
|
||||
hint: true,
|
||||
highlight: true,
|
||||
minLength: 1
|
||||
}, {
|
||||
name: 'states',
|
||||
source: substringMatcher(states)
|
||||
});
|
||||
// constructs the suggestion engine
|
||||
var states = new Bloodhound({
|
||||
datumTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
// `states` is an array of state names defined in "The Basics"
|
||||
local: states
|
||||
});
|
||||
|
||||
$('#bloodhound .typeahead').typeahead({
|
||||
hint: true,
|
||||
highlight: true,
|
||||
minLength: 1
|
||||
}, {
|
||||
name: 'states',
|
||||
source: states
|
||||
});
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user