5 $('.filter').change(function() {
6 document.filter[this.name].value = this.value;
7 document.filter.submit();
10 $('.check-filter').change(function() {
11 document.filter[this.name].value = this.checked ? '1' : '';
12 document.filter.submit();
15 $('.text-filter').each(function() {
17 $(inp).parent().submit(function() {
18 document.filter[inp.name].value = inp.value;
19 document.filter.submit();
25 $('.autoslug-source').change(function() {
26 $('.autoslug').attr('value', slugify(this.value));
30 var nowTemp = new Date();
31 var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
33 $('.datepicker-field').each(function() {
34 var checkout = $(this).datepicker({
37 onRender: function(date) {
38 return date.valueOf() < now.valueOf() ? 'disabled' : '';
40 }).on('changeDate', function() {
42 }).data('datepicker');
46 $("select").change(function() {
47 var helpdiv = $(this).next();
48 if (helpdiv.hasClass('help-text')) {
49 var helptext = $("option:selected", this).attr('data-help');
50 helpdiv.html(helptext || '');
54 if ($.isFunction($.fn.chosen)) {
55 $('.chosen-select').chosen().each(function () {
56 var widget = $(this.nextSibling), $t = $(this);
57 $.each($.merge([], this.attributes), function () {
58 if (this.name.substr(0, 5) === 'data-') {
59 $t.removeAttr(this.name);
60 widget.attr(this.name, this.value);
68 var tutorial, tutorial_no;
71 var first_reset = true;
73 if (start) $(start).popover('hide');
76 var all_tutorial = $('[data-toggle="tutorial"]');
79 return parseInt($(a).attr('data-tutorial'));
81 tutorial = $.makeArray(all_tutorial.sort(
82 function(a, b) {return sortKey(a) < sortKey(b) ? -1 : 1}
86 $.each(tutorial, function(i, e) {
87 var but = (i < tutorial.length - 1) ? '>>' : 'OK',
88 but_prev_html = i === 0 ? '' : '<a class="btn btn-default tutorial-prev" href="#-" id="pv'+i+'"><<</a></div></div>';
90 title: '<a class="btn btn-default tutorial-off" href="#-" id="tutoff'+i+'" style="float:right; padding:0 8px 4px 8px; position:relative; top:-6px; right:-10px;">×</a>Tutorial',
93 template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div><div><a style="float:right" class="btn btn-default tutorial-next" href="#-" id="nt'+i+'">' + but + '</a>' + but_prev_html + '</div></div>'
95 $(e).popover('disable');
102 sessionStorage.setItem("tutorial", "on");
104 var $tutModal = $('#tutModal');
105 if($tutModal.length === 0) {
108 $tutModal.modal('show');
113 $(this).popover('hide');
114 if (start) $(start).popover('hide');
116 sessionStorage.removeItem("tutorial");
117 $('[data-toggle="tutorial"]').popover('disable');
122 $(start).popover('hide').popover('disable');
124 if (tutorial_no === null)
130 if (tutorial_no < tutorial.length && tutorial_no >= 0) {
131 start = tutorial[tutorial_no];
132 $(start).popover('enable').popover('show');
146 $('#tutModal').on('hidden.bs.modal', tutnext);
148 if (sessionStorage.getItem("tutorial") === "on" && $('#tuton').length === 0) {
152 $(document).on('click', '#tuton', tuton);
153 $(document).on('click', '.tutorial-off', tutoff);
154 $(document).on('click', '.tutorial-next', tutnext);
155 $(document).on('click', '.tutorial-prev', tutprev);