'
68 | };
69 |
70 | String.format = function () {
71 | var str = arguments[0];
72 | for (var i = 1; i < arguments.length; i++) {
73 | str = str.replace(RegExp("\\{" + (i - 1) + "\\}", "gm"), arguments[i]);
74 | }
75 | return str;
76 | };
77 |
78 | function isDuplicateNotification(notification) {
79 | var isDupe = false;
80 |
81 | $('[data-notify="container"]').each(function (i, el) {
82 | var $el = $(el);
83 | var title = $el.find('[data-notify="title"]').text().trim();
84 | var message = $el.find('[data-notify="message"]').html().trim();
85 |
86 | // The input string might be different than the actual parsed HTML string!
87 | // ( vs for example)
88 | // So we have to force-parse this as HTML here!
89 | var isSameTitle = title === $("
" + notification.settings.content.title + "
").html().trim();
90 | var isSameMsg = message === $("
" + notification.settings.content.message + "
").html().trim();
91 | var isSameType = $el.hasClass('alert-' + notification.settings.type);
92 |
93 | if (isSameTitle && isSameMsg && isSameType) {
94 | //we found the dupe. Set the var and stop checking.
95 | isDupe = true;
96 | }
97 | return !isDupe;
98 | });
99 |
100 | return isDupe;
101 | }
102 |
103 | function Notify(element, content, options) {
104 | // Setup Content of Notify
105 | var contentObj = {
106 | content: {
107 | message: typeof content === 'object' ? content.message : content,
108 | title: content.title ? content.title : '',
109 | icon: content.icon ? content.icon : '',
110 | url: content.url ? content.url : '#',
111 | target: content.target ? content.target : '-'
112 | }
113 | };
114 |
115 | options = $.extend(true, {}, contentObj, options);
116 | this.settings = $.extend(true, {}, defaults, options);
117 | this._defaults = defaults;
118 | if (this.settings.content.target === "-") {
119 | this.settings.content.target = this.settings.url_target;
120 | }
121 | this.animations = {
122 | start: 'webkitAnimationStart oanimationstart MSAnimationStart animationstart',
123 | end: 'webkitAnimationEnd oanimationend MSAnimationEnd animationend'
124 | };
125 |
126 | if (typeof this.settings.offset === 'number') {
127 | this.settings.offset = {
128 | x: this.settings.offset,
129 | y: this.settings.offset
130 | };
131 | }
132 |
133 | //if duplicate messages are not allowed, then only continue if this new message is not a duplicate of one that it already showing
134 | if (this.settings.allow_duplicates || (!this.settings.allow_duplicates && !isDuplicateNotification(this))) {
135 | this.init();
136 | }
137 | }
138 |
139 | $.extend(Notify.prototype, {
140 | init: function () {
141 | var self = this;
142 |
143 | this.buildNotify();
144 | if (this.settings.content.icon) {
145 | this.setIcon();
146 | }
147 | if (this.settings.content.url != "#") {
148 | this.styleURL();
149 | }
150 | this.styleDismiss();
151 | this.placement();
152 | this.bind();
153 |
154 | this.notify = {
155 | $ele: this.$ele,
156 | update: function (command, update) {
157 | var commands = {};
158 | if (typeof command === "string") {
159 | commands[command] = update;
160 | } else {
161 | commands = command;
162 | }
163 | for (var cmd in commands) {
164 | switch (cmd) {
165 | case "type":
166 | this.$ele.removeClass('alert-' + self.settings.type);
167 | this.$ele.find('[data-notify="progressbar"] > .progress-bar').removeClass('progress-bar-' + self.settings.type);
168 | self.settings.type = commands[cmd];
169 | this.$ele.addClass('alert-' + commands[cmd]).find('[data-notify="progressbar"] > .progress-bar').addClass('progress-bar-' + commands[cmd]);
170 | break;
171 | case "icon":
172 | var $icon = this.$ele.find('[data-notify="icon"]');
173 | if (self.settings.icon_type.toLowerCase() === 'class') {
174 | $icon.removeClass(self.settings.content.icon).addClass(commands[cmd]);
175 | } else {
176 | if (!$icon.is('img')) {
177 | $icon.find('img');
178 | }
179 | $icon.attr('src', commands[cmd]);
180 | }
181 | break;
182 | case "progress":
183 | var newDelay = self.settings.delay - (self.settings.delay * (commands[cmd] / 100));
184 | this.$ele.data('notify-delay', newDelay);
185 | this.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', commands[cmd]).css('width', commands[cmd] + '%');
186 | break;
187 | case "url":
188 | this.$ele.find('[data-notify="url"]').attr('href', commands[cmd]);
189 | break;
190 | case "target":
191 | this.$ele.find('[data-notify="url"]').attr('target', commands[cmd]);
192 | break;
193 | default:
194 | this.$ele.find('[data-notify="' + cmd + '"]').html(commands[cmd]);
195 | }
196 | }
197 | var posX = this.$ele.outerHeight() + parseInt(self.settings.spacing) + parseInt(self.settings.offset.y);
198 | self.reposition(posX);
199 | },
200 | close: function () {
201 | self.close();
202 | }
203 | };
204 |
205 | },
206 | buildNotify: function () {
207 | var content = this.settings.content;
208 | this.$ele = $(String.format(this.settings.template, this.settings.type, content.title, content.message, content.url, content.target));
209 | this.$ele.attr('data-notify-position', this.settings.placement.from + '-' + this.settings.placement.align);
210 | if (!this.settings.allow_dismiss) {
211 | this.$ele.find('[data-notify="dismiss"]').css('display', 'none');
212 | }
213 | if ((this.settings.delay <= 0 && !this.settings.showProgressbar) || !this.settings.showProgressbar) {
214 | this.$ele.find('[data-notify="progressbar"]').remove();
215 | }
216 | },
217 | setIcon: function () {
218 |
219 | this.$ele.addClass('alert-with-icon');
220 |
221 | if (this.settings.icon_type.toLowerCase() === 'class') {
222 | this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon);
223 | } else {
224 | if (this.$ele.find('[data-notify="icon"]').is('img')) {
225 | this.$ele.find('[data-notify="icon"]').attr('src', this.settings.content.icon);
226 | } else {
227 | this.$ele.find('[data-notify="icon"]').append('');
228 | }
229 | }
230 | },
231 | styleDismiss: function () {
232 | this.$ele.find('[data-notify="dismiss"]').css({
233 | position: 'absolute',
234 | right: '10px',
235 | top: '50%',
236 | marginTop: '-13px',
237 | zIndex: this.settings.z_index + 2
238 | });
239 | },
240 | styleURL: function () {
241 | this.$ele.find('[data-notify="url"]').css({
242 | backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)',
243 | height: '100%',
244 | left: 0,
245 | position: 'absolute',
246 | top: 0,
247 | width: '100%',
248 | zIndex: this.settings.z_index + 1
249 | });
250 | },
251 | placement: function () {
252 | var self = this,
253 | offsetAmt = this.settings.offset.y,
254 | css = {
255 | display: 'inline-block',
256 | margin: '0px auto',
257 | position: this.settings.position ? this.settings.position : (this.settings.element === 'body' ? 'fixed' : 'absolute'),
258 | transition: 'all .5s ease-in-out',
259 | zIndex: this.settings.z_index
260 | },
261 | hasAnimation = false,
262 | settings = this.settings;
263 |
264 | $('[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])').each(function () {
265 | offsetAmt = Math.max(offsetAmt, parseInt($(this).css(settings.placement.from)) + parseInt($(this).outerHeight()) + parseInt(settings.spacing));
266 | });
267 | if (this.settings.newest_on_top === true) {
268 | offsetAmt = this.settings.offset.y;
269 | }
270 | css[this.settings.placement.from] = offsetAmt + 'px';
271 |
272 | switch (this.settings.placement.align) {
273 | case "left":
274 | case "right":
275 | css[this.settings.placement.align] = this.settings.offset.x + 'px';
276 | break;
277 | case "center":
278 | css.left = 0;
279 | css.right = 0;
280 | break;
281 | }
282 | this.$ele.css(css).addClass(this.settings.animate.enter);
283 | $.each(Array('webkit-', 'moz-', 'o-', 'ms-', ''), function (index, prefix) {
284 | self.$ele[0].style[prefix + 'AnimationIterationCount'] = 1;
285 | });
286 |
287 | $(this.settings.element).append(this.$ele);
288 |
289 | if (this.settings.newest_on_top === true) {
290 | offsetAmt = (parseInt(offsetAmt) + parseInt(this.settings.spacing)) + this.$ele.outerHeight();
291 | this.reposition(offsetAmt);
292 | }
293 |
294 | if ($.isFunction(self.settings.onShow)) {
295 | self.settings.onShow.call(this.$ele);
296 | }
297 |
298 | this.$ele.one(this.animations.start, function () {
299 | hasAnimation = true;
300 | }).one(this.animations.end, function () {
301 | if ($.isFunction(self.settings.onShown)) {
302 | self.settings.onShown.call(this);
303 | }
304 | });
305 |
306 | setTimeout(function () {
307 | if (!hasAnimation) {
308 | if ($.isFunction(self.settings.onShown)) {
309 | self.settings.onShown.call(this);
310 | }
311 | }
312 | }, 600);
313 | },
314 | bind: function () {
315 | var self = this;
316 |
317 | this.$ele.find('[data-notify="dismiss"]').on('click', function () {
318 | self.close();
319 | });
320 |
321 | this.$ele.mouseover(function () {
322 | $(this).data('data-hover', "true");
323 | }).mouseout(function () {
324 | $(this).data('data-hover', "false");
325 | });
326 | this.$ele.data('data-hover', "false");
327 |
328 | if (this.settings.delay > 0) {
329 | self.$ele.data('notify-delay', self.settings.delay);
330 | var timer = setInterval(function () {
331 | var delay = parseInt(self.$ele.data('notify-delay')) - self.settings.timer;
332 | if ((self.$ele.data('data-hover') === 'false' && self.settings.mouse_over === "pause") || self.settings.mouse_over != "pause") {
333 | var percent = ((self.settings.delay - delay) / self.settings.delay) * 100;
334 | self.$ele.data('notify-delay', delay);
335 | self.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', percent).css('width', percent + '%');
336 | }
337 | if (delay <= -(self.settings.timer)) {
338 | clearInterval(timer);
339 | self.close();
340 | }
341 | }, self.settings.timer);
342 | }
343 | },
344 | close: function () {
345 | var self = this,
346 | posX = parseInt(this.$ele.css(this.settings.placement.from)),
347 | hasAnimation = false;
348 |
349 | this.$ele.data('closing', 'true').addClass(this.settings.animate.exit);
350 | self.reposition(posX);
351 |
352 | if ($.isFunction(self.settings.onClose)) {
353 | self.settings.onClose.call(this.$ele);
354 | }
355 |
356 | this.$ele.one(this.animations.start, function () {
357 | hasAnimation = true;
358 | }).one(this.animations.end, function () {
359 | $(this).remove();
360 | if ($.isFunction(self.settings.onClosed)) {
361 | self.settings.onClosed.call(this);
362 | }
363 | });
364 |
365 | setTimeout(function () {
366 | if (!hasAnimation) {
367 | self.$ele.remove();
368 | if (self.settings.onClosed) {
369 | self.settings.onClosed(self.$ele);
370 | }
371 | }
372 | }, 600);
373 | },
374 | reposition: function (posX) {
375 | var self = this,
376 | notifies = '[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])',
377 | $elements = this.$ele.nextAll(notifies);
378 | if (this.settings.newest_on_top === true) {
379 | $elements = this.$ele.prevAll(notifies);
380 | }
381 | $elements.each(function () {
382 | $(this).css(self.settings.placement.from, posX);
383 | posX = (parseInt(posX) + parseInt(self.settings.spacing)) + $(this).outerHeight();
384 | });
385 | }
386 | });
387 |
388 | $.notify = function (content, options) {
389 | var plugin = new Notify(this, content, options);
390 | return plugin.notify;
391 | };
392 | $.notifyDefaults = function (options) {
393 | defaults = $.extend(true, {}, defaults, options);
394 | return defaults;
395 | };
396 | $.notifyClose = function (command) {
397 | if (typeof command === "undefined" || command === "all") {
398 | $('[data-notify]').find('[data-notify="dismiss"]').trigger('click');
399 | } else {
400 | $('[data-notify-position="' + command + '"]').find('[data-notify="dismiss"]').trigger('click');
401 | }
402 | };
403 |
404 | }));
405 |
--------------------------------------------------------------------------------
/public/js/jquery.bootstrap.wizard.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * jQuery twitter bootstrap wizard plugin
3 | * Examples and documentation at: http://github.com/VinceG/twitter-bootstrap-wizard
4 | * version 1.0
5 | * Requires jQuery v1.3.2 or later
6 | * Supports Bootstrap 2.2.x, 2.3.x, 3.0
7 | * Dual licensed under the MIT and GPL licenses:
8 | * http://www.opensource.org/licenses/mit-license.php
9 | * http://www.gnu.org/licenses/gpl.html
10 | * Authors: Vadim Vincent Gabriel (http://vadimg.com), Jason Gill (www.gilluminate.com)
11 | */
12 | (function(e){var n=function(d,k){d=e(d);var a=this,g=[],c=e.extend({},e.fn.bootstrapWizard.defaults,k),f=null,b=null;this.rebindClick=function(h,a){h.unbind("click",a).bind("click",a)};this.fixNavigationButtons=function(){f.length||(b.find("a:first").tab("show"),f=b.find('li:has([data-toggle="tab"]):first'));e(c.previousSelector,d).toggleClass("disabled",a.firstIndex()>=a.currentIndex());e(c.nextSelector,d).toggleClass("disabled",a.currentIndex()>=a.navigationLength());e(c.backSelector,d).toggleClass("disabled",
13 | 0==g.length);a.rebindClick(e(c.nextSelector,d),a.next);a.rebindClick(e(c.previousSelector,d),a.previous);a.rebindClick(e(c.lastSelector,d),a.last);a.rebindClick(e(c.firstSelector,d),a.first);a.rebindClick(e(c.backSelector,d),a.back);if(c.onTabShow&&"function"===typeof c.onTabShow&&!1===c.onTabShow(f,b,a.currentIndex()))return!1};this.next=function(h){if(d.hasClass("last")||c.onNext&&"function"===typeof c.onNext&&!1===c.onNext(f,b,a.nextIndex()))return!1;h=a.currentIndex();$index=a.nextIndex();$index>
14 | a.navigationLength()||(g.push(h),b.find('li:has([data-toggle="tab"]):eq('+$index+") a").tab("show"))};this.previous=function(h){if(d.hasClass("first")||c.onPrevious&&"function"===typeof c.onPrevious&&!1===c.onPrevious(f,b,a.previousIndex()))return!1;h=a.currentIndex();$index=a.previousIndex();0>$index||(g.push(h),b.find('li:has([data-toggle="tab"]):eq('+$index+") a").tab("show"))};this.first=function(h){if(c.onFirst&&"function"===typeof c.onFirst&&!1===c.onFirst(f,b,a.firstIndex())||d.hasClass("disabled"))return!1;
15 | g.push(a.currentIndex());b.find('li:has([data-toggle="tab"]):eq(0) a').tab("show")};this.last=function(h){if(c.onLast&&"function"===typeof c.onLast&&!1===c.onLast(f,b,a.lastIndex())||d.hasClass("disabled"))return!1;g.push(a.currentIndex());b.find('li:has([data-toggle="tab"]):eq('+a.navigationLength()+") a").tab("show")};this.back=function(){if(0==g.length)return null;var a=g.pop();if(c.onBack&&"function"===typeof c.onBack&&!1===c.onBack(f,b,a))return g.push(a),!1;d.find('li:has([data-toggle="tab"]):eq('+
16 | a+") a").tab("show")};this.currentIndex=function(){return b.find('li:has([data-toggle="tab"])').index(f)};this.firstIndex=function(){return 0};this.lastIndex=function(){return a.navigationLength()};this.getIndex=function(a){return b.find('li:has([data-toggle="tab"])').index(a)};this.nextIndex=function(){return b.find('li:has([data-toggle="tab"])').index(f)+1};this.previousIndex=function(){return b.find('li:has([data-toggle="tab"])').index(f)-1};this.navigationLength=function(){return b.find('li:has([data-toggle="tab"])').length-
17 | 1};this.activeTab=function(){return f};this.nextTab=function(){return b.find('li:has([data-toggle="tab"]):eq('+(a.currentIndex()+1)+")").length?b.find('li:has([data-toggle="tab"]):eq('+(a.currentIndex()+1)+")"):null};this.previousTab=function(){return 0>=a.currentIndex()?null:b.find('li:has([data-toggle="tab"]):eq('+parseInt(a.currentIndex()-1)+")")};this.show=function(b){b=isNaN(b)?d.find('li:has([data-toggle="tab"]) a[href=#'+b+"]"):d.find('li:has([data-toggle="tab"]):eq('+b+") a");0").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,d=d.concat(c.errorList)}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||-1!==a.inArray(c.keyCode,d)||(b.name in this.submitted||b===this.lastElement)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this.form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!a(this).is(e.ignore)&&e[d].call(c,this,b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors();var b,c=this.elements().removeData("previousValue").removeAttr("aria-invalid");if(this.settings.unhighlight)for(b=0;c[b];b++)this.settings.unhighlight.call(this,c[b],this.settings.errorClass,"");else c.removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=b.type;return"radio"===e||"checkbox"===e?this.findByName(b.name).filter(":checked").val():"number"===e&&"undefined"!=typeof b.validity?b.validity.badInput?!1:d.val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j instanceof TypeError&&(j.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;aWarning: No message defined for "+b.name+"")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=this.errorsFor(b),h=this.idOrName(b),i=a(b).attr("aria-describedby");g.length?(g.removeClass(this.settings.validClass).addClass(this.settings.errorClass),g.html(c)):(g=a("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&&(d=g.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),g.is("label")?g.attr("for",h):0===g.parents("label[for='"+h+"']").length&&(f=g.attr("id").replace(/(:|\.|\[|\]|\$)/g,"\\$1"),i?i.match(new RegExp("\\b"+f+"\\b"))||(i+=" "+f):i=f,a(b).attr("aria-describedby",i),e=this.groups[b.name],e&&a.each(this.groups,function(b,c){c===e&&a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&&this.settings.success&&(g.text(""),"string"==typeof this.settings.success?g.addClass(this.settings.success):this.settings.success(g,b)),this.toShow=this.toShow.add(g)},errorsFor:function(b){var c=this.idOrName(b),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+d.replace(/\s+/g,", #")),this.errors().filter(e)},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.off(".validate-equalTo").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}});var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)})});
--------------------------------------------------------------------------------
/public/js/light-bootstrap-dashboard.js:
--------------------------------------------------------------------------------
1 | /*! =========================================================
2 | *
3 | * Light Bootstrap Dashboard PRO - V1.3.0
4 | *
5 | * =========================================================
6 | *
7 | * Copyright 2016 Creative Tim
8 | * Available with purchase of license from http://www.creative-tim.com/product/light-bootstrap-dashboard-pro
9 | *
10 | * _oo0oo_
11 | * o8888888o
12 | * 88" . "88
13 | * (| -_- |)
14 | * 0\ = /0
15 | * ___/`---'\___
16 | * .' \\| |// '.
17 | * / \\||| : |||// \
18 | * / _||||| -:- |||||- \
19 | * | | \\\ - /// | |
20 | * | \_| ''\---/'' |_/ |
21 | * \ .-\__ '-' ___/-. /
22 | * ___'. .' /--.--\ `. .'___
23 | * ."" '< `.___\_<|>_/___.' >' "".
24 | * | | : `- \`.;`\ _ /`;.`/ - ` : | |
25 | * \ \ `_. \_ __\ /__ _/ .-` / /
26 | * =====`-.____`.___ \_____/___.-`___.-'=====
27 | * `=---='
28 | *
29 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30 | *
31 | * Buddha Bless: "No Bugs"
32 | *
33 | * ========================================================= */
34 |
35 | var searchVisible = 0;
36 | var transparent = true;
37 |
38 | var transparentDemo = true;
39 | var fixedTop = false;
40 |
41 | var mobile_menu_visible = 0,
42 | mobile_menu_initialized = false,
43 | toggle_initialized = false,
44 | bootstrap_nav_initialized = false,
45 | $sidebar,
46 | isWindows;
47 |
48 | (function(){
49 | isWindows = navigator.platform.indexOf('Win') > -1 ? true : false;
50 |
51 | if (isWindows && !$('body').hasClass('sidebar-mini')){
52 | // if we are on windows OS we activate the perfectScrollbar function
53 | $('.sidebar .sidebar-wrapper, .main-panel').perfectScrollbar();
54 |
55 | $('html').addClass('perfect-scrollbar-on');
56 | } else {
57 | $('html').addClass('perfect-scrollbar-off');
58 | }
59 | })();
60 |
61 | $(document).ready(function(){
62 |
63 | window_width = $(window).width();
64 | $sidebar = $('.sidebar');
65 |
66 | // check if there is an image set for the sidebar's background
67 | lbd.checkSidebarImage();
68 |
69 | if($('body').hasClass('sidebar-mini')){
70 | lbd.misc.sidebar_mini_active = true;
71 | }
72 |
73 | lbd.initSidebarsCheck();
74 |
75 | lbd.initMinimizeSidebar();
76 |
77 | $('.form-control').on("focus", function(){
78 | $(this).parent('.input-group').addClass("input-group-focus");
79 | }).on("blur", function(){
80 | $(this).parent(".input-group").removeClass("input-group-focus");
81 | });
82 |
83 | // Init Collapse Areas
84 | lbd.initCollapseArea();
85 |
86 | // Init Tooltips
87 | $('[rel="tooltip"]').tooltip();
88 |
89 | // Init Tags Input
90 | if($(".tagsinput").length != 0){
91 | $(".tagsinput").tagsInput();
92 | }
93 |
94 | // Init Bootstrap Select Picker
95 | if($(".selectpicker").length != 0){
96 | $(".selectpicker").selectpicker();
97 | }
98 |
99 | });
100 |
101 | // activate mobile menus when the windows is resized
102 | $(window).resize(function(){
103 | lbd.initSidebarsCheck();
104 | });
105 |
106 |
107 | lbd = {
108 |
109 | misc:{
110 | navbar_menu_visible: 0,
111 | active_collapse: true,
112 | disabled_collapse_init: 0,
113 |
114 | },
115 |
116 | checkSidebarImage: function(){
117 | $sidebar = $('.sidebar');
118 | image_src = $sidebar.data('image');
119 |
120 | if(image_src !== undefined){
121 | sidebar_container = ''
122 | $sidebar.append(sidebar_container);
123 | } else if(mobile_menu_initialized == true){
124 | // reset all the additions that we made for the sidebar wrapper only if the screen is bigger than 991px
125 | $sidebar_wrapper.find('.navbar-form').remove();
126 | $sidebar_wrapper.find('.nav-mobile-menu').remove();
127 |
128 | mobile_menu_initialized = false;
129 | }
130 | },
131 |
132 | initSidebarsCheck: function(){
133 | if($(window).width() <= 991){
134 | if($sidebar.length != 0){
135 | lbd.initSidebarMenu();
136 |
137 | } else {
138 | lbd.initBootstrapNavbarMenu();
139 | }
140 | }
141 |
142 | },
143 |
144 | initMinimizeSidebar: function(){
145 |
146 | // when we are on a Desktop Screen and the collapse is triggered we check if the sidebar mini is active or not. If it is active then we don't let the collapse to show the elements because the elements from the collapse are showing on the hover state over the icons in sidebar mini, not on the click.
147 | $('.sidebar .collapse').on('show.bs.collapse',function(){
148 | if($(window).width() > 991){
149 | if(lbd.misc.sidebar_mini_active == true){
150 | return false;
151 | } else{
152 | return true;
153 | }
154 | }
155 | });
156 |
157 | $('#minimizeSidebar').click(function(){
158 | var $btn = $(this);
159 |
160 | if(lbd.misc.sidebar_mini_active == true){
161 | $('body').removeClass('sidebar-mini');
162 | lbd.misc.sidebar_mini_active = false;
163 |
164 | if(isWindows){
165 | $('.sidebar .sidebar-wrapper').perfectScrollbar();
166 | }
167 |
168 | }else{
169 |
170 | $('.sidebar .collapse').collapse('hide').on('hidden.bs.collapse',function(){
171 | $(this).css('height','auto');
172 | });
173 |
174 | if(isWindows){
175 | $('.sidebar .sidebar-wrapper').perfectScrollbar('destroy');
176 | }
177 |
178 | setTimeout(function(){
179 | $('body').addClass('sidebar-mini');
180 |
181 | $('.sidebar .collapse').css('height','auto');
182 | lbd.misc.sidebar_mini_active = true;
183 | },300);
184 | }
185 |
186 | // we simulate the window Resize so the charts will get updated in realtime.
187 | var simulateWindowResize = setInterval(function(){
188 | window.dispatchEvent(new Event('resize'));
189 | },180);
190 |
191 | // we stop the simulation of Window Resize after the animations are completed
192 | setTimeout(function(){
193 | clearInterval(simulateWindowResize);
194 | },1000);
195 | });
196 | },
197 |
198 |
199 | checkFullPageBackgroundImage: function(){
200 | $page = $('.full-page');
201 | image_src = $page.data('image');
202 |
203 | if(image_src !== undefined){
204 | image_container = ''
205 | $page.append(image_container);
206 | }
207 | },
208 |
209 | initSidebarMenu: debounce(function(){
210 | $sidebar_wrapper = $('.sidebar-wrapper');
211 |
212 | //console.log('aici se face meniu in dreapta');
213 |
214 | if(!mobile_menu_initialized){
215 |
216 | $navbar = $('nav').find('.navbar-collapse').first().clone(true);
217 |
218 | nav_content = '';
219 | mobile_menu_content = '';
220 |
221 | //add the content from the regular header to the mobile menu
222 | //pas = 1;
223 | $navbar.children('ul').each(function(){
224 |
225 | content_buff = $(this).html();
226 | nav_content = nav_content + content_buff;
227 | //console.log('pas:' + pas);
228 |
229 | //pas = pas+1;
230 | });
231 |
232 | nav_content = '