copy dari repo om Irfan
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
(function($) {
|
||||
|
||||
|
||||
/*
|
||||
Multi Select: Toggle All Button
|
||||
*/
|
||||
function multiselect_selected($el) {
|
||||
var ret = true;
|
||||
$('option', $el).each(function(element) {
|
||||
if (!!!$(this).prop('selected')) {
|
||||
ret = false;
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
function multiselect_selectAll($el) {
|
||||
$('option', $el).each(function(element) {
|
||||
$el.multiselect('select', $(this).val());
|
||||
});
|
||||
}
|
||||
|
||||
function multiselect_deselectAll($el) {
|
||||
$('option', $el).each(function(element) {
|
||||
$el.multiselect('deselect', $(this).val());
|
||||
});
|
||||
}
|
||||
|
||||
function multiselect_toggle($el, $btn) {
|
||||
if (multiselect_selected($el)) {
|
||||
multiselect_deselectAll($el);
|
||||
$btn.text("Select All");
|
||||
} else {
|
||||
multiselect_selectAll($el);
|
||||
$btn.text("Deselect All");
|
||||
}
|
||||
}
|
||||
|
||||
$("#ms_example7-toggle").click(function(e) {
|
||||
e.preventDefault();
|
||||
multiselect_toggle($("#ms_example7"), $(this));
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
Slider Range: Output Values
|
||||
*/
|
||||
$('#listenSlider').change(function() {
|
||||
$('.output b').text(this.value);
|
||||
});
|
||||
|
||||
$('#listenSlider2').change(function() {
|
||||
var min = parseInt(this.value.split('/')[0], 10);
|
||||
var max = parseInt(this.value.split('/')[1], 10);
|
||||
|
||||
$('.output2 b.min').text(min);
|
||||
$('.output2 b.max').text(max);
|
||||
});
|
||||
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,45 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
// basic
|
||||
$("#form").validate({
|
||||
highlight: function( label ) {
|
||||
$(label).closest('.form-group').removeClass('has-success').addClass('has-error');
|
||||
},
|
||||
success: function( label ) {
|
||||
$(label).closest('.form-group').removeClass('has-error');
|
||||
label.remove();
|
||||
},
|
||||
errorPlacement: function( error, element ) {
|
||||
var placement = element.closest('.input-group');
|
||||
if (!placement.get(0)) {
|
||||
placement = element;
|
||||
}
|
||||
if (error.text() !== '') {
|
||||
placement.after(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// validation summary
|
||||
var $summaryForm = $("#summary-form");
|
||||
$summaryForm.validate({
|
||||
errorContainer: $summaryForm.find( 'div.validation-message' ),
|
||||
errorLabelContainer: $summaryForm.find( 'div.validation-message ul' ),
|
||||
wrapper: "li"
|
||||
});
|
||||
|
||||
// checkbox, radio and selects
|
||||
$("#chk-radios-form, #selects-form").each(function() {
|
||||
$(this).validate({
|
||||
highlight: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-success').addClass('has-error');
|
||||
},
|
||||
success: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-error');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}).apply( this, [ jQuery ]);
|
||||
@@ -0,0 +1,319 @@
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
Wizard #1
|
||||
*/
|
||||
var $w1finish = $('#w1').find('ul.pager li.finish'),
|
||||
$w1validator = $("#w1 form").validate({
|
||||
highlight: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-success').addClass('has-error');
|
||||
},
|
||||
success: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-error');
|
||||
$(element).remove();
|
||||
},
|
||||
errorPlacement: function( error, element ) {
|
||||
element.parent().append( error );
|
||||
}
|
||||
});
|
||||
|
||||
$w1finish.on('click', function( ev ) {
|
||||
ev.preventDefault();
|
||||
var validated = $('#w1 form').valid();
|
||||
if ( validated ) {
|
||||
new PNotify({
|
||||
title: 'Congratulations',
|
||||
text: 'You completed the wizard form.',
|
||||
type: 'custom',
|
||||
addclass: 'notification-success',
|
||||
icon: 'fa fa-check'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#w1').bootstrapWizard({
|
||||
tabClass: 'wizard-steps',
|
||||
nextSelector: 'ul.pager li.next',
|
||||
previousSelector: 'ul.pager li.previous',
|
||||
firstSelector: null,
|
||||
lastSelector: null,
|
||||
onNext: function( tab, navigation, index, newindex ) {
|
||||
var validated = $('#w1 form').valid();
|
||||
if( !validated ) {
|
||||
$w1validator.focusInvalid();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
onTabClick: function( tab, navigation, index, newindex ) {
|
||||
if ( newindex == index + 1 ) {
|
||||
return this.onNext( tab, navigation, index, newindex);
|
||||
} else if ( newindex > index + 1 ) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
onTabChange: function( tab, navigation, index, newindex ) {
|
||||
var totalTabs = navigation.find('li').size() - 1;
|
||||
$w1finish[ newindex != totalTabs ? 'addClass' : 'removeClass' ]( 'hidden' );
|
||||
$('#w1').find(this.nextSelector)[ newindex == totalTabs ? 'addClass' : 'removeClass' ]( 'hidden' );
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
Wizard #2
|
||||
*/
|
||||
var $w2finish = $('#w2').find('ul.pager li.finish'),
|
||||
$w2validator = $("#w2 form").validate({
|
||||
highlight: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-success').addClass('has-error');
|
||||
},
|
||||
success: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-error');
|
||||
$(element).remove();
|
||||
},
|
||||
errorPlacement: function( error, element ) {
|
||||
element.parent().append( error );
|
||||
}
|
||||
});
|
||||
|
||||
$w2finish.on('click', function( ev ) {
|
||||
ev.preventDefault();
|
||||
var validated = $('#w2 form').valid();
|
||||
if ( validated ) {
|
||||
new PNotify({
|
||||
title: 'Congratulations',
|
||||
text: 'You completed the wizard form.',
|
||||
type: 'custom',
|
||||
addclass: 'notification-success',
|
||||
icon: 'fa fa-check'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#w2').bootstrapWizard({
|
||||
tabClass: 'wizard-steps',
|
||||
nextSelector: 'ul.pager li.next',
|
||||
previousSelector: 'ul.pager li.previous',
|
||||
firstSelector: null,
|
||||
lastSelector: null,
|
||||
onNext: function( tab, navigation, index, newindex ) {
|
||||
var validated = $('#w2 form').valid();
|
||||
if( !validated ) {
|
||||
$w2validator.focusInvalid();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
onTabClick: function( tab, navigation, index, newindex ) {
|
||||
if ( newindex == index + 1 ) {
|
||||
return this.onNext( tab, navigation, index, newindex);
|
||||
} else if ( newindex > index + 1 ) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
onTabChange: function( tab, navigation, index, newindex ) {
|
||||
var totalTabs = navigation.find('li').size() - 1;
|
||||
$w2finish[ newindex != totalTabs ? 'addClass' : 'removeClass' ]( 'hidden' );
|
||||
$('#w2').find(this.nextSelector)[ newindex == totalTabs ? 'addClass' : 'removeClass' ]( 'hidden' );
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
Wizard #3
|
||||
*/
|
||||
var $w3finish = $('#w3').find('ul.pager li.finish'),
|
||||
$w3validator = $("#w3 form").validate({
|
||||
highlight: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-success').addClass('has-error');
|
||||
},
|
||||
success: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-error');
|
||||
$(element).remove();
|
||||
},
|
||||
errorPlacement: function( error, element ) {
|
||||
element.parent().append( error );
|
||||
}
|
||||
});
|
||||
|
||||
$w3finish.on('click', function( ev ) {
|
||||
ev.preventDefault();
|
||||
var validated = $('#w3 form').valid();
|
||||
if ( validated ) {
|
||||
new PNotify({
|
||||
title: 'Congratulations',
|
||||
text: 'You completed the wizard form.',
|
||||
type: 'custom',
|
||||
addclass: 'notification-success',
|
||||
icon: 'fa fa-check'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#w3').bootstrapWizard({
|
||||
tabClass: 'wizard-steps',
|
||||
nextSelector: 'ul.pager li.next',
|
||||
previousSelector: 'ul.pager li.previous',
|
||||
firstSelector: null,
|
||||
lastSelector: null,
|
||||
onNext: function( tab, navigation, index, newindex ) {
|
||||
var validated = $('#w3 form').valid();
|
||||
if( !validated ) {
|
||||
$w3validator.focusInvalid();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
onTabClick: function( tab, navigation, index, newindex ) {
|
||||
if ( newindex == index + 1 ) {
|
||||
return this.onNext( tab, navigation, index, newindex);
|
||||
} else if ( newindex > index + 1 ) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
onTabChange: function( tab, navigation, index, newindex ) {
|
||||
var $total = navigation.find('li').size() - 1;
|
||||
$w3finish[ newindex != $total ? 'addClass' : 'removeClass' ]( 'hidden' );
|
||||
$('#w3').find(this.nextSelector)[ newindex == $total ? 'addClass' : 'removeClass' ]( 'hidden' );
|
||||
},
|
||||
onTabShow: function( tab, navigation, index ) {
|
||||
var $total = navigation.find('li').length - 1;
|
||||
var $current = index;
|
||||
var $percent = Math.floor(( $current / $total ) * 100);
|
||||
$('#w3').find('.progress-indicator').css({ 'width': $percent + '%' });
|
||||
tab.prevAll().addClass('completed');
|
||||
tab.nextAll().removeClass('completed');
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
Wizard #4
|
||||
*/
|
||||
var $w4finish = $('#w4').find('ul.pager li.finish'),
|
||||
$w4validator = $("#w4 form").validate({
|
||||
highlight: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-success').addClass('has-error');
|
||||
},
|
||||
success: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-error');
|
||||
$(element).remove();
|
||||
},
|
||||
errorPlacement: function( error, element ) {
|
||||
element.parent().append( error );
|
||||
}
|
||||
});
|
||||
|
||||
$w4finish.on('click', function( ev ) {
|
||||
ev.preventDefault();
|
||||
var validated = $('#w4 form').valid();
|
||||
if ( validated ) {
|
||||
new PNotify({
|
||||
title: 'Congratulations',
|
||||
text: 'You completed the wizard form.',
|
||||
type: 'custom',
|
||||
addclass: 'notification-success',
|
||||
icon: 'fa fa-check'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#w4').bootstrapWizard({
|
||||
tabClass: 'wizard-steps',
|
||||
nextSelector: 'ul.pager li.next',
|
||||
previousSelector: 'ul.pager li.previous',
|
||||
firstSelector: null,
|
||||
lastSelector: null,
|
||||
onNext: function( tab, navigation, index, newindex ) {
|
||||
var validated = $('#w4 form').valid();
|
||||
if( !validated ) {
|
||||
$w4validator.focusInvalid();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
onTabClick: function( tab, navigation, index, newindex ) {
|
||||
if ( newindex == index + 1 ) {
|
||||
return this.onNext( tab, navigation, index, newindex);
|
||||
} else if ( newindex > index + 1 ) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
onTabChange: function( tab, navigation, index, newindex ) {
|
||||
var $total = navigation.find('li').size() - 1;
|
||||
$w4finish[ newindex != $total ? 'addClass' : 'removeClass' ]( 'hidden' );
|
||||
$('#w4').find(this.nextSelector)[ newindex == $total ? 'addClass' : 'removeClass' ]( 'hidden' );
|
||||
},
|
||||
onTabShow: function( tab, navigation, index ) {
|
||||
var $total = navigation.find('li').length - 1;
|
||||
var $current = index;
|
||||
var $percent = Math.floor(( $current / $total ) * 100);
|
||||
$('#w4').find('.progress-indicator').css({ 'width': $percent + '%' });
|
||||
tab.prevAll().addClass('completed');
|
||||
tab.nextAll().removeClass('completed');
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
Wizard #5
|
||||
*/
|
||||
var $w5finish = $('#w5').find('ul.pager li.finish'),
|
||||
$w5validator = $("#w5 form").validate({
|
||||
highlight: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-success').addClass('has-error');
|
||||
},
|
||||
success: function(element) {
|
||||
$(element).closest('.form-group').removeClass('has-error');
|
||||
$(element).remove();
|
||||
},
|
||||
errorPlacement: function( error, element ) {
|
||||
element.parent().append( error );
|
||||
}
|
||||
});
|
||||
|
||||
$w5finish.on('click', function( ev ) {
|
||||
ev.preventDefault();
|
||||
var validated = $('#w5 form').valid();
|
||||
if ( validated ) {
|
||||
new PNotify({
|
||||
title: 'Congratulations',
|
||||
text: 'You completed the wizard form.',
|
||||
type: 'custom',
|
||||
addclass: 'notification-success',
|
||||
icon: 'fa fa-check'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#w5').bootstrapWizard({
|
||||
tabClass: 'wizard-steps',
|
||||
nextSelector: 'ul.pager li.next',
|
||||
previousSelector: 'ul.pager li.previous',
|
||||
firstSelector: null,
|
||||
lastSelector: null,
|
||||
onNext: function( tab, navigation, index, newindex ) {
|
||||
var validated = $('#w5 form').valid();
|
||||
if( !validated ) {
|
||||
$w5validator.focusInvalid();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
onTabChange: function( tab, navigation, index, newindex ) {
|
||||
var $total = navigation.find('li').size() - 1;
|
||||
$w5finish[ newindex != $total ? 'addClass' : 'removeClass' ]( 'hidden' );
|
||||
$('#w5').find(this.nextSelector)[ newindex == $total ? 'addClass' : 'removeClass' ]( 'hidden' );
|
||||
},
|
||||
onTabShow: function( tab, navigation, index ) {
|
||||
var $total = navigation.find('li').length;
|
||||
var $current = index + 1;
|
||||
var $percent = ( $current / $total ) * 100;
|
||||
$('#w5').find('.progress-bar').css({ 'width': $percent + '%' });
|
||||
}
|
||||
});
|
||||
|
||||
}).apply( this, [ jQuery ]);
|
||||
Reference in New Issue
Block a user