Primer Commit
This commit is contained in:
65
dist/js/pages/forms/clockpicker/form-clockpicker.init.js
vendored
Normal file
65
dist/js/pages/forms/clockpicker/form-clockpicker.init.js
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
// Clock pickers
|
||||
$('#single-input').clockpicker({
|
||||
placement: 'bottom',
|
||||
align: 'left',
|
||||
autoclose: true,
|
||||
'default': 'now'
|
||||
});
|
||||
$('.clockpicker').clockpicker({
|
||||
donetext: 'Done',
|
||||
}).find('input').change(function() {
|
||||
console.log(this.value);
|
||||
});
|
||||
$('#check-minutes').click(function(e) {
|
||||
// Have to stop propagation here
|
||||
e.stopPropagation();
|
||||
input.clockpicker('show').clockpicker('toggleView', 'minutes');
|
||||
});
|
||||
if (/mobile/i.test(navigator.userAgent)) {
|
||||
$('input').prop('readOnly', true);
|
||||
}
|
||||
|
||||
$('.top_clockpicker').clockpicker({
|
||||
placement: 'top',
|
||||
align: 'left',
|
||||
donetext: 'Done'
|
||||
});
|
||||
|
||||
var input = $('.clockpicker-with-callbacks').clockpicker({
|
||||
donetext: 'Done',
|
||||
init: function() {
|
||||
console.log("colorpicker initiated");
|
||||
},
|
||||
beforeShow: function() {
|
||||
console.log("before show");
|
||||
},
|
||||
afterShow: function() {
|
||||
console.log("after show");
|
||||
},
|
||||
beforeHide: function() {
|
||||
console.log("before hide");
|
||||
},
|
||||
afterHide: function() {
|
||||
console.log("after hide");
|
||||
},
|
||||
beforeHourSelect: function() {
|
||||
console.log("before hour selected");
|
||||
},
|
||||
afterHourSelect: function() {
|
||||
console.log("after hour selected");
|
||||
},
|
||||
beforeDone: function() {
|
||||
console.log("before done");
|
||||
},
|
||||
afterDone: function() {
|
||||
console.log("after done");
|
||||
}
|
||||
});
|
||||
|
||||
// Manually toggle to the minutes view
|
||||
$('#check-minutes').click(function(e) {
|
||||
// Have to stop propagation here
|
||||
e.stopPropagation();
|
||||
input.clockpicker('show')
|
||||
.clockpicker('toggleView', 'minutes');
|
||||
});
|
||||
496
dist/js/pages/forms/datetimepicker/datetimepicker.init.js
vendored
Normal file
496
dist/js/pages/forms/datetimepicker/datetimepicker.init.js
vendored
Normal file
@@ -0,0 +1,496 @@
|
||||
/***********************************/
|
||||
// Basic date
|
||||
/***********************************/
|
||||
$('.pickadate').pickadate();
|
||||
|
||||
/***********************************/
|
||||
// Change Day & Month strings
|
||||
/***********************************/
|
||||
$('.pickadate-short-string').pickadate({
|
||||
weekdaysShort: ['S', 'M', 'Tu', 'W', 'Th', 'F', 'S'],
|
||||
showMonthsShort: true
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Select Year
|
||||
/***********************************/
|
||||
$('.pickadate-select-year').pickadate({
|
||||
selectYears: 8
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Change first weekday
|
||||
/***********************************/
|
||||
$('.pickadate-firstweek').pickadate({
|
||||
firstDay: 1
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Button options
|
||||
/***********************************/
|
||||
$('.pickadate-clear-buttons').pickadate({
|
||||
today: '',
|
||||
close: 'Close Picker',
|
||||
clear: ''
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Date limits
|
||||
/***********************************/
|
||||
$('.pickadate-datelimits').pickadate({
|
||||
min: [2016, 8, 20],
|
||||
max: [2016, 10, 30]
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Format options
|
||||
/***********************************/
|
||||
$('.pickadate-change-format').pickadate({
|
||||
// Escape any 'rule' characters with an exclamation mark (!).
|
||||
format: 'Selecte!d Date : dddd, dd mmmm, yyyy',
|
||||
formatSubmit: 'mm/dd/yyyy',
|
||||
hiddenPrefix: 'prefix__',
|
||||
hiddenSuffix: '__suffix'
|
||||
});
|
||||
|
||||
$('.pickadate-changearrow').pickadate({
|
||||
monthPrev: '←',
|
||||
monthNext: '→',
|
||||
weekdaysShort: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
||||
showMonthsFull: false
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Disable weekday range
|
||||
/***********************************/
|
||||
$('.pickadate-disable-week').pickadate({
|
||||
disable: [
|
||||
3
|
||||
]
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Disable dates
|
||||
/***********************************/
|
||||
$('.pickadate-disable-arbitrarydates').pickadate({
|
||||
disable: [
|
||||
[2016, 5, 10],
|
||||
[2016, 5, 15],
|
||||
[2016, 5, 20]
|
||||
]
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Month & Year selectors
|
||||
/***********************************/
|
||||
$('.pickadate-selectors').pickadate({
|
||||
labelMonthNext: 'Next month',
|
||||
labelMonthPrev: 'Previous month',
|
||||
labelMonthSelect: 'Pick a Month',
|
||||
labelYearSelect: 'Pick a Year',
|
||||
selectMonths: true,
|
||||
selectYears: true
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// With Select
|
||||
/***********************************/
|
||||
$('.pickadate-monyear-dropdown').pickadate({
|
||||
selectMonths: true,
|
||||
selectYears: true
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Events
|
||||
/***********************************/
|
||||
$('.pickadate-events').pickadate({
|
||||
onStart: function() {
|
||||
console.log('Hi there!!!');
|
||||
},
|
||||
onRender: function() {
|
||||
console.log('Holla... rendered new');
|
||||
},
|
||||
onOpen: function() {
|
||||
console.log('Picker Opened');
|
||||
},
|
||||
onClose: function() {
|
||||
console.log("I'm Closed now");
|
||||
},
|
||||
onStop: function() {
|
||||
console.log('Have a great day ahead!!');
|
||||
},
|
||||
onSet: function(context) {
|
||||
console.log('All stuff:', context);
|
||||
}
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Picker Translations
|
||||
/***********************************/
|
||||
$('.pickadate-translations').pickadate({
|
||||
formatSubmit: 'dd/mm/yyyy',
|
||||
monthsFull: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
|
||||
monthsShort: ['Jan', 'Fev', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Aou', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
weekdaysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
|
||||
today: 'aujourd\'hui',
|
||||
clear: 'clair',
|
||||
close: 'Fermer'
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Picker min-max range
|
||||
/***********************************/
|
||||
$('.pickadate-minmax').pickadate({
|
||||
dateMin: -8,
|
||||
dateMax: true
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Date Range from & to
|
||||
/***********************************/
|
||||
var from_$input = $('#picker_from').pickadate(),
|
||||
from_picker = from_$input.pickadate('picker');
|
||||
|
||||
var to_$input = $('#picker_to').pickadate(),
|
||||
to_picker = to_$input.pickadate('picker');
|
||||
|
||||
|
||||
if (from_picker.get('value')) {
|
||||
to_picker.set('min', from_picker.get('select'));
|
||||
}
|
||||
if (to_picker.get('value')) {
|
||||
from_picker.set('max', to_picker.get('select'));
|
||||
}
|
||||
|
||||
from_picker.on('set', function(event) {
|
||||
if (event.select) {
|
||||
to_picker.set('min', from_picker.get('select'));
|
||||
} else if ('clear' in event) {
|
||||
to_picker.set('min', false);
|
||||
}
|
||||
});
|
||||
to_picker.on('set', function(event) {
|
||||
if (event.select) {
|
||||
from_picker.set('max', to_picker.get('select'));
|
||||
} else if ('clear' in event) {
|
||||
from_picker.set('max', false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/***********************************/
|
||||
//Pick-a-time Picker
|
||||
/***********************************/
|
||||
/***********************************/
|
||||
// Basic time
|
||||
/***********************************/
|
||||
$('.pickatime').pickatime();
|
||||
|
||||
/***********************************/
|
||||
// Hide Button
|
||||
/***********************************/
|
||||
$('.pickatime-button').pickatime({
|
||||
clear: '',
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Format options
|
||||
/***********************************/
|
||||
$('.pickatime-format').pickatime({
|
||||
format: 'T!ime selected: h:i a',
|
||||
formatLabel: 'h:i a',
|
||||
formatSubmit: 'HH:i',
|
||||
hiddenPrefix: 'prefix__',
|
||||
hiddenSuffix: '__suffix'
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Format options
|
||||
/***********************************/
|
||||
$('.pickatime-formatTime-display').pickatime({
|
||||
format: 'T!ime selected: h:i a',
|
||||
formatLabel: '<b>h</b>:i <!i>a</!i>',
|
||||
formatSubmit: 'HH:i',
|
||||
hiddenPrefix: 'prefix__',
|
||||
hiddenSuffix: '__suffix'
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Format options
|
||||
/***********************************/
|
||||
$('.pickatime-format-label').pickatime({
|
||||
formatLabel: function(time) {
|
||||
var hours = (time.pick - this.get('now').pick) / 60,
|
||||
label = hours < 0 ? ' !hours to now' : hours > 0 ? ' !hours from now' : 'now';
|
||||
return 'h:i a <sm!all>' + (hours ? Math.abs(hours) : '') + label + '</sm!all>';
|
||||
}
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Date range to select
|
||||
/***********************************/
|
||||
$('.pickatime-minmax-range').pickatime({
|
||||
min: new Date(2018, 3, 20, 7),
|
||||
max: new Date(2018, 7, 14, 18, 30)
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Time using Integer & Boolean
|
||||
/***********************************/
|
||||
$('.pickatime-time-limits').pickatime({
|
||||
min: -5,
|
||||
max: true
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Intervals
|
||||
/***********************************/
|
||||
$('.pickatime-intervals').pickatime({
|
||||
interval: 150
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Diasable Time sets
|
||||
/***********************************/
|
||||
$('.pickatime-disable').pickatime({
|
||||
// Disable Using Javascript
|
||||
disable: [
|
||||
new Date(2016, 3, 20, 4, 30),
|
||||
new Date(2016, 3, 20, 9)
|
||||
]
|
||||
// Disable Using Array
|
||||
/*disable: [
|
||||
[0,30],
|
||||
[2,0],
|
||||
[8,30],
|
||||
[9,0]
|
||||
]*/
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Disable using integers
|
||||
/***********************************/
|
||||
$('.pickatime-timedisable-integer').pickatime({
|
||||
disable: [
|
||||
3, 5, 7, 13, 17, 21
|
||||
]
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Disable using object
|
||||
/***********************************/
|
||||
$('.pickatime-timedisable-object').pickatime({
|
||||
disable: [
|
||||
{ from: [2, 0], to: [5, 30] }
|
||||
]
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Disable All
|
||||
/***********************************/
|
||||
$('.pickatime-disable-all').pickatime({
|
||||
disable: [
|
||||
true,
|
||||
3, 5, 7, [0, 30],
|
||||
[2, 0],
|
||||
[8, 30],
|
||||
[9, 0]
|
||||
]
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Close on a user action
|
||||
/***********************************/
|
||||
$('.pickatime-closeuser-action').pickatime({
|
||||
closeOnSelect: false,
|
||||
closeOnClear: false
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Events
|
||||
/***********************************/
|
||||
$('.pickatime-events').pickatime({
|
||||
onStart: function() {
|
||||
console.log('Hello there :)');
|
||||
},
|
||||
onRender: function() {
|
||||
console.log('Whoa.. rendered anew');
|
||||
},
|
||||
onOpen: function() {
|
||||
console.log('Opened up');
|
||||
},
|
||||
onClose: function() {
|
||||
console.log("Closed now");
|
||||
},
|
||||
onStop: function() {
|
||||
console.log('See ya.');
|
||||
},
|
||||
onSet: function(context) {
|
||||
console.log('Just set stuff:', context);
|
||||
}
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Picker Translations
|
||||
/***********************************/
|
||||
$('.pickatime-translations').pickatime({
|
||||
formatSubmit: 'dd/mm/yyyy',
|
||||
monthsFull: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
|
||||
monthsShort: ['Jan', 'Fev', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Aou', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
weekdaysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
|
||||
today: 'aujourd\'hui',
|
||||
clear: 'clair',
|
||||
close: 'Fermer'
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Basic Date Range Picker
|
||||
/***********************************/
|
||||
$('.daterange').daterangepicker();
|
||||
|
||||
/***********************************/
|
||||
// Date & Time
|
||||
/***********************************/
|
||||
$('.datetime').daterangepicker({
|
||||
timePicker: true,
|
||||
timePickerIncrement: 30,
|
||||
locale: {
|
||||
format: 'MM/DD/YYYY h:mm A'
|
||||
}
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
//Calendars are not linked
|
||||
/***********************************/
|
||||
$('.timeseconds').daterangepicker({
|
||||
timePicker: true,
|
||||
timePickerIncrement: 30,
|
||||
timePicker24Hour: true,
|
||||
timePickerSeconds: true,
|
||||
locale: {
|
||||
format: 'MM-DD-YYYY h:mm:ss'
|
||||
}
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Single Date Range Picker
|
||||
/***********************************/
|
||||
$('.singledate').daterangepicker({
|
||||
singleDatePicker: true,
|
||||
showDropdowns: true
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Auto Apply Date Range
|
||||
/***********************************/
|
||||
$('.autoapply').daterangepicker({
|
||||
autoApply: true,
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Calendars are not linked
|
||||
/***********************************/
|
||||
$('.linkedCalendars').daterangepicker({
|
||||
linkedCalendars: false,
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Date Limit
|
||||
/***********************************/
|
||||
$('.dateLimit').daterangepicker({
|
||||
dateLimit: {
|
||||
days: 7
|
||||
},
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Show Dropdowns
|
||||
/***********************************/
|
||||
$('.showdropdowns').daterangepicker({
|
||||
showDropdowns: true,
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Show Week Numbers
|
||||
/***********************************/
|
||||
$('.showweeknumbers').daterangepicker({
|
||||
showWeekNumbers: true,
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Date Ranges
|
||||
/***********************************/
|
||||
$('.dateranges').daterangepicker({
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
}
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Always Show Calendar on Ranges
|
||||
/***********************************/
|
||||
$('.shawCalRanges').daterangepicker({
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
},
|
||||
alwaysShowCalendars: true,
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Date Limit
|
||||
/***********************************/
|
||||
$('.openRight').daterangepicker({
|
||||
opens: "left" // left/right/center
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Date Limit
|
||||
/***********************************/
|
||||
$('.drops').daterangepicker({
|
||||
drops: "up" // up/down
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// Date Limit
|
||||
/***********************************/
|
||||
$('.buttonClass').daterangepicker({
|
||||
drops: "up",
|
||||
buttonClasses: "btn",
|
||||
applyClass: "btn-info",
|
||||
cancelClass: "btn-danger"
|
||||
});
|
||||
|
||||
/***********************************/
|
||||
// language
|
||||
/***********************************/
|
||||
$('.localeRange').daterangepicker({
|
||||
ranges: {
|
||||
"Aujourd'hui": [moment(), moment()],
|
||||
'Hier': [moment().subtract('days', 1), moment().subtract('days', 1)],
|
||||
'Les 7 derniers jours': [moment().subtract('days', 6), moment()],
|
||||
'Les 30 derniers jours': [moment().subtract('days', 29), moment()],
|
||||
'Ce mois-ci': [moment().startOf('month'), moment().endOf('month')],
|
||||
'le mois dernier': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
|
||||
},
|
||||
locale: {
|
||||
applyLabel: "Vers l'avant",
|
||||
cancelLabel: 'Annulation',
|
||||
startLabel: 'Date initiale',
|
||||
endLabel: 'Date limite',
|
||||
customRangeLabel: 'Sélectionner une date',
|
||||
// daysOfWeek: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi','Samedi'],
|
||||
daysOfWeek: ['Di', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa'],
|
||||
monthNames: ['Janvier', 'février', 'Mars', 'Avril', 'Маi', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Decembre'],
|
||||
firstDay: 1
|
||||
}
|
||||
});
|
||||
86
dist/js/pages/forms/dual-listbox/dual-listbox.js
vendored
Normal file
86
dist/js/pages/forms/dual-listbox/dual-listbox.js
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
//********************************//
|
||||
//initialization of dualbox
|
||||
//********************************//
|
||||
// Basic Dual Listbox
|
||||
//********************************//
|
||||
$('.duallistbox').bootstrapDualListbox();
|
||||
|
||||
//********************************//
|
||||
// Without Filter
|
||||
//********************************//
|
||||
$('.duallistbox-no-filter').bootstrapDualListbox({
|
||||
showFilterInputs: false
|
||||
});
|
||||
|
||||
//********************************//
|
||||
// Multi selection Dual Listbox
|
||||
//********************************//
|
||||
$('.duallistbox-multi-selection').bootstrapDualListbox({
|
||||
nonSelectedListLabel: 'Non-selected Dual',
|
||||
selectedListLabel: 'Selected',
|
||||
preserveSelectionOnMove: 'moved',
|
||||
moveOnSelect: false
|
||||
});
|
||||
|
||||
//********************************//
|
||||
//With Filter Options
|
||||
//********************************//
|
||||
$('.duallistbox-with-filter').bootstrapDualListbox({
|
||||
nonSelectedListLabel: 'Non-selected Dual',
|
||||
selectedListLabel: 'Selected',
|
||||
preserveSelectionOnMove: 'moved',
|
||||
moveOnSelect: false,
|
||||
nonSelectedFilter: 'Berlin|Frankfurt'
|
||||
});
|
||||
|
||||
//********************************//
|
||||
// for font awesome
|
||||
//********************************//
|
||||
$(function() {
|
||||
|
||||
$('.moveall i').removeClass().addClass('fas fa-angle-right');
|
||||
$('.removeall i').removeClass().addClass('fas fa-angle-left');
|
||||
$('.move i').removeClass().addClass('fas fa-angle-right');
|
||||
$('.remove i').removeClass().addClass('fas fa-angle-left');
|
||||
});
|
||||
|
||||
//********************************//
|
||||
// Custom Text Support
|
||||
//********************************//
|
||||
$('.duallistbox-custom-text').bootstrapDualListbox({
|
||||
moveOnSelect: false,
|
||||
filterTextClear: "Show All Options",
|
||||
filterPlaceHolder: "Filter Options",
|
||||
infoText: 'Showing {0} Option(s)',
|
||||
infoTextFiltered: '<span class="badge badge-info">Filtered List</span> {0} from {1}',
|
||||
infoTextEmpty: 'No Options Listed',
|
||||
});
|
||||
|
||||
//********************************//
|
||||
//Custom Height
|
||||
//********************************//
|
||||
$('.duallistbox-custom-height').bootstrapDualListbox({
|
||||
moveOnSelect: false,
|
||||
selectorMinimalHeight: 250
|
||||
});
|
||||
|
||||
//********************************//
|
||||
// Add dynamic Option
|
||||
//********************************//
|
||||
var duallistboxDynamic = $('.duallistbox-dynamic').bootstrapDualListbox({
|
||||
moveOnSelect: false
|
||||
});
|
||||
var numb = 25;
|
||||
$(".duallistbox-add").on('click', function() {
|
||||
var opt1 = numb + 1;
|
||||
var opt2 = numb + 2;
|
||||
duallistboxDynamic.append('<option value="' + opt1 + '">London</option><option value="' + opt2 + '" selected>Rome</option>');
|
||||
duallistboxDynamic.bootstrapDualListbox('refresh');
|
||||
});
|
||||
|
||||
$(".duallistbox-add-clear").on('click', function() {
|
||||
var opt1 = numb + 1;
|
||||
var opt2 = numb + 2;
|
||||
duallistboxDynamic.append('<option value="' + opt1 + '">London</option><option value="' + opt2 + '" selected>Rome</option>');
|
||||
duallistboxDynamic.bootstrapDualListbox('refresh', true);
|
||||
});
|
||||
275
dist/js/pages/forms/img-cropper/cropper.init.js
vendored
Normal file
275
dist/js/pages/forms/img-cropper/cropper.init.js
vendored
Normal file
@@ -0,0 +1,275 @@
|
||||
$(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var console = window.console || { log: function () {} };
|
||||
var URL = window.URL || window.webkitURL;
|
||||
var $image = $('#image');
|
||||
var $download = $('#download');
|
||||
var $dataX = $('#dataX');
|
||||
var $dataY = $('#dataY');
|
||||
var $dataHeight = $('#dataHeight');
|
||||
var $dataWidth = $('#dataWidth');
|
||||
var $dataRotate = $('#dataRotate');
|
||||
var $dataScaleX = $('#dataScaleX');
|
||||
var $dataScaleY = $('#dataScaleY');
|
||||
var options = {
|
||||
aspectRatio: 16 / 9,
|
||||
preview: '.img-preview',
|
||||
crop: function (e) {
|
||||
$dataX.val(Math.round(e.detail.x));
|
||||
$dataY.val(Math.round(e.detail.y));
|
||||
$dataHeight.val(Math.round(e.detail.height));
|
||||
$dataWidth.val(Math.round(e.detail.width));
|
||||
$dataRotate.val(e.detail.rotate);
|
||||
$dataScaleX.val(e.detail.scaleX);
|
||||
$dataScaleY.val(e.detail.scaleY);
|
||||
}
|
||||
};
|
||||
var originalImageURL = $image.attr('src');
|
||||
var uploadedImageName = 'cropped.jpg';
|
||||
var uploadedImageType = 'image/jpeg';
|
||||
var uploadedImageURL;
|
||||
|
||||
|
||||
// Tooltip
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
|
||||
// Cropper
|
||||
$image.on({
|
||||
ready: function (e) {
|
||||
console.log(e.type);
|
||||
},
|
||||
cropstart: function (e) {
|
||||
console.log(e.type, e.detail.action);
|
||||
},
|
||||
cropmove: function (e) {
|
||||
console.log(e.type, e.detail.action);
|
||||
},
|
||||
cropend: function (e) {
|
||||
console.log(e.type, e.detail.action);
|
||||
},
|
||||
crop: function (e) {
|
||||
console.log(e.type);
|
||||
},
|
||||
zoom: function (e) {
|
||||
console.log(e.type, e.detail.ratio);
|
||||
}
|
||||
}).cropper(options);
|
||||
|
||||
|
||||
// Buttons
|
||||
if (!$.isFunction(document.createElement('canvas').getContext)) {
|
||||
$('button[data-method="getCroppedCanvas"]').prop('disabled', true);
|
||||
}
|
||||
|
||||
if (typeof document.createElement('cropper').style.transition === 'undefined') {
|
||||
$('button[data-method="rotate"]').prop('disabled', true);
|
||||
$('button[data-method="scale"]').prop('disabled', true);
|
||||
}
|
||||
|
||||
|
||||
// Download
|
||||
if (typeof $download[0].download === 'undefined') {
|
||||
$download.addClass('disabled');
|
||||
}
|
||||
|
||||
|
||||
// Options
|
||||
$('.docs-toggles').on('change', 'input', function () {
|
||||
var $this = $(this);
|
||||
var name = $this.attr('name');
|
||||
var type = $this.prop('type');
|
||||
var cropBoxData;
|
||||
var canvasData;
|
||||
|
||||
if (!$image.data('cropper')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === 'checkbox') {
|
||||
options[name] = $this.prop('checked');
|
||||
cropBoxData = $image.cropper('getCropBoxData');
|
||||
canvasData = $image.cropper('getCanvasData');
|
||||
|
||||
options.ready = function () {
|
||||
$image.cropper('setCropBoxData', cropBoxData);
|
||||
$image.cropper('setCanvasData', canvasData);
|
||||
};
|
||||
} else if (type === 'radio') {
|
||||
options[name] = $this.val();
|
||||
}
|
||||
|
||||
$image.cropper('destroy').cropper(options);
|
||||
});
|
||||
|
||||
|
||||
// Methods
|
||||
$('.docs-buttons').on('click', '[data-method]', function () {
|
||||
var $this = $(this);
|
||||
var data = $this.data();
|
||||
var cropper = $image.data('cropper');
|
||||
var cropped;
|
||||
var $target;
|
||||
var result;
|
||||
|
||||
if ($this.prop('disabled') || $this.hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cropper && data.method) {
|
||||
data = $.extend({}, data); // Clone a new one
|
||||
|
||||
if (typeof data.target !== 'undefined') {
|
||||
$target = $(data.target);
|
||||
|
||||
if (typeof data.option === 'undefined') {
|
||||
try {
|
||||
data.option = JSON.parse($target.val());
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cropped = cropper.cropped;
|
||||
|
||||
switch (data.method) {
|
||||
case 'rotate':
|
||||
if (cropped && options.viewMode > 0) {
|
||||
$image.cropper('clear');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'getCroppedCanvas':
|
||||
if (uploadedImageType === 'image/jpeg') {
|
||||
if (!data.option) {
|
||||
data.option = {};
|
||||
}
|
||||
|
||||
data.option.fillColor = '#fff';
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
result = $image.cropper(data.method, data.option, data.secondOption);
|
||||
|
||||
switch (data.method) {
|
||||
case 'rotate':
|
||||
if (cropped && options.viewMode > 0) {
|
||||
$image.cropper('crop');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'scaleX':
|
||||
case 'scaleY':
|
||||
$(this).data('option', -data.option);
|
||||
break;
|
||||
|
||||
case 'getCroppedCanvas':
|
||||
if (result) {
|
||||
// Bootstrap's Modal
|
||||
$('#getCroppedCanvasModal').modal().find('.modal-body').html(result);
|
||||
|
||||
if (!$download.hasClass('disabled')) {
|
||||
download.download = uploadedImageName;
|
||||
$download.attr('href', result.toDataURL(uploadedImageType));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'destroy':
|
||||
if (uploadedImageURL) {
|
||||
URL.revokeObjectURL(uploadedImageURL);
|
||||
uploadedImageURL = '';
|
||||
$image.attr('src', originalImageURL);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ($.isPlainObject(result) && $target) {
|
||||
try {
|
||||
$target.val(JSON.stringify(result));
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Keyboard
|
||||
$(document.body).on('keydown', function (e) {
|
||||
|
||||
if (!$image.data('cropper') || this.scrollTop > 300) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (e.which) {
|
||||
case 37:
|
||||
e.preventDefault();
|
||||
$image.cropper('move', -1, 0);
|
||||
break;
|
||||
|
||||
case 38:
|
||||
e.preventDefault();
|
||||
$image.cropper('move', 0, -1);
|
||||
break;
|
||||
|
||||
case 39:
|
||||
e.preventDefault();
|
||||
$image.cropper('move', 1, 0);
|
||||
break;
|
||||
|
||||
case 40:
|
||||
e.preventDefault();
|
||||
$image.cropper('move', 0, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Import image
|
||||
var $inputImage = $('#inputImage');
|
||||
|
||||
if (URL) {
|
||||
$inputImage.change(function () {
|
||||
var files = this.files;
|
||||
var file;
|
||||
|
||||
if (!$image.data('cropper')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (files && files.length) {
|
||||
file = files[0];
|
||||
|
||||
if (/^image\/\w+$/.test(file.type)) {
|
||||
uploadedImageName = file.name;
|
||||
uploadedImageType = file.type;
|
||||
|
||||
if (uploadedImageURL) {
|
||||
URL.revokeObjectURL(uploadedImageURL);
|
||||
}
|
||||
|
||||
uploadedImageURL = URL.createObjectURL(file);
|
||||
$image.cropper('destroy').attr('src', uploadedImageURL).cropper(options);
|
||||
$inputImage.val('');
|
||||
} else {
|
||||
window.alert('Please choose an image file.');
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$inputImage.prop('disabled', true).parent().addClass('disabled');
|
||||
}
|
||||
|
||||
});
|
||||
32
dist/js/pages/forms/mask/mask.init.js
vendored
Normal file
32
dist/js/pages/forms/mask/mask.init.js
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
$(function(e) {
|
||||
"use strict";
|
||||
$(".date-inputmask").inputmask("dd/mm/yyyy"),
|
||||
$(".phone-inputmask").inputmask("(999) 999-9999"),
|
||||
$(".international-inputmask").inputmask("+9(999)999-9999"),
|
||||
$(".xphone-inputmask").inputmask("(999) 999-9999 / x999999"),
|
||||
$(".purchase-inputmask").inputmask("aaaa 9999-****"),
|
||||
$(".cc-inputmask").inputmask("9999 9999 9999 9999"),
|
||||
$(".ssn-inputmask").inputmask("999-99-9999"),
|
||||
$(".isbn-inputmask").inputmask("999-99-999-9999-9"),
|
||||
$(".currency-inputmask").inputmask("$9999"),
|
||||
$(".percentage-inputmask").inputmask("99%"),
|
||||
$(".decimal-inputmask").inputmask({
|
||||
alias: "decimal"
|
||||
, radixPoint: "."
|
||||
}),
|
||||
|
||||
$(".email-inputmask").inputmask({
|
||||
mask: "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[*{2,6}][*{1,2}].*{1,}[.*{2,6}][.*{1,2}]"
|
||||
, greedy: !1
|
||||
, onBeforePaste: function (n, a) {
|
||||
return (e = e.toLowerCase()).replace("mailto:", "")
|
||||
}
|
||||
, definitions: {
|
||||
"*": {
|
||||
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~/-]"
|
||||
, cardinality: 1
|
||||
, casing: "lower"
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
367
dist/js/pages/forms/select2/select2.init.js
vendored
Normal file
367
dist/js/pages/forms/select2/select2.init.js
vendored
Normal file
@@ -0,0 +1,367 @@
|
||||
/*************************************************************************************/
|
||||
// -->Template Name: Bootstrap Press Admin
|
||||
// -->Author: Themedesigner
|
||||
// -->Email: niravjoshi87@gmail.com
|
||||
// -->File: c3_chart_JS
|
||||
/*************************************************************************************/
|
||||
|
||||
//***********************************//
|
||||
//initialization of select2
|
||||
//***********************************//
|
||||
|
||||
//***********************************//
|
||||
// For select 2
|
||||
//***********************************//
|
||||
$(".select2").select2();
|
||||
|
||||
// Single Select Placeholder
|
||||
$("#select2-with-placeholder").select2({
|
||||
placeholder: "Select a state",
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
// Hiding the search box
|
||||
//***********************************//
|
||||
$("#select2-search-hide").select2({
|
||||
minimumResultsForSearch: Infinity
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
// Select With Icon
|
||||
//***********************************//
|
||||
$("#select2-with-icons").select2({
|
||||
minimumResultsForSearch: Infinity,
|
||||
templateResult: iconFormat,
|
||||
templateSelection: iconFormat,
|
||||
escapeMarkup: function(es) { return es; }
|
||||
});
|
||||
|
||||
function iconFormat(icon) {
|
||||
var originalOption = icon.element;
|
||||
if (!icon.id) { return icon.text; }
|
||||
var $icon = "<i class='fab fa-" + $(icon.element).data('icon') + "'></i>" + icon.text;
|
||||
return $icon;
|
||||
}
|
||||
|
||||
//***********************************//
|
||||
// Limiting the number of selections
|
||||
//***********************************//
|
||||
$("#select2-max-length").select2({
|
||||
maximumSelectionLength: 3,
|
||||
placeholder: "Select only maximum 3 items"
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
//multiple-select2-with-icons
|
||||
//***********************************//
|
||||
$("#multiple-select2-with-icons").select2({
|
||||
minimumResultsForSearch: Infinity,
|
||||
templateResult: iconFormat,
|
||||
templateSelection: iconFormat,
|
||||
escapeMarkup: function(es) { return es; }
|
||||
});
|
||||
|
||||
function iconFormat(icon) {
|
||||
var originalOption = icon.element;
|
||||
if (!icon.id) { return icon.text; }
|
||||
var $icon = "<i class='fab fa-" + $(icon.element).data('icon') + "'></i>" + icon.text;
|
||||
return $icon;
|
||||
}
|
||||
|
||||
//***********************************//
|
||||
// DOM Events
|
||||
//***********************************//
|
||||
var $selectEvent = $(".js-events");
|
||||
$selectEvent.select2({
|
||||
placeholder: "DOM Events"
|
||||
});
|
||||
$selectEvent.on("select2:open", function(e) {
|
||||
alert("Open Event Fired.");
|
||||
});
|
||||
$selectEvent.on("select2:close", function(e) {
|
||||
alert("Close Event Fired.");
|
||||
});
|
||||
$selectEvent.on("select2:select", function(e) {
|
||||
alert("Select Event Fired.");
|
||||
});
|
||||
$selectEvent.on("select2:unselect", function(e) {
|
||||
alert("Unselect Event Fired.");
|
||||
});
|
||||
|
||||
$selectEvent.on("change", function(e) {
|
||||
alert("Change Event Fired.");
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
// Programmatic access
|
||||
//***********************************//
|
||||
var $select = $(".js-programmatic").select2();
|
||||
var $selectMulti = $(".js-programmatic-multiple").select2();
|
||||
$selectMulti.select2({
|
||||
placeholder: "Programmatic Events"
|
||||
});
|
||||
$(".js-programmatic-set-val").on("click", function() { $select.val("NM").trigger("change"); });
|
||||
|
||||
$(".js-programmatic-open").on("click", function() { $select.select2("open"); });
|
||||
$(".js-programmatic-close").on("click", function() { $select.select2("close"); });
|
||||
|
||||
$(".js-programmatic-init").on("click", function() { $select.select2(); });
|
||||
$(".js-programmatic-destroy").on("click", function() { $select.select2("destroy"); });
|
||||
|
||||
$(".js-programmatic-multi-set-val").on("click", function() { $selectMulti.val(["UT", "NM"]).trigger("change"); });
|
||||
$(".js-programmatic-multi-clear").on("click", function() { $selectMulti.val(null).trigger("change"); });
|
||||
|
||||
//***********************************//
|
||||
// Loading array data
|
||||
//***********************************//
|
||||
var data = [
|
||||
{ id: 0, text: 'Web Designer' },
|
||||
{ id: 1, text: 'Mobile App Developer' },
|
||||
{ id: 2, text: 'Graphics Designer' },
|
||||
{ id: 3, text: 'Hacker' },
|
||||
{ id: 4, text: 'Animation Designer' }
|
||||
];
|
||||
|
||||
$("#select2-data-array").select2({
|
||||
data: data
|
||||
});
|
||||
|
||||
|
||||
//***********************************//
|
||||
// Loading remote data
|
||||
//***********************************//
|
||||
$(".select2-data-ajax").select2({
|
||||
placeholder: "Loading remote data",
|
||||
ajax: {
|
||||
url: "http://api.github.com/search/repositories",
|
||||
dataType: 'json',
|
||||
delay: 250,
|
||||
data: function(params) {
|
||||
return {
|
||||
q: params.term, // search term
|
||||
page: params.page
|
||||
};
|
||||
},
|
||||
processResults: function(data, params) {
|
||||
// parse the results into the format expected by Select2
|
||||
// since we are using custom formatting functions we do not need to
|
||||
// alter the remote JSON data, except to indicate that infinite
|
||||
// scrolling can be used
|
||||
params.page = params.page || 1;
|
||||
|
||||
return {
|
||||
results: data.items,
|
||||
pagination: {
|
||||
more: (params.page * 30) < data.total_count
|
||||
}
|
||||
};
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
escapeMarkup: function(markup) { return markup; }, // let our custom formatter work
|
||||
minimumInputLength: 1,
|
||||
templateResult: formatRepo, // omitted for brevity, see the source of this page
|
||||
templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
|
||||
});
|
||||
|
||||
function formatRepo(repo) {
|
||||
if (repo.loading) return repo.text;
|
||||
|
||||
var markup = "<div class='select2-result-repository clearfix'>" +
|
||||
"<div class='select2-result-repository__avatar'><img src='" + repo.owner.avatar_url + "' /></div>" +
|
||||
"<div class='select2-result-repository__meta'>" +
|
||||
"<div class='select2-result-repository__title'>" + repo.full_name + "</div>";
|
||||
|
||||
if (repo.description) {
|
||||
markup += "<div class='select2-result-repository__description'>" + repo.description + "</div>";
|
||||
}
|
||||
|
||||
markup += "<div class='select2-result-repository__statistics'>" +
|
||||
"<div class='select2-result-repository__forks'><i class='la la-code-fork mr-0'></i> " + repo.forks_count + " Forks</div>" +
|
||||
"<div class='select2-result-repository__stargazers'><i class='la la-star-o mr-0'></i> " + repo.stargazers_count + " Stars</div>" +
|
||||
"<div class='select2-result-repository__watchers'><i class='la la-eye mr-0'></i> " + repo.watchers_count + " Watchers</div>" +
|
||||
"</div>" +
|
||||
"</div></div>";
|
||||
|
||||
return markup;
|
||||
}
|
||||
|
||||
function formatRepoSelection(repo) {
|
||||
return repo.full_name || repo.text;
|
||||
}
|
||||
|
||||
//***********************************//
|
||||
// Multiple languages
|
||||
//***********************************//
|
||||
$("#select2-language").select2({
|
||||
language: "es"
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
// Theme support
|
||||
//***********************************//
|
||||
$("#select2-theme").select2({
|
||||
placeholder: "Classic Theme",
|
||||
theme: "classic"
|
||||
});
|
||||
|
||||
|
||||
//***********************************//
|
||||
//templete with flag icons
|
||||
//***********************************//
|
||||
$("#template-with-flag-icons").select2({
|
||||
minimumResultsForSearch: Infinity,
|
||||
templateResult: iconFormat,
|
||||
templateSelection: iconFormat,
|
||||
escapeMarkup: function(es) { return es; }
|
||||
});
|
||||
|
||||
function iconFormat(ficon) {
|
||||
var originalOption = ficon.element;
|
||||
if (!ficon.id) { return ficon.text; }
|
||||
var $ficon = "<i class='flag-icon flag-icon-" + $(ficon.element).data('flag') + "'></i>" + ficon.text;
|
||||
return $ficon;
|
||||
}
|
||||
|
||||
//***********************************//
|
||||
// Tagging support
|
||||
//***********************************//
|
||||
$("#select2-with-tags").select2({
|
||||
tags: true
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
// Automatic tokenization
|
||||
//***********************************//
|
||||
$("#select2-with-tokenizer").select2({
|
||||
tags: true,
|
||||
tokenSeparators: [',', ' ']
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
// RTL support
|
||||
//***********************************//
|
||||
$("#select2-rtl-multiple").select2({
|
||||
placeholder: "RTL Select",
|
||||
dir: "rtl"
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
// Language Files
|
||||
//***********************************//
|
||||
$("#select2-transliteration-multiple").select2({
|
||||
placeholder: "Type 'aero'",
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
// Color Options
|
||||
//***********************************//
|
||||
|
||||
//***********************************//
|
||||
// Background Color
|
||||
//***********************************//
|
||||
$('.select2-with-bg').each(function(i, obj) {
|
||||
var variation = "",
|
||||
textVariation = "",
|
||||
textColor = "";
|
||||
var color = $(this).data('bgcolor');
|
||||
variation = $(this).data('bgcolor-variation');
|
||||
textVariation = $(this).data('text-variation');
|
||||
textColor = $(this).data('text-color');
|
||||
if (textVariation !== "") {
|
||||
textVariation = " " + textVariation;
|
||||
}
|
||||
if (variation !== "") {
|
||||
variation = " bg-" + variation;
|
||||
}
|
||||
var className = "bg-" + color + variation + " " + textColor + textVariation + " border-" + color;
|
||||
|
||||
$(this).select2({
|
||||
containerCssClass: className
|
||||
});
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
// Menu Background Color
|
||||
//***********************************//
|
||||
$('.select2-with-menu-bg').each(function(i, obj) {
|
||||
var variation = "",
|
||||
textVariation = "",
|
||||
textColor = "";
|
||||
var color = $(this).data('bgcolor');
|
||||
variation = $(this).data('bgcolor-variation');
|
||||
textVariation = $(this).data('text-variation');
|
||||
textColor = $(this).data('text-color');
|
||||
if (variation !== "") {
|
||||
variation = " bg-" + variation;
|
||||
}
|
||||
if (textVariation !== "") {
|
||||
textVariation = " " + textVariation;
|
||||
}
|
||||
var className = "bg-" + color + variation + " " + textColor + textVariation + " border-" + color;
|
||||
|
||||
$(this).select2({
|
||||
dropdownCssClass: className
|
||||
});
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
// Full Background Color
|
||||
//***********************************//
|
||||
$('.select2-with-full-bg').each(function(i, obj) {
|
||||
var variation = "",
|
||||
textVariation = "",
|
||||
textColor = "";
|
||||
var color = $(this).data('bgcolor');
|
||||
variation = $(this).data('bgcolor-variation');
|
||||
textVariation = $(this).data('text-variation');
|
||||
textColor = $(this).data('text-color');
|
||||
if (variation !== "") {
|
||||
variation = " bg-" + variation;
|
||||
}
|
||||
if (textVariation !== "") {
|
||||
textVariation = " " + textVariation;
|
||||
}
|
||||
var className = "bg-" + color + variation + " " + textColor + textVariation + " border-" + color;
|
||||
|
||||
$(this).select2({
|
||||
containerCssClass: className,
|
||||
dropdownCssClass: className
|
||||
});
|
||||
});
|
||||
|
||||
$('select[data-text-color]').each(function(i, obj) {
|
||||
var text = $(this).data('text-color'),
|
||||
textVariation;
|
||||
textVariation = $(this).data('text-variation');
|
||||
if (textVariation !== "") {
|
||||
textVariation = " " + textVariation;
|
||||
}
|
||||
$(this).next(".select2").find(".select2-selection__rendered").addClass(text + textVariation);
|
||||
});
|
||||
|
||||
//***********************************//
|
||||
// Border Color
|
||||
//***********************************//
|
||||
$('.select2-with-border').each(function(i, obj) {
|
||||
var variation = "",
|
||||
textVariation = "",
|
||||
textColor = "";
|
||||
var color = $(this).data('border-color');
|
||||
textVariation = $(this).data('text-variation');
|
||||
variation = $(this).data('border-variation');
|
||||
textColor = $(this).data('text-color');
|
||||
if (textVariation !== "") {
|
||||
textVariation = " " + textVariation;
|
||||
}
|
||||
if (variation !== "") {
|
||||
variation = " border-" + variation;
|
||||
}
|
||||
|
||||
var className = "border-" + color + " " + variation + " " + textColor + textVariation;
|
||||
|
||||
$(this).select2({
|
||||
containerCssClass: className
|
||||
});
|
||||
});
|
||||
1
dist/js/pages/forms/typeahead/countries.json
vendored
Normal file
1
dist/js/pages/forms/typeahead/countries.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
["Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Åland","Azerbaijan","Bosnia and Herzegovina","Barbados","Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Saint Barthélemy","Bermuda","Brunei","Bolivia","Bonaire","Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos [Keeling] Islands","Congo","Central African Republic","Republic of the Congo","Switzerland","Ivory Coast","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica","Cuba","Cape Verde","Curacao","Christmas Island","Cyprus","Czechia","Germany","Djibouti","Denmark","Dominica","Dominican Republic","Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji","Falkland Islands","Micronesia","Faroe Islands","France","Gabon","United Kingdom","Grenada","Georgia","French Guiana","Guernsey","Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala","Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia","Ireland","Israel","Isle of Man","India","British Indian Ocean Territory","Iraq","Iran","Iceland","Italy","Jersey","Jamaica","Jordan","Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","North Korea","South Korea","Kuwait","Cayman Islands","Kazakhstan","Laos","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania","Luxembourg","Latvia","Libya","Morocco","Monaco","Moldova","Montenegro","Saint Martin","Madagascar","Marshall Islands","Macedonia","Mali","Myanmar [Burma]","Mongolia","Macao","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives","Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua","Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia","Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestine","Portugal","Palau","Paraguay","Qatar","Réunion","Romania","Serbia","Russia","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan","Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname","South Sudan","São Tomé and Príncipe","El Salvador","Sint Maarten","Syria","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand","Tajikistan","Tokelau","East Timor","Turkmenistan","Tunisia","Tonga","Turkey","Trinidad and Tobago","Tuvalu","Taiwan","Tanzania","Ukraine","Uganda","U.S. Minor Outlying Islands","United States","Uruguay","Uzbekistan","Vatican City","Saint Vincent and the Grenadines","Venezuela","British Virgin Islands","U.S. Virgin Islands","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Kosovo","Yemen","Mayotte","South Africa","Zambia","Zimbabwe"]
|
||||
1
dist/js/pages/forms/typeahead/nba.json
vendored
Normal file
1
dist/js/pages/forms/typeahead/nba.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[{ "team": "Boston Celtics" },{ "team": "Dallas Mavericks" },{ "team": "Brooklyn Nets" },{ "team": "Houston Rockets" },{ "team": "New York Knicks" },{ "team": "Memphis Grizzlies" },{ "team": "Philadelphia 76ers" },{ "team": "New Orleans Hornets" },{ "team": "Toronto Raptors" },{ "team": "San Antonio Spurs" },{ "team": "Chicago Bulls" },{ "team": "Denver Nuggets" },{ "team": "Cleveland Cavaliers" },{ "team": "Minnesota Timberwolves" },{ "team": "Detroit Pistons" },{ "team": "Portland Trail Blazers" },{ "team": "Indiana Pacers" },{ "team": "Oklahoma City Thunder" },{ "team": "Milwaukee Bucks" },{ "team": "Utah Jazz" },{ "team": "Atlanta Hawks" },{ "team": "Golden State Warriors" },{ "team": "Charlotte Bobcats" },{ "team": "Los Angeles Clippers" },{ "team": "Miami Heat" },{ "team": "Los Angeles Lakers" },{ "team": "Orlando Magic" },{ "team": "Phoenix Suns" },{ "team": "Washington Wizards" },{ "team": "Sacramento Kings" }]
|
||||
34
dist/js/pages/forms/typeahead/nfl.json
vendored
Normal file
34
dist/js/pages/forms/typeahead/nfl.json
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
[
|
||||
{ "team": "San Francisco 49ers" },
|
||||
{ "team": "Chicago Bears" },
|
||||
{ "team": "Cincinnati Bengals" },
|
||||
{ "team": "Buffalo Bills" },
|
||||
{ "team": "Denver Broncos" },
|
||||
{ "team": "Cleveland Browns" },
|
||||
{ "team": "Tampa Bay Buccaneers" },
|
||||
{ "team": "Arizona Cardinals" },
|
||||
{ "team": "San Diego Chargers" },
|
||||
{ "team": "Kansas City Chiefs" },
|
||||
{ "team": "Indianapolis Colts" },
|
||||
{ "team": "Dallas Cowboys" },
|
||||
{ "team": "Miami Dolphins" },
|
||||
{ "team": "Philadelphia Eagles" },
|
||||
{ "team": "Atlanta Falcons" },
|
||||
{ "team": "New York Giants" },
|
||||
{ "team": "Jacksonville Jaguars" },
|
||||
{ "team": "New York Jets" },
|
||||
{ "team": "Detroit Lions" },
|
||||
{ "team": "Green Bay Packers" },
|
||||
{ "team": "Carolina Panthers" },
|
||||
{ "team": "New England Patriots" },
|
||||
{ "team": "Oakland Raiders" },
|
||||
{ "team": "St.Louis Rams" },
|
||||
{ "team": "Baltimore Ravens" },
|
||||
{ "team": "Washington Redskins" },
|
||||
{ "team": "New Orlean Saints" },
|
||||
{ "team": "Seattle Seahawks" },
|
||||
{ "team": "Pittsburgh Steelers" },
|
||||
{ "team": "Houston Texans" },
|
||||
{ "team": "Tennesse Titans" },
|
||||
{ "team": "Minnesota Viking" }
|
||||
]
|
||||
1
dist/js/pages/forms/typeahead/nhl.json
vendored
Normal file
1
dist/js/pages/forms/typeahead/nhl.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[{ "team": "New Jersey Devils" },{ "team": "New York Islanders" },{ "team": "New York Rangers" },{ "team": "Philadelphia Flyers" },{ "team": "Pittsburgh Penguins" },{ "team": "Chicago Blackhawks" },{ "team": "Columbus Blue Jackets" },{ "team": "Detroit Red Wings" },{ "team": "Nashville Predators" },{ "team": "St. Louis Blues" },{ "team": "Boston Bruins" },{ "team": "Buffalo Sabres" },{ "team": "Montreal Canadiens" },{ "team": "Ottawa Senators" },{ "team": "Toronto Maple Leafs" },{ "team": "Calgary Flames" },{ "team": "Colorado Avalanche" },{ "team": "Edmonton Oilers" },{ "team": "Minnesota Wild" },{ "team": "Vancouver Canucks" },{ "team": "Carolina Hurricanes" },{ "team": "Florida Panthers" },{ "team": "Tampa Bay Lightning" },{ "team": "Washington Capitals" },{ "team": "Winnipeg Jets" },{ "team": "Anaheim Ducks" },{ "team": "Dallas Stars" },{ "team": "Los Angeles Kings" },{ "team": "Phoenix Coyotes" },{ "team": "San Jose Sharks" }]
|
||||
148
dist/js/pages/forms/typeahead/typeahead.init.js
vendored
Normal file
148
dist/js/pages/forms/typeahead/typeahead.init.js
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
//*************
|
||||
//The basics
|
||||
//*************
|
||||
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`
|
||||
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
|
||||
$.each(strs, function(i, str) {
|
||||
if (substrRegex.test(str)) {
|
||||
matches.push(str);
|
||||
}
|
||||
});
|
||||
|
||||
cb(matches);
|
||||
};
|
||||
};
|
||||
|
||||
var states = ["Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Åland","Azerbaijan","Bosnia and Herzegovina","Barbados","Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Saint Barthélemy","Bermuda","Brunei","Bolivia","Bonaire","Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos [Keeling] Islands","Congo","Central African Republic","Republic of the Congo","Switzerland","Ivory Coast","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica","Cuba","Cape Verde","Curacao","Christmas Island","Cyprus","Czechia","Germany","Djibouti","Denmark","Dominica","Dominican Republic","Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji","Falkland Islands","Micronesia","Faroe Islands","France","Gabon","United Kingdom","Grenada","Georgia","French Guiana","Guernsey","Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala","Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia","Ireland","Israel","Isle of Man","India","British Indian Ocean Territory","Iraq","Iran","Iceland","Italy","Jersey","Jamaica","Jordan","Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","North Korea","South Korea","Kuwait","Cayman Islands","Kazakhstan","Laos","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania","Luxembourg","Latvia","Libya","Morocco","Monaco","Moldova","Montenegro","Saint Martin","Madagascar","Marshall Islands","Macedonia","Mali","Myanmar [Burma]","Mongolia","Macao","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives","Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua","Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia","Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestine","Portugal","Palau","Paraguay","Qatar","Réunion","Romania","Serbia","Russia","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan","Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname","South Sudan","São Tomé and Príncipe","El Salvador","Sint Maarten","Syria","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand","Tajikistan","Tokelau","East Timor","Turkmenistan","Tunisia","Tonga","Turkey","Trinidad and Tobago","Tuvalu","Taiwan","Tanzania","Ukraine","Uganda","U.S. Minor Outlying Islands","United States","Uruguay","Uzbekistan","Vatican City","Saint Vincent and the Grenadines","Venezuela","British Virgin Islands","U.S. Virgin Islands","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Kosovo","Yemen","Mayotte","South Africa","Zambia","Zimbabwe"];;
|
||||
|
||||
|
||||
$('#the-basics .typeahead').typeahead({
|
||||
hint: true,
|
||||
highlight: true,
|
||||
minLength: 1
|
||||
},
|
||||
{
|
||||
name: 'states',
|
||||
source: substringMatcher(states)
|
||||
});
|
||||
|
||||
// ---------- Bloodhound ----------
|
||||
|
||||
// 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
|
||||
});
|
||||
|
||||
|
||||
// -------- Prefatch --------
|
||||
|
||||
var countries = new Bloodhound({
|
||||
datumTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
// url points to a json file that contains an array of country names, see
|
||||
// https://github.com/twitter/typeahead.js/blob/gh-pages/data/countries.json
|
||||
prefetch: 'countries.json'
|
||||
});
|
||||
|
||||
// passing in `null` for the `options` arguments will result in the default
|
||||
// options being used
|
||||
$('#prefetch .typeahead').typeahead(null, {
|
||||
name: 'countries',
|
||||
source: countries
|
||||
});
|
||||
|
||||
// -------- Custom --------
|
||||
|
||||
var nflTeams = new Bloodhound({
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('team'),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
identify: function(obj) { return obj.team; },
|
||||
prefetch: 'nfl.json'
|
||||
});
|
||||
|
||||
function nflTeamsWithDefaults(q, sync) {
|
||||
if (q === '') {
|
||||
sync(nflTeams.get('Detroit Lions', 'Green Bay Packers', 'Chicago Bears'));
|
||||
}
|
||||
|
||||
else {
|
||||
nflTeams.search(q, sync);
|
||||
}
|
||||
}
|
||||
|
||||
$('#default-suggestions .typeahead').typeahead({
|
||||
minLength: 0,
|
||||
highlight: true
|
||||
},
|
||||
{
|
||||
name: 'nfl-teams',
|
||||
display: 'team',
|
||||
source: nflTeamsWithDefaults
|
||||
});
|
||||
|
||||
// -------- Multiple --------
|
||||
|
||||
var nbaTeams = new Bloodhound({
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('team'),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
prefetch: 'nba.json'
|
||||
});
|
||||
|
||||
var nhlTeams = new Bloodhound({
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('team'),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
prefetch: 'nhl.json'
|
||||
});
|
||||
|
||||
$('#multiple-datasets .typeahead').typeahead({
|
||||
highlight: true
|
||||
},
|
||||
{
|
||||
name: 'nba-teams',
|
||||
display: 'team',
|
||||
source: nbaTeams,
|
||||
templates: {
|
||||
header: '<h3 class="league-name">NBA Teams</h3>'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'nhl-teams',
|
||||
display: 'team',
|
||||
source: nhlTeams,
|
||||
templates: {
|
||||
header: '<h3 class="league-name">NHL Teams</h3>'
|
||||
}
|
||||
});
|
||||
|
||||
// -------- Scrollable --------
|
||||
|
||||
|
||||
|
||||
$('#scrollable-dropdown-menu .typeahead').typeahead(null, {
|
||||
name: 'states',
|
||||
limit: 10,
|
||||
source: states
|
||||
});
|
||||
40
dist/js/pages/forms/typeahead/typeahead.js.jquery.json
vendored
Normal file
40
dist/js/pages/forms/typeahead/typeahead.js.jquery.json
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"licenses": [
|
||||
{
|
||||
"url": "https://github.com/twitter/typeahead.js/blob/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": ">=1.7"
|
||||
},
|
||||
"docs": "https://github.com/twitter/typeahead.js",
|
||||
"demo": "http://twitter.github.com/typeahead.js/examples",
|
||||
"name": "typeahead.js",
|
||||
"title": "typeahead.js",
|
||||
"author": {
|
||||
"name": "Twitter, Inc.",
|
||||
"url": "https://twitter.com/twitteross"
|
||||
},
|
||||
"description": "fast and fully-featured autocomplete library",
|
||||
"keywords": [
|
||||
"typeahead",
|
||||
"autocomplete"
|
||||
],
|
||||
"homepage": "http://twitter.github.com/typeahead.js",
|
||||
"bugs": "https://github.com/twitter/typeahead.js/issues",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Jake Harding",
|
||||
"url": "https://twitter.com/JakeHarding"
|
||||
},
|
||||
{
|
||||
"name": "Tim Trueman",
|
||||
"url": "https://twitter.com/timtrueman"
|
||||
},
|
||||
{
|
||||
"name": "Veljko Skarich",
|
||||
"url": "https://twitter.com/vskarich"
|
||||
}
|
||||
],
|
||||
"version": "0.11.1"
|
||||
}
|
||||
Reference in New Issue
Block a user