/* input(44492,3-11): run-time error JS1300: Strict-mode does not allow assignment to undefined variables: Sortable */ /*! * Bootstrap v3.0.3 (http://getbootstrap.com) * Copyright 2013 Twitter, Inc. * Licensed under http://www.apache.org/licenses/LICENSE-2.0 */ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery") } /* ======================================================================== * Bootstrap: transition.js v3.0.3 * http://getbootstrap.com/javascript/#transitions * ======================================================================== * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================================== */ +function ($) { "use strict"; // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) // ============================================================ function transitionEnd() { var el = document.createElement('bootstrap') var transEndEventNames = { 'WebkitTransition' : 'webkitTransitionEnd' , 'MozTransition' : 'transitionend' , 'OTransition' : 'oTransitionEnd otransitionend' , 'transition' : 'transitionend' } for (var name in transEndEventNames) { if (el.style[name] !== undefined) { return { end: transEndEventNames[name] } } } } // http://blog.alexmaccaw.com/css-transitions $.fn.emulateTransitionEnd = function (duration) { var called = false, $el = this $(this).one($.support.transition.end, function () { called = true }) var callback = function () { if (!called) $($el).trigger($.support.transition.end) } setTimeout(callback, duration) return this } $(function () { $.support.transition = transitionEnd() }) }(jQuery); /* ======================================================================== * Bootstrap: alert.js v3.0.3 * http://getbootstrap.com/javascript/#alerts * ======================================================================== * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================================== */ +function ($) { "use strict"; // ALERT CLASS DEFINITION // ====================== var dismiss = '[data-dismiss="alert"]' var Alert = function (el) { $(el).on('click', dismiss, this.close) } Alert.prototype.close = function (e) { var $this = $(this) var selector = $this.attr('data-target') if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } var $parent = $(selector) if (e) e.preventDefault() if (!$parent.length) { $parent = $this.hasClass('alert') ? $this : $this.parent() } $parent.trigger(e = $.Event('close.bs.alert')) if (e.isDefaultPrevented()) return $parent.removeClass('in') function removeElement() { $parent.trigger('closed.bs.alert').remove() } $.support.transition && $parent.hasClass('fade') ? $parent .one($.support.transition.end, removeElement) .emulateTransitionEnd(150) : removeElement() } // ALERT PLUGIN DEFINITION // ======================= var old = $.fn.alert $.fn.alert = function (option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.alert') if (!data) $this.data('bs.alert', (data = new Alert(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.alert.Constructor = Alert // ALERT NO CONFLICT // ================= $.fn.alert.noConflict = function () { $.fn.alert = old return this } // ALERT DATA-API // ============== $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) }(jQuery); /* ======================================================================== * Bootstrap: button.js v3.0.3 * http://getbootstrap.com/javascript/#buttons * ======================================================================== * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================================== */ +function ($) { "use strict"; // BUTTON PUBLIC CLASS DEFINITION // ============================== var Button = function (element, options) { this.$element = $(element) this.options = $.extend({}, Button.DEFAULTS, options) } Button.DEFAULTS = { loadingText: 'loading...' } Button.prototype.setState = function (state) { var d = 'disabled' var $el = this.$element var val = $el.is('input') ? 'val' : 'html' var data = $el.data() state = state + 'Text' if (!data.resetText) $el.data('resetText', $el[val]()) $el[val](data[state] || this.options[state]) // push to event loop to allow forms to submit setTimeout(function () { state == 'loadingText' ? $el.addClass(d).attr(d, d) : $el.removeClass(d).removeAttr(d); }, 0) } Button.prototype.toggle = function () { var $parent = this.$element.closest('[data-toggle="buttons"]') var changed = true if ($parent.length) { var $input = this.$element.find('input') if ($input.prop('type') === 'radio') { // see if clicking on current one if ($input.prop('checked') && this.$element.hasClass('active')) changed = false else $parent.find('.active').removeClass('active') } if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') } if (changed) this.$element.toggleClass('active') } // BUTTON PLUGIN DEFINITION // ======================== var old = $.fn.button $.fn.button = function (option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.button') var options = typeof option == 'object' && option if (!data) $this.data('bs.button', (data = new Button(this, options))) if (option == 'toggle') data.toggle() else if (option) data.setState(option) }) } $.fn.button.Constructor = Button // BUTTON NO CONFLICT // ================== $.fn.button.noConflict = function () { $.fn.button = old return this } // BUTTON DATA-API // =============== $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) { var $btn = $(e.target) if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') $btn.button('toggle') e.preventDefault() }) }(jQuery); /* ======================================================================== * Bootstrap: carousel.js v3.0.3 * http://getbootstrap.com/javascript/#carousel * ======================================================================== * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================================== */ +function ($) { "use strict"; // CAROUSEL CLASS DEFINITION // ========================= var Carousel = function (element, options) { this.$element = $(element) this.$indicators = this.$element.find('.carousel-indicators') this.options = options this.paused = this.sliding = this.interval = this.$active = this.$items = null this.options.pause == 'hover' && this.$element .on('mouseenter', $.proxy(this.pause, this)) .on('mouseleave', $.proxy(this.cycle, this)) } Carousel.DEFAULTS = { interval: 5000 , pause: 'hover' , wrap: true } Carousel.prototype.cycle = function (e) { e || (this.paused = false) this.interval && clearInterval(this.interval) this.options.interval && !this.paused && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) return this } Carousel.prototype.getActiveIndex = function () { this.$active = this.$element.find('.item.active') this.$items = this.$active.parent().children() return this.$items.index(this.$active) } Carousel.prototype.to = function (pos) { var that = this var activeIndex = this.getActiveIndex() if (pos > (this.$items.length - 1) || pos < 0) return if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) if (activeIndex == pos) return this.pause().cycle() return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) } Carousel.prototype.pause = function (e) { e || (this.paused = true) if (this.$element.find('.next, .prev').length && $.support.transition.end) { this.$element.trigger($.support.transition.end) this.cycle(true) } this.interval = clearInterval(this.interval) return this } Carousel.prototype.next = function () { if (this.sliding) return return this.slide('next') } Carousel.prototype.prev = function () { if (this.sliding) return return this.slide('prev') } Carousel.prototype.slide = function (type, next) { var $active = this.$element.find('.item.active') var $next = next || $active[type]() var isCycling = this.interval var direction = type == 'next' ? 'left' : 'right' var fallback = type == 'next' ? 'first' : 'last' var that = this if (!$next.length) { if (!this.options.wrap) return $next = this.$element.find('.item')[fallback]() } this.sliding = true isCycling && this.pause() var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction }) if ($next.hasClass('active')) return if (this.$indicators.length) { this.$indicators.find('.active').removeClass('active') this.$element.one('slid.bs.carousel', function () { var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) $nextIndicator && $nextIndicator.addClass('active') }) } if ($.support.transition && this.$element.hasClass('slide')) { this.$element.trigger(e) if (e.isDefaultPrevented()) return $next.addClass(type) $next[0].offsetWidth // force reflow $active.addClass(direction) $next.addClass(direction) $active .one($.support.transition.end, function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0) }) .emulateTransitionEnd(600) } else { this.$element.trigger(e) if (e.isDefaultPrevented()) return $active.removeClass('active') $next.addClass('active') this.sliding = false this.$element.trigger('slid.bs.carousel') } isCycling && this.cycle() return this } // CAROUSEL PLUGIN DEFINITION // ========================== var old = $.fn.carousel $.fn.carousel = function (option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.carousel') var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) var action = typeof option == 'string' ? option : options.slide if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) if (typeof option == 'number') data.to(option) else if (action) data[action]() else if (options.interval) data.pause().cycle() }) } $.fn.carousel.Constructor = Carousel // CAROUSEL NO CONFLICT // ==================== $.fn.carousel.noConflict = function () { $.fn.carousel = old return this } // CAROUSEL DATA-API // ================= $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { var $this = $(this), href var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 var options = $.extend({}, $target.data(), $this.data()) var slideIndex = $this.attr('data-slide-to') if (slideIndex) options.interval = false $target.carousel(options) if (slideIndex = $this.attr('data-slide-to')) { $target.data('bs.carousel').to(slideIndex) } e.preventDefault() }) $(window).on('load', function () { $('[data-ride="carousel"]').each(function () { var $carousel = $(this) $carousel.carousel($carousel.data()) }) }) }(jQuery); /* ======================================================================== * Bootstrap: collapse.js v3.0.3 * http://getbootstrap.com/javascript/#collapse * ======================================================================== * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================================== */ +function ($) { "use strict"; // COLLAPSE PUBLIC CLASS DEFINITION // ================================ var Collapse = function (element, options) { this.$element = $(element) this.options = $.extend({}, Collapse.DEFAULTS, options) this.transitioning = null if (this.options.parent) this.$parent = $(this.options.parent) if (this.options.toggle) this.toggle() } Collapse.DEFAULTS = { toggle: true } Collapse.prototype.dimension = function () { var hasWidth = this.$element.hasClass('width') return hasWidth ? 'width' : 'height' } Collapse.prototype.show = function () { if (this.transitioning || this.$element.hasClass('in')) return var startEvent = $.Event('show.bs.collapse') this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return var actives = this.$parent && this.$parent.find('> .panel > .in') if (actives && actives.length) { var hasData = actives.data('bs.collapse') if (hasData && hasData.transitioning) return actives.collapse('hide') hasData || actives.data('bs.collapse', null) } var dimension = this.dimension() this.$element .removeClass('collapse') .addClass('collapsing') [dimension](0) this.transitioning = 1 var complete = function () { this.$element .removeClass('collapsing') .addClass('in') [dimension]('auto') this.transitioning = 0 this.$element.trigger('shown.bs.collapse') } if (!$.support.transition) return complete.call(this) var scrollSize = $.camelCase(['scroll', dimension].join('-')) this.$element .one($.support.transition.end, $.proxy(complete, this)) .emulateTransitionEnd(350) [dimension](this.$element[0][scrollSize]) } Collapse.prototype.hide = function () { if (this.transitioning || !this.$element.hasClass('in')) return var startEvent = $.Event('hide.bs.collapse') this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return var dimension = this.dimension() this.$element [dimension](this.$element[dimension]()) [0].offsetHeight this.$element .addClass('collapsing') .removeClass('collapse') .removeClass('in') this.transitioning = 1 var complete = function () { this.transitioning = 0 this.$element .trigger('hidden.bs.collapse') .removeClass('collapsing') .addClass('collapse') } if (!$.support.transition) return complete.call(this) this.$element [dimension](0) .one($.support.transition.end, $.proxy(complete, this)) .emulateTransitionEnd(350) } Collapse.prototype.toggle = function () { this[this.$element.hasClass('in') ? 'hide' : 'show']() } // COLLAPSE PLUGIN DEFINITION // ========================== var old = $.fn.collapse $.fn.collapse = function (option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.collapse') var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.collapse.Constructor = Collapse // COLLAPSE NO CONFLICT // ==================== $.fn.collapse.noConflict = function () { $.fn.collapse = old return this } // COLLAPSE DATA-API // ================= $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) { var $this = $(this), href var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 var $target = $(target) var data = $target.data('bs.collapse') var option = data ? 'toggle' : $this.data() var parent = $this.attr('data-parent') var $parent = parent && $(parent) if (!data || !data.transitioning) { if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed') $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') } $target.collapse(option) }) }(jQuery); /* ======================================================================== * Bootstrap: dropdown.js v3.0.3 * http://getbootstrap.com/javascript/#dropdowns * ======================================================================== * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================================== */ +function ($) { "use strict"; // DROPDOWN CLASS DEFINITION // ========================= var backdrop = '.dropdown-backdrop' var toggle = '[data-toggle=dropdown]' var Dropdown = function (element) { $(element).on('click.bs.dropdown', this.toggle) } Dropdown.prototype.toggle = function (e) { var $this = $(this) if ($this.is('.disabled, :disabled')) return var $parent = getParent($this) var isActive = $parent.hasClass('open') clearMenus() if (!isActive) { if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { // if mobile we use a backdrop because click events don't delegate $('
').insertAfter($(this)).on('click', clearMenus) } $parent.trigger(e = $.Event('show.bs.dropdown')) if (e.isDefaultPrevented()) return $parent .toggleClass('open') .trigger('shown.bs.dropdown') $this.focus() } return false } Dropdown.prototype.keydown = function (e) { if (!/(38|40|27)/.test(e.keyCode)) return var $this = $(this) e.preventDefault() e.stopPropagation() if ($this.is('.disabled, :disabled')) return var $parent = getParent($this) var isActive = $parent.hasClass('open') if (!isActive || (isActive && e.keyCode == 27)) { if (e.which == 27) $parent.find(toggle).focus() return $this.click() } var $items = $('[role=menu] li:not(.divider):visible a', $parent) if (!$items.length) return var index = $items.index($items.filter(':focus')) if (e.keyCode == 38 && index > 0) index-- // up if (e.keyCode == 40 && index < $items.length - 1) index++ // down if (!~index) index=0 $items.eq(index).focus() } function clearMenus() { if (typeof this != "undefined") { if ((this.activeElement != null) && (typeof this.activeElement != "undefined")) { if ((this.activeElement.localName != "button") && (this.activeElement.localName != "a")) { $("div.popover").remove(); $("div.tooltip").remove(); } } } else { { $("div.popover").remove(); $("div.tooltip").remove(); } } $(backdrop).remove() $(toggle).each(function (e) { var $parent = getParent($(this)) if (!$parent.hasClass('open')) return $parent.trigger(e = $.Event('hide.bs.dropdown')) if (e.isDefaultPrevented()) return $parent.removeClass('open').trigger('hidden.bs.dropdown') }) } function getParent($this) { var selector = $this.attr('data-target') if (!selector) { selector = $this.attr('href') selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } var $parent = selector && $(selector) return $parent && $parent.length ? $parent : $this.parent() } // DROPDOWN PLUGIN DEFINITION // ========================== var old = $.fn.dropdown $.fn.dropdown = function (option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.dropdown') if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.dropdown.Constructor = Dropdown // DROPDOWN NO CONFLICT // ==================== $.fn.dropdown.noConflict = function () { $.fn.dropdown = old return this } // APPLY TO STANDARD DROPDOWN ELEMENTS // =================================== $(document) .on('click.bs.dropdown.data-api', clearMenus) .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle) .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) }(jQuery); /* ======================================================================== * Bootstrap: modal.js v3.0.3 * http://getbootstrap.com/javascript/#modals * ======================================================================== * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================================== */ +function ($) { "use strict"; // MODAL CLASS DEFINITION // ====================== var Modal = function (element, options) { this.options = options this.$element = $(element) this.$backdrop = this.isShown = null if (this.options.remote) this.$element.load(this.options.remote) } Modal.DEFAULTS = { backdrop: true , keyboard: true , show: true } Modal.prototype.toggle = function (_relatedTarget) { return this[!this.isShown ? 'show' : 'hide'](_relatedTarget) } Modal.prototype.show = function (_relatedTarget) { var that = this var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) this.$element.trigger(e) if (this.isShown || e.isDefaultPrevented()) return this.isShown = true this.escape() this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { that.$element.appendTo(document.body) // don't move modals dom position } that.$element.show() if (transition) { that.$element[0].offsetWidth // force reflow } that.$element .addClass('in') .attr('aria-hidden', false) that.enforceFocus() var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) transition ? that.$element.find('.modal-dialog') // wait for modal to slide in .one($.support.transition.end, function () { that.$element.focus().trigger(e) }) .emulateTransitionEnd(300) : that.$element.focus().trigger(e) }) } Modal.prototype.hide = function (e) { if (e) e.preventDefault() e = $.Event('hide.bs.modal') this.$element.trigger(e) if (!this.isShown || e.isDefaultPrevented()) return this.isShown = false this.escape() $(document).off('focusin.bs.modal') this.$element .removeClass('in') .attr('aria-hidden', true) .off('click.dismiss.modal') $.support.transition && this.$element.hasClass('fade') ? this.$element .one($.support.transition.end, $.proxy(this.hideModal, this)) .emulateTransitionEnd(300) : this.hideModal() } Modal.prototype.enforceFocus = function () { $(document) .off('focusin.bs.modal') // guard against infinite focus loop .on('focusin.bs.modal', $.proxy(function (e) { if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { this.$element.focus() } }, this)) } Modal.prototype.escape = function () { if (this.isShown && this.options.keyboard) { this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) { e.which == 27 && this.hide() }, this)) } else if (!this.isShown) { this.$element.off('keyup.dismiss.bs.modal') } } Modal.prototype.hideModal = function () { var that = this this.$element.hide() this.backdrop(function () { that.removeBackdrop() that.$element.trigger('hidden.bs.modal') }) } Modal.prototype.removeBackdrop = function () { this.$backdrop && this.$backdrop.remove() this.$backdrop = null } Modal.prototype.backdrop = function (callback) { var that = this var animate = this.$element.hasClass('fade') ? 'fade' : '' if (this.isShown && this.options.backdrop) { var doAnimate = $.support.transition && animate this.$backdrop = $('') .appendTo(document.body) this.$element.on('click.dismiss.modal', $.proxy(function (e) { if (e.target !== e.currentTarget) return this.options.backdrop == 'static' ? this.$element[0].focus.call(this.$element[0]) : this.hide.call(this) }, this)) if (doAnimate) this.$backdrop[0].offsetWidth // force reflow this.$backdrop.addClass('in') if (!callback) return doAnimate ? this.$backdrop .one($.support.transition.end, callback) .emulateTransitionEnd(150) : callback() } else if (!this.isShown && this.$backdrop) { this.$backdrop.removeClass('in') $.support.transition && this.$element.hasClass('fade')? this.$backdrop .one($.support.transition.end, callback) .emulateTransitionEnd(150) : callback() } else if (callback) { callback() } } // MODAL PLUGIN DEFINITION // ======================= var old = $.fn.modal $.fn.modal = function (option, _relatedTarget) { return this.each(function () { var $this = $(this) var data = $this.data('bs.modal') var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) if (!data) $this.data('bs.modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option](_relatedTarget) else if (options.show) data.show(_relatedTarget) }) } $.fn.modal.Constructor = Modal // MODAL NO CONFLICT // ================= $.fn.modal.noConflict = function () { $.fn.modal = old return this } // MODAL DATA-API // ============== $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) var href = $this.attr('href') var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) e.preventDefault() $target .modal(option, this) .one('hide', function () { $this.is(':visible') && $this.focus() }) }) $(document) .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') }) .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') }) }(jQuery); /* ======================================================================== * Bootstrap: tooltip.js v3.0.3 * http://getbootstrap.com/javascript/#tooltip * Inspired by the original jQuery.tipsy by Jason Frame * ======================================================================== * Copyright 2013 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================================== */ +function ($) { "use strict"; // TOOLTIP PUBLIC CLASS DEFINITION // =============================== var Tooltip = function (element, options) { this.type = this.options = this.enabled = this.timeout = this.hoverState = this.$element = null this.init('tooltip', element, options) } Tooltip.DEFAULTS = { animation: true , placement: 'top' , selector: false , template: 'Restricts or allows the user to validate typed entries.
* Defaults totrue
.
*/
allowFreeEntries: true,
/**
* @cfg {String} cls
* A custom CSS class to apply to the field's underlying element.
* Defaults to''
.
*/
cls: '',
/**
* @cfg {Array / String / Function} data
* JSON Data source used to populate the combo box. 3 options are available here:No Data Source (default)
* When left null, the combo box will not suggest anything. It can still enable the user to enter
* multiple entries if allowFreeEntries is * set to true (default).
Static Source
* You can pass an array of JSON objects, an array of strings or even a single CSV string as the
* data source.
For ex. data: [* {id:0,name:"Paris"}, {id: 1, name: "New York"}]
* You can also pass any json object with the results property containing the json array.
Url
* You can pass the url from which the component will fetch its JSON data.
Data will be fetched
* using a POST ajax request that will * include the entered text as 'query' parameter. The results
* fetched from the server can be:
* - an array of JSON objects (ex: [{id:...,name:...},{...}])
* - a string containing an array of JSON objects ready to be parsed (ex: "[{id:...,name:...},{...}]")
* - a JSON object whose data will be contained in the results property
* (ex: {results: [{id:...,name:...},{...}]
Function
* You can pass a function which returns an array of JSON objects (ex: [{id:...,name:...},{...}])
* The function can return the JSON data or it can use the first argument as function to handle the data.
* Only one (callback function or return value) is needed for the function to succeed.
* See the following example:
* function (response) { var myjson = [{name: 'test', id: 1}]; response(myjson); return myjson; }
Additional parameters to the ajax call
* Defaults to{}
*/
dataUrlParams: {},
/**
* @cfg {Boolean} disabled
* Start the component in a disabled state.
* Defaults tofalse
.
*/
disabled: false,
/**
* @cfg {String} displayField
* name of JSON object property displayed in the combo list
* Defaults toname
.
*/
displayField: 'name',
/**
* @cfg {Boolean} editable
* Set to false if you only want mouse interaction. In that case the combo will * automatically expand on focus.
* Defaults totrue
.
*/
editable: true,
/**
* @cfg {String} emptyText
* The default placeholder text when nothing has been entered
* Defaults to'Type or click here'
or just 'Click here'
if not editable.
*/
emptyText: function() {
return cfg.editable ? 'Type or click here' : 'Click here';
},
/**
* @cfg {String} emptyTextCls
* A custom CSS class to style the empty text
* Defaults to'ms-empty-text'
.
*/
emptyTextCls: 'ms-empty-text',
/**
* @cfg {Boolean} expanded
* Set starting state for combo.
* Defaults tofalse
.
*/
expanded: false,
/**
* @cfg {Boolean} expandOnFocus
* Automatically expands combo on focus.
* Defaults tofalse
.
*/
expandOnFocus: function() {
return cfg.editable ? false : true;
},
/**
* @cfg {String} groupBy
* JSON property by which the list should be grouped
* Defaults to null */ groupBy: null, /** * @cfg {Boolean} hideTrigger *Set to true to hide the trigger on the right
* Defaults tofalse
.
*/
hideTrigger: false,
/**
* @cfg {Boolean} highlight
* Set to true to highlight search input within displayed suggestions
* Defaults totrue
.
*/
highlight: true,
/**
* @cfg {String} id
* A custom ID for this component
* Defaults to 'ms-ctn-{n}' with n positive integer */ id: function() { return 'ms-ctn-' + $('div[id^="ms-ctn"]').length; }, /** * @cfg {String} infoMsgCls *A class that is added to the info message appearing on the top-right part of the component
* Defaults to '' */ infoMsgCls: '', /** * @cfg {Object} inputCfg *Additional parameters passed out to the INPUT tag. Enables usage of AngularJS's custom tags for ex.
* Defaults to{}
*/
inputCfg: {},
/**
* @cfg {String} invalidCls
* The class that is applied to show that the field is invalid
* Defaults to ms-ctn-invalid */ invalidCls: 'ms-ctn-invalid', /** * @cfg {Boolean} matchCase *Set to true to filter data results according to case. Useless if the data is fetched remotely
* Defaults tofalse
.
*/
matchCase: false,
/**
* @cfg {Integer} maxDropHeight (in px)
* Once expanded, the combo's height will take as much room as the # of available results. * In case there are too many results displayed, this will fix the drop down height.
* Defaults to 290 px. */ maxDropHeight: 290, /** * @cfg {Integer} maxEntryLength *Defines how long the user free entry can be. Set to null for no limit.
* Defaults to null. */ maxEntryLength: null, /** * @cfg {String} maxEntryRenderer *A function that defines the helper text when the max entry length has been surpassed.
* Defaults tofunction(v){return 'Please reduce your entry by ' + v + ' character' + (v > 1 ? 's':'');}
*/
maxEntryRenderer: function(v) {
return 'Please reduce your entry by ' + v + ' character' + (v > 1 ? 's':'');
},
/**
* @cfg {Integer} maxSuggestions
* The maximum number of results displayed in the combo drop down at once.
* Defaults to null. */ maxSuggestions: null, /** * @cfg {Integer} maxSelection *The maximum number of items the user can select if multiple selection is allowed. * Set to null to remove the limit.
* Defaults to 10. */ maxSelection: 10, /** * @cfg {Function} maxSelectionRenderer *A function that defines the helper text when the max selection amount has been reached. The function has a single * parameter which is the number of selected elements.
* Defaults tofunction(v){return 'You cannot choose more than ' + v + ' item' + (v > 1 ? 's':'');}
*/
maxSelectionRenderer: function(v) {
return 'You cannot choose more than ' + v + ' item' + (v > 1 ? 's':'');
},
/**
* @cfg {String} method
* The method used by the ajax request.
* Defaults to 'POST' */ method: 'POST', /** * @cfg {Integer} minChars *The minimum number of characters the user must type before the combo expands and offers suggestions.
* Defaults to 0
.
*/
minChars: 0,
/**
* @cfg {Function} minCharsRenderer
*
A function that defines the helper text when not enough letters are set. The function has a single * parameter which is the difference between the required amount of letters and the current one.
* Defaults tofunction(v){return 'Please type ' + v + ' more character' + (v > 1 ? 's':'');}
*/
minCharsRenderer: function(v) {
return 'Please type ' + v + ' more character' + (v > 1 ? 's':'');
},
/**
* @cfg {String} name
* The name used as a form element.
* Defaults to 'null' */ name: null, /** * @cfg {String} noSuggestionText *The text displayed when there are no suggestions.
* Defaults to 'No suggestions" */ noSuggestionText: 'No suggestions', /** * @cfg {Boolean} preselectSingleSuggestion *If a single suggestion comes out, it is preselected.
* Defaults totrue
.
*/
preselectSingleSuggestion: true,
/**
* @cfg (function) renderer
* A function used to define how the items will be presented in the combo
* Defaults tonull
.
*/
renderer: null,
/**
* @cfg {Boolean} required
* Whether or not this field should be required
* Defaults to false */ required: false, /** * @cfg {Boolean} resultAsString *Set to true to render selection as comma separated string
* Defaults tofalse
.
*/
resultAsString: false,
/**
* @cfg {String} resultsField
* Name of JSON object property that represents the list of suggested objets
* Defaults toresults
*/
resultsField: 'results',
/**
* @cfg {String} selectionCls
* A custom CSS class to add to a selected item
* Defaults to''
.
*/
selectionCls: '',
/**
* @cfg {String} selectionPosition
* Where the selected items will be displayed. Only 'right', 'bottom' and 'inner' are valid values
* Defaults to'inner'
, meaning the selected items will appear within the input box itself.
*/
selectionPosition: 'inner',
/**
* @cfg (function) selectionRenderer
* A function used to define how the items will be presented in the tag list
* Defaults tonull
.
*/
selectionRenderer: null,
/**
* @cfg {Boolean} selectionStacked
* Set to true to stack the selectioned items when positioned on the bottom * Requires the selectionPosition to be set to 'bottom'
* Defaults tofalse
.
*/
selectionStacked: false,
/**
* @cfg {String} sortDir
* Direction used for sorting. Only 'asc' and 'desc' are valid values
* Defaults to'asc'
.
*/
sortDir: 'asc',
/**
* @cfg {String} sortOrder
* name of JSON object property for local result sorting. * Leave null if you do not wish the results to be ordered or if they are already ordered remotely.
* * Defaults tonull
.
*/
sortOrder: null,
/**
* @cfg {Boolean} strictSuggest
* If set to true, suggestions will have to start by user input (and not simply contain it as a substring)
* Defaults tofalse
.
*/
strictSuggest: false,
/**
* @cfg {String} style
* Custom style added to the component container.
* * Defaults to''
.
*/
style: '',
/**
* @cfg {Boolean} toggleOnClick
* If set to true, the combo will expand / collapse when clicked upon
* Defaults tofalse
.
*/
toggleOnClick: false,
/**
* @cfg {Integer} typeDelay
* Amount (in ms) between keyboard registers.
* * Defaults to400
*/
typeDelay: 400,
/**
* @cfg {Boolean} useTabKey
* If set to true, tab won't blur the component but will be registered as the ENTER key
* Defaults tofalse
.
*/
useTabKey: false,
/**
* @cfg {Boolean} useCommaKey
* If set to true, using comma will validate the user's choice
* Defaults totrue
.
*/
useCommaKey: true,
/**
* @cfg {Boolean} useZebraStyle
* Determines whether or not the results will be displayed with a zebra table style
* Defaults totrue
.
*/
useZebraStyle: true,
/**
* @cfg {String/Object/Array} value
* initial value for the field
* Defaults tonull
.
*/
value: null,
/**
* @cfg {String} valueField
* name of JSON object property that represents its underlying value
* Defaults toid
.
*/
valueField: 'id',
/**
* @cfg {Integer} width (in px)
* Width of the component
* Defaults to underlying element width. */ width: function() { return $(this).width(); } }; var conf = $.extend({},options); var cfg = $.extend(true, {}, defaults, conf); // some init stuff if ($.isFunction(cfg.emptyText)) { cfg.emptyText = cfg.emptyText.call(this); } if ($.isFunction(cfg.expandOnFocus)) { cfg.expandOnFocus = cfg.expandOnFocus.call(this); } if ($.isFunction(cfg.id)) { cfg.id = cfg.id.call(this); } /********** PUBLIC METHODS ************/ /** * Add one or multiple json items to the current selection * @param items - json object or array of json objects * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered */ this.addToSelection = function(items, isSilent) { if (!cfg.maxSelection || _selection.length < cfg.maxSelection) { if (!$.isArray(items)) { items = [items]; } var valuechanged = false; $.each(items, function(index, json) { if ($.inArray(json[cfg.valueField], ms.getValue()) === -1) { _selection.push(json); valuechanged = true; } }); if(valuechanged === true) { self._renderSelection(); this.empty(); if (isSilent !== true) { $(this).trigger('selectionchange', [this, this.getSelectedItems()]); } } } }; /** * Clears the current selection * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered */ this.clear = function(isSilent) { this.removeFromSelection(_selection.slice(0), isSilent); // clone array to avoid concurrency issues }; /** * Collapse the drop down part of the combo */ this.collapse = function() { if (cfg.expanded === true) { this.combobox.detach(); cfg.expanded = false; $(this).trigger('collapse', [this]); } }; /** * Set the component in a disabled state. */ this.disable = function() { this.container.addClass('ms-ctn-disabled'); cfg.disabled = true; ms.input.attr('disabled', true); }; /** * Empties out the combo user text */ this.empty = function(){ this.input.removeClass(cfg.emptyTextCls); this.input.val(''); }; /** * Set the component in a enable state. */ this.enable = function() { this.container.removeClass('ms-ctn-disabled'); cfg.disabled = false; ms.input.attr('disabled', false); }; /** * Expand the drop drown part of the combo. */ this.expand = function() { if (!cfg.expanded && (this.input.val().length >= cfg.minChars || this.combobox.children().size() > 0)) { this.combobox.appendTo(this.container); self._processSuggestions(); cfg.expanded = true; $(this).trigger('expand', [this]); } }; /** * Retrieve component enabled status */ this.isDisabled = function() { return cfg.disabled; }; /** * Checks whether the field is valid or not * @return {boolean} */ this.isValid = function() { return cfg.required === false || _selection.length > 0; }; /** * Gets the data params for current ajax request */ this.getDataUrlParams = function() { return cfg.dataUrlParams; }; /** * Gets the name given to the form input */ this.getName = function() { return cfg.name; }; /** * Retrieve an array of selected json objects * @return {Array} */ this.getSelectedItems = function() { return _selection; }; /** * Retrieve the current text entered by the user */ this.getRawValue = function(){ return ms.input.val() !== cfg.emptyText ? ms.input.val() : ''; }; /** * Retrieve an array of selected values */ this.getValue = function() { return $.map(_selection, function(o) { return o[cfg.valueField]; }); }; /** * Remove one or multiples json items from the current selection * @param items - json object or array of json objects * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered */ this.removeFromSelection = function(items, isSilent) { if (!$.isArray(items)) { items = [items]; } var valuechanged = false; $.each(items, function(index, json) { var i = $.inArray(json[cfg.valueField], ms.getValue()); if (i > -1) { _selection.splice(i, 1); valuechanged = true; } }); if (valuechanged === true) { self._renderSelection(); if(isSilent !== true){ $(this).trigger('selectionchange', [this, this.getSelectedItems()]); } if(cfg.expandOnFocus){ ms.expand(); } if(cfg.expanded) { self._processSuggestions(); } } }; /** * Set up some combo data after it has been rendered * @param data */ this.setData = function(data){ cfg.data = data; self._processSuggestions(); }; /** * Sets the name for the input field so it can be fetched in the form * @param name */ this.setName = function(name){ cfg.name = name; if(ms._valueContainer){ ms._valueContainer.name = name; } }; /** * Sets a value for the combo box. Value must be a value or an array of value with data type matching valueField one. * @param data */ this.setValue = function(data) { var values = data, items = []; if(!$.isArray(data)){ if(typeof(data) === 'string'){ if(data.indexOf('[') > -1){ values = eval(data); } else if(data.indexOf(',') > -1){ values = data.split(','); } } else { values = [data]; } } $.each(_cbData, function(index, obj) { if($.inArray(obj[cfg.valueField], values) > -1) { items.push(obj); } }); if(items.length > 0) { this.addToSelection(items); } }; /** * Sets data params for subsequent ajax requests * @param params */ this.setDataUrlParams = function(params) { cfg.dataUrlParams = $.extend({},params); }; /********** PRIVATE ************/ var _selection = [], // selected objects _comboItemHeight = 0, // height for each combo item. _timer, _hasFocus = false, _groups = null, _cbData = [], _ctrlDown = false; var self = { /** * Empties the result container and refills it with the array of json results in input * @private */ _displaySuggestions: function(data) { ms.combobox.empty(); var resHeight = 0, // total height taken by displayed results. nbGroups = 0; if(_groups === null) { self._renderComboItems(data); resHeight = _comboItemHeight * data.length; } else { for(var grpName in _groups) { nbGroups += 1; $('', { 'class': 'ms-res-group', html: grpName }).appendTo(ms.combobox); self._renderComboItems(_groups[grpName].items, true); } resHeight = _comboItemHeight * (data.length + nbGroups); } if(resHeight < ms.combobox.height() || resHeight <= cfg.maxDropHeight) { ms.combobox.height(resHeight); } else if(resHeight >= ms.combobox.height() && resHeight > cfg.maxDropHeight) { ms.combobox.height(cfg.maxDropHeight); } if(data.length === 1 && cfg.preselectSingleSuggestion === true) { ms.combobox.children().filter(':last').addClass('ms-res-item-active'); } if(data.length === 0 && ms.getRawValue() !== "") { self._updateHelper(cfg.noSuggestionText); ms.collapse(); } }, /** * Returns an array of json objects from an array of strings. * @private */ _getEntriesFromStringArray: function(data) { var json = []; $.each(data, function(index, s) { var entry = {}; entry[cfg.displayField] = entry[cfg.valueField] = $.trim(s); json.push(entry); }); return json; }, /** * Replaces html with highlighted html according to case * @param html * @private */ _highlightSuggestion: function(html) { var q = ms.input.val() !== cfg.emptyText ? ms.input.val() : ''; if(q.length === 0) { return html; // nothing entered as input } if(cfg.matchCase === true) { html = html.replace(new RegExp('(' + q + ')(?!([^<]+)?>)','g'), '$1'); } else { html = html.replace(new RegExp('(' + q + ')(?!([^<]+)?>)','gi'), '$1'); } return html; }, /** * Moves the selected cursor amongst the list item * @param dir - 'up' or 'down' * @private */ _moveSelectedRow: function(dir) { if(!cfg.expanded) { ms.expand(); } var list, start, active, scrollPos; list = ms.combobox.find(".ms-res-item"); if(dir === 'down') { start = list.eq(0); } else { start = list.filter(':last'); } active = ms.combobox.find('.ms-res-item-active:first'); if(active.length > 0) { if(dir === 'down') { start = active.nextAll('.ms-res-item').first(); if(start.length === 0) { start = list.eq(0); } scrollPos = ms.combobox.scrollTop(); ms.combobox.scrollTop(0); if(start[0].offsetTop + start.outerHeight() > ms.combobox.height()) { ms.combobox.scrollTop(scrollPos + _comboItemHeight); } } else { start = active.prevAll('.ms-res-item').first(); if(start.length === 0) { start = list.filter(':last'); ms.combobox.scrollTop(_comboItemHeight * list.length); } if(start[0].offsetTop < ms.combobox.scrollTop()) { ms.combobox.scrollTop(ms.combobox.scrollTop() - _comboItemHeight); } } } list.removeClass("ms-res-item-active"); start.addClass("ms-res-item-active"); }, /** * According to given data and query, sort and add suggestions in their container * @private */ _processSuggestions: function(source) { var json = null, data = source || cfg.data; if(data !== null) { if(typeof(data) === 'function'){ data = data.call(ms); } if(typeof(data) === 'string' && data.indexOf(',') < 0) { // get results from ajax $(ms).trigger('beforeload', [ms]); var params = $.extend({query: ms.input.val()}, cfg.dataUrlParams); $.ajax({ type: cfg.method, url: data, data: params, success: function(asyncData){ json = typeof(asyncData) === 'string' ? JSON.parse(asyncData) : asyncData; self._processSuggestions(json); $(ms).trigger('load', [ms, json]); }, error: function(){ throw("Could not reach server"); } }); return; } else if(typeof(data) === 'string' && data.indexOf(',') > -1) { // results from csv string _cbData = self._getEntriesFromStringArray(data.split(',')); } else { // results from local array if(data.length > 0 && typeof(data[0]) === 'string') { // results from array of strings _cbData = self._getEntriesFromStringArray(data); } else { // regular json array or json object with results property _cbData = data[cfg.resultsField] || data; } } self._displaySuggestions(self._sortAndTrim(_cbData)); } }, /** * Render the component to the given input DOM element * @private */ _render: function(el) { $(ms).trigger('beforerender', [ms]); var w = $.isFunction(cfg.width) ? cfg.width.call(el) : cfg.width; // holds the main div, will relay the focus events to the contained input element. ms.container = $('', { id: cfg.id, 'class': 'ms-ctn ' + cfg.cls + (cfg.disabled === true ? ' ms-ctn-disabled' : '') + (cfg.editable === true ? '' : ' ms-ctn-readonly'), style: cfg.style }).width(w); ms.container.focus($.proxy(handlers._onFocus, this)); ms.container.blur($.proxy(handlers._onBlur, this)); ms.container.keydown($.proxy(handlers._onKeyDown, this)); ms.container.keyup($.proxy(handlers._onKeyUp, this)); // holds the input field ms.input = $('', $.extend({ id: 'ms-input-' + $('input[id^="ms-input"]').length, type: 'text', 'class': cfg.emptyTextCls + (cfg.editable === true ? '' : ' ms-input-readonly'), value: cfg.emptyText, readonly: !cfg.editable, disabled: cfg.disabled }, cfg.inputCfg)).width(w - (cfg.hideTrigger ? 16 : 42)); ms.input.focus($.proxy(handlers._onInputFocus, this)); ms.input.click($.proxy(handlers._onInputClick, this)); // holds the trigger on the right side if(cfg.hideTrigger === false) { ms.trigger = $('', { id: 'ms-trigger-' + $('div[id^="ms-trigger"]').length, 'class': 'ms-trigger', html: '' }); ms.trigger.click($.proxy(handlers._onTriggerClick, this)); ms.container.append(ms.trigger); } // holds the suggestions. will always be placed on focus ms.combobox = $('', { id: 'ms-res-ctn-' + $('div[id^="ms-res-ctn"]').length, 'class': 'ms-res-ctn ' }).width(w).height(cfg.maxDropHeight); // bind the onclick and mouseover using delegated events (needs jQuery >= 1.7) ms.combobox.on('click', 'div.ms-res-item', $.proxy(handlers._onComboItemSelected, this)); ms.combobox.on('mouseover', 'div.ms-res-item', $.proxy(handlers._onComboItemMouseOver, this)); ms.selectionContainer = $('', { id: 'ms-sel-ctn-' + $('div[id^="ms-sel-ctn"]').length, 'class': 'ms-sel-ctn' }); ms.selectionContainer.click($.proxy(handlers._onFocus, this)); if(cfg.selectionPosition === 'inner') { ms.selectionContainer.append(ms.input); } else { ms.container.append(ms.input); } ms.helper = $('', { 'class': 'ms-helper ' + cfg.infoMsgCls }); self._updateHelper(); ms.container.append(ms.helper); // Render the whole thing $(el).replaceWith(ms.container); switch(cfg.selectionPosition) { case 'bottom': ms.selectionContainer.insertAfter(ms.container); if(cfg.selectionStacked === true) { ms.selectionContainer.width(ms.container.width()); ms.selectionContainer.addClass('ms-stacked'); } break; case 'right': ms.selectionContainer.insertAfter(ms.container); ms.container.css('float', 'left'); break; default: ms.container.append(ms.selectionContainer); break; } self._processSuggestions(); if(cfg.value !== null) { ms.setValue(cfg.value); self._renderSelection(); } $(ms).trigger('afterrender', [ms]); $("body").click(function(e) { if(ms.container.hasClass('ms-ctn-bootstrap-focus') && ms.container.has(e.target).length === 0 && e.target.className.indexOf('ms-res-item') < 0 && e.target.className.indexOf('ms-close-btn') < 0 && ms.container[0] !== e.target) { handlers._onBlur(); } }); if(cfg.expanded === true) { cfg.expanded = false; ms.expand(); } }, _renderComboItems: function(items, isGrouped) { var ref = this, html = ''; $.each(items, function(index, value) { var displayed = cfg.renderer !== null ? cfg.renderer.call(ref, value) : value[cfg.displayField]; var resultItemEl = $('', { 'class': 'ms-res-item ' + (isGrouped ? 'ms-res-item-grouped ':'') + (index % 2 === 1 && cfg.useZebraStyle === true ? 'ms-res-odd' : ''), html: cfg.highlight === true ? self._highlightSuggestion(displayed) : displayed, 'data-json': JSON.stringify(value) }); resultItemEl.click($.proxy(handlers._onComboItemSelected, ref)); resultItemEl.mouseover($.proxy(handlers._onComboItemMouseOver, ref)); html += $('').append(resultItemEl).html(); }); ms.combobox.append(html); _comboItemHeight = ms.combobox.find('.ms-res-item:first').outerHeight(); }, /** * Renders the selected items into their container. * @private */ _renderSelection: function() { var ref = this, w = 0, inputOffset = 0, items = [], asText = cfg.resultAsString === true && !_hasFocus; ms.selectionContainer.find('.ms-sel-item').remove(); if(ms._valueContainer !== undefined) { ms._valueContainer.remove(); } $.each(_selection, function(index, value){ var selectedItemEl, delItemEl, selectedItemHtml = cfg.selectionRenderer !== null ? cfg.selectionRenderer.call(ref, value) : value[cfg.displayField]; // tag representing selected value if(asText === true) { selectedItemEl = $('', { 'class': 'ms-sel-item ms-sel-text ' + cfg.selectionCls, html: selectedItemHtml + (index === (_selection.length - 1) ? '' : ',') }).data('json', value); } else { selectedItemEl = $('', { 'class': 'ms-sel-item ' + cfg.selectionCls, html: selectedItemHtml }).data('json', value); if(cfg.disabled === false){ // small cross img delItemEl = $('', { 'class': 'ms-close-btn' }).data('json', value).appendTo(selectedItemEl); delItemEl.click($.proxy(handlers._onTagTriggerClick, ref)); } } items.push(selectedItemEl); }); ms.selectionContainer.prepend(items); ms._valueContainer = $('', { type: 'hidden', name: cfg.name, value: JSON.stringify(ms.getValue()) }); ms._valueContainer.appendTo(ms.selectionContainer); if(cfg.selectionPosition === 'inner') { ms.input.width(0); inputOffset = ms.input.offset().left - ms.selectionContainer.offset().left; w = ms.container.width() - inputOffset - 42; ms.input.width(w); ms.container.height(ms.selectionContainer.height()); } if(_selection.length === cfg.maxSelection){ self._updateHelper(cfg.maxSelectionRenderer.call(this, _selection.length)); } else { ms.helper.hide(); } }, /** * Select an item either through keyboard or mouse * @param item * @private */ _selectItem: function(item) { if(cfg.maxSelection === 1){ _selection = []; } ms.addToSelection(item.data('json')); item.removeClass('ms-res-item-active'); if(cfg.expandOnFocus === false || _selection.length === cfg.maxSelection){ ms.collapse(); } if(!_hasFocus){ ms.input.focus(); } else if(_hasFocus && (cfg.expandOnFocus || _ctrlDown)){ self._processSuggestions(); if(_ctrlDown){ ms.expand(); } } }, /** * Sorts the results and cut them down to max # of displayed results at once * @private */ _sortAndTrim: function(data) { var q = ms.getRawValue(), filtered = [], newSuggestions = [], selectedValues = ms.getValue(); // filter the data according to given input if(q.length > 0) { $.each(data, function(index, obj) { var name = obj[cfg.displayField]; if((cfg.matchCase === true && name.indexOf(q) > -1) || (cfg.matchCase === false && name.toLowerCase().indexOf(q.toLowerCase()) > -1)) { if(cfg.strictSuggest === false || name.toLowerCase().indexOf(q.toLowerCase()) === 0) { filtered.push(obj); } } }); } else { filtered = data; } // take out the ones that have already been selected $.each(filtered, function(index, obj) { if($.inArray(obj[cfg.valueField], selectedValues) === -1) { newSuggestions.push(obj); } }); // sort the data if(cfg.sortOrder !== null) { newSuggestions.sort(function(a,b) { if(a[cfg.sortOrder] < b[cfg.sortOrder]) { return cfg.sortDir === 'asc' ? -1 : 1; } if(a[cfg.sortOrder] > b[cfg.sortOrder]) { return cfg.sortDir === 'asc' ? 1 : -1; } return 0; }); } // trim it down if(cfg.maxSuggestions && cfg.maxSuggestions > 0) { newSuggestions = newSuggestions.slice(0, cfg.maxSuggestions); } // build groups if(cfg.groupBy !== null) { _groups = {}; $.each(newSuggestions, function(index, value) { if(_groups[value[cfg.groupBy]] === undefined) { _groups[value[cfg.groupBy]] = {title: value[cfg.groupBy], items: [value]}; } else { _groups[value[cfg.groupBy]].items.push(value); } }); } return newSuggestions; }, /** * Update the helper text * @private */ _updateHelper: function(html) { ms.helper.html(html); if(!ms.helper.is(":visible")) { ms.helper.fadeIn(); } } }; var handlers = { /** * Triggered when blurring out of the component * @private */ _onBlur: function() { ms.container.removeClass('ms-ctn-bootstrap-focus'); ms.collapse(); _hasFocus = false; if(ms.getRawValue() !== '' && cfg.allowFreeEntries === true){ var obj = {}; obj[cfg.displayField] = obj[cfg.valueField] = ms.getRawValue(); ms.addToSelection(obj); } self._renderSelection(); if(ms.isValid() === false) { ms.container.addClass('ms-ctn-invalid'); } if(ms.input.val() === '' && _selection.length === 0) { ms.input.addClass(cfg.emptyTextCls); ms.input.val(cfg.emptyText); } else if(ms.input.val() !== '' && cfg.allowFreeEntries === false) { ms.empty(); self._updateHelper(''); } if(ms.input.is(":focus")) { $(ms).trigger('blur', [ms]); } }, /** * Triggered when hovering an element in the combo * @param e * @private */ _onComboItemMouseOver: function(e) { ms.combobox.children().removeClass('ms-res-item-active'); $(e.currentTarget).addClass('ms-res-item-active'); }, /** * Triggered when an item is chosen from the list * @param e * @private */ _onComboItemSelected: function(e) { self._selectItem($(e.currentTarget)); }, /** * Triggered when focusing on the container div. Will focus on the input field instead. * @private */ _onFocus: function() { ms.input.focus(); }, /** * Triggered when clicking on the input text field * @private */ _onInputClick: function(){ if (ms.isDisabled() === false && _hasFocus) { if (cfg.toggleOnClick === true) { if (cfg.expanded){ ms.collapse(); } else { ms.expand(); } } } }, /** * Triggered when focusing on the input text field. * @private */ _onInputFocus: function() { if(ms.isDisabled() === false && !_hasFocus) { _hasFocus = true; ms.container.addClass('ms-ctn-bootstrap-focus'); ms.container.removeClass(cfg.invalidCls); if(ms.input.val() === cfg.emptyText) { ms.empty(); } var curLength = ms.getRawValue().length; if(cfg.expandOnFocus === true){ ms.expand(); } if(_selection.length === cfg.maxSelection) { self._updateHelper(cfg.maxSelectionRenderer.call(this, _selection.length)); } else if(curLength < cfg.minChars) { self._updateHelper(cfg.minCharsRenderer.call(this, cfg.minChars - curLength)); } self._renderSelection(); $(ms).trigger('focus', [ms]); } }, /** * Triggered when the user presses a key while the component has focus * This is where we want to handle all keys that don't require the user input field * since it hasn't registered the key hit yet * @param e keyEvent * @private */ _onKeyDown: function(e) { // check how tab should be handled var active = ms.combobox.find('.ms-res-item-active:first'), freeInput = ms.input.val() !== cfg.emptyText ? ms.input.val() : ''; $(ms).trigger('keydown', [ms, e]); if(e.keyCode === 9 && (cfg.useTabKey === false || (cfg.useTabKey === true && active.length === 0 && ms.input.val().length === 0))) { handlers._onBlur(); return; } switch(e.keyCode) { case 8: //backspace if(freeInput.length === 0 && ms.getSelectedItems().length > 0 && cfg.selectionPosition === 'inner') { _selection.pop(); self._renderSelection(); $(ms).trigger('selectionchange', [ms, ms.getSelectedItems()]); ms.input.focus(); e.preventDefault(); } break; case 9: // tab case 188: // esc case 13: // enter e.preventDefault(); break; case 17: // ctrl _ctrlDown = true; break; case 40: // down e.preventDefault(); self._moveSelectedRow("down"); break; case 38: // up e.preventDefault(); self._moveSelectedRow("up"); break; default: if(_selection.length === cfg.maxSelection) { e.preventDefault(); } break; } }, /** * Triggered when a key is released while the component has focus * @param e * @private */ _onKeyUp: function(e) { var freeInput = ms.getRawValue(), inputValid = $.trim(ms.input.val()).length > 0 && ms.input.val() !== cfg.emptyText && (!cfg.maxEntryLength || $.trim(ms.input.val()).length <= cfg.maxEntryLength), selected, obj = {}; $(ms).trigger('keyup', [ms, e]); clearTimeout(_timer); // collapse if escape, but keep focus. if(e.keyCode === 27 && cfg.expanded) { ms.combobox.height(0); } // ignore a bunch of keys if((e.keyCode === 9 && cfg.useTabKey === false) || (e.keyCode > 13 && e.keyCode < 32)) { if(e.keyCode === 17){ _ctrlDown = false; } return; } switch(e.keyCode) { case 40:case 38: // up, down e.preventDefault(); break; case 13:case 9:case 188:// enter, tab, comma if(e.keyCode !== 188 || cfg.useCommaKey === true) { e.preventDefault(); if(cfg.expanded === true){ // if a selection is performed, select it and reset field selected = ms.combobox.find('.ms-res-item-active:first'); if(selected.length > 0) { self._selectItem(selected); return; } } // if no selection or if freetext entered and free entries allowed, add new obj to selection if(inputValid === true && cfg.allowFreeEntries === true) { obj[cfg.displayField] = obj[cfg.valueField] = freeInput; ms.addToSelection(obj); ms.collapse(); // reset combo suggestions ms.input.focus(); } break; } default: if(_selection.length === cfg.maxSelection){ self._updateHelper(cfg.maxSelectionRenderer.call(this, _selection.length)); } else { if(freeInput.length < cfg.minChars) { self._updateHelper(cfg.minCharsRenderer.call(this, cfg.minChars - freeInput.length)); if(cfg.expanded === true) { ms.collapse(); } } else if(cfg.maxEntryLength && freeInput.length > cfg.maxEntryLength) { self._updateHelper(cfg.maxEntryRenderer.call(this, freeInput.length - cfg.maxEntryLength)); if(cfg.expanded === true) { ms.collapse(); } } else { ms.helper.hide(); if(cfg.minChars <= freeInput.length){ _timer = setTimeout(function() { if(cfg.expanded === true) { self._processSuggestions(); } else { ms.expand(); } }, cfg.typeDelay); } } } break; } }, /** * Triggered when clicking upon cross for deletion * @param e * @private */ _onTagTriggerClick: function(e) { ms.removeFromSelection($(e.currentTarget).data('json')); }, /** * Triggered when clicking on the small trigger in the right * @private */ _onTriggerClick: function() { if(ms.isDisabled() === false && !(cfg.expandOnFocus === true && _selection.length === cfg.maxSelection)) { $(ms).trigger('triggerclick', [ms]); if(cfg.expanded === true) { ms.collapse(); } else { var curLength = ms.getRawValue().length; if(curLength >= cfg.minChars){ ms.input.focus(); ms.expand(); } else { self._updateHelper(cfg.minCharsRenderer.call(this, cfg.minChars - curLength)); } } } } }; // startup point if(element !== null) { self._render(element); } }; $.fn.magicSuggest = function(options) { var obj = $(this); if(obj.size() === 1 && obj.data('magicSuggest')) { return obj.data('magicSuggest'); } obj.each(function(i) { // assume $(this) is an element var cntr = $(this); // Return early if this element already has a plugin instance if(cntr.data('magicSuggest')){ return; } if(this.nodeName.toLowerCase() === 'select'){ // rendering from select options.data = []; options.value = []; $.each(this.children, function(index, child){ if(child.nodeName && child.nodeName.toLowerCase() === 'option'){ options.data.push({id: child.value, name: child.text}); if(child.selected){ options.value.push(child.value); } } }); } var def = {}; // set values from DOM container element $.each(this.attributes, function(i, att){ def[att.name] = att.value; }); var field = new MagicSuggest(this, $.extend(options, def)); cntr.data('magicSuggest', field); field.container.data('magicSuggest', field); }); if(obj.size() === 1) { return obj.data('magicSuggest'); } return obj; }; // $.fn.magicSuggest.defaults = {}; })(jQuery); /* jquery.nicescroll -- version 3.4.0 -- copyright 2011-12-13 InuYaksa*2013 -- licensed under the MIT -- -- http://areaaperta.com/nicescroll -- https://github.com/inuyaksa/jquery.nicescroll -- */ (function(jQuery){ // globals var domfocus = false; var mousefocus = false; var zoomactive = false; var tabindexcounter = 5000; var ascrailcounter = 2000; var globalmaxzindex = 0; var $ = jQuery; // sandbox // http://stackoverflow.com/questions/2161159/get-script-path function getScriptPath() { var scripts=document.getElementsByTagName('script'); var path=scripts[scripts.length-1].src.split('?')[0]; return (path.split('/').length>0) ? path.split('/').slice(0,-1).join('/')+'/' : ''; } var scriptpath = getScriptPath(); // derived by Paul Irish https://gist.github.com/paulirish/1579671 - thanks for your code! if (!Array.prototype.forEach) { // JS 1.6 polyfill Array.prototype.forEach = function(fn, scope) { for(var i = 0, len = this.length; i < len; ++i) { fn.call(scope, this[i], i, this); } } } var vendors = ['ms','moz','webkit','o']; var setAnimationFrame = window.requestAnimationFrame||false; var clearAnimationFrame = window.cancelAnimationFrame||false; vendors.forEach(function(v){ if (!setAnimationFrame) setAnimationFrame = window[v+'RequestAnimationFrame']; if (!clearAnimationFrame) clearAnimationFrame = window[v+'CancelAnimationFrame']||window[v+'CancelRequestAnimationFrame']; }); var clsMutationObserver = window.MutationObserver || window.WebKitMutationObserver || false; var _globaloptions = { zindex:"auto", cursoropacitymin:0, cursoropacitymax:1, cursorcolor:"#424242", cursorwidth:"5px", cursorborder:"1px solid #fff", cursorborderradius:"5px", scrollspeed:60, mousescrollstep:8*3, touchbehavior:false, hwacceleration:true, usetransition:true, boxzoom:false, dblclickzoom:true, gesturezoom:true, grabcursorenabled:true, autohidemode:true, background:"", iframeautoresize:true, cursorminheight:32, preservenativescrolling:true, railoffset:false, bouncescroll:true, spacebarenabled:true, railpadding:{top:0,right:0,left:0,bottom:0}, disableoutline:true, horizrailenabled:true, railalign:"right", railvalign:"bottom", enabletranslate3d:true, enablemousewheel:true, enablekeyboard:true, smoothscroll:true, sensitiverail:true, enablemouselockapi:true, // cursormaxheight:false, cursorfixedheight:false, directionlockdeadzone:6, hidecursordelay:400, nativeparentscrolling:true, enablescrollonselection:true, overflowx:true, overflowy:true, cursordragspeed:0.3, rtlmode:false, cursordragontouch:false } var browserdetected = false; var getBrowserDetection = function() { if (browserdetected) return browserdetected; var domtest = document.createElement('DIV'); var d = {}; d.haspointerlock = "pointerLockElement" in document || "mozPointerLockElement" in document || "webkitPointerLockElement" in document; d.isopera = ("opera" in window); d.isopera12 = (d.isopera&&("getUserMedia" in navigator)); d.isie = (("all" in document) && ("attachEvent" in domtest) && !d.isopera); d.isieold = (d.isie && !("msInterpolationMode" in domtest.style)); // IE6 and older d.isie7 = d.isie&&!d.isieold&&(!("documentMode" in document)||(document.documentMode==7)); d.isie8 = d.isie&&("documentMode" in document)&&(document.documentMode==8); d.isie9 = d.isie&&("performance" in window)&&(document.documentMode>=9); d.isie10 = d.isie&&("performance" in window)&&(document.documentMode>=10); d.isie9mobile = /iemobile.9/i.test(navigator.userAgent); //wp 7.1 mango if (d.isie9mobile) d.isie9 = false; d.isie7mobile = (!d.isie9mobile&&d.isie7) && /iemobile/i.test(navigator.userAgent); //wp 7.0 d.ismozilla = ("MozAppearance" in domtest.style); d.iswebkit = ("WebkitAppearance" in domtest.style); d.ischrome = ("chrome" in window); d.ischrome22 = (d.ischrome&&d.haspointerlock); d.ischrome26 = (d.ischrome&&("transition" in domtest.style)); // issue with transform detection (maintain prefix) d.cantouch = ("ontouchstart" in document.documentElement)||("ontouchstart" in window); // detection for Chrome Touch Emulation d.hasmstouch = (window.navigator.msPointerEnabled||false); // IE10+ pointer events d.ismac = /^mac$/i.test(navigator.platform); d.isios = (d.cantouch && /iphone|ipad|ipod/i.test(navigator.platform)); d.isios4 = ((d.isios)&&!("seal" in Object)); d.isandroid = (/android/i.test(navigator.userAgent)); d.trstyle = false; d.hastransform = false; d.hastranslate3d = false; d.transitionstyle = false; d.hastransition = false; d.transitionend = false; var check = ['transform','msTransform','webkitTransform','MozTransform','OTransform']; for(var a=0;aObject with extended date parsing and formatting capabilities. * This library borrows many concepts and ideas from the Date Instance * Methods by Ken Snyder along with some parts of Ken's actual code.
* *jsDate takes a different approach by not extending the built-in * Date Object, improving date parsing, allowing for multiple formatting * syntaxes and multiple and more easily expandable localization.
* * @author Chris Leonello * @date #date# * @version #VERSION# * @copyright (c) 2010 Chris Leonello * jsDate is currently available for use in all personal or commercial projects * under both the MIT and GPL version 2.0 licenses. This means that you can * choose the license that best suits your project and use it accordingly. * *Ken's origianl Date Instance Methods and copyright notice:
** Ken Snyder (ken d snyder at gmail dot com) * 2008-09-10 * version 2.0.2 (http://kendsnyder.com/sandbox/date/) * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/) ** * @class * @name jsDate * @param {String | Number | Array | Date Object | Options Object} arguments Optional arguments, either a parsable date/time string, * a JavaScript timestamp, an array of numbers of form [year, month, day, hours, minutes, seconds, milliseconds], * a Date object, or an options object of form {syntax: "perl", date:some Date} where all options are optional. */ var jsDate = function () { this.syntax = jsDate.config.syntax; this._type = "jsDate"; this.proxy = new Date(); this.options = {}; this.locale = jsDate.regional.getLocale(); this.formatString = ''; this.defaultCentury = jsDate.config.defaultCentury; switch ( arguments.length ) { case 0: break; case 1: // other objects either won't have a _type property or, // if they do, it shouldn't be set to "jsDate", so // assume it is an options argument. if (get_type(arguments[0]) == "[object Object]" && arguments[0]._type != "jsDate") { var opts = this.options = arguments[0]; this.syntax = opts.syntax || this.syntax; this.defaultCentury = opts.defaultCentury || this.defaultCentury; this.proxy = jsDate.createDate(opts.date); } else { this.proxy = jsDate.createDate(arguments[0]); } break; default: var a = []; for ( var i=0; i
Localizations must be an object and have the following properties defined: monthNames, monthNamesShort, dayNames, dayNamesShort and Localizations are added like:
** jsDate.regional['en'] = { * monthNames : 'January February March April May June July August September October November December'.split(' '), * monthNamesShort : 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' '), * dayNames : 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.split(' '), * dayNamesShort : 'Sun Mon Tue Wed Thu Fri Sat'.split(' ') * }; **
After adding localizations, call jsDate.regional.getLocale();
to update the locale setting with the
* new localizations.
strftime formatting can be accomplished without creating a jsDate object by calling jsDate.strftime():
** var formattedDate = jsDate.strftime('Feb 8, 2006 8:48:32', '%Y-%m-%d %H:%M:%S'); ** @param {String | Number | Array | jsDate Object | Date Object} date A parsable date string, JavaScript time stamp, Array of form [year, month, day, hours, minutes, seconds, milliseconds], jsDate Object or Date object. * @param {String} formatString String with embedded date formatting codes. * See: {@link jsDate.formats}. * @param {String} syntax Optional syntax to use [default perl]. * @param {String} locale Optional locale to use. * @returns {String} Formatted representation of the date. */ // // Logic as implemented here is very similar to Ken Snyder's Date Instance Methods. // jsDate.strftime = function(d, formatString, syntax, locale) { var syn = 'perl'; var loc = jsDate.regional.getLocale(); // check if syntax and locale are available or reversed if (syntax && jsDate.formats.hasOwnProperty(syntax)) { syn = syntax; } else if (syntax && jsDate.regional.hasOwnProperty(syntax)) { loc = syntax; } if (locale && jsDate.formats.hasOwnProperty(locale)) { syn = locale; } else if (locale && jsDate.regional.hasOwnProperty(locale)) { loc = locale; } if (get_type(d) != "[object Object]" || d._type != "jsDate") { d = new jsDate(d); d.locale = loc; } if (!formatString) { formatString = d.formatString || jsDate.regional[loc]['formatString']; } // default the format string to year-month-day var source = formatString || '%Y-%m-%d', result = '', match; // replace each format code while (source.length > 0) { if (match = source.match(jsDate.formats[syn].codes.matcher)) { result += source.slice(0, match.index); result += (match[1] || '') + format(d, match[2], syn); source = source.slice(match.index + match[0].length); } else { result += source; source = ''; } } return result; }; /** * @namespace * Namespace to hold format codes and format shortcuts. "perl" and "php" format codes * and shortcuts are defined by default. Additional codes and shortcuts can be * added like: * *
* jsDate.formats["perl"] = { * "codes": { * matcher: /someregex/, * Y: "fullYear", // name of "get" method without the "get", * ..., // more codes * }, * "shortcuts": { * F: '%Y-%m-%d', * ..., // more shortcuts * } * }; ** *
Additionally, ISO and SQL shortcuts are defined and can be accesses via:
* jsDate.formats.ISO
and jsDate.formats.SQL
*/
jsDate.formats = {
ISO:'%Y-%m-%dT%H:%M:%S.%N%G',
SQL:'%Y-%m-%d %H:%M:%S'
};
/**
* Perl format codes and shortcuts for strftime.
*
* A hash (object) of codes where each code must be an array where the first member is
* the name of a Date.prototype or jsDate.prototype function to call
* and optionally a second member indicating the number to pass to addZeros()
*
*
The following format codes are defined:
* ** Code Result Description * == Years == * %Y 2008 Four-digit year * %y 08 Two-digit year * * == Months == * %m 09 Two-digit month * %#m 9 One or two-digit month * %B September Full month name * %b Sep Abbreviated month name * * == Days == * %d 05 Two-digit day of month * %#d 5 One or two-digit day of month * %e 5 One or two-digit day of month * %A Sunday Full name of the day of the week * %a Sun Abbreviated name of the day of the week * %w 0 Number of the day of the week (0 = Sunday, 6 = Saturday) * * == Hours == * %H 23 Hours in 24-hour format (two digits) * %#H 3 Hours in 24-hour integer format (one or two digits) * %I 11 Hours in 12-hour format (two digits) * %#I 3 Hours in 12-hour integer format (one or two digits) * %p PM AM or PM * * == Minutes == * %M 09 Minutes (two digits) * %#M 9 Minutes (one or two digits) * * == Seconds == * %S 02 Seconds (two digits) * %#S 2 Seconds (one or two digits) * %s 1206567625723 Unix timestamp (Seconds past 1970-01-01 00:00:00) * * == Milliseconds == * %N 008 Milliseconds (three digits) * %#N 8 Milliseconds (one to three digits) * * == Timezone == * %O 360 difference in minutes between local time and GMT * %Z Mountain Standard Time Name of timezone as reported by browser * %G 06:00 Hours and minutes between GMT * * == Shortcuts == * %F 2008-03-26 %Y-%m-%d * %T 05:06:30 %H:%M:%S * %X 05:06:30 %H:%M:%S * %x 03/26/08 %m/%d/%y * %D 03/26/08 %m/%d/%y * %#c Wed Mar 26 15:31:00 2008 %a %b %e %H:%M:%S %Y * %v 3-Sep-2008 %e-%b-%Y * %R 15:31 %H:%M * %r 03:31:00 PM %I:%M:%S %p * * == Characters == * %n \n Newline * %t \t Tab * %% % Percent Symbol ** *
Formatting shortcuts that will be translated into their longer version. * Be sure that format shortcuts do not refer to themselves: this will cause an infinite loop.
* *Format codes and format shortcuts can be redefined after the jsDate * module is imported.
* *Note that if you redefine the whole hash (object), you must supply a "matcher" * regex for the parser. The default matcher is:
* */()%(#?(%|[a-z]))/i
*
* which corresponds to the Perl syntax used by default.
* *By customizing the matcher and format codes, nearly any strftime functionality is possible.
*/ jsDate.formats.perl = { codes: { // // 2-part regex matcher for format codes // // first match must be the character before the code (to account for escaping) // second match must be the format code character(s) // matcher: /()%(#?(%|[a-z]))/i, // year Y: 'FullYear', y: 'ShortYear.2', // month m: 'MonthNumber.2', '#m': 'MonthNumber', B: 'MonthName', b: 'AbbrMonthName', // day d: 'Date.2', '#d': 'Date', e: 'Date', A: 'DayName', a: 'AbbrDayName', w: 'Day', // hours H: 'Hours.2', '#H': 'Hours', I: 'Hours12.2', '#I': 'Hours12', p: 'AMPM', // minutes M: 'Minutes.2', '#M': 'Minutes', // seconds S: 'Seconds.2', '#S': 'Seconds', s: 'Unix', // milliseconds N: 'Milliseconds.3', '#N': 'Milliseconds', // timezone O: 'TimezoneOffset', Z: 'TimezoneName', G: 'GmtOffset' }, shortcuts: { // date F: '%Y-%m-%d', // time T: '%H:%M:%S', X: '%H:%M:%S', // local format date x: '%m/%d/%y', D: '%m/%d/%y', // local format extended '#c': '%a %b %e %H:%M:%S %Y', // local format short v: '%e-%b-%Y', R: '%H:%M', r: '%I:%M:%S %p', // tab and newline t: '\t', n: '\n', '%': '%' } }; /** * PHP format codes and shortcuts for strftime. * * A hash (object) of codes where each code must be an array where the first member is * the name of a Date.prototype or jsDate.prototype function to call * and optionally a second member indicating the number to pass to addZeros() * *The following format codes are defined:
* ** Code Result Description * === Days === * %a Sun through Sat An abbreviated textual representation of the day * %A Sunday - Saturday A full textual representation of the day * %d 01 to 31 Two-digit day of the month (with leading zeros) * %e 1 to 31 Day of the month, with a space preceding single digits. * %j 001 to 366 Day of the year, 3 digits with leading zeros * %u 1 - 7 (Mon - Sun) ISO-8601 numeric representation of the day of the week * %w 0 - 6 (Sun - Sat) Numeric representation of the day of the week * * === Week === * %U 13 Full Week number, starting with the first Sunday as the first week * %V 01 through 53 ISO-8601:1988 week number, starting with the first week of the year * with at least 4 weekdays, with Monday being the start of the week * %W 46 A numeric representation of the week of the year, * starting with the first Monday as the first week * === Month === * %b Jan through Dec Abbreviated month name, based on the locale * %B January - December Full month name, based on the locale * %h Jan through Dec Abbreviated month name, based on the locale (an alias of %b) * %m 01 - 12 (Jan - Dec) Two digit representation of the month * * === Year === * %C 19 Two digit century (year/100, truncated to an integer) * %y 09 for 2009 Two digit year * %Y 2038 Four digit year * * === Time === * %H 00 through 23 Two digit representation of the hour in 24-hour format * %I 01 through 12 Two digit representation of the hour in 12-hour format * %l 1 through 12 Hour in 12-hour format, with a space preceeding single digits * %M 00 through 59 Two digit representation of the minute * %p AM/PM UPPER-CASE 'AM' or 'PM' based on the given time * %P am/pm lower-case 'am' or 'pm' based on the given time * %r 09:34:17 PM Same as %I:%M:%S %p * %R 00:35 Same as %H:%M * %S 00 through 59 Two digit representation of the second * %T 21:34:17 Same as %H:%M:%S * %X 03:59:16 Preferred time representation based on locale, without the date * %z -0500 or EST Either the time zone offset from UTC or the abbreviation * %Z -0500 or EST The time zone offset/abbreviation option NOT given by %z * * === Time and Date === * %D 02/05/09 Same as %m/%d/%y * %F 2009-02-05 Same as %Y-%m-%d (commonly used in database datestamps) * %s 305815200 Unix Epoch Time timestamp (same as the time() function) * %x 02/05/09 Preferred date representation, without the time * * === Miscellaneous === * %n --- A newline character (\n) * %t --- A Tab character (\t) * %% --- A literal percentage character (%) **/ jsDate.formats.php = { codes: { // // 2-part regex matcher for format codes // // first match must be the character before the code (to account for escaping) // second match must be the format code character(s) // matcher: /()%((%|[a-z]))/i, // day a: 'AbbrDayName', A: 'DayName', d: 'Date.2', e: 'Date', j: 'DayOfYear.3', u: 'DayOfWeek', w: 'Day', // week U: 'FullWeekOfYear.2', V: 'IsoWeek.2', W: 'WeekOfYear.2', // month b: 'AbbrMonthName', B: 'MonthName', m: 'MonthNumber.2', h: 'AbbrMonthName', // year C: 'Century.2', y: 'ShortYear.2', Y: 'FullYear', // time H: 'Hours.2', I: 'Hours12.2', l: 'Hours12', p: 'AMPM', P: 'AmPm', M: 'Minutes.2', S: 'Seconds.2', s: 'Unix', O: 'TimezoneOffset', z: 'GmtOffset', Z: 'TimezoneAbbr' }, shortcuts: { D: '%m/%d/%y', F: '%Y-%m-%d', T: '%H:%M:%S', X: '%H:%M:%S', x: '%m/%d/%y', R: '%H:%M', r: '%I:%M:%S %p', t: '\t', n: '\n', '%': '%' } }; // // Conceptually, the logic implemented here is similar to Ken Snyder's Date Instance Methods. // I use his idea of a set of parsers which can be regular expressions or functions, // iterating through those, and then seeing if Date.parse() will create a date. // The parser expressions and functions are a little different and some bugs have been // worked out. Also, a lot of "pre-parsing" is done to fix implementation // variations of Date.parse() between browsers. // jsDate.createDate = function(date) { // if passing in multiple arguments, try Date constructor if (date == null) { return new Date(); } // If the passed value is already a date object, return it if (date instanceof Date) { return date; } // if (typeof date == 'number') return new Date(date * 1000); // If the passed value is an integer, interpret it as a javascript timestamp if (typeof date == 'number') { return new Date(date); } // Before passing strings into Date.parse(), have to normalize them for certain conditions. // If strings are not formatted staccording to the EcmaScript spec, results from Date parse will be implementation dependent. // // For example: // * FF and Opera assume 2 digit dates are pre y2k, Chome assumes <50 is pre y2k, 50+ is 21st century. // * Chrome will correctly parse '1984-1-25' into localtime, FF and Opera will not parse. // * Both FF, Chrome and Opera will parse '1984/1/25' into localtime. // remove leading and trailing spaces var parsable = String(date).replace(/^\s*(.+)\s*$/g, '$1'); // replace dahses (-) with slashes (/) in dates like n[nnn]/n[n]/n[nnn] parsable = parsable.replace(/^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,4})/, "$1/$2/$3"); ///////// // Need to check for '15-Dec-09' also. // FF will not parse, but Chrome will. // Chrome will set date to 2009 as well. ///////// // first check for 'dd-mmm-yyyy' or 'dd/mmm/yyyy' like '15-Dec-2010' parsable = parsable.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{4})/i, "$1 $2 $3"); // Now check for 'dd-mmm-yy' or 'dd/mmm/yy' and normalize years to default century. var match = parsable.match(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i); if (match && match.length > 3) { var m3 = parseFloat(match[3]); var ny = jsDate.config.defaultCentury + m3; ny = String(ny); // now replace 2 digit year with 4 digit year parsable = parsable.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i, match[1] +' '+ match[2] +' '+ ny); } // Check for '1/19/70 8:14PM' // where starts with mm/dd/yy or yy/mm/dd and have something after // Check if 1st postiion is greater than 31, assume it is year. // Assme all 2 digit years are 1900's. // Finally, change them into US style mm/dd/yyyy representations. match = parsable.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})[^0-9]/); function h1(parsable, match) { var m1 = parseFloat(match[1]); var m2 = parseFloat(match[2]); var m3 = parseFloat(match[3]); var cent = jsDate.config.defaultCentury; var ny, nd, nm, str; if (m1 > 31) { // first number is a year nd = m3; nm = m2; ny = cent + m1; } else { // last number is the year nd = m2; nm = m1; ny = cent + m3; } str = nm+'/'+nd+'/'+ny; // now replace 2 digit year with 4 digit year return parsable.replace(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})/, str); } if (match && match.length > 3) { parsable = h1(parsable, match); } // Now check for '1/19/70' with nothing after and do as above var match = parsable.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})$/); if (match && match.length > 3) { parsable = h1(parsable, match); } var i = 0; var length = jsDate.matchers.length; var pattern, ms, current = parsable, obj; while (i < length) { ms = Date.parse(current); if (!isNaN(ms)) { return new Date(ms); } pattern = jsDate.matchers[i]; if (typeof pattern == 'function') { obj = pattern.call(jsDate, current); if (obj instanceof Date) { return obj; } } else { current = parsable.replace(pattern[0], pattern[1]); } i++; } return NaN; }; /** * @static * Handy static utility function to return the number of days in a given month. * @param {Integer} year Year * @param {Integer} month Month (1-12) * @returns {Integer} Number of days in the month. */ // // handy utility method Borrowed right from Ken Snyder's Date Instance Mehtods. // jsDate.daysInMonth = function(year, month) { if (month == 2) { return new Date(year, 1, 29).getDate() == 29 ? 29 : 28; } return [undefined,31,undefined,31,30,31,30,31,31,30,31,30,31][month]; }; // // An Array of regular expressions or functions that will attempt to match the date string. // Functions are called with scope of a jsDate instance. // jsDate.matchers = [ // convert dd.mmm.yyyy to mm/dd/yyyy (world date to US date). [/(3[01]|[0-2]\d)\s*\.\s*(1[0-2]|0\d)\s*\.\s*([1-9]\d{3})/, '$2/$1/$3'], // convert yyyy-mm-dd to mm/dd/yyyy (ISO date to US date). [/([1-9]\d{3})\s*-\s*(1[0-2]|0\d)\s*-\s*(3[01]|[0-2]\d)/, '$2/$3/$1'], // Handle 12 hour or 24 hour time with milliseconds am/pm and optional date part. function(str) { var match = str.match(/^(?:(.+)\s+)?([012]?\d)(?:\s*\:\s*(\d\d))?(?:\s*\:\s*(\d\d(\.\d*)?))?\s*(am|pm)?\s*$/i); // opt. date hour opt. minute opt. second opt. msec opt. am or pm if (match) { if (match[1]) { var d = this.createDate(match[1]); if (isNaN(d)) { return; } } else { var d = new Date(); d.setMilliseconds(0); } var hour = parseFloat(match[2]); if (match[6]) { hour = match[6].toLowerCase() == 'am' ? (hour == 12 ? 0 : hour) : (hour == 12 ? 12 : hour + 12); } d.setHours(hour, parseInt(match[3] || 0, 10), parseInt(match[4] || 0, 10), ((parseFloat(match[5] || 0)) || 0)*1000); return d; } else { return str; } }, // Handle ISO timestamp with time zone. function(str) { var match = str.match(/^(?:(.+))[T|\s+]([012]\d)(?:\:(\d\d))(?:\:(\d\d))(?:\.\d+)([\+\-]\d\d\:\d\d)$/i); if (match) { if (match[1]) { var d = this.createDate(match[1]); if (isNaN(d)) { return; } } else { var d = new Date(); d.setMilliseconds(0); } var hour = parseFloat(match[2]); d.setHours(hour, parseInt(match[3], 10), parseInt(match[4], 10), parseFloat(match[5])*1000); return d; } else { return str; } }, // Try to match ambiguous strings like 12/8/22. // Use FF date assumption that 2 digit years are 20th century (i.e. 1900's). // This may be redundant with pre processing of date already performed. function(str) { var match = str.match(/^([0-3]?\d)\s*[-\/.\s]{1}\s*([a-zA-Z]{3,9})\s*[-\/.\s]{1}\s*([0-3]?\d)$/); if (match) { var d = new Date(); var cent = jsDate.config.defaultCentury; var m1 = parseFloat(match[1]); var m3 = parseFloat(match[3]); var ny, nd, nm; if (m1 > 31) { // first number is a year nd = m3; ny = cent + m1; } else { // last number is the year nd = m1; ny = cent + m3; } var nm = inArray(match[2], jsDate.regional[jsDate.regional.getLocale()]["monthNamesShort"]); if (nm == -1) { nm = inArray(match[2], jsDate.regional[jsDate.regional.getLocale()]["monthNames"]); } d.setFullYear(ny, nm, nd); d.setHours(0,0,0,0); return d; } else { return str; } } ]; // // I think John Reisig published this method on his blog, ejohn. // function inArray( elem, array ) { if ( array.indexOf ) { return array.indexOf( elem ); } for ( var i = 0, length = array.length; i < length; i++ ) { if ( array[ i ] === elem ) { return i; } } return -1; } // // Thanks to Kangax, Christian Sciberras and Stack Overflow for this method. // function get_type(thing){ if(thing===null) return "[object Null]"; // special case return Object.prototype.toString.call(thing); } $.jsDate = jsDate; /** * JavaScript printf/sprintf functions. * * This code has been adapted from the publicly available sprintf methods * by Ash Searle. His original header follows: * * This code is unrestricted: you are free to use it however you like. * * The functions should work as expected, performing left or right alignment, * truncating strings, outputting numbers with a required precision etc. * * For complex cases, these functions follow the Perl implementations of * (s)printf, allowing arguments to be passed out-of-order, and to set the * precision or length of the output based on arguments instead of fixed * numbers. * * See http://perldoc.perl.org/functions/sprintf.html for more information. * * Implemented: * - zero and space-padding * - right and left-alignment, * - base X prefix (binary, octal and hex) * - positive number prefix * - (minimum) width * - precision / truncation / maximum width * - out of order arguments * * Not implemented (yet): * - vector flag * - size (bytes, words, long-words etc.) * * Will not implement: * - %n or %p (no pass-by-reference in JavaScript) * * @version 2007.04.27 * @author Ash Searle * * You can see the original work and comments on his blog: * http://hexmen.com/blog/2007/03/printf-sprintf/ * http://hexmen.com/js/sprintf.js */ /** * @Modifications 2009.05.26 * @author Chris Leonello * * Added %p %P specifier * Acts like %g or %G but will not add more significant digits to the output than present in the input. * Example: * Format: '%.3p', Input: 0.012, Output: 0.012 * Format: '%.3g', Input: 0.012, Output: 0.0120 * Format: '%.4p', Input: 12.0, Output: 12.0 * Format: '%.4g', Input: 12.0, Output: 12.00 * Format: '%.4p', Input: 4.321e-5, Output: 4.321e-5 * Format: '%.4g', Input: 4.321e-5, Output: 4.3210e-5 * * Example: * >>> $.jqplot.sprintf('%.2f, %d', 23.3452, 43.23) * "23.35, 43" * >>> $.jqplot.sprintf("no value: %n, decimal with thousands separator: %'d", 23.3452, 433524) * "no value: , decimal with thousands separator: 433,524" */ $.jqplot.sprintf = function() { function pad(str, len, chr, leftJustify) { var padding = (str.length >= len) ? '' : Array(1 + len - str.length >>> 0).join(chr); return leftJustify ? str + padding : padding + str; } function thousand_separate(value) { var value_str = new String(value); for (var i=10; i>0; i--) { if (value_str == (value_str = value_str.replace(/^(\d+)(\d{3})/, "$1"+$.jqplot.sprintf.thousandsSeparator+"$2"))) break; } return value_str; } function justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace) { var diff = minWidth - value.length; if (diff > 0) { var spchar = ' '; if (htmlSpace) { spchar = ' '; } if (leftJustify || !zeroPad) { value = pad(value, minWidth, spchar, leftJustify); } else { value = value.slice(0, prefix.length) + pad('', diff, '0', true) + value.slice(prefix.length); } } return value; } function formatBaseX(value, base, prefix, leftJustify, minWidth, precision, zeroPad, htmlSpace) { // Note: casts negative numbers to positive ones var number = value >>> 0; prefix = prefix && number && {'2': '0b', '8': '0', '16': '0x'}[base] || ''; value = prefix + pad(number.toString(base), precision || 0, '0', false); return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace); } function formatString(value, leftJustify, minWidth, precision, zeroPad, htmlSpace) { if (precision != null) { value = value.slice(0, precision); } return justify(value, '', leftJustify, minWidth, zeroPad, htmlSpace); } var a = arguments, i = 0, format = a[i++]; return format.replace($.jqplot.sprintf.regex, function(substring, valueIndex, flags, minWidth, _, precision, type) { if (substring == '%%') { return '%'; } // parse flags var leftJustify = false, positivePrefix = '', zeroPad = false, prefixBaseX = false, htmlSpace = false, thousandSeparation = false; for (var j = 0; flags && j < flags.length; j++) switch (flags.charAt(j)) { case ' ': positivePrefix = ' '; break; case '+': positivePrefix = '+'; break; case '-': leftJustify = true; break; case '0': zeroPad = true; break; case '#': prefixBaseX = true; break; case '&': htmlSpace = true; break; case '\'': thousandSeparation = true; break; } // parameters may be null, undefined, empty-string or real valued // we want to ignore null, undefined and empty-string values if (!minWidth) { minWidth = 0; } else if (minWidth == '*') { minWidth = +a[i++]; } else if (minWidth.charAt(0) == '*') { minWidth = +a[minWidth.slice(1, -1)]; } else { minWidth = +minWidth; } // Note: undocumented perl feature: if (minWidth < 0) { minWidth = -minWidth; leftJustify = true; } if (!isFinite(minWidth)) { throw new Error('$.jqplot.sprintf: (minimum-)width must be finite'); } if (!precision) { precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type == 'd') ? 0 : void(0); } else if (precision == '*') { precision = +a[i++]; } else if (precision.charAt(0) == '*') { precision = +a[precision.slice(1, -1)]; } else { precision = +precision; } // grab value using valueIndex if required? var value = valueIndex ? a[valueIndex.slice(0, -1)] : a[i++]; switch (type) { case 's': { if (value == null) { return ''; } return formatString(String(value), leftJustify, minWidth, precision, zeroPad, htmlSpace); } case 'c': return formatString(String.fromCharCode(+value), leftJustify, minWidth, precision, zeroPad, htmlSpace); case 'b': return formatBaseX(value, 2, prefixBaseX, leftJustify, minWidth, precision, zeroPad,htmlSpace); case 'o': return formatBaseX(value, 8, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace); case 'x': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace); case 'X': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace).toUpperCase(); case 'u': return formatBaseX(value, 10, prefixBaseX, leftJustify, minWidth, precision, zeroPad, htmlSpace); case 'i': { var number = parseInt(+value, 10); if (isNaN(number)) { return ''; } var prefix = number < 0 ? '-' : positivePrefix; var number_str = thousandSeparation ? thousand_separate(String(Math.abs(number))): String(Math.abs(number)); value = prefix + pad(number_str, precision, '0', false); //value = prefix + pad(String(Math.abs(number)), precision, '0', false); return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace); } case 'd': { var number = Math.round(+value); if (isNaN(number)) { return ''; } var prefix = number < 0 ? '-' : positivePrefix; var number_str = thousandSeparation ? thousand_separate(String(Math.abs(number))): String(Math.abs(number)); value = prefix + pad(number_str, precision, '0', false); return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace); } case 'e': case 'E': case 'f': case 'F': case 'g': case 'G': { var number = +value; if (isNaN(number)) { return ''; } var prefix = number < 0 ? '-' : positivePrefix; var method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())]; var textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2]; var number_str = Math.abs(number)[method](precision); number_str = thousandSeparation ? thousand_separate(number_str): number_str; value = prefix + number_str; var justified = justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace)[textTransform](); if ($.jqplot.sprintf.decimalMark !== '.' && $.jqplot.sprintf.decimalMark !== $.jqplot.sprintf.thousandsSeparator) { return justified.replace(/\./, $.jqplot.sprintf.decimalMark); } else { return justified; } } case 'p': case 'P': { // make sure number is a number var number = +value; if (isNaN(number)) { return ''; } var prefix = number < 0 ? '-' : positivePrefix; var parts = String(Number(Math.abs(number)).toExponential()).split(/e|E/); var sd = (parts[0].indexOf('.') != -1) ? parts[0].length - 1 : parts[0].length; var zeros = (parts[1] < 0) ? -parts[1] - 1 : 0; if (Math.abs(number) < 1) { if (sd + zeros <= precision) { value = prefix + Math.abs(number).toPrecision(sd); } else { if (sd <= precision - 1) { value = prefix + Math.abs(number).toExponential(sd-1); } else { value = prefix + Math.abs(number).toExponential(precision-1); } } } else { var prec = (sd <= precision) ? sd : precision; value = prefix + Math.abs(number).toPrecision(prec); } var textTransform = ['toString', 'toUpperCase']['pP'.indexOf(type) % 2]; return justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace)[textTransform](); } case 'n': return ''; default: return substring; } }); }; $.jqplot.sprintf.thousandsSeparator = ','; // Specifies the decimal mark for floating point values. By default a period '.' // is used. If you change this value to for example a comma be sure to also // change the thousands separator or else this won't work since a simple String // replace is used (replacing all periods with the mark specified here). $.jqplot.sprintf.decimalMark = '.'; $.jqplot.sprintf.regex = /%%|%(\d+\$)?([-+#0&\' ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([nAscboxXuidfegpEGP])/g; $.jqplot.getSignificantFigures = function(number) { var parts = String(Number(Math.abs(number)).toExponential()).split(/e|E/); // total significant digits var sd = (parts[0].indexOf('.') != -1) ? parts[0].length - 1 : parts[0].length; var zeros = (parts[1] < 0) ? -parts[1] - 1 : 0; // exponent var expn = parseInt(parts[1], 10); // digits to the left of the decimal place var dleft = (expn + 1 > 0) ? expn + 1 : 0; // digits to the right of the decimal place var dright = (sd <= dleft) ? 0 : sd - expn - 1; return {significantDigits: sd, digitsLeft: dleft, digitsRight: dright, zeros: zeros, exponent: expn} ; }; $.jqplot.getPrecision = function(number) { return $.jqplot.getSignificantFigures(number).digitsRight; }; })(jQuery); var backCompat = $.uiBackCompat !== false; $.jqplot.effects = { effect: {} }; // prefix used for storing data on .data() var dataSpace = "jqplot.storage."; /******************************************************************************/ /*********************************** EFFECTS **********************************/ /******************************************************************************/ $.extend( $.jqplot.effects, { version: "1.9pre", // Saves a set of properties in a data storage save: function( element, set ) { for( var i=0; i < set.length; i++ ) { if ( set[ i ] !== null ) { element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); } } }, // Restores a set of previously saved properties from a data storage restore: function( element, set ) { for( var i=0; i < set.length; i++ ) { if ( set[ i ] !== null ) { element.css( set[ i ], element.data( dataSpace + set[ i ] ) ); } } }, setMode: function( el, mode ) { if (mode === "toggle") { mode = el.is( ":hidden" ) ? "show" : "hide"; } return mode; }, // Wraps the element around a wrapper that copies position properties createWrapper: function( element ) { // if the element is already wrapped, return it if ( element.parent().is( ".ui-effects-wrapper" )) { return element.parent(); } // wrap the element var props = { width: element.outerWidth(true), height: element.outerHeight(true), "float": element.css( "float" ) }, wrapper = $( "" ) .addClass( "ui-effects-wrapper" ) .css({ fontSize: "100%", background: "transparent", border: "none", margin: 0, padding: 0 }), // Store the size in case width/height are defined in % - Fixes #5245 size = { width: element.width(), height: element.height() }, active = document.activeElement; element.wrap( wrapper ); // Fixes #7595 - Elements lose focus when wrapped. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { $( active ).focus(); } wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element // transfer positioning properties to the wrapper if ( element.css( "position" ) === "static" ) { wrapper.css({ position: "relative" }); element.css({ position: "relative" }); } else { $.extend( props, { position: element.css( "position" ), zIndex: element.css( "z-index" ) }); $.each([ "top", "left", "bottom", "right" ], function(i, pos) { props[ pos ] = element.css( pos ); if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { props[ pos ] = "auto"; } }); element.css({ position: "relative", top: 0, left: 0, right: "auto", bottom: "auto" }); } element.css(size); return wrapper.css( props ).show(); }, removeWrapper: function( element ) { var active = document.activeElement; if ( element.parent().is( ".ui-effects-wrapper" ) ) { element.parent().replaceWith( element ); // Fixes #7595 - Elements lose focus when wrapped. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { $( active ).focus(); } } return element; } }); // return an effect options object for the given parameters: function _normalizeArguments( effect, options, speed, callback ) { // short path for passing an effect options object: if ( $.isPlainObject( effect ) ) { return effect; } // convert to an object effect = { effect: effect }; // catch (effect) if ( options === undefined ) { options = {}; } // catch (effect, callback) if ( $.isFunction( options ) ) { callback = options; speed = null; options = {}; } // catch (effect, speed, ?) if ( $.type( options ) === "number" || $.fx.speeds[ options ]) { callback = speed; speed = options; options = {}; } // catch (effect, options, callback) if ( $.isFunction( speed ) ) { callback = speed; speed = null; } // add options to effect if ( options ) { $.extend( effect, options ); } speed = speed || options.duration; effect.duration = $.fx.off ? 0 : typeof speed === "number" ? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default; effect.complete = callback || options.complete; return effect; } function standardSpeed( speed ) { // valid standard speeds if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) { return true; } // invalid strings - treat as "normal" speed if ( typeof speed === "string" && !$.jqplot.effects.effect[ speed ] ) { // TODO: remove in 2.0 (#7115) if ( backCompat && $.jqplot.effects[ speed ] ) { return false; } return true; } return false; } $.fn.extend({ jqplotEffect: function( effect, options, speed, callback ) { var args = _normalizeArguments.apply( this, arguments ), mode = args.mode, queue = args.queue, effectMethod = $.jqplot.effects.effect[ args.effect ], // DEPRECATED: remove in 2.0 (#7115) oldEffectMethod = !effectMethod && backCompat && $.jqplot.effects[ args.effect ]; if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) { // delegate to the original method (e.g., .show()) if possible if ( mode ) { return this[ mode ]( args.duration, args.complete ); } else { return this.each( function() { if ( args.complete ) { args.complete.call( this ); } }); } } function run( next ) { var elem = $( this ), complete = args.complete, mode = args.mode; function done() { if ( $.isFunction( complete ) ) { complete.call( elem[0] ); } if ( $.isFunction( next ) ) { next(); } } // if the element is hiddden and mode is hide, // or element is visible and mode is show if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { done(); } else { effectMethod.call( elem[0], args, done ); } } // TODO: remove this check in 2.0, effectMethod will always be true if ( effectMethod ) { return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); } else { // DEPRECATED: remove in 2.0 (#7115) return oldEffectMethod.call(this, { options: args, duration: args.duration, callback: args.complete, mode: args.mode }); } } }); var rvertical = /up|down|vertical/, rpositivemotion = /up|left|vertical|horizontal/; $.jqplot.effects.effect.blind = function( o, done ) { // Create element var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "height", "width" ], mode = $.jqplot.effects.setMode( el, o.mode || "hide" ), direction = o.direction || "up", vertical = rvertical.test( direction ), ref = vertical ? "height" : "width", ref2 = vertical ? "top" : "left", motion = rpositivemotion.test( direction ), animation = {}, show = mode === "show", wrapper, distance, top; // // if already wrapped, the wrapper's properties are my property. #6245 if ( el.parent().is( ".ui-effects-wrapper" ) ) { $.jqplot.effects.save( el.parent(), props ); } else { $.jqplot.effects.save( el, props ); } el.show(); top = parseInt(el.css('top'), 10); wrapper = $.jqplot.effects.createWrapper( el ).css({ overflow: "hidden" }); distance = vertical ? wrapper[ ref ]() + top : wrapper[ ref ](); animation[ ref ] = show ? String(distance) : '0'; if ( !motion ) { el .css( vertical ? "bottom" : "right", 0 ) .css( vertical ? "top" : "left", "" ) .css({ position: "absolute" }); animation[ ref2 ] = show ? '0' : String(distance); } // // start at 0 if we are showing if ( show ) { wrapper.css( ref, 0 ); if ( ! motion ) { wrapper.css( ref2, distance ); } } // // Animate wrapper.animate( animation, { duration: o.duration, easing: o.easing, queue: false, complete: function() { if ( mode === "hide" ) { el.hide(); } $.jqplot.effects.restore( el, props ); $.jqplot.effects.removeWrapper( el ); done(); } }); }; /** * jqPlot * Pure JavaScript plotting plugin using jQuery * * Version: 1.0.4 * Revision: 1121 * * Copyright (c) 2009-2012 Chris Leonello * jqPlot is currently available for use in all personal or commercial projects * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can * choose the license that best suits your project and use it accordingly. * * Although not required, the author would appreciate an email letting him * know of any substantial use of jqPlot. You can reach the author at: * chris at jqplot dot com or see http://www.jqplot.com/info.php . * * If you are feeling kind and generous, consider supporting the project by * making a donation at: http://www.jqplot.com/donate.php . * * sprintf functions contained in jqplot.sprintf.js by Ash Searle: * * version 2007.04.27 * author Ash Searle * http://hexmen.com/blog/2007/03/printf-sprintf/ * http://hexmen.com/js/sprintf.js * The author (Ash Searle) has placed this code in the public domain: * "This code is unrestricted: you are free to use it however you like." * * included jsDate library by Chris Leonello: * * Copyright (c) 2010-2012 Chris Leonello * * jsDate is currently available for use in all personal or commercial projects * under both the MIT and GPL version 2.0 licenses. This means that you can * choose the license that best suits your project and use it accordingly. * * jsDate borrows many concepts and ideas from the Date Instance * Methods by Ken Snyder along with some parts of Ken's actual code. * * Ken's origianl Date Instance Methods and copyright notice: * * Ken Snyder (ken d snyder at gmail dot com) * 2008-09-10 * version 2.0.2 (http://kendsnyder.com/sandbox/date/) * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/) * * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js. * Larry has generously given permission to adapt his code for inclusion * into jqPlot. * * Larry's original code can be found here: * * https://github.com/lsiden/export-jqplot-to-png * * */ (function($) { // This code is a modified version of the canvastext.js code, copyright below: // // This code is released to the public domain by Jim Studt, 2007. // He may keep some sort of up to date copy at http://www.federated.com/~jim/canvastext/ // $.jqplot.CanvasTextRenderer = function(options){ this.fontStyle = 'normal'; // normal, italic, oblique [not implemented] this.fontVariant = 'normal'; // normal, small caps [not implemented] this.fontWeight = 'normal'; // normal, bold, bolder, lighter, 100 - 900 this.fontSize = '10px'; this.fontFamily = 'sans-serif'; this.fontStretch = 1.0; this.fillStyle = '#666666'; this.angle = 0; this.textAlign = 'start'; this.textBaseline = 'alphabetic'; this.text; this.width; this.height; this.pt2px = 1.28; $.extend(true, this, options); this.normalizedFontSize = this.normalizeFontSize(this.fontSize); this.setHeight(); }; $.jqplot.CanvasTextRenderer.prototype.init = function(options) { $.extend(true, this, options); this.normalizedFontSize = this.normalizeFontSize(this.fontSize); this.setHeight(); }; // convert css spec into point size // returns float $.jqplot.CanvasTextRenderer.prototype.normalizeFontSize = function(sz) { sz = String(sz); var n = parseFloat(sz); if (sz.indexOf('px') > -1) { return n/this.pt2px; } else if (sz.indexOf('pt') > -1) { return n; } else if (sz.indexOf('em') > -1) { return n*12; } else if (sz.indexOf('%') > -1) { return n*12/100; } // default to pixels; else { return n/this.pt2px; } }; $.jqplot.CanvasTextRenderer.prototype.fontWeight2Float = function(w) { // w = normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 // return values adjusted for Hershey font. if (Number(w)) { return w/400; } else { switch (w) { case 'normal': return 1; break; case 'bold': return 1.75; break; case 'bolder': return 2.25; break; case 'lighter': return 0.75; break; default: return 1; break; } } }; $.jqplot.CanvasTextRenderer.prototype.getText = function() { return this.text; }; $.jqplot.CanvasTextRenderer.prototype.setText = function(t, ctx) { this.text = t; this.setWidth(ctx); return this; }; $.jqplot.CanvasTextRenderer.prototype.getWidth = function(ctx) { return this.width; }; $.jqplot.CanvasTextRenderer.prototype.setWidth = function(ctx, w) { if (!w) { this.width = this.measure(ctx, this.text); } else { this.width = w; } return this; }; // return height in pixels. $.jqplot.CanvasTextRenderer.prototype.getHeight = function(ctx) { return this.height; }; // w - height in pt // set heigh in px $.jqplot.CanvasTextRenderer.prototype.setHeight = function(w) { if (!w) { //height = this.fontSize /0.75; this.height = this.normalizedFontSize * this.pt2px; } else { this.height = w; } return this; }; $.jqplot.CanvasTextRenderer.prototype.letter = function (ch) { return this.letters[ch]; }; $.jqplot.CanvasTextRenderer.prototype.ascent = function() { return this.normalizedFontSize; }; $.jqplot.CanvasTextRenderer.prototype.descent = function() { return 7.0*this.normalizedFontSize/25.0; }; $.jqplot.CanvasTextRenderer.prototype.measure = function(ctx, str) { var total = 0; var len = str.length; for (var i = 0; i < len; i++) { var c = this.letter(str.charAt(i)); if (c) { total += c.width * this.normalizedFontSize / 25.0 * this.fontStretch; } } return total; }; $.jqplot.CanvasTextRenderer.prototype.draw = function(ctx,str) { var x = 0; // leave room at bottom for descenders. var y = this.height*0.72; var total = 0; var len = str.length; var mag = this.normalizedFontSize / 25.0; ctx.save(); var tx, ty; // 1st quadrant if ((-Math.PI/2 <= this.angle && this.angle <= 0) || (Math.PI*3/2 <= this.angle && this.angle <= Math.PI*2)) { tx = 0; ty = -Math.sin(this.angle) * this.width; } // 4th quadrant else if ((0 < this.angle && this.angle <= Math.PI/2) || (-Math.PI*2 <= this.angle && this.angle <= -Math.PI*3/2)) { tx = Math.sin(this.angle) * this.height; ty = 0; } // 2nd quadrant else if ((-Math.PI < this.angle && this.angle < -Math.PI/2) || (Math.PI <= this.angle && this.angle <= Math.PI*3/2)) { tx = -Math.cos(this.angle) * this.width; ty = -Math.sin(this.angle) * this.width - Math.cos(this.angle) * this.height; } // 3rd quadrant else if ((-Math.PI*3/2 < this.angle && this.angle < Math.PI) || (Math.PI/2 < this.angle && this.angle < Math.PI)) { tx = Math.sin(this.angle) * this.height - Math.cos(this.angle)*this.width; ty = -Math.cos(this.angle) * this.height; } ctx.strokeStyle = this.fillStyle; ctx.fillStyle = this.fillStyle; ctx.translate(tx, ty); ctx.rotate(this.angle); ctx.lineCap = "round"; // multiplier was 2.0 var fact = (this.normalizedFontSize > 30) ? 2.0 : 2 + (30 - this.normalizedFontSize)/20; ctx.lineWidth = fact * mag * this.fontWeight2Float(this.fontWeight); for ( var i = 0; i < len; i++) { var c = this.letter( str.charAt(i)); if ( !c) { continue; } ctx.beginPath(); var penUp = 1; var needStroke = 0; for ( var j = 0; j < c.points.length; j++) { var a = c.points[j]; if ( a[0] == -1 && a[1] == -1) { penUp = 1; continue; } if ( penUp) { ctx.moveTo( x + a[0]*mag*this.fontStretch, y - a[1]*mag); penUp = false; } else { ctx.lineTo( x + a[0]*mag*this.fontStretch, y - a[1]*mag); } } ctx.stroke(); x += c.width*mag*this.fontStretch; } ctx.restore(); return total; }; $.jqplot.CanvasTextRenderer.prototype.letters = { ' ': { width: 16, points: [] }, '!': { width: 10, points: [[5,21],[5,7],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]] }, '"': { width: 16, points: [[4,21],[4,14],[-1,-1],[12,21],[12,14]] }, '#': { width: 21, points: [[11,25],[4,-7],[-1,-1],[17,25],[10,-7],[-1,-1],[4,12],[18,12],[-1,-1],[3,6],[17,6]] }, '$': { width: 20, points: [[8,25],[8,-4],[-1,-1],[12,25],[12,-4],[-1,-1],[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] }, '%': { width: 24, points: [[21,21],[3,0],[-1,-1],[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],[10,20],[13,19],[16,19],[19,20],[21,21],[-1,-1],[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]] }, '&': { width: 26, points: [[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]] }, '\'': { width: 10, points: [[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]] }, '(': { width: 14, points: [[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]] }, ')': { width: 14, points: [[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]] }, '*': { width: 16, points: [[8,21],[8,9],[-1,-1],[3,18],[13,12],[-1,-1],[13,18],[3,12]] }, '+': { width: 26, points: [[13,18],[13,0],[-1,-1],[4,9],[22,9]] }, ',': { width: 10, points: [[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] }, '-': { width: 18, points: [[6,9],[12,9]] }, '.': { width: 10, points: [[5,2],[4,1],[5,0],[6,1],[5,2]] }, '/': { width: 22, points: [[20,25],[2,-7]] }, '0': { width: 20, points: [[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]] }, '1': { width: 20, points: [[6,17],[8,18],[11,21],[11,0]] }, '2': { width: 20, points: [[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]] }, '3': { width: 20, points: [[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] }, '4': { width: 20, points: [[13,21],[3,7],[18,7],[-1,-1],[13,21],[13,0]] }, '5': { width: 20, points: [[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] }, '6': { width: 20, points: [[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]] }, '7': { width: 20, points: [[17,21],[7,0],[-1,-1],[3,21],[17,21]] }, '8': { width: 20, points: [[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]] }, '9': { width: 20, points: [[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]] }, ':': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]] }, ';': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] }, '<': { width: 24, points: [[20,18],[4,9],[20,0]] }, '=': { width: 26, points: [[4,12],[22,12],[-1,-1],[4,6],[22,6]] }, '>': { width: 24, points: [[4,18],[20,9],[4,0]] }, '?': { width: 18, points: [[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]] }, '@': { width: 27, points: [[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]] }, 'A': { width: 18, points: [[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]] }, 'B': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]] }, 'C': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]] }, 'D': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]] }, 'E': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]] }, 'F': { width: 18, points: [[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]] }, 'G': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]] }, 'H': { width: 22, points: [[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]] }, 'I': { width: 8, points: [[4,21],[4,0]] }, 'J': { width: 16, points: [[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]] }, 'K': { width: 21, points: [[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]] }, 'L': { width: 17, points: [[4,21],[4,0],[-1,-1],[4,0],[16,0]] }, 'M': { width: 24, points: [[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]] }, 'N': { width: 22, points: [[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]] }, 'O': { width: 22, points: [[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]] }, 'P': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]] }, 'Q': { width: 22, points: [[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]] }, 'R': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]] }, 'S': { width: 20, points: [[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] }, 'T': { width: 16, points: [[8,21],[8,0],[-1,-1],[1,21],[15,21]] }, 'U': { width: 22, points: [[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]] }, 'V': { width: 18, points: [[1,21],[9,0],[-1,-1],[17,21],[9,0]] }, 'W': { width: 24, points: [[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]] }, 'X': { width: 20, points: [[3,21],[17,0],[-1,-1],[17,21],[3,0]] }, 'Y': { width: 18, points: [[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]] }, 'Z': { width: 20, points: [[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]] }, '[': { width: 14, points: [[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]] }, '\\': { width: 14, points: [[0,21],[14,-3]] }, ']': { width: 14, points: [[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]] }, '^': { width: 16, points: [[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]] }, '_': { width: 16, points: [[0,-2],[16,-2]] }, '`': { width: 10, points: [[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]] }, 'a': { width: 19, points: [[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] }, 'b': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]] }, 'c': { width: 18, points: [[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] }, 'd': { width: 19, points: [[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] }, 'e': { width: 18, points: [[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] }, 'f': { width: 12, points: [[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]] }, 'g': { width: 19, points: [[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] }, 'h': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]] }, 'i': { width: 8, points: [[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]] }, 'j': { width: 10, points: [[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]] }, 'k': { width: 17, points: [[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]] }, 'l': { width: 8, points: [[4,21],[4,0]] }, 'm': { width: 30, points: [[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]] }, 'n': { width: 19, points: [[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]] }, 'o': { width: 19, points: [[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]] }, 'p': { width: 19, points: [[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]] }, 'q': { width: 19, points: [[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] }, 'r': { width: 13, points: [[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]] }, 's': { width: 17, points: [[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]] }, 't': { width: 12, points: [[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]] }, 'u': { width: 19, points: [[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]] }, 'v': { width: 16, points: [[2,14],[8,0],[-1,-1],[14,14],[8,0]] }, 'w': { width: 22, points: [[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]] }, 'x': { width: 17, points: [[3,14],[14,0],[-1,-1],[14,14],[3,0]] }, 'y': { width: 16, points: [[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]] }, 'z': { width: 17, points: [[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]] }, '{': { width: 14, points: [[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]] }, '|': { width: 8, points: [[4,25],[4,-7]] }, '}': { width: 14, points: [[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]] }, '~': { width: 24, points: [[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]] } }; $.jqplot.CanvasFontRenderer = function(options) { options = options || {}; if (!options.pt2px) { options.pt2px = 1.5; } $.jqplot.CanvasTextRenderer.call(this, options); }; $.jqplot.CanvasFontRenderer.prototype = new $.jqplot.CanvasTextRenderer({}); $.jqplot.CanvasFontRenderer.prototype.constructor = $.jqplot.CanvasFontRenderer; $.jqplot.CanvasFontRenderer.prototype.measure = function(ctx, str) { // var fstyle = this.fontStyle+' '+this.fontVariant+' '+this.fontWeight+' '+this.fontSize+' '+this.fontFamily; var fstyle = this.fontSize+' '+this.fontFamily; ctx.save(); ctx.font = fstyle; var w = ctx.measureText(str).width; ctx.restore(); return w; }; $.jqplot.CanvasFontRenderer.prototype.draw = function(ctx, str) { var x = 0; // leave room at bottom for descenders. var y = this.height*0.72; //var y = 12; ctx.save(); var tx, ty; // 1st quadrant if ((-Math.PI/2 <= this.angle && this.angle <= 0) || (Math.PI*3/2 <= this.angle && this.angle <= Math.PI*2)) { tx = 0; ty = -Math.sin(this.angle) * this.width; } // 4th quadrant else if ((0 < this.angle && this.angle <= Math.PI/2) || (-Math.PI*2 <= this.angle && this.angle <= -Math.PI*3/2)) { tx = Math.sin(this.angle) * this.height; ty = 0; } // 2nd quadrant else if ((-Math.PI < this.angle && this.angle < -Math.PI/2) || (Math.PI <= this.angle && this.angle <= Math.PI*3/2)) { tx = -Math.cos(this.angle) * this.width; ty = -Math.sin(this.angle) * this.width - Math.cos(this.angle) * this.height; } // 3rd quadrant else if ((-Math.PI*3/2 < this.angle && this.angle < Math.PI) || (Math.PI/2 < this.angle && this.angle < Math.PI)) { tx = Math.sin(this.angle) * this.height - Math.cos(this.angle)*this.width; ty = -Math.cos(this.angle) * this.height; } ctx.strokeStyle = this.fillStyle; ctx.fillStyle = this.fillStyle; // var fstyle = this.fontStyle+' '+this.fontVariant+' '+this.fontWeight+' '+this.fontSize+' '+this.fontFamily; var fstyle = this.fontSize+' '+this.fontFamily; ctx.font = fstyle; ctx.translate(tx, ty); ctx.rotate(this.angle); ctx.fillText(str, x, y); // ctx.strokeText(str, x, y); ctx.restore(); }; })(jQuery); /** * jqPlot * Pure JavaScript plotting plugin using jQuery * * Version: 1.0.4 * Revision: 1121 * * Copyright (c) 2009-2012 Chris Leonello * jqPlot is currently available for use in all personal or commercial projects * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can * choose the license that best suits your project and use it accordingly. * * Although not required, the author would appreciate an email letting him * know of any substantial use of jqPlot. You can reach the author at: * chris at jqplot dot com or see http://www.jqplot.com/info.php . * * If you are feeling kind and generous, consider supporting the project by * making a donation at: http://www.jqplot.com/donate.php . * * sprintf functions contained in jqplot.sprintf.js by Ash Searle: * * version 2007.04.27 * author Ash Searle * http://hexmen.com/blog/2007/03/printf-sprintf/ * http://hexmen.com/js/sprintf.js * The author (Ash Searle) has placed this code in the public domain: * "This code is unrestricted: you are free to use it however you like." * */ (function($) { /** * Class: $.jqplot.CanvasAxisLabelRenderer * Renderer to draw axis labels with a canvas element to support advanced * featrues such as rotated text. This renderer uses a separate rendering engine * to draw the text on the canvas. Two modes of rendering the text are available. * If the browser has native font support for canvas fonts (currently Mozila 3.5 * and Safari 4), you can enable text rendering with the canvas fillText method. * You do so by setting the "enableFontSupport" option to true. * * Browsers lacking native font support will have the text drawn on the canvas * using the Hershey font metrics. Even if the "enableFontSupport" option is true * non-supporting browsers will still render with the Hershey font. * */ $.jqplot.CanvasAxisLabelRenderer = function(options) { // Group: Properties // prop: angle // angle of text, measured clockwise from x axis. this.angle = 0; // name of the axis associated with this tick this.axis; // prop: show // wether or not to show the tick (mark and label). this.show = true; // prop: showLabel // wether or not to show the label. this.showLabel = true; // prop: label // label for the axis. this.label = ''; // prop: fontFamily // CSS spec for the font-family css attribute. // Applies only to browsers supporting native font rendering in the // canvas tag. Currently Mozilla 3.5 and Safari 4. this.fontFamily = '"Trebuchet MS", Arial, Helvetica, sans-serif'; // prop: fontSize // CSS spec for font size. this.fontSize = '11pt'; // prop: fontWeight // CSS spec for fontWeight: normal, bold, bolder, lighter or a number 100 - 900 this.fontWeight = 'normal'; // prop: fontStretch // Multiplier to condense or expand font width. // Applies only to browsers which don't support canvas native font rendering. this.fontStretch = 1.0; // prop: textColor // css spec for the color attribute. this.textColor = '#666666'; // prop: enableFontSupport // true to turn on native canvas font support in Mozilla 3.5+ and Safari 4+. // If true, label will be drawn with canvas tag native support for fonts. // If false, label will be drawn with Hershey font metrics. this.enableFontSupport = true; // prop: pt2px // Point to pixel scaling factor, used for computing height of bounding box // around a label. The labels text renderer has a default setting of 1.4, which // should be suitable for most fonts. Leave as null to use default. If tops of // letters appear clipped, increase this. If bounding box seems too big, decrease. // This is an issue only with the native font renderering capabilities of Mozilla // 3.5 and Safari 4 since they do not provide a method to determine the font height. this.pt2px = null; this._elem; this._ctx; this._plotWidth; this._plotHeight; this._plotDimensions = {height:null, width:null}; $.extend(true, this, options); if (options.angle == null && this.axis != 'xaxis' && this.axis != 'x2axis') { this.angle = -90; } var ropts = {fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily}; if (this.pt2px) { ropts.pt2px = this.pt2px; } if (this.enableFontSupport) { if ($.jqplot.support_canvas_text()) { this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts); } else { this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts); } } else { this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts); } }; $.jqplot.CanvasAxisLabelRenderer.prototype.init = function(options) { $.extend(true, this, options); this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily}); }; // return width along the x axis // will check first to see if an element exists. // if not, will return the computed text box width. $.jqplot.CanvasAxisLabelRenderer.prototype.getWidth = function(ctx) { if (this._elem) { return this._elem.outerWidth(true); } else { var tr = this._textRenderer; var l = tr.getWidth(ctx); var h = tr.getHeight(ctx); var w = Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l); return w; } }; // return height along the y axis. $.jqplot.CanvasAxisLabelRenderer.prototype.getHeight = function(ctx) { if (this._elem) { return this._elem.outerHeight(true); } else { var tr = this._textRenderer; var l = tr.getWidth(ctx); var h = tr.getHeight(ctx); var w = Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l); return w; } }; $.jqplot.CanvasAxisLabelRenderer.prototype.getAngleRad = function() { var a = this.angle * Math.PI/180; return a; }; $.jqplot.CanvasAxisLabelRenderer.prototype.draw = function(ctx, plot) { // Memory Leaks patch if (this._elem) { if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) { window.G_vmlCanvasManager.uninitElement(this._elem.get(0)); } this._elem.emptyForce(); this._elem = null; } // create a canvas here, but can't draw on it untill it is appended // to dom for IE compatability. var elem = plot.canvasManager.getCanvas(); this._textRenderer.setText(this.label, ctx); var w = this.getWidth(ctx); var h = this.getHeight(ctx); elem.width = w; elem.height = h; elem.style.width = w; elem.style.height = h; elem = plot.canvasManager.initCanvas(elem); this._elem = $(elem); this._elem.css({ position: 'absolute'}); this._elem.addClass('jqplot-'+this.axis+'-label'); elem = null; return this._elem; }; $.jqplot.CanvasAxisLabelRenderer.prototype.pack = function() { this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label); }; })(jQuery); /** * jqPlot * Pure JavaScript plotting plugin using jQuery * * Version: 1.0.4 * Revision: 1121 * * Copyright (c) 2009-2012 Chris Leonello * jqPlot is currently available for use in all personal or commercial projects * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can * choose the license that best suits your project and use it accordingly. * * Although not required, the author would appreciate an email letting him * know of any substantial use of jqPlot. You can reach the author at: * chris at jqplot dot com or see http://www.jqplot.com/info.php . * * If you are feeling kind and generous, consider supporting the project by * making a donation at: http://www.jqplot.com/donate.php . * * sprintf functions contained in jqplot.sprintf.js by Ash Searle: * * version 2007.04.27 * author Ash Searle * http://hexmen.com/blog/2007/03/printf-sprintf/ * http://hexmen.com/js/sprintf.js * The author (Ash Searle) has placed this code in the public domain: * "This code is unrestricted: you are free to use it however you like." * */ (function($) { // Class: $.jqplot.BarRenderer // A plugin renderer for jqPlot to draw a bar plot. // Draws series as a line. $.jqplot.BarRenderer = function(){ $.jqplot.LineRenderer.call(this); }; $.jqplot.BarRenderer.prototype = new $.jqplot.LineRenderer(); $.jqplot.BarRenderer.prototype.constructor = $.jqplot.BarRenderer; // called with scope of series. $.jqplot.BarRenderer.prototype.init = function(options, plot) { // Group: Properties // // prop: barPadding // Number of pixels between adjacent bars at the same axis value. this.barPadding = 8; // prop: barMargin // Number of pixels between groups of bars at adjacent axis values. this.barMargin = 10; // prop: barDirection // 'vertical' = up and down bars, 'horizontal' = side to side bars this.barDirection = 'vertical'; // prop: barWidth // Width of the bar in pixels (auto by devaul). null = calculated automatically. this.barWidth = null; // prop: shadowOffset // offset of the shadow from the slice and offset of // each succesive stroke of the shadow from the last. this.shadowOffset = 2; // prop: shadowDepth // number of strokes to apply to the shadow, // each stroke offset shadowOffset from the last. this.shadowDepth = 5; // prop: shadowAlpha // transparency of the shadow (0 = transparent, 1 = opaque) this.shadowAlpha = 0.08; // prop: waterfall // true to enable waterfall plot. this.waterfall = false; // prop: groups // group bars into this many groups this.groups = 1; // prop: varyBarColor // true to color each bar of a series separately rather than // have every bar of a given series the same color. // If used for non-stacked multiple series bar plots, user should // specify a separate 'seriesColors' array for each series. // Otherwise, each series will set their bars to the same color array. // This option has no Effect for stacked bar charts and is disabled. this.varyBarColor = false; // prop: highlightMouseOver // True to highlight slice when moused over. // This must be false to enable highlightMouseDown to highlight when clicking on a slice. this.highlightMouseOver = true; // prop: highlightMouseDown // True to highlight when a mouse button is pressed over a slice. // This will be disabled if highlightMouseOver is true. this.highlightMouseDown = false; // prop: highlightColors // an array of colors to use when highlighting a bar. this.highlightColors = []; // prop: transposedData // NOT IMPLEMENTED YET. True if this is a horizontal bar plot and // x and y values are "transposed". Tranposed, or "swapped", data is // required prior to rev. 894 builds of jqPlot with horizontal bars. // Allows backward compatability of bar renderer horizontal bars with // old style data sets. this.transposedData = true; this.renderer.animation = { show: false, direction: 'down', speed: 3000, _supported: true }; this._type = 'bar'; // if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver if (options.highlightMouseDown && options.highlightMouseOver == null) { options.highlightMouseOver = false; } ////// // This is probably wrong here. // After going back and forth on wether renderer should be the thing // or extend the thing, it seems that it it best if it is a property // on the thing. This should be something that is commonized // among series renderers in the future. ////// $.extend(true, this, options); // really should probably do this $.extend(true, this.renderer, options); // fill is still needed to properly draw the legend. // bars have to be filled. this.fill = true; // if horizontal bar and animating, reset the default direction if (this.barDirection === 'horizontal' && this.rendererOptions.animation && this.rendererOptions.animation.direction == null) { this.renderer.animation.direction = 'left'; } if (this.waterfall) { this.fillToZero = false; this.disableStack = true; } if (this.barDirection == 'vertical' ) { this._primaryAxis = '_xaxis'; this._stackAxis = 'y'; this.fillAxis = 'y'; } else { this._primaryAxis = '_yaxis'; this._stackAxis = 'x'; this.fillAxis = 'x'; } // index of the currenty highlighted point, if any this._highlightedPoint = null; // total number of values for all bar series, total number of bar series, and position of this series this._plotSeriesInfo = null; // Array of actual data colors used for each data point. this._dataColors = []; this._barPoints = []; // set the shape renderer options var opts = {lineJoin:'miter', lineCap:'round', fill:true, isarc:false, strokeStyle:this.color, fillStyle:this.color, closePath:this.fill}; this.renderer.shapeRenderer.init(opts); // set the shadow renderer options var sopts = {lineJoin:'miter', lineCap:'round', fill:true, isarc:false, angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, depth:this.shadowDepth, closePath:this.fill}; this.renderer.shadowRenderer.init(sopts); plot.postInitHooks.addOnce(postInit); plot.postDrawHooks.addOnce(postPlotDraw); plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove); plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown); plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp); plot.eventListenerHooks.addOnce('jqplotClick', handleClick); plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick); }; // called with scope of series function barPreInit(target, data, seriesDefaults, options) { if (this.rendererOptions.barDirection == 'horizontal') { this._stackAxis = 'x'; this._primaryAxis = '_yaxis'; } if (this.rendererOptions.waterfall == true) { this._data = $.extend(true, [], this.data); var sum = 0; var pos = (!this.rendererOptions.barDirection || this.rendererOptions.barDirection === 'vertical' || this.transposedData === false) ? 1 : 0; for(var i=0; i
hi: | %s |
low: | %s |
close: | %s |