1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-09-19 15:11:40 +02:00
polr/public/js/base.js
2016-12-02 19:06:40 -05:00

30 lines
834 B
JavaScript

// AJAX settings
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
// Escape jQuery selectors
function esc_selector(selector) {
return selector.replace( /(:|\.|\[|\]|,)/g, "\\$1" );
}
jQuery.fn.clearForm = function() {
// http://stackoverflow.com/questions/6364289/clear-form-fields-with-jquery
$(this).find('input').not(':button, :submit, :reset, :hidden')
.val('')
.removeAttr('checked')
.removeAttr('selected');
return this;
};
// Output helpful console message
console.log('%cPolr', 'font-size:5em;color:green');
console.log('%cNeed help? Open a ticket: https://github.com/cydrobolt/polr', 'color:blue');
console.log('%cDocs: https://docs.polr.me', 'color:blue');
// Set up Angular module
var polr = angular.module('polr',[]);