').append(this.$clear)); \n } \n */\n\n },\n value2html: function value2html(value, element) {\n var text = value ? value.format(this.options.viewformat) : ''; //$(element).text(text);\n\n Constructor.superclass.value2html.call(this, text, element);\n },\n html2value: function html2value(html) {\n return html ? moment(html, this.options.viewformat) : null;\n },\n value2str: function value2str(value) {\n return value ? value.format(this.options.format) : '';\n },\n str2value: function str2value(str) {\n return str ? moment(str, this.options.format) : null;\n },\n value2submit: function value2submit(value) {\n return this.value2str(value);\n },\n value2input: function value2input(value) {\n this.$input.combodate('setValue', value);\n },\n input2value: function input2value() {\n return this.$input.combodate('getValue', null);\n },\n activate: function activate() {\n this.$input.siblings('.combodate').find('select').eq(0).focus();\n },\n\n /*\n clear: function() {\n this.$input.data('datepicker').date = null;\n this.$input.find('.active').removeClass('active');\n },\n */\n autosubmit: function autosubmit() {}\n });\n Constructor.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {\n /**\n @property tpl \n @default
\n **/\n tpl: '
',\n\n /**\n @property inputclass \n @default null\n **/\n inputclass: null,\n\n /**\n Format used for sending value to server. Also applied when converting date from
data-value
attribute.
\n See list of tokens in [momentjs docs](http://momentjs.com/docs/#/parsing/string-format) \n \n @property format \n @type string\n @default YYYY-MM-DD\n **/\n format: 'YYYY-MM-DD',\n\n /**\n Format used for displaying date. Also applied when converting date from element's text on init. \n If not specified equals to `format`.\n \n @property viewformat \n @type string\n @default null\n **/\n viewformat: null,\n\n /**\n Template used for displaying dropdowns.\n \n @property template \n @type string\n @default D / MMM / YYYY\n **/\n template: 'D / MMM / YYYY',\n\n /**\n Configuration of combodate.\n Full list of options: http://vitalets.github.com/combodate/#docs\n \n @property combodate \n @type object\n @default null\n **/\n combodate: null\n /*\n (not implemented yet)\n Text shown as clear date button. \n If
false
clear button will not be rendered.\n \n @property clear \n @type boolean|string\n @default 'x clear' \n */\n //clear: '× clear'\n\n });\n $.fn.editabletypes.combodate = Constructor;\n})(window.jQuery);\n/*\nEditableform based on Twitter Bootstrap 3\n*/\n\n\n(function ($) {\n \"use strict\"; //store parent methods\n\n var pInitInput = $.fn.editableform.Constructor.prototype.initInput;\n $.extend($.fn.editableform.Constructor.prototype, {\n initTemplate: function initTemplate() {\n this.$form = $($.fn.editableform.template);\n this.$form.find('.control-group').addClass('form-group');\n this.$form.find('.editable-error-block').addClass('help-block');\n },\n initInput: function initInput() {\n pInitInput.apply(this);\n var emptyInputClass = this.input.options.inputclass === null || this.input.options.inputclass === false;\n var defaultClass = 'form-control-sm'; //bs3 add `form-control` class to standard inputs\n\n var stdtypes = 'text,select,textarea,password,email,url,tel,number,range,time,typeaheadjs'.split(',');\n\n if (~$.inArray(this.input.type, stdtypes)) {\n this.input.$input.addClass('form-control');\n\n if (emptyInputClass) {\n this.input.options.inputclass = defaultClass;\n this.input.$input.addClass(defaultClass);\n }\n } //apply size class also to buttons (to fit size of control)\n\n\n var $btn = this.$form.find('.editable-buttons');\n var classes = emptyInputClass ? [defaultClass] : this.input.options.inputclass.split(' ');\n\n for (var i = 0; i < classes.length; i++) {\n // `btn-sm` is default now\n\n /*\n if(classes[i].toLowerCase() === 'input-sm') { \n $btn.find('button').addClass('btn-sm'); \n }\n */\n if (classes[i].toLowerCase() === 'input-lg') {\n $btn.find('button').removeClass('btn-sm').addClass('btn-lg');\n }\n }\n }\n }); //buttons\n\n $.fn.editableform.buttons = '
' + '
'; //error classes\n\n $.fn.editableform.errorGroupClass = 'has-error';\n $.fn.editableform.errorBlockClass = null; //engine\n\n $.fn.editableform.engine = 'bs4';\n})(window.jQuery);\n/**\n* Editable Popover for Bootstrap 4 based on Popper.js\n* ---------------------\n* requires bootstrap-popover.js\n*/\n\n\n(function ($) {\n \"use strict\"; //extend methods\n\n $.extend($.fn.editableContainer.Popup.prototype, {\n containerName: 'popover',\n containerDataName: 'bs.popover',\n innerCss: '.popover-body',\n defaults: $.fn.popover.Constructor.DEFAULTS,\n initContainer: function initContainer() {\n $.extend(this.containerOptions, {\n trigger: 'manual',\n selector: false,\n content: ' ',\n template: this.defaults.template\n }); //as template property is used in inputs, hide it from popover\n\n var t;\n\n if (this.$element.data('template')) {\n t = this.$element.data('template');\n this.$element.removeData('template');\n }\n\n this.call(this.containerOptions);\n\n if (t) {\n //restore data('template')\n this.$element.data('template', t);\n }\n },\n\n /* show */\n innerShow: function innerShow() {\n this.call('show');\n },\n\n /* hide */\n innerHide: function innerHide() {\n this.call('hide');\n },\n\n /* destroy */\n innerDestroy: function innerDestroy() {\n this.call('dispose');\n },\n setContainerOption: function setContainerOption(key, value) {\n this.container().options[key] = value;\n },\n setPosition: function setPosition() {\n (function () {}).call(this.container());\n },\n tip: function tip() {\n return this.container() ? $(this.container().tip) : null;\n }\n });\n})(window.jQuery);\n/* =========================================================\n * bootstrap-datepicker.js\n * http://www.eyecon.ro/bootstrap-datepicker\n * =========================================================\n * Copyright 2012 Stefan Petre\n * Improvements by Andrew Rowls\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ========================================================= */\n\n\n(function ($) {\n function UTCDate() {\n return new Date(Date.UTC.apply(Date, arguments));\n }\n\n function UTCToday() {\n var today = new Date();\n return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());\n } // Picker object\n\n\n var Datepicker = function Datepicker(element, options) {\n var that = this;\n\n this._process_options(options);\n\n this.element = $(element);\n this.isInline = false;\n this.isInput = this.element.is('input');\n this.component = this.element.is('.date') ? this.element.find('.add-on, .btn') : false;\n this.hasInput = this.component && this.element.find('input').length;\n if (this.component && this.component.length === 0) this.component = false;\n this.picker = $(DPGlobal.template);\n\n this._buildEvents();\n\n this._attachEvents();\n\n if (this.isInline) {\n this.picker.addClass('datepicker-inline').appendTo(this.element);\n } else {\n this.picker.addClass('datepicker-dropdown dropdown-menu');\n }\n\n if (this.o.rtl) {\n this.picker.addClass('datepicker-rtl');\n this.picker.find('.prev i, .next i').toggleClass('icon-arrow-left icon-arrow-right');\n }\n\n this.viewMode = this.o.startView;\n if (this.o.calendarWeeks) this.picker.find('tfoot th.today').attr('colspan', function (i, val) {\n return parseInt(val) + 1;\n });\n this._allow_update = false;\n this.setStartDate(this.o.startDate);\n this.setEndDate(this.o.endDate);\n this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);\n this.fillDow();\n this.fillMonths();\n this._allow_update = true;\n this.update();\n this.showMode();\n\n if (this.isInline) {\n this.show();\n }\n };\n\n Datepicker.prototype = {\n constructor: Datepicker,\n _process_options: function _process_options(opts) {\n // Store raw options for reference\n this._o = $.extend({}, this._o, opts); // Processed options\n\n var o = this.o = $.extend({}, this._o); // Check if \"de-DE\" style date is available, if not language should\n // fallback to 2 letter code eg \"de\"\n\n var lang = o.language;\n\n if (!dates[lang]) {\n lang = lang.split('-')[0];\n if (!dates[lang]) lang = defaults.language;\n }\n\n o.language = lang;\n\n switch (o.startView) {\n case 2:\n case 'decade':\n o.startView = 2;\n break;\n\n case 1:\n case 'year':\n o.startView = 1;\n break;\n\n default:\n o.startView = 0;\n }\n\n switch (o.minViewMode) {\n case 1:\n case 'months':\n o.minViewMode = 1;\n break;\n\n case 2:\n case 'years':\n o.minViewMode = 2;\n break;\n\n default:\n o.minViewMode = 0;\n }\n\n o.startView = Math.max(o.startView, o.minViewMode);\n o.weekStart %= 7;\n o.weekEnd = (o.weekStart + 6) % 7;\n var format = DPGlobal.parseFormat(o.format);\n\n if (o.startDate !== -Infinity) {\n o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);\n }\n\n if (o.endDate !== Infinity) {\n o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);\n }\n\n o.daysOfWeekDisabled = o.daysOfWeekDisabled || [];\n if (!$.isArray(o.daysOfWeekDisabled)) o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\\s]*/);\n o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function (d) {\n return parseInt(d, 10);\n });\n },\n _events: [],\n _secondaryEvents: [],\n _applyEvents: function _applyEvents(evs) {\n for (var i = 0, el, ev; i < evs.length; i++) {\n el = evs[i][0];\n ev = evs[i][1];\n el.on(ev);\n }\n },\n _unapplyEvents: function _unapplyEvents(evs) {\n for (var i = 0, el, ev; i < evs.length; i++) {\n el = evs[i][0];\n ev = evs[i][1];\n el.off(ev);\n }\n },\n _buildEvents: function _buildEvents() {\n if (this.isInput) {\n // single input\n this._events = [[this.element, {\n focus: $.proxy(this.show, this),\n keyup: $.proxy(this.update, this),\n keydown: $.proxy(this.keydown, this)\n }]];\n } else if (this.component && this.hasInput) {\n // component: input + button\n this._events = [// For components that are not readonly, allow keyboard nav\n [this.element.find('input'), {\n focus: $.proxy(this.show, this),\n keyup: $.proxy(this.update, this),\n keydown: $.proxy(this.keydown, this)\n }], [this.component, {\n click: $.proxy(this.show, this)\n }]];\n } else if (this.element.is('div')) {\n // inline datepicker\n this.isInline = true;\n } else {\n this._events = [[this.element, {\n click: $.proxy(this.show, this)\n }]];\n }\n\n this._secondaryEvents = [[this.picker, {\n click: $.proxy(this.click, this)\n }], [$(window), {\n resize: $.proxy(this.place, this)\n }], [$(document), {\n mousedown: $.proxy(function (e) {\n // Clicked outside the datepicker, hide it\n if (!(this.element.is(e.target) || this.element.find(e.target).size() || this.picker.is(e.target) || this.picker.find(e.target).size())) {\n this.hide();\n }\n }, this)\n }]];\n },\n _attachEvents: function _attachEvents() {\n this._detachEvents();\n\n this._applyEvents(this._events);\n },\n _detachEvents: function _detachEvents() {\n this._unapplyEvents(this._events);\n },\n _attachSecondaryEvents: function _attachSecondaryEvents() {\n this._detachSecondaryEvents();\n\n this._applyEvents(this._secondaryEvents);\n },\n _detachSecondaryEvents: function _detachSecondaryEvents() {\n this._unapplyEvents(this._secondaryEvents);\n },\n _trigger: function _trigger(event, altdate) {\n var date = altdate || this.date,\n local_date = new Date(date.getTime() + date.getTimezoneOffset() * 60000);\n this.element.trigger({\n type: event,\n date: local_date,\n format: $.proxy(function (altformat) {\n var format = altformat || this.o.format;\n return DPGlobal.formatDate(date, format, this.o.language);\n }, this)\n });\n },\n show: function show(e) {\n if (!this.isInline) this.picker.appendTo('body');\n this.picker.show();\n this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();\n this.place();\n\n this._attachSecondaryEvents();\n\n if (e) {\n e.preventDefault();\n }\n\n this._trigger('show');\n },\n hide: function hide(e) {\n if (this.isInline) return;\n if (!this.picker.is(':visible')) return;\n this.picker.hide().detach();\n\n this._detachSecondaryEvents();\n\n this.viewMode = this.o.startView;\n this.showMode();\n if (this.o.forceParse && (this.isInput && this.element.val() || this.hasInput && this.element.find('input').val())) this.setValue();\n\n this._trigger('hide');\n },\n remove: function remove() {\n this.hide();\n\n this._detachEvents();\n\n this._detachSecondaryEvents();\n\n this.picker.remove();\n delete this.element.data().datepicker;\n\n if (!this.isInput) {\n delete this.element.data().date;\n }\n },\n getDate: function getDate() {\n var d = this.getUTCDate();\n return new Date(d.getTime() + d.getTimezoneOffset() * 60000);\n },\n getUTCDate: function getUTCDate() {\n return this.date;\n },\n setDate: function setDate(d) {\n this.setUTCDate(new Date(d.getTime() - d.getTimezoneOffset() * 60000));\n },\n setUTCDate: function setUTCDate(d) {\n this.date = d;\n this.setValue();\n },\n setValue: function setValue() {\n var formatted = this.getFormattedDate();\n\n if (!this.isInput) {\n if (this.component) {\n this.element.find('input').val(formatted);\n }\n } else {\n this.element.val(formatted);\n }\n },\n getFormattedDate: function getFormattedDate(format) {\n if (format === undefined) format = this.o.format;\n return DPGlobal.formatDate(this.date, format, this.o.language);\n },\n setStartDate: function setStartDate(startDate) {\n this._process_options({\n startDate: startDate\n });\n\n this.update();\n this.updateNavArrows();\n },\n setEndDate: function setEndDate(endDate) {\n this._process_options({\n endDate: endDate\n });\n\n this.update();\n this.updateNavArrows();\n },\n setDaysOfWeekDisabled: function setDaysOfWeekDisabled(daysOfWeekDisabled) {\n this._process_options({\n daysOfWeekDisabled: daysOfWeekDisabled\n });\n\n this.update();\n this.updateNavArrows();\n },\n place: function place() {\n if (this.isInline) return;\n var zIndex = parseInt(this.element.parents().filter(function () {\n return $(this).css('z-index') != 'auto';\n }).first().css('z-index')) + 10;\n var offset = this.component ? this.component.parent().offset() : this.element.offset();\n var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(true);\n this.picker.css({\n top: offset.top + height,\n left: offset.left,\n zIndex: zIndex\n });\n },\n _allow_update: true,\n update: function update() {\n if (!this._allow_update) return;\n var date,\n fromArgs = false;\n\n if (arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {\n date = arguments[0];\n fromArgs = true;\n } else {\n date = this.isInput ? this.element.val() : this.element.data('date') || this.element.find('input').val();\n delete this.element.data().date;\n }\n\n this.date = DPGlobal.parseDate(date, this.o.format, this.o.language);\n if (fromArgs) this.setValue();\n\n if (this.date < this.o.startDate) {\n this.viewDate = new Date(this.o.startDate);\n } else if (this.date > this.o.endDate) {\n this.viewDate = new Date(this.o.endDate);\n } else {\n this.viewDate = new Date(this.date);\n }\n\n this.fill();\n },\n fillDow: function fillDow() {\n var dowCnt = this.o.weekStart,\n html = '
';\n\n if (this.o.calendarWeeks) {\n var cell = ' | ';\n html += cell;\n this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);\n }\n\n while (dowCnt < this.o.weekStart + 7) {\n html += '' + dates[this.o.language].daysMin[dowCnt++ % 7] + ' | ';\n }\n\n html += '
';\n this.picker.find('.datepicker-days thead').append(html);\n },\n fillMonths: function fillMonths() {\n var html = '',\n i = 0;\n\n while (i < 12) {\n html += '
' + dates[this.o.language].monthsShort[i++] + '';\n }\n\n this.picker.find('.datepicker-months td').html(html);\n },\n setRange: function setRange(range) {\n if (!range || !range.length) delete this.range;else this.range = $.map(range, function (d) {\n return d.valueOf();\n });\n this.fill();\n },\n getClassNames: function getClassNames(date) {\n var cls = [],\n year = this.viewDate.getUTCFullYear(),\n month = this.viewDate.getUTCMonth(),\n currentDate = this.date.valueOf(),\n today = new Date();\n\n if (date.getUTCFullYear() < year || date.getUTCFullYear() == year && date.getUTCMonth() < month) {\n cls.push('old');\n } else if (date.getUTCFullYear() > year || date.getUTCFullYear() == year && date.getUTCMonth() > month) {\n cls.push('new');\n } // Compare internal UTC date with local today, not UTC today\n\n\n if (this.o.todayHighlight && date.getUTCFullYear() == today.getFullYear() && date.getUTCMonth() == today.getMonth() && date.getUTCDate() == today.getDate()) {\n cls.push('today');\n }\n\n if (currentDate && date.valueOf() == currentDate) {\n cls.push('active');\n }\n\n if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate || $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1) {\n cls.push('disabled');\n }\n\n if (this.range) {\n if (date > this.range[0] && date < this.range[this.range.length - 1]) {\n cls.push('range');\n }\n\n if ($.inArray(date.valueOf(), this.range) != -1) {\n cls.push('selected');\n }\n }\n\n return cls;\n },\n fill: function fill() {\n var d = new Date(this.viewDate),\n year = d.getUTCFullYear(),\n month = d.getUTCMonth(),\n startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,\n startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,\n endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,\n endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,\n currentDate = this.date && this.date.valueOf(),\n tooltip;\n this.picker.find('.datepicker-days thead th.datepicker-switch').text(dates[this.o.language].months[month] + ' ' + year);\n this.picker.find('tfoot th.today').text(dates[this.o.language].today).toggle(this.o.todayBtn !== false);\n this.picker.find('tfoot th.clear').text(dates[this.o.language].clear).toggle(this.o.clearBtn !== false);\n this.updateNavArrows();\n this.fillMonths();\n var prevMonth = UTCDate(year, month - 1, 28, 0, 0, 0, 0),\n day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());\n prevMonth.setUTCDate(day);\n prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7) % 7);\n var nextMonth = new Date(prevMonth);\n nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);\n nextMonth = nextMonth.valueOf();\n var html = [];\n var clsName;\n\n while (prevMonth.valueOf() < nextMonth) {\n if (prevMonth.getUTCDay() == this.o.weekStart) {\n html.push('
');\n\n if (this.o.calendarWeeks) {\n // ISO 8601: First week contains first thursday.\n // ISO also states week starts on Monday, but we can be more abstract here.\n var // Start of current week: based on weekstart/current date\n ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),\n // Thursday of this week\n th = new Date(+ws + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),\n // First Thursday of year, year from thursday\n yth = new Date(+(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay()) % 7 * 864e5),\n // Calendar week: ms between thursdays, div ms per day, div 7 days\n calWeek = (th - yth) / 864e5 / 7 + 1;\n html.push('' + calWeek + ' | ');\n }\n }\n\n clsName = this.getClassNames(prevMonth);\n clsName.push('day');\n var before = this.o.beforeShowDay(prevMonth);\n if (before === undefined) before = {};else if (typeof before === 'boolean') before = {\n enabled: before\n };else if (typeof before === 'string') before = {\n classes: before\n };\n if (before.enabled === false) clsName.push('disabled');\n if (before.classes) clsName = clsName.concat(before.classes.split(/\\s+/));\n if (before.tooltip) tooltip = before.tooltip;\n clsName = $.unique(clsName);\n html.push('' + prevMonth.getUTCDate() + ' | ');\n\n if (prevMonth.getUTCDay() == this.o.weekEnd) {\n html.push('
');\n }\n\n prevMonth.setUTCDate(prevMonth.getUTCDate() + 1);\n }\n\n this.picker.find('.datepicker-days tbody').empty().append(html.join(''));\n var currentYear = this.date && this.date.getUTCFullYear();\n var months = this.picker.find('.datepicker-months').find('th:eq(1)').text(year).end().find('span').removeClass('active');\n\n if (currentYear && currentYear == year) {\n months.eq(this.date.getUTCMonth()).addClass('active');\n }\n\n if (year < startYear || year > endYear) {\n months.addClass('disabled');\n }\n\n if (year == startYear) {\n months.slice(0, startMonth).addClass('disabled');\n }\n\n if (year == endYear) {\n months.slice(endMonth + 1).addClass('disabled');\n }\n\n html = '';\n year = parseInt(year / 10, 10) * 10;\n var yearCont = this.picker.find('.datepicker-years').find('th:eq(1)').text(year + '-' + (year + 9)).end().find('td');\n year -= 1;\n\n for (var i = -1; i < 11; i++) {\n html += '
endYear ? ' disabled' : '') + '\">' + year + '';\n year += 1;\n }\n\n yearCont.html(html);\n },\n updateNavArrows: function updateNavArrows() {\n if (!this._allow_update) return;\n var d = new Date(this.viewDate),\n year = d.getUTCFullYear(),\n month = d.getUTCMonth();\n\n switch (this.viewMode) {\n case 0:\n if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()) {\n this.picker.find('.prev').css({\n visibility: 'hidden'\n });\n } else {\n this.picker.find('.prev').css({\n visibility: 'visible'\n });\n }\n\n if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()) {\n this.picker.find('.next').css({\n visibility: 'hidden'\n });\n } else {\n this.picker.find('.next').css({\n visibility: 'visible'\n });\n }\n\n break;\n\n case 1:\n case 2:\n if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()) {\n this.picker.find('.prev').css({\n visibility: 'hidden'\n });\n } else {\n this.picker.find('.prev').css({\n visibility: 'visible'\n });\n }\n\n if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()) {\n this.picker.find('.next').css({\n visibility: 'hidden'\n });\n } else {\n this.picker.find('.next').css({\n visibility: 'visible'\n });\n }\n\n break;\n }\n },\n click: function click(e) {\n e.preventDefault();\n var target = $(e.target).closest('span, td, th');\n\n if (target.length == 1) {\n switch (target[0].nodeName.toLowerCase()) {\n case 'th':\n switch (target[0].className) {\n case 'datepicker-switch':\n this.showMode(1);\n break;\n\n case 'prev':\n case 'next':\n var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1);\n\n switch (this.viewMode) {\n case 0:\n this.viewDate = this.moveMonth(this.viewDate, dir);\n break;\n\n case 1:\n case 2:\n this.viewDate = this.moveYear(this.viewDate, dir);\n break;\n }\n\n this.fill();\n break;\n\n case 'today':\n var date = new Date();\n date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);\n this.showMode(-2);\n var which = this.o.todayBtn == 'linked' ? null : 'view';\n\n this._setDate(date, which);\n\n break;\n\n case 'clear':\n var element;\n if (this.isInput) element = this.element;else if (this.component) element = this.element.find('input');\n if (element) element.val(\"\").change();\n\n this._trigger('changeDate');\n\n this.update();\n if (this.o.autoclose) this.hide();\n break;\n }\n\n break;\n\n case 'span':\n if (!target.is('.disabled')) {\n this.viewDate.setUTCDate(1);\n\n if (target.is('.month')) {\n var day = 1;\n var month = target.parent().find('span').index(target);\n var year = this.viewDate.getUTCFullYear();\n this.viewDate.setUTCMonth(month);\n\n this._trigger('changeMonth', this.viewDate);\n\n if (this.o.minViewMode === 1) {\n this._setDate(UTCDate(year, month, day, 0, 0, 0, 0));\n }\n } else {\n var year = parseInt(target.text(), 10) || 0;\n var day = 1;\n var month = 0;\n this.viewDate.setUTCFullYear(year);\n\n this._trigger('changeYear', this.viewDate);\n\n if (this.o.minViewMode === 2) {\n this._setDate(UTCDate(year, month, day, 0, 0, 0, 0));\n }\n }\n\n this.showMode(-1);\n this.fill();\n }\n\n break;\n\n case 'td':\n if (target.is('.day') && !target.is('.disabled')) {\n var day = parseInt(target.text(), 10) || 1;\n var year = this.viewDate.getUTCFullYear(),\n month = this.viewDate.getUTCMonth();\n\n if (target.is('.old')) {\n if (month === 0) {\n month = 11;\n year -= 1;\n } else {\n month -= 1;\n }\n } else if (target.is('.new')) {\n if (month == 11) {\n month = 0;\n year += 1;\n } else {\n month += 1;\n }\n }\n\n this._setDate(UTCDate(year, month, day, 0, 0, 0, 0));\n }\n\n break;\n }\n }\n },\n _setDate: function _setDate(date, which) {\n if (!which || which == 'date') this.date = new Date(date);\n if (!which || which == 'view') this.viewDate = new Date(date);\n this.fill();\n this.setValue();\n\n this._trigger('changeDate');\n\n var element;\n\n if (this.isInput) {\n element = this.element;\n } else if (this.component) {\n element = this.element.find('input');\n }\n\n if (element) {\n element.change();\n\n if (this.o.autoclose && (!which || which == 'date')) {\n this.hide();\n }\n }\n },\n moveMonth: function moveMonth(date, dir) {\n if (!dir) return date;\n var new_date = new Date(date.valueOf()),\n day = new_date.getUTCDate(),\n month = new_date.getUTCMonth(),\n mag = Math.abs(dir),\n new_month,\n test;\n dir = dir > 0 ? 1 : -1;\n\n if (mag == 1) {\n test = dir == -1 // If going back one month, make sure month is not current month\n // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)\n ? function () {\n return new_date.getUTCMonth() == month;\n } // If going forward one month, make sure month is as expected\n // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)\n : function () {\n return new_date.getUTCMonth() != new_month;\n };\n new_month = month + dir;\n new_date.setUTCMonth(new_month); // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11\n\n if (new_month < 0 || new_month > 11) new_month = (new_month + 12) % 12;\n } else {\n // For magnitudes >1, move one month at a time...\n for (var i = 0; i < mag; i++) {\n // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...\n new_date = this.moveMonth(new_date, dir);\n } // ...then reset the day, keeping it in the new month\n\n\n new_month = new_date.getUTCMonth();\n new_date.setUTCDate(day);\n\n test = function test() {\n return new_month != new_date.getUTCMonth();\n };\n } // Common date-resetting loop -- if date is beyond end of month, make it\n // end of month\n\n\n while (test()) {\n new_date.setUTCDate(--day);\n new_date.setUTCMonth(new_month);\n }\n\n return new_date;\n },\n moveYear: function moveYear(date, dir) {\n return this.moveMonth(date, dir * 12);\n },\n dateWithinRange: function dateWithinRange(date) {\n return date >= this.o.startDate && date <= this.o.endDate;\n },\n keydown: function keydown(e) {\n if (this.picker.is(':not(:visible)')) {\n if (e.keyCode == 27) // allow escape to hide and re-show picker\n this.show();\n return;\n }\n\n var dateChanged = false,\n dir,\n day,\n month,\n newDate,\n newViewDate;\n\n switch (e.keyCode) {\n case 27:\n // escape\n this.hide();\n e.preventDefault();\n break;\n\n case 37: // left\n\n case 39:\n // right\n if (!this.o.keyboardNavigation) break;\n dir = e.keyCode == 37 ? -1 : 1;\n\n if (e.ctrlKey) {\n newDate = this.moveYear(this.date, dir);\n newViewDate = this.moveYear(this.viewDate, dir);\n } else if (e.shiftKey) {\n newDate = this.moveMonth(this.date, dir);\n newViewDate = this.moveMonth(this.viewDate, dir);\n } else {\n newDate = new Date(this.date);\n newDate.setUTCDate(this.date.getUTCDate() + dir);\n newViewDate = new Date(this.viewDate);\n newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir);\n }\n\n if (this.dateWithinRange(newDate)) {\n this.date = newDate;\n this.viewDate = newViewDate;\n this.setValue();\n this.update();\n e.preventDefault();\n dateChanged = true;\n }\n\n break;\n\n case 38: // up\n\n case 40:\n // down\n if (!this.o.keyboardNavigation) break;\n dir = e.keyCode == 38 ? -1 : 1;\n\n if (e.ctrlKey) {\n newDate = this.moveYear(this.date, dir);\n newViewDate = this.moveYear(this.viewDate, dir);\n } else if (e.shiftKey) {\n newDate = this.moveMonth(this.date, dir);\n newViewDate = this.moveMonth(this.viewDate, dir);\n } else {\n newDate = new Date(this.date);\n newDate.setUTCDate(this.date.getUTCDate() + dir * 7);\n newViewDate = new Date(this.viewDate);\n newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7);\n }\n\n if (this.dateWithinRange(newDate)) {\n this.date = newDate;\n this.viewDate = newViewDate;\n this.setValue();\n this.update();\n e.preventDefault();\n dateChanged = true;\n }\n\n break;\n\n case 13:\n // enter\n this.hide();\n e.preventDefault();\n break;\n\n case 9:\n // tab\n this.hide();\n break;\n }\n\n if (dateChanged) {\n this._trigger('changeDate');\n\n var element;\n\n if (this.isInput) {\n element = this.element;\n } else if (this.component) {\n element = this.element.find('input');\n }\n\n if (element) {\n element.change();\n }\n }\n },\n showMode: function showMode(dir) {\n if (dir) {\n this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));\n }\n /*\n \tvitalets: fixing bug of very special conditions:\n \tjquery 1.7.1 + webkit + show inline datepicker in bootstrap popover.\n \tMethod show() does not set display css correctly and datepicker is not shown.\n \tChanged to .css('display', 'block') solve the problem.\n \tSee https://github.com/vitalets/x-editable/issues/37\n \t\tIn jquery 1.7.2+ everything works fine.\n */\n //this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();\n\n\n this.picker.find('>div').hide().filter('.datepicker-' + DPGlobal.modes[this.viewMode].clsName).css('display', 'block');\n this.updateNavArrows();\n }\n };\n\n var DateRangePicker = function DateRangePicker(element, options) {\n this.element = $(element);\n this.inputs = $.map(options.inputs, function (i) {\n return i.jquery ? i[0] : i;\n });\n delete options.inputs;\n $(this.inputs).datepicker(options).bind('changeDate', $.proxy(this.dateUpdated, this));\n this.pickers = $.map(this.inputs, function (i) {\n return $(i).data('datepicker');\n });\n this.updateDates();\n };\n\n DateRangePicker.prototype = {\n updateDates: function updateDates() {\n this.dates = $.map(this.pickers, function (i) {\n return i.date;\n });\n this.updateRanges();\n },\n updateRanges: function updateRanges() {\n var range = $.map(this.dates, function (d) {\n return d.valueOf();\n });\n $.each(this.pickers, function (i, p) {\n p.setRange(range);\n });\n },\n dateUpdated: function dateUpdated(e) {\n var dp = $(e.target).data('datepicker'),\n new_date = dp.getUTCDate(),\n i = $.inArray(e.target, this.inputs),\n l = this.inputs.length;\n if (i == -1) return;\n\n if (new_date < this.dates[i]) {\n // Date being moved earlier/left\n while (i >= 0 && new_date < this.dates[i]) {\n this.pickers[i--].setUTCDate(new_date);\n }\n } else if (new_date > this.dates[i]) {\n // Date being moved later/right\n while (i < l && new_date > this.dates[i]) {\n this.pickers[i++].setUTCDate(new_date);\n }\n }\n\n this.updateDates();\n },\n remove: function remove() {\n $.map(this.pickers, function (p) {\n p.remove();\n });\n delete this.element.data().datepicker;\n }\n };\n\n function opts_from_el(el, prefix) {\n // Derive options from element data-attrs\n var data = $(el).data(),\n out = {},\n inkey,\n replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])'),\n prefix = new RegExp('^' + prefix.toLowerCase());\n\n for (var key in data) {\n if (prefix.test(key)) {\n inkey = key.replace(replace, function (_, a) {\n return a.toLowerCase();\n });\n out[inkey] = data[key];\n }\n }\n\n return out;\n }\n\n function opts_from_locale(lang) {\n // Derive options from locale plugins\n var out = {}; // Check if \"de-DE\" style date is available, if not language should\n // fallback to 2 letter code eg \"de\"\n\n if (!dates[lang]) {\n lang = lang.split('-')[0];\n if (!dates[lang]) return;\n }\n\n var d = dates[lang];\n $.each(locale_opts, function (i, k) {\n if (k in d) out[k] = d[k];\n });\n return out;\n }\n\n var old = $.fn.datepicker;\n\n var datepicker = $.fn.datepicker = function (option) {\n var args = Array.apply(null, arguments);\n args.shift();\n var internal_return, this_return;\n this.each(function () {\n var $this = $(this),\n data = $this.data('datepicker'),\n options = _typeof(option) == 'object' && option;\n\n if (!data) {\n var elopts = opts_from_el(this, 'date'),\n // Preliminary otions\n xopts = $.extend({}, defaults, elopts, options),\n locopts = opts_from_locale(xopts.language),\n // Options priority: js args, data-attrs, locales, defaults\n opts = $.extend({}, defaults, locopts, elopts, options);\n\n if ($this.is('.input-daterange') || opts.inputs) {\n var ropts = {\n inputs: opts.inputs || $this.find('input').toArray()\n };\n $this.data('datepicker', data = new DateRangePicker(this, $.extend(opts, ropts)));\n } else {\n $this.data('datepicker', data = new Datepicker(this, opts));\n }\n }\n\n if (typeof option == 'string' && typeof data[option] == 'function') {\n internal_return = data[option].apply(data, args);\n if (internal_return !== undefined) return false;\n }\n });\n if (internal_return !== undefined) return internal_return;else return this;\n };\n\n var defaults = $.fn.datepicker.defaults = {\n autoclose: false,\n beforeShowDay: $.noop,\n calendarWeeks: false,\n clearBtn: false,\n daysOfWeekDisabled: [],\n endDate: Infinity,\n forceParse: true,\n format: 'mm/dd/yyyy',\n keyboardNavigation: true,\n language: 'en',\n minViewMode: 0,\n rtl: false,\n startDate: -Infinity,\n startView: 0,\n todayBtn: false,\n todayHighlight: false,\n weekStart: 0\n };\n var locale_opts = $.fn.datepicker.locale_opts = ['format', 'rtl', 'weekStart'];\n $.fn.datepicker.Constructor = Datepicker;\n var dates = $.fn.datepicker.dates = {\n en: {\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"Sunday\"],\n daysShort: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"],\n daysMin: [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\", \"Su\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n monthsShort: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"],\n today: \"Today\",\n clear: \"Clear\"\n }\n };\n var DPGlobal = {\n modes: [{\n clsName: 'days',\n navFnc: 'Month',\n navStep: 1\n }, {\n clsName: 'months',\n navFnc: 'FullYear',\n navStep: 1\n }, {\n clsName: 'years',\n navFnc: 'FullYear',\n navStep: 10\n }],\n isLeapYear: function isLeapYear(year) {\n return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;\n },\n getDaysInMonth: function getDaysInMonth(year, month) {\n return [31, DPGlobal.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];\n },\n validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,\n nonpunctuation: /[^ -\\/:-@\\[\\u3400-\\u9fff-`{-~\\t\\n\\r]+/g,\n parseFormat: function parseFormat(format) {\n // IE treats \\0 as a string end in inputs (truncating the value),\n // so it's a bad format delimiter, anyway\n var separators = format.replace(this.validParts, '\\0').split('\\0'),\n parts = format.match(this.validParts);\n\n if (!separators || !separators.length || !parts || parts.length === 0) {\n throw new Error(\"Invalid date format.\");\n }\n\n return {\n separators: separators,\n parts: parts\n };\n },\n parseDate: function parseDate(date, format, language) {\n if (date instanceof Date) return date;\n if (typeof format === 'string') format = DPGlobal.parseFormat(format);\n\n if (/^[\\-+]\\d+[dmwy]([\\s,]+[\\-+]\\d+[dmwy])*$/.test(date)) {\n var part_re = /([\\-+]\\d+)([dmwy])/,\n parts = date.match(/([\\-+]\\d+)([dmwy])/g),\n part,\n dir;\n date = new Date();\n\n for (var i = 0; i < parts.length; i++) {\n part = part_re.exec(parts[i]);\n dir = parseInt(part[1]);\n\n switch (part[2]) {\n case 'd':\n date.setUTCDate(date.getUTCDate() + dir);\n break;\n\n case 'm':\n date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);\n break;\n\n case 'w':\n date.setUTCDate(date.getUTCDate() + dir * 7);\n break;\n\n case 'y':\n date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);\n break;\n }\n }\n\n return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);\n }\n\n var parts = date && date.match(this.nonpunctuation) || [],\n date = new Date(),\n parsed = {},\n setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],\n setters_map = {\n yyyy: function yyyy(d, v) {\n return d.setUTCFullYear(v);\n },\n yy: function yy(d, v) {\n return d.setUTCFullYear(2000 + v);\n },\n m: function m(d, v) {\n v -= 1;\n\n while (v < 0) {\n v += 12;\n }\n\n v %= 12;\n d.setUTCMonth(v);\n\n while (d.getUTCMonth() != v) {\n d.setUTCDate(d.getUTCDate() - 1);\n }\n\n return d;\n },\n d: function d(_d, v) {\n return _d.setUTCDate(v);\n }\n },\n val,\n filtered,\n part;\n setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];\n setters_map['dd'] = setters_map['d'];\n date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);\n var fparts = format.parts.slice(); // Remove noop parts\n\n if (parts.length != fparts.length) {\n fparts = $(fparts).filter(function (i, p) {\n return $.inArray(p, setters_order) !== -1;\n }).toArray();\n } // Process remainder\n\n\n if (parts.length == fparts.length) {\n for (var i = 0, cnt = fparts.length; i < cnt; i++) {\n val = parseInt(parts[i], 10);\n part = fparts[i];\n\n if (isNaN(val)) {\n switch (part) {\n case 'MM':\n filtered = $(dates[language].months).filter(function () {\n var m = this.slice(0, parts[i].length),\n p = parts[i].slice(0, m.length);\n return m == p;\n });\n val = $.inArray(filtered[0], dates[language].months) + 1;\n break;\n\n case 'M':\n filtered = $(dates[language].monthsShort).filter(function () {\n var m = this.slice(0, parts[i].length),\n p = parts[i].slice(0, m.length);\n return m == p;\n });\n val = $.inArray(filtered[0], dates[language].monthsShort) + 1;\n break;\n }\n }\n\n parsed[part] = val;\n }\n\n for (var i = 0, s; i < setters_order.length; i++) {\n s = setters_order[i];\n if (s in parsed && !isNaN(parsed[s])) setters_map[s](date, parsed[s]);\n }\n }\n\n return date;\n },\n formatDate: function formatDate(date, format, language) {\n if (typeof format === 'string') format = DPGlobal.parseFormat(format);\n var val = {\n d: date.getUTCDate(),\n D: dates[language].daysShort[date.getUTCDay()],\n DD: dates[language].days[date.getUTCDay()],\n m: date.getUTCMonth() + 1,\n M: dates[language].monthsShort[date.getUTCMonth()],\n MM: dates[language].months[date.getUTCMonth()],\n yy: date.getUTCFullYear().toString().substring(2),\n yyyy: date.getUTCFullYear()\n };\n val.dd = (val.d < 10 ? '0' : '') + val.d;\n val.mm = (val.m < 10 ? '0' : '') + val.m;\n var date = [],\n seps = $.extend([], format.separators);\n\n for (var i = 0, cnt = format.parts.length; i <= cnt; i++) {\n if (seps.length) date.push(seps.shift());\n date.push(val[format.parts[i]]);\n }\n\n return date.join('');\n },\n headTemplate: '
' + '' + ' | ' + ' | ' + ' | ' + '
' + '',\n contTemplate: '
|
',\n footTemplate: '
|
---|
|
---|
'\n };\n DPGlobal.template = '
' + '
' + '
' + DPGlobal.headTemplate + '' + DPGlobal.footTemplate + '
' + '
' + '
' + '
' + DPGlobal.headTemplate + DPGlobal.contTemplate + DPGlobal.footTemplate + '
' + '
' + '
' + '
' + DPGlobal.headTemplate + DPGlobal.contTemplate + DPGlobal.footTemplate + '
' + '
' + '
';\n $.fn.datepicker.DPGlobal = DPGlobal;\n /* DATEPICKER NO CONFLICT\n * =================== */\n\n $.fn.datepicker.noConflict = function () {\n $.fn.datepicker = old;\n return this;\n };\n /* DATEPICKER DATA-API\n * ================== */\n\n\n $(document).on('focus.datepicker.data-api click.datepicker.data-api', '[data-provide=\"datepicker\"]', function (e) {\n var $this = $(this);\n if ($this.data('datepicker')) return;\n e.preventDefault(); // component click requires us to explicitly show it\n\n datepicker.call($this, 'show');\n });\n $(function () {\n //$('[data-provide=\"datepicker-inline\"]').datepicker();\n //vit: changed to support noConflict()\n datepicker.call($('[data-provide=\"datepicker-inline\"]'));\n });\n})(window.jQuery);\n/**\nBootstrap-datepicker. \nDescription and examples: https://github.com/eternicode/bootstrap-datepicker. \nFor **i18n** you should include js file from here: https://github.com/eternicode/bootstrap-datepicker/tree/master/js/locales\nand set `language` option. \nSince 1.4.0 date has different appearance in **popup** and **inline** modes. \n\n@class date\n@extends abstractinput\n@final\n@example\n
15/05/1984\n\n**/\n\n\n(function ($) {\n \"use strict\"; //store bootstrap-datepicker as bdateicker to exclude conflict with jQuery UI one\n\n $.fn.bdatepicker = $.fn.datepicker.noConflict();\n\n if (!$.fn.datepicker) {\n //if there were no other datepickers, keep also original name\n $.fn.datepicker = $.fn.bdatepicker;\n }\n\n var Date = function Date(options) {\n this.init('date', options, Date.defaults);\n this.initPicker(options, Date.defaults);\n };\n\n $.fn.editableutils.inherit(Date, $.fn.editabletypes.abstractinput);\n $.extend(Date.prototype, {\n initPicker: function initPicker(options, defaults) {\n //'format' is set directly from settings or data-* attributes\n //by default viewformat equals to format\n if (!this.options.viewformat) {\n this.options.viewformat = this.options.format;\n } //try parse datepicker config defined as json string in data-datepicker\n\n\n options.datepicker = $.fn.editableutils.tryParseJson(options.datepicker, true); //overriding datepicker config (as by default jQuery extend() is not recursive)\n //since 1.4 datepicker internally uses viewformat instead of format. Format is for submit only\n\n this.options.datepicker = $.extend({}, defaults.datepicker, options.datepicker, {\n format: this.options.viewformat\n }); //language\n\n this.options.datepicker.language = this.options.datepicker.language || 'en'; //store DPglobal\n\n this.dpg = $.fn.bdatepicker.DPGlobal; //store parsed formats\n\n this.parsedFormat = this.dpg.parseFormat(this.options.format);\n this.parsedViewFormat = this.dpg.parseFormat(this.options.viewformat);\n },\n render: function render() {\n this.$input.bdatepicker(this.options.datepicker); //\"clear\" link\n\n if (this.options.clear) {\n this.$clear = $('
').html(this.options.clear).click($.proxy(function (e) {\n e.preventDefault();\n e.stopPropagation();\n this.clear();\n }, this));\n this.$tpl.parent().append($('
').append(this.$clear));\n }\n },\n value2html: function value2html(value, element) {\n var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';\n Date.superclass.value2html.call(this, text, element);\n },\n html2value: function html2value(html) {\n return this.parseDate(html, this.parsedViewFormat);\n },\n value2str: function value2str(value) {\n return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : '';\n },\n str2value: function str2value(str) {\n return this.parseDate(str, this.parsedFormat);\n },\n value2submit: function value2submit(value) {\n return this.value2str(value);\n },\n value2input: function value2input(value) {\n this.$input.bdatepicker('update', value);\n },\n input2value: function input2value() {\n return this.$input.data('datepicker').date;\n },\n activate: function activate() {},\n clear: function clear() {\n this.$input.data('datepicker').date = null;\n this.$input.find('.active').removeClass('active');\n\n if (!this.options.showbuttons) {\n this.$input.closest('form').submit();\n }\n },\n autosubmit: function autosubmit() {\n this.$input.on('mouseup', '.day', function (e) {\n if ($(e.currentTarget).is('.old') || $(e.currentTarget).is('.new')) {\n return;\n }\n\n var $form = $(this).closest('form');\n setTimeout(function () {\n $form.submit();\n }, 200);\n }); //changedate is not suitable as it triggered when showing datepicker. see #149\n\n /*\n this.$input.on('changeDate', function(e){\n var $form = $(this).closest('form');\n setTimeout(function() {\n $form.submit();\n }, 200);\n });\n */\n },\n\n /*\n For incorrect date bootstrap-datepicker returns current date that is not suitable\n for datefield.\n This function returns null for incorrect date. \n */\n parseDate: function parseDate(str, format) {\n var date = null,\n formattedBack;\n\n if (str) {\n date = this.dpg.parseDate(str, format, this.options.datepicker.language);\n\n if (typeof str === 'string') {\n formattedBack = this.dpg.formatDate(date, format, this.options.datepicker.language);\n\n if (str !== formattedBack) {\n date = null;\n }\n }\n }\n\n return date;\n }\n });\n Date.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {\n /**\n @property tpl \n @default
\n **/\n tpl: '
',\n\n /**\n @property inputclass \n @default null\n **/\n inputclass: null,\n\n /**\n Format used for sending value to server. Also applied when converting date from
data-value
attribute.
\n Possible tokens are:
d, dd, m, mm, yy, yyyy
\n @property format \n @type string\n @default yyyy-mm-dd\n **/\n format: 'yyyy-mm-dd',\n\n /**\n Format used for displaying date. Also applied when converting date from element's text on init. \n If not specified equals to
format
\n @property viewformat \n @type string\n @default null\n **/\n viewformat: null,\n\n /**\n Configuration of datepicker.\n Full list of options: http://bootstrap-datepicker.readthedocs.org/en/latest/options.html\n @property datepicker \n @type object\n @default {\n weekStart: 0,\n startView: 0,\n minViewMode: 0,\n autoclose: false\n }\n **/\n datepicker: {\n weekStart: 0,\n startView: 0,\n minViewMode: 0,\n autoclose: false\n },\n\n /**\n Text shown as clear date button. \n If
false
clear button will not be rendered.\n @property clear \n @type boolean|string\n @default 'x clear'\n **/\n clear: '× clear'\n });\n $.fn.editabletypes.date = Date;\n})(window.jQuery);\n/**\nBootstrap datefield input - modification for inline mode.\nShows normal
and binds popup datepicker.\nAutomatically shown in inline mode.\n\n@class datefield\n@extends date\n\n@since 1.4.0\n**/\n\n\n(function ($) {\n \"use strict\";\n\n var DateField = function DateField(options) {\n this.init('datefield', options, DateField.defaults);\n this.initPicker(options, DateField.defaults);\n };\n\n $.fn.editableutils.inherit(DateField, $.fn.editabletypes.date);\n $.extend(DateField.prototype, {\n render: function render() {\n this.$input = this.$tpl.find('input');\n this.setClass();\n this.setAttr('placeholder'); //bootstrap-datepicker is set `bdateicker` to exclude conflict with jQuery UI one. (in date.js)\n\n this.$input.bdatepicker(this.options.datepicker); //need to disable original event handlers\n\n this.$input.off('focus keydown'); //update value of datepicker\n\n this.$input.keyup($.proxy(function () {\n this.$tpl.removeData('date');\n this.$tpl.bdatepicker('update');\n }, this));\n },\n value2input: function value2input(value) {\n this.$input.val(value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '');\n this.$tpl.bdatepicker('update');\n },\n input2value: function input2value() {\n return this.html2value(this.$input.val());\n },\n activate: function activate() {\n $.fn.editabletypes.text.prototype.activate.call(this);\n },\n autosubmit: function autosubmit() {//reset autosubmit to empty\n }\n });\n DateField.defaults = $.extend({}, $.fn.editabletypes.date.defaults, {\n /**\n @property tpl\n **/\n tpl: '
',\n\n /**\n @property inputclass\n @default 'input-small'\n **/\n inputclass: 'input-small',\n\n /* datepicker config */\n datepicker: {\n weekStart: 0,\n startView: 0,\n minViewMode: 0,\n autoclose: true\n }\n });\n $.fn.editabletypes.datefield = DateField;\n})(window.jQuery);\n/**\nBootstrap-datetimepicker. \nBased on [smalot bootstrap-datetimepicker plugin](https://github.com/smalot/bootstrap-datetimepicker). \nBefore usage you should manually include dependent js and css:\n\n
\n \n\nFor **i18n** you should include js file from here: https://github.com/smalot/bootstrap-datetimepicker/tree/master/js/locales\nand set `language` option. \n\n@class datetime\n@extends abstractinput\n@final\n@since 1.4.4\n@example\n
15/03/2013 12:45\n\n**/\n\n\n(function ($) {\n \"use strict\";\n\n var DateTime = function DateTime(options) {\n this.init('datetime', options, DateTime.defaults);\n this.initPicker(options, DateTime.defaults);\n };\n\n $.fn.editableutils.inherit(DateTime, $.fn.editabletypes.abstractinput);\n $.extend(DateTime.prototype, {\n initPicker: function initPicker(options, defaults) {\n //'format' is set directly from settings or data-* attributes\n //by default viewformat equals to format\n if (!this.options.viewformat) {\n this.options.viewformat = this.options.format;\n } //try parse datetimepicker config defined as json string in data-datetimepicker\n\n\n options.datetimepicker = $.fn.editableutils.tryParseJson(options.datetimepicker, true); //overriding datetimepicker config (as by default jQuery extend() is not recursive)\n //since 1.4 datetimepicker internally uses viewformat instead of format. Format is for submit only\n\n this.options.datetimepicker = $.extend({}, defaults.datetimepicker, options.datetimepicker, {\n format: this.options.viewformat\n }); //language\n\n this.options.datetimepicker.language = this.options.datetimepicker.language || 'en'; //store DPglobal\n\n this.dpg = $.fn.datetimepicker.DPGlobal; //store parsed formats\n\n this.parsedFormat = this.dpg.parseFormat(this.options.format, this.options.formatType);\n this.parsedViewFormat = this.dpg.parseFormat(this.options.viewformat, this.options.formatType);\n },\n render: function render() {\n this.$input.datetimepicker(this.options.datetimepicker); //adjust container position when viewMode changes\n //see https://github.com/smalot/bootstrap-datetimepicker/pull/80\n\n this.$input.on('changeMode', function (e) {\n var f = $(this).closest('form').parent(); //timeout here, otherwise container changes position before form has new size\n\n setTimeout(function () {\n f.triggerHandler('resize');\n }, 0);\n }); //\"clear\" link\n\n if (this.options.clear) {\n this.$clear = $('
').html(this.options.clear).click($.proxy(function (e) {\n e.preventDefault();\n e.stopPropagation();\n this.clear();\n }, this));\n this.$tpl.parent().append($('
').append(this.$clear));\n }\n },\n value2html: function value2html(value, element) {\n //formatDate works with UTCDate!\n var text = value ? this.dpg.formatDate(this.toUTC(value), this.parsedViewFormat, this.options.datetimepicker.language, this.options.formatType) : '';\n\n if (element) {\n DateTime.superclass.value2html.call(this, text, element);\n } else {\n return text;\n }\n },\n html2value: function html2value(html) {\n //parseDate return utc date!\n var value = this.parseDate(html, this.parsedViewFormat);\n return value ? this.fromUTC(value) : null;\n },\n value2str: function value2str(value) {\n //formatDate works with UTCDate!\n return value ? this.dpg.formatDate(this.toUTC(value), this.parsedFormat, this.options.datetimepicker.language, this.options.formatType) : '';\n },\n str2value: function str2value(str) {\n //parseDate return utc date!\n var value = this.parseDate(str, this.parsedFormat);\n return value ? this.fromUTC(value) : null;\n },\n value2submit: function value2submit(value) {\n return this.value2str(value);\n },\n value2input: function value2input(value) {\n if (value) {\n this.$input.data('datetimepicker').setDate(value);\n }\n },\n input2value: function input2value() {\n //date may be cleared, in that case getDate() triggers error\n var dt = this.$input.data('datetimepicker');\n return dt.date ? dt.getDate() : null;\n },\n activate: function activate() {},\n clear: function clear() {\n this.$input.data('datetimepicker').date = null;\n this.$input.find('.active').removeClass('active');\n\n if (!this.options.showbuttons) {\n this.$input.closest('form').submit();\n }\n },\n autosubmit: function autosubmit() {\n this.$input.on('mouseup', '.minute', function (e) {\n var $form = $(this).closest('form');\n setTimeout(function () {\n $form.submit();\n }, 200);\n });\n },\n //convert date from local to utc\n toUTC: function toUTC(value) {\n return value ? new Date(value.valueOf() - value.getTimezoneOffset() * 60000) : value;\n },\n //convert date from utc to local\n fromUTC: function fromUTC(value) {\n return value ? new Date(value.valueOf() + value.getTimezoneOffset() * 60000) : value;\n },\n\n /*\n For incorrect date bootstrap-datetimepicker returns current date that is not suitable\n for datetimefield.\n This function returns null for incorrect date. \n */\n parseDate: function parseDate(str, format) {\n var date = null,\n formattedBack;\n\n if (str) {\n date = this.dpg.parseDate(str, format, this.options.datetimepicker.language, this.options.formatType);\n\n if (typeof str === 'string') {\n formattedBack = this.dpg.formatDate(date, format, this.options.datetimepicker.language, this.options.formatType);\n\n if (str !== formattedBack) {\n date = null;\n }\n }\n }\n\n return date;\n }\n });\n DateTime.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {\n /**\n @property tpl \n @default
\n **/\n tpl: '
',\n\n /**\n @property inputclass \n @default null\n **/\n inputclass: null,\n\n /**\n Format used for sending value to server. Also applied when converting date from
data-value
attribute.
\n Possible tokens are:
d, dd, m, mm, yy, yyyy, h, i
\n \n @property format \n @type string\n @default yyyy-mm-dd hh:ii\n **/\n format: 'yyyy-mm-dd hh:ii',\n formatType: 'standard',\n\n /**\n Format used for displaying date. Also applied when converting date from element's text on init. \n If not specified equals to
format
\n \n @property viewformat \n @type string\n @default null\n **/\n viewformat: null,\n\n /**\n Configuration of datetimepicker.\n Full list of options: https://github.com/smalot/bootstrap-datetimepicker\n @property datetimepicker \n @type object\n @default { }\n **/\n datetimepicker: {\n todayHighlight: false,\n autoclose: false\n },\n\n /**\n Text shown as clear date button. \n If
false
clear button will not be rendered.\n @property clear \n @type boolean|string\n @default 'x clear'\n **/\n clear: '× clear'\n });\n $.fn.editabletypes.datetime = DateTime;\n})(window.jQuery);\n/**\nBootstrap datetimefield input - datetime input for inline mode.\nShows normal
and binds popup datetimepicker. \nAutomatically shown in inline mode.\n\n@class datetimefield\n@extends datetime\n\n**/\n\n\n(function ($) {\n \"use strict\";\n\n var DateTimeField = function DateTimeField(options) {\n this.init('datetimefield', options, DateTimeField.defaults);\n this.initPicker(options, DateTimeField.defaults);\n };\n\n $.fn.editableutils.inherit(DateTimeField, $.fn.editabletypes.datetime);\n $.extend(DateTimeField.prototype, {\n render: function render() {\n this.$input = this.$tpl.find('input');\n this.setClass();\n this.setAttr('placeholder');\n this.$tpl.datetimepicker(this.options.datetimepicker); //need to disable original event handlers\n\n this.$input.off('focus keydown'); //update value of datepicker\n\n this.$input.keyup($.proxy(function () {\n this.$tpl.removeData('date');\n this.$tpl.datetimepicker('update');\n }, this));\n },\n value2input: function value2input(value) {\n this.$input.val(this.value2html(value));\n this.$tpl.datetimepicker('update');\n },\n input2value: function input2value() {\n return this.html2value(this.$input.val());\n },\n activate: function activate() {\n $.fn.editabletypes.text.prototype.activate.call(this);\n },\n autosubmit: function autosubmit() {//reset autosubmit to empty \n }\n });\n DateTimeField.defaults = $.extend({}, $.fn.editabletypes.datetime.defaults, {\n /**\n @property tpl \n **/\n tpl: '
',\n\n /**\n @property inputclass \n @default 'input-medium'\n **/\n inputclass: 'input-medium',\n\n /* datetimepicker config */\n datetimepicker: {\n todayHighlight: false,\n autoclose: true\n }\n });\n $.fn.editabletypes.datetimefield = DateTimeField;\n})(window.jQuery);","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/*! Bootstrap 4 integration for DataTables' Responsive\n * ©2016 SpryMedia Ltd - datatables.net/license\n */\n(function (factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD\n define(['jquery', 'datatables.net-bs4', 'datatables.net-responsive'], function ($) {\n return factory($, window, document);\n });\n } else if ((typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === 'object') {\n // CommonJS\n module.exports = function (root, $) {\n if (!root) {\n root = window;\n }\n\n if (!$ || !$.fn.dataTable) {\n $ = require('datatables.net-bs4')(root, $).$;\n }\n\n if (!$.fn.dataTable.Responsive) {\n require('datatables.net-responsive')(root, $);\n }\n\n return factory($, root, root.document);\n };\n } else {\n // Browser\n factory(jQuery, window, document);\n }\n})(function ($, window, document, undefined) {\n 'use strict';\n\n var DataTable = $.fn.dataTable;\n var _display = DataTable.Responsive.display;\n var _original = _display.modal;\n\n var _modal = $('
' + '
');\n\n _display.modal = function (options) {\n return function (row, update, render) {\n if (!$.fn.modal) {\n _original(row, update, render);\n } else {\n if (!update) {\n if (options && options.header) {\n var header = _modal.find('div.modal-header');\n\n var button = header.find('button').detach();\n header.empty().append('
' + options.header(row) + '
').append(button);\n }\n\n _modal.find('div.modal-body').empty().append(render());\n\n _modal.appendTo('body').modal();\n }\n }\n };\n };\n\n return DataTable.Responsive;\n});","$(function() {\n $('.creature_traits select').select2({\n maximumSelectionLength: 5,\n tags: true,\n tokenSeparators: [',', ' '],\n theme: 'bootstrap4'\n });\n\n $('.creature_languages select').select2({\n tags: true,\n tokenSeparators: [',', ' '],\n theme: 'bootstrap4'\n });\n\n if ( $('.faq-nav').length ) {\n $('.faq-nav li a').click(function() { \n $('.faq-nav li a').removeClass('active');\n $(this).addClass('active');\n }); \n }\n \n // RSS Feed to pull latest two RFC episodes\n if ( $('#rss-feeds').length ) {\n $(document).on(\"click\", \".rss-wrapper .close-icon\", function() {\n $('.rss-wrapper').hide();\n });\n };\n\n // Twitter & FB sharing\n if ( $('.share').length ) {\n $('.share').each(function() {\n var shareText, \n shareUrl = window.location.href,\n uri = window.location.href,\n twitterShare = $(this).find('span.twitter'),\n facebookShare = $(this).find('span.facebook');\n\n // check if we're on the blog page with articles b/c we want to share links directly to each article for this page\n if ($(this).closest('article').length) {\n // find title of article\n shareText = $(this).closest('article').find('h2').text();\n // remove any existing hash in the URL\n if (window.location.hash != '') {\n uri = window.location.href.split(\"#\")[0];\n } \n // find the article ID and use as the new hash in the share URL\n // %23: URL encoding #\n var articleId = $(this).closest('article').prop('id');\n shareUrl = uri + '%23' + articleId;\n } \n\n // twitter\n twitterShare.click(function() {\n var twitterWindow = window.open('https://twitter.com/intent/tweet?text=' + shareText + ' ' + shareUrl + ' via @rollforcombat', 'twitter-popup', 'height=350,width=600');\n if(twitterWindow.focus) { twitterWindow.focus(); } \n });\n \n // fb (does not allow pre-filled text)\n facebookShare.click(function() {\n var facebookWindow = window.open('https://www.facebook.com/sharer/sharer.php?u=' + shareUrl, 'facebook-popup', 'height=350,width=600');\n if(facebookWindow.focus) { facebookWindow.focus(); }\n });\n\n });\n };\n\n})\n","import {createEditor} from \"creature_editor\";\nimport './stylesheets/editor'\n\n$(function() {\n //$(\".datetimepicker-input\").datetimepicker();\n //$('.contest-monsters-table').dataTable();\n\n $('.datetimepicker-input').each(function() {\n let date = moment($(this).val(), 'MM-DD-YYYY hh:mm a').toDate();\n $(this).datetimepicker({date: date});\n });\n\n $('#all-creatures-table, #submitted-creatures-table, #nominated-creatures-table, #winner-creatures-table').each(function(idx, table) {\n let url = $(table).attr('id').split('-')[0];\n let contestId = $(table).data('contest-id');\n let ajaxUrl = `/contests/${contestId}/${url}.json`;\n let isUser = $(table).data('is-user');\n let showState = $(table).data('show-state');\n let showPrize = $(table).data('show-prize');\n let dataTable = $(table).DataTable({\n processing: true,\n serverSide: true,\n ajax: ajaxUrl,\n columns: [\n {data: 'level'},\n {data: 'name'},\n {data: 'submitted'},\n {data: 'status', visible: showState},\n {data: 'type'},\n {data: 'author'},\n {data: 'you', visible: isUser},\n {data: 'numUserVotes'},\n {data: 'avgUserVote'},\n {data: 'avgImperfectUserVote'},\n {data: 'numJudgeVotes'},\n {data: 'avgJudgeVote', visible: !isUser},\n {data: 'weightedVote', visible: !isUser},\n {data: 'prize', visible: showPrize},\n {\n searchable: false, \n orderable: false,\n render: (data, type, row, meta) => {\n return `
`\n }\n }\n ],\n order: [[10, 'desc']],\n //responsive: true,\n bAutoWidth: false\n });\n\n\t\t$(table).on('click', 'td', function() {\n\t\t\tlet tr = $(this).closest('tr');\n\t\t\tlet tbody = $(this).closest('tbody');\n let row = dataTable.row(tr);\n if (row.data()) {\n let creatureId = row.data()['id'];\n\n if ( row.child.isShown() ) {\n // This row is already open - close it\n row.child(\"\").hide();\n tr.removeClass('shown');\n }\n else {\n $.ajax(`/creatures/${creatureId}`, {\n method: 'GET'\n })\n .done((data, status, xhr) => {\n // Open this row\n row.child(data).show();\n window.creatureId = creatureId;\n createEditor('#app', window.creatureData, 'view', creatureId);\n tr.addClass('shown');\n })\n .fail(() => {\n console.log(arguments);\n });\n }\n\n tbody.find('tr').each(function(idx, r) {\n if (r != tr) {\n let row = dataTable.row(r);\n row.child.hide();\n }\n });\n }\n\t\t});\n });\n\n $(document).on('ajax:success', '.btn-nominate', function(evt) {\n $('#all-creatures-table').DataTable().ajax.reload()\n $('#submitted-creatures-table').DataTable().ajax.reload()\n $('#nominated-creatures-table').DataTable().ajax.reload()\n });\n\n $(document).on('ajax:success', 'form.award-prize', function(evt) {\n $('#all-creatures-table').DataTable().ajax.reload()\n $('#nominated-creatures-table').DataTable().ajax.reload()\n $('#winner-creatures-table').DataTable().ajax.reload()\n });\n\n\tif ($('#current-monsters-table').length) {\n let currentMonstersTable = $('#current-monsters-table').DataTable({\n paging: false,\n\t\t\tbAutoWidth: false,\n\t\t\tresponsive: {\n\t\t\t details: false\n },\n columnDefs: [\n {\n targets: 7,\n orderable: false,\n searchable: false\n },\n {\n targets: 0,\n visible: false\n }\n ]\n });\n\n if (!$('#current-monsters-table').data('is-user')) {\n currentMonstersTable.column(5).visible(false);\n }\n\n\t\t$('#current-monsters-table').on('click', 'td.open-details', function(evt) {\n\t\t\tlet tr = $(this).closest('tr');\n\t\t\tlet tbody = $(this).closest('tbody');\n\t\t\tlet row = currentMonstersTable.row(tr);\n\t\t\tlet trBgdClass = tr.attr('class');\n\n\t\t\tif ( row.child.isShown() ) {\n\t\t\t\t// This row is already open - close it\n\t\t\t\trow.child(\"\").hide();\n\t\t\t\ttr.removeClass('shown');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet creatureId = $(tr).data('id');\n\t\t\t\t$.ajax(`/creatures/${creatureId}`, {\n\t\t\t\t\tmethod: 'GET'\n\t\t\t\t})\n\t\t\t\t\t.done((data, status, xhr) => {\n\t\t\t\t\t\t// Open this row\n\t\t\t\t\t\trow.child(data).show();\n\t\t\t\t\t\trow.child().addClass(trBgdClass);\n window.creatureId = creatureId;\n\t\t\t\t\t\tcreateEditor('#app', window.creatureData, 'view', creatureId);\n\t\t\t\t\t\t$('#current-table tr').removeClass('shown');\n\t\t\t\t\t\ttr.addClass('shown');\n\t\t\t\t\t})\n\t\t\t\t\t.fail(() => {\n\t\t\t\t\t\tconsole.log(arguments);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\ttbody.find('tr').each(function(idx, r) {\n\t\t\t\tif (r != tr) {\n\t\t\t\t\tlet row = currentMonstersTable.row(r);\n\t\t\t\t\trow.child.hide();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n }\n\n if ($(\"#winnersTab\").length >0 && window.location.hash != \"\") {\n var tab = window.location.hash;\n $(`a[href='${tab}']`).trigger(\"click\");\n }\n\n if ($('.winnersTabContent').length > 0) {\n // $('.winnersTabContent').each(function(i, el) {\n // createEditor('#app', window.creatureData, 'view');\n // })\n $('.grand-winner').each(function(i, el) {\n var creatureId = $(el).data(\"creature-id\");\n createEditor(\"#grand-winner-\" + creatureId, window.creatureData[creatureId], 'view');\n });\n\n $('.winnersTabContent').on('click', '.show-winner', function() {\n let creatureId = $(this).data('creature-id');\n let link = this;\n $.ajax(`/creatures/${creatureId}`, {\n method: 'GET'\n })\n .done((data, status, xhr) => {\n // Open this row\n $(link).closest('.tab-pane').find('.winner-box-body').html(data);\n window.creatureId = creatureId;\n createEditor('#app', window.creatureData, 'view', creatureId);\n let winnerBox = $(link).closest('.tab-pane').find('.winner-box');\n winnerBox.find('.editor').next('.row').remove();\n winnerBox.fadeIn('slow');\n winnerBox.get(0).scrollIntoView();\n })\n .fail(() => {\n console.log(arguments);\n });\n });\n\n $('.winnersTabContent').on('click', '.winner-box-close', function() {\n $(this).closest('.winner-box').hide();\n return false;\n });\n }\n});\n","$(function() {\n if ($('#users-table').length) {\n $('#users-table').dataTable({\n processing: true,\n serverSide: true,\n ajax: '/users.json',\n columns: [\n {data: 'first'},\n {data: 'last'},\n {data: 'role'},\n {data: 'editor'},\n {data: 'email'},\n {data: 'username'},\n {data: 'created'},\n {\n searchable: false, \n orderable: false,\n render: (data, type, row, meta) => {\n let links = `
`;\n links = links + `
`\n return links;\n }\n }\n ],\n order: [[1, 'asc']],\n responsive: true,\n bAutoWidth: false\n });\n }\n});\n","import {createEditor} from \"creature_editor\";\nimport './stylesheets/editor'\n\n$(function() {\n\tif ($('#reported-table').length) {\n\t\tlet reportedTable = $('#reported-table').DataTable();\n\t\t$('#reported-table').on('click', 'td', function() {\n\t\t\tlet tr = $(this).closest('tr');\n let creatureId = tr.data('id');\n\t\t\tlet tbody = $(this).closest('tbody');\n\t\t\tlet row = reportedTable.row(tr);\n\n\t\t\tif ( row.child.isShown() ) {\n\t\t\t\t// This row is already open - close it\n\t\t\t\trow.child(\"\").hide();\n\t\t\t\ttr.removeClass('shown');\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$.ajax(`/creatures/${creatureId}`, {\n\t\t\t\t\tmethod: 'GET'\n\t\t\t\t})\n\t\t\t\t\t.done((data, status, xhr) => {\n\t\t\t\t\t\t// Open this row\n\t\t\t\t\t\trow.child(data).show();\n window.creatureId = creatureId;\n\t\t\t\t\t\tcreateEditor('#app', window.creatureData, 'view', creatureId);\n\t\t\t\t\t\ttr.addClass('shown');\n\t\t\t\t\t})\n\t\t\t\t\t.fail(() => {\n\t\t\t\t\t\tconsole.log(arguments);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\ttbody.find('tr').each(function(idx, r) {\n\t\t\t\tif (r != tr) {\n\t\t\t\t\tlet row = reportedTable.row(r);\n\t\t\t\t\trow.child.hide();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n }\n\n\tif ($('#banned-table').length) {\n\t\tlet bannedTable = $('#banned-table').DataTable();\n\t\t$('#banned-table').on('click', 'td', function() {\n\t\t\tlet tr = $(this).closest('tr');\n let creatureId = tr.data('id');\n\t\t\tlet tbody = $(this).closest('tbody');\n\t\t\tlet row = bannedTable.row(tr);\n\n\t\t\tif ( row.child.isShown() ) {\n\t\t\t\t// This row is already open - close it\n\t\t\t\trow.child(\"\").hide();\n\t\t\t\ttr.removeClass('shown');\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$.ajax(`/creatures/${creatureId}`, {\n\t\t\t\t\tmethod: 'GET'\n\t\t\t\t})\n\t\t\t\t\t.done((data, status, xhr) => {\n\t\t\t\t\t\t// Open this row\n\t\t\t\t\t\trow.child(data).show();\n window.creatureId = creatureId;\n\t\t\t\t\t\tcreateEditor('#app', window.creatureData, 'view', creatureId);\n\t\t\t\t\t\ttr.addClass('shown');\n\t\t\t\t\t})\n\t\t\t\t\t.fail(() => {\n\t\t\t\t\t\tconsole.log(arguments);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\ttbody.find('tr').each(function(idx, r) {\n\t\t\t\tif (r != tr) {\n\t\t\t\t\tlet row = bannedTable.row(r);\n\t\t\t\t\trow.child.hide();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n }\n});\n","import { update } from \"lodash\";\n\n$(function() {\n $('#book-creatures-table').DataTable();\n\n const updateCharsRemaining = () => {\n var nameInBook = $(\"#contract_name_in_book\");\n $(\"#num-chars-remaining\").html(20 - nameInBook.val().length);\n if (nameInBook.val().length > 20) {\n $(\"#chars-remaining-msg\").css({color: \"red\"})\n } else {\n $(\"#chars-remaining-msg\").css({color: \"black\"})\n }\n }\n\n if ($(\"#contract_name_in_book\").length) {\n updateCharsRemaining();\n\n $(\"#contract_name_in_book\").on(\"keyup\", updateCharsRemaining);\n }\n})"],"sourceRoot":""}