diff --git a/NzbDrone.Web/CassetteConfiguration.cs b/NzbDrone.Web/CassetteConfiguration.cs deleted file mode 100644 index fa92189e4..000000000 --- a/NzbDrone.Web/CassetteConfiguration.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Cassette; -using Cassette.Scripts; -using Cassette.Stylesheets; - -namespace NzbDrone.Web -{ - /// - /// Configures the Cassette asset bundles for the web application. - /// - public class CassetteBundleConfiguration : IConfiguration - { - public const string BASE_STYLE = "BASE_STYLE"; - public const string BASE_SCRIPT = "BASE_SCRIPT"; - public const string BACKBONE = "BACKBONE"; - public const string FONTS = "FONTS"; - public const string VALIDATION_SCRIPTS = "VALIDATION_SCRIPTS"; - public const string FILEBROWSER_SCRIPT = "FILEBROWSER_SCRIPT"; - public const string FILEBROWSER_STYLE = "FILEBROWSER_STYLE"; - - public void Configure(BundleCollection bundles) - { - bundles.AddUrlWithAlias("//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,600,300'", FONTS); - - - bundles.Add(BASE_STYLE, new[]{ - "content2\\Bootstrap\\bootstrap.less", - //"content2\\Bootstrap\\responsive.less", - //"content2\\bootstrap-metro.css", - "content2\\base.css", - "content2\\menu.css", - "content2\\bootstrap-overrides.css"}, - bundle => bundle.AddReference("/" + FONTS)); - - bundles.Add(BASE_SCRIPT, new[]{ - "scripts2\\jquery-1.8.2.js", - "scripts2\\jquery.livequery.js", - "scripts2\\bootstrap-mvc.js", - "scripts2\\bootstrap.js", - "scripts2\\metro\\jquery.metro.js"}); - - bundles.Add(BACKBONE, new[]{ - "JsLibraries\\underscore.js", - "JsLibraries\\backbone.js", - "JsLibraries\\backbone.marionette.js", - - "app.js", - "AddSeries\\Views\\addSeriesView.js"}, - bundle => bundle.AddReference("/" + BASE_SCRIPT)); - - - bundles.AddPerSubDirectory("AddSeries", bundle => bundle.AddReference("/" + BASE_STYLE)); - - - bundles.Add(FILEBROWSER_STYLE, new[]{ - "content2\\stats.css", - "content2\\file-browser.css", - "content2\\FancyBox\\jquery.fancybox.css"}, - bundle => bundle.AddReference("/" + BASE_STYLE)); - - bundles.Add(FILEBROWSER_SCRIPT, new[]{ - "content2\\FancyBox\\jquery.fancybox.js"}, - bundle => bundle.AddReference("/" + BASE_SCRIPT)); - - bundles.Add(VALIDATION_SCRIPTS, new[]{ - "scripts2\\jquery.livequery.js", - "scripts2\\jquery.validate.js", - "scripts2\\jquery.validate.unobtrusive.js", - "scripts2\\bootstrap-mvc.js"}, - bundle => bundle.AddReference("/" + BASE_SCRIPT)); - - - - } - } -} \ No newline at end of file diff --git a/NzbDrone.Web/Content2/FancyBox/jquery.fancybox.css b/NzbDrone.Web/Content2/FancyBox/jquery.fancybox.css deleted file mode 100644 index b1d4c020e..000000000 --- a/NzbDrone.Web/Content2/FancyBox/jquery.fancybox.css +++ /dev/null @@ -1,246 +0,0 @@ -/*! fancyBox v2.1.0 fancyapps.com | fancyapps.com/fancybox/#license */ -.fancybox-wrap, -.fancybox-skin, -.fancybox-outer, -.fancybox-inner, -.fancybox-image, -.fancybox-wrap iframe, -.fancybox-wrap object, -.fancybox-nav, -.fancybox-nav span, -.fancybox-tmp -{ - padding: 0; - margin: 0; - border: 0; - outline: none; - vertical-align: top; -} - -.fancybox-wrap { - position: absolute; - top: 0; - left: 0; - z-index: 8020; -} - -.fancybox-skin { - position: relative; - background: #f9f9f9; - color: #444; - text-shadow: none; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - -.fancybox-opened { - z-index: 8030; -} - -.fancybox-opened .fancybox-skin { - -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); - -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); - box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); -} - -.fancybox-outer, .fancybox-inner { - position: relative; -} - -.fancybox-inner { - overflow: hidden; -} - -.fancybox-type-iframe .fancybox-inner { - -webkit-overflow-scrolling: touch; -} - -.fancybox-error { - color: #444; - font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; - margin: 0; - padding: 15px; - white-space: nowrap; -} - -.fancybox-image, .fancybox-iframe { - display: block; - width: 100%; - height: 100%; -} - -.fancybox-image { - max-width: 100%; - max-height: 100%; -} - -#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { - background-image: url('fancybox_sprite.png'); -} - -#fancybox-loading { - position: fixed; - top: 50%; - left: 50%; - margin-top: -22px; - margin-left: -22px; - background-position: 0 -108px; - opacity: 0.8; - cursor: pointer; - z-index: 8060; -} - -#fancybox-loading div { - width: 44px; - height: 44px; - background: url('fancybox_loading.gif') center center no-repeat; -} - -.fancybox-close { - position: absolute; - top: -18px; - right: -18px; - width: 36px; - height: 36px; - cursor: pointer; - z-index: 8040; -} - -.fancybox-nav { - position: absolute; - top: 0; - width: 40%; - height: 100%; - cursor: pointer; - text-decoration: none; - background: transparent url('blank.gif'); /* helps IE */ - -webkit-tap-highlight-color: rgba(0,0,0,0); - z-index: 8040; -} - -.fancybox-prev { - left: 0; -} - -.fancybox-next { - right: 0; -} - -.fancybox-nav span { - position: absolute; - top: 50%; - width: 36px; - height: 34px; - margin-top: -18px; - cursor: pointer; - z-index: 8040; - visibility: hidden; -} - -.fancybox-prev span { - left: 10px; - background-position: 0 -36px; -} - -.fancybox-next span { - right: 10px; - background-position: 0 -72px; -} - -.fancybox-nav:hover span { - visibility: visible; -} - -.fancybox-tmp { - position: absolute; - top: -9999px; - left: -9999px; - visibility: hidden; -} - -/* Overlay helper */ - -.fancybox-lock { - overflow: hidden; -} - -.fancybox-overlay { - position: absolute; - top: 0; - left: 0; - overflow: hidden; - display: none; - z-index: 8010; - background: url('fancybox_overlay.png'); -} - -.fancybox-overlay-fixed { - position: fixed; - bottom: 0; - right: 0; -} - -.fancybox-lock .fancybox-overlay { - overflow: auto; - overflow-y: scroll; -} - -/* Title helper */ - -.fancybox-title { - visibility: hidden; - font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; - position: relative; - text-shadow: none; - z-index: 8050; -} - -.fancybox-opened .fancybox-title { - visibility: visible; -} - -.fancybox-title-float-wrap { - position: absolute; - bottom: 0; - right: 50%; - margin-bottom: -35px; - z-index: 8050; - text-align: center; -} - -.fancybox-title-float-wrap .child { - display: inline-block; - margin-right: -100%; - padding: 2px 20px; - background: transparent; /* Fallback for web browsers that doesn't support RGBa */ - background: rgba(0, 0, 0, 0.8); - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - border-radius: 15px; - text-shadow: 0 1px 2px #222; - color: #FFF; - font-weight: bold; - line-height: 24px; - white-space: nowrap; -} - -.fancybox-title-outside-wrap { - position: relative; - margin-top: 10px; - color: #fff; -} - -.fancybox-title-inside-wrap { - padding-top: 10px; -} - -.fancybox-title-over-wrap { - position: absolute; - bottom: 0; - left: 0; - color: #fff; - padding: 10px; - background: #000; - background: rgba(0, 0, 0, .8); -} \ No newline at end of file diff --git a/NzbDrone.Web/Content2/FancyBox/jquery.fancybox.js b/NzbDrone.Web/Content2/FancyBox/jquery.fancybox.js deleted file mode 100644 index 26f40045b..000000000 --- a/NzbDrone.Web/Content2/FancyBox/jquery.fancybox.js +++ /dev/null @@ -1,1921 +0,0 @@ -/*! - * fancyBox - jQuery Plugin - * version: 2.1.1 (Mon, 01 Oct 2012) - * @requires jQuery v1.6 or later - * - * Examples at http://fancyapps.com/fancybox/ - * License: www.fancyapps.com/fancybox/#license - * - * Copyright 2012 Janis Skarnelis - janis@fancyapps.com - * - */ - -(function (window, document, $, undefined) { - "use strict"; - - var W = $(window), - D = $(document), - F = $.fancybox = function () { - F.open.apply( this, arguments ); - }, - didUpdate = null, - isTouch = document.createTouch !== undefined, - - isQuery = function(obj) { - return obj && obj.hasOwnProperty && obj instanceof $; - }, - isString = function(str) { - return str && $.type(str) === "string"; - }, - isPercentage = function(str) { - return isString(str) && str.indexOf('%') > 0; - }, - isScrollable = function(el) { - return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight))); - }, - getScalar = function(orig, dim) { - var value = parseInt(orig, 10) || 0; - - if (dim && isPercentage(orig)) { - value = F.getViewport()[ dim ] / 100 * value; - } - - return Math.ceil(value); - }, - getValue = function(value, dim) { - return getScalar(value, dim) + 'px'; - }; - - $.extend(F, { - // The current version of fancyBox - version: '2.1.1', - - defaults: { - padding : 15, - margin : 20, - - width : 800, - height : 600, - minWidth : 100, - minHeight : 100, - maxWidth : 9999, - maxHeight : 9999, - - autoSize : true, - autoHeight : false, - autoWidth : false, - - autoResize : !isTouch, - autoCenter : !isTouch, - fitToView : true, - aspectRatio : false, - topRatio : 0.5, - leftRatio : 0.5, - - scrolling : 'auto', // 'auto', 'yes' or 'no' - wrapCSS : '', - - arrows : true, - closeBtn : true, - closeClick : false, - nextClick : false, - mouseWheel : true, - autoPlay : false, - playSpeed : 3000, - preload : 3, - modal : false, - loop : true, - - ajax : { - dataType : 'html', - headers : { 'X-fancyBox': true } - }, - iframe : { - scrolling : 'auto', - preload : true - }, - swf : { - wmode: 'transparent', - allowfullscreen : 'true', - allowscriptaccess : 'always' - }, - - keys : { - next : { - 13 : 'left', // enter - 34 : 'up', // page down - 39 : 'left', // right arrow - 40 : 'up' // down arrow - }, - prev : { - 8 : 'right', // backspace - 33 : 'down', // page up - 37 : 'right', // left arrow - 38 : 'down' // up arrow - }, - close : [27], // escape key - play : [32], // space - start/stop slideshow - toggle : [70] // letter "f" - toggle fullscreen - }, - - direction : { - next : 'left', - prev : 'right' - }, - - scrollOutside : true, - - // Override some properties - index : 0, - type : null, - href : null, - content : null, - title : null, - - // HTML templates - tpl: { - wrap : '
', - image : '', - iframe : '', - error : '

The requested content cannot be loaded.
Please try again later.

', - closeBtn : '', - next : '', - prev : '' - }, - - // Properties for each animation type - // Opening fancyBox - openEffect : 'fade', // 'elastic', 'fade' or 'none' - openSpeed : 250, - openEasing : 'swing', - openOpacity : true, - openMethod : 'zoomIn', - - // Closing fancyBox - closeEffect : 'fade', // 'elastic', 'fade' or 'none' - closeSpeed : 250, - closeEasing : 'swing', - closeOpacity : true, - closeMethod : 'zoomOut', - - // Changing next gallery item - nextEffect : 'elastic', // 'elastic', 'fade' or 'none' - nextSpeed : 250, - nextEasing : 'swing', - nextMethod : 'changeIn', - - // Changing previous gallery item - prevEffect : 'elastic', // 'elastic', 'fade' or 'none' - prevSpeed : 250, - prevEasing : 'swing', - prevMethod : 'changeOut', - - // Enable default helpers - helpers : { - overlay : true, - title : true - }, - - // Callbacks - onCancel : $.noop, // If canceling - beforeLoad : $.noop, // Before loading - afterLoad : $.noop, // After loading - beforeShow : $.noop, // Before changing in current item - afterShow : $.noop, // After opening - beforeChange : $.noop, // Before changing gallery item - beforeClose : $.noop, // Before closing - afterClose : $.noop // After closing - }, - - //Current state - group : {}, // Selected group - opts : {}, // Group options - previous : null, // Previous element - coming : null, // Element being loaded - current : null, // Currently loaded element - isActive : false, // Is activated - isOpen : false, // Is currently open - isOpened : false, // Have been fully opened at least once - - wrap : null, - skin : null, - outer : null, - inner : null, - - player : { - timer : null, - isActive : false - }, - - // Loaders - ajaxLoad : null, - imgPreload : null, - - // Some collections - transitions : {}, - helpers : {}, - - /* - * Static methods - */ - - open: function (group, opts) { - if (!group) { - return; - } - - if (!$.isPlainObject(opts)) { - opts = {}; - } - - // Close if already active - if (false === F.close(true)) { - return; - } - - // Normalize group - if (!$.isArray(group)) { - group = isQuery(group) ? $(group).get() : [group]; - } - - // Recheck if the type of each element is `object` and set content type (image, ajax, etc) - $.each(group, function(i, element) { - var obj = {}, - href, - title, - content, - type, - rez, - hrefParts, - selector; - - if ($.type(element) === "object") { - // Check if is DOM element - if (element.nodeType) { - element = $(element); - } - - if (isQuery(element)) { - obj = { - href : element.data('fancybox-href') || element.attr('href'), - title : element.data('fancybox-title') || element.attr('title'), - isDom : true, - element : element - }; - - if ($.metadata) { - $.extend(true, obj, element.metadata()); - } - - } else { - obj = element; - } - } - - href = opts.href || obj.href || (isString(element) ? element : null); - title = opts.title !== undefined ? opts.title : obj.title || ''; - - content = opts.content || obj.content; - type = content ? 'html' : (opts.type || obj.type); - - if (!type && obj.isDom) { - type = element.data('fancybox-type'); - - if (!type) { - rez = element.prop('class').match(/fancybox\.(\w+)/); - type = rez ? rez[1] : null; - } - } - - if (isString(href)) { - // Try to guess the content type - if (!type) { - if (F.isImage(href)) { - type = 'image'; - - } else if (F.isSWF(href)) { - type = 'swf'; - - } else if (href.charAt(0) === '#') { - type = 'inline'; - - } else if (isString(element)) { - type = 'html'; - content = element; - } - } - - // Split url into two pieces with source url and content selector, e.g, - // "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id" - if (type === 'ajax') { - hrefParts = href.split(/\s+/, 2); - href = hrefParts.shift(); - selector = hrefParts.shift(); - } - } - - if (!content) { - if (type === 'inline') { - if (href) { - content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7 - - } else if (obj.isDom) { - content = element; - } - - } else if (type === 'html') { - content = href; - - } else if (!type && !href && obj.isDom) { - type = 'inline'; - content = element; - } - } - - $.extend(obj, { - href : href, - type : type, - content : content, - title : title, - selector : selector - }); - - group[ i ] = obj; - }); - - // Extend the defaults - F.opts = $.extend(true, {}, F.defaults, opts); - - // All options are merged recursive except keys - if (opts.keys !== undefined) { - F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false; - } - - F.group = group; - - return F._start(F.opts.index); - }, - - // Cancel image loading or abort ajax request - cancel: function () { - var coming = F.coming; - - if (!coming || false === F.trigger('onCancel')) { - return; - } - - F.hideLoading(); - - if (F.ajaxLoad) { - F.ajaxLoad.abort(); - } - - F.ajaxLoad = null; - - if (F.imgPreload) { - F.imgPreload.onload = F.imgPreload.onerror = null; - } - - // If the first item has been canceled, then clear everything - if (coming.wrap) { - coming.wrap.stop(true).trigger('onReset').remove(); - } - - if (!F.current) { - F.trigger('afterClose'); - } - - F.coming = null; - }, - - // Start closing animation if is open; remove immediately if opening/closing - close: function (immediately) { - F.cancel(); - - if (false === F.trigger('beforeClose')) { - return; - } - - F.unbindEvents(); - - if (!F.isOpen || immediately === true) { - $('.fancybox-wrap').stop(true).trigger('onReset').remove(); - - F._afterZoomOut(); - - } else { - F.isOpen = F.isOpened = false; - F.isClosing = true; - - $('.fancybox-item, .fancybox-nav').remove(); - - F.wrap.stop(true, true).removeClass('fancybox-opened'); - - if (F.wrap.css('position') === 'fixed') { - F.wrap.css(F._getPosition( true )); - } - - F.transitions[ F.current.closeMethod ](); - } - }, - - // Manage slideshow: - // $.fancybox.play(); - toggle slideshow - // $.fancybox.play( true ); - start - // $.fancybox.play( false ); - stop - play: function ( action ) { - var clear = function () { - clearTimeout(F.player.timer); - }, - set = function () { - clear(); - - if (F.current && F.player.isActive) { - F.player.timer = setTimeout(F.next, F.current.playSpeed); - } - }, - stop = function () { - clear(); - - $('body').unbind('.player'); - - F.player.isActive = false; - - F.trigger('onPlayEnd'); - }, - start = function () { - if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) { - F.player.isActive = true; - - $('body').bind({ - 'afterShow.player onUpdate.player' : set, - 'onCancel.player beforeClose.player' : stop, - 'beforeLoad.player' : clear - }); - - set(); - - F.trigger('onPlayStart'); - } - }; - - if (action === true || (!F.player.isActive && action !== false)) { - start(); - } else { - stop(); - } - }, - - // Navigate to next gallery item - next: function ( direction ) { - var current = F.current; - - if (current) { - if (!isString(direction)) { - direction = current.direction.next; - } - - F.jumpto(current.index + 1, direction, 'next'); - } - }, - - // Navigate to previous gallery item - prev: function ( direction ) { - var current = F.current; - - if (current) { - if (!isString(direction)) { - direction = current.direction.prev; - } - - F.jumpto(current.index - 1, direction, 'prev'); - } - }, - - // Navigate to gallery item by index - jumpto: function ( index, direction, router ) { - var current = F.current; - - if (!current) { - return; - } - - index = getScalar(index); - - F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ]; - F.router = router || 'jumpto'; - - if (current.loop) { - if (index < 0) { - index = current.group.length + (index % current.group.length); - } - - index = index % current.group.length; - } - - if (current.group[ index ] !== undefined) { - F.cancel(); - - F._start(index); - } - }, - - // Center inside viewport and toggle position type to fixed or absolute if needed - reposition: function (e, onlyAbsolute) { - var pos; - - if (F.isOpen) { - pos = F._getPosition(onlyAbsolute); - - if (e && e.type === 'scroll') { - delete pos.position; - - F.wrap.stop(true, true).animate(pos, 200); - - } else { - F.wrap.css(pos); - } - } - }, - - update: function (e) { - var type = (e && e.type), - anyway = !type || type === 'orientationchange'; - - if (anyway) { - clearTimeout(didUpdate); - - didUpdate = null; - } - - if (!F.isOpen || didUpdate) { - return; - } - - // Help browser to restore document dimensions - if (anyway || isTouch) { - F.wrap.removeAttr('style').addClass('fancybox-tmp'); - - F.trigger('onUpdate'); - } - - didUpdate = setTimeout(function() { - var current = F.current; - - if (!current) { - return; - } - - F.wrap.removeClass('fancybox-tmp'); - - if (type !== 'scroll') { - F._setDimension(); - } - - if (!(type === 'scroll' && current.canShrink)) { - F.reposition(e); - } - - F.trigger('onUpdate'); - - didUpdate = null; - - }, (isTouch ? 500 : (anyway ? 20 : 300))); - }, - - // Shrink content to fit inside viewport or restore if resized - toggle: function ( action ) { - if (F.isOpen) { - F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView; - - F.update(); - } - }, - - hideLoading: function () { - D.unbind('keypress.fb'); - - $('#fancybox-loading').remove(); - }, - - showLoading: function () { - var el, viewport; - - F.hideLoading(); - - // If user will press the escape-button, the request will be canceled - D.bind('keypress.fb', function(e) { - if ((e.which || e.keyCode) === 27) { - e.preventDefault(); - F.cancel(); - } - }); - - el = $('
').click(F.cancel).appendTo('body'); - - if (!F.defaults.fixed) { - viewport = F.getViewport(); - - el.css({ - position : 'absolute', - top : (viewport.h * 0.5) + viewport.y, - left : (viewport.w * 0.5) + viewport.x - }); - } - }, - - getViewport: function () { - var locked = (F.current && F.current.locked) || false, - rez = { - x: W.scrollLeft(), - y: W.scrollTop() - }; - - if (locked) { - rez.w = locked[0].clientWidth; - rez.h = locked[0].clientHeight; - - } else { - // See http://bugs.jquery.com/ticket/6724 - rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width(); - rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height(); - } - - return rez; - }, - - // Unbind the keyboard / clicking actions - unbindEvents: function () { - if (F.wrap && isQuery(F.wrap)) { - F.wrap.unbind('.fb'); - } - - D.unbind('.fb'); - W.unbind('.fb'); - }, - - bindEvents: function () { - var current = F.current, - keys; - - if (!current) { - return; - } - - // Changing document height on iOS devices triggers a 'resize' event, - // that can change document height... repeating infinitely - W.bind('orientationchange.fb' + (current.autoResize ? ' resize.fb' : '' ) + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update); - - keys = current.keys; - - if (keys) { - D.bind('keydown.fb', function (e) { - var code = e.which || e.keyCode, - target = e.target || e.srcElement; - - // Ignore key combinations and key events within form elements - if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) { - $.each(keys, function(i, val) { - if (current.group.length > 1 && val[ code ] !== undefined) { - F[ i ]( val[ code ] ); - - e.preventDefault(); - return false; - } - - if ($.inArray(code, val) > -1) { - F[ i ] (); - - e.preventDefault(); - return false; - } - }); - } - }); - } - - if ($.fn.mousewheel && current.mouseWheel) { - F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) { - var target = e.target || null, - parent = $(target), - canScroll = false; - - while (parent.length) { - if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) { - break; - } - - canScroll = isScrollable( parent[0] ); - parent = $(parent).parent(); - } - - if (delta !== 0 && !canScroll) { - if (F.group.length > 1 && !current.canShrink) { - if (deltaY > 0 || deltaX > 0) { - F.prev( deltaY > 0 ? 'down' : 'left' ); - - } else if (deltaY < 0 || deltaX < 0) { - F.next( deltaY < 0 ? 'up' : 'right' ); - } - - e.preventDefault(); - } - } - }); - } - }, - - trigger: function (event, o) { - var ret, obj = o || F.coming || F.current; - - if (!obj) { - return; - } - - if ($.isFunction( obj[event] )) { - ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1)); - } - - if (ret === false) { - return false; - } - - if (event === 'onCancel' && !F.isOpened) { - F.isActive = false; - } - - if (obj.helpers) { - $.each(obj.helpers, function (helper, opts) { - if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) { - opts = $.extend(true, {}, F.helpers[helper].defaults, opts); - - F.helpers[helper][event](opts, obj); - } - }); - } - - $.event.trigger(event + '.fb'); - }, - - isImage: function (str) { - return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i); - }, - - isSWF: function (str) { - return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i); - }, - - _start: function (index) { - var coming = {}, - obj, - href, - type, - margin, - padding; - - index = getScalar( index ); - obj = F.group[ index ] || null; - - if (!obj) { - return false; - } - - coming = $.extend(true, {}, F.opts, obj); - - // Convert margin and padding properties to array - top, right, bottom, left - margin = coming.margin; - padding = coming.padding; - - if ($.type(margin) === 'number') { - coming.margin = [margin, margin, margin, margin]; - } - - if ($.type(padding) === 'number') { - coming.padding = [padding, padding, padding, padding]; - } - - // 'modal' propery is just a shortcut - if (coming.modal) { - $.extend(true, coming, { - closeBtn : false, - closeClick : false, - nextClick : false, - arrows : false, - mouseWheel : false, - keys : null, - helpers: { - overlay : { - closeClick : false - } - } - }); - } - - // 'autoSize' property is a shortcut, too - if (coming.autoSize) { - coming.autoWidth = coming.autoHeight = true; - } - - if (coming.width === 'auto') { - coming.autoWidth = true; - } - - if (coming.height === 'auto') { - coming.autoHeight = true; - } - - /* - * Add reference to the group, so it`s possible to access from callbacks, example: - * afterLoad : function() { - * this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); - * } - */ - - coming.group = F.group; - coming.index = index; - - // Give a chance for callback or helpers to update coming item (type, title, etc) - F.coming = coming; - - if (false === F.trigger('beforeLoad')) { - F.coming = null; - - return; - } - - type = coming.type; - href = coming.href; - - if (!type) { - F.coming = null; - - //If we can not determine content type then drop silently or display next/prev item if looping through gallery - if (F.current && F.router && F.router !== 'jumpto') { - F.current.index = index; - - return F[ F.router ]( F.direction ); - } - - return false; - } - - F.isActive = true; - - if (type === 'image' || type === 'swf') { - coming.autoHeight = coming.autoWidth = false; - coming.scrolling = 'visible'; - } - - if (type === 'image') { - coming.aspectRatio = true; - } - - if (type === 'iframe' && isTouch) { - coming.scrolling = 'scroll'; - } - - // Build the neccessary markup - coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' ); - - $.extend(coming, { - skin : $('.fancybox-skin', coming.wrap), - outer : $('.fancybox-outer', coming.wrap), - inner : $('.fancybox-inner', coming.wrap) - }); - - $.each(["Top", "Right", "Bottom", "Left"], function(i, v) { - coming.skin.css('padding' + v, getValue(coming.padding[ i ])); - }); - - F.trigger('onReady'); - - // Check before try to load; 'inline' and 'html' types need content, others - href - if (type === 'inline' || type === 'html') { - if (!coming.content || !coming.content.length) { - return F._error( 'content' ); - } - - } else if (!href) { - return F._error( 'href' ); - } - - if (type === 'image') { - F._loadImage(); - - } else if (type === 'ajax') { - F._loadAjax(); - - } else if (type === 'iframe') { - F._loadIframe(); - - } else { - F._afterLoad(); - } - }, - - _error: function ( type ) { - $.extend(F.coming, { - type : 'html', - autoWidth : true, - autoHeight : true, - minWidth : 0, - minHeight : 0, - scrolling : 'no', - hasError : type, - content : F.coming.tpl.error - }); - - F._afterLoad(); - }, - - _loadImage: function () { - // Reset preload image so it is later possible to check "complete" property - var img = F.imgPreload = new Image(); - - img.onload = function () { - this.onload = this.onerror = null; - - F.coming.width = this.width; - F.coming.height = this.height; - - F._afterLoad(); - }; - - img.onerror = function () { - this.onload = this.onerror = null; - - F._error( 'image' ); - }; - - img.src = F.coming.href; - - if (img.complete === undefined || !img.complete) { - F.showLoading(); - } - }, - - _loadAjax: function () { - var coming = F.coming; - - F.showLoading(); - - F.ajaxLoad = $.ajax($.extend({}, coming.ajax, { - url: coming.href, - error: function (jqXHR, textStatus) { - if (F.coming && textStatus !== 'abort') { - F._error( 'ajax', jqXHR ); - - } else { - F.hideLoading(); - } - }, - success: function (data, textStatus) { - if (textStatus === 'success') { - coming.content = data; - - F._afterLoad(); - } - } - })); - }, - - _loadIframe: function() { - var coming = F.coming, - iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime())) - .attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling) - .attr('src', coming.href); - - // This helps IE - $(coming.wrap).bind('onReset', function () { - try { - $(this).find('iframe').hide().attr('src', '//about:blank').end().empty(); - } catch (e) {} - }); - - if (coming.iframe.preload) { - F.showLoading(); - - iframe.one('load', function() { - $(this).data('ready', 1); - - // iOS will lose scrolling if we resize - if (!isTouch) { - $(this).bind('load.fb', F.update); - } - - // Without this trick: - // - iframe won't scroll on iOS devices - // - IE7 sometimes displays empty iframe - $(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show(); - - F._afterLoad(); - }); - } - - coming.content = iframe.appendTo( coming.inner ); - - if (!coming.iframe.preload) { - F._afterLoad(); - } - }, - - _preloadImages: function() { - var group = F.group, - current = F.current, - len = group.length, - cnt = current.preload ? Math.min(current.preload, len - 1) : 0, - item, - i; - - for (i = 1; i <= cnt; i += 1) { - item = group[ (current.index + i ) % len ]; - - if (item.type === 'image' && item.href) { - new Image().src = item.href; - } - } - }, - - _afterLoad: function () { - var coming = F.coming, - previous = F.current, - placeholder = 'fancybox-placeholder', - current, - content, - type, - scrolling, - href, - embed; - - F.hideLoading(); - - if (!coming || F.isActive === false) { - return; - } - - if (false === F.trigger('afterLoad', coming, previous)) { - coming.wrap.stop(true).trigger('onReset').remove(); - - F.coming = null; - - return; - } - - if (previous) { - F.trigger('beforeChange', previous); - - previous.wrap.stop(true).removeClass('fancybox-opened') - .find('.fancybox-item, .fancybox-nav') - .remove(); - - if (previous.wrap.css('position') === 'fixed') { - previous.wrap.css(F._getPosition( true )); - } - } - - F.unbindEvents(); - - current = coming; - content = coming.content; - type = coming.type; - scrolling = coming.scrolling; - - $.extend(F, { - wrap : current.wrap, - skin : current.skin, - outer : current.outer, - inner : current.inner, - current : current, - previous : previous - }); - - href = current.href; - - switch (type) { - case 'inline': - case 'ajax': - case 'html': - if (current.selector) { - content = $('
').html(content).find(current.selector); - - } else if (isQuery(content)) { - if (!content.data(placeholder)) { - content.data(placeholder, $('
').insertAfter( content ).hide() ); - } - - content = content.show().detach(); - - current.wrap.bind('onReset', function () { - if ($(this).find(content).length) { - content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false); - } - }); - } - break; - - case 'image': - content = current.tpl.image.replace('{href}', href); - break; - - case 'swf': - content = ''; - embed = ''; - - $.each(current.swf, function(name, val) { - content += ''; - embed += ' ' + name + '="' + val + '"'; - }); - - content += ''; - break; - } - - if (!(isQuery(content) && content.parent().is(current.inner))) { - current.inner.append( content ); - } - - // Give a chance for helpers or callbacks to update elements - F.trigger('beforeShow'); - - // Set scrolling before calculating dimensions - current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling)); - - // Set initial dimensions and start position - F._setDimension(); - - current.wrap.removeClass('fancybox-tmp'); - - current.pos = $.extend({}, current.dim, F._getPosition( true )); - - F.isOpen = false; - F.coming = null; - - F.bindEvents(); - - if (!F.isOpened) { - $('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove(); - - } else if (previous.prevMethod) { - F.transitions[ previous.prevMethod ](); - } - - F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ](); - - F._preloadImages(); - }, - - _setDimension: function () { - var viewport = F.getViewport(), - steps = 0, - canShrink = false, - canExpand = false, - wrap = F.wrap, - skin = F.skin, - inner = F.inner, - current = F.current, - width = current.width, - height = current.height, - minWidth = current.minWidth, - minHeight = current.minHeight, - maxWidth = current.maxWidth, - maxHeight = current.maxHeight, - scrolling = current.scrolling, - scrollOut = current.scrollOutside ? current.scrollbarWidth : 0, - margin = current.margin, - wMargin = margin[1] + margin[3], - hMargin = margin[0] + margin[2], - wPadding, - hPadding, - wSpace, - hSpace, - origWidth, - origHeight, - origMaxWidth, - origMaxHeight, - ratio, - width_, - height_, - maxWidth_, - maxHeight_, - iframe, - body; - - // Reset dimensions so we could re-check actual size - wrap.add(skin).add(inner).width('auto').height('auto'); - - wPadding = skin.outerWidth(true) - skin.width(); - hPadding = skin.outerHeight(true) - skin.height(); - - // Any space between content and viewport (margin, padding, border, title) - wSpace = wMargin + wPadding; - hSpace = hMargin + hPadding; - - origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width; - origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height; - - if (current.type === 'iframe') { - iframe = current.content; - - if (current.autoHeight && iframe.data('ready') === 1) { - try { - if (iframe[0].contentWindow.document.location) { - inner.width( origWidth ).height(9999); - - body = iframe.contents().find('body'); - - if (scrollOut) { - body.css('overflow-x', 'hidden'); - } - - origHeight = body.height(); - } - - } catch (e) {} - } - - } else if (current.autoWidth || current.autoHeight) { - inner.addClass( 'fancybox-tmp' ); - - // Set width or height in case we need to calculate only one dimension - if (!current.autoWidth) { - inner.width( origWidth ); - } - - if (!current.autoHeight) { - inner.height( origHeight ); - } - - if (current.autoWidth) { - origWidth = inner.width(); - } - - if (current.autoHeight) { - origHeight = inner.height(); - } - - inner.removeClass( 'fancybox-tmp' ); - } - - width = getScalar( origWidth ); - height = getScalar( origHeight ); - - ratio = origWidth / origHeight; - - // Calculations for the content - minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth); - maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth); - - minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight); - maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight); - - // These will be used to determine if wrap can fit in the viewport - origMaxWidth = maxWidth; - origMaxHeight = maxHeight; - - maxWidth_ = viewport.w - wMargin; - maxHeight_ = viewport.h - hMargin; - - if (current.aspectRatio) { - if (width > maxWidth) { - width = maxWidth; - height = width / ratio; - } - - if (height > maxHeight) { - height = maxHeight; - width = height * ratio; - } - - if (width < minWidth) { - width = minWidth; - height = width / ratio; - } - - if (height < minHeight) { - height = minHeight; - width = height * ratio; - } - - } else { - width = Math.max(minWidth, Math.min(width, maxWidth)); - height = Math.max(minHeight, Math.min(height, maxHeight)); - } - - // Try to fit inside viewport (including the title) - if (current.fitToView) { - maxWidth = Math.min(viewport.w - wSpace, maxWidth); - maxHeight = Math.min(viewport.h - hSpace, maxHeight); - - inner.width( getScalar( width ) ).height( getScalar( height ) ); - - wrap.width( getScalar( width + wPadding ) ); - - // Real wrap dimensions - width_ = wrap.width(); - height_ = wrap.height(); - - if (current.aspectRatio) { - while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) { - if (steps++ > 19) { - break; - } - - height = Math.max(minHeight, Math.min(maxHeight, height - 10)); - width = height * ratio; - - if (width < minWidth) { - width = minWidth; - height = width / ratio; - } - - if (width > maxWidth) { - width = maxWidth; - height = width / ratio; - } - - inner.width( getScalar( width ) ).height( getScalar( height ) ); - - wrap.width( getScalar( width + wPadding ) ); - - width_ = wrap.width(); - height_ = wrap.height(); - } - - } else { - width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_))); - height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_))); - } - } - - if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) { - width += scrollOut; - } - - inner.width( getScalar( width ) ).height( getScalar( height ) ); - - wrap.width( getScalar( width + wPadding ) ); - - width_ = wrap.width(); - height_ = wrap.height(); - - canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight; - canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight)); - - $.extend(current, { - dim : { - width : getValue( width_ ), - height : getValue( height_ ) - }, - origWidth : origWidth, - origHeight : origHeight, - canShrink : canShrink, - canExpand : canExpand, - wPadding : wPadding, - hPadding : hPadding, - wrapSpace : height_ - skin.outerHeight(true), - skinSpace : skin.height() - height - }); - - if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) { - inner.height('auto'); - } - }, - - _getPosition: function (onlyAbsolute) { - var current = F.current, - viewport = F.getViewport(), - margin = current.margin, - width = F.wrap.width() + margin[1] + margin[3], - height = F.wrap.height() + margin[0] + margin[2], - rez = { - position: 'absolute', - top : margin[0], - left : margin[3] - }; - - if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) { - rez.position = 'fixed'; - - } else if (!current.locked) { - rez.top += viewport.y; - rez.left += viewport.x; - } - - rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio))); - rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio))); - - return rez; - }, - - _afterZoomIn: function () { - var current = F.current; - - if (!current) { - return; - } - - F.isOpen = F.isOpened = true; - - F.wrap.addClass('fancybox-opened').css('overflow', 'visible'); - - F.reposition(); - - // Assign a click event - if (current.closeClick || current.nextClick) { - F.inner.css('cursor', 'pointer').bind('click.fb', function(e) { - if (!$(e.target).is('a') && !$(e.target).parent().is('a')) { - F[ current.closeClick ? 'close' : 'next' ](); - } - }); - } - - // Create a close button - if (current.closeBtn) { - $(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', F.close); - } - - // Create navigation arrows - if (current.arrows && F.group.length > 1) { - if (current.loop || current.index > 0) { - $(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev); - } - - if (current.loop || current.index < F.group.length - 1) { - $(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next); - } - } - - F.trigger('afterShow'); - - // Stop the slideshow if this is the last item - if (!current.loop && current.index === current.group.length - 1) { - F.play( false ); - - } else if (F.opts.autoPlay && !F.player.isActive) { - F.opts.autoPlay = false; - - F.play(); - } - }, - - _afterZoomOut: function () { - var current = F.current; - - $('.fancybox-wrap').stop(true).trigger('onReset').remove(); - - $.extend(F, { - group : {}, - opts : {}, - router : false, - current : null, - isActive : false, - isOpened : false, - isOpen : false, - isClosing : false, - wrap : null, - skin : null, - outer : null, - inner : null - }); - - F.trigger('afterClose', current); - } - }); - - /* - * Default transitions - */ - - F.transitions = { - getOrigPosition: function () { - var current = F.current, - element = current.element, - orig = current.orig, - pos = {}, - width = 50, - height = 50, - hPadding = current.hPadding, - wPadding = current.wPadding, - viewport = F.getViewport(); - - if (!orig && current.isDom && element.is(':visible')) { - orig = element.find('img:first'); - - if (!orig.length) { - orig = element; - } - } - - if (isQuery(orig)) { - pos = orig.offset(); - - if (orig.is('img')) { - width = orig.outerWidth(); - height = orig.outerHeight(); - } - - } else { - pos.top = viewport.y + (viewport.h - height) * current.topRatio; - pos.left = viewport.x + (viewport.w - width) * current.leftRatio; - } - - if (current.locked) { - pos.top -= viewport.y; - pos.left -= viewport.x; - } - - pos = { - top : getValue(pos.top - hPadding * current.topRatio), - left : getValue(pos.left - wPadding * current.leftRatio), - width : getValue(width + wPadding), - height : getValue(height + hPadding) - }; - - return pos; - }, - - step: function (now, fx) { - var ratio, - padding, - value, - prop = fx.prop, - current = F.current, - wrapSpace = current.wrapSpace, - skinSpace = current.skinSpace; - - if (prop === 'width' || prop === 'height') { - ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start); - - if (F.isClosing) { - ratio = 1 - ratio; - } - - padding = prop === 'width' ? current.wPadding : current.hPadding; - value = now - padding; - - F.skin[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) ) ); - F.inner[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) ); - } - }, - - zoomIn: function () { - var current = F.current, - startPos = current.pos, - effect = current.openEffect, - elastic = effect === 'elastic', - endPos = $.extend({opacity : 1}, startPos); - - // Remove "position" property that breaks older IE - delete endPos.position; - - if (elastic) { - startPos = this.getOrigPosition(); - - if (current.openOpacity) { - startPos.opacity = 0.1; - } - - } else if (effect === 'fade') { - startPos.opacity = 0.1; - } - - F.wrap.css(startPos).animate(endPos, { - duration : effect === 'none' ? 0 : current.openSpeed, - easing : current.openEasing, - step : elastic ? this.step : null, - complete : F._afterZoomIn - }); - }, - - zoomOut: function () { - var current = F.current, - effect = current.closeEffect, - elastic = effect === 'elastic', - endPos = {opacity : 0.1}; - - if (elastic) { - endPos = this.getOrigPosition(); - - if (current.closeOpacity) { - endPos.opacity = 0.1; - } - } - - F.wrap.animate(endPos, { - duration : effect === 'none' ? 0 : current.closeSpeed, - easing : current.closeEasing, - step : elastic ? this.step : null, - complete : F._afterZoomOut - }); - }, - - changeIn: function () { - var current = F.current, - effect = current.nextEffect, - startPos = current.pos, - endPos = { opacity : 1 }, - direction = F.direction, - distance = 200, - field; - - startPos.opacity = 0.1; - - if (effect === 'elastic') { - field = direction === 'down' || direction === 'up' ? 'top' : 'left'; - - if (direction === 'down' || direction === 'right') { - startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance); - endPos[ field ] = '+=' + distance + 'px'; - - } else { - startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance); - endPos[ field ] = '-=' + distance + 'px'; - } - } - - // Workaround for http://bugs.jquery.com/ticket/12273 - if (effect === 'none') { - F._afterZoomIn(); - - } else { - F.wrap.css(startPos).animate(endPos, { - duration : current.nextSpeed, - easing : current.nextEasing, - complete : F._afterZoomIn - }); - } - }, - - changeOut: function () { - var previous = F.previous, - effect = previous.prevEffect, - endPos = { opacity : 0.1 }, - direction = F.direction, - distance = 200; - - if (effect === 'elastic') { - endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px'; - } - - previous.wrap.animate(endPos, { - duration : effect === 'none' ? 0 : previous.prevSpeed, - easing : previous.prevEasing, - complete : function () { - $(this).trigger('onReset').remove(); - } - }); - } - }; - - /* - * Overlay helper - */ - - F.helpers.overlay = { - defaults : { - closeClick : true, // close if clicking on the overlay - speedOut : 200, // animation speed of fading out - showEarly : true, // should be opened immediately or wait until the content is ready - css : {}, // custom overlay style - locked : true // should be content locked into overlay - }, - - overlay : null, - - update : function () { - var width = '100%', offsetWidth; - - // Reset width/height so it will not mess - this.overlay.width(width).height('100%'); - - // jQuery does not return reliable result for IE - if ($.browser.msie) { - offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth); - - if (D.width() > offsetWidth) { - width = D.width(); - } - - } else if (D.width() > W.width()) { - width = D.width(); - } - - this.overlay.width(width).height(D.height()); - }, - - // This is where we can manipulate DOM, because later it would cause iframes to reload - onReady : function (opts, obj) { - $('.fancybox-overlay').stop(true, true); - - if (!this.overlay) { - $.extend(this, { - overlay : $('
').appendTo( obj.parent || 'body' ), - margin : D.height() > W.height() || $('body').css('overflow-y') === 'scroll' ? $('body').css('margin-right') : false, - el : document.all && !document.querySelector ? $('html') : $('body') - }); - } - - if (obj.fixed && !isTouch) { - this.overlay.addClass('fancybox-overlay-fixed'); - - if (obj.autoCenter && opts.locked) { - obj.locked = this.overlay.append( obj.wrap ); - } - } - - if (opts.showEarly === true) { - this.beforeShow.apply(this, arguments); - } - }, - - beforeShow : function(opts, obj) { - var overlay = this.overlay.unbind('.fb').width('auto').height('auto').css( opts.css ); - - if (opts.closeClick) { - overlay.bind('click.fb', function(e) { - if ($(e.target).hasClass('fancybox-overlay')) { - F.close(); - } - }); - } - - if (obj.fixed && !isTouch) { - if (obj.locked) { - this.el.addClass('fancybox-lock'); - - if (this.margin !== false) { - $('body').css('margin-right', getScalar( this.margin ) + obj.scrollbarWidth); - } - } - - } else { - this.update(); - } - - overlay.show(); - }, - - onUpdate : function(opts, obj) { - if (!obj.fixed || isTouch) { - this.update(); - } - }, - - afterClose: function (opts) { - var that = this, - speed = opts.speedOut || 0; - - // Remove overlay if exists and fancyBox is not opening - // (e.g., it is not being open using afterClose callback) - if (that.overlay && !F.isActive) { - that.overlay.fadeOut(speed || 0, function () { - $('body').css('margin-right', that.margin); - - that.el.removeClass('fancybox-lock'); - - that.overlay.remove(); - - that.overlay = null; - }); - } - } - }; - - /* - * Title helper - */ - - F.helpers.title = { - defaults : { - type : 'float', // 'float', 'inside', 'outside' or 'over', - position : 'bottom' // 'top' or 'bottom' - }, - - beforeShow: function (opts) { - var current = F.current, - text = current.title, - type = opts.type, - title, - target; - - if ($.isFunction(text)) { - text = text.call(current.element, current); - } - - if (!isString(text) || $.trim(text) === '') { - return; - } - - title = $('
' + text + '
'); - - switch (type) { - case 'inside': - target = F.skin; - break; - - case 'outside': - target = F.wrap; - break; - - case 'over': - target = F.inner; - break; - - default: // 'float' - target = F.skin; - - title.appendTo('body'); - - if ($.browser.msie) { - title.width( title.width() ); - } - - title.wrapInner(''); - - //Increase bottom margin so this title will also fit into viewport - F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) ); - break; - } - - title[ (opts.position === 'top' ? 'prependTo' : 'appendTo') ](target); - } - }; - - // jQuery plugin initialization - $.fn.fancybox = function (options) { - var index, - that = $(this), - selector = this.selector || '', - run = function(e) { - var what = $(this).blur(), idx = index, relType, relVal; - - if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) { - relType = options.groupAttr || 'data-fancybox-group'; - relVal = what.attr(relType); - - if (!relVal) { - relType = 'rel'; - relVal = what.get(0)[ relType ]; - } - - if (relVal && relVal !== '' && relVal !== 'nofollow') { - what = selector.length ? $(selector) : that; - what = what.filter('[' + relType + '="' + relVal + '"]'); - idx = what.index(this); - } - - options.index = idx; - - // Stop an event from bubbling if everything is fine - if (F.open(what, options) !== false) { - e.preventDefault(); - } - } - }; - - options = options || {}; - index = options.index || 0; - - if (!selector || options.live === false) { - that.unbind('click.fb-start').bind('click.fb-start', run); - } else { - D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run); - } - - return this; - }; - - // Tests that need a body at doc ready - D.ready(function() { - if ( $.scrollbarWidth === undefined ) { - // http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth - $.scrollbarWidth = function() { - var parent = $('
').appendTo('body'), - child = parent.children(), - width = child.innerWidth() - child.height( 99 ).innerWidth(); - - parent.remove(); - - return width; - }; - } - - if ( $.support.fixedPosition === undefined ) { - $.support.fixedPosition = (function() { - var elem = $('
').appendTo('body'), - fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 ); - - elem.remove(); - - return fixed; - }()); - } - - $.extend(F.defaults, { - scrollbarWidth : $.scrollbarWidth(), - fixed : $.support.fixedPosition, - parent : $('body') - }); - }); - -}(window, document, jQuery)); \ No newline at end of file diff --git a/NzbDrone.Web/Content2/New folder/jquery.lhpMegaImgViewer.1.1.js b/NzbDrone.Web/Content2/New folder/jquery.lhpMegaImgViewer.1.1.js deleted file mode 100644 index eef56f77d..000000000 --- a/NzbDrone.Web/Content2/New folder/jquery.lhpMegaImgViewer.1.1.js +++ /dev/null @@ -1,1088 +0,0 @@ -// Mega Image Viewer v1.1 - jQuery image viewer plugin - converting
element to an animated image viewer -// (c) 2012 lhp - http://codecanyon.net/user/lhp - -/* - * ---------------------------------------------------------------------------- - * settings: - * viewportWidth string (default: '100%'; accepted: string; Defines width of the area in which image will be displayed inside the outer div (myDiv). Size can be given in pixels, ems, percentages.) - * viewportHeight string (default: '100%'; accepted: string; Defines height of the area in which image will be displayed inside the outer div (myDiv). Size can be given in pixels, ems, percentages.) - * startScale number (default: 1; accepted: 0...1; Defines start scale.) - * startX number (default: 0; accepted: integer; Defines start coordinate x in px, in the display object frame of reference, which will be moved to the center of the viewport, if it is possible.) - * startY number (defaabout:startpageult: 0; accepted: integer; Defines start coordinate y in px, in the display object frame of reference, which will be moved to the center of the viewport, if it is possible.) - * animTime number (default: 500; accepted: integer; Defines duration in ms of the scale and position animations.) - * draggInertia number (default: 10; accepted: integer; Defines inertia after dragging.) - * contentUrl string (default: ''; accepted: string; Defines a path for an image source. This param is optional. Instead you can use the HTML image tag (see DOC -> STEP 2B - ACTIVATE THE PLUGIN (IMAGE SOURCE FROM HTML)).) - * intNavEnable boolean (default: true; accepted: true, false; Defines the navigation bar enabled/disabled. ) - * intNavPos string (default: 'T'; accepted: 'TL', 'T', 'TR', 'L', 'R', 'BL', 'B', 'BR', false; Defines the navigation bar position. ) - * intNavAutoHide boolean (default: false; accepted: true, false; Defines the navigation bar autohide. ) - * fitToViewportShortSide boolean (default: false; accepted: true, false; Shorter side of the displayed object will fit the viewport. ) - * contentSizeOver100 boolean (default: false; accepted: true, false; If the viewport size (width and height) is greater than the size of the displayed object, allow the object scaled over 100% to fit the viewport (zoom is disabled). ) - * ---------------------------------------------------------------------------- - */ - -(function ($) { - - var pubMet, constSett, defaultSett;about:startpage - - constSett = { - 'dragSmooth' : 8 - }; - - defaultSett = { - 'viewportWidth' : '100%', - 'viewportHeight' : '100%', - 'startScale' : 1, - 'startX' : 0, - 'startY' : 0, - 'animTime' : 500, - 'draggInertia' : 10, - 'contentUrl' : '', - 'intNavEnable' : true, - 'intNavPos' : 'T', - 'intNavAutoHide' : false, - 'fitToViewportShortSide' : false, - 'contentSizeOver100' : false - }; - - pubMet = { - init : function (options) { - - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'), interImgs = $t.find('img'), sett = {}; - $.extend(sett, defaultSett, options); - $.extend(sett, constSett); - - if (!data) { - - if(sett.draggInertia < 0) { - sett.draggInertia = 0; - } - - sett.animTime = parseInt(sabout:startpageett.animTime); - if(sett.animTime < 0) { - sett.animTime = 0; - } - - /*img tag*/ - if(interImgs.length > 0) { - sett.contentUrl = interImgs[0].src; - interImgs.remove(); - } - - $t.data('lhpMIV', {}); - $t.data('lhpMIV').interImgsTmp = interImgs; - $t.data('lhpMIV').lc = new LocationChanger(sett, $t); - } - }); - }, - /* - * Sets the position and size of the displayed object. The second parameter is optional - if empty, the size remains unchanged. - * @param {integer} x Coordinate x in px, in the display object frame of reference, which will be moved to the center of the viewport (if it is possible). - * @param {integer} y Coordinate y in px, in the display object frame of reference, which will be moved to the center of the viewport (if it is possible). - * @param {number} scale The size to which the display object will be scaled (if it is possible); optional. - * @return {Object} Returns jQuery object. - */ - setPosition : function (x, y, scale) { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.setProperties(x, y, scale); - } - }); - }, - /*about:startpage - * Initializes the movement of the display object to the top, to the boundary of the viewport or untill the moveStop method is called. - * @return {Object} Returns jQuery object. - */ - moveUp : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.beginDirectMove('U'); - } - }); - }, - /* - * Initializes the movement of the display object to the bottom, to the boundary of the viewport or untill the moveStop method is called. - * @return {Object} Returns jQuery object. - */ - moveDown : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.beginDirectMove('D'); - } - }); - }, - /* - * Initializes the movement of the display object to the left, to the boundary of the viewport or untill the moveStop method is called. - * @return {Object} Returns jQuery object. - */ - moveLeft : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.beginDirectMove('L'); - } - }); - }, - /* - * Initializes the movement of the display object to the right, to the boundary of the viewport or untill the moveStop method is called. - * @return {Object} Returns jQuery object.about:startpage - */ - moveRight : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.beginDirectMove('R'); - } - }); - }, - /* - * Stops the movement of the display object. - * @return {Object} Returns jQuery object. - */ - moveStop : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.stopDirectMoving(); - } - }); - }, - /* - * Initializes the zooming of the display object up to 100% or untill the zoomStop method is called. - * @return {Object} Returns jQuery object. - */ - zoom : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.beginZooming('Z'); - } - }); - }, - /* - * Initializes the unzooming of the display object up to the viewport's size or untill the zoomStop method is called.about:startpage - * @return {Object} Returns jQuery object. - */ - unzoom : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.beginZooming('U'); - } - }); - }, - /* - * Stops the zooming/unzooming of the display object. - * @return {Object} Returns jQuery object. - */ - zoomStop : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.stopZooming(); - } - }); - }, - /* - * Fits the display obejct's size to the viewport size and moves the object to the center of the viewport. - * @return {Object} Returns jQuery object. - */ - fitToViewport : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.setProperties(null, null, 0.0001); - } - }); - }, - /* - * Sets the initial size of the display object anabout:startpaged moves the object to the center of the viewport. - * @return {Object} Returns jQuery object. - */ - fullSize : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.setProperties(null, null, 1); - } - }); - }, - /* - * Control the correct position and size of the object displayed inside the viewport. - * @return {Object} Returns jQuery object. - */ - adaptsToContainer : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.adaptsToContainer(); - } - }); - }, - /* - * Destructor. Removes the viewer from the page. Restores the original appearance and functionality of the outer
element. Allows to efficiently clean the memory. - * @return {Object} Returns jQuery object. - */ - destroy : function () { - return this.each(function () { - var $t = $(this), data = $t.data('lhpMIV'); - if (data) { - $t.data('lhpMIV').lc.destroy(); - $t.prepend($t.data('lhpMIV').interImgsTmp); - $t.removeData('lhpMIV'); - } - });about:startpage - } - }; - - $.fn.lhpMegaImgViewer = function (method) { - if (pubMet[method]) { - return pubMet[method].apply(this, Array.prototype.slice.call(arguments, 1)); - } else if (typeof method === 'object' || !method) { - return pubMet.init.apply(this, arguments); - } else { - $.error('Method ' + method + ' does not exist on jQuery.lhpMegaImgViewer'); - } - }; - - /*location changer*/ - var LocationChanger = function (sett, $mainHolder) { - this.isTouchDev = (typeof(window.ontouchstart) != 'undefined') ? true : false; - this.sett = sett; - this.$mainHolder = $mainHolder; - this.lastMousePageCoor = this.lastDrag = this.contentFullSize = {}; - this.$mivHol = this.$contentHol = this.$content = null; - this.$preloadHol = this.$blackScreen = this.$navHol = null; - this.movingIntreval = this.movingDirectIntreval = this.navAutohideInterval = null; - this.speedX = this.speedY = null; - this.targetX = this.targetY = null; - this.allow = {allowDown : null, allowUp : null, allowLeft : null, allowRight : null, allowZoom : null, allowUnzoom : null}; - this.sm = new ScaleManager(); - - this.createHolders(); - - /*load content*/ - this.contentLoader = new LoaderImgContent(this.sett.contentUrl, this.$contentHol, function(that) { - return function($content) { - that.imgContentStart($content); - }about:startpage - }(this)); - /**/ - }; - //initialization - LocationChanger.prototype.createHolders = function () { - this.$mivHol = $('
') - .addClass('lhp_miv_holder') - .css({position : 'relative', overflow : 'hidden', width : this.sett.viewportWidth, height : this.sett.viewportHeight}); - - this.$preloadHol = $('
') - .addClass('lhp_miv_preload_holder'); - - this.$contentHol = $('
') - .addClass('lhp_miv_content_holder') - .css({position : 'absolute'}); - - this.$blackScreen = $('
') - .addClass('lhp_miv_blackScreen') - .css({position : 'absolute', 'z-index' : '1', width : '100%', height : '100%', background : '#ffffff'}); - - this.$mivHol.append(this.$preloadHol); - this.$mivHol.append(this.$blackScreen); - this.$mivHol.append(this.$contentHol); - this.$mainHolder.append(this.$mivHol); - } - LocationChanger.prototype.iniNav = function () { - var $ul = $('
    ').addClass('ui-widget ui-helper-clearfix'), - $mainHolder = this.$mainHolder, - $navHol = this.$navHol, - $li, $span, - _this = this, - btt = [['moveDown', 'moveStop', 'ui-icon-carat-1-n'], ['moveUp', 'moveStop', 'ui-icon-carat-1-s'], ['moveRight', 'moveStop', 'ui-icon-carat-1-w'], ['moveLeft', 'moveStop', 'ui-icon-carat-1-e'], - ['zoom', 'zoomStop', 'ui-icon-zoomin'], ['unzoom', 'zoomStop', 'ui-icon-zoomout'], ['fitToViewport', null, 'ui-icon-stop'], ['fullSize', null, 'ui-icon-arrow-4-diag']]; - - $.each(btt, function(i) { - mousedownFunc = btt[i][0], - mouseupFunc = btt[i][1], - $li = $('
  • ').addClass('ui-state-default ui-corner-all ' + mousedownFunc); - $span = $('').addClass('ui-icon ' + btt[i][2]); - - $li.append($span); - $ul.append($li); - - $li.bind('mouseenter.lhpMIV touchstart.lhpMIV', function() { - if(!$(this).hasClass('lhp_miv_nav_btt_disab')) { - $(this).addClass('ui-state-hover'); - } - }); - - $li.bind('mouseleave.lhpMIV touchend.lhpMIV', function() { - $(this).removeClass('ui-state-hover'); - }); - - $li.bind('mousedown.lhpMIV touchstart.lhpMIV', function(func) { - return function(e) { - if(!$(this).hasClass('lhp_miv_nav_btt_disab')) { - $mainHolder.lhpMegaImgViewer(func); - } - e.preventDefault(); - } - }(mousedownFunc)); - - if(mouseupFunc) { - $li.bind('mouseup.lhpMIV touchend.lhpMIV', function(func) { - return function(e) { - if(!$(this).hasClass('lhp_miv_nav_btt_disab')) { - $mainHolder.lhpMegaImgViewer(func); - } - e.preventDefault(); - } - }(mouseupFunc)); - } - }); - - $mainHolder.bind('mivChange.lhpMIV', function(e) { - - var c1 = 'lhp_miv_nav_btt_disab', c2 = 'ui-state-hover'; - - if(e.allowDown) { - $navHol.find('.moveDown').removeClass(c1); - } else { - $navHol.find('.moveDown').removeClass(c2).addClass(c1); - } - - if(e.allowUp) { - $navHol.find('.moveUp').removeClass(c1); - } else { - $navHol.find('.moveUp').removeClass(c2).addClass(c1); - } - - if(e.allowLeft) { - $navHol.find('.moveLeft').removeClass(c1); - } else { - $navHol.find('.moveLeft').removeClass(c2).addClass(c1); - } - - if(e.allowRight) { - $navHol.find('.moveRight').removeClass(c1); - } else { - $navHol.find('.moveRight').removeClass(c2).addClass(c1); - } - - if(e.allowZoom) { - $navHol.find('.zoom').removeClass(c1); - $navHol.find('.fullSize').removeClass(c1); - } else { - $navHol.find('.zoom').removeClass(c2).addClass(c1); - $navHol.find('.fullSize').removeClass(c2).addClass(c1); - } - - if(e.allowUnzoom) { - $navHol.find('.unzoom').removeClass(c1); - $navHol.find('.fitToViewport').removeClass(c1); - } else { - $navHol.find('.unzoom').removeClassabout:startpage(c2).addClass(c1); - $navHol.find('.fitToViewport').removeClass(c2).addClass(c1); - } - - }); - - if(this.sett.intNavAutoHide) { - $navHol.css('display', 'none'); - $mainHolder.bind('mouseenter.lhpMIV touchstart.lhpMIV', function() { - clearInterval(_this.navAutohideInterval); - $navHol.fadeIn('fast'); - }); - $mainHolder.bind('mouseleave.lhpMIV touchend.lhpMIV', function() { - clearInterval(_this.navAutohideInterval); - _this.navAutohideInterval = setInterval(function($navHol){ - return function () { - $navHol.stop().clearQueue().fadeOut('fast'); - }; - }($navHol), 1000); - }); - } - - $navHol.append($ul); - } - LocationChanger.prototype.imgContentStart = function ($content) { - this.$content = $content; - $content.addClass('lhp_miv_content').css({'float' : 'left'}); - this.contentFullSize = {'w' : $content.width(), 'h' : $content.height()}; - this.start(); - this.$blackScreen.animate({ opacity : 0 }, { duration : 500, complete : function(){ $(this).remove(); }});about:startpage - } - LocationChanger.prototype.start = function () { - - if(this.sett.intNavEnable) { - this.$navHol = $('
    ').addClass('lhp_miv_nav_pos_' + this.sett.intNavPos); - this.iniNav(); - this.$mivHol.prepend(this.$navHol); - } - - this.$preloadHol.remove(); - - this.$contentHol.bind('mouseenter.lhpMIV', {'_this' : this}, this.mouseenterHandler); - if(this.isTouchDev) { - this.$contentHol.bind('touchstart.lhpMIV', {'_this' : this}, this.mousedownHandler); - } else { - this.$contentHol.bind('mousedown.lhpMIV', {'_this' : this}, this.mousedownHandler); - this.$contentHol.bind('mouseup.lhpMIV', {'_this' : this}, this.mouseupHandler); - this.$contentHol.bind('mouseleave.lhpMIV', {'_this' : this}, this.mouseupHandler); - } - this.$contentHol.bind('mousewheel.lhpMIV', {'_this' : this}, this.mousewheelHandler); - this.setProperties(this.sett.startX, this.sett.startY, this.sett.startScale, true); - } - LocationChanger.prototype.destroy = function () { - /*clear content*/ - this.contentLoader.dispose(); - - /*clear callback*/ - this.animStop(); - this.stopMoving(); - this.stopDirectMoving(); - - /*clear nav handler*/ - if(this.$navHol) { - this.$navHol.find('li').each(function(i) { - $(this).unbind(); - }); - } - - /*clear handler*/ - this.$mainHolder.unbind('.lhpMIV'); - this.$contentHol.unbind(); - - /*clear holders*/ - this.$mivHol.remove(); - - /*clear properties*/ - $.each(this, function(k, v) { - if(!$.isFunction(v)) { - k = null; - } - }); - } - //mouse handlers - LocationChanger.prototype.mousePageCoor = function (e) { - var r = {x : e.pageX, y : e.pageY}; - e = e.originalEvent; - if(this.isTouchDev && e) { - r.x = e.changedTouches[0].pageX; - r.y = e.changedTouches[0].pageY; - } - return r; - } - LocationChanger.prototype.mouseenterHandler = function (e) { - e.data._this.$contentHol.css('cursor', 'url(cursorHand.png),default'); - } - LocationChanger.prototype.mousedownHandler = function (e) { - var _this = e.data._this; - - _this.animStop(true); - _this.stopMoving(); - _this.stopDirectMoving(); - - if(_this.isTouchDev) { - _this.$contentHol.unbind('touchmove.lhpMIV', _this.mousemoveHandler).bind('touchmove.lhpMIV', {'_this' : _this}, _this.mousemoveHandler); - _this.$contentHol.unbind({'touchend.lhpMIV' : _this.positioning}).bind('touchend.lhpMIV' , {'_this' : _this}, _this.positioning); - } else { - _this.$contentHol.unbind('mousemove.lhpMIV', _this.mousemoveHandler).bind('mousemove.lhpMIV', {'_this' : _this}, _this.mousemoveHandler); - _this.$contentHol.unbind({'mouseup.lhpMIV' : _this.positioning}).bind('mouseup.lhpMIV' , {'_this' : _this}, _this.positioning); - } - - _this.lastMousePageCoor = _this.mousePageCoor(e); - _this.$contentHol.css('cursor', 'url(cursorDrag.png), move'); - e.preventDefault(); - } - LocationChanger.prototype.mousemoveHandler = function (e) { - var _this = e.data._this; - - if(_this.isTouchDev) { - _this.$contentHol.unbind({'touchend.lhpMIV' : _this.positioning}); - _this.$contentHol.unbind({'touchend.lhpMIV' : _this.stopDraggingHandler}).bind('touchend.lhpMIV' , {'_this' : _this}, _this.stopDraggingHandler); - } else { - _this.$contentHol.unbind('mouseup.lhpMIV', _this.positioning); - _this.$contentHol.unbind({'mouseup.lhpMIV' : _this.stopDraggingHandler}).bind('mouseup.lhpMIV' , {'_this' : _this}, _this.stopDraggingHandler); - _this.$contentHol.unbind({'mouseleave.lhpMIV' : _this.stopDraggingHandler}).bind('mouseleave.lhpMIV' , {'_this' : _this}, _this.stopDraggingHandler); - } - - _this.dragging(e, 'hard'); - e.preventDefault(); - } - LocationChanger.prototype.mouseupHandler = function (e) { - var _this = e.data._this; - _this.$contentHol.unbind('mousemove.lhpMIV', _this.mousemoveHandler); - _this.$contentHol.unbind('mouseup.lhpMIV', _this.positioning); - _this.$contentHol.css('cursor', 'url(cursorHand.png),default'); - } - LocationChanger.prototype.stopDraggingHandler = function (e) { - var _this = e.data._this; - _this.$contentHol.unbind({'mouseup.lhpMIV' : _this.stopDraggingHandler}); - _this.$contentHol.unbind({'mouseleave.lhpMIV' : _this.stopDraggingHandler}); - _this.dragging(e, 'inertia'); - } - LocationChanger.prototype.mousewheelHandler = function (e, delta) { - var _this = e.data._this, - newScale = (delta > 0) ? _this.sm.nextScale() : _this.sm.prevScale(), - newProp = _this.calculateScale(e, newScale); - - _this.animStop(); - _this.stopMoving(); - _this.stopDirectMoving(); - _this.animSizeAndPos(newProp.x, newProp.y, newProp.w, newProp.h); - return false; - } - //changers - LocationChanger.prototype.adaptsToContainer = function () { - if(this.$content) { - var iterimScale = this.$content.width() / this.contentFullSize.w; - iterimScale = (iterimScale > 1) ? 1 : iterimScale; - - this.animStop(); - this.stopMoving(); - this.stopDirectMoving(); - this.setProperties(null, null, iterimScale, true); - } - } - LocationChanger.prototype.beginZooming = function (t) { - var delta = (t == 'Z') ? 1 : -1, - data = {_this : this}, - mivCenter = {'x' : (this.$mivHol.width() / 2), 'y' : (this.$mivHol.height() / 2)}, - mivHolOff = this.$mivHol.offset(), - mouseGivCenter = {'x' : (mivCenter.x + mivHolOff.left), 'y' : (mivCenter.y + mivHolOff.top)}, - e = {data : data, pageX : mouseGivCenter.x, pageY : mouseGivCenter.y }; //pseudo event object - - this.animStop(true); - this.stopMoving(); - this.stopDirectMoving(); - - if(!this.movingIntreval) { - this.movingIntreval = setInterval(function(_this, e, delta){ - return function () { - _this.zooming(e, delta); - }; - }(this, e, delta), this.sett.animTime / 5); - } - - this.zooming(e, delta); - } - LocationChanger.prototype.zooming = function (e, delta) { - var newScale = (delta > 0) ? this.sm.nextScale() : this.sm.prevScale(), - newProp = this.calculateScale(e, newScale); - - this.animStop(); - this.animSizeAndPos(newProp.x, newProp.y, newProp.w, newProp.h); - - if(this.sett.fitToViewportShortSide) { - if(newScale >= 1 || newProp.w <= this.$mivHol.width() || newProp.h <= this.$mivHol.height()) { - this.stopZooming(); - } - } else { - if(newScale >= 1 || (newProp.w <= this.$mivHol.width() && newProp.h <= this.$mivHol.height())) { - this.stopZooming(); - } - } - } - LocationChanger.prototype.stopZooming = function () { - this.stopMoving(); - } - LocationChanger.prototype.beginDirectMove = function (direct) { - this.animStop(true); - this.stopMoving(); - this.sm.setScale(this.$content.width() / this.contentFullSize.w); - this.speedX = this.speedY = 0; - - switch(direct) { - case 'U': - this.speedY = -50000 / this.sett.animTime; - break; - case 'D': - this.speedY = 50000 / this.sett.animTime; - break; - case 'L': - this.speedX = -50000 / this.sett.animTime; - break; - case 'R': - this.speedX = 50000 / this.sett.animTime; - break; - } - - if(!this.movingDirectIntreval && (this.speedX || this.speedY)) { - this.movingDirectIntreval = setInterval(function(_this){ - return function () { - _this.directMoveWithInertia(); - }; - }(this), 10); - } - } - LocationChanger.prototype.directMoveWithInertia = function () { - var holLeft = this.$contentHol.position().left, - holTop = this.$contentHol.position().top, - targetX = Math.ceil(holLeft + this.speedX), - targetY = Math.ceil(holTop + this.speedY); - - if(!this.movingIntreval) { - this.movingIntreval = setInterval(function(_this){ - return function () { - _this.moveWithInertia(); - }; - }(this), 10); - } - - safeTarget = this.getSafeTarget(targetX, targetY, this.speedX, this.speedY); - - this.targetX = Math.round(safeTarget.x); - this.targetY = Math.round(safeTarget.y); - } - LocationChanger.prototype.stopDirectMoving = function () { - clearInterval(this.movingDirectIntreval); - this.movingDirectIntreval = null; - } - LocationChanger.prototype.dragging = function (e, type) { - var draggIner = this.sett.draggInertia, - mousePageCoor = this.mousePageCoor(e), - draggShftX = mousePageCoor.x - this.lastMousePageCoor.x, - draggShftY = mousePageCoor.y - this.lastMousePageCoor.y; - - if(type == 'inertia' && this.lastDragg) { - this.draggingWithInertia(this.lastDragg.x * draggIner, this.lastDragg.y * draggIner); - } else { - this.draggingHard(draggShftX, draggShftY); - } - - this.lastDragg = {x : (Math.abs(draggShftX) < 5) ? 0 : draggShftX, - y : (Math.abs(draggShftY) < 5) ? 0 : draggShftY}; - - this.lastMousePageCoor = mousePageCoor; - } - LocationChanger.prototype.draggingHard = function (draggShftX, draggShftY) { - var contentHolPos = this.$contentHol.position() - targetX = contentHolPos.left + draggShftX, - targetY = contentHolPos.top + draggShftY, - safeTarget = this.getSafeTarget(targetX, targetY, draggShftX, draggShftY); - - this.animStop(); - this.$contentHol.css({'left' : safeTarget.x, 'top' : safeTarget.y}); - } - LocationChanger.prototype.draggingWithInertia = function (draggShftX, draggShftY) { - var targetX = this.targetX + draggShftX, - targetY = this.targetY + draggShftY, - safeTarget; - - if(!this.movingIntreval) { - this.movingIntreval = setInterval(function(_this){ - return function () { - _this.moveWithInertia(); - }; - }(this), 10); - targetX = this.$contentHol.position().left + draggShftX; - targetY = this.$contentHol.position().top + draggShftY; - } - - safeTarget = this.getSafeTarget(targetX, targetY, draggShftX, draggShftY); - - this.targetX = Math.round(safeTarget.x); - this.targetY = Math.round(safeTarget.y); - } - LocationChanger.prototype.getSafeTarget = function (targetX, targetY, moveDirectX, moveDirectY) { - var limits = this.getLimit(this.sm.getScale()), - xMin = limits.xMin, - xMax = limits.xMax, - yMin = limits.yMin, - yMax = limits.yMax, - mivHolW = this.$mivHol.width(), - mivHolH = this.$mivHol.height(), - mivHolCentX = mivHolW/2, - mivHolCentY = mivHolH/2, - newContentW = this.contentFullSize.w * this.sm.getScale(), - newContentH = this.contentFullSize.h * this.sm.getScale(); - - /*Y*/ - if((moveDirectY < 0) && (targetY < yMin)) { //move up limit - targetY = yMin; - } else if((moveDirectY > 0) && (targetY > yMax)) { // move down limit - targetY = yMax; - } - - if (newContentH < mivHolH) - { - targetY = mivHolCentY - newContentH / 2; - } - - /*X*/ - if((moveDirectX < 0) && (targetX < xMin)) { //move left limit - targetX = xMin; - } else if((moveDirectX > 0) && (targetX > xMax)) { //move right limit - targetX = xMax; - } - - if (newContentW < mivHolW) - { - targetX = mivHolCentX - newContentW / 2; - } - - return {x : targetX, y : targetY}; - } - LocationChanger.prototype.moveWithInertia = function () { - var contentHolPos = this.$contentHol.position(), - damping = this.sett.dragSmooth, - distX, distY; - - contentHolPos.left = Math.ceil(contentHolPos.left); - contentHolPos.top = Math.ceil(contentHolPos.top); - distX = (this.targetX - contentHolPos.left)/damping; - distY = (this.targetY - contentHolPos.top)/damping; - - if(Math.abs(distX) < 1) { - distX = (distX > 0) ? 1 : -1 - } - - if(Math.abs(distY) < 1) { - distY = (distY > 0) ? 1 : -1 - } - - if(contentHolPos.left == this.targetX) { - distX = 0; - } - - if(contentHolPos.top == this.targetY) { - distY = 0; - } - - this.$contentHol.css({'left' : contentHolPos.left + distX, 'top' : contentHolPos.top + distY}); - this.dispatchEventChange(); - - if(contentHolPos.left == this.targetX && contentHolPos.top == this.targetY) { - this.stopDirectMoving(); - this.stopMoving(); - } - } - LocationChanger.prototype.stopMoving = function () { - clearInterval(this.movingIntreval); - this.movingIntreval = null; - } - LocationChanger.prototype.positioning = function (e) { - var _this = e.data._this, - newProp = _this.calculatePosInCenter(e); - - _this.animStop(); - _this.stopMoving(); - _this.stopDirectMoving(); - _this.animSizeAndPos(newProp.x, newProp.y); - } - LocationChanger.prototype.setProperties = function (x, y, scale, noAnim) { - if(this.$content) { - var data = {_this : this}, - mivCenter = {'x' : (this.$mivHol.width() / 2), 'y' : (this.$mivHol.height() / 2)}, - mivHolOff = this.$mivHol.offset(), - mouseGivCenter = {'x' : (mivCenter.x + mivHolOff.left), 'y' : (mivCenter.y + mivHolOff.top)}, - e = {data : data, pageX : mouseGivCenter.x, pageY : mouseGivCenter.y }, //pseudo event object - contentHolPos = this.$contentHol.position(), - newProp, iterimScale, - newX = contentHolPos.left, newY = contentHolPos.top, newW = this.$content.width(), newH = this.$content.height(); - - x = parseFloat(x); - y = parseFloat(y); - scale = parseFloat(scale); - - if(!isNaN(scale)) { - if(scale > 1) { - scale = 1; - } - newProp = this.calculateScale(e, scale); - newX = newProp.x; - newY = newProp.y; - newW = newProp.w; - newH = newProp.h; - } - - iterimScale = newW / this.contentFullSize.w; - - if(!isNaN(x)) { - newX = -(x * iterimScale) + mivCenter.x; - } - - if(!isNaN(y)) { - newY = -(y * iterimScale) + mivCenter.y; - } - - this.animStop(); - this.stopMoving(); - this.stopDirectMoving(); - this.animSizeAndPos(newX, newY, newW, newH, noAnim); - } - } - LocationChanger.prototype.calculatePosInCenter = function (e) { - var contentHolPos = this.$contentHol.position(), - mivHolOff = this.$mivHol.offset(), - mivCenter = {'x' : (this.$mivHol.width() / 2), 'y' : (this.$mivHol.height() / 2)}, - mousePageCoor = this.mousePageCoor(e), - mouseHolCoor = {'x' : (mousePageCoor.x - mivHolOff.left), 'y' : (mousePageCoor.y - mivHolOff.top)}, - shftX, shftY, - newX, newY; - - shftX = mivCenter.x - mouseHolCoor.x; - shftY = mivCenter.y - mouseHolCoor.y; - newX = contentHolPos.left + shftX; - newY = contentHolPos.top + shftY; - - return {x : newX, y : newY, 'shftX' : shftX, 'shftY' : shftY}; - } - LocationChanger.prototype.calculateScale = function (e, newScale) { - var mivHolOff = this.$mivHol.offset(), - contentOff = this.$content.offset(), - mousePageCoor = this.mousePageCoor(e), - iterimScale, - mouseContentCoor, - newX, newY, newW, newH; - - newScale = this.getSafeScale(newScale); - this.sm.setScale(newScale); - iterimScale = this.$content.width() / this.contentFullSize.w; - - mouseContentCoor = {'x' : (mousePageCoor.x - contentOff.left) / iterimScale, - 'y' : (mousePageCoor.y - contentOff.top) / iterimScale}; - - newW = Math.round(this.contentFullSize.w * newScale); - newH = Math.round(this.contentFullSize.h * newScale); - newX = Math.round(contentOff.left - mivHolOff.left + mouseContentCoor.x * (iterimScale - newScale)); - newY = Math.round(contentOff.top - mivHolOff.top + mouseContentCoor.y * (iterimScale - newScale)); - - return {x : newX, y : newY, w : newW, h : newH}; - } - LocationChanger.prototype.getSafeScale = function (newScale) { - var safeScale = (newScale <= 0) ? 0.00001 : newScale, - mivHolW = this.$mivHol.width(), - mivHolH = this.$mivHol.height(), - defContentW = this.contentFullSize.w, - defContentH = this.contentFullSize.h, - newContentW = defContentW * safeScale, - newContentH = defContentH * safeScale, - horScale = mivHolW/defContentW, - verScale = mivHolH/defContentH, - mivHolProp = mivHolW/mivHolH, //viewport proportion; p < 1 - vertical; p > 1 - horizontal - contentProp = newContentW/newContentH; //content proportion - - if (!this.sett.contentSizeOver100 && defContentW <= mivHolW && defContentH <= mivHolH) - { - safeScale = 1; - return safeScale; - } - - if(this.sett.fitToViewportShortSide) { - if(newContentW < mivHolW || newContentH < mivHolH) { - horScale = mivHolW / this.contentFullSize.w; - verScale = mivHolH / this.contentFullSize.h; - safeScale = Math.max(horScale, verScale); - } - } else { - if (newContentW < mivHolW && newContentH < mivHolH) { - if (contentProp <= mivHolProp) - safeScale = verScale; - else - safeScale = horScale; - } - } - - return safeScale; - } - LocationChanger.prototype.getLimit = function (inScale) { - var xMin = -(Math.round(this.contentFullSize.w * inScale) - this.$mivHol.width()), - yMin = -(Math.round(this.contentFullSize.h * inScale) - this.$mivHol.height()); - return {'xMin' : xMin, 'xMax' : 0, 'yMin' : yMin, 'yMax' : 0}; - } - LocationChanger.prototype.getSafeXY = function (x, y, inScale) { - var limits = this.getLimit(inScale), - mivHolW = this.$mivHol.width(), - mivHolH = this.$mivHol.height(), - mivHolCentX = mivHolW/2, - mivHolCentY = mivHolH/2, - defContentW = this.contentFullSize.w, - defContentH = this.contentFullSize.h, - newContentW = defContentW * inScale, - newContentH = defContentH * inScale, - safeX = x, safeY = y; - - - /*X*/ - if (newContentW < mivHolW) - { - if (x < limits.xMin || x > limits.xMax) - safeX = mivHolCentX - newContentW / 2; - } - else - { - if(x < limits.xMin) { - safeX = limits.xMin; - } else if(x > limits.xMax) { - safeX = limits.xMax; - } - } - - /*Y*/ - if (newContentH < mivHolH) - { - if (y < limits.yMin || y > limits.yMax) - safeY = mivHolCentY - newContentH / 2; - } - else - { - if(y < limits.yMin) { - safeY = limits.yMin; - } else if(y > limits.yMax) { - safeY = limits.yMax; - } - } - - return {'x' : safeX, 'y' : safeY}; - } - LocationChanger.prototype.animSizeAndPos = function (x, y, w, h, noAnim) { - var safeXY, iterimScale, - changeHandler = function(_this) { - return function() { - _this.dispatchEventChange(); - } - }(this); - - if(w != undefined) { - iterimScale = w / this.contentFullSize.w; - } else { - iterimScale = this.$content.width() / this.contentFullSize.w; - } - - if(x != undefined && y != undefined) { - safeXY = this.getSafeXY(x, y, iterimScale); - if(noAnim) { - this.$contentHol.css({ left : safeXY.x, top : safeXY.y }); - this.dispatchEventChange(); - } else { - this.$contentHol.animate({ left : safeXY.x, top : safeXY.y }, - { duration : this.sett.animTime, easing : 'easeOutCubic', - step : changeHandler, - complete : changeHandler }); - } - } - if(w != undefined && h != undefined) { - if(noAnim) { - this.$content.css({ width : w, height : h }); - this.dispatchEventChange(); - } else { - this.$content.animate({ width : w, height : h }, - { duration : this.sett.animTime, easing : 'easeOutCubic', - step : changeHandler, - complete : changeHandler }); - } - } - } - LocationChanger.prototype.animStop = function (saveScale) { - if(this.$contentHol && this.$content) { - this.$contentHol.stop().clearQueue(); - this.$content.stop().clearQueue(); - - if(saveScale) { - this.sm.setScale(this.$content.width() / this.contentFullSize.w); - } - - this.dispatchEventChange(); - } - } - LocationChanger.prototype.dispatchEventChange = function () { - var e, a = {}, - contentHolPos = this.$contentHol.position(), - limits = this.getLimit(this.sm.getScale()), - contnetW = this.$content.width(), - contnetH = this.$content.height(); - - /*position*/ - a.allowDown = (Math.ceil(contentHolPos.top) < Math.ceil(limits.yMax)); - a.allowUp = (Math.ceil(contentHolPos.top) > Math.ceil(limits.yMin)); - a.allowRight = (Math.ceil(contentHolPos.left) < Math.ceil(limits.xMax)); - a.allowLeft = (Math.ceil(contentHolPos.left) > Math.ceil(limits.xMin)); - - /*scale*/ - a.allowZoom = (contnetW / this.contentFullSize.w < 1); - if(this.sett.fitToViewportShortSide) { - a.allowUnzoom = (contnetW > this.$mivHol.width() && contnetH > this.$mivHol.height()); - } else { - a.allowUnzoom = (contnetW > this.$mivHol.width() || contnetH > this.$mivHol.height()); - } - - if(!this.allowCompare(a, this.allow)) { - e = $.Event("mivChange", a); - this.$mainHolder.trigger(e); - } - - this.allow = a; - } - LocationChanger.prototype.allowCompare = function (_new, _old) { - var res = true; - - $.each(_new, function(k){ - if(_new[k] != _old[k]) { - res = false; - return; - } - }); - - return res; - } - - /*scale manager*/ - var ScaleManager = function() { - this.step = .1; - this.curr = 1; - }; - ScaleManager.prototype.getScale = function() { - return this.curr; - } - ScaleManager.prototype.setScale = function(v) { - this.curr = v; - } - ScaleManager.prototype.nextScale = function() { - var scale = this.curr + this.step; - if(scale > 1) { - this.curr = 1; - } else { - this.curr = scale; - } - return this.getScale(); - } - ScaleManager.prototype.prevScale = function() { - var scale = this.curr - this.step; - if(scale < this.step) { - this.curr = this.step; - } else { - this.curr = scale; - } - return this.getScale(); - } - /**/ - - /*content loaders*/ - var LoaderImgContent = function (url, $imgHolder, callback) { - var $img = $(''); - this.callback = callback; - - $img.one('load', function (that){ - return function (e) { - that.loadComplete(e); - } - }(this)); - - $imgHolder.append($img); - $img.attr('src',url); //load - } - LoaderImgContent.prototype.loadComplete = function(e) { - if(this.callback) { - this.callback($(e.currentTarget)); - } - } - LoaderImgContent.prototype.dispose = function() { - this.callback = null; - } - /**/ - -})(jQuery); \ No newline at end of file diff --git a/NzbDrone.Web/Content2/New folder/jquery.lhpMegaImgViewer.2.0.js b/NzbDrone.Web/Content2/New folder/jquery.lhpMegaImgViewer.2.0.js deleted file mode 100644 index d6b1e1d1d..000000000 --- a/NzbDrone.Web/Content2/New folder/jquery.lhpMegaImgViewer.2.0.js +++ /dev/null @@ -1,1831 +0,0 @@ -// Mega Image Viewer v2.0 - jQuery image viewer plugin - converting
    element to an animated image viewer -// (c) 2012 lhp - http://codecanyon.net/user/lhp -(function (f) { - var c, h, e; - h = { - dragSmooth: 8 - }; - e = { - viewportWidth: "100%", - viewportHeight: "100%", - fitToViewportShortSide: false, - contentSizeOver100: false, - startScale: 1, - startX: 0, - startY: 0, - animTime: 500, - draggInertia: 10, - contentUrl: "", - intNavEnable: true, - intNavPos: "T", - intNavAutoHide: false, - intNavMoveDownBtt: true, - intNavMoveUpBtt: true, - intNavMoveRightBtt: true, - intNavMoveLeftBtt: true, - intNavZoomBtt: true, - intNavUnzoomBtt: true, - intNavFitToViewportBtt: true, - intNavFullSizeBtt: true, - mapEnable: true, - mapThumb: null, - mapPos: "BL", - popupShowAction: "rollover", - testMode: false - }; - c = { - init: function (m, l) { - return this.each(function () { - var q = f(this), - p = q.data("lhpMIV"), - o = q.find("img"), - n = {}; - f.extend(n, e, m); - f.extend(n, h); - if (!p) { - if (n.draggInertia < 0) { - n.draggInertia = 0 - } - n.animTime = parseInt(n.animTime); - if (n.animTime < 0) { - n.animTime = 0 - } - if (o.length > 0) { - n.contentUrl = o[0].src; - o.remove() - } - q.data("lhpMIV", {}); - q.data("lhpMIV").interImgsTmp = o; - q.data("lhpMIV").lc = new d(n, q, l) - } - }) - }, - setPosition: function (l, o, n, m) { - return this.each(function () { - var q = f(this), - p = q.data("lhpMIV"); - if (p) { - q.data("lhpMIV").lc.setProperties(l, o, n, m) - } - }) - }, - moveUp: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.beginDirectMove("U") - } - }) - }, - moveDown: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.beginDirectMove("D") - } - }) - }, - moveLeft: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.beginDirectMove("L") - } - }) - }, - moveRight: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.beginDirectMove("R") - } - }) - }, - moveStop: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.stopDirectMoving() - } - }) - }, - zoom: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.beginZooming("Z") - } - }) - }, - unzoom: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.beginZooming("U") - } - }) - }, - zoomStop: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.stopZooming() - } - }) - }, - fitToViewport: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.setProperties(null, null, 0) - } - }) - }, - fullSize: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.setProperties(null, null, 1) - } - }) - }, - adaptsToContainer: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.adaptsToContainer() - } - }) - }, - getCurrentState: function () { - var n = f(this), - m = n.data("lhpMIV"), - l = {}; - if (m) { - l = n.data("lhpMIV").lc.getCurrentState() - } - return l - }, - destroy: function () { - return this.each(function () { - var m = f(this), - l = m.data("lhpMIV"); - if (l) { - m.data("lhpMIV").lc.destroy(); - m.prepend(m.data("lhpMIV").interImgsTmp); - m.removeData("lhpMIV") - } - }) - } - }; - f.fn.lhpMegaImgViewer = function (l) { - if (c[l]) { - return c[l].apply(this, Array.prototype.slice.call(arguments, 1)) - } else { - if (typeof l === "object" || !l) { - return c.init.apply(this, arguments) - } else { - f.error("Method " + l + " does not exist on jQuery.lhpMegaImgViewer") - } - } - }; - var d = function (m, n, l) { - this.isTouchDev = (typeof (window.ontouchstart) != "undefined") ? true : false; - this.sett = m; - this.$mainHolder = n; - this.lastMousePageCoor = null; - this.lastDrag = null; - this.contentFullSize = {}; - this.$mivHol = null; - this.$contentHol = null; - this.$content = null; - this.$preloadHol = null; - this.$blackScreen = null; - this.$infoBox = null; - this.$navHol = null; - this.movingIntreval = null; - this.movingDirectIntreval = null; - this.navAutohideInterval = null; - this.speedX = this.speedY = null; - this.targetX = this.targetY = null; - this.allow = { - allowDown: false, - allowUp: false, - allowLeft: false, - allowRight: false, - allowZoom: false, - allowUnzoom: false - }; - this.isScaled = false; - this.sm = new k(); - this.map = null; - this.markersContainer = l; - this.markers = null; - this.createHolders(); - this.contentLoader = new g(this.sett.contentUrl, this.$contentHol, function (o) { - return function (p) { - o.imgContentStart(p) - } - }(this)); - this.contentLoader.loadStart() - }; - d.prototype.createHolders = function () { - this.$mivHol = f("
    ").addClass("lhp_miv_holder").css({ - position: "relative", - overflow: "hidden", - width: this.sett.viewportWidth, - height: this.sett.viewportHeight - }); - this.$preloadHol = f("
    ").addClass("lhp_miv_preload_holder"); - this.$contentHol = f("
    ").addClass("lhp_miv_content_holder").css({ - position: "absolute" - }); - this.$blackScreen = f("
    ").addClass("lhp_miv_blackScreen").css({ - position: "absolute", - "z-index": "9999", - width: "100%", - height: "100%", - background: "#ffffff" - }); - this.$mivHol.append(this.$preloadHol); - this.$mivHol.append(this.$blackScreen); - this.$mivHol.append(this.$contentHol); - this.$mainHolder.append(this.$mivHol); - if (this.sett.testMode) { - this.$infoBox = f("
    ").addClass("lhp_miv_infoBox_holder"); - this.$mivHol.append(this.$infoBox) - } - }; - d.prototype.iniNav = function () { - var m = f("
      ").addClass("ui-widget ui-helper-clearfix"), - s = this.$mainHolder, - n = this.$navHol, - p, q, o = this, - t = 27, - l = 0, - r = [ - ["moveDown", "moveStop", "ui-icon-carat-1-n", "intNavMoveDownBtt"], - ["moveUp", "moveStop", "ui-icon-carat-1-s", "intNavMoveUpBtt"], - ["moveRight", "moveStop", "ui-icon-carat-1-w", "intNavMoveRightBtt"], - ["moveLeft", "moveStop", "ui-icon-carat-1-e", "intNavMoveLeftBtt"], - ["zoom", "zoomStop", "ui-icon-zoomin", "intNavZoomBtt"], - ["unzoom", "zoomStop", "ui-icon-zoomout", "intNavUnzoomBtt"], - ["fitToViewport", null, "ui-icon-stop", "intNavFitToViewportBtt"], - ["fullSize", null, "ui-icon-arrow-4-diag", "intNavFullSizeBtt"] - ]; - f.each(r, function (v) { - var w = r[v][0], - x = r[v][1], - z = r[v][3], - y, u; - if (o.sett[z]) { - l += t; - y = f("
    • ").addClass("ui-state-default ui-corner-all " + w), u = f("").addClass("ui-icon " + r[v][2]); - y.append(u); - m.append(y); - y.bind("mouseenter.lhpMIV touchstart.lhpMIV", function () { - if (!f(this).hasClass("lhp_miv_nav_btt_disab")) { - f(this).addClass("ui-state-hover") - } - }); - y.bind("mouseleave.lhpMIV touchend.lhpMIV", function () { - f(this).removeClass("ui-state-hover") - }); - y.bind(((o.isTouchDev) ? "touchstart.lhpMIV" : "mousedown.lhpMIV"), function (A) { - return function (B) { - if (!f(this).hasClass("lhp_miv_nav_btt_disab")) { - s.lhpMegaImgViewer(A) - } - B.preventDefault() - } - }(w)); - if (x) { - y.bind(((o.isTouchDev) ? "touchend.lhpMIV" : "mouseup.lhpMIV"), function (A) { - return function (B) { - if (!f(this).hasClass("lhp_miv_nav_btt_disab")) { - s.lhpMegaImgViewer(A) - } - B.preventDefault() - } - }(x)) - } - } - }); - if (this.$navHol.hasClass("lhp_miv_nav_pos_L") || this.$navHol.hasClass("lhp_miv_nav_pos_R")) { - this.$navHol.css("width", t); - this.$navHol.css("margin-top", - l / 2) - } - if (this.$navHol.hasClass("lhp_miv_nav_pos_T") || this.$navHol.hasClass("lhp_miv_nav_pos_B")) { - this.$navHol.css("margin-left", - l / 2) - } - s.bind("mivChange.lhpMIV", function (w) { - var v = "lhp_miv_nav_btt_disab", - u = "ui-state-hover"; - if (w.allowDown) { - n.find(".moveDown").removeClass(v) - } else { - n.find(".moveDown").removeClass(u).addClass(v) - } - if (w.allowUp) { - n.find(".moveUp").removeClass(v) - } else { - n.find(".moveUp").removeClass(u).addClass(v) - } - if (w.allowLeft) { - n.find(".moveLeft").removeClass(v) - } else { - n.find(".moveLeft").removeClass(u).addClass(v) - } - if (w.allowRight) { - n.find(".moveRight").removeClass(v) - } else { - n.find(".moveRight").removeClass(u).addClass(v) - } - if (w.allowZoom) { - n.find(".zoom").removeClass(v); - n.find(".fullSize").removeClass(v) - } else { - n.find(".zoom").removeClass(u).addClass(v); - n.find(".fullSize").removeClass(u).addClass(v) - } - if (w.allowUnzoom) { - n.find(".unzoom").removeClass(v); - n.find(".fitToViewport").removeClass(v) - } else { - n.find(".unzoom").removeClass(u).addClass(v); - n.find(".fitToViewport").removeClass(u).addClass(v) - } - }); - if (this.sett.intNavAutoHide) { - n.css("display", "none"); - s.bind("mouseenter.lhpMIV touchstart.lhpMIV", function () { - clearInterval(o.navAutohideInterval); - n.fadeIn("fast") - }); - s.bind("mouseleave.lhpMIV touchend.lhpMIV", function () { - clearInterval(o.navAutohideInterval); - o.navAutohideInterval = setInterval(function (u) { - return function () { - u.stop().clearQueue().fadeOut("fast") - } - }(n), 1000) - }) - } - n.append(m) - }; - d.prototype.imgContentStart = function (l) { - this.$content = l; - l.addClass("lhp_miv_content").css({ - "float": "left" - }); - this.contentFullSize = { - w: l.width(), - h: l.height() - }; - this.sett.mainImgWidth = this.contentFullSize.w; - this.sett.mainImgHeight = this.contentFullSize.h; - this.start(); - this.$preloadHol.remove(); - this.$blackScreen.animate({ - opacity: 0 - }, { - duration: 500, - complete: function () { - f(this).remove() - } - }) - }; - d.prototype.start = function () { - if (this.sett.mapEnable && this.sett.mapThumb) { - this.map = new b(this.sett, this.$mainHolder, this.$content, this.isTouchDev); - this.map.ini(this.$mivHol) - } - if (this.sett.intNavEnable) { - this.$navHol = f('
      ').addClass("lhp_miv_nav_pos_" + this.sett.intNavPos); - this.iniNav(); - this.$mivHol.prepend(this.$navHol) - } - this.markers = new a(this.$mainHolder, this.$contentHol, this.markersContainer, this.isTouchDev, this.sett.popupShowAction, this.sett.startScale); - this.markers.ini(); - this.$contentHol.bind("mouseenter.lhpMIV", { - _this: this - }, this.mouseenterHandler); - if (this.isTouchDev) { - this.$contentHol.bind("touchstart.lhpMIV", { - _this: this - }, this.mousedownHandler) - } else { - this.$contentHol.bind("mousedown.lhpMIV", { - _this: this - }, this.mousedownHandler); - this.$contentHol.bind("mouseup.lhpMIV", { - _this: this - }, this.mouseupHandler); - this.$contentHol.bind("mouseleave.lhpMIV", { - _this: this - }, this.mouseupHandler) - } - this.$contentHol.bind("mousewheel.lhpMIV", { - _this: this - }, this.mousewheelHandler); - if (this.sett.testMode) { - this.$contentHol.bind("mousemove.lhpMIV", { - _this: this - }, this.showCurrentCoor) - } - this.setProperties(this.sett.startX, this.sett.startY, this.sett.startScale, true) - }; - d.prototype.destroy = function () { - this.contentLoader.dispose(); - this.contentLoader = null; - this.animStop(); - this.stopMoving(); - this.stopDirectMoving(); - if (this.markers) { - this.markers.destroy() - } - if (this.$navHol) { - this.$navHol.find("li").each(function (l) { - f(this).unbind() - }) - } - if (this.map) { - this.map.destroy() - } - this.$mainHolder.unbind(".lhpMIV"); - this.$contentHol.unbind(); - this.$mivHol.remove(); - f.each(this, function (m, l) { - if (!f.isFunction(l)) { - m = null - } - }) - }; - d.prototype.mousePageCoor = function (m) { - var l = { - x: m.pageX, - y: m.pageY - }; - m = m.originalEvent; - if (this.isTouchDev && m) { - l.x = m.changedTouches[0].pageX; - l.y = m.changedTouches[0].pageY - } - return l - }; - d.prototype.mouseenterHandler = function (l) { - if (!l.data._this.sett.testMode) { - l.data._this.$contentHol.css("cursor", "url(css/lhp_miv/cursorHand.png),default") - } - }; - d.prototype.mousedownHandler = function (l) { - var m = l.data._this; - m.animStop(true); - m.stopMoving(); - m.stopDirectMoving(); - if (m.isTouchDev) { - m.$contentHol.unbind("touchmove.lhpMIV", m.mousemoveHandler).bind("touchmove.lhpMIV", { - _this: m - }, m.mousemoveHandler); - m.$contentHol.unbind({ - "touchend.lhpMIV": m.positioning - }).bind("touchend.lhpMIV", { - _this: m - }, m.positioning) - } else { - m.$contentHol.unbind("mousemove.lhpMIV", m.mousemoveHandler).bind("mousemove.lhpMIV", { - _this: m - }, m.mousemoveHandler); - m.$contentHol.unbind({ - "mouseup.lhpMIV": m.positioning - }).bind("mouseup.lhpMIV", { - _this: m - }, m.positioning) - } - m.lastMousePageCoor = m.mousePageCoor(l); - m.$contentHol.css("cursor", "url(css/lhp_miv/cursorDrag.png), move"); - l.preventDefault() - }; - d.prototype.mousemoveHandler = function (l) { - var m = l.data._this; - if (m.isTouchDev) { - m.$contentHol.unbind({ - "touchend.lhpMIV": m.positioning - }); - m.$contentHol.unbind({ - "touchend.lhpMIV": m.stopDraggingHandler - }).bind("touchend.lhpMIV", { - _this: m - }, m.stopDraggingHandler) - } else { - m.$contentHol.unbind("mouseup.lhpMIV", m.positioning); - m.$contentHol.unbind({ - "mouseup.lhpMIV": m.stopDraggingHandler - }).bind("mouseup.lhpMIV", { - _this: m - }, m.stopDraggingHandler); - m.$contentHol.unbind({ - "mouseleave.lhpMIV": m.stopDraggingHandler - }).bind("mouseleave.lhpMIV", { - _this: m - }, m.stopDraggingHandler) - } - m.dragging(l, "hard"); - l.preventDefault() - }; - d.prototype.mouseupHandler = function (l) { - var m = l.data._this; - m.$contentHol.unbind("mousemove.lhpMIV", m.mousemoveHandler); - m.$contentHol.unbind("mouseup.lhpMIV", m.positioning); - if (!m.sett.testMode) { - m.$contentHol.css("cursor", "url(css/lhp_miv/cursorHand.png),default") - } else { - m.$contentHol.css("cursor", "default") - } - }; - d.prototype.stopDraggingHandler = function (l) { - var m = l.data._this; - m.$contentHol.unbind({ - "mouseup.lhpMIV": m.stopDraggingHandler - }); - m.$contentHol.unbind({ - "mouseleave.lhpMIV": m.stopDraggingHandler - }); - m.dragging(l, "inertia") - }; - d.prototype.mousewheelHandler = function (m, p) { - var o = m.data._this, - n = (p > 0) ? o.sm.nextScale() : o.sm.prevScale(), - l = o.calculateScale(m, n); - o.animStop(); - o.stopMoving(); - o.stopDirectMoving(); - o.animSizeAndPos(l.x, l.y, l.w, l.h); - m.preventDefault(); - return false - }; - d.prototype.showCurrentCoor = function (o) { - var q = o.data._this, - l = q.mousePageCoor(o), - p = q.$contentHol.position(), - m = q.$mivHol.offset(), - n = q.$content.width() / q.contentFullSize.w; - l.x = Math.round((l.x - p.left - m.left) / n); - l.y = Math.round((l.y - p.top - m.top) / n); - q.$infoBox.css("display", "block"); - q.$infoBox.html("x:" + l.x + " y:" + l.y) - }; - d.prototype.adaptsToContainer = function () { - if (this.$content) { - var l = this.$content.width() / this.contentFullSize.w; - l = (l > 1) ? 1 : l; - this.animStop(); - this.stopMoving(); - this.stopDirectMoving(); - this.setProperties(null, null, l, true) - } - }; - d.prototype.beginZooming = function (n) { - if (this.$content) { - var r = (n == "Z") ? 1 : -1, - o = { - _this: this - }, q = { - x: (this.$mivHol.width() / 2), - y: (this.$mivHol.height() / 2) - }, m = this.$mivHol.offset(), - l = { - x: (q.x + m.left), - y: (q.y + m.top) - }, p = { - data: o, - pageX: l.x, - pageY: l.y - }; - this.animStop(true); - this.stopMoving(); - this.stopDirectMoving(); - if (!this.movingIntreval) { - this.movingIntreval = setInterval(function (u, s, t) { - return function () { - u.zooming(s, t) - } - }(this, p, r), this.sett.animTime / 5) - } - this.zooming(p, r) - } - }; - d.prototype.zooming = function (m, o) { - var n = (o > 0) ? this.sm.nextScale() : this.sm.prevScale(), - l = this.calculateScale(m, n); - this.animStop(); - this.animSizeAndPos(l.x, l.y, l.w, l.h); - if (this.sett.fitToViewportShortSide) { - if (n >= 1 || l.w <= this.$mivHol.width() || l.h <= this.$mivHol.height()) { - this.stopZooming() - } - } else { - if (n >= 1 || (l.w <= this.$mivHol.width() && l.h <= this.$mivHol.height())) { - this.stopZooming() - } - } - }; - d.prototype.stopZooming = function () { - this.stopMoving() - }; - d.prototype.beginDirectMove = function (l) { - if (this.$content) { - this.animStop(true); - this.stopMoving(); - this.sm.setScale(this.$content.width() / this.contentFullSize.w); - this.speedX = this.speedY = 0; - switch (l) { - case "U": - this.speedY = -50000 / this.sett.animTime; - break; - case "D": - this.speedY = 50000 / this.sett.animTime; - break; - case "L": - this.speedX = -50000 / this.sett.animTime; - break; - case "R": - this.speedX = 50000 / this.sett.animTime; - break - } - if (!this.movingDirectIntreval && (this.speedX || this.speedY)) { - this.movingDirectIntreval = setInterval(function (m) { - return function () { - m.directMoveWithInertia() - } - }(this), 10) - } - } - }; - d.prototype.directMoveWithInertia = function () { - var m = this.$contentHol.position().left, - l = this.$contentHol.position().top, - p = Math.ceil(m + this.speedX), - n = Math.ceil(l + this.speedY), - o; - if (!this.movingIntreval) { - this.movingIntreval = setInterval(function (q) { - return function () { - q.moveWithInertia() - } - }(this), 10) - } - o = this.getSafeTarget(p, n, this.speedX, this.speedY); - this.targetX = Math.round(o.x); - this.targetY = Math.round(o.y) - }; - d.prototype.stopDirectMoving = function () { - clearInterval(this.movingDirectIntreval); - this.movingDirectIntreval = null - }; - d.prototype.dragging = function (q, o) { - var p = this.sett.draggInertia, - m = this.mousePageCoor(q), - n = m.x - this.lastMousePageCoor.x, - l = m.y - this.lastMousePageCoor.y; - if (o == "inertia" && this.lastDragg) { - this.draggingWithInertia(this.lastDragg.x * p, this.lastDragg.y * p) - } else { - this.draggingHard(n, l) - } - this.lastDragg = { - x: (Math.abs(n) < 5) ? 0 : n, - y: (Math.abs(l) < 5) ? 0 : l - }; - this.lastMousePageCoor = m - }; - d.prototype.draggingHard = function (m, l) { - var q = this.$contentHol.position(), - p = q.left + m, - n = q.top + l, - o = this.getSafeTarget(p, n, m, l); - this.animStop(); - this.$contentHol.css({ - left: o.x, - top: o.y - }) - }; - d.prototype.draggingWithInertia = function (m, l) { - var p = this.targetX + m, - n = this.targetY + l, - o; - if (!this.movingIntreval) { - this.movingIntreval = setInterval(function (q) { - return function () { - q.moveWithInertia() - } - }(this), 10); - p = this.$contentHol.position().left + m; - n = this.$contentHol.position().top + l - } - o = this.getSafeTarget(p, n, m, l); - this.targetX = Math.round(o.x); - this.targetY = Math.round(o.y) - }; - d.prototype.getSafeTarget = function (y, w, o, m) { - var l = this.getLimit(this.sm.getScale()), - p = l.xMin, - s = l.xMax, - z = l.yMin, - r = l.yMax, - n = this.$mivHol.width(), - x = this.$mivHol.height(), - v = n / 2, - u = x / 2, - t = this.contentFullSize.w * this.sm.getScale(), - q = this.contentFullSize.h * this.sm.getScale(); - if ((m < 0) && (w < z)) { - w = z - } else { - if ((m > 0) && (w > r)) { - w = r - } - } - if (q < x) { - w = u - q / 2 - } - if ((o < 0) && (y < p)) { - y = p - } else { - if ((o > 0) && (y > s)) { - y = s - } - } - if (t < n) { - y = v - t / 2 - } - return { - x: y, - y: w - } - }; - d.prototype.moveWithInertia = function () { - var o = this.$contentHol.position(), - n = this.sett.dragSmooth, - m, l; - o.left = Math.ceil(o.left); - o.top = Math.ceil(o.top); - m = (this.targetX - o.left) / n; - l = (this.targetY - o.top) / n; - if (Math.abs(m) < 1) { - m = (m > 0) ? 1 : -1 - } - if (Math.abs(l) < 1) { - l = (l > 0) ? 1 : -1 - } - if (o.left == this.targetX) { - m = 0 - } - if (o.top == this.targetY) { - l = 0 - } - this.$contentHol.css({ - left: o.left + m, - top: o.top + l - }); - this.dispatchEventChange(); - if (o.left == this.targetX && o.top == this.targetY) { - this.stopDirectMoving(); - this.stopMoving() - } - }; - d.prototype.stopMoving = function () { - clearInterval(this.movingIntreval); - this.movingIntreval = null - }; - d.prototype.positioning = function (m) { - var n = m.data._this, - l = n.calculatePosInCenter(m); - n.animStop(); - n.stopMoving(); - n.stopDirectMoving(); - n.animSizeAndPos(l.x, l.y) - }; - d.prototype.setProperties = function (A, u, o, z) { - if (this.$content) { - var p = { - _this: this - }, q = { - x: (this.$mivHol.width() / 2), - y: (this.$mivHol.height() / 2) - }, B = this.$mivHol.offset(), - n = { - x: (q.x + B.left), - y: (q.y + B.top) - }, r = { - data: p, - pageX: n.x, - pageY: n.y - }, w = this.$contentHol.position(), - s, v, l = w.left, - C = w.top, - m = this.$content.width(), - t = this.$content.height(); - A = parseFloat(A); - u = parseFloat(u); - o = parseFloat(o); - if (!isNaN(o)) { - if (o > 1) { - o = 1 - } - s = this.calculateScale(r, o); - l = s.x; - C = s.y; - m = s.w; - t = s.h - } - v = m / this.contentFullSize.w; - if (!isNaN(A)) { - l = -(A * v) + q.x - } - if (!isNaN(u)) { - C = -(u * v) + q.y - } - this.animStop(); - this.stopMoving(); - this.stopDirectMoving(); - this.animSizeAndPos(l, C, m, t, z) - } - }; - d.prototype.calculatePosInCenter = function (n) { - var o = this.$contentHol.position(), - r = this.$mivHol.offset(), - m = { - x: (this.$mivHol.width() / 2), - y: (this.$mivHol.height() / 2) - }, s = this.mousePageCoor(n), - t = { - x: (s.x - r.left), - y: (s.y - r.top) - }, q, p, l, u; - q = m.x - t.x; - p = m.y - t.y; - l = o.left + q; - u = o.top + p; - return { - x: l, - y: u, - shftX: q, - shftY: p - } - }; - d.prototype.calculateScale = function (q, p) { - var t = this.$mivHol.offset(), - o = this.$content.offset(), - u = this.mousePageCoor(q), - s, n, l, v, m, r; - p = this.getSafeScale(p); - this.sm.setScale(p); - s = this.$content.width() / this.contentFullSize.w; - n = { - x: (u.x - o.left) / s, - y: (u.y - o.top) / s - }; - m = Math.round(this.contentFullSize.w * p); - r = Math.round(this.contentFullSize.h * p); - l = Math.round(o.left - t.left + n.x * (s - p)); - v = Math.round(o.top - t.top + n.y * (s - p)); - return { - x: l, - y: v, - w: m, - h: r - } - }; - d.prototype.getSafeScale = function (s) { - var u = (s <= 0) ? 0.00001 : s, - l = this.$mivHol.width(), - v = this.$mivHol.height(), - t = this.contentFullSize.w, - p = this.contentFullSize.h, - r = t * u, - n = p * u, - q = l / t, - w = v / p, - m = l / v, - o = r / n; - if (this.sett.fitToViewportShortSide) { - if (r < l || n < v) { - q = l / this.contentFullSize.w; - w = v / this.contentFullSize.h; - u = Math.max(q, w); - if (!this.sett.contentSizeOver100 && (t <= l || p <= v)) { - u = 1 - } - } - } else { - if (r < l && n < v) { - if (o <= m) { - u = w - } else { - u = q - } - } - if (!this.sett.contentSizeOver100 && t <= l && p <= v) { - u = 1 - } - } - return u - }; - d.prototype.getLimit = function (n) { - var m = -(Math.round(this.contentFullSize.w * n) - this.$mivHol.width()), - l = -(Math.round(this.contentFullSize.h * n) - this.$mivHol.height()); - return { - xMin: m, - xMax: 0, - yMin: l, - yMax: 0 - } - }; - d.prototype.getSafeXY = function (w, u, t) { - var l = this.getLimit(t), - m = this.$mivHol.width(), - v = this.$mivHol.height(), - s = m / 2, - q = v / 2, - r = this.contentFullSize.w, - o = this.contentFullSize.h, - p = r * t, - n = o * t, - A = w, - z = u; - if (p < m) { - if (w < l.xMin || w > l.xMax) { - A = s - p / 2 - } - } else { - if (w < l.xMin) { - A = l.xMin - } else { - if (w > l.xMax) { - A = l.xMax - } - } - } - if (n < v) { - if (u < l.yMin || u > l.yMax) { - z = q - n / 2 - } - } else { - if (u < l.yMin) { - z = l.yMin - } else { - if (u > l.yMax) { - z = l.yMax - } - } - } - return { - x: A, - y: z - } - }; - d.prototype.animSizeAndPos = function (t, q, u, n, s) { - var p, r, v = function (w) { - return function () { - w.dispatchEventChange() - } - }(this), - l = function (w) { - return function () { - w.dispatchEventChange() - } - }(this), - m = function (w) { - return function () { - w.dispatchEventChange() - } - }(this), - o = function (w) { - return function () { - w.isScaled = false; - w.dispatchEventChange() - } - }(this); - if (u != undefined) { - r = u / this.contentFullSize.w - } else { - r = this.$content.width() / this.contentFullSize.w - } - if (t != undefined && q != undefined) { - p = this.getSafeXY(t, q, r); - if (s) { - this.$contentHol.css({ - left: p.x, - top: p.y - }); - l() - } else { - this.$contentHol.animate({ - left: p.x, - top: p.y - }, { - duration: this.sett.animTime, - easing: "easeOutCubic", - step: v, - complete: l - }) - } - } - if (u != undefined && n != undefined && (u != this.$content.width() || n != this.$content.height())) { - this.isScaled = true; - if (s) { - this.$content.css({ - width: u, - height: n - }); - m(); - o() - } else { - this.$content.animate({ - width: u, - height: n - }, { - duration: this.sett.animTime, - easing: "easeOutCubic", - step: m, - complete: o - }) - } - } - }; - d.prototype.animStop = function (l) { - if (this.$contentHol && this.$content) { - this.$contentHol.stop().clearQueue(); - this.$content.stop().clearQueue(); - if (l) { - this.sm.setScale(this.$content.width() / this.contentFullSize.w) - } - this.dispatchEventChange() - } - }; - d.prototype.dispatchEventChange = function () { - var l = this.getCurrentState(), - m = f.Event("mivChange", l); - this.allow = l; - this.$mainHolder.trigger(m) - }; - d.prototype.getCurrentState = function () { - var m = {}; - if (this.$content) { - var r = this.$contentHol.position(), - n = this.getLimit(this.sm.getScale()), - l = this.$content.width(), - o = this.$content.height(), - q = { - x: (this.$mivHol.width() / 2), - y: (this.$mivHol.height() / 2) - }, p = l / this.contentFullSize.w; - m.allowDown = (Math.ceil(r.top) < Math.ceil(n.yMax)); - m.allowUp = (Math.ceil(r.top) > Math.ceil(n.yMin)); - m.allowRight = (Math.ceil(r.left) < Math.ceil(n.xMax)); - m.allowLeft = (Math.ceil(r.left) > Math.ceil(n.xMin)); - m.allowZoom = (l / this.contentFullSize.w < 1); - if (this.sett.fitToViewportShortSide) { - m.allowUnzoom = (l > this.$mivHol.width() && o > this.$mivHol.height()) - } else { - m.allowUnzoom = (l > this.$mivHol.width() || o > this.$mivHol.height()) - } - m.wPropViewpContent = this.$mivHol.width() / l; - m.hPropViewpContent = this.$mivHol.height() / o; - m.xPosInCenter = Math.round((-r.left + q.x) / p); - m.yPosInCenter = Math.round((-r.top + q.y) / p); - m.scale = p; - m.isScaled = this.isScaled - } - return m - }; - d.prototype.allowCompare = function (n, l) { - var m = true; - f.each(n, function (o) { - if (n[o] != l[o]) { - m = false; - return - } - }); - return m - }; - var k = function () { - this.step = 0.1; - this.curr = 1 - }; - k.prototype.getScale = function () { - return this.curr - }; - k.prototype.setScale = function (l) { - this.curr = l - }; - k.prototype.nextScale = function () { - var l = this.curr + this.step; - if (l > 1) { - this.curr = 1 - } else { - this.curr = l - } - return this.getScale() - }; - k.prototype.prevScale = function () { - var l = this.curr - this.step; - if (l < this.step) { - this.curr = 0 - } else { - this.curr = l - } - return this.getScale() - }; - var g = function (m, l, n) { - this.url = m; - this.$imgHolder = l; - this.callback = n - }; - g.prototype.loadStart = function () { - var l = f(""); - l.one("load", function (m) { - return function (n) { - m.loadComplete(n) - } - }(this)); - this.$imgHolder.prepend(l); - l.attr("src", this.url) - }; - g.prototype.loadComplete = function (l) { - if (this.callback) { - this.callback(f(l.currentTarget)) - } - }; - g.prototype.dispose = function () { - this.callback = null - }; - var b = function (n, o, l, m) { - this.contentLoader = null; - this.isTouchDev = m; - this.sett = n; - this.$mainHolder = o; - this.$previewImg = l; - this.$img = null; - this.$mapHol = null; - this.$mapWrappHol = null; - this.$vr = null; - this.lastMousePageCoor = {}; - this.contentLoadStartTimeout - }; - b.prototype.ini = function (l) { - this.$mapHol = f('
      '); - this.$mapWrappHol = f('
      '); - this.$mapHol.append(this.$mapWrappHol); - l.prepend(this.$mapHol); - this.contentLoader = new g(this.sett.mapThumb, this.$mapWrappHol, function (n) { - return function (o) { - n.start(o) - } - }(this)); - var m = this; - this.contentLoadStartTimeout = setTimeout(function () { - return function () { - m.contentLoader.loadStart() - } - }(), 10) - }; - b.prototype.start = function (m) { - var l = m.width(), - n = m.height(), - o; - this.$img = m; - this.$img.css({ - cursor: "pointer" - }); - this.$mapHol.addClass("lhp_miv_map_pos_" + this.sett.mapPos).css({ - width: l, - height: n - }); - this.$mapWrappHol.addClass("lhp_miv_map_wrapp_hol_" + this.sett.mapPos).css({ - width: l, - height: n - }); - switch (this.sett.mapPos) { - case "T": - case "B": - this.$mapHol.css("margin-left", - l / 2); - break; - case "L": - case "R": - this.$mapHol.css("margin-top", - n / 2); - break - } - this.$mapWrappHol.append(this.$img); - this.$vr = f('
      ').css({ - position: "absolute", - "z-index": 2 - }).appendTo(this.$mapWrappHol); - this.vrAddInteractions(); - this.$mainHolder.bind("mivChange.lhpMIV", { - _this: this - }, this.mivChangeHandler); - o = this.$mainHolder.lhpMegaImgViewer("getCurrentState"); - o.data = {}; - o.data._this = this; - this.mivChangeHandler(o) - }; - b.prototype.destroy = function () { - clearTimeout(this.contentLoadStartTimeout); - this.$vr.unbind(".lhpMIV"); - this.$mapHol.unbind(".lhpMIV"); - this.$img.unbind(".lhpMIV"); - this.contentLoader.dispose(); - this.contentLoader = null - }; - b.prototype.vrAddInteractions = function () { - this.$vr.bind("mouseenter.lhpMIV", { - _this: this - }, this.mouseenterHandler); - if (this.isTouchDev) { - this.$vr.bind("touchstart.lhpMIV", { - _this: this - }, this.mousedownHandler); - this.$vr.bind("touchend.lhpMIV", { - _this: this - }, this.mouseupHandler); - this.$img.bind("touchstart.lhpMIV", { - _this: this - }, this.mouseclickHandler) - } else { - this.$vr.bind("mousedown.lhpMIV", { - _this: this - }, this.mousedownHandler); - this.$mapHol.bind("mouseup.lhpMIV", { - _this: this - }, this.mouseupHandler); - this.$mapHol.bind("mouseleave.lhpMIV", { - _this: this - }, this.mouseupHandler); - this.$img.bind("click.lhpMIV", { - _this: this - }, this.mouseclickHandler) - } - }; - b.prototype.mouseenterHandler = function (l) { - l.data._this.$vr.css("cursor", "url(css/lhp_miv/cursorHand.png),default") - }; - b.prototype.mousedownHandler = function (l) { - var m = l.data._this; - m.$mainHolder.unbind("mivChange.lhpMIV", m.mivChangeHandler); - if (m.isTouchDev) { - m.$mapHol.unbind("touchmove.lhpMIV", m.mousemoveHandler).bind("touchmove.lhpMIV", { - _this: m - }, m.mousemoveHandler) - } else { - m.$mapHol.unbind("mousemove.lhpMIV", m.mousemoveHandler).bind("mousemove.lhpMIV", { - _this: m - }, m.mousemoveHandler) - } - m.$vr.unbind("mouseenter.lhpMIV", m.mouseenterHandler); - m.lastMousePageCoor = m.mousePageCoor(l); - m.$vr.css("cursor", "url(css/lhp_miv/cursorDrag.png), move").addClass("lhp_miv_map_vr_over"); - l.preventDefault() - }; - b.prototype.mousemoveHandler = function (l) { - var m = l.data._this; - if (m.isTouchDev) { - m.$mapHol.unbind({ - "touchend.lhpMIV": m.stopDraggingHandler - }).bind("touchend.lhpMIV", { - _this: m - }, m.stopDraggingHandler) - } else { - m.$mapHol.unbind({ - "mouseup.lhpMIV": m.stopDraggingHandler - }).bind("mouseup.lhpMIV", { - _this: m - }, m.stopDraggingHandler); - m.$mapHol.unbind({ - "mouseleave.lhpMIV": m.stopDraggingHandler - }).bind("mouseleave.lhpMIV", { - _this: m - }, m.stopDraggingHandler) - } - m.dragging(l); - l.preventDefault() - }; - b.prototype.mouseupHandler = function (l) { - var m = l.data._this; - m.$mapHol.unbind("touchmove.lhpMIV", m.mousemoveHandler); - m.$mapHol.unbind("mousemove.lhpMIV", m.mousemoveHandler); - m.$vr.unbind("mouseenter.lhpMIV", m.mouseenterHandler).bind("mouseenter.lhpMIV", { - _this: m - }, m.mouseenterHandler); - m.$mainHolder.unbind("mivChange.lhpMIV", m.mivChangeHandler).bind("mivChange.lhpMIV", { - _this: m - }, m.mivChangeHandler); - m.$vr.css("cursor", "url(css/lhp_miv/cursorHand.png),default").removeClass("lhp_miv_map_vr_over") - }; - b.prototype.mouseclickHandler = function (o) { - var q = o.data._this, - m = q.mousePageCoor(o), - n = q.$mapHol.offset(), - l = (m.x - n.left) * q.sett.mainImgWidth / q.$mapWrappHol.width(), - p = (m.y - n.top) * q.sett.mainImgHeight / q.$mapWrappHol.height(); - q.$mainHolder.lhpMegaImgViewer("setPosition", l, p) - }; - b.prototype.dragging = function (r) { - var m = this.mousePageCoor(r), - n = m.x - this.lastMousePageCoor.x, - l = m.y - this.lastMousePageCoor.y, - s = this.$vr.position(), - q = s.left + n, - o = s.top + l, - p = this.getSafeTarget(q, o, n, l); - this.$vr.css({ - left: p.x, - top: p.y - }); - this.lastMousePageCoor = m; - this.mainHolderSetPosition(p.x, p.y) - }; - b.prototype.stopDraggingHandler = function (l) { - var m = l.data._this; - m.$mapHol.unbind({ - "touchend.lhpMIV": m.stopDraggingHandler - }); - m.$mapHol.unbind({ - "mouseup.lhpMIV": m.stopDraggingHandler - }); - m.$mapHol.unbind({ - "mouseleave.lhpMIV": m.stopDraggingHandler - }) - }; - b.prototype.mousePageCoor = function (m) { - var l = { - x: m.pageX, - y: m.pageY - }; - m = m.originalEvent; - if (this.isTouchDev && m) { - l.x = m.changedTouches[0].pageX; - l.y = m.changedTouches[0].pageY - } - return l - }; - b.prototype.getSafeTarget = function (q, p, n, m) { - var o = 0, - l = 0, - s = this.$mapWrappHol.width() - this.$vr.width(), - r = this.$mapWrappHol.height() - this.$vr.height(); - if ((m < 0) && (p < l)) { - p = l - } else { - if ((m > 0) && (p > r)) { - p = r - } - } - if ((n < 0) && (q < o)) { - q = o - } else { - if ((n > 0) && (q > s)) { - q = s - } - } - return { - x: q, - y: p - } - }; - b.prototype.mainHolderSetPosition = function (n, m) { - var l = (n + this.$vr.width() / 2) * this.sett.mainImgWidth / this.$mapWrappHol.width(), - o = (m + this.$vr.height() / 2) * this.sett.mainImgHeight / this.$mapWrappHol.height(); - this.$mainHolder.lhpMegaImgViewer("setPosition", l, o, null, true) - }; - b.prototype.mivChangeHandler = function (q) { - var s = q.data._this, - m = s.$mapWrappHol.width(), - p = s.$mapWrappHol.height(), - r = Math.round(m * ((q.wPropViewpContent > 1) ? 1 : q.wPropViewpContent)), - l = Math.round(p * ((q.hPropViewpContent > 1) ? 1 : q.hPropViewpContent)), - o = Math.round((m / s.sett.mainImgWidth) * q.xPosInCenter - (r / 2)), - n = Math.round((p / s.sett.mainImgHeight) * q.yPosInCenter - (l / 2)); - s.$vr.css({ - width: r, - height: l, - left: o, - top: n - }) - }; - var a = function (q, p, l, n, o, m) { - this.$mainHolder = q; - this.$contentHol = p; - this.containerId = l; - this.mClass = "lhp_miv_hotspot"; - this.mInnClass = "lhp_miv_marker"; - this.pClass = "lhp_miv_popup"; - this.isTouchDev = n; - this.markers = []; - this.popups = []; - this.currShowPopup = null; - this.popupShowAction = o; - this.startScale = m - }; - a.prototype.ini = function () { - var m = this, - l; - f("#" + this.containerId).find("." + this.mClass).each(function () { - m.addMarker(f(this).clone(true, true)) - }); - this.$mainHolder.bind("mivChange.lhpMIV", { - _this: this - }, this.mivChangeHandler); - if (this.startScale == 1) { - this.positionsMarkers(1) - } - }; - a.prototype.destroy = function () { - var l; - for (l in this.markers) { - this.markers[l].destroy() - } - for (l in this.popups) { - this.popups[l].destroy() - } - this.$mainHolder = null; - this.$contentHol = null; - this.markers = null; - this.popups = null - }; - a.prototype.addMarker = function (t) { - var o = 0, - u = 0, - s = 0, - r = 0, - l, q, m, n; - if (t.attr("data-id")) { - o = t.attr("data-id") - } - if (t.attr("data-x")) { - u = parseInt(t.attr("data-x")) - } - if (t.attr("data-y")) { - s = parseInt(t.attr("data-y")) - } - if (t.attr("data-visible-scale")) { - r = parseFloat(t.attr("data-visible-scale")) - } - if (t.attr("data-url")) { - l = t.attr("data-url") - } - n = t.find("." + this.pClass).remove()[0]; - this.$contentHol.append(t); - q = new i(this, o, u, s, r, l, t); - this.markers.push(q); - if (n) { - this.$contentHol.append(n); - m = new j(o, f(n), q); - m.ini(); - this.popups.push(m); - q.popup = m - } - q.ini() - }; - a.prototype.mivChangeHandler = function (l) { - var m = l.data._this; - if (l.isScaled) { - m.positionsMarkers(l.scale); - m.positionsPopup() - } else { - m.positionsPopup() - } - }; - a.prototype.positionsMarkers = function (n) { - var m, l; - for (m in this.markers) { - l = this.markers[m]; - l.positions(n); - l.visibility(n) - } - }; - a.prototype.positionsPopup = function () { - if (this.currShowPopup) { - this.currShowPopup.positions() - } - }; - a.prototype.getLimit = function () { - var p = this.$contentHol.position(), - m = -p.left, - o = m + this.$mainHolder.width(), - l = -p.top, - n = l + this.$mainHolder.height(); - return { - xMin: m, - xMax: o, - yMin: l, - yMax: n - } - }; - a.prototype.showPopup = function (l) { - if (!this.currShowPopup) { - this.currShowPopup = l; - this.currShowPopup.show(); - this.currShowPopup.positions(); - return - } - if (this.currShowPopup && this.currShowPopup != l) { - this.hidePopup(this.currShowPopup); - this.currShowPopup = l; - this.currShowPopup.show(); - this.currShowPopup.positions() - } - }; - a.prototype.hidePopup = function (l) { - if (this.currShowPopup && this.currShowPopup == l) { - this.currShowPopup.hide(); - this.currShowPopup = null - } - }; - var i = function (p, r, l, q, o, m, n) { - this.markers = p; - this.id = r; - this.x = l; - this.y = q; - this.visibleScale = o; - this.url = m; - this.$m = n; - this.visible = false; - this.popup = null; - this.popupClose = null - }; - i.prototype.ini = function () { - this.style(); - this.positions(1); - if (this.url) { - this.addInteractivityUrl() - } - if (this.popup) { - this.popupClose = this.popup.addClose(); - this.addPopupAction() - } else { - if (this.markers.popupShowAction == "rollover") { - this.addPopupActionNull() - } - } - }; - i.prototype.destroy = function () { - this.getInn().unbind(".lhpMIV"); - if (this.popup) { - this.popupClose.unbind(".lhpMIV"); - this.popupClose = null; - this.popup = null - } - this.$m = null; - this.markers = null - }; - i.prototype.getInn = function () { - return this.$m.find("." + this.markers.mInnClass) - }; - i.prototype.getSize = function () { - return { - w: this.getInn().width(), - h: this.getInn().height() - } - }; - i.prototype.getEdges = function () { - return this.findEdges() - }; - i.prototype.findEdges = function () { - var q = this.getInn().offset(), - n = this.markers.$mainHolder.offset(), - u = this.markers.$contentHol.position(), - x = u.left, - p = u.top, - v = this.getSize(), - o = q.left - x - n.left, - m = o + v.w, - w = q.top - p - n.top, - s = w + v.h; - return ({ - L: o, - R: m, - T: w, - B: s - }) - }; - i.prototype.getLimit = function () { - return this.markers.getLimit() - }; - i.prototype.style = function () { - var l = { - position: "absolute", - "z-index": "2", - display: "none" - }; - this.$m.css(l); - this.$m.css("height", this.$m.height()) - }; - i.prototype.positions = function (m) { - var l = Math.round(this.x * m), - n = Math.round(this.y * m); - this.$m.css({ - left: l, - top: n - }) - }; - i.prototype.visibility = function (l) { - if (l >= this.visibleScale) { - if (!this.visible) { - this.$m.stop(true, true).fadeIn(300) - } - this.visible = true - } else { - if (this.visible) { - this.$m.fadeOut(300) - } - this.visible = false; - this.markers.hidePopup(this.popup) - } - }; - i.prototype.addInteractivityUrl = function () { - this.getInn().css("cursor", "pointer"); - this.getInn().bind(((this.markers.isTouchDev) ? "touchstart.lhpMIV" : "mousedown.lhpMIV"), { - _this: this - }, this.clickHandlerUrl) - }; - i.prototype.clickHandlerUrl = function (l) { - var m = l.data._this; - if (m.url) { - window.location = m.url - } - l.stopPropagation() - }; - i.prototype.addPopupAction = function () { - if (this.markers.popupShowAction == "click") { - this.getInn().bind(((this.markers.isTouchDev) ? "touchstart.lhpMIV" : "mousedown.lhpMIV"), { - _this: this - }, this.showPopup); - this.getInn().css("cursor", "pointer") - } else { - this.getInn().bind(((this.markers.isTouchDev) ? "touchstart.lhpMIV" : "mouseenter.lhpMIV"), { - _this: this - }, this.showPopup) - } - this.popupClose.bind(((this.markers.isTouchDev) ? "touchstart.lhpMIV" : "mousedown.lhpMIV"), { - _this: this - }, this.hidePopup) - }; - i.prototype.addPopupActionNull = function () { - this.getInn().bind(((this.markers.isTouchDev) ? "touchstart.lhpMIV" : "mouseenter.lhpMIV"), { - _this: this - }, this.showPopup) - }; - i.prototype.showPopup = function (l) { - var m = l.data._this; - m.markers.showPopup(m.popup); - l.stopPropagation() - }; - i.prototype.hidePopup = function (l) { - var m = l.data._this; - m.markers.hidePopup(m.popup); - l.stopPropagation() - }; - var j = function (n, m, l) { - this.id = n; - this.$p = m; - this.marker = l; - this.posHor = this.posHC; - this.posVer = this.posVT; - this.$closeHolder = null - }; - j.prototype.ini = function () { - if (this.$p.hasClass("pos-TL")) { - this.posHor = this.posHL; - this.posVer = this.posVT - } else { - if (this.$p.hasClass("pos-T")) { - this.posHor = this.posHC; - this.posVer = this.posVT - } else { - if (this.$p.hasClass("pos-TR")) { - this.posHor = this.posHR; - this.posVer = this.posVT - } else { - if (this.$p.hasClass("pos-L")) { - this.posHor = this.posHL; - this.posVer = this.posVC - } else { - if (this.$p.hasClass("pos-R")) { - this.posHor = this.posHR; - this.posVer = this.posVC - } else { - if (this.$p.hasClass("pos-BL")) { - this.posHor = this.posHL; - this.posVer = this.posVB - } else { - if (this.$p.hasClass("pos-B")) { - this.posHor = this.posHC; - this.posVer = this.posVB - } else { - if (this.$p.hasClass("pos-BR")) { - this.posHor = this.posHR; - this.posVer = this.posVB - } - } - } - } - } - } - } - } - this.style(); - this.positions(1) - }; - j.prototype.destroy = function () { - this.$p = null; - this.marker = null - }; - j.prototype.style = function () { - var l = { - display: "none", - position: "absolute", - "z-index": "3" - }; - this.$p.css(l); - this.$p.css("height", this.$p.height()) - }; - j.prototype.addClose = function () { - this.$closeHolder = f('
      '); - this.$closeHolder.hover(function () { - f(this).css("opacity", 0.7) - }, function () { - f(this).css("opacity", 1) - }); - this.$p.append(this.$closeHolder); - return this.$closeHolder - }; - j.prototype.getSize = function () { - return { - w: this.$p.width(), - h: this.$p.height() - } - }; - j.prototype.positions = function () { - var m = this.marker.getEdges(), - l = this.posHor(m), - q = this.posVer(m), - o = this.marker.getLimit(), - n = this.$p.width(), - p = this.$p.height(); - if (l < o.xMin) { - l = o.xMin - } else { - if (l + n > o.xMax) { - l = o.xMax - n - } - } - if (q < o.yMin) { - q = o.yMin - } else { - if (q + p > o.yMax) { - q = o.yMax - p - } - } - this.$p.css({ - left: l, - top: q - }) - }; - j.prototype.posVT = function (l) { - return Math.round(l.T) - this.$p.height() - }; - j.prototype.posVC = function (l) { - return Math.round(l.T + (l.B - l.T) / 2) - this.$p.height() / 2 - }; - j.prototype.posVB = function (l) { - return Math.round(l.B) - }; - j.prototype.posHL = function (l) { - return Math.round(l.L) - this.$p.width() - }; - j.prototype.posHC = function (l) { - return Math.round(l.L + (l.R - l.L) / 2) - this.$p.width() / 2 - }; - j.prototype.posHR = function (l) { - return Math.round(l.R) - }; - j.prototype.show = function () { - this.$p.fadeIn(300) - }; - j.prototype.hide = function () { - this.$p.stop().clearQueue().fadeOut(100) - } -})(jQuery); \ No newline at end of file diff --git a/NzbDrone.Web/Content2/SmothZoomPan/smothzoompan.js b/NzbDrone.Web/Content2/SmothZoomPan/smothzoompan.js deleted file mode 100644 index 9306e9006..000000000 --- a/NzbDrone.Web/Content2/SmothZoomPan/smothzoompan.js +++ /dev/null @@ -1,2451 +0,0 @@ -/* - Smooth Zoom Pan - jQuery Image Viewer - Copyright (c) 2011-12 Ramesh Kumar - http://codecanyon.net/user/VF - - Version: 1.6.7 - RELEASE: 09 SEP 2011 - UPDATE: 27 SEP 2012 - - Built using: - jQuery version:1.7.1 http://jquery.com/ - Modernizr version:2.5.3 http://www.modernizr.com/ - MouseWheel version:3.0.6 http://brandonaaron.net/code/mousewheel/docs - -*/ - -(function ($, window, document) { - - /***************************************************************************** - Default settings: - For detailed description of individual parameters, see the help document - ******************************************************************************/ - var defaults = { - - width: '', //Width of the view area [480, '480px', '100%'] - height: '', //Height of the view area [480, '480px', '100%'] - - initial_ZOOM: '', //Initial zoom level to start with (in percentage) [100] - initial_POSITION: '', //Initial location to be focused in pixel value [150,150 or 150 150] - - animation_SMOOTHNESS: 5.5, //Ease or smoothness of all movements [Any number from 0] - animation_SPEED_ZOOM: 5.5, //Speed of zoom movements [Any number from 0] - animation_SPEED_PAN: 5.5, //Speed of pan movements [Any number from 0] - - zoom_MAX: 800, //Maximum limit for zooming (in percentage) - zoom_MIN: '', //Minimum limit for zooming (in percentage) - zoom_SINGLE_STEP: false, //To reach maximum and minimum zoom levels in single click - zoom_OUT_TO_FIT: true, //To allow image to be zoomed out with whitespace on sides - zoom_BUTTONS_SHOW: true, //To enable/disable the + and - buttons - - pan_BUTTONS_SHOW: true, //To enable/disable the arrow and reset buttons - pan_LIMIT_BOUNDARY: true, //To allow/restrict moving the image beyond boundaries - pan_REVERSE: false, - - reset_ALIGN_TO: 'center center', //Image can be aligned to desired position on reset. Example: 'Top Left' - reset_TO_ZOOM_MIN: true, //How it should behave if zoom_MIN value set and while clicking reset button, - - button_SIZE: 18, //Button width and height (in pixels) - button_SIZE_TOUCH_DEVICE: 30, //Button width and height (in pixels) on touch devices - button_COLOR: '#FFFFFF', //Button color in hexadecimal - button_BG_COLOR: '#000000', //Button set's background color in hexadecimal - button_BG_TRANSPARENCY: 55, //Background transparency (in percentage) - button_AUTO_HIDE: false, //To hide the button set when mouse moved outside the view area - button_AUTO_HIDE_DELAY: 1, //Auto hide delay time in seconds - button_ALIGN: 'bottom right', //Button set can be aligned to any side or center - button_MARGIN: 10, //Space between button set and view port's edge - button_ROUND_CORNERS: true, //To enable disable roundness of button corner - - touch_DRAG: true, //Enable/disable the dragability of image (touch) - mouse_DRAG: true, //Enable/disable the dragability of image (mouse) - mouse_WHEEL: true, //Enable/disable mousewheel zoom - mouse_WHEEL_CURSOR_POS: true, //Enable/disable position sensitive mousewheel zoom - mouse_DOUBLE_CLICK: true, //Enable/disable zoom action with double click - - background_COLOR: '#FFFFFF', //Background colour of image container - border_SIZE: 1, //Border size of view area - border_COLOR: '#000000', //Border color of view area - border_TRANSPARENCY: 10, //Border transparency of view area - - image_url: '', //Set url or image to be zoomed - image_original_width: '', //Original width of main image - image_original_height: '', //Original height of main image - container: '', //Set container element of image (id of container) - - on_IMAGE_LOAD: '', //To Call external function immediatly after image loaded - on_ZOOM_PAN_UPDATE: '', //To Call external function for each zoom, pan animation frame - on_ZOOM_PAN_COMPLETE: '', //To Call external function whenever zoom, pan animation completes - on_LANDMARK_STATE_CHANGE: '', //To Call external function whenever the zoom leval crosses global "data-show-at-zoom" value - - use_3D_Transform: true, //To enable / disable Hardware acceleration on webkit browsers - - responsive: false, //To enable / disable Responsive / fluid layout - responsive_maintain_ratio: true, //To maintain view area width/height ratio or not - max_WIDTH: '', //Maximum allowed width of view area (helpful when 'width' parameter set with % and need limit) - max_HEIGHT: '' //Maximum allowed height of view area (helpful when 'height' parameter set with % and need limit) - }; - - function Zoomer($elem, params) { - - var self = this; - this.$elem = $elem; - var op = $.extend({}, defaults, params); - - /********************************************************** - Option values verified and formated if needed - **********************************************************/ - this.sW = op.width; - this.sH = op.height; - - this.init_zoom = op.initial_ZOOM / 100; - this.init_pos = op.initial_POSITION.replace(/,/g, ' ').replace(/\s{2,}/g, ' ').split(' '); - - this.zoom_max = op.zoom_MAX / 100; - this.zoom_min = op.zoom_MIN / 100; - - this.zoom_single = checkBoolean(op.zoom_SINGLE_STEP); - this.zoom_fit = checkBoolean(op.zoom_OUT_TO_FIT); - this.zoom_speed = 1 + (((op.animation_SPEED === 0 || op.animation_SPEED ? op.animation_SPEED : op.animation_SPEED_ZOOM) + 1) / 20); - this.zoom_show = checkBoolean(op.zoom_BUTTONS_SHOW); - - this.pan_speed_o = (op.animation_SPEED === 0 || op.animation_SPEED ? op.animation_SPEED : op.animation_SPEED_PAN); - this.pan_show = checkBoolean(op.pan_BUTTONS_SHOW); - this.pan_limit = checkBoolean(op.pan_LIMIT_BOUNDARY); - this.pan_rev = checkBoolean(op.pan_REVERSE); - - this.reset_align = op.reset_ALIGN_TO.toLowerCase().split(' '); - this.reset_to_zmin = checkBoolean(op.reset_TO_ZOOM_MIN); - - if (supportsTouch) { - this.bu_size = parseInt(op.button_SIZE_TOUCH_DEVICE / 2) * 2; - } else { - this.bu_size = parseInt(op.button_SIZE / 2) * 2; - } - this.bu_color = op.button_COLOR; - this.bu_bg = op.button_BG_COLOR; - this.bu_bg_alpha = op.button_BG_TRANSPARENCY / 100; - this.bu_icon = op.button_ICON_IMAGE; - this.bu_auto = checkBoolean(op.button_AUTO_HIDE); - - this.bu_delay = op.button_AUTO_HIDE_DELAY * 1000; - this.bu_align = op.button_ALIGN.toLowerCase().split(' '); - this.bu_margin = op.button_MARGIN; - this.bu_round = checkBoolean(op.button_ROUND_CORNERS); - - this.touch_drag = checkBoolean(op.touch_DRAG); - this.mouse_drag = checkBoolean(op.mouse_DRAG); - this.mouse_wheel = checkBoolean(op.mouse_WHEEL); - this.mouse_wheel_cur = checkBoolean(op.mouse_WHEEL_CURSOR_POS); - this.mouse_dbl_click = checkBoolean(op.mouse_DOUBLE_CLICK); - - this.ani_smooth = Math.max(1, (op.animation_SMOOTHNESS + 1) / 1.45); - - this.bg_color = op.background_COLOR; - this.bord_size = op.border_SIZE; - this.bord_color = op.border_COLOR; - this.bord_alpha = op.border_TRANSPARENCY / 100; - - this.container = op.container; - this.image_url = op.image_url; - this.image_width = op.image_original_width; - this.image_height = op.image_original_height; - - this.responsive = checkBoolean(op.responsive); - this.maintain_ratio = checkBoolean(op.responsive_maintain_ratio); - this.w_max = op.max_WIDTH; - this.h_max = op.max_HEIGHT; - - this.onLOAD = op.on_IMAGE_LOAD; - this.onUPDATE = op.on_ZOOM_PAN_UPDATE; - this.onZOOM_PAN = op.on_ZOOM_PAN_COMPLETE; - this.onLANDMARK = op.on_LANDMARK_STATE_CHANGE; - - /*********************************************************** - Variables for inner operation. - x, y, width, height and scale value of image - ***********************************************************/ - this._x; - this._y; - this._w; - this._h; - this._sc = 0; - - this.rA = 1; - this.rF = 1; - this.rR = 1; - this.iW = 0; - this.iH = 0; - this.tX = 0; - this.tY = 0; - this.oX = 0; - this.oY = 0; - this.fX = 0; - this.fY = 0; - this.dX = 0; - this.dY = 0; - this.cX = 0; - this.cY = 0; - - this.transOffX = 0; - this.transOffY = 0; - this.focusOffX = 0; - this.focusOffY = 0; - this.offX = 0; - this.offY = 0; - - /*********************************************************** - Flags that convey current states and events - ***********************************************************/ - this._playing = false; - this._dragging = false; - this._onfocus = false; - this._moveCursor = false; - this._wheel = false; - this._recent = 'zoomOut'; - this._pinching = false; - this._landmark = false; - this._rA; - this._centx; - this._centy; - this._onButton = false; - this._onHitArea = false; - this.cFlag = { - _zi: false, - _zo: false, - _ml: false, - _mr: false, - _mu: false, - _md: false, - _rs: false, - _nd: false - }; - - /*********************************************************** - Elements and arrays that references elements - ***********************************************************/ - this.$holder; - this.$hitArea; - this.$controls; - this.$loc_cont; - this.map_coordinates = []; - this.locations = []; - this.buttons = []; - this.border = []; - - /*********************************************************** - miscellaneous - ***********************************************************/ - this.buttons_total = 7; - this.cButtId = 0; - this.pan_speed; - this.auto_timer; - this.ani_timer; - this.ani_end; - this.focusSpeed = this.reduction = .5; - this.orig_style; - this.mapAreas; - this.icons; - this.show_at_zoom; - this.assetsLoaded = false; - this.zStep = 0; - this.sRed = 300; - this.use3D = op.use_3D_Transform && supportsTrans3D; - - if (supportsTouch) { - this.event_down = 'touchstart.sz'; - this.event_up = 'touchend.sz'; - this.event_move = 'touchmove.sz'; - } else { - this.event_down = 'mousedown.sz'; - this.event_up = 'mouseup.sz'; - this.event_move = 'mousemove.sz'; - } - - //Case 1: Image specificed (possibly) through img tag: - if (this.image_url == '') { - this.$image = $elem; - this.id = this.$image.attr('id'); - - //Case 2: Image url specificed through parameter: - } else { - var img = new Image(); - if (this.image_width) { - img.width = this.image_width; - } - if (this.image_height) { - img.height = this.image_height; - } - img.src = this.image_url; - this.$image = $(img).appendTo($elem); - } - - - //Prepare container div (Basically the element that masks image with overflow hidden) - this.setContainer(); - - //Get button icon image's url - var testOb; - if (!this.bu_icon) { - var regx = /url\(["']?([^'")]+)['"]?\)/; - testOb = $('
      '); - this.$holder.append(testOb); - this.bu_icon = testOb.css("background-image").replace(regx, '$1'); - if (this.bu_icon == 'none') { - this.bu_icon = 'zoom_assets/icons.png'; - } - testOb.remove(); - } - - //Firefox feature checkup - if (this.$image.css('-moz-transform') && prop_transform) { - testOb = $('
      '); - this.$holder.append(testOb); - this.fixMoz = testOb.position().left === 1 ? false : true; - testOb.remove(); - } else { - this.fixMoz = false; - } - - //Preload icons and main image. - this.$image.hide(); - this.imgList = [ - { loaded: false, src: this.bu_icon || 'zoom_assets/icons.png' }, //Icon image - { loaded: false, src: this.image_url == '' ? this.$image.attr('src') : this.image_url } // Main image - ]; - - $.each(this.imgList, function (i) { - var _img = new Image(); - $(_img).bind('load', { id: i, self: self }, self.loadComplete) - .bind('error', { id: i, self: self }, self.loadComplete); //Allow initiation even if image is not there :( - _img.src = self.imgList[i].src; - }); - - } - - Zoomer.prototype = { - - /*Preload the icon and main image - *********************************************************************************************************************/ - loadComplete: function (e) { - var self = e.data.self, - complete = true; - - self.imgList[e.data.id].loaded = true; - for (var j = 0; j < self.imgList.length; j++) { - if (!self.imgList[j].loaded) { - complete = false; - } - } - if (complete) { - self.assetsLoaded = true; - if (self.onLOAD !== '') { - self.onLOAD(); - } - - //Assets loaded, initiate plugin - self.init(); - } - }, - - - /*Initiate after assets loaded - ***********************************************************************************************************************/ - init: function () { - var self = this, - $image = self.$image, - sW = self.sW, - sH = self.sH, - container = self.container, - cBW, cBH, pan_show = self.pan_show, - zoom_show = self.zoom_show, - $controls = self.$controls, - buttons = self.buttons, - cFlag = self.cFlag, - bu_align = self.bu_align, - bu_margin = self.bu_margin, - $holder = self.$holder; - - //Store the default image properties so that it can be reverted back when plugin needs to be destroyed - self.orig_style = self.getStyle(); - - //IE 6 Image tool bar disabled - $image.attr('galleryimg', 'no'); - - if (!navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad)/)) { - $image.removeAttr('width'); - $image.removeAttr('height'); - } - - //In case parent element's display property set to 'none', we need to first set them 'block', measure the width and height and then set them back to 'none' - var temp = $image, - dispArray = []; - for (var i = 0; i < 5; i++) { - if (temp && temp[0].tagName !== 'BODY' && temp[0].tagName !== 'HTML') { - if (temp.css('display') == 'none') { - temp.css('display', 'block'); - dispArray.push(temp); - } - temp = temp.parent(); - } else { - break; - } - } - - self.iW = $image.width(); - self.iH = $image.height(); - - for (var i = 0; i < dispArray.length; i++) { - dispArray[i].css('display', 'none'); - } - - //Initially the image needs to be resized to fit container. To do so, first measure the scaledown ratio - self.rF = self.rR = self.checkRatio(sW, sH, self.iW, self.iH, self.zoom_fit); - - //If NO Minimum zoom value set - if (self.zoom_min == 0 || self.init_zoom != 0) { - if (self.init_zoom != '') { - self.rA = self._sc = self.init_zoom; - } else { - self.rA = self._sc = self.rF; - } - if (self.zoom_min != 0) { - self.rF = self.zoom_min; - } - - //If Minimum zoom value set - } else { - if (self.rF < self.zoom_min) { - self.rF = self.zoom_min; - if (self.reset_to_zmin) { - self.rR = self.zoom_min - } - self.rA = self._sc = self.zoom_min; - } else { - self.rA = self._sc = self.rR; - } - } - - //Width and Height to be applied to the image - self._w = self._sc * self.iW; - self._h = self._sc * self.iH; - - //Resize the image and position it centered inside the wrapper - if (self.init_pos == '') { - self._x = self.tX = (sW - self._w) / 2; - self._y = self.tY = (sH - self._h) / 2; - } else { - self._x = self.tX = (sW / 2) - parseInt(self.init_pos[0]) * self._sc; - self._y = self.tY = (sH / 2) - parseInt(self.init_pos[1]) * self._sc; - self.oX = (self.tX - ((sW - self._w) / 2)) / (self._w / sW); - self.oY = (self.tY - ((sH - self._h) / 2)) / (self._h / sH); - } - - if ((!self.pan_limit || self._moveCursor || self.init_zoom != self.rF) && self.mouse_drag) { - $image.css('cursor', 'move'); - self.$hitArea.css('cursor', 'move'); - } - - if ($.browser.mozilla && supportsTrans3D) { - $image.css('opacity', 0); - } - - if (prop_transform) { - self.$image.css(prop_origin, '0 0'); - } - if (self.use3D) { - $image.css({ - '-webkit-backface-visibility': 'hidden', - '-webkit-perspective': 1000 - }); - } - - //Start displaying the image - $image.css({ - position: 'absolute', - 'z-index': 2, - left: '0px', - top: '0px', - '-webkit-box-shadow': '1px 1px rgba(0,0,0,0)' - }) - .hide() - .fadeIn(500, function () { - $holder.css('background-image', 'none'); - if ($.browser.mozilla && supportsTrans3D) { - $image.css('opacity', 1); - } - }); - - //Create Control buttons and events - var self = self, - bs = self.bu_size, - iSize = 50, - sDiff = 2, - bSpace = 3, - mSize = Math.ceil(self.bu_size / 4), - iconOff = bs < 16 ? 50 : 0, - bsDiff = bs - sDiff; - - //Show all buttons - if (pan_show) { - if (zoom_show) { - cBW = parseInt(bs + (bs * .85) + (bsDiff * 3) + (bSpace * 2) + (mSize * 2)); - } else { - cBW = parseInt((bsDiff * 3) + (bSpace * 2) + (mSize * 2)); - } - cBH = parseInt((bsDiff * 3) + (bSpace * 2) + (mSize * 2)); - - //Show zoom buttons only - } else { - if (zoom_show) { - cBW = parseInt(bs + mSize * 2); - cBH = parseInt(bs * 2 + mSize * 3); - cBW = parseInt(cBW / 2) * 2; - cBH = parseInt(cBH / 2) * 2; - } else { - cBW = 0; - cBH = 0; - } - } - - var pOff = (iSize - bs) / 2, - resetCenterX = cBW - ((bs - (pan_show ? sDiff : 0)) * 2) - mSize - bSpace, - resetCenterY = (cBH / 2) - ((bs - (pan_show ? sDiff : 0)) / 2); - - var hProp, vProp, hVal, vVal; - //Align button set as per settings - if (bu_align[0] == 'top') { - vProp = 'top'; - vVal = bu_margin; - } else if (bu_align[0] == 'center') { - vProp = 'top'; - vVal = parseInt((sH - cBH) / 2); - } else { - vProp = 'bottom'; - vVal = bu_margin; - } - if (bu_align[1] == 'right') { - hProp = 'right'; - hVal = bu_margin; - } else if (bu_align[1] == 'center') { - hProp = 'right'; - hVal = parseInt((sW - cBW) / 2); - } else { - hProp = 'left'; - hVal = bu_margin; - } - - //Buttons Container - $controls = $( - '
      \ -
      \ -
      \ -
      ' - ); - - $holder.append($controls); - var $controlsBg = $controls.find('.controlsBg'); - - //Make the corners rounded - if (self.bu_round) { - if (prop_radius) { - $controlsBg - .css(prop_radius, (iconOff > 0 ? 4 : 5) + 'px') - .css('background-color', self.bu_bg); - } else { - self.roundBG( - $controlsBg, - 'cBg', - cBW, - cBH, - iconOff > 0 ? 4 : 5, - 375, - self.bu_bg, - self.bu_icon, - 1, - iconOff ? 50 : 0 - ); - } - } else { - $controlsBg.css('background-color', self.bu_bg); - } - - $controlsBg.css('opacity', self.bu_bg_alpha); - - //Generating Button properties (7 buttons) - buttons[0] = { - _var: '_zi', - l: mSize, - t: pan_show ? (cBH - (bs * 2) - (bSpace * 2) + 2) / 2 : mSize, - w: bs, - h: bs, - bx: -pOff, - by: -pOff - iconOff - }; - - buttons[1] = { - _var: '_zo', - l: mSize, - t: pan_show ? ((cBH - (bs * 2) - (bSpace * 2) + 2) / 2) + bs + (bSpace * 2) - 2 : cBH - bs - mSize, - w: bs, - h: bs, - bx: -iSize - pOff, - by: -pOff - iconOff - }; - - buttons[2] = { - _var: self.pan_rev ? '_ml' : '_mr', - l: resetCenterX - bsDiff - bSpace, - t: resetCenterY, - w: bsDiff, - h: bsDiff, - bx: -(sDiff / 2) - iSize * 2 - pOff, - by: -(sDiff / 2) - pOff - iconOff - }; - - buttons[3] = { - _var: self.pan_rev ? '_mr' : '_ml', - l: resetCenterX + bsDiff + bSpace, - t: resetCenterY, - w: bsDiff, - h: bsDiff, - bx: -(sDiff / 2) - iSize * 3 - pOff, - by: -(sDiff / 2) - pOff - iconOff - }; - - buttons[4] = { - _var: self.pan_rev ? '_md' : '_mu', - l: resetCenterX, - t: resetCenterY + bsDiff + bSpace, - w: bsDiff, - h: bsDiff, - bx: -(sDiff / 2) - iSize * 4 - pOff, - by: -(sDiff / 2) - pOff - iconOff - }; - - buttons[5] = { - _var: self.pan_rev ? '_mu' : '_md', - l: resetCenterX, - t: resetCenterY - bsDiff - bSpace, - w: bsDiff, - h: bsDiff, - bx: -(sDiff / 2) - iSize * 5 - pOff, - by: -(sDiff / 2) - pOff - iconOff - }; - - buttons[6] = { - _var: '_rs', - l: resetCenterX, - t: resetCenterY, - w: bsDiff, - h: bsDiff, - bx: -(sDiff / 2) - iSize * 6 - pOff, - by: -(sDiff / 2) - pOff - iconOff - }; - - for (var i = 0; i < 7; i++) { - buttons[i].$ob = $( - '
      \ -
      ' - ) - .css('opacity', .7) - .bind((supportsTouch ? "" : 'mouseover.sz mouseout.sz ') + self.event_down, { - id: i - - }, function (e) { - self._onfocus = false; - $this = $(this); - - //Button over - if (e.type == 'mouseover') { - if ($this.css('opacity') > .5) { - $this.css('opacity', 1); - } - - //Button out - } else if (e.type == 'mouseout') { - if ($this.css('opacity') > .5) { - $this.css('opacity', .7); - } - - //Button press/down - } else if (e.type == 'mousedown' || e.type == 'touchstart') { - self.cButtId = e.data.id; - self._onButton = true; - self._wheel = false; - - //If NOT already down.. - if ($this.css('opacity') > .5) { - $this.css('opacity', 1); - $holder.find('#' + buttons[self.cButtId]._var + 'norm').hide(); - $holder.find('#' + buttons[self.cButtId]._var + 'over').show(); - - //CASE 1: If zoomIn pressed and single step zoom enabled - if (self.cButtId <= 1 && self.zoom_single) { - if (!cFlag[buttons[self.cButtId]._var]) { - self.sRed = 300; - cFlag[buttons[self.cButtId]._var] = true; - } - - //CASE 2: If any button except RESET pressed - } else if (self.cButtId < 6) { - cFlag[buttons[self.cButtId]._var] = true; - - //CASE 3: RESET pressed - } else { - cFlag._rs = true; - self.rA = self.rR; - if (self.reset_align[0] == 'top') { - self.fY = (self.sH / 2) * (self.rA / 2); - } else if (self.reset_align[0] == 'bottom') { - self.fY = -(self.sH / 2) * (self.rA / 2); - } else { - self.fY = 0; - } - if (self.reset_align[1] == 'left') { - self.fX = (self.sW / 2) * (self.rA / 2); - } else if (self.reset_align[1] == 'right') { - self.fX = -(self.sW / 2) * (self.rA / 2); - } else { - self.fX = 0; - } - } - - self.focusOffX = self.focusOffY = 0; - self.changeOffset(true, true); - if (!self._playing) { - self.Animate(); - } - } - e.preventDefault(); - e.stopPropagation(); - } - }); - - //Make 2 BGs for Button Normal and Over state - //Button BG normal - var tpm = $( - '
      \ -
      ' - ); - - //Button BG hover - var tpmo = $( - '' - ); - - //Add the button icons - var cont = $( - '
      \ -
      ' - ); - - buttons[i].$ob.append(tpm, tpmo, cont); - $controls.append(buttons[i].$ob); - - //Apply corner radius - if (self.bu_round) { - if (prop_radius) { - tpm.css(prop_radius, '2px'); - tpmo.css(prop_radius, '2px'); - } else { - self.roundBG( - tpm, - buttons[i]._var + "norm", - buttons[i].w, - buttons[i].h, - 2, - 425, - self.bu_color, - self.bu_icon, - i + 1, - iconOff ? 50 : 0 - ); - self.roundBG( - tpmo, - buttons[i]._var + "over", - buttons[i].w + 2, - buttons[i].h + 2, - 2, - 425, - self.bu_color, - self.bu_icon, - i + 1, - iconOff ? 50 : 0 - ); - } - } - } - - //Add Events for mouse drag / touch swipe action - $(document).bind(self.event_up + self.id, { self: self }, self.mouseUp); - - if ((self.mouse_drag && !supportsTouch) || (self.touch_drag && supportsTouch)) { - self.$holder.bind(self.event_down, { self: self }, self.mouseDown); - if (supportsTouch) { - $(document).bind(self.event_move + self.id, { self: self }, self.mouseDrag); - } - } - - //Add Double click / Double tap zoom - if (self.mouse_dbl_click) { - var dClickedX, - dClickedY, - dbl_click_dir = 1; - - self.$holder.bind('dblclick.sz', function (e) { - self.focusOffX = e.pageX - $holder.offset().left - (self.sW / 2); - self.focusOffY = e.pageY - $holder.offset().top - (self.sH / 2); - self.changeOffset(true, true); - self._wheel = false; - - if (self.rA < self.zoom_max && dbl_click_dir == -1 && dClickedX != self.focusOffX && dClickedY != self.focusOffY) { - dbl_click_dir = 1; - } - - dClickedX = self.focusOffX; - dClickedY = self.focusOffY; - - if (self.rA >= self.zoom_max && dbl_click_dir == 1) { - dbl_click_dir = -1; - } - if (self.rA <= self.rF && dbl_click_dir == -1) { - dbl_click_dir = 1; - } - if (dbl_click_dir > 0) { - self.rA *= 2; - self.rA = self.rA > self.zoom_max ? self.zoom_max : self.rA; - cFlag._zi = true; - clearTimeout(self.ani_timer); - self._playing = true; - self.Animate(); - cFlag._zi = false; - - } else { - self.rA /= 2; - self.rA = self.rA < self.rF ? self.rF : self.rA; - cFlag._zo = true; - clearTimeout(self.ani_timer); - self._playing = true; - self.Animate(); - cFlag._zo = false; - } - e.preventDefault(); - e.stopPropagation(); - }); - } - - //Add mouse wheel event if enabled - if (self.mouse_wheel) { - $holder.bind('mousewheel.sz', { self: this }, self.mouseWheel); - } - - //Auto Hide the control buttons if enabled - if (self.bu_auto) { - $holder.bind('mouseleave.sz', { self: this }, self.autoHide); - } - - //Prevent Controls Bg from start dragging image - $controls.bind(self.event_down, function (e) { - e.preventDefault(); - e.stopPropagation(); - }); - - //Prevent Controls Bg from double click zoom - if (self.mouse_dbl_click) { - $controls.bind('dblclick.sz', function (e) { - e.preventDefault(); - e.stopPropagation(); - }); - } - - //Prevent text selection for smoother dragging and button focus - $('.noSel').each(function () { - this.onselectstart = function () { - return false; - }; - }); - - self.$holder = $holder; - self.$controls = $controls; - self.sW = sW; - self.sH = sH; - self.cBW = cBW; - self.cBH = cBH; - - //Apply initial transformation - self.Animate(); - }, - - - /*Prepare the container (holder) element and get landmarks if available - ***********************************************************************************************************************/ - setContainer: function () { - var self = this, - $image = self.$image, - bord_size = self.bord_size, - border = self.border, - $holder = self.$holder; - - //Wrap a container for image or get the container if specified through options: - if (self.container == '' && self.image_url == '') { - $holder = self.$image.wrap( - '
      \ -
      ' - ).parent(); - - } else { - if (self.image_url == '') { - $holder = $('#' + self.container); - } else { - $holder = self.$elem; - } - $holder.addClass('noSel smooth_zoom_preloader'); - self.locations = []; - self.$loc_cont = $holder.find('.landmarks'); - if (self.$loc_cont[0]) { - var locs = self.$loc_cont.children('.item'); - self.loc_clone = self.$loc_cont.clone(); - self.show_at_zoom = parseInt(self.$loc_cont.data('show-at-zoom'), 10) / 100; - self.allow_scale = checkBoolean(self.$loc_cont.data('allow-scale')); - self.allow_drag = checkBoolean(self.$loc_cont.data('allow-drag')); - locs.each(function () { - self.setLocation($(this)); - }); - } - } - - $holder.css({ - 'position': 'relative', - 'overflow': 'hidden', - 'text-align': 'left', - '-moz-user-select': 'none', - '-khtml-user-select': 'none', - '-webkit-user-select': 'none', - 'user-select': 'none', - '-webkit-touch-callout': 'none', - '-webkit-tap-highlight-color': 'rgba(255, 255, 255, 0)', - 'background-color': self.bg_color, - 'background-position': 'center center', - 'background-repeat': 'no-repeat' - }) - - self.$hitArea = $('
      ').appendTo($holder); - - self.getContainerSize(self.sW, self.sH, $holder, self.w_max, self.h_max); - - if (self.responsive) { - $(window).bind("orientationchange.sz" + self.id + " resize.sz" + self.id, { self: self }, self.resize); - } - var sW = self.sW; - var sH = self.sH; - - //Add Image container properties - $holder.css({ - 'width': sW, - 'height': sH - }); - - //Add border if needed - if (bord_size > 0) { - border[0] = $('
      ').css('opacity', self.bord_alpha); - border[1] = $('
      ').css('opacity', self.bord_alpha); - border[2] = $('
      ').css('opacity', self.bord_alpha); - border[3] = $('
      ').css('opacity', self.bord_alpha); - $holder.append(border[0], border[1], border[2], border[3]); - } - - //Get Image maps if exists - if ($image.attr('usemap') != undefined) { - self.mapAreas = $("map[name='" + ($image.attr('usemap').split('#').join('')) + "']").children('area'); - self.mapAreas.each(function (i) { - var area = $(this); - area.css('cursor', 'pointer'); - if (self.mouse_drag) { - area.bind(self.event_down, { self: self }, self.mouseDown); - } - if (self.mouse_wheel) { - area.bind('mousewheel.sz', { self: self }, self.mouseWheel); - } - self.map_coordinates.push(area.attr('coords').split(',')); - }); - } - - self.$holder = $holder; - self.sW = sW; - self.sH = sH; - }, - - getContainerSize: function (sW, sH, $holder, w_max, h_max) { - if (sW === '' || sW === 0) { - if (this.image_url == '') { - sW = Math.max($holder.parent().width(), 100); - } else { - sW = Math.max($holder.width(), 100); - } - - } else if (!isNaN(sW) || String(sW).indexOf('px') > -1) { - sW = this.oW = parseInt(sW); - if (this.responsive) { - sW = Math.min($holder.parent().width(), sW); - } - } else if (String(sW).indexOf('%') > -1) { - sW = $holder.parent().width() * (sW.split('%')[0] / 100); - } else { - sW = 100; - } - if (w_max !== 0 && w_max !== '') { - sW = Math.min(sW, w_max); - } - if (sH === '' || sH === 0) { - if (this.image_url == '') { - sH = Math.max($holder.parent().height(), 100); - } else { - sH = Math.max($holder.height(), 100); - } - } else if (!isNaN(sH) || String(sH).indexOf('px') > -1) { - sH = this.oH = parseInt(sH); - - } else if (String(sH).indexOf('%') > -1) { - sH = $holder.parent().height() * (sH.split('%')[0] / 100); - } else { - sH = 100; - } - if (h_max !== 0 && h_max !== '') { - sH = Math.min(sH, h_max); - } - - if (this.oW && sW !== this.oW) { - if (this.oH && this.maintain_ratio) { - sH = sW / (this.oW / this.oH); - } - } - - this.sW = sW; - this.sH = sH; - }, - - - /*Each landmark / location / lable initiated here - ***********************************************************************************************************************/ - setLocation: function (lc) { - var self = this, - ob = lc, - w2, h2, pos, sc; - - if (prop_origin) { - ob.css(prop_origin, '0 0'); - } - - ob.css({ - 'display': 'block', - 'z-index': 2 - }) - if (self.use3D) { - ob.css({ - '-webkit-backface-visibility': 'hidden', - '-webkit-perspective': 1000 - }); - } - - w2 = ob.outerWidth() / 2; - h2 = ob.outerHeight() / 2; - pos = ob.data('position').split(','); - sc = ob.data('allow-scale'); - if (sc == undefined) { - sc = self.allow_scale; - } else { - sc = checkBoolean(sc); - } - - if (ob.hasClass('mark')) { - var imgw = ob.find('img').css('vertical-align', 'bottom').width(); - $(ob.children()[0]).css({ - 'position': 'absolute', - 'left': (-ob.width() / 2), - 'bottom': parseInt(ob.css('padding-bottom')) * 2 - }); - var txt = ob.find('.text'); - self.locations.push({ - ob: ob, - x: parseInt(pos[0]), - y: parseInt(pos[1]), - w2: w2, - h2: h2, - w2pad: w2 + (txt[0] ? parseInt(txt.css('padding-left')) : 0), - vis: false, - lab: false, - lpx: '0', - lpy: '0', - showAt: isNaN(ob.data('show-at-zoom')) ? self.show_at_zoom : parseInt(ob.data('show-at-zoom'), 10) / 100, - scale: sc - }); - - } else if (ob.hasClass('lable')) { - var bg = ob.data('bg-color'), - opacity = ob.data('bg-opacity'), - cont = $(ob.eq(0).children()[0]) - .css({ - 'position': 'absolute', - 'z-index': 2, - left: -w2, - top: -h2 - }); - - self.locations.push({ - ob: ob, - x: parseInt(pos[0]), - y: parseInt(pos[1]), - w2: w2, - h2: h2, - w2pad: w2, - vis: false, - lab: true, - lpx: '0', - lpy: '0', - showAt: isNaN(ob.data('show-at-zoom')) ? self.show_at_zoom : parseInt(ob.data('show-at-zoom'), 10) / 100, - scale: sc - }); - - if (bg !== "") { - if (!bg) { - bg = "#000000"; - opacity = .7; - } - var bgob = $('
      ').appendTo(ob); - if (opacity) { - bgob.css('opacity', opacity); - } - } - } - ob.hide(); - if (prop_transform) { - ob.css('opacity', 0); - } - if (!self.allow_drag) { - ob.bind(self.event_down, function (e) { - //e.preventDefault(); - e.stopPropagation(); - }) - } - }, - - /*Storing the original style of image (needed only when destroying) - ***********************************************************************************************************************/ - getStyle: function () { - var el = this.$image; - return { - prop_origin: [prop_origin, prop_origin !== false && prop_origin !== undefined ? el.css(prop_origin) : null], - prop_transform: [prop_transform, prop_transform !== false && prop_transform !== undefined ? el.css(prop_transform) : null], - 'position': ['position', el.css('position')], - 'z-index': ['z-index', el.css('z-index')], - 'cursor': ['cursor', el.css('cursor')], - 'left': ['left', el.css('left')], - 'top': ['top', el.css('top')], - 'width': ['width', el.css('width')], - 'height': ['height', el.css('height')] - }; - }, - - /*Find the scale ratios - ***********************************************************************************************************************/ - checkRatio: function (sW, sH, iW, iH, zoom_fit) { - var rF; - if (iW == sW && iH == sH) { - rF = 1; - } else if (iW < sW && iH < sH) { - rF = sW / iW; - if (zoom_fit) { - if (rF * iH > sH) { - rF = sH / iH; - } - } else { - if (rF * iH < sH) { - rF = sH / iH; - } - if (sW / iW !== sH / iH && this.mouse_drag) { - this._moveCursor = true; - this.$image.css('cursor', 'move'); - this.$hitArea.css('cursor', 'move'); - } - } - } else { - - rF = sW / iW; - if (zoom_fit) { - if (rF * iH > sH) { - rF = sH / iH; - } - if (rF < this.init_zoom && this.mouse_drag) { - this._moveCursor = true; - this.$image.css('cursor', 'move'); - this.$hitArea.css('cursor', 'move'); - } - } else { - if (rF * iH < sH) { - rF = sH / iH; - } - if (sW / iW !== sH / iH && this.mouse_drag) { - this._moveCursor = true; - this.$image.css('cursor', 'move'); - this.$hitArea.css('cursor', 'move'); - } - } - } - return rF; - }, - - - /*Returns distance between 2 points (used for touch gesture) - ***********************************************************************************************************************/ - getDistance: function (x1, y1, x2, y2) { - return Math.sqrt(Math.abs(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)))); - }, - - - /*Image Events for Dragging and Mouse Wheel - ***********************************************************************************************************************/ - mouseDown: function (e) { - var self = e.data.self; - self._onfocus = self._dragging = false; - if (self.cFlag._nd) { - if (self.fixMoz) { - self.correctTransValue(); - } - self.samePointRelease = false; - if (e.type == 'mousedown') { - self.stX = e.pageX; - self.stY = e.pageY; - self.offX = e.pageX - self.$holder.offset().left - self.$image.position().left; - self.offY = e.pageY - self.$holder.offset().top - self.$image.position().top; - $(document).bind(self.event_move + self.id, { self: self }, self.mouseDrag); - } else { - var te = e.originalEvent; - if (te.targetTouches.length > 1) { - self._pinching = true; - self._rA = self.rA; - self.dStart = self.getDistance(te.touches[0].pageX, te.touches[0].pageY, te.touches[1].pageX, te.touches[1].pageY); - } else { - self.offX = te.touches[0].pageX - self.$holder.offset().left - self.$image.position().left; - self.offY = te.touches[0].pageY - self.$holder.offset().top - self.$image.position().top; - self.setDraggedPos(te.touches[0].pageX - self.$holder.offset().left - self.offX, te.touches[0].pageY - self.$holder.offset().top - self.offY, self._sc); - self._recent = 'drag'; - self._dragging = true; - } - } - self._onHitArea = true; - } - if (e.type == 'mousedown') { - e.preventDefault(); - } - }, - - - /*Mouse Drag / Touch swipe operations handled here - ***********************************************************************************************************************/ - mouseDrag: function (e) { - var self = e.data.self; - - //Mouse - if (e.type == 'mousemove') { - self.setDraggedPos(e.pageX - self.$holder.offset().left - self.offX, e.pageY - self.$holder.offset().top - self.offY, self._sc); - self._recent = 'drag'; - self._dragging = true; - if (!self._playing) { - self.Animate(); - } - return false; - - //Touch - } else { - if (self._dragging || self._pinching) { - e.preventDefault(); - } - if (self._onHitArea) { - var touches = e.originalEvent.touches; - if (self._pinching || touches.length > 1) { - if (!self._pinching) { - self._pinching = true; - self._rA = self.rA; - if (touches.length > 1) { - self.dStart = self.getDistance(touches[0].pageX, touches[0].pageY, touches[1].pageX, touches[1].pageY); - } - } - if (touches.length > 1) { - self._centx = (touches[0].pageX + touches[1].pageX) / 2; - self._centy = (touches[0].pageY + touches[1].pageY) / 2; - self.focusOffX = self._centx - self.$holder.offset().left - (self.sW / 2); - self.focusOffY = self._centy - self.$holder.offset().top - (self.sH / 2); - self.changeOffset(true, true); - self._wheel = true; - self._dragging = false; - if (self.zoom_single) { - self.sRed = 300; - - } else { - self.dEnd = self.getDistance(touches[0].pageX, touches[0].pageY, touches[1].pageX, touches[1].pageY); - self.rA = self._rA * (self.dEnd / self.dStart); - self.rA = self.rA > self.zoom_max ? self.zoom_max : self.rA; - self.rA = self.rA < self.rF ? self.rF : self.rA; - } - if (self._sc < self.rA) { - self.cFlag._zo = false; - self.cFlag._zi = true; - } else { - self.cFlag._zi = false; - self.cFlag._zo = true; - } - if (!self._playing) { - self.Animate(); - } - } - - } else if (self._dragging && touches.length < 2) { - self.setDraggedPos(touches[0].pageX - self.$holder.offset().left - self.offX, touches[0].pageY - self.$holder.offset().top - self.offY, self._sc); - self._recent = 'drag'; - if (!self._playing) { - self.Animate(); - } - } - } - } - }, - - - /*Global Mouse Up / Touch End - ***********************************************************************************************************************/ - mouseUp: function (e) { - var self = e.data.self; - - //If one of the buttons released - if (self._onButton) { - self.$holder.find('#' + self.buttons[self.cButtId]._var + 'norm').show(); - self.$holder.find('#' + self.buttons[self.cButtId]._var + 'over').hide(); - if (self.cButtId !== 6) { - self.cFlag[self.buttons[self.cButtId]._var] = false; - } - if (e.type == 'touchend' && self.buttons[self.cButtId].$ob.css('opacity') > .5) { - self.buttons[self.cButtId].$ob.css('opacity', .7); - } - self._onButton = false; - e.stopPropagation(); - return false; - - //If the mouse drag or touch swipe completed - } else if (self._onHitArea) { - if (self.mouse_drag || self.touch_drag) { - //Mouse - if (e.type == 'mouseup') { - $(document).unbind(self.event_move + self.id); - if (self.stX == e.pageX && self.stY == e.pageY) { - self.samePointRelease = true; - } - self._recent = 'drag'; - self._dragging = false; - if (!self._playing) { - self.Animate(); - } - self._onHitArea = false; - - //Touch - } else { - e.preventDefault(); - self._dragging = false; - if (self._pinching) { - self._pinching = false; - self._wheel = false; - self.cFlag._nd = true; - self.cFlag._zi = false; - self.cFlag._zo = false; - } else { - self._recent = 'drag'; - if (!self._playing) { - self.Animate(); - } - } - self._onHitArea = false; - } - } - } - }, - - - /*Mouse wheel zoom in-out - ***********************************************************************************************************************/ - mouseWheel: function (e, delta) { - var self = e.data.self; - self._onfocus = self._dragging = false; - if (self.mouse_wheel_cur) { - self.focusOffX = e.pageX - self.$holder.offset().left - (self.sW / 2); - self.focusOffY = e.pageY - self.$holder.offset().top - (self.sH / 2); - self.changeOffset(true, true); - } - - self._dragging = false; - if (delta > 0) { - if (self.rA != self.zoom_max) { - if (self.zoom_single) { - if (!self._wheel) { - self.sRed = 300; - } - } else { - self.rA *= delta < 1 ? 1 + (.3 * delta) : 1.3; - self.rA = self.rA > self.zoom_max ? self.zoom_max : self.rA; - } - self._wheel = true; - self.cFlag._zi = true; - clearTimeout(self.ani_timer); - self._playing = true; - self.Animate(); - self.cFlag._zi = false; - } - } else { - if (self.rA != self.rF) { - if (self.zoom_single) { - if (!self._wheel) { - self.sRed = 300; - } - } else { - self.rA /= delta > -1 ? 1 + (.3 * -delta) : 1.3; - self.rA = self.rA < self.rF ? self.rF : self.rA; - } - self._wheel = true; - self.cFlag._zo = true; - clearTimeout(self.ani_timer); - self._playing = true; - self.Animate(); - self.cFlag._zo = false; - } - } - return false; - }, - - - /*Control buttons Auto hide - ***********************************************************************************************************************/ - autoHide: function (e) { - var self = e.data.self; - - clearTimeout(self.auto_timer); - self.auto_timer = setTimeout(function () { - self.$controls.fadeOut(600); - }, self.bu_delay); - - self.$holder.bind('mouseenter.sz', function (e) { - clearTimeout(self.auto_timer); - self.$controls.fadeIn(300); - }); - }, - - - /*Mozilla works differently than others when getting translated positions. So this correction needed - ***********************************************************************************************************************/ - correctTransValue: function () { - var v = this.$image.css('-moz-transform').toString().replace(')', '').split(','); - this.transOffX = parseInt(v[4]); - this.transOffY = parseInt(v[5]); - }, - - - /*Make sure the dragged position obeying limits - ***********************************************************************************************************************/ - setDraggedPos: function (xp, yp, s) { - var self = this; - - if (xp !== '') { - self.dX = xp + self.transOffX; - if (self.pan_limit) { - self.dX = self.dX + (s * self.iW) < self.sW ? self.sW - (s * self.iW) : self.dX; - self.dX = self.dX > 0 ? 0 : self.dX; - if ((s * self.iW) < self.sW) { - self.dX = (self.sW - (s * self.iW)) / 2; - } - } else { - self.dX = self.dX + (s * self.iW) < self.sW / 2 ? (self.sW / 2) - (s * self.iW) : self.dX; - self.dX = self.dX > self.sW / 2 ? self.sW / 2 : self.dX; - } - } - if (yp !== '') { - self.dY = yp + self.transOffY; - if (self.pan_limit) { - self.dY = self.dY + (s * self.iH) < self.sH ? self.sH - (s * self.iH) : self.dY; - self.dY = self.dY > 0 ? 0 : self.dY; - if ((s * self.iH) < self.sH) { - self.dY = (self.sH - (s * self.iH)) / 2; - } - } else { - self.dY = self.dY + (s * self.iH) < self.sH / 2 ? (self.sH / 2) - (s * self.iH) : self.dY; - self.dY = self.dY > self.sH / 2 ? self.sH / 2 : self.dY; - } - } - }, - - /*Called to animate image transformation whenever the navigation events occur - ***********************************************************************************************************************/ - Animate: function () { - - var self = this; - var pixTol = .5; - - self.cFlag._nd = true; - self.ani_end = false; - - //Zoom In - if (self.cFlag._zi) { - if (!self._wheel && !self.zoom_single) { - self.rA *= self.zoom_speed; - } - if (self.rA > self.zoom_max) { - self.rA = self.zoom_max; - } - self.cFlag._nd = false; - self.cFlag._rs = false; - self._recent = 'zoomIn'; - self._onfocus = self._dragging = false; - } - - //Zoom Out - if (self.cFlag._zo) { - if (!self._wheel && !self.zoom_single) { - self.rA /= self.zoom_speed; - } - if (self.zoom_min != 0) { - if (self.rA < self.zoom_min) { - self.rA = self.zoom_min; - } - } else { - if (self.rA < self.rF) { - self.rA = self.rF; - } - } - - self.cFlag._nd = false; - self.cFlag._rs = false; - self._recent = 'zoomOut'; - self._onfocus = self._dragging = false; - } - - //Zoom In or Out - Single Step - if (self.zoom_single && !self.cFlag._rs) { - if (self._recent == 'zoomIn') { - self.sRed += (10 - self.sRed) / 6; - self.rA += (self.zoom_max - self.rA) / (((1 / (self.pan_speed_o + 1)) * self.sRed) + 1); - - } else if (self._recent == 'zoomOut') { - self.sRed += (3 - self.sRed) / 3; - self.rA += (self.rF - self.rA) / (((1 / self.pan_speed_o + 1) * self.sRed) + 1); - } - } - - //Pan speed needs to adjust according to application dimension and zoom level - self.pan_speed = (Math.max(1, 1 + ((self.sW + self.sH) / 500)) + (self.pan_speed_o * self.pan_speed_o / 4)) / Math.max(1, self.rA / 2); - - //Move Left - if (self.cFlag._ml) { - self.oX -= self.pan_speed; - self.cFlag._nd = false; - self.cFlag._rs = false; - self._recent = 'left'; - self._onfocus = self._dragging = false; - } - - //Move Right - if (self.cFlag._mr) { - self.oX += self.pan_speed; - self.cFlag._nd = false; - self.cFlag._rs = false; - self._recent = 'right'; - self._onfocus = self._dragging = false; - } - - //Move Up - if (self.cFlag._mu) { - self.oY -= self.pan_speed; - self.cFlag._nd = false; - self.cFlag._rs = false; - self._recent = 'up'; - self._onfocus = self._dragging = false; - } - - //Move Down - if (self.cFlag._md) { - self.oY += self.pan_speed; - self.cFlag._nd = false; - self.cFlag._rs = false; - self._recent = 'down'; - self._onfocus = self._dragging = false; - } - - //Reset - if (self.cFlag._rs) { - self.oX += (self.fX - self.oX) / 8; - self.oY += (self.fY - self.oY) / 8; - self.cFlag._nd = false; - self._recent = 'reset'; - self._onfocus = self._dragging = false; - } - - //Find scale value, width and height - //Case 1: Single Step Zoom - if (self.zoom_single && (self._recent !== 'reset')) { - if (self._onfocus) { - self._sc += (self.rA - self._sc) / self.reduction; - } else { - self._sc = self.rA; - } - - //Case 2: Normal Zoom - } else { - self._sc += (self.rA - self._sc) / (self.ani_smooth / (self._onfocus ? self.reduction : 1)); - } - - self._w = self._sc * self.iW; - self._h = self._sc * self.iH; - - //Dragging - if (self._dragging) { - self.tX = self.dX; - self.tY = self.dY; - self.changeOffset(true, true); - } - - //Check if Zoom In completed - if (self._recent == "zoomIn") { - if (self._w > (self.rA * self.iW) - pixTol && !self.zoom_single) { - if (self.cFlag._nd) { - self.ani_end = true; - } - self._sc = self.rA; - } else if (self._w > (self.zoom_max * self.iW) - pixTol && self.zoom_single) { - if (self.cFlag._nd) { - self.ani_end = true; - } - self._sc = self.rA = self.zoom_max; - } - if (self.ani_end) { - self._w = self._sc * self.iW; - self._h = self._sc * self.iH; - } - - //Check if Zoom Out completed - } else if (self._recent == "zoomOut") { - if (self._w < (self.rA * self.iW) + pixTol && !self.zoom_single) { - if (self.cFlag._nd) { - self.ani_end = true; - } - self._sc = self.rA; - } else if (self._w < (self.rF * self.iW) + pixTol && self.zoom_single) { - if (self.cFlag._nd) { - self.ani_end = true; - } - self._sc = self.rA = self.rF; - } - if (self.ani_end) { - self._w = self._sc * self.iW; - self._h = self._sc * self.iH; - } - } - - //Move image according to boundary limits - self.limitX = (((self._w - self.sW) / (self._w / self.sW)) / 2); - self.limitY = (((self._h - self.sH) / (self._h / self.sH)) / 2); - - if (!self._dragging) { - if (self.pan_limit) { - if (self.oX < -self.limitX - self.focusOffX) { - self.oX = -self.limitX - self.focusOffX; - } - if (self.oX > self.limitX - self.focusOffX) { - self.oX = self.limitX - self.focusOffX; - } - if (self._w < self.sW) { - self.tX = (self.sW - self._w) / 2; - self.changeOffset(true, false); - } - if (self.oY < -self.limitY - self.focusOffY) { - self.oY = -self.limitY - self.focusOffY; - } - if (self.oY > self.limitY - self.focusOffY) { - self.oY = self.limitY - self.focusOffY; - } - if (self._h < self.sH) { - self.tY = (self.sH - self._h) / 2; - self.changeOffset(false, true); - } - } else { - if (self.oX < -self.limitX - (self.focusOffX / self._w * self.sW) - ((self.sW / 2) / (self._w / self.sW))) { - self.oX = -self.limitX - (self.focusOffX / self._w * self.sW) - ((self.sW / 2) / (self._w / self.sW)); - } - - if (self.oX > self.limitX - (self.focusOffX / self._w * self.sW) + ((self.sW / 2) / (self._w / self.sW))) { - self.oX = self.limitX - (self.focusOffX / self._w * self.sW) + ((self.sW / 2) / (self._w / self.sW)); - } - - if (self.oY < -self.limitY - (self.focusOffY / self._h * self.sH) - (self.sH / (self._h / self.sH * 2))) { - self.oY = -self.limitY - (self.focusOffY / self._h * self.sH) - (self.sH / (self._h / self.sH * 2)); - } - - if (self.oY > self.limitY - (self.focusOffY / self._h * self.sH) + (self.sH / (self._h / self.sH * 2))) { - self.oY = self.limitY - (self.focusOffY / self._h * self.sH) + (self.sH / (self._h / self.sH * 2)); - } - } - } - if (!self._dragging && self._recent != "drag") { - self.tX = ((self.sW - self._w) / 2) + self.focusOffX + (self.oX * (self._w / self.sW)); - self.tY = ((self.sH - self._h) / 2) + self.focusOffY + (self.oY * (self._h / self.sH)); - if (self.ani_smooth === 1) { - self.cFlag._nd = true; - self.ani_end = true; - } - } - if (self._recent == "zoomIn" || self._recent == "zoomOut" || self.cFlag._rs) { - self._x = self.tX; - self._y = self.tY; - } else { - self._x += (self.tX - self._x) / (self.ani_smooth / (self._onfocus ? self.reduction : 1)); - self._y += (self.tY - self._y) / (self.ani_smooth / (self._onfocus ? self.reduction : 1)); - } - - //Check if Left movement completed - if (self._recent == "left") { - if (self._x < self.tX + pixTol || self.ani_smooth === 1) { - self.cFlag._nd ? self.ani_end = true : ""; - self._recent = ''; - self._x = self.tX; - } - - //Check if Right movement completed - } else if (self._recent == "right") { - if (self._x > self.tX - pixTol || self.ani_smooth === 1) { - self.cFlag._nd ? self.ani_end = true : ""; - self._recent = ''; - self._x = self.tX; - } - - //Check if Up movement completed - } else if (self._recent == "up") { - if (self._y < self.tY + pixTol || self.ani_smooth === 1) { - self.cFlag._nd ? self.ani_end = true : ""; - self._recent = ''; - self._y = self.tY; - } - - //Check if Down movement completed - } else if (self._recent == "down") { - if (self._y > self.tY - pixTol || self.ani_smooth === 1) { - self.cFlag._nd ? self.ani_end = true : ""; - self._recent = ''; - self._y = self.tY; - } - - //Check if Dragging completed - } else if (self._recent == "drag") { - if (self._x + pixTol >= self.tX && self._x - pixTol <= self.tX && self._y + pixTol >= self.tY && self._y - pixTol <= self.tY || self.ani_smooth === 1) { - if (self._onfocus) { - self._dragging = false; - } - self.cFlag._nd ? self.ani_end = true : ""; - self._recent = ''; - self._x = self.tX; - self._y = self.tY; - } - } - - //Check if Reset completed - if (self.cFlag._rs && self._w + pixTol >= (self.rA * self.iW) && self._w - pixTol <= (self.rA * self.iW) && self.oX <= self.fX + pixTol && self.oX >= self.fX - pixTol && self.oY <= self.fY + pixTol && self.oY >= self.fY - pixTol) { - self.ani_end = true; - self._recent = ''; - self.cFlag._rs = false; - self.cFlag._nd = true; - self._x = self.tX; - self._y = self.tY; - self._sc = self.rA; - self._w = self._sc * self.iW; - self._h = self._sc * self.iH; - } - - //When the image fits exactly to container size, disable the pan, zoom out and reset buttons - if (self.rA == self.rF && self.iW * self.rA <= self.sW && self.iH * self.rA <= self.sH) { - if (self.buttons[1].$ob.css('opacity') > .5) { - if (self.rA >= self.rF && (self.init_zoom == '' || self.rA < self.init_zoom) && (self.zoom_min == '' || self.rA < self.zoom_min)) { - if (self.pan_limit && self._moveCursor && !self._moveCursor) { - self.$image.css('cursor', 'default'); - self.$hitArea.css('cursor', 'default'); - } - for (var bEn = 1; bEn < (self.pan_limit && !self._moveCursor ? self.buttons_total : 2) ; bEn++) { - self.buttons[bEn].$ob.css({ - 'opacity': .4 - }); - self._wheel = false; - self.$holder.find('#' + self.buttons[bEn]._var + 'norm').show(); - self.$holder.find('#' + self.buttons[bEn]._var + 'over').hide(); - } - } - } - - } else { - if (self.buttons[1].$ob.css('opacity') < .5) { - if (self._moveCursor && self.mouse_drag) { - self.$image.css('cursor', 'move'); - self.$hitArea.css('cursor', 'move'); - } - for (var bEn = 1; bEn < self.buttons_total; bEn++) { - self.buttons[bEn].$ob.css('opacity', .7); - } - } - } - - //When the image reaches max zoom, disable the zoom button - if (self.rA == self.zoom_max) { - if (self.buttons[0].$ob.css('opacity') > .5) { - self.buttons[0].$ob.css('opacity', .4); - self._wheel = false; - self.$holder.find('#' + self.buttons[0]._var + 'norm').show(); - self.$holder.find('#' + self.buttons[0]._var + 'over').hide(); - } - - } else { - if (self.buttons[0].$ob.css('opacity') < .5) { - self.buttons[0].$ob.css('opacity', .7); - } - } - - //Apply Scale and position to the image: - if (prop_transform) { - self.$image.css(prop_transform, 'translate(' + self._x.toFixed(14) + 'px,' + self._y.toFixed(14) + 'px) scale(' + self._sc + ')'); - - } else { - self.$image.css({ - left: self._x, - top: self._y, - width: self._w, - height: self._h - }); - } - - if (self.$loc_cont) { - self.updateLocations(self._x, self._y, self._sc, self.locations); - } - - //In case image Maps used, update them - if (!prop_transform && self.map_coordinates.length > 0) { - self.updateMap(); - } - //If the animation completed, stop running; else continue - if (self.ani_end && !self._dragging && self._recent != "drag") { - self._playing = false; - self._recent = ''; - self.cX = (-self._x + (self.sW / 2)) / self.rA; - self.cY = (-self._y + (self.sH / 2)) / self.rA; - if (self.onUPDATE) { - self.onUPDATE(self.getZoomData(), false); - } - if (self.onZOOM_PAN) { - self.onZOOM_PAN(self.getZoomData()); - } - clearTimeout(self.ani_timer); - } else { - self._playing = true; - if (self.onUPDATE) { - self.onUPDATE(self.getZoomData(), true); - } - self.ani_timer = setTimeout(function () { - self.Animate(); - }, 28); - } - }, - - - /*Relocate the landmarks according to main image's position - ***********************************************************************************************************************/ - updateLocations: function (_x, _y, _sc, loc) { - - if (this.onLANDMARK !== '') { - if (_sc >= this.show_at_zoom) { - if (!this._landmark) { - this._landmark = true - this.onLANDMARK(true); - } - } else { - if (this._landmark) { - this._landmark = false; - this.onLANDMARK(false); - } - } - } - - for (var p = 0; p < loc.length; p++) { - var wScaled, - hScaled, - lpx = (loc[p].x * _sc) + _x, - lpy = (loc[p].y * _sc) + _y; - - if (_sc >= loc[p].showAt) { - if (loc[p].scale && prop_transform) { - wScaled = loc[p].w2pad * this._sc; - hScaled = loc[p].h2 * this._sc; - } else { - wScaled = loc[p].w2pad; - hScaled = loc[p].h2; - } - if (lpx > -wScaled && lpx < this.sW + wScaled && ((lpy > -hScaled && lpy < this.sH + hScaled && loc[p].lab) || (lpy > 0 && lpy < this.sH + (hScaled * 2) && !loc[p].lab))) { - if (!loc[p].vis) { - loc[p].vis = true; - if (prop_transform) { - loc[p].ob.stop() - .css('display', 'block') - .animate({ - opacity: 1 - }, 300); - } else { - loc[p].ob.show(); - } - } - } else { - if (loc[p].vis) { - loc[p].vis = false; - if (prop_transform) { - loc[p].ob.stop() - .animate({ - opacity: 0 - }, 200, function () { - $(this).hide(); - }); - } else { - loc[p].ob.hide(); - } - } - } - } else { - if (loc[p].vis) { - loc[p].vis = false; - if (prop_transform) { - loc[p].ob.stop() - .animate({ - opacity: 0 - }, 200, function () { - $(this).hide(); - }); - } else { - loc[p].ob.hide(); - } - } - } - if (lpx !== loc[p].lpx || lpy !== loc[p].lpy && loc[p].vis) { - if (prop_transform) { - loc[p].ob.css(prop_transform, 'translate(' + lpx.toFixed(14) + 'px,' + lpy.toFixed(14) + 'px)' + (loc[p].scale ? ' scale(' + this._sc + ')' : '')); - } else { - loc[p].ob.css({ - left: lpx, - top: lpy - }); - } - } - loc[p].lpx = lpx; - loc[p].lpy = lpy; - } - }, - - - /*If the broswer doesn't supports css border radius, we need to go with old school png image for rounded corner - ***********************************************************************************************************************/ - roundBG: function (el, _name, _w, _h, _r, _p, _c, _i, _z, _yoff) { - var w = 50 / 2; - - el.append($( - '
      \ -
      \ -
      \ -
      \ -
      \ -
      \ -
      ' - )); - $('.bgi' + _name).css({ - position: 'absolute', - width: _r, - height: _r, - 'background-image': 'url(' + _i + ')', - 'background-repeat': 'no-repeat', - '-ms-filter': 'progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)', - 'filter': 'progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)', - 'zoom': 1 - }); - $('.bgh' + _name).css({ - position: 'absolute', - width: _w - _r * 2, - height: _r, - 'background-color': _c, - left: _r - }); - $('.bgc' + _name).css({ - position: 'absolute', - width: _w, - height: _h - _r * 2, - 'background-color': _c, - top: _r, - left: 0 - }); - }, - - - /*To calibrate position offset when navigation events supposed to be overlapped - ***********************************************************************************************************************/ - changeOffset: function (x, y) { - if (x) this.oX = (this.tX - ((this.sW - this._w) / 2) - this.focusOffX) / (this._w / this.sW); - if (y) this.oY = (this.tY - ((this.sH - this._h) / 2) - this.focusOffY) / (this._h / this.sH); - }, - - - /*Transform Image Maps (hot spots) if any - ***********************************************************************************************************************/ - updateMap: function () { - var self = this, - mapId = 0; - - self.mapAreas.each(function () { - var new_vals = []; - for (var i = 0; i < self.map_coordinates[mapId].length; i++) { - new_vals[i] = self.map_coordinates[mapId][i] * self._sc; - } - new_vals = new_vals.join(","); - $(this).attr('coords', new_vals); - mapId++; - }); - }, - - - /*To stop the timer loops immediatly - ***********************************************************************************************************************/ - haltAnimation: function () { - clearTimeout(this.ani_timer); - this._playing = false; - this._recent = ''; - }, - - - /*Method to Remove the plugin instance - ***********************************************************************************************************************/ - destroy: function () { - var self = this; - - if (self.assetsLoaded) { - self.haltAnimation(); - for (prop in self.orig_style) { - if (self.orig_style[prop][0] !== false && self.orig_style[prop][0] !== undefined) { - if (self.orig_style[prop][0] === 'width' || self.orig_style[prop][0] === 'height') { - if (parseInt(self.orig_style[prop][1]) !== 0) { - self.$image.css(self.orig_style[prop][0], self.orig_style[prop][1]); - } - } else { - self.$image.css(self.orig_style[prop][0], self.orig_style[prop][1]); - } - } - } - clearTimeout(self.auto_timer); - $(document).unbind('.sz' + self.id); - $(window).unbind('.sz' + self.id); - self.$holder.unbind('.sz'); - self.$controls = undefined; - } else { - self.$image.show(); - } - - if (self.container == '') { - if (self.image_url == '') { - self.$image.insertBefore(self.$holder); - if (self.$holder !== undefined) { - self.$holder.remove(); - } - } else { - self.$elem.empty(); - if (self.$loc_cont[0]) { - self.$elem.append(self.loc_clone); - } - } - } else { - self.$image.insertBefore(self.$holder); - self.$holder.empty(); - self.$image.wrap(self.$holder); - if (self.$loc_cont[0]) { - self.$holder.append(self.loc_clone); - } - } - self.$elem.removeData('smoothZoom'); - self.$holder = undefined; - self.Buttons = undefined; - self.op = undefined; - self.$image = undefined; - }, - - - /*Method to change focus point and level - ***********************************************************************************************************************/ - focusTo: function (params) { - var self = this; - - if (self.assetsLoaded) { - if (params.zoom === undefined || params.zoom === '' || params.zoom == 0) { - params.zoom = self.rA; - } else { - params.zoom /= 100; - } - self._onfocus = true; - if (params.zoom > self.rA && self.rA != self.zoom_max) { - self.rA = params.zoom; - self.rA = self.rA > self.zoom_max ? self.zoom_max : self.rA; - } else if (params.zoom < self.rA && self.rA != self.rF) { - self.rA = params.zoom; - self.rA = self.rA < self.rF ? self.rF : self.rA; - } - self.transOffX = self.transOffY = 0; - self.setDraggedPos(params.x === undefined || params.x === '' ? "" : (-params.x * self.rA) + (self.sW / 2), params.y === undefined || params.y === '' ? "" : (-params.y * self.rA) + (self.sH / 2), self.rA); - self.reduction = params.speed ? params.speed / 10 : self.focusSpeed; - self._recent = 'drag'; - self._dragging = true; - if (!self._playing) { - self.Animate(); - } - } - }, - - zoomIn: function (params) { - this.buttons[0].$ob.trigger(this.event_down, { - id: 0 - }); - }, - - zoomOut: function (params) { - this.buttons[1].$ob.trigger(this.event_down, { - id: 1 - }); - }, - - moveRight: function (params) { - this.buttons[2].$ob.trigger(this.event_down, { - id: 2 - }); - }, - - moveLeft: function (params) { - this.buttons[3].$ob.trigger(this.event_down, { - id: 3 - }); - }, - - moveUp: function (params) { - this.buttons[4].$ob.trigger(this.event_down, { - id: 4 - }); - }, - - moveDown: function (params) { - this.buttons[5].$ob.trigger(this.event_down, { - id: 5 - }); - }, - - Reset: function (params) { - this.buttons[6].$ob.trigger(this.event_down, { - id: 6 - }); - }, - - getZoomData: function (params) { - return { - //x offset (without scale ratio multiplied) - normX: (-this._x / this.rA).toFixed(14), - - //y offset (without scale ratio multiplied) - normY: (-this._y / this.rA).toFixed(14), - - //Original image Width - normWidth: this.iW, - - //Original image height - normHeight: this.iH, - - //x offset (with scale ratio multiplied) - scaledX: -this._x.toFixed(14), - - //y offset (with scale ratio multiplied) - scaledY: -this._y.toFixed(14), - - //Scaled image width - scaledWidth: this._w, - - //Scaled image height - scaledHeight: this._h, - - //The X location on image which is currently on center of canvas - centerX: (-this._x.toFixed(14) + (this.sW / 2)) / this.rA, - - //The Y location on image which is currently on center of canvas - centerY: (-this._y.toFixed(14) + (this.sH / 2)) / this.rA, - - //Scale ratio - ratio: this.rA - }; - }, - - addLandmark: function (loc) { - if (this.$loc_cont) { - var total = loc.length; - - for (var i = 0; i < total; i++) { - var $loc = $(loc[i]); - this.$loc_cont.append($loc); - this.setLocation($loc); - } - - if (total > 0) { - this.updateLocations(this._x, this._y, this._sc, this.locations); - } - } - }, - - attachLandmark: function (loc) { - if (this.$loc_cont) { - var total = loc.length; - for (var i = 0; i < total; i++) { - this.setLocation(loc[i] instanceof jQuery ? loc[i] : $('#' + loc[i])); - } - if (total > 0) { - this.updateLocations(this._x, this._y, this._sc, this.locations); - } - } - }, - - removeLandmark: function (loc) { - if (this.$loc_cont) { - if (loc) { - var total = loc.length; - for (var i = 0; i < total; i++) { - for (var j = 0; j < this.locations.length; j++) { - if ((loc[i] instanceof jQuery && this.locations[j].ob[0] == loc[i][0]) || (!(loc[i] instanceof jQuery) && this.locations[j].ob.attr('id') == loc[i])) { - this.locations[j].ob.remove(); - this.locations.splice(j, 1); - j--; - } - } - } - } else { - if (this.locations.length > 0) { - this.locations[this.locations.length - 1].ob.remove(); - this.locations.pop(); - } - } - if (total > 0) { - this.updateLocations(this._x, this._y, this._sc, this.locations); - } - } - }, - - refreshAllLandmarks: function () { - var self = this; - var locs = self.$loc_cont.children('.item'); - self.show_at_zoom = parseInt(self.$loc_cont.data('show-at-zoom'), 10) / 100; - self.allow_scale = checkBoolean(self.$loc_cont.data('allow-scale')); - self.allow_drag = checkBoolean(self.$loc_cont.data('allow-drag')); - - //Step 1: Remove records for which the elements no longer exist - for (var i = 0; i < self.locations.length; i++) { - var exists = false; - locs.each(function () { - if (self.locations[i].ob[0] == $(this)[0]) { - exists = true; - } - }); - if (!exists) { - self.locations.splice(i, 1); - i--; - } - } - - //Step 2: Add new elements to record - locs.each(function () { - var exists = false; - for (var i = 0; i < self.locations.length; i++) { - if (self.locations[i].ob[0] == $(this)[0]) { - exists = true; - break; - } - } - if (!exists) { - self.setLocation($(this)); - } - - }); - this.updateLocations(this._x, this._y, this._sc, this.locations); - }, - - - /*On windows resize, adjust some defaults - ***********************************************************************************************************************/ - resize: function (e) { - var self; - - if (e.data) { - e.preventDefault(); - self = e.data.self; - var pw = self.$holder.parent().width(); - var ph = self.$holder.parent().height(); - - if (self.oW) { - pw = Math.min(pw, self.oW); - } - self.sW = pw; - - if (self.oH) { - if (self.oW && self.maintain_ratio) { - self.sH = pw / (self.oW / self.oH); - } - } else { - self.sH = ph; - } - - - } else { - self = this; - if (e.width) { - self.sW = e.width; - } - if (e.height) { - self.sH = e.height; - } - if (e.max_WIDTH) { - self.w_max = e.max_WIDTH; - } - if (e.max_HEIGHT) { - self.h_max = e.max_HEIGHT; - } - } - if (self.w_max !== 0 && self.w_max !== '') { - self.sW = Math.min(self.sW, self.w_max); - } - if (self.h_max !== 0 && self.h_max !== '') { - self.sH = Math.min(self.sH, self.h_max); - } - self.$holder.css({ - 'width': self.sW, - 'height': self.sH - }); - if (self.bord_size > 0) { - self.border[0].height(self.sH); - self.border[1].css({ - height: self.sH, - left: self.sW - self.bord_size - }); - self.border[2].width(self.sW - (self.bord_size * 2)); - self.border[3].css({ - width: self.sW - (self.bord_size * 2), - top: self.sH - self.bord_size - }); - } - if (self.bu_align[1] == 'center') { - self.$controls.css('left', parseInt((self.sW - self.cBW) / 2)); - } - if (self.bu_align[0] == 'center') { - self.$controls.css('top', parseInt((self.sH - self.cBH) / 2)); - } - self.rF = self.rR = self.checkRatio(self.sW, self.sH, self.iW, self.iH, self.zoom_fit); - if (self.zoom_min == 0) { - if (self.rA < self.rF) { - self.rA = self.rF; - } - } - - self.focusTo({ - x: self.cX, - y: self.cY, - zoom: '', - speed: 10 - }); - } - } - - - $.fn.smoothZoom = function (params) { - var self = this; - var l = self.length; - - //For single or more than one plugin instance - for (var i = 0; i < l; i++) { - var $elem = $(self[i]); - var instance = $elem.data('smoothZoom'); - - // Case 1: Initiate the plugin if not already have an instance - if (!instance) { - - if (typeof params === 'object' || !params) { - $elem.data('smoothZoom', new Zoomer($elem, params)); - } - - // Case 2: If the instance already available - Check for method call - } else { - - // getZoomData - Returns {sourceX, sourceY, sourceWidth, sourceHeight, distX, distY, distWidth, distHeight, centerX, centerY, ratio} - if (params == "getZoomData") { - return instance[params].apply(instance, Array.prototype.slice.call(arguments, 1)); - - // destroy | focusTo | zoomIn | zoomOut | moveRight| moveLeft | moveUp | moveDown | Reset | addLandmark | removeLandmark | attachLandmark | refreshAllLandmarks - } else if (instance[params]) { - instance[params].apply(instance, Array.prototype.slice.call(arguments, 1)); - } - } - } - - //return for chainability for possible cases - if (params !== "getZoomData") { - return this; - } - }; - - function checkBoolean(_var) { - if (_var === true) { - return true; - } else if (_var) { - _var = _var.toLowerCase(); - if (_var == 'yes' || _var == 'true') { - return true; - } - } - return false; - } - - - //................................................................................................................... - //Using Modernizr to check browser capabilities and property names prefixed - - /* Modernizr 2.5.3 (Custom Build) | MIT & BSD - * Build: http://www.modernizr.com/download/#-borderradius-csstransforms-csstransforms3d-touch-prefixed-teststyles-testprop-testallprops-prefixes-domprefixes - */ - var Modernizr = function (a, b, c) { function y(a) { i.cssText = a } function z(a, b) { return y(l.join(a + ";") + (b || "")) } function A(a, b) { return typeof a === b } function B(a, b) { return !!~("" + a).indexOf(b) } function C(a, b) { for (var d in a) if (i[a[d]] !== c) return b == "pfx" ? a[d] : !0; return !1 } function D(a, b, d) { for (var e in a) { var f = b[a[e]]; if (f !== c) return d === !1 ? a[e] : A(f, "function") ? f.bind(d || b) : f } return !1 } function E(a, b, c) { var d = a.charAt(0).toUpperCase() + a.substr(1), e = (a + " " + n.join(d + " ") + d).split(" "); return A(b, "string") || A(b, "undefined") ? C(e, b) : (e = (a + " " + o.join(d + " ") + d).split(" "), D(e, b, c)) } var d = "2.5.3", e = {}, f = b.documentElement, g = "modernizr", h = b.createElement(g), i = h.style, j, k = {}.toString, l = " -webkit- -moz- -o- -ms- ".split(" "), m = "Webkit Moz O ms", n = m.split(" "), o = m.toLowerCase().split(" "), p = {}, q = {}, r = {}, s = [], t = s.slice, u, v = function (a, c, d, e) { var h, i, j, k = b.createElement("div"), l = b.body, m = l ? l : b.createElement("body"); if (parseInt(d, 10)) while (d--) j = b.createElement("div"), j.id = e ? e[d] : g + (d + 1), k.appendChild(j); return h = ["­", ""].join(""), k.id = g, (l ? k : m).innerHTML += h, m.appendChild(k), l || (m.style.background = "", f.appendChild(m)), i = c(k, a), l ? k.parentNode.removeChild(k) : m.parentNode.removeChild(m), !!i }, w = {}.hasOwnProperty, x; !A(w, "undefined") && !A(w.call, "undefined") ? x = function (a, b) { return w.call(a, b) } : x = function (a, b) { return b in a && A(a.constructor.prototype[b], "undefined") }, Function.prototype.bind || (Function.prototype.bind = function (b) { var c = this; if (typeof c != "function") throw new TypeError; var d = t.call(arguments, 1), e = function () { if (this instanceof e) { var a = function () { }; a.prototype = c.prototype; var f = new a, g = c.apply(f, d.concat(t.call(arguments))); return Object(g) === g ? g : f } return c.apply(b, d.concat(t.call(arguments))) }; return e }); var F = function (c, d) { var f = c.join(""), g = d.length; v(f, function (c, d) { var f = b.styleSheets[b.styleSheets.length - 1], h = f ? f.cssRules && f.cssRules[0] ? f.cssRules[0].cssText : f.cssText || "" : "", i = c.childNodes, j = {}; while (g--) j[i[g].id] = i[g]; e.touch = "ontouchstart" in a || a.DocumentTouch && b instanceof DocumentTouch || (j.touch && j.touch.offsetTop) === 9, e.csstransforms3d = (j.csstransforms3d && j.csstransforms3d.offsetLeft) === 9 && j.csstransforms3d.offsetHeight === 3 }, g, d) }([, ["@media (", l.join("touch-enabled),("), g, ")", "{#touch{top:9px;position:absolute}}"].join(""), ["@media (", l.join("transform-3d),("), g, ")", "{#csstransforms3d{left:9px;position:absolute;height:3px;}}"].join("")], [, "touch", "csstransforms3d"]); p.touch = function () { return e.touch }, p.borderradius = function () { return E("borderRadius") }, p.csstransforms = function () { return !!E("transform") }, p.csstransforms3d = function () { var a = !!E("perspective"); return a && "webkitPerspective" in f.style && (a = e.csstransforms3d), a }; for (var G in p) x(p, G) && (u = G.toLowerCase(), e[u] = p[G](), s.push((e[u] ? "" : "no-") + u)); return y(""), h = j = null, e._version = d, e._prefixes = l, e._domPrefixes = o, e._cssomPrefixes = n, e.testProp = function (a) { return C([a]) }, e.testAllProps = E, e.testStyles = v, e.prefixed = function (a, b, c) { return b ? E(a, b, c) : E(a, "pfx") }, e }(this, this.document); - - var prop_transform = Modernizr.prefixed('transform'); - var prop_origin = Modernizr.prefixed('transformOrigin'); - var prop_radius = Modernizr.prefixed('borderRadius'); - var supportsTrans3D = Modernizr.csstransforms3d; - var supportsTouch = Modernizr.touch; - -})(jQuery, window, document); - -//End - smoothZoom - -//................................................................................................................... -//For mouse wheel support - -/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) - * Licensed under the MIT License (LICENSE.txt). - * - * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. - * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. - * Thanks to: Seamus Leahy for adding deltaX and deltaY - * - * Version: 3.0.6 - * - * Requires: 1.2.2+ - */ -(function (a) { function d(b) { var c = b || window.event, d = [].slice.call(arguments, 1), e = 0, f = !0, g = 0, h = 0; return b = a.event.fix(c), b.type = "mousewheel", c.wheelDelta && (e = c.wheelDelta / 120), c.detail && (e = -c.detail / 3), h = e, c.axis !== undefined && c.axis === c.HORIZONTAL_AXIS && (h = 0, g = -1 * e), c.wheelDeltaY !== undefined && (h = c.wheelDeltaY / 120), c.wheelDeltaX !== undefined && (g = -1 * c.wheelDeltaX / 120), d.unshift(b, e, g, h), (a.event.dispatch || a.event.handle).apply(this, d) } var b = ["DOMMouseScroll", "mousewheel"]; if (a.event.fixHooks) for (var c = b.length; c;) a.event.fixHooks[b[--c]] = a.event.mouseHooks; a.event.special.mousewheel = { setup: function () { if (this.addEventListener) for (var a = b.length; a;) this.addEventListener(b[--a], d, !1); else this.onmousewheel = d }, teardown: function () { if (this.remove_eventListener) for (var a = b.length; a;) this.remove_eventListener(b[--a], d, !1); else this.onmousewheel = null } }, a.fn.extend({ mousewheel: function (a) { return a ? this.bind("mousewheel", a) : this.trigger("mousewheel") }, unmousewheel: function (a) { return this.unbind("mousewheel", a) } }) })(jQuery) - -//................................................................................................................... \ No newline at end of file diff --git a/NzbDrone.Web/Content2/bootstrap-metro.css b/NzbDrone.Web/Content2/bootstrap-metro.css deleted file mode 100644 index 970f4c4f1..000000000 --- a/NzbDrone.Web/Content2/bootstrap-metro.css +++ /dev/null @@ -1,833 +0,0 @@ -/* === UTILS ==={ */ -/* }=== UTILS === */ -/* === COLOR - AZURE ==={ */ -/* }=== COLOR - AZURE === */ -/* === MADMIN MENU ==={ */ -/* general setup & list styles reset */ -.sidebar-menu, -.sidebar-menu ul, -.sidebar-menu li -{ - position: relative; - list-style: none; - padding: 0; - margin: 0; -} - - .sidebar-menu > li, - .sidebar-menu > li > div - { - width: 220px; - } - - .sidebar-menu li > a - { - white-space: nowrap; - } -/* drop sub-menu mix-in */ -/* main menu styles */ -.sidebar-menu -{ - /* level 0 */ - /* levels 1+ */ -} - - .sidebar-menu > li > div - { - position: relative; - } - - .sidebar-menu > li > div > a - { - display: block; - height: 30px; - padding: 10px; - color: #ffffff; - } - - .sidebar-menu > li > div > a > i - { - position: relative; - top: 5px; - margin-right: 10px; - font-size: 30px; - font-weight: normal; - } - - .sidebar-menu > li:hover > div > a, - .sidebar-menu > li.open > div > a - { - background: #6bbef6; - } - - .sidebar-menu > li.parent > div > a > span:before - { - content: ""; - display: inline-block; - width: 0px; - height: 0px; - border-width: 5px; - border-style: solid; - border-color: #61b0e9 #61b0e9 #61b0e9 #ffffff; - margin-right: 5px; - } - - .sidebar-menu > li.parent:hover > div > a > span:before, - .sidebar-menu > li.parent.open > div > a > span:before - { - content: ""; - display: inline-block; - width: 0px; - height: 0px; - border-width: 5px; - border-style: solid; - border-color: #6bbef6 #6bbef6 #6bbef6 #ffffff; - } - - .sidebar-menu > li.active > div > a - { - background: #ffffff; - color: #20202f; - } - - .sidebar-menu > li.parent.active > div > a > span:before - { - content: ""; - display: inline-block; - width: 0px; - height: 0px; - border-width: 5px; - border-style: solid; - border-color: #20202f #ffffff #ffffff #ffffff; - position: relative; - top: 1px; - } - - .sidebar-menu ul - { - display: none; - } - - .sidebar-menu ul > li > a - { - display: block; - height: 20px; - padding: 5px; - } - /* drop-right */ - .sidebar-menu.on-hover > li.parent.inactive:hover > div > ul, - .sidebar-menu > li.parent.inactive.open > div > ul - { - display: block; - position: absolute; - top: 0 !important; - left: 100% !important; - padding: 10px 0; - background: #6bbef6; - } - - .sidebar-menu.on-hover > li.parent.inactive:hover > div > ul > li a, - .sidebar-menu > li.parent.inactive.open > div > ul > li a - { - padding: 5px 16px; - height: 20px; - color: #ffffff; - } - - .sidebar-menu.on-hover > li.parent.inactive:hover > div > ul > li:hover a, - .sidebar-menu > li.parent.inactive.open > div > ul > li:hover a, - .sidebar-menu.on-hover > li.parent.inactive:hover > div > ul > li.active a, - .sidebar-menu > li.parent.inactive.open > div > ul > li.active a, - .sidebar-menu.on-hover > li.parent.inactive:hover > div > ul > li.active a:hover, - .sidebar-menu > li.parent.inactive.open > div > ul > li.active a:hover - { - padding-left: 8px; - border-left: 8px solid #aedcfb; - } - - .sidebar-menu.on-hover > li.parent.inactive:hover > div > ul > li.active a, - .sidebar-menu > li.parent.inactive.open > div > ul > li.active a, - .sidebar-menu.on-hover > li.parent.inactive:hover > div > ul > li.active a:hover, - .sidebar-menu > li.parent.inactive.open > div > ul > li.active a:hover - { - color: #20202f; - border-color: #20202f; - } -/* maximized sidebar - active's item submenu */ -.sidebar-max .sidebar-menu .active ul -{ - display: block; - padding-bottom: 10px; - background: #ffffff; -} - - .sidebar-max .sidebar-menu .active ul > li > a - { - margin-left: 72px; - color: #61b0e9; - border-color: #61b0e9; - } - - .sidebar-max .sidebar-menu .active ul > li > a:hover, - .sidebar-max .sidebar-menu .active ul > li.active > a - { - border-left: 8px solid; - padding-left: 7px; - margin-left: 62px; - } - - .sidebar-max .sidebar-menu .active ul > li.active > a - { - color: #20202f; - border-color: #20202f; - } -/* minimized sidebar */ -.sidebar-min .sidebar-menu > li -{ - width: 60px; - overflow: hidden; -} - - .sidebar-min .sidebar-menu > li.parent > div.sidebar-menu-item-wrapper > ul, - .sidebar-min .sidebar-menu > li.parent.active > div.sidebar-menu-item-wrapper > ul - { - display: block; - position: absolute; - top: 50px !important; - left: 60px !important; - padding: 10px 0; - background: #6bbef6; - min-width: 160px; - padding-top: 0 !important; - } - - .sidebar-min .sidebar-menu > li.parent > div.sidebar-menu-item-wrapper > ul > li a, - .sidebar-min .sidebar-menu > li.parent.active > div.sidebar-menu-item-wrapper > ul > li a - { - padding: 5px 16px; - height: 20px; - color: #ffffff; - } - - .sidebar-min .sidebar-menu > li.parent > div.sidebar-menu-item-wrapper > ul > li:hover a, - .sidebar-min .sidebar-menu > li.parent.active > div.sidebar-menu-item-wrapper > ul > li:hover a, - .sidebar-min .sidebar-menu > li.parent > div.sidebar-menu-item-wrapper > ul > li.active a, - .sidebar-min .sidebar-menu > li.parent.active > div.sidebar-menu-item-wrapper > ul > li.active a, - .sidebar-min .sidebar-menu > li.parent > div.sidebar-menu-item-wrapper > ul > li.active a:hover, - .sidebar-min .sidebar-menu > li.parent.active > div.sidebar-menu-item-wrapper > ul > li.active a:hover - { - padding-left: 8px; - border-left: 8px solid #aedcfb; - } - - .sidebar-min .sidebar-menu > li.parent > div.sidebar-menu-item-wrapper > ul > li.active a, - .sidebar-min .sidebar-menu > li.parent.active > div.sidebar-menu-item-wrapper > ul > li.active a, - .sidebar-min .sidebar-menu > li.parent > div.sidebar-menu-item-wrapper > ul > li.active a:hover, - .sidebar-min .sidebar-menu > li.parent.active > div.sidebar-menu-item-wrapper > ul > li.active a:hover - { - color: #20202f; - border-color: #20202f; - } - - .sidebar-min .sidebar-menu.on-hover > li:hover, - .sidebar-min .sidebar-menu > li.open - { - overflow: visible; - } - - .sidebar-min .sidebar-menu.on-hover > li:hover > div > a, - .sidebar-min .sidebar-menu > li.open > div > a - { - background: #6bbef6; - } - - .sidebar-min .sidebar-menu.on-hover > li.parent.active:hover > div > a > span:before, - .sidebar-min .sidebar-menu > li.parent.active.open > div > a > span:before - { - content: ""; - display: inline-block; - width: 0px; - height: 0px; - border-width: 5px; - border-style: solid; - border-color: #20202f #6bbef6 #6bbef6 #6bbef6; - position: relative; - top: 1px; - } - - .sidebar-min .sidebar-menu.on-hover > li.parent:hover > div > a > span:before, - .sidebar-min .sidebar-menu > li.parent.open > div > a > span:before - { - content: ""; - display: inline-block; - width: 0px; - height: 0px; - border-width: 5px; - border-style: solid; - border-color: #ffffff #6bbef6 #6bbef6 #6bbef6; - position: relative; - top: 1px; - } -/* }=== MADMIN MENU === */ -/* === LAYOUT ==={ */ -body -{ - padding: 30px 0 40px 0; -} - - body.help-page - { - padding: 0; - } - -.row-fluid -{ - position: relative; -} - -#topbar -{ - position: fixed; - top: 0; - width: 100%; - height: 30px; - padding: 0 3px; - border: 0; - margin: 0; - text-align: center; - z-index: 5000; -} - - #topbar > li - { - display: inline-block; - position: relative; - } - -#sidebar -{ - position: absolute; - width: 220px; - padding: 10px 0 70px 0; - z-index: 1000; -} - - #sidebar.fixed - { - position: fixed !important; - top: 30px; - left: 0; - bottom: 0; - } - -.sidebar-min #sidebar -{ - width: 60px; -} - -.sidebar-min #content -{ - left: 0; - margin-left: 80px; -} - -#container -{ - padding: 0; -} - -#content -{ - position: absolute; - top: 20px; - left: 240px; - right: 20px; - width: auto; - min-width: 600px; - margin: 0; -} - -.page.hidden -{ - position: absolute; - left: -10000px; - top: -10000px; -} - -.panel -{ - margin: 0 auto 20px auto; -} - - .panel header - { - padding: 0 10px; - height: 30px; - } - - .panel header i - { - position: relative; - top: 5px; - margin-right: 5px; - } - - .panel header span - { - position: relative; - top: 5px; - } - - .panel .content - { - padding: 10px; - } - -#panel-login -{ - width: 345px; -} - - #panel-login .content - { - padding: 30px; - } -/* }=== LAYOUT === */ -/* === LOOKS ==={ */ -body.help-page -{ - background-color: #FDFCE4; -} - -.hero-unit, -input, -button, -select, -textarea -{ - border-radius: 0 !important; -} -/* Top Bar */ -#topbar -{ - background: #3a4450; - color: #ffffff; -} - - #topbar h1 - { - position: relative; - top: -6px; - font-size: 14px; - font-weight: normal; - } - - #topbar h1 i - { - position: relative; - top: 3px; - margin-right: 5px; - font-size: 20px; - color: #6ac8fb; - } - - #topbar h1 a - { - color: #ffffff; - } - - #topbar h1 a:hover - { - text-decoration: none; - } - - #topbar > li > a - { - display: inline-block; - padding: 6px 10px 0 10px; - font-size: 11px; - font-weight: bold; - text-transform: uppercase; - color: #ffffff; - height: 24px; - line-height: 20px; - } - - #topbar > li > a:hover - { - text-decoration: none; - background: #4b5867; - } - - #topbar > li.pull-right > a - { - margin-left: 10px; - } - - #topbar > li.parent > a > span:after - { - content: ""; - display: inline-block; - width: 0px; - height: 0px; - border-width: 5px; - border-style: solid; - border-color: #ffffff #3a4450 #3a4450 #3a4450; - position: relative; - top: 1px; - position: relative; - top: 2px; - margin-left: 5px; - } - - #topbar > li.parent > a:hover > span:after - { - content: ""; - display: inline-block; - width: 0px; - height: 0px; - border-width: 5px; - border-style: solid; - border-color: #ffffff #4b5867 #4b5867 #4b5867; - position: relative; - top: 1px; - position: relative; - top: 2px; - margin-left: 5px; - } - - #topbar .dropdown-menu - { - top: 98%; - right: 0; - padding: 0 0 0 0; - background: #3a4450; - border: 0; - border-radius: 0; - box-shadow: none; - text-align: left; - } - - #topbar .dropdown-menu * - { - color: #ffffff; - } - - #topbar .dropdown-menu > li > a - { - height: 24px; - } - - #topbar .dropdown-menu > li > a:hover - { - background: #4b5867; - } - - #topbar .dropdown-menu > li.divider - { - background: none; - border-bottom-color: #4b5867; - } -/* Bootstrap drop-downs behavior enhancement */ -ul.on-hover > li.parent:hover > .dropdown-menu -{ - display: block; -} -/* Sidebar Resizer */ -#sidebar-resizer -{ - display: block; - position: absolute; - bottom: 0; - padding: 10px; - width: 200px; - height: 30px; - text-align: center; - font-size: 32px; - color: #20202f; - margin: 10px 0 10px 0; -} - - #sidebar-resizer:hover - { - text-decoration: none; - } - - #sidebar-resizer i.max - { - display: none; - } - -.sidebar-min #sidebar-resizer -{ - width: 40px; -} - - .sidebar-min #sidebar-resizer i.max - { - display: inline-block; - } - - .sidebar-min #sidebar-resizer i.min - { - display: none; - } -/* Sidebar Mini-Search */ -.search-mini -{ - position: relative; - margin: 10px 0 20px 0; -} - - .search-mini input - { - border: 0; - margin: 0 10px; - width: 192px; - height: 22px; - background: #3a4450; - color: #ffffff; - } - - .search-mini button - { - position: absolute; - width: 30px; - height: 30px; - padding: 0; - border: 0; - margin: 0; - background: #3a4450; - color: #ffffff; - top: 0; - right: 10px; - font-size: 18px; - } - -.sidebar-min .search-mini input -{ - width: 32px; -} - -.sidebar-min .search-mini :-webkit-input-placeholder, -.sidebar-min .search-mini :-moz-placeholder -{ - display: none; -} - -.sidebar-min .search-mini button -{ - right: 24.5%; -} - -.sidebar-min .search-mini:hover input -{ - width: 162px; -} - -.sidebar-min .search-mini:hover button -{ - left: 162px; -} -/* Panels */ -.panel header, -.accordion-heading -{ - background: #3a4450; -} - - .panel header *, - .accordion-heading *, - .panel header a:hover, - .accordion-heading a:hover - { - color: #ffffff; - text-decoration: none; - } - -.panel .content -{ - background: #f7f7fd; - color: #3a4450; - border: 1px solid #f0f0fb; -} - -.hero-unit, -.form-actions -{ - background: #f7f7fd; -} -/* Table of Key Numbers */ -.table-key-numbers -{ - width: 100%; - text-align: center; -} - - .table-key-numbers td - { - font-size: 30px; - font-weight: bold; - line-height: 1.6em; - color: #20202f; - } - - .table-key-numbers th - { - color: #666; - font-weight: normal; - color: #8b9198; - } -/* Demo Charts */ -#stats-area-chart, -#dashboard-dynamic-chart, -#stats-pie-chart -{ - margin: 10px; - height: 200px; -} - -#stats-pie-chart -{ - margin: 10px auto 10px auto; - width: 400px; - overflow: hidden; -} -/* Sidebar */ -#sidebar -{ - background: #61b0e9; -} -/* Tablesorter Plugin */ -table.tablesorter thead tr .headerSortDown, -table.tablesorter thead tr .headerSortUp -{ - background-color: #aedcfb; -} - -table.tablesorter thead tr th, -table.tablesorter tfoot tr th -{ - background-color: #61b0e9; -} - -table.tablesorter -{ - background-color: #f7f7fd; -} -/* Accordions */ -.accordion-group, -.accordion-inner -{ - border: 0; -} - -.sidebar-menu a:hover -{ - text-decoration: none; -} - -.sidebar-menu > li > div > a -{ - font-weight: bold; - text-transform: uppercase; - font-size: 12px; -} - -.hero-unit h1 -{ - margin-bottom: 0.15em; -} -/* }=== TYPO === */ -/* === FORMS ==={ */ -/* }=== FORMS === */ -/* === BUTTONS ==={ */ -.btn -{ - filter: none; - border-radius: 0; -} - -.btn-madmin.btn.btn-primary -{ - background: #61b0e9; - color: #ffffff; - text-transform: uppercase; - font-size: 14px; - border-color: #389ae2; - text-shadow: none; -} - - .btn-madmin.btn.btn-primary:hover - { - border-color: #6bbef6; - background: #6bbef6; - color: #ffffff; - } - - .btn-madmin.btn.btn-primary.btn-large - { - font-size: 16px; - } - - .btn-madmin.btn.btn-primary.btn-small - { - font-size: 12px; - } - - .btn-madmin.btn.btn-primary.btn-mini - { - font-size: 10px; - } - -.btn-madmin.btn -{ - background: #DCE0F1; - text-shadow: none; - border-color: #C1C1E3; -} - - .btn-madmin.btn:hover - { - background: #E3EAF9; - border-color: #CECEF4; - } -/* Tile buttons */ -.tile-btn -{ - display: inline-block; - width: 105px; - height: 85px; - margin: 5px; - background: #61b0e9; - color: #ffffff; - text-align: center; -} - - .tile-btn:hover - { - text-decoration: none; - background: #6bbef6; - color: #ffffff; - } - - .tile-btn i - { - display: block; - font-size: 32px; - margin-top: 20px; - } - - .tile-btn span - { - display: block; - margin-top: 10px; - } - -.tiles-container -{ - text-align: center; -} -/* }=== BUTTONS === */ -/* === FIXES ==={ */ -/* }=== FIXES === */ diff --git a/NzbDrone.Web/Content2/bootstrap-overrides.css b/NzbDrone.Web/Content2/bootstrap-overrides.css deleted file mode 100644 index 13dd4416f..000000000 --- a/NzbDrone.Web/Content2/bootstrap-overrides.css +++ /dev/null @@ -1,83 +0,0 @@ -body { - padding-top: 0px; - color: #57606b; -} - -div, table, ul { - -moz-border-radius: 0 !important; - -webkit-border-radius: 0 !important; - border-radius: 0 !important; -} - -table { - font-size: 16px; -} - - table th, .table th { - font-size: 20px; - font-weight: 100; - text-transform: lowercase; - } - -h1 { - font-size: 60px; - padding-bottom: 50px; -} - -h2 { - font-size: 40px; -} - -h3 { - font-size: 30px; -} - -h1, h2, h3 { - text-transform: lowercase; -} - -input, -textarea, -.uneditable-input { - width: 400px; -} - -.field-validation-error { - color: rgb(207, 27, 27); -} - -.alert-error ul { - margin: 0px; - list-style-type: none; -} - -:not([class^="alert-"]:before), -:not([class*="alert-"]:before), -[class^="icon-"]:before, -[class*=" icon-"]:before { - color: #57606b; -} - -[class^="icon-"]:before, -[class*=" icon-"]:before { - margin-right: 7px; -} - - -form input[type=submit] { - margin-top: 30px; -} - -.btn { - margin-right: 10px; -} - -.btn-hover { - padding: 7px 15px; -} - - .btn-hover:hover { - background: white; - color: #57606b; - text-decoration: none; - } diff --git a/NzbDrone.Web/Content2/file-browser.css b/NzbDrone.Web/Content2/file-browser.css deleted file mode 100644 index 0ca22fbb6..000000000 --- a/NzbDrone.Web/Content2/file-browser.css +++ /dev/null @@ -1,19 +0,0 @@ -/* -[class^="icon-"]:before, -[class*=" icon-"]:before { - font-size: 30px; -} -*/ - - -#main > .icon-folder-open, .icon-file, .icon-download-alt { - font-size: 25px; -} - -.link-download { - margin-right: 10px; -} - -.file-browser-message { - text-align: center; -} diff --git a/NzbDrone.Web/Content2/metro.blue.css b/NzbDrone.Web/Content2/metro.blue.css deleted file mode 100644 index 664408b6f..000000000 --- a/NzbDrone.Web/Content2/metro.blue.css +++ /dev/null @@ -1,830 +0,0 @@ -.accent { - color: #1ba1e2; -} - -.white { - color: #fff; -} - -.black { - color: #000; -} - -.blue { - color: #1ba1e2; -} - -.brown { - color: #a05000; -} - -.green { - color: #393; -} - -.lime { - color: #8cbf26; -} - -.magenta { - color: #ff0097; -} - -.orange { - color: #f09609; -} - -.pink { - color: #e671b8; -} - -.purple { - color: #a200ff; -} - -.red { - color: #e51400; -} - -.teal { - color: #00aba9; -} - -.whitebg { - background-color: #fff; -} - -.blackbg { - background-color: #000; -} - -.bluebg { - background-color: #1ba1e2; -} - -.brownbg { - background-color: #a05000; -} - -.greenbg { - background-color: #393; -} - -.limebg { - background-color: #8cbf26; -} - -.magentabg { - background-color: #ff0097; -} - -.orangebg { - background-color: #f09609; -} - -.pinkbg { - background-color: #e671b8; -} - -.purplebg { - background-color: #a200ff; -} - -.redbg { - background-color: #e51400; -} - -.tealbg { - background-color: #00aba9; -} - -@font-face { - font-family: 'RobotoRegular'; - src: url('../fonts/Roboto-Regular-webfont.eot'); - src: url('../fonts/Roboto-Regular-webfont.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-Regular-webfont.woff') format('woff'),url('../fonts/Roboto-Regular-webfont.ttf') format('truetype'),url('../fonts/Roboto-Regular-webfont.svg#RobotoRegular') format('svg'); - font-weight: normal; - font-style: normal; -} - -@font-face { - font-family: 'RobotoLight'; - src: url('../fonts/Roboto-Light-webfont.eot'); - src: url('../fonts/Roboto-Light-webfont.eot?#iefix') format('embedded-opentype'),url('../fonts/Roboto-Light-webfont.woff') format('woff'),url('../fonts/Roboto-Light-webfont.ttf') format('truetype'),url('../fonts/Roboto-Light-webfont.svg#RobotoLight') format('svg'); - font-weight: normal; - font-style: normal; -} - -#headingstyles { - font-family: "Segoe UI Light","Helvetica Neue",'RobotoLight',"Segoe UI","Segoe WP",sans-serif; - font-weight: 100; - margin-top: 5px; - margin-bottom: 0px; - text-transform: lowercase; -} - -body { - font-family: "Segoe UI","Segoe WP","Helvetica Neue",'RobotoRegular',sans-serif; - font-size: 14px; -} - -h1, h2, h3, h4, h5, h6 { - font-family: "Segoe UI Light","Helvetica Neue",'RobotoLight',"Segoe UI","Segoe WP",sans-serif; - font-weight: 100; - margin-top: 5px; - margin-bottom: 0px; - text-transform: lowercase; -} - -h1 { - font-size: 56px; -} - -h2 { - font-size: 42px; -} - -h3 { - font-size: 28px; -} - -h4, h5, h6 { - font-weight: normal; - text-transform: uppercase; -} - -ul.metro-list, ol.metro-list { - padding: 0; -} - - ul.metro-list li, ol.metro-list li { - display: block; - list-style-type: none; - border-left: solid 30px #1ba1e2; - height: 20px; - list-style-position: inside; - margin: 10px 0; - padding: 5px; - } - -ul.metro-list { - overflow: hidden; -} - -ol.metro-list { - text-indent: -25px; - counter-reset: item; -} - - ol.metro-list li:before { - color: white; - margin-right: 25px; - content: counter(item) " "; - counter-increment: item; - } - -.tile { - -webkit-perspective: 0; - -webkit-transform-style: preserve- 3 d; - -webkit-transition: -webkit-transform 0.2s; - float: left; - margin-right: 10px; - margin-bottom: 10px; - text-align: center; - padding: 5px; - opacity: 0.75; -} - - .tile h1, .tile h2, .tile h3, .tile h4, .tile h5, .tile h6 { - color: #fff; - -webkit-user-select: none; - } - - .tile h2 { - font-size: 1.75em; - margin-top: -10px; - margin-left: 0px; - } - - .tile a:hover { - text-decoration: none; - } - - .tile img { - border: 0; - } - - .tile:hover { - opacity: 1; - } - -.tiles { - clear: both; -} - -.tilerow { - float: left; - -webkit-perspective: 0; - -webkit-transform-style: preserve- 3 d; - -webkit-user-select: none; -} - -.one { - width: 130px; - height: 130px; -} - -.two-h { - width: 280px; - height: 130px; -} - -.two-v { - width: 130px; - height: 280px; -} - -.firstcol, .secondcol, .thirdcol, .fourthcol, .fifthcol { - position: absolute; -} - -.secondcol { - margin-left: 150px; -} - -.thirdcol { - margin-left: 300px; -} - -.fourthcol { - margin-left: 450px; -} - -.fifthcol { - margin-left: 600px; -} - -metro-pivot .headers { - clear: both; - display: block; - white-space: nowrap; -} - -.metro-pivot .pivot-item h3, .metro-pivot .headers .header { - font-family: "Segoe UI Light","Helvetica Neue",'RobotoLight',"Segoe UI","Segoe WP",sans-serif; - font-weight: 100; - margin-top: 5px; - margin-bottom: 0px; - text-transform: lowercase; - cursor: pointer; - display: inline-block; - font-size: 42px; - margin-right: 24px; - padding: 0; - vertical-align: top; -} - -.metro-pivot .headers { - white-space: nowrap; - display: block; - clear: both; -} - - .metro-pivot .pivot-item h3, .metro-pivot .headers .header { - font-family: "Segoe UI Light","Helvetica Neue",'RobotoLight',"Segoe UI","Segoe WP",sans-serif; - font-weight: 100; - margin-top: 5px; - margin-bottom: 0px; - text-transform: lowercase; - font-size: 42px; - display: inline-block; - vertical-align: top; - padding: 0; - cursor: pointer; - margin-right: 24px; - } - -.metro-pivot .items { - position: relative; -} - - .metro-pivot .items .pivotItem { - display: block; - white-space: normal; - text-align: justify; - width: 100%; - } - -article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { - display: block; -} - -audio, canvas, video { - display: inline-block; - *display: inline; - *zoom: 1; -} - - audio:not([controls]) { - display: none; - } - -html { - font-size: 100%; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; -} - -a:focus { - outline: thin dotted; - outline: 5px auto -webkit-focus-ring-color; - outline-offset: -2px; -} - -a:hover, a:active { - outline: 0; -} - -sub, sup { - position: relative; - font-size: 75%; - line-height: 0; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -img { - max-width: 100%; - height: auto; - border: 0; - -ms-interpolation-mode: bicubic; -} - -button, input, select, textarea { - margin: 0; - font-size: 100%; - vertical-align: middle; -} - -button, input { - *overflow: visible; - line-height: normal; -} - - button::-moz-focus-inner, input::-moz-focus-inner { - padding: 0; - border: 0; - } - - button, input[type="button"], input[type="reset"], input[type="submit"] { - cursor: pointer; - -webkit-appearance: button; - } - - input[type="search"] { - -webkit-appearance: textfield; - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; - } - - input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { - -webkit-appearance: none; - } - -textarea { - overflow: auto; - vertical-align: top; -} - -.container { - width: 940px; - margin-left: auto; - margin-right: auto; - *zoom: 1; -} - - .container:before, .container:after { - display: table; - content: ""; - } - - .container:after { - clear: both; - } - -.container-fluid { - padding-left: 20px; - padding-right: 20px; - *zoom: 1; -} - - .container-fluid:before, .container-fluid:after { - display: table; - content: ""; - } - - .container-fluid:after { - clear: both; - } - -.row { - margin-left: -20px; - *zoom: 1; -} - - .row:before, .row:after { - display: table; - content: ""; - } - - .row:after { - clear: both; - } - -[class*="span"] { - float: left; - margin-left: 20px; -} - -.span1 { - width: 60px; -} - -.span2 { - width: 140px; -} - -.span3 { - width: 220px; -} - -.span4 { - width: 300px; -} - -.span5 { - width: 380px; -} - -.span6 { - width: 460px; -} - -.span7 { - width: 540px; -} - -.span8 { - width: 620px; -} - -.span9 { - width: 700px; -} - -.span10 { - width: 780px; -} - -.span11 { - width: 860px; -} - -.span12, .container { - width: 940px; -} - -.offset1 { - margin-left: 100px; -} - -.offset2 { - margin-left: 180px; -} - -.offset3 { - margin-left: 260px; -} - -.offset4 { - margin-left: 340px; -} - -.offset5 { - margin-left: 420px; -} - -.offset6 { - margin-left: 500px; -} - -.offset7 { - margin-left: 580px; -} - -.offset8 { - margin-left: 660px; -} - -.offset9 { - margin-left: 740px; -} - -.offset10 { - margin-left: 820px; -} - -.offset11 { - margin-left: 900px; -} - -.row-fluid { - width: 100%; - *zoom: 1; -} - - .row-fluid:before, .row-fluid:after { - display: table; - content: ""; - } - - .row-fluid:after { - clear: both; - } - - .row-fluid > [class*="span"] { - float: left; - margin-left: 2.13%; - } - - .row-fluid > [class*="span"]:first-child { - margin-left: 0; - } - - .row-fluid .span1 { - width: 6.38%; - } - - .row-fluid .span2 { - width: 14.89%; - } - - .row-fluid .span3 { - width: 23.4%; - } - - .row-fluid .span4 { - width: 31.91%; - } - - .row-fluid .span5 { - width: 40.43%; - } - - .row-fluid .span6 { - width: 48.94%; - } - - .row-fluid .span7 { - width: 57.45%; - } - - .row-fluid .span8 { - width: 65.96%; - } - - .row-fluid .span9 { - width: 74.47%; - } - - .row-fluid .span10 { - width: 82.98%; - } - - .row-fluid .span11 { - width: 91.49%; - } - - .row-fluid .span12 { - width: 100%; - } - -@-webkit-keyframes progress-bar-stripes { - from { - background-position: 0 0; - } - - to { - background-position: 40px 0; - } -} - -@-moz-keyframes progress-bar-stripes { - from { - background-position: 0 0; - } - - to { - background-position: 40px 0; - } -} - -@keyframes progress-bar-stripes { - from { - background-position: 0 0; - } - - to { - background-position: 40px 0; - } -} - -.progress { - overflow: hidden; - height: 18px; - margin-bottom: 18px; - background-color: #f7f7f7; - background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9); - background-image: -ms-linear-gradient(top, #f5f5f5, #f9f9f9); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9)); - background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9); - background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9); - background-image: linear-gradient(top, #f5f5f5, #f9f9f9); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#f9f9f9', GradientType=0); - -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - - .progress .bar { - width: 0%; - height: 18px; - color: #fff; - font-size: 12px; - text-align: center; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background-color: #5ebdeb; - background-image: -moz-linear-gradient(top, #8bd0f1, #1ba1e2); - background-image: -ms-linear-gradient(top, #8bd0f1, #1ba1e2); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#8bd0f1), to(#1ba1e2)); - background-image: -webkit-linear-gradient(top, #8bd0f1, #1ba1e2); - background-image: -o-linear-gradient(top, #8bd0f1, #1ba1e2); - background-image: linear-gradient(top, #8bd0f1, #1ba1e2); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8bd0f1', endColorstr='#1ba1e2', GradientType=0); - -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); - -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); - box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - -webkit-transition: width 0.6s ease; - -moz-transition: width 0.6s ease; - -ms-transition: width 0.6s ease; - -o-transition: width 0.6s ease; - transition: width 0.6s ease; - } - -.progress-striped .bar { - background-color: #1ba1e2; - background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); - background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - -webkit-background-size: 40px 40px; - -moz-background-size: 40px 40px; - -o-background-size: 40px 40px; - background-size: 40px 40px; -} - -.progress.active .bar { - -webkit-animation: progress-bar-stripes 2s linear infinite; - -moz-animation: progress-bar-stripes 2s linear infinite; - animation: progress-bar-stripes 2s linear infinite; -} - -.progress-danger .bar { - background-color: #dd514c; - background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35); - background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35)); - background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); - background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); - background-image: linear-gradient(top, #ee5f5b, #c43c35); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0); -} - -.progress-danger.progress-striped .bar { - background-color: #ee5f5b; - background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); - background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -} - -.progress-success .bar { - background-color: #5eb95e; - background-image: -moz-linear-gradient(top, #62c462, #57a957); - background-image: -ms-linear-gradient(top, #62c462, #57a957); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957)); - background-image: -webkit-linear-gradient(top, #62c462, #57a957); - background-image: -o-linear-gradient(top, #62c462, #57a957); - background-image: linear-gradient(top, #62c462, #57a957); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0); -} - -.progress-success.progress-striped .bar { - background-color: #62c462; - background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); - background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -} - -.progress-info .bar { - background-color: #4bb1cf; - background-image: -moz-linear-gradient(top, #5bc0de, #339bb9); - background-image: -ms-linear-gradient(top, #5bc0de, #339bb9); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9)); - background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9); - background-image: -o-linear-gradient(top, #5bc0de, #339bb9); - background-image: linear-gradient(top, #5bc0de, #339bb9); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0); -} - -.progress-info.progress-striped .bar { - background-color: #5bc0de; - background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent)); - background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); -} - -.pull-right { - float: right; -} - -.pull-left { - float: left; -} - -.hide { - display: none; -} - -.show { - display: block; -} - -.invisible { - visibility: hidden; -} - -a { - color: #1ba1e2; - text-decoration: none; -} - - a:hover { - color: #13709e; - text-decoration: underline; - } - -pre { - padding: 15px; - border: 1px solid #aaa; - background: #fafafa; -} - -code { - background: #fafafa; - border: 1px solid #aaa; - padding-left: 5px; - padding-right: 5px; -} - -.clear { - clear: both; -} diff --git a/NzbDrone.Web/Content2/metro.css b/NzbDrone.Web/Content2/metro.css deleted file mode 100644 index 2d6de616b..000000000 --- a/NzbDrone.Web/Content2/metro.css +++ /dev/null @@ -1,160 +0,0 @@ -body>h1{ - font:60px 'Ubuntu Condensed', sans-serif; - font-weight:lighter; - color:#fff; - cursor:default; - margin:40px 0 0 5%; -} - -#center{ - margin:0 auto; - width:2100px; - padding:50px; -} - -#center a:focus{ outline:0 } - -#center section{ - width:910px; - display:inline-block; - margin-right:100px; -} - -#center a{ - display:block; - float:left; - margin:4px; - height:100px; - width:250px; - padding:25px; - background:#5fbfbf; - z-index:0; - color:#fff; - font-size:18px; - font:18px 'Cantarell', sans-serif; - text-decoration:none; - -} -#center a span{ - letter-spacing:-3px; - font-size:50px; - text-transform:uppercase -} - -#center a img{ - display:inline; - margin:-25px 0 0 -25px -} - -#center a.normal, #center a.numbers{ - background: #479ea8; - background: -moz-linear-gradient(left, #479ea8 1%, #53b6bc 98%); - background: -webkit-gradient(linear, left top, right top, color-stop(1%,#479ea8), color-stop(98%,#53b6bc)); - background: -webkit-linear-gradient(left, #479ea8 1%,#53b6bc 98%); - background: -o-linear-gradient(left, #479ea8 1%,#53b6bc 98%); - background: -ms-linear-gradient(left, #479ea8 1%,#53b6bc 98%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#479ea8', endColorstr='#53b6bc',GradientType=1 ); - background: linear-gradient(left, #479ea8 1%,#53b6bc 98%); - border:1px solid #59b0b6 -} -#center a.normal:hover, #center a.numbers:hover{ - background:#53b6bc; -} -#center a.fulltext{ - background: #de8211; /* Old browsers */ - background: -moz-linear-gradient(left, #de8211 0%, #e3a419 94%); - background: -webkit-gradient(linear, left top, right top, color-stop(0%,#de8211), color-stop(94%,#e3a419)); - background: -webkit-linear-gradient(left, #de8211 0%,#e3a419 94%); - background: -o-linear-gradient(left, #de8211 0%,#e3a419 94%); - background: -ms-linear-gradient(left, #de8211 0%,#e3a419 94%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#de8211', endColorstr='#e3a419',GradientType=1 ); - background: linear-gradient(left, #de8211 0%,#e3a419 94%); - border:1px solid #d8923d; - font-size:16px; -} -#center a.fulltext:hover{ - background:#e3a419; -} -#center a.icon{ - background: #7ca024; - background: -moz-linear-gradient(left, #7ca024 3%, #9ab92f 98%); - background: -webkit-gradient(linear, left top, right top, color-stop(3%,#7ca024), color-stop(98%,#9ab92f)); - background: -webkit-linear-gradient(left, #7ca024 3%,#9ab92f 98%); - background: -o-linear-gradient(left, #7ca024 3%,#9ab92f 98%); - background: -ms-linear-gradient(left, #7ca024 3%,#9ab92f 98%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7ca024', endColorstr='#9ab92f',GradientType=1 ); - background: linear-gradient(left, #7ca024 3%,#9ab92f 98%); - width:100px; - border:1px solid #aab662 -} -#center a.icon:hover{ - background:#9ab92f; -} - -#center a.preview{ - background: #c74430; /* Old browsers */ - background: -moz-linear-gradient(left, #c74430 0%, #d85636 95%); - background: -webkit-gradient(linear, left top, right top, color-stop(0%,#c74430), color-stop(95%,#d85636)); - background: -webkit-linear-gradient(left, #c74430 0%,#d85636 95%); - background: -o-linear-gradient(left, #c74430 0%,#d85636 95%); - background: -ms-linear-gradient(left, #c74430 0%,#d85636 95%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c74430', endColorstr='#d85636',GradientType=1 ); - background: linear-gradient(left, #c74430 0%,#d85636 95%); - font-size:30px; - border:1px solid #d55b46; - border-top:0 -} -#center a.preview:hover{ - background:#d85636; -} -#center a.preview img{ - display:block; - margin-bottom:5px -} - -#center a.search{ - background: #631254; /* Old browsers */ - background: -moz-linear-gradient(left, #631254 4%, #7c1d6e 98%); - background: -webkit-gradient(linear, left top, right top, color-stop(4%,#631254), color-stop(98%,#7c1d6e)); - background: -webkit-linear-gradient(left, #631254 4%,#7c1d6e 98%); - background: -o-linear-gradient(left, #631254 4%,#7c1d6e 98%); - background: -ms-linear-gradient(left, #631254 4%,#7c1d6e 98%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#631254', endColorstr='#7c1d6e',GradientType=1 ); - background: linear-gradient(left, #631254 4%,#7c1d6e 98%); - border:1px solid #7b387f; - width:100px; -} -#center a.search:hover{ - background:#7c1d6e; -} - -#center a.twitter{ - background: #652d9a; - background: -moz-linear-gradient(left, #652d9a 3%, #7f37b5 98%); - background: -webkit-gradient(linear, left top, right top, color-stop(3%,#652d9a), color-stop(98%,#7f37b5)); - background: -webkit-linear-gradient(left, #652d9a 3%,#7f37b5 98%); - background: -o-linear-gradient(left, #652d9a 3%,#7f37b5 98%); - background: -ms-linear-gradient(left, #652d9a 3%,#7f37b5 98%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#652d9a', endColorstr='#7f37b5',GradientType=1 ); - background: linear-gradient(left, #652d9a 3%,#7f37b5 98%); - border:1px solid #8148b1; - font-size:16px; - text-shadow:1px 1px 2px ##652d9a; - width:260px; - height:110px; - padding-top:15px; - padding-left:15px; -} -#center a.twitter:hover{background:#7f37b5} -#center a.twitter>span{font-size:20px;letter-spacing:-3px} -#center a.twitter>i{font-size:.9em;font-style:italic;} -#center a.twitter>img{ - float:left; - margin:0 5px 0 0; -} - -#center a.images{ - padding:0; - width:302px; - height:152px; -} \ No newline at end of file diff --git a/NzbDrone.Web/Content2/stats.css b/NzbDrone.Web/Content2/stats.css deleted file mode 100644 index 4a5eb7ff5..000000000 --- a/NzbDrone.Web/Content2/stats.css +++ /dev/null @@ -1,36 +0,0 @@ -.stat-item { - background: whiteSmoke; - font-weight: 100; -} - - -.user-stats { - margin-bottom: 30px; -} - -.stat-value { - font-size: 50px; - padding-bottom: 20px; - padding-left: 5px; - border-bottom-style: solid; - border-bottom-width: 10px; -} - -.stat-size { - color: #1081CD; -} - -.stat-count { - color: #8EBD40; -} - -.stat-last-backup { - color: #988CC3; -} - -.stat-lable { - color: #57606B; - margin-bottom: 15px; - padding-left: 5px; - -} diff --git a/NzbDrone.Web/Controllers/V2Controller.cs b/NzbDrone.Web/Controllers/V2Controller.cs new file mode 100644 index 000000000..70f9a8c9d --- /dev/null +++ b/NzbDrone.Web/Controllers/V2Controller.cs @@ -0,0 +1,21 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; + +namespace NzbDrone.Web.Controllers +{ + public class V2Controller : Controller + { + // + // GET: /V2/ + + public ActionResult Index() + { + return View(); + } + + } +} diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 9d7286f95..abaf1c5f5 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -182,102 +182,91 @@ - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - mixins.less - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -386,36 +375,19 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + diff --git a/NzbDrone.Web/Scripts2/Metro/jquery.metro.js b/NzbDrone.Web/Scripts2/Metro/jquery.metro.js deleted file mode 100644 index 9ddbafa96..000000000 --- a/NzbDrone.Web/Scripts2/Metro/jquery.metro.js +++ /dev/null @@ -1,162 +0,0 @@ -/** - * jqMetro - * JQUERY PLUGIN FOR METRO UI CONTROLS - * - * Copyright (c) 2011 Mohammad Valipour (http://manorey.net/mohblog) - * Licensed under the MIT License: - * http://www.opensource.org/licenses/mit-license.php - * - */ - -;(function ($) { - var defaults = { - animationDuration: 150, - headerOpacity: 0.5, - fixedHeaders: false, - headerSelector: function (item) { return item.children("h3").first(); }, - itemSelector: function (item) { return item.children(".pivot-item"); }, - headerItemTemplate: function () { return $(""); }, - pivotItemTemplate: function () { return $("
      "); }, - itemsTemplate: function () { return $("
      "); }, - headersTemplate: function () { return $("
      "); }, - controlInitialized: undefined, - selectedItemChanged: undefined - }; - - $.fn.metroPivot = function (settings) { - if(this.length > 1) - { - return this.each(function(index, el){ $(el).wp7Pivot(settings); }); - } - - $.extend(this, defaults, settings); - $.extend(this,{ - animating : false, - headers : undefined, - items : undefined, - goToNext: function(){ - if(this.animating) return; - this.headers.children(".current").next().trigger("click"); - }, - goToPrevious: function(){ - if(this.animating) return; - this.headers.children(".header").last().trigger("click"); - }, - goToItemByName:function(header){ - if(this.animating) return; - this.headers.children(":contains("+header+")").first().trigger("click"); - }, - goToItemByIndex:function(index){ - if(this.animating) return; - this.headers.children().eq(index).trigger("click"); - }, - initialize : function () { - var pivot = this; - // define sections - - var headers = pivot.headersTemplate(); - var items = pivot.itemsTemplate(); - - pivot.itemSelector(pivot).each(function (index, el) { - el = $(el); - - var h3Element = pivot.headerSelector(el); - if (h3Element.length == 0) return; - - var headerItem = pivot.headerItemTemplate().html(h3Element.html()).fadeTo(0, pivot.headerOpacity); - var pivotItem = pivot.pivotItemTemplate().append(el).hide(); - - if (index == 0) { - headerItem.addClass("current").fadeTo(0, 1); - pivotItem.addClass("current").show(); - } - headerItem.attr("index", index); - headerItem.click(function() { pivot.pivotHeader_Click($(this)); }); - - headers.append(headerItem); - items.append(pivotItem); - - h3Element.remove(); - }); - - pivot.append(headers).append(items); - pivot.headers = headers; - pivot.items = items; - - this.data("controller", pivot); - - if(this.controlInitialized != undefined) - { - this.controlInitialized(); - } - }, - setCurrentHeader: function(header){ - var pivot = this; - - // make current header a normal one - this.headers.children(".header.current").removeClass("current").fadeTo(0, this.headerOpacity); - - // make selected header to current - header.addClass("current").fadeTo(0, 1); - - if(pivot.fixedHeaders == false) - { - // create a copy for fadeout navigation - var copy = header.prevAll().clone(); - // detach items to move to end of headers - var detached = $(header.prevAll().detach().toArray().reverse()); - - // copy animation items to beginning and animate them - $("").append(copy).prependTo(pivot.headers).animate({ width: 0, opacity: 0 }, pivot.animationDuration, function () { - // when finished: delete animation objects - $(this).remove(); - - // and attach detached items to the end of headers - detached.fadeTo(0, 0).appendTo(pivot.headers).fadeTo(200, pivot.headerOpacity); - }); - } - }, - setCurrentItem: function(item, index){ - var pivot = this; - - // hide current item immediately - pivot.items.children(".pivotItem.current").hide().removeClass("current"); - - // after a little delay - setTimeout(function () { - // move the item to far right and make it visible - item.css({ marginLeft: item.outerWidth() }).show().addClass("current"); - - // animate it to left - item.animate( { marginLeft: 0 }, pivot.animationDuration, function() { pivot.currentItemChanged(index);}); - - }, 200); - }, - currentItemChanged: function(index) { - this.animating = false; - if(this.selectedItemChanged != undefined) - { - this.selectedItemChanged(index); - } - }, - pivotHeader_Click : function (me) { - // ignore if already current - if (me.is(".current")) return; - - // ignore if still animating - if (this.animating) return; - this.animating = true; - - // set current header - this.setCurrentHeader(me); - - var index = me.attr("index"); - // find and set current item - var item = this.items.children(".pivotItem:nth(" + index + ")"); - this.setCurrentItem(item, index); - }, - }); - - return this.initialize(); - }; -})(jQuery); \ No newline at end of file diff --git a/NzbDrone.Web/Scripts2/Metro/tilt.js b/NzbDrone.Web/Scripts2/Metro/tilt.js deleted file mode 100644 index fc77a4666..000000000 --- a/NzbDrone.Web/Scripts2/Metro/tilt.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - Base off Tim Holman's tile tilt: http://tholman.com/experiments/css3/metro-tiles/ -*/ - -function addTileTilt() -{ - var tile = this; - var mouse = {x: 0, y: 0, down: false}; - var maxRotation = 16; - - var setRotation = function(){ - var width = tile.offsetWidth; - var height = tile.offsetHeight; - //Rotations as percentages - var yRotation = (mouse.x - (width / 2)) / (width / 2); - var xRotation = (mouse.y - (height / 2)) / (height / 2); - - tile.style.webkitTransform = "rotateX(" + -xRotation * maxRotation + "deg)" + - " rotateY(" + yRotation * maxRotation + "deg)"; - - tile.style.mozTransform = "rotateX(" + -xRotation * maxRotation + "deg)" + - " rotateY(" + yRotation * maxRotation + "deg)"; - - tile.style.transform = "rotateX(" + -xRotation * maxRotation + "deg)" + - " rotateY(" + yRotation * maxRotation + "deg)"; - } - - var MouseDown = function(e){ - mouse.x = e.offsetX; - mouse.y = e.offsetY; - mouse.down = true; - setRotation(); - } - - var MouseUp = function(e){ - mouse.down = false; - tile.style.webkitTransform = "rotateX(0deg)" + - " rotateY(0deg)"; - - tile.style.mozTransform = "rotateX(0deg)" + - " rotateY(0deg)"; - - tile.style.transform = "rotateX(0deg)" + - " rotateY(0deg)"; - } - - var MouseMove = function(e){ - mouse.x = e.offsetX; - mouse.y = e.offsetY; - if (mouse.down == true){ - setRotation(); - } - } - - - tile.addEventListener('mousemove', MouseMove, false); - tile.addEventListener('mousedown', MouseDown, false); - tile.addEventListener('mouseup', MouseUp, false); - tile.addEventListener('mouseout', MouseUp, false); -} \ No newline at end of file diff --git a/NzbDrone.Web/Scripts2/MicrosoftAjax.debug.js b/NzbDrone.Web/Scripts2/MicrosoftAjax.debug.js deleted file mode 100644 index a5f7942ef..000000000 --- a/NzbDrone.Web/Scripts2/MicrosoftAjax.debug.js +++ /dev/null @@ -1,7117 +0,0 @@ -// Name: MicrosoftAjax.debug.js -// Assembly: System.Web.Extensions -// Version: 4.0.0.0 -// FileVersion: 4.0.20526.0 -//----------------------------------------------------------------------- -// Copyright (C) Microsoft Corporation. All rights reserved. -//----------------------------------------------------------------------- -// MicrosoftAjax.js -// Microsoft AJAX Framework. - -Function.__typeName = 'Function'; -Function.__class = true; -Function.createCallback = function Function$createCallback(method, context) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "method", type: Function}, - {name: "context", mayBeNull: true} - ]); - if (e) throw e; - return function() { - var l = arguments.length; - if (l > 0) { - var args = []; - for (var i = 0; i < l; i++) { - args[i] = arguments[i]; - } - args[l] = context; - return method.apply(this, args); - } - return method.call(this, context); - } -} -Function.createDelegate = function Function$createDelegate(instance, method) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "instance", mayBeNull: true}, - {name: "method", type: Function} - ]); - if (e) throw e; - return function() { - return method.apply(instance, arguments); - } -} -Function.emptyFunction = Function.emptyMethod = function Function$emptyMethod() { - /// -} -Function.validateParameters = function Function$validateParameters(parameters, expectedParameters, validateParameterCount) { - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "parameters"}, - {name: "expectedParameters"}, - {name: "validateParameterCount", type: Boolean, optional: true} - ]); - if (e) throw e; - return Function._validateParams(parameters, expectedParameters, validateParameterCount); -} -Function._validateParams = function Function$_validateParams(params, expectedParams, validateParameterCount) { - var e, expectedLength = expectedParams.length; - validateParameterCount = validateParameterCount || (typeof(validateParameterCount) === "undefined"); - e = Function._validateParameterCount(params, expectedParams, validateParameterCount); - if (e) { - e.popStackFrame(); - return e; - } - for (var i = 0, l = params.length; i < l; i++) { - var expectedParam = expectedParams[Math.min(i, expectedLength - 1)], - paramName = expectedParam.name; - if (expectedParam.parameterArray) { - paramName += "[" + (i - expectedLength + 1) + "]"; - } - else if (!validateParameterCount && (i >= expectedLength)) { - break; - } - e = Function._validateParameter(params[i], expectedParam, paramName); - if (e) { - e.popStackFrame(); - return e; - } - } - return null; -} -Function._validateParameterCount = function Function$_validateParameterCount(params, expectedParams, validateParameterCount) { - var i, error, - expectedLen = expectedParams.length, - actualLen = params.length; - if (actualLen < expectedLen) { - var minParams = expectedLen; - for (i = 0; i < expectedLen; i++) { - var param = expectedParams[i]; - if (param.optional || param.parameterArray) { - minParams--; - } - } - if (actualLen < minParams) { - error = true; - } - } - else if (validateParameterCount && (actualLen > expectedLen)) { - error = true; - for (i = 0; i < expectedLen; i++) { - if (expectedParams[i].parameterArray) { - error = false; - break; - } - } - } - if (error) { - var e = Error.parameterCount(); - e.popStackFrame(); - return e; - } - return null; -} -Function._validateParameter = function Function$_validateParameter(param, expectedParam, paramName) { - var e, - expectedType = expectedParam.type, - expectedInteger = !!expectedParam.integer, - expectedDomElement = !!expectedParam.domElement, - mayBeNull = !!expectedParam.mayBeNull; - e = Function._validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName); - if (e) { - e.popStackFrame(); - return e; - } - var expectedElementType = expectedParam.elementType, - elementMayBeNull = !!expectedParam.elementMayBeNull; - if (expectedType === Array && typeof(param) !== "undefined" && param !== null && - (expectedElementType || !elementMayBeNull)) { - var expectedElementInteger = !!expectedParam.elementInteger, - expectedElementDomElement = !!expectedParam.elementDomElement; - for (var i=0; i < param.length; i++) { - var elem = param[i]; - e = Function._validateParameterType(elem, expectedElementType, - expectedElementInteger, expectedElementDomElement, elementMayBeNull, - paramName + "[" + i + "]"); - if (e) { - e.popStackFrame(); - return e; - } - } - } - return null; -} -Function._validateParameterType = function Function$_validateParameterType(param, expectedType, expectedInteger, expectedDomElement, mayBeNull, paramName) { - var e, i; - if (typeof(param) === "undefined") { - if (mayBeNull) { - return null; - } - else { - e = Error.argumentUndefined(paramName); - e.popStackFrame(); - return e; - } - } - if (param === null) { - if (mayBeNull) { - return null; - } - else { - e = Error.argumentNull(paramName); - e.popStackFrame(); - return e; - } - } - if (expectedType && expectedType.__enum) { - if (typeof(param) !== 'number') { - e = Error.argumentType(paramName, Object.getType(param), expectedType); - e.popStackFrame(); - return e; - } - if ((param % 1) === 0) { - var values = expectedType.prototype; - if (!expectedType.__flags || (param === 0)) { - for (i in values) { - if (values[i] === param) return null; - } - } - else { - var v = param; - for (i in values) { - var vali = values[i]; - if (vali === 0) continue; - if ((vali & param) === vali) { - v -= vali; - } - if (v === 0) return null; - } - } - } - e = Error.argumentOutOfRange(paramName, param, String.format(Sys.Res.enumInvalidValue, param, expectedType.getName())); - e.popStackFrame(); - return e; - } - if (expectedDomElement && (!Sys._isDomElement(param) || (param.nodeType === 3))) { - e = Error.argument(paramName, Sys.Res.argumentDomElement); - e.popStackFrame(); - return e; - } - if (expectedType && !Sys._isInstanceOfType(expectedType, param)) { - e = Error.argumentType(paramName, Object.getType(param), expectedType); - e.popStackFrame(); - return e; - } - if (expectedType === Number && expectedInteger) { - if ((param % 1) !== 0) { - e = Error.argumentOutOfRange(paramName, param, Sys.Res.argumentInteger); - e.popStackFrame(); - return e; - } - } - return null; -} - -Error.__typeName = 'Error'; -Error.__class = true; -Error.create = function Error$create(message, errorInfo) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "message", type: String, mayBeNull: true, optional: true}, - {name: "errorInfo", mayBeNull: true, optional: true} - ]); - if (e) throw e; - var err = new Error(message); - err.message = message; - if (errorInfo) { - for (var v in errorInfo) { - err[v] = errorInfo[v]; - } - } - err.popStackFrame(); - return err; -} -Error.argument = function Error$argument(paramName, message) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "paramName", type: String, mayBeNull: true, optional: true}, - {name: "message", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - var displayMessage = "Sys.ArgumentException: " + (message ? message : Sys.Res.argument); - if (paramName) { - displayMessage += "\n" + String.format(Sys.Res.paramName, paramName); - } - var err = Error.create(displayMessage, { name: "Sys.ArgumentException", paramName: paramName }); - err.popStackFrame(); - return err; -} -Error.argumentNull = function Error$argumentNull(paramName, message) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "paramName", type: String, mayBeNull: true, optional: true}, - {name: "message", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - var displayMessage = "Sys.ArgumentNullException: " + (message ? message : Sys.Res.argumentNull); - if (paramName) { - displayMessage += "\n" + String.format(Sys.Res.paramName, paramName); - } - var err = Error.create(displayMessage, { name: "Sys.ArgumentNullException", paramName: paramName }); - err.popStackFrame(); - return err; -} -Error.argumentOutOfRange = function Error$argumentOutOfRange(paramName, actualValue, message) { - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "paramName", type: String, mayBeNull: true, optional: true}, - {name: "actualValue", mayBeNull: true, optional: true}, - {name: "message", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - var displayMessage = "Sys.ArgumentOutOfRangeException: " + (message ? message : Sys.Res.argumentOutOfRange); - if (paramName) { - displayMessage += "\n" + String.format(Sys.Res.paramName, paramName); - } - if (typeof(actualValue) !== "undefined" && actualValue !== null) { - displayMessage += "\n" + String.format(Sys.Res.actualValue, actualValue); - } - var err = Error.create(displayMessage, { - name: "Sys.ArgumentOutOfRangeException", - paramName: paramName, - actualValue: actualValue - }); - err.popStackFrame(); - return err; -} -Error.argumentType = function Error$argumentType(paramName, actualType, expectedType, message) { - /// - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "paramName", type: String, mayBeNull: true, optional: true}, - {name: "actualType", type: Type, mayBeNull: true, optional: true}, - {name: "expectedType", type: Type, mayBeNull: true, optional: true}, - {name: "message", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - var displayMessage = "Sys.ArgumentTypeException: "; - if (message) { - displayMessage += message; - } - else if (actualType && expectedType) { - displayMessage += - String.format(Sys.Res.argumentTypeWithTypes, actualType.getName(), expectedType.getName()); - } - else { - displayMessage += Sys.Res.argumentType; - } - if (paramName) { - displayMessage += "\n" + String.format(Sys.Res.paramName, paramName); - } - var err = Error.create(displayMessage, { - name: "Sys.ArgumentTypeException", - paramName: paramName, - actualType: actualType, - expectedType: expectedType - }); - err.popStackFrame(); - return err; -} -Error.argumentUndefined = function Error$argumentUndefined(paramName, message) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "paramName", type: String, mayBeNull: true, optional: true}, - {name: "message", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - var displayMessage = "Sys.ArgumentUndefinedException: " + (message ? message : Sys.Res.argumentUndefined); - if (paramName) { - displayMessage += "\n" + String.format(Sys.Res.paramName, paramName); - } - var err = Error.create(displayMessage, { name: "Sys.ArgumentUndefinedException", paramName: paramName }); - err.popStackFrame(); - return err; -} -Error.format = function Error$format(message) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "message", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - var displayMessage = "Sys.FormatException: " + (message ? message : Sys.Res.format); - var err = Error.create(displayMessage, {name: 'Sys.FormatException'}); - err.popStackFrame(); - return err; -} -Error.invalidOperation = function Error$invalidOperation(message) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "message", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - var displayMessage = "Sys.InvalidOperationException: " + (message ? message : Sys.Res.invalidOperation); - var err = Error.create(displayMessage, {name: 'Sys.InvalidOperationException'}); - err.popStackFrame(); - return err; -} -Error.notImplemented = function Error$notImplemented(message) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "message", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - var displayMessage = "Sys.NotImplementedException: " + (message ? message : Sys.Res.notImplemented); - var err = Error.create(displayMessage, {name: 'Sys.NotImplementedException'}); - err.popStackFrame(); - return err; -} -Error.parameterCount = function Error$parameterCount(message) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "message", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - var displayMessage = "Sys.ParameterCountException: " + (message ? message : Sys.Res.parameterCount); - var err = Error.create(displayMessage, {name: 'Sys.ParameterCountException'}); - err.popStackFrame(); - return err; -} -Error.prototype.popStackFrame = function Error$popStackFrame() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (typeof(this.stack) === "undefined" || this.stack === null || - typeof(this.fileName) === "undefined" || this.fileName === null || - typeof(this.lineNumber) === "undefined" || this.lineNumber === null) { - return; - } - var stackFrames = this.stack.split("\n"); - var currentFrame = stackFrames[0]; - var pattern = this.fileName + ":" + this.lineNumber; - while(typeof(currentFrame) !== "undefined" && - currentFrame !== null && - currentFrame.indexOf(pattern) === -1) { - stackFrames.shift(); - currentFrame = stackFrames[0]; - } - var nextFrame = stackFrames[1]; - if (typeof(nextFrame) === "undefined" || nextFrame === null) { - return; - } - var nextFrameParts = nextFrame.match(/@(.*):(\d+)$/); - if (typeof(nextFrameParts) === "undefined" || nextFrameParts === null) { - return; - } - this.fileName = nextFrameParts[1]; - this.lineNumber = parseInt(nextFrameParts[2]); - stackFrames.shift(); - this.stack = stackFrames.join("\n"); -} - -Object.__typeName = 'Object'; -Object.__class = true; -Object.getType = function Object$getType(instance) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "instance"} - ]); - if (e) throw e; - var ctor = instance.constructor; - if (!ctor || (typeof(ctor) !== "function") || !ctor.__typeName || (ctor.__typeName === 'Object')) { - return Object; - } - return ctor; -} -Object.getTypeName = function Object$getTypeName(instance) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "instance"} - ]); - if (e) throw e; - return Object.getType(instance).getName(); -} - -String.__typeName = 'String'; -String.__class = true; -String.prototype.endsWith = function String$endsWith(suffix) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "suffix", type: String} - ]); - if (e) throw e; - return (this.substr(this.length - suffix.length) === suffix); -} -String.prototype.startsWith = function String$startsWith(prefix) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "prefix", type: String} - ]); - if (e) throw e; - return (this.substr(0, prefix.length) === prefix); -} -String.prototype.trim = function String$trim() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this.replace(/^\s+|\s+$/g, ''); -} -String.prototype.trimEnd = function String$trimEnd() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this.replace(/\s+$/, ''); -} -String.prototype.trimStart = function String$trimStart() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this.replace(/^\s+/, ''); -} -String.format = function String$format(format, args) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "format", type: String}, - {name: "args", mayBeNull: true, parameterArray: true} - ]); - if (e) throw e; - return String._toFormattedString(false, arguments); -} -String._toFormattedString = function String$_toFormattedString(useLocale, args) { - var result = ''; - var format = args[0]; - for (var i=0;;) { - var open = format.indexOf('{', i); - var close = format.indexOf('}', i); - if ((open < 0) && (close < 0)) { - result += format.slice(i); - break; - } - if ((close > 0) && ((close < open) || (open < 0))) { - if (format.charAt(close + 1) !== '}') { - throw Error.argument('format', Sys.Res.stringFormatBraceMismatch); - } - result += format.slice(i, close + 1); - i = close + 2; - continue; - } - result += format.slice(i, open); - i = open + 1; - if (format.charAt(i) === '{') { - result += '{'; - i++; - continue; - } - if (close < 0) throw Error.argument('format', Sys.Res.stringFormatBraceMismatch); - var brace = format.substring(i, close); - var colonIndex = brace.indexOf(':'); - var argNumber = parseInt((colonIndex < 0)? brace : brace.substring(0, colonIndex), 10) + 1; - if (isNaN(argNumber)) throw Error.argument('format', Sys.Res.stringFormatInvalid); - var argFormat = (colonIndex < 0)? '' : brace.substring(colonIndex + 1); - var arg = args[argNumber]; - if (typeof(arg) === "undefined" || arg === null) { - arg = ''; - } - if (arg.toFormattedString) { - result += arg.toFormattedString(argFormat); - } - else if (useLocale && arg.localeFormat) { - result += arg.localeFormat(argFormat); - } - else if (arg.format) { - result += arg.format(argFormat); - } - else - result += arg.toString(); - i = close + 1; - } - return result; -} - -Boolean.__typeName = 'Boolean'; -Boolean.__class = true; -Boolean.parse = function Boolean$parse(value) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "value", type: String} - ], false); - if (e) throw e; - var v = value.trim().toLowerCase(); - if (v === 'false') return false; - if (v === 'true') return true; - throw Error.argumentOutOfRange('value', value, Sys.Res.boolTrueOrFalse); -} - -Date.__typeName = 'Date'; -Date.__class = true; - -Number.__typeName = 'Number'; -Number.__class = true; - -RegExp.__typeName = 'RegExp'; -RegExp.__class = true; - -if (!window) this.window = this; -window.Type = Function; -Type.__fullyQualifiedIdentifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]([^ \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*[^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\])?$", "i"); -Type.__identifierRegExp = new RegExp("^[^.0-9 \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\][^. \\s|,;:&*=+\\-()\\[\\]{}^%#@!~\\n\\r\\t\\f\\\\]*$", "i"); -Type.prototype.callBaseMethod = function Type$callBaseMethod(instance, name, baseArguments) { - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "instance"}, - {name: "name", type: String}, - {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true} - ]); - if (e) throw e; - var baseMethod = Sys._getBaseMethod(this, instance, name); - if (!baseMethod) throw Error.invalidOperation(String.format(Sys.Res.methodNotFound, name)); - if (!baseArguments) { - return baseMethod.apply(instance); - } - else { - return baseMethod.apply(instance, baseArguments); - } -} -Type.prototype.getBaseMethod = function Type$getBaseMethod(instance, name) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "instance"}, - {name: "name", type: String} - ]); - if (e) throw e; - return Sys._getBaseMethod(this, instance, name); -} -Type.prototype.getBaseType = function Type$getBaseType() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return (typeof(this.__baseType) === "undefined") ? null : this.__baseType; -} -Type.prototype.getInterfaces = function Type$getInterfaces() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - var result = []; - var type = this; - while(type) { - var interfaces = type.__interfaces; - if (interfaces) { - for (var i = 0, l = interfaces.length; i < l; i++) { - var interfaceType = interfaces[i]; - if (!Array.contains(result, interfaceType)) { - result[result.length] = interfaceType; - } - } - } - type = type.__baseType; - } - return result; -} -Type.prototype.getName = function Type$getName() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return (typeof(this.__typeName) === "undefined") ? "" : this.__typeName; -} -Type.prototype.implementsInterface = function Type$implementsInterface(interfaceType) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "interfaceType", type: Type} - ]); - if (e) throw e; - this.resolveInheritance(); - var interfaceName = interfaceType.getName(); - var cache = this.__interfaceCache; - if (cache) { - var cacheEntry = cache[interfaceName]; - if (typeof(cacheEntry) !== 'undefined') return cacheEntry; - } - else { - cache = this.__interfaceCache = {}; - } - var baseType = this; - while (baseType) { - var interfaces = baseType.__interfaces; - if (interfaces) { - if (Array.indexOf(interfaces, interfaceType) !== -1) { - return cache[interfaceName] = true; - } - } - baseType = baseType.__baseType; - } - return cache[interfaceName] = false; -} -Type.prototype.inheritsFrom = function Type$inheritsFrom(parentType) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "parentType", type: Type} - ]); - if (e) throw e; - this.resolveInheritance(); - var baseType = this.__baseType; - while (baseType) { - if (baseType === parentType) { - return true; - } - baseType = baseType.__baseType; - } - return false; -} -Type.prototype.initializeBase = function Type$initializeBase(instance, baseArguments) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "instance"}, - {name: "baseArguments", type: Array, mayBeNull: true, optional: true, elementMayBeNull: true} - ]); - if (e) throw e; - if (!Sys._isInstanceOfType(this, instance)) throw Error.argumentType('instance', Object.getType(instance), this); - this.resolveInheritance(); - if (this.__baseType) { - if (!baseArguments) { - this.__baseType.apply(instance); - } - else { - this.__baseType.apply(instance, baseArguments); - } - } - return instance; -} -Type.prototype.isImplementedBy = function Type$isImplementedBy(instance) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "instance", mayBeNull: true} - ]); - if (e) throw e; - if (typeof(instance) === "undefined" || instance === null) return false; - var instanceType = Object.getType(instance); - return !!(instanceType.implementsInterface && instanceType.implementsInterface(this)); -} -Type.prototype.isInstanceOfType = function Type$isInstanceOfType(instance) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "instance", mayBeNull: true} - ]); - if (e) throw e; - return Sys._isInstanceOfType(this, instance); -} -Type.prototype.registerClass = function Type$registerClass(typeName, baseType, interfaceTypes) { - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "typeName", type: String}, - {name: "baseType", type: Type, mayBeNull: true, optional: true}, - {name: "interfaceTypes", type: Type, parameterArray: true} - ]); - if (e) throw e; - if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName); - var parsedName; - try { - parsedName = eval(typeName); - } - catch(e) { - throw Error.argument('typeName', Sys.Res.argumentTypeName); - } - if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName); - if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName)); - if ((arguments.length > 1) && (typeof(baseType) === 'undefined')) throw Error.argumentUndefined('baseType'); - if (baseType && !baseType.__class) throw Error.argument('baseType', Sys.Res.baseNotAClass); - this.prototype.constructor = this; - this.__typeName = typeName; - this.__class = true; - if (baseType) { - this.__baseType = baseType; - this.__basePrototypePending = true; - } - Sys.__upperCaseTypes[typeName.toUpperCase()] = this; - if (interfaceTypes) { - this.__interfaces = []; - this.resolveInheritance(); - for (var i = 2, l = arguments.length; i < l; i++) { - var interfaceType = arguments[i]; - if (!interfaceType.__interface) throw Error.argument('interfaceTypes[' + (i - 2) + ']', Sys.Res.notAnInterface); - for (var methodName in interfaceType.prototype) { - var method = interfaceType.prototype[methodName]; - if (!this.prototype[methodName]) { - this.prototype[methodName] = method; - } - } - this.__interfaces.push(interfaceType); - } - } - Sys.__registeredTypes[typeName] = true; - return this; -} -Type.prototype.registerInterface = function Type$registerInterface(typeName) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "typeName", type: String} - ]); - if (e) throw e; - if (!Type.__fullyQualifiedIdentifierRegExp.test(typeName)) throw Error.argument('typeName', Sys.Res.notATypeName); - var parsedName; - try { - parsedName = eval(typeName); - } - catch(e) { - throw Error.argument('typeName', Sys.Res.argumentTypeName); - } - if (parsedName !== this) throw Error.argument('typeName', Sys.Res.badTypeName); - if (Sys.__registeredTypes[typeName]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, typeName)); - Sys.__upperCaseTypes[typeName.toUpperCase()] = this; - this.prototype.constructor = this; - this.__typeName = typeName; - this.__interface = true; - Sys.__registeredTypes[typeName] = true; - return this; -} -Type.prototype.resolveInheritance = function Type$resolveInheritance() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (this.__basePrototypePending) { - var baseType = this.__baseType; - baseType.resolveInheritance(); - for (var memberName in baseType.prototype) { - var memberValue = baseType.prototype[memberName]; - if (!this.prototype[memberName]) { - this.prototype[memberName] = memberValue; - } - } - delete this.__basePrototypePending; - } -} -Type.getRootNamespaces = function Type$getRootNamespaces() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return Array.clone(Sys.__rootNamespaces); -} -Type.isClass = function Type$isClass(type) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "type", mayBeNull: true} - ]); - if (e) throw e; - if ((typeof(type) === 'undefined') || (type === null)) return false; - return !!type.__class; -} -Type.isInterface = function Type$isInterface(type) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "type", mayBeNull: true} - ]); - if (e) throw e; - if ((typeof(type) === 'undefined') || (type === null)) return false; - return !!type.__interface; -} -Type.isNamespace = function Type$isNamespace(object) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "object", mayBeNull: true} - ]); - if (e) throw e; - if ((typeof(object) === 'undefined') || (object === null)) return false; - return !!object.__namespace; -} -Type.parse = function Type$parse(typeName, ns) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "typeName", type: String, mayBeNull: true}, - {name: "ns", mayBeNull: true, optional: true} - ]); - if (e) throw e; - var fn; - if (ns) { - fn = Sys.__upperCaseTypes[ns.getName().toUpperCase() + '.' + typeName.toUpperCase()]; - return fn || null; - } - if (!typeName) return null; - if (!Type.__htClasses) { - Type.__htClasses = {}; - } - fn = Type.__htClasses[typeName]; - if (!fn) { - fn = eval(typeName); - if (typeof(fn) !== 'function') throw Error.argument('typeName', Sys.Res.notATypeName); - Type.__htClasses[typeName] = fn; - } - return fn; -} -Type.registerNamespace = function Type$registerNamespace(namespacePath) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "namespacePath", type: String} - ]); - if (e) throw e; - Type._registerNamespace(namespacePath); -} -Type._registerNamespace = function Type$_registerNamespace(namespacePath) { - if (!Type.__fullyQualifiedIdentifierRegExp.test(namespacePath)) throw Error.argument('namespacePath', Sys.Res.invalidNameSpace); - var rootObject = window; - var namespaceParts = namespacePath.split('.'); - for (var i = 0; i < namespaceParts.length; i++) { - var currentPart = namespaceParts[i]; - var ns = rootObject[currentPart]; - var nsType = typeof(ns); - if ((nsType !== "undefined") && (ns !== null)) { - if (nsType === "function") { - throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsClass, namespaceParts.splice(0, i + 1).join('.'))); - } - if ((typeof(ns) !== "object") || (ns instanceof Array)) { - throw Error.invalidOperation(String.format(Sys.Res.namespaceContainsNonObject, namespaceParts.splice(0, i + 1).join('.'))); - } - } - if (!ns) { - ns = rootObject[currentPart] = {}; - } - if (!ns.__namespace) { - if ((i === 0) && (namespacePath !== "Sys")) { - Sys.__rootNamespaces[Sys.__rootNamespaces.length] = ns; - } - ns.__namespace = true; - ns.__typeName = namespaceParts.slice(0, i + 1).join('.'); - var parsedName; - try { - parsedName = eval(ns.__typeName); - } - catch(e) { - parsedName = null; - } - if (parsedName !== ns) { - delete rootObject[currentPart]; - throw Error.argument('namespacePath', Sys.Res.invalidNameSpace); - } - ns.getName = function ns$getName() {return this.__typeName;} - } - rootObject = ns; - } -} -Type._checkDependency = function Type$_checkDependency(dependency, featureName) { - var scripts = Type._registerScript._scripts, isDependent = (scripts ? (!!scripts[dependency]) : false); - if ((typeof(featureName) !== 'undefined') && !isDependent) { - throw Error.invalidOperation(String.format(Sys.Res.requiredScriptReferenceNotIncluded, - featureName, dependency)); - } - return isDependent; -} -Type._registerScript = function Type$_registerScript(scriptName, dependencies) { - var scripts = Type._registerScript._scripts; - if (!scripts) { - Type._registerScript._scripts = scripts = {}; - } - if (scripts[scriptName]) { - throw Error.invalidOperation(String.format(Sys.Res.scriptAlreadyLoaded, scriptName)); - } - scripts[scriptName] = true; - if (dependencies) { - for (var i = 0, l = dependencies.length; i < l; i++) { - var dependency = dependencies[i]; - if (!Type._checkDependency(dependency)) { - throw Error.invalidOperation(String.format(Sys.Res.scriptDependencyNotFound, scriptName, dependency)); - } - } - } -} -Type._registerNamespace("Sys"); -Sys.__upperCaseTypes = {}; -Sys.__rootNamespaces = [Sys]; -Sys.__registeredTypes = {}; -Sys._isInstanceOfType = function Sys$_isInstanceOfType(type, instance) { - if (typeof(instance) === "undefined" || instance === null) return false; - if (instance instanceof type) return true; - var instanceType = Object.getType(instance); - return !!(instanceType === type) || - (instanceType.inheritsFrom && instanceType.inheritsFrom(type)) || - (instanceType.implementsInterface && instanceType.implementsInterface(type)); -} -Sys._getBaseMethod = function Sys$_getBaseMethod(type, instance, name) { - if (!Sys._isInstanceOfType(type, instance)) throw Error.argumentType('instance', Object.getType(instance), type); - var baseType = type.getBaseType(); - if (baseType) { - var baseMethod = baseType.prototype[name]; - return (baseMethod instanceof Function) ? baseMethod : null; - } - return null; -} -Sys._isDomElement = function Sys$_isDomElement(obj) { - var val = false; - if (typeof (obj.nodeType) !== 'number') { - var doc = obj.ownerDocument || obj.document || obj; - if (doc != obj) { - var w = doc.defaultView || doc.parentWindow; - val = (w != obj); - } - else { - val = (typeof (doc.body) === 'undefined'); - } - } - return !val; -} - -Array.__typeName = 'Array'; -Array.__class = true; -Array.add = Array.enqueue = function Array$enqueue(array, item) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "array", type: Array, elementMayBeNull: true}, - {name: "item", mayBeNull: true} - ]); - if (e) throw e; - array[array.length] = item; -} -Array.addRange = function Array$addRange(array, items) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "array", type: Array, elementMayBeNull: true}, - {name: "items", type: Array, elementMayBeNull: true} - ]); - if (e) throw e; - array.push.apply(array, items); -} -Array.clear = function Array$clear(array) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "array", type: Array, elementMayBeNull: true} - ]); - if (e) throw e; - array.length = 0; -} -Array.clone = function Array$clone(array) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "array", type: Array, elementMayBeNull: true} - ]); - if (e) throw e; - if (array.length === 1) { - return [array[0]]; - } - else { - return Array.apply(null, array); - } -} -Array.contains = function Array$contains(array, item) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "array", type: Array, elementMayBeNull: true}, - {name: "item", mayBeNull: true} - ]); - if (e) throw e; - return (Sys._indexOf(array, item) >= 0); -} -Array.dequeue = function Array$dequeue(array) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "array", type: Array, elementMayBeNull: true} - ]); - if (e) throw e; - return array.shift(); -} -Array.forEach = function Array$forEach(array, method, instance) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "array", type: Array, elementMayBeNull: true}, - {name: "method", type: Function}, - {name: "instance", mayBeNull: true, optional: true} - ]); - if (e) throw e; - for (var i = 0, l = array.length; i < l; i++) { - var elt = array[i]; - if (typeof(elt) !== 'undefined') method.call(instance, elt, i, array); - } -} -Array.indexOf = function Array$indexOf(array, item, start) { - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "array", type: Array, elementMayBeNull: true}, - {name: "item", mayBeNull: true, optional: true}, - {name: "start", mayBeNull: true, optional: true} - ]); - if (e) throw e; - return Sys._indexOf(array, item, start); -} -Array.insert = function Array$insert(array, index, item) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "array", type: Array, elementMayBeNull: true}, - {name: "index", mayBeNull: true}, - {name: "item", mayBeNull: true} - ]); - if (e) throw e; - array.splice(index, 0, item); -} -Array.parse = function Array$parse(value) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "value", type: String, mayBeNull: true} - ]); - if (e) throw e; - if (!value) return []; - var v = eval(value); - if (!Array.isInstanceOfType(v)) throw Error.argument('value', Sys.Res.arrayParseBadFormat); - return v; -} -Array.remove = function Array$remove(array, item) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "array", type: Array, elementMayBeNull: true}, - {name: "item", mayBeNull: true} - ]); - if (e) throw e; - var index = Sys._indexOf(array, item); - if (index >= 0) { - array.splice(index, 1); - } - return (index >= 0); -} -Array.removeAt = function Array$removeAt(array, index) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "array", type: Array, elementMayBeNull: true}, - {name: "index", mayBeNull: true} - ]); - if (e) throw e; - array.splice(index, 1); -} -Sys._indexOf = function Sys$_indexOf(array, item, start) { - if (typeof(item) === "undefined") return -1; - var length = array.length; - if (length !== 0) { - start = start - 0; - if (isNaN(start)) { - start = 0; - } - else { - if (isFinite(start)) { - start = start - (start % 1); - } - if (start < 0) { - start = Math.max(0, length + start); - } - } - for (var i = start; i < length; i++) { - if ((typeof(array[i]) !== "undefined") && (array[i] === item)) { - return i; - } - } - } - return -1; -} -Type._registerScript._scripts = { - "MicrosoftAjaxCore.js": true, - "MicrosoftAjaxGlobalization.js": true, - "MicrosoftAjaxSerialization.js": true, - "MicrosoftAjaxComponentModel.js": true, - "MicrosoftAjaxHistory.js": true, - "MicrosoftAjaxNetwork.js" : true, - "MicrosoftAjaxWebServices.js": true }; - -Sys.IDisposable = function Sys$IDisposable() { - throw Error.notImplemented(); -} - function Sys$IDisposable$dispose() { - throw Error.notImplemented(); - } -Sys.IDisposable.prototype = { - dispose: Sys$IDisposable$dispose -} -Sys.IDisposable.registerInterface('Sys.IDisposable'); - -Sys.StringBuilder = function Sys$StringBuilder(initialText) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "initialText", mayBeNull: true, optional: true} - ]); - if (e) throw e; - this._parts = (typeof(initialText) !== 'undefined' && initialText !== null && initialText !== '') ? - [initialText.toString()] : []; - this._value = {}; - this._len = 0; -} - function Sys$StringBuilder$append(text) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "text", mayBeNull: true} - ]); - if (e) throw e; - this._parts[this._parts.length] = text; - } - function Sys$StringBuilder$appendLine(text) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "text", mayBeNull: true, optional: true} - ]); - if (e) throw e; - this._parts[this._parts.length] = - ((typeof(text) === 'undefined') || (text === null) || (text === '')) ? - '\r\n' : text + '\r\n'; - } - function Sys$StringBuilder$clear() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - this._parts = []; - this._value = {}; - this._len = 0; - } - function Sys$StringBuilder$isEmpty() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (this._parts.length === 0) return true; - return this.toString() === ''; - } - function Sys$StringBuilder$toString(separator) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "separator", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - separator = separator || ''; - var parts = this._parts; - if (this._len !== parts.length) { - this._value = {}; - this._len = parts.length; - } - var val = this._value; - if (typeof(val[separator]) === 'undefined') { - if (separator !== '') { - for (var i = 0; i < parts.length;) { - if ((typeof(parts[i]) === 'undefined') || (parts[i] === '') || (parts[i] === null)) { - parts.splice(i, 1); - } - else { - i++; - } - } - } - val[separator] = this._parts.join(separator); - } - return val[separator]; - } -Sys.StringBuilder.prototype = { - append: Sys$StringBuilder$append, - appendLine: Sys$StringBuilder$appendLine, - clear: Sys$StringBuilder$clear, - isEmpty: Sys$StringBuilder$isEmpty, - toString: Sys$StringBuilder$toString -} -Sys.StringBuilder.registerClass('Sys.StringBuilder'); - -Sys.Browser = {}; -Sys.Browser.InternetExplorer = {}; -Sys.Browser.Firefox = {}; -Sys.Browser.Safari = {}; -Sys.Browser.Opera = {}; -Sys.Browser.agent = null; -Sys.Browser.hasDebuggerStatement = false; -Sys.Browser.name = navigator.appName; -Sys.Browser.version = parseFloat(navigator.appVersion); -Sys.Browser.documentMode = 0; -if (navigator.userAgent.indexOf(' MSIE ') > -1) { - Sys.Browser.agent = Sys.Browser.InternetExplorer; - Sys.Browser.version = parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]); - if (Sys.Browser.version >= 8) { - if (document.documentMode >= 7) { - Sys.Browser.documentMode = document.documentMode; - } - } - Sys.Browser.hasDebuggerStatement = true; -} -else if (navigator.userAgent.indexOf(' Firefox/') > -1) { - Sys.Browser.agent = Sys.Browser.Firefox; - Sys.Browser.version = parseFloat(navigator.userAgent.match(/ Firefox\/(\d+\.\d+)/)[1]); - Sys.Browser.name = 'Firefox'; - Sys.Browser.hasDebuggerStatement = true; -} -else if (navigator.userAgent.indexOf(' AppleWebKit/') > -1) { - Sys.Browser.agent = Sys.Browser.Safari; - Sys.Browser.version = parseFloat(navigator.userAgent.match(/ AppleWebKit\/(\d+(\.\d+)?)/)[1]); - Sys.Browser.name = 'Safari'; -} -else if (navigator.userAgent.indexOf('Opera/') > -1) { - Sys.Browser.agent = Sys.Browser.Opera; -} - -Sys.EventArgs = function Sys$EventArgs() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); -} -Sys.EventArgs.registerClass('Sys.EventArgs'); -Sys.EventArgs.Empty = new Sys.EventArgs(); - -Sys.CancelEventArgs = function Sys$CancelEventArgs() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - Sys.CancelEventArgs.initializeBase(this); - this._cancel = false; -} - function Sys$CancelEventArgs$get_cancel() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._cancel; - } - function Sys$CancelEventArgs$set_cancel(value) { - var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]); - if (e) throw e; - this._cancel = value; - } -Sys.CancelEventArgs.prototype = { - get_cancel: Sys$CancelEventArgs$get_cancel, - set_cancel: Sys$CancelEventArgs$set_cancel -} -Sys.CancelEventArgs.registerClass('Sys.CancelEventArgs', Sys.EventArgs); -Type.registerNamespace('Sys.UI'); - -Sys._Debug = function Sys$_Debug() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); -} - function Sys$_Debug$_appendConsole(text) { - if ((typeof(Debug) !== 'undefined') && Debug.writeln) { - Debug.writeln(text); - } - if (window.console && window.console.log) { - window.console.log(text); - } - if (window.opera) { - window.opera.postError(text); - } - if (window.debugService) { - window.debugService.trace(text); - } - } - function Sys$_Debug$_appendTrace(text) { - var traceElement = document.getElementById('TraceConsole'); - if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) { - traceElement.value += text + '\n'; - } - } - function Sys$_Debug$assert(condition, message, displayCaller) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "condition", type: Boolean}, - {name: "message", type: String, mayBeNull: true, optional: true}, - {name: "displayCaller", type: Boolean, optional: true} - ]); - if (e) throw e; - if (!condition) { - message = (displayCaller && this.assert.caller) ? - String.format(Sys.Res.assertFailedCaller, message, this.assert.caller) : - String.format(Sys.Res.assertFailed, message); - if (confirm(String.format(Sys.Res.breakIntoDebugger, message))) { - this.fail(message); - } - } - } - function Sys$_Debug$clearTrace() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - var traceElement = document.getElementById('TraceConsole'); - if (traceElement && (traceElement.tagName.toUpperCase() === 'TEXTAREA')) { - traceElement.value = ''; - } - } - function Sys$_Debug$fail(message) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "message", type: String, mayBeNull: true} - ]); - if (e) throw e; - this._appendConsole(message); - if (Sys.Browser.hasDebuggerStatement) { - eval('debugger'); - } - } - function Sys$_Debug$trace(text) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "text"} - ]); - if (e) throw e; - this._appendConsole(text); - this._appendTrace(text); - } - function Sys$_Debug$traceDump(object, name) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "object", mayBeNull: true}, - {name: "name", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - var text = this._traceDump(object, name, true); - } - function Sys$_Debug$_traceDump(object, name, recursive, indentationPadding, loopArray) { - name = name? name : 'traceDump'; - indentationPadding = indentationPadding? indentationPadding : ''; - if (object === null) { - this.trace(indentationPadding + name + ': null'); - return; - } - switch(typeof(object)) { - case 'undefined': - this.trace(indentationPadding + name + ': Undefined'); - break; - case 'number': case 'string': case 'boolean': - this.trace(indentationPadding + name + ': ' + object); - break; - default: - if (Date.isInstanceOfType(object) || RegExp.isInstanceOfType(object)) { - this.trace(indentationPadding + name + ': ' + object.toString()); - break; - } - if (!loopArray) { - loopArray = []; - } - else if (Array.contains(loopArray, object)) { - this.trace(indentationPadding + name + ': ...'); - return; - } - Array.add(loopArray, object); - if ((object == window) || (object === document) || - (window.HTMLElement && (object instanceof HTMLElement)) || - (typeof(object.nodeName) === 'string')) { - var tag = object.tagName? object.tagName : 'DomElement'; - if (object.id) { - tag += ' - ' + object.id; - } - this.trace(indentationPadding + name + ' {' + tag + '}'); - } - else { - var typeName = Object.getTypeName(object); - this.trace(indentationPadding + name + (typeof(typeName) === 'string' ? ' {' + typeName + '}' : '')); - if ((indentationPadding === '') || recursive) { - indentationPadding += " "; - var i, length, properties, p, v; - if (Array.isInstanceOfType(object)) { - length = object.length; - for (i = 0; i < length; i++) { - this._traceDump(object[i], '[' + i + ']', recursive, indentationPadding, loopArray); - } - } - else { - for (p in object) { - v = object[p]; - if (!Function.isInstanceOfType(v)) { - this._traceDump(v, p, recursive, indentationPadding, loopArray); - } - } - } - } - } - Array.remove(loopArray, object); - } - } -Sys._Debug.prototype = { - _appendConsole: Sys$_Debug$_appendConsole, - _appendTrace: Sys$_Debug$_appendTrace, - assert: Sys$_Debug$assert, - clearTrace: Sys$_Debug$clearTrace, - fail: Sys$_Debug$fail, - trace: Sys$_Debug$trace, - traceDump: Sys$_Debug$traceDump, - _traceDump: Sys$_Debug$_traceDump -} -Sys._Debug.registerClass('Sys._Debug'); -Sys.Debug = new Sys._Debug(); - Sys.Debug.isDebug = true; - -function Sys$Enum$parse(value, ignoreCase) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "value", type: String}, - {name: "ignoreCase", type: Boolean, optional: true} - ]); - if (e) throw e; - var values, parsed, val; - if (ignoreCase) { - values = this.__lowerCaseValues; - if (!values) { - this.__lowerCaseValues = values = {}; - var prototype = this.prototype; - for (var name in prototype) { - values[name.toLowerCase()] = prototype[name]; - } - } - } - else { - values = this.prototype; - } - if (!this.__flags) { - val = (ignoreCase ? value.toLowerCase() : value); - parsed = values[val.trim()]; - if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value, this.__typeName)); - return parsed; - } - else { - var parts = (ignoreCase ? value.toLowerCase() : value).split(','); - var v = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var part = parts[i].trim(); - parsed = values[part]; - if (typeof(parsed) !== 'number') throw Error.argument('value', String.format(Sys.Res.enumInvalidValue, value.split(',')[i].trim(), this.__typeName)); - v |= parsed; - } - return v; - } -} -function Sys$Enum$toString(value) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "value", mayBeNull: true, optional: true} - ]); - if (e) throw e; - if ((typeof(value) === 'undefined') || (value === null)) return this.__string; - if ((typeof(value) != 'number') || ((value % 1) !== 0)) throw Error.argumentType('value', Object.getType(value), this); - var values = this.prototype; - var i; - if (!this.__flags || (value === 0)) { - for (i in values) { - if (values[i] === value) { - return i; - } - } - } - else { - var sorted = this.__sortedValues; - if (!sorted) { - sorted = []; - for (i in values) { - sorted[sorted.length] = {key: i, value: values[i]}; - } - sorted.sort(function(a, b) { - return a.value - b.value; - }); - this.__sortedValues = sorted; - } - var parts = []; - var v = value; - for (i = sorted.length - 1; i >= 0; i--) { - var kvp = sorted[i]; - var vali = kvp.value; - if (vali === 0) continue; - if ((vali & value) === vali) { - parts[parts.length] = kvp.key; - v -= vali; - if (v === 0) break; - } - } - if (parts.length && v === 0) return parts.reverse().join(', '); - } - throw Error.argumentOutOfRange('value', value, String.format(Sys.Res.enumInvalidValue, value, this.__typeName)); -} -Type.prototype.registerEnum = function Type$registerEnum(name, flags) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "name", type: String}, - {name: "flags", type: Boolean, optional: true} - ]); - if (e) throw e; - if (!Type.__fullyQualifiedIdentifierRegExp.test(name)) throw Error.argument('name', Sys.Res.notATypeName); - var parsedName; - try { - parsedName = eval(name); - } - catch(e) { - throw Error.argument('name', Sys.Res.argumentTypeName); - } - if (parsedName !== this) throw Error.argument('name', Sys.Res.badTypeName); - if (Sys.__registeredTypes[name]) throw Error.invalidOperation(String.format(Sys.Res.typeRegisteredTwice, name)); - for (var j in this.prototype) { - var val = this.prototype[j]; - if (!Type.__identifierRegExp.test(j)) throw Error.invalidOperation(String.format(Sys.Res.enumInvalidValueName, j)); - if (typeof(val) !== 'number' || (val % 1) !== 0) throw Error.invalidOperation(Sys.Res.enumValueNotInteger); - if (typeof(this[j]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.enumReservedName, j)); - } - Sys.__upperCaseTypes[name.toUpperCase()] = this; - for (var i in this.prototype) { - this[i] = this.prototype[i]; - } - this.__typeName = name; - this.parse = Sys$Enum$parse; - this.__string = this.toString(); - this.toString = Sys$Enum$toString; - this.__flags = flags; - this.__enum = true; - Sys.__registeredTypes[name] = true; -} -Type.isEnum = function Type$isEnum(type) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "type", mayBeNull: true} - ]); - if (e) throw e; - if ((typeof(type) === 'undefined') || (type === null)) return false; - return !!type.__enum; -} -Type.isFlags = function Type$isFlags(type) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "type", mayBeNull: true} - ]); - if (e) throw e; - if ((typeof(type) === 'undefined') || (type === null)) return false; - return !!type.__flags; -} -Sys.CollectionChange = function Sys$CollectionChange(action, newItems, newStartingIndex, oldItems, oldStartingIndex) { - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "action", type: Sys.NotifyCollectionChangedAction}, - {name: "newItems", mayBeNull: true, optional: true}, - {name: "newStartingIndex", type: Number, mayBeNull: true, integer: true, optional: true}, - {name: "oldItems", mayBeNull: true, optional: true}, - {name: "oldStartingIndex", type: Number, mayBeNull: true, integer: true, optional: true} - ]); - if (e) throw e; - this.action = action; - if (newItems) { - if (!(newItems instanceof Array)) { - newItems = [newItems]; - } - } - this.newItems = newItems || null; - if (typeof newStartingIndex !== "number") { - newStartingIndex = -1; - } - this.newStartingIndex = newStartingIndex; - if (oldItems) { - if (!(oldItems instanceof Array)) { - oldItems = [oldItems]; - } - } - this.oldItems = oldItems || null; - if (typeof oldStartingIndex !== "number") { - oldStartingIndex = -1; - } - this.oldStartingIndex = oldStartingIndex; -} -Sys.CollectionChange.registerClass("Sys.CollectionChange"); -Sys.NotifyCollectionChangedAction = function Sys$NotifyCollectionChangedAction() { - /// - /// - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); -} -Sys.NotifyCollectionChangedAction.prototype = { - add: 0, - remove: 1, - reset: 2 -} -Sys.NotifyCollectionChangedAction.registerEnum('Sys.NotifyCollectionChangedAction'); -Sys.NotifyCollectionChangedEventArgs = function Sys$NotifyCollectionChangedEventArgs(changes) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "changes", type: Array, elementType: Sys.CollectionChange} - ]); - if (e) throw e; - this._changes = changes; - Sys.NotifyCollectionChangedEventArgs.initializeBase(this); -} - function Sys$NotifyCollectionChangedEventArgs$get_changes() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._changes || []; - } -Sys.NotifyCollectionChangedEventArgs.prototype = { - get_changes: Sys$NotifyCollectionChangedEventArgs$get_changes -} -Sys.NotifyCollectionChangedEventArgs.registerClass("Sys.NotifyCollectionChangedEventArgs", Sys.EventArgs); -Sys.Observer = function Sys$Observer() { - throw Error.invalidOperation(); -} -Sys.Observer.registerClass("Sys.Observer"); -Sys.Observer.makeObservable = function Sys$Observer$makeObservable(target) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target"} - ]); - if (e) throw e; - var isArray = target instanceof Array, - o = Sys.Observer; - Sys.Observer._ensureObservable(target); - if (target.setValue === o._observeMethods.setValue) return target; - o._addMethods(target, o._observeMethods); - if (isArray) { - o._addMethods(target, o._arrayMethods); - } - return target; -} -Sys.Observer._ensureObservable = function Sys$Observer$_ensureObservable(target) { - var type = typeof target; - if ((type === "string") || (type === "number") || (type === "boolean") || (type === "date")) { - throw Error.invalidOperation(String.format(Sys.Res.notObservable, type)); - } -} -Sys.Observer._addMethods = function Sys$Observer$_addMethods(target, methods) { - for (var m in methods) { - if (target[m] && (target[m] !== methods[m])) { - throw Error.invalidOperation(String.format(Sys.Res.observableConflict, m)); - } - target[m] = methods[m]; - } -} -Sys.Observer._addEventHandler = function Sys$Observer$_addEventHandler(target, eventName, handler) { - Sys.Observer._getContext(target, true).events._addHandler(eventName, handler); -} -Sys.Observer.addEventHandler = function Sys$Observer$addEventHandler(target, eventName, handler) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target"}, - {name: "eventName", type: String}, - {name: "handler", type: Function} - ]); - if (e) throw e; - Sys.Observer._ensureObservable(target); - Sys.Observer._addEventHandler(target, eventName, handler); -} -Sys.Observer._removeEventHandler = function Sys$Observer$_removeEventHandler(target, eventName, handler) { - Sys.Observer._getContext(target, true).events._removeHandler(eventName, handler); -} -Sys.Observer.removeEventHandler = function Sys$Observer$removeEventHandler(target, eventName, handler) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target"}, - {name: "eventName", type: String}, - {name: "handler", type: Function} - ]); - if (e) throw e; - Sys.Observer._ensureObservable(target); - Sys.Observer._removeEventHandler(target, eventName, handler); -} -Sys.Observer.raiseEvent = function Sys$Observer$raiseEvent(target, eventName, eventArgs) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target"}, - {name: "eventName", type: String}, - {name: "eventArgs", type: Sys.EventArgs} - ]); - if (e) throw e; - Sys.Observer._ensureObservable(target); - var ctx = Sys.Observer._getContext(target); - if (!ctx) return; - var handler = ctx.events.getHandler(eventName); - if (handler) { - handler(target, eventArgs); - } -} -Sys.Observer.addPropertyChanged = function Sys$Observer$addPropertyChanged(target, handler) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target"}, - {name: "handler", type: Function} - ]); - if (e) throw e; - Sys.Observer._ensureObservable(target); - Sys.Observer._addEventHandler(target, "propertyChanged", handler); -} -Sys.Observer.removePropertyChanged = function Sys$Observer$removePropertyChanged(target, handler) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target"}, - {name: "handler", type: Function} - ]); - if (e) throw e; - Sys.Observer._ensureObservable(target); - Sys.Observer._removeEventHandler(target, "propertyChanged", handler); -} -Sys.Observer.beginUpdate = function Sys$Observer$beginUpdate(target) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target"} - ]); - if (e) throw e; - Sys.Observer._ensureObservable(target); - Sys.Observer._getContext(target, true).updating = true; -} -Sys.Observer.endUpdate = function Sys$Observer$endUpdate(target) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target"} - ]); - if (e) throw e; - Sys.Observer._ensureObservable(target); - var ctx = Sys.Observer._getContext(target); - if (!ctx || !ctx.updating) return; - ctx.updating = false; - var dirty = ctx.dirty; - ctx.dirty = false; - if (dirty) { - if (target instanceof Array) { - var changes = ctx.changes; - ctx.changes = null; - Sys.Observer.raiseCollectionChanged(target, changes); - } - Sys.Observer.raisePropertyChanged(target, ""); - } -} -Sys.Observer.isUpdating = function Sys$Observer$isUpdating(target) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target"} - ]); - if (e) throw e; - Sys.Observer._ensureObservable(target); - var ctx = Sys.Observer._getContext(target); - return ctx ? ctx.updating : false; -} -Sys.Observer._setValue = function Sys$Observer$_setValue(target, propertyName, value) { - var getter, setter, mainTarget = target, path = propertyName.split('.'); - for (var i = 0, l = (path.length - 1); i < l ; i++) { - var name = path[i]; - getter = target["get_" + name]; - if (typeof (getter) === "function") { - target = getter.call(target); - } - else { - target = target[name]; - } - var type = typeof (target); - if ((target === null) || (type === "undefined")) { - throw Error.invalidOperation(String.format(Sys.Res.nullReferenceInPath, propertyName)); - } - } - var currentValue, lastPath = path[l]; - getter = target["get_" + lastPath]; - setter = target["set_" + lastPath]; - if (typeof(getter) === 'function') { - currentValue = getter.call(target); - } - else { - currentValue = target[lastPath]; - } - if (typeof(setter) === 'function') { - setter.call(target, value); - } - else { - target[lastPath] = value; - } - if (currentValue !== value) { - var ctx = Sys.Observer._getContext(mainTarget); - if (ctx && ctx.updating) { - ctx.dirty = true; - return; - }; - Sys.Observer.raisePropertyChanged(mainTarget, path[0]); - } -} -Sys.Observer.setValue = function Sys$Observer$setValue(target, propertyName, value) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target"}, - {name: "propertyName", type: String}, - {name: "value", mayBeNull: true} - ]); - if (e) throw e; - Sys.Observer._ensureObservable(target); - Sys.Observer._setValue(target, propertyName, value); -} -Sys.Observer.raisePropertyChanged = function Sys$Observer$raisePropertyChanged(target, propertyName) { - /// - /// - /// - Sys.Observer.raiseEvent(target, "propertyChanged", new Sys.PropertyChangedEventArgs(propertyName)); -} -Sys.Observer.addCollectionChanged = function Sys$Observer$addCollectionChanged(target, handler) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target", type: Array, elementMayBeNull: true}, - {name: "handler", type: Function} - ]); - if (e) throw e; - Sys.Observer._addEventHandler(target, "collectionChanged", handler); -} -Sys.Observer.removeCollectionChanged = function Sys$Observer$removeCollectionChanged(target, handler) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target", type: Array, elementMayBeNull: true}, - {name: "handler", type: Function} - ]); - if (e) throw e; - Sys.Observer._removeEventHandler(target, "collectionChanged", handler); -} -Sys.Observer._collectionChange = function Sys$Observer$_collectionChange(target, change) { - var ctx = Sys.Observer._getContext(target); - if (ctx && ctx.updating) { - ctx.dirty = true; - var changes = ctx.changes; - if (!changes) { - ctx.changes = changes = [change]; - } - else { - changes.push(change); - } - } - else { - Sys.Observer.raiseCollectionChanged(target, [change]); - Sys.Observer.raisePropertyChanged(target, 'length'); - } -} -Sys.Observer.add = function Sys$Observer$add(target, item) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target", type: Array, elementMayBeNull: true}, - {name: "item", mayBeNull: true} - ]); - if (e) throw e; - var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [item], target.length); - Array.add(target, item); - Sys.Observer._collectionChange(target, change); -} -Sys.Observer.addRange = function Sys$Observer$addRange(target, items) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target", type: Array, elementMayBeNull: true}, - {name: "items", type: Array, elementMayBeNull: true} - ]); - if (e) throw e; - var change = new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, items, target.length); - Array.addRange(target, items); - Sys.Observer._collectionChange(target, change); -} -Sys.Observer.clear = function Sys$Observer$clear(target) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target", type: Array, elementMayBeNull: true} - ]); - if (e) throw e; - var oldItems = Array.clone(target); - Array.clear(target); - Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.reset, null, -1, oldItems, 0)); -} -Sys.Observer.insert = function Sys$Observer$insert(target, index, item) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target", type: Array, elementMayBeNull: true}, - {name: "index", type: Number, integer: true}, - {name: "item", mayBeNull: true} - ]); - if (e) throw e; - Array.insert(target, index, item); - Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.add, [item], index)); -} -Sys.Observer.remove = function Sys$Observer$remove(target, item) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target", type: Array, elementMayBeNull: true}, - {name: "item", mayBeNull: true} - ]); - if (e) throw e; - var index = Array.indexOf(target, item); - if (index !== -1) { - Array.remove(target, item); - Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item], index)); - return true; - } - return false; -} -Sys.Observer.removeAt = function Sys$Observer$removeAt(target, index) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target", type: Array, elementMayBeNull: true}, - {name: "index", type: Number, integer: true} - ]); - if (e) throw e; - if ((index > -1) && (index < target.length)) { - var item = target[index]; - Array.removeAt(target, index); - Sys.Observer._collectionChange(target, new Sys.CollectionChange(Sys.NotifyCollectionChangedAction.remove, null, -1, [item], index)); - } -} -Sys.Observer.raiseCollectionChanged = function Sys$Observer$raiseCollectionChanged(target, changes) { - /// - /// - /// - Sys.Observer.raiseEvent(target, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(changes)); -} -Sys.Observer._observeMethods = { - add_propertyChanged: function(handler) { - Sys.Observer._addEventHandler(this, "propertyChanged", handler); - }, - remove_propertyChanged: function(handler) { - Sys.Observer._removeEventHandler(this, "propertyChanged", handler); - }, - addEventHandler: function(eventName, handler) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "eventName", type: String}, - {name: "handler", type: Function} - ]); - if (e) throw e; - Sys.Observer._addEventHandler(this, eventName, handler); - }, - removeEventHandler: function(eventName, handler) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "eventName", type: String}, - {name: "handler", type: Function} - ]); - if (e) throw e; - Sys.Observer._removeEventHandler(this, eventName, handler); - }, - get_isUpdating: function() { - /// - /// - return Sys.Observer.isUpdating(this); - }, - beginUpdate: function() { - /// - Sys.Observer.beginUpdate(this); - }, - endUpdate: function() { - /// - Sys.Observer.endUpdate(this); - }, - setValue: function(name, value) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "name", type: String}, - {name: "value", mayBeNull: true} - ]); - if (e) throw e; - Sys.Observer._setValue(this, name, value); - }, - raiseEvent: function(eventName, eventArgs) { - /// - /// - /// - Sys.Observer.raiseEvent(this, eventName, eventArgs); - }, - raisePropertyChanged: function(name) { - /// - /// - Sys.Observer.raiseEvent(this, "propertyChanged", new Sys.PropertyChangedEventArgs(name)); - } -} -Sys.Observer._arrayMethods = { - add_collectionChanged: function(handler) { - Sys.Observer._addEventHandler(this, "collectionChanged", handler); - }, - remove_collectionChanged: function(handler) { - Sys.Observer._removeEventHandler(this, "collectionChanged", handler); - }, - add: function(item) { - /// - /// - Sys.Observer.add(this, item); - }, - addRange: function(items) { - /// - /// - Sys.Observer.addRange(this, items); - }, - clear: function() { - /// - Sys.Observer.clear(this); - }, - insert: function(index, item) { - /// - /// - /// - Sys.Observer.insert(this, index, item); - }, - remove: function(item) { - /// - /// - /// - return Sys.Observer.remove(this, item); - }, - removeAt: function(index) { - /// - /// - Sys.Observer.removeAt(this, index); - }, - raiseCollectionChanged: function(changes) { - /// - /// - Sys.Observer.raiseEvent(this, "collectionChanged", new Sys.NotifyCollectionChangedEventArgs(changes)); - } -} -Sys.Observer._getContext = function Sys$Observer$_getContext(obj, create) { - var ctx = obj._observerContext; - if (ctx) return ctx(); - if (create) { - return (obj._observerContext = Sys.Observer._createContext())(); - } - return null; -} -Sys.Observer._createContext = function Sys$Observer$_createContext() { - var ctx = { - events: new Sys.EventHandlerList() - }; - return function() { - return ctx; - } -} -Date._appendPreOrPostMatch = function Date$_appendPreOrPostMatch(preMatch, strBuilder) { - var quoteCount = 0; - var escaped = false; - for (var i = 0, il = preMatch.length; i < il; i++) { - var c = preMatch.charAt(i); - switch (c) { - case '\'': - if (escaped) strBuilder.append("'"); - else quoteCount++; - escaped = false; - break; - case '\\': - if (escaped) strBuilder.append("\\"); - escaped = !escaped; - break; - default: - strBuilder.append(c); - escaped = false; - break; - } - } - return quoteCount; -} -Date._expandFormat = function Date$_expandFormat(dtf, format) { - if (!format) { - format = "F"; - } - var len = format.length; - if (len === 1) { - switch (format) { - case "d": - return dtf.ShortDatePattern; - case "D": - return dtf.LongDatePattern; - case "t": - return dtf.ShortTimePattern; - case "T": - return dtf.LongTimePattern; - case "f": - return dtf.LongDatePattern + " " + dtf.ShortTimePattern; - case "F": - return dtf.FullDateTimePattern; - case "M": case "m": - return dtf.MonthDayPattern; - case "s": - return dtf.SortableDateTimePattern; - case "Y": case "y": - return dtf.YearMonthPattern; - default: - throw Error.format(Sys.Res.formatInvalidString); - } - } - else if ((len === 2) && (format.charAt(0) === "%")) { - format = format.charAt(1); - } - return format; -} -Date._expandYear = function Date$_expandYear(dtf, year) { - var now = new Date(), - era = Date._getEra(now); - if (year < 100) { - var curr = Date._getEraYear(now, dtf, era); - year += curr - (curr % 100); - if (year > dtf.Calendar.TwoDigitYearMax) { - year -= 100; - } - } - return year; -} -Date._getEra = function Date$_getEra(date, eras) { - if (!eras) return 0; - var start, ticks = date.getTime(); - for (var i = 0, l = eras.length; i < l; i += 4) { - start = eras[i+2]; - if ((start === null) || (ticks >= start)) { - return i; - } - } - return 0; -} -Date._getEraYear = function Date$_getEraYear(date, dtf, era, sortable) { - var year = date.getFullYear(); - if (!sortable && dtf.eras) { - year -= dtf.eras[era + 3]; - } - return year; -} -Date._getParseRegExp = function Date$_getParseRegExp(dtf, format) { - if (!dtf._parseRegExp) { - dtf._parseRegExp = {}; - } - else if (dtf._parseRegExp[format]) { - return dtf._parseRegExp[format]; - } - var expFormat = Date._expandFormat(dtf, format); - expFormat = expFormat.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g, "\\\\$1"); - var regexp = new Sys.StringBuilder("^"); - var groups = []; - var index = 0; - var quoteCount = 0; - var tokenRegExp = Date._getTokenRegExp(); - var match; - while ((match = tokenRegExp.exec(expFormat)) !== null) { - var preMatch = expFormat.slice(index, match.index); - index = tokenRegExp.lastIndex; - quoteCount += Date._appendPreOrPostMatch(preMatch, regexp); - if ((quoteCount%2) === 1) { - regexp.append(match[0]); - continue; - } - switch (match[0]) { - case 'dddd': case 'ddd': - case 'MMMM': case 'MMM': - case 'gg': case 'g': - regexp.append("(\\D+)"); - break; - case 'tt': case 't': - regexp.append("(\\D*)"); - break; - case 'yyyy': - regexp.append("(\\d{4})"); - break; - case 'fff': - regexp.append("(\\d{3})"); - break; - case 'ff': - regexp.append("(\\d{2})"); - break; - case 'f': - regexp.append("(\\d)"); - break; - case 'dd': case 'd': - case 'MM': case 'M': - case 'yy': case 'y': - case 'HH': case 'H': - case 'hh': case 'h': - case 'mm': case 'm': - case 'ss': case 's': - regexp.append("(\\d\\d?)"); - break; - case 'zzz': - regexp.append("([+-]?\\d\\d?:\\d{2})"); - break; - case 'zz': case 'z': - regexp.append("([+-]?\\d\\d?)"); - break; - case '/': - regexp.append("(\\" + dtf.DateSeparator + ")"); - break; - default: - Sys.Debug.fail("Invalid date format pattern"); - } - Array.add(groups, match[0]); - } - Date._appendPreOrPostMatch(expFormat.slice(index), regexp); - regexp.append("$"); - var regexpStr = regexp.toString().replace(/\s+/g, "\\s+"); - var parseRegExp = {'regExp': regexpStr, 'groups': groups}; - dtf._parseRegExp[format] = parseRegExp; - return parseRegExp; -} -Date._getTokenRegExp = function Date$_getTokenRegExp() { - return /\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g; -} -Date.parseLocale = function Date$parseLocale(value, formats) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "value", type: String}, - {name: "formats", mayBeNull: true, optional: true, parameterArray: true} - ]); - if (e) throw e; - return Date._parse(value, Sys.CultureInfo.CurrentCulture, arguments); -} -Date.parseInvariant = function Date$parseInvariant(value, formats) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "value", type: String}, - {name: "formats", mayBeNull: true, optional: true, parameterArray: true} - ]); - if (e) throw e; - return Date._parse(value, Sys.CultureInfo.InvariantCulture, arguments); -} -Date._parse = function Date$_parse(value, cultureInfo, args) { - var i, l, date, format, formats, custom = false; - for (i = 1, l = args.length; i < l; i++) { - format = args[i]; - if (format) { - custom = true; - date = Date._parseExact(value, format, cultureInfo); - if (date) return date; - } - } - if (! custom) { - formats = cultureInfo._getDateTimeFormats(); - for (i = 0, l = formats.length; i < l; i++) { - date = Date._parseExact(value, formats[i], cultureInfo); - if (date) return date; - } - } - return null; -} -Date._parseExact = function Date$_parseExact(value, format, cultureInfo) { - value = value.trim(); - var dtf = cultureInfo.dateTimeFormat, - parseInfo = Date._getParseRegExp(dtf, format), - match = new RegExp(parseInfo.regExp).exec(value); - if (match === null) return null; - - var groups = parseInfo.groups, - era = null, year = null, month = null, date = null, weekDay = null, - hour = 0, hourOffset, min = 0, sec = 0, msec = 0, tzMinOffset = null, - pmHour = false; - for (var j = 0, jl = groups.length; j < jl; j++) { - var matchGroup = match[j+1]; - if (matchGroup) { - switch (groups[j]) { - case 'dd': case 'd': - date = parseInt(matchGroup, 10); - if ((date < 1) || (date > 31)) return null; - break; - case 'MMMM': - month = cultureInfo._getMonthIndex(matchGroup); - if ((month < 0) || (month > 11)) return null; - break; - case 'MMM': - month = cultureInfo._getAbbrMonthIndex(matchGroup); - if ((month < 0) || (month > 11)) return null; - break; - case 'M': case 'MM': - month = parseInt(matchGroup, 10) - 1; - if ((month < 0) || (month > 11)) return null; - break; - case 'y': case 'yy': - year = Date._expandYear(dtf,parseInt(matchGroup, 10)); - if ((year < 0) || (year > 9999)) return null; - break; - case 'yyyy': - year = parseInt(matchGroup, 10); - if ((year < 0) || (year > 9999)) return null; - break; - case 'h': case 'hh': - hour = parseInt(matchGroup, 10); - if (hour === 12) hour = 0; - if ((hour < 0) || (hour > 11)) return null; - break; - case 'H': case 'HH': - hour = parseInt(matchGroup, 10); - if ((hour < 0) || (hour > 23)) return null; - break; - case 'm': case 'mm': - min = parseInt(matchGroup, 10); - if ((min < 0) || (min > 59)) return null; - break; - case 's': case 'ss': - sec = parseInt(matchGroup, 10); - if ((sec < 0) || (sec > 59)) return null; - break; - case 'tt': case 't': - var upperToken = matchGroup.toUpperCase(); - pmHour = (upperToken === dtf.PMDesignator.toUpperCase()); - if (!pmHour && (upperToken !== dtf.AMDesignator.toUpperCase())) return null; - break; - case 'f': - msec = parseInt(matchGroup, 10) * 100; - if ((msec < 0) || (msec > 999)) return null; - break; - case 'ff': - msec = parseInt(matchGroup, 10) * 10; - if ((msec < 0) || (msec > 999)) return null; - break; - case 'fff': - msec = parseInt(matchGroup, 10); - if ((msec < 0) || (msec > 999)) return null; - break; - case 'dddd': - weekDay = cultureInfo._getDayIndex(matchGroup); - if ((weekDay < 0) || (weekDay > 6)) return null; - break; - case 'ddd': - weekDay = cultureInfo._getAbbrDayIndex(matchGroup); - if ((weekDay < 0) || (weekDay > 6)) return null; - break; - case 'zzz': - var offsets = matchGroup.split(/:/); - if (offsets.length !== 2) return null; - hourOffset = parseInt(offsets[0], 10); - if ((hourOffset < -12) || (hourOffset > 13)) return null; - var minOffset = parseInt(offsets[1], 10); - if ((minOffset < 0) || (minOffset > 59)) return null; - tzMinOffset = (hourOffset * 60) + (matchGroup.startsWith('-')? -minOffset : minOffset); - break; - case 'z': case 'zz': - hourOffset = parseInt(matchGroup, 10); - if ((hourOffset < -12) || (hourOffset > 13)) return null; - tzMinOffset = hourOffset * 60; - break; - case 'g': case 'gg': - var eraName = matchGroup; - if (!eraName || !dtf.eras) return null; - eraName = eraName.toLowerCase().trim(); - for (var i = 0, l = dtf.eras.length; i < l; i += 4) { - if (eraName === dtf.eras[i + 1].toLowerCase()) { - era = i; - break; - } - } - if (era === null) return null; - break; - } - } - } - var result = new Date(), defaults, convert = dtf.Calendar.convert; - if (convert) { - defaults = convert.fromGregorian(result); - } - if (!convert) { - defaults = [result.getFullYear(), result.getMonth(), result.getDate()]; - } - if (year === null) { - year = defaults[0]; - } - else if (dtf.eras) { - year += dtf.eras[(era || 0) + 3]; - } - if (month === null) { - month = defaults[1]; - } - if (date === null) { - date = defaults[2]; - } - if (convert) { - result = convert.toGregorian(year, month, date); - if (result === null) return null; - } - else { - result.setFullYear(year, month, date); - if (result.getDate() !== date) return null; - if ((weekDay !== null) && (result.getDay() !== weekDay)) { - return null; - } - } - if (pmHour && (hour < 12)) { - hour += 12; - } - result.setHours(hour, min, sec, msec); - if (tzMinOffset !== null) { - var adjustedMin = result.getMinutes() - (tzMinOffset + result.getTimezoneOffset()); - result.setHours(result.getHours() + parseInt(adjustedMin/60, 10), adjustedMin%60); - } - return result; -} -Date.prototype.format = function Date$format(format) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "format", type: String} - ]); - if (e) throw e; - return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture); -} -Date.prototype.localeFormat = function Date$localeFormat(format) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "format", type: String} - ]); - if (e) throw e; - return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture); -} -Date.prototype._toFormattedString = function Date$_toFormattedString(format, cultureInfo) { - var dtf = cultureInfo.dateTimeFormat, - convert = dtf.Calendar.convert; - if (!format || !format.length || (format === 'i')) { - if (cultureInfo && cultureInfo.name.length) { - if (convert) { - return this._toFormattedString(dtf.FullDateTimePattern, cultureInfo); - } - else { - var eraDate = new Date(this.getTime()); - var era = Date._getEra(this, dtf.eras); - eraDate.setFullYear(Date._getEraYear(this, dtf, era)); - return eraDate.toLocaleString(); - } - } - else { - return this.toString(); - } - } - var eras = dtf.eras, - sortable = (format === "s"); - format = Date._expandFormat(dtf, format); - var ret = new Sys.StringBuilder(); - var hour; - function addLeadingZero(num) { - if (num < 10) { - return '0' + num; - } - return num.toString(); - } - function addLeadingZeros(num) { - if (num < 10) { - return '00' + num; - } - if (num < 100) { - return '0' + num; - } - return num.toString(); - } - function padYear(year) { - if (year < 10) { - return '000' + year; - } - else if (year < 100) { - return '00' + year; - } - else if (year < 1000) { - return '0' + year; - } - return year.toString(); - } - - var foundDay, checkedDay, dayPartRegExp = /([^d]|^)(d|dd)([^d]|$)/g; - function hasDay() { - if (foundDay || checkedDay) { - return foundDay; - } - foundDay = dayPartRegExp.test(format); - checkedDay = true; - return foundDay; - } - - var quoteCount = 0, - tokenRegExp = Date._getTokenRegExp(), - converted; - if (!sortable && convert) { - converted = convert.fromGregorian(this); - } - for (;;) { - var index = tokenRegExp.lastIndex; - var ar = tokenRegExp.exec(format); - var preMatch = format.slice(index, ar ? ar.index : format.length); - quoteCount += Date._appendPreOrPostMatch(preMatch, ret); - if (!ar) break; - if ((quoteCount%2) === 1) { - ret.append(ar[0]); - continue; - } - - function getPart(date, part) { - if (converted) { - return converted[part]; - } - switch (part) { - case 0: return date.getFullYear(); - case 1: return date.getMonth(); - case 2: return date.getDate(); - } - } - switch (ar[0]) { - case "dddd": - ret.append(dtf.DayNames[this.getDay()]); - break; - case "ddd": - ret.append(dtf.AbbreviatedDayNames[this.getDay()]); - break; - case "dd": - foundDay = true; - ret.append(addLeadingZero(getPart(this, 2))); - break; - case "d": - foundDay = true; - ret.append(getPart(this, 2)); - break; - case "MMMM": - ret.append((dtf.MonthGenitiveNames && hasDay()) - ? dtf.MonthGenitiveNames[getPart(this, 1)] - : dtf.MonthNames[getPart(this, 1)]); - break; - case "MMM": - ret.append((dtf.AbbreviatedMonthGenitiveNames && hasDay()) - ? dtf.AbbreviatedMonthGenitiveNames[getPart(this, 1)] - : dtf.AbbreviatedMonthNames[getPart(this, 1)]); - break; - case "MM": - ret.append(addLeadingZero(getPart(this, 1) + 1)); - break; - case "M": - ret.append(getPart(this, 1) + 1); - break; - case "yyyy": - ret.append(padYear(converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable))); - break; - case "yy": - ret.append(addLeadingZero((converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)) % 100)); - break; - case "y": - ret.append((converted ? converted[0] : Date._getEraYear(this, dtf, Date._getEra(this, eras), sortable)) % 100); - break; - case "hh": - hour = this.getHours() % 12; - if (hour === 0) hour = 12; - ret.append(addLeadingZero(hour)); - break; - case "h": - hour = this.getHours() % 12; - if (hour === 0) hour = 12; - ret.append(hour); - break; - case "HH": - ret.append(addLeadingZero(this.getHours())); - break; - case "H": - ret.append(this.getHours()); - break; - case "mm": - ret.append(addLeadingZero(this.getMinutes())); - break; - case "m": - ret.append(this.getMinutes()); - break; - case "ss": - ret.append(addLeadingZero(this.getSeconds())); - break; - case "s": - ret.append(this.getSeconds()); - break; - case "tt": - ret.append((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator); - break; - case "t": - ret.append(((this.getHours() < 12) ? dtf.AMDesignator : dtf.PMDesignator).charAt(0)); - break; - case "f": - ret.append(addLeadingZeros(this.getMilliseconds()).charAt(0)); - break; - case "ff": - ret.append(addLeadingZeros(this.getMilliseconds()).substr(0, 2)); - break; - case "fff": - ret.append(addLeadingZeros(this.getMilliseconds())); - break; - case "z": - hour = this.getTimezoneOffset() / 60; - ret.append(((hour <= 0) ? '+' : '-') + Math.floor(Math.abs(hour))); - break; - case "zz": - hour = this.getTimezoneOffset() / 60; - ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour)))); - break; - case "zzz": - hour = this.getTimezoneOffset() / 60; - ret.append(((hour <= 0) ? '+' : '-') + addLeadingZero(Math.floor(Math.abs(hour))) + - ":" + addLeadingZero(Math.abs(this.getTimezoneOffset() % 60))); - break; - case "g": - case "gg": - if (dtf.eras) { - ret.append(dtf.eras[Date._getEra(this, eras) + 1]); - } - break; - case "/": - ret.append(dtf.DateSeparator); - break; - default: - Sys.Debug.fail("Invalid date format pattern"); - } - } - return ret.toString(); -} -String.localeFormat = function String$localeFormat(format, args) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "format", type: String}, - {name: "args", mayBeNull: true, parameterArray: true} - ]); - if (e) throw e; - return String._toFormattedString(true, arguments); -} -Number.parseLocale = function Number$parseLocale(value) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "value", type: String} - ], false); - if (e) throw e; - return Number._parse(value, Sys.CultureInfo.CurrentCulture); -} -Number.parseInvariant = function Number$parseInvariant(value) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "value", type: String} - ], false); - if (e) throw e; - return Number._parse(value, Sys.CultureInfo.InvariantCulture); -} -Number._parse = function Number$_parse(value, cultureInfo) { - value = value.trim(); - - if (value.match(/^[+-]?infinity$/i)) { - return parseFloat(value); - } - if (value.match(/^0x[a-f0-9]+$/i)) { - return parseInt(value); - } - var numFormat = cultureInfo.numberFormat; - var signInfo = Number._parseNumberNegativePattern(value, numFormat, numFormat.NumberNegativePattern); - var sign = signInfo[0]; - var num = signInfo[1]; - - if ((sign === '') && (numFormat.NumberNegativePattern !== 1)) { - signInfo = Number._parseNumberNegativePattern(value, numFormat, 1); - sign = signInfo[0]; - num = signInfo[1]; - } - if (sign === '') sign = '+'; - - var exponent; - var intAndFraction; - var exponentPos = num.indexOf('e'); - if (exponentPos < 0) exponentPos = num.indexOf('E'); - if (exponentPos < 0) { - intAndFraction = num; - exponent = null; - } - else { - intAndFraction = num.substr(0, exponentPos); - exponent = num.substr(exponentPos + 1); - } - - var integer; - var fraction; - var decimalPos = intAndFraction.indexOf(numFormat.NumberDecimalSeparator); - if (decimalPos < 0) { - integer = intAndFraction; - fraction = null; - } - else { - integer = intAndFraction.substr(0, decimalPos); - fraction = intAndFraction.substr(decimalPos + numFormat.NumberDecimalSeparator.length); - } - - integer = integer.split(numFormat.NumberGroupSeparator).join(''); - var altNumGroupSeparator = numFormat.NumberGroupSeparator.replace(/\u00A0/g, " "); - if (numFormat.NumberGroupSeparator !== altNumGroupSeparator) { - integer = integer.split(altNumGroupSeparator).join(''); - } - - var p = sign + integer; - if (fraction !== null) { - p += '.' + fraction; - } - if (exponent !== null) { - var expSignInfo = Number._parseNumberNegativePattern(exponent, numFormat, 1); - if (expSignInfo[0] === '') { - expSignInfo[0] = '+'; - } - p += 'e' + expSignInfo[0] + expSignInfo[1]; - } - if (p.match(/^[+-]?\d*\.?\d*(e[+-]?\d+)?$/)) { - return parseFloat(p); - } - return Number.NaN; -} -Number._parseNumberNegativePattern = function Number$_parseNumberNegativePattern(value, numFormat, numberNegativePattern) { - var neg = numFormat.NegativeSign; - var pos = numFormat.PositiveSign; - switch (numberNegativePattern) { - case 4: - neg = ' ' + neg; - pos = ' ' + pos; - case 3: - if (value.endsWith(neg)) { - return ['-', value.substr(0, value.length - neg.length)]; - } - else if (value.endsWith(pos)) { - return ['+', value.substr(0, value.length - pos.length)]; - } - break; - case 2: - neg += ' '; - pos += ' '; - case 1: - if (value.startsWith(neg)) { - return ['-', value.substr(neg.length)]; - } - else if (value.startsWith(pos)) { - return ['+', value.substr(pos.length)]; - } - break; - case 0: - if (value.startsWith('(') && value.endsWith(')')) { - return ['-', value.substr(1, value.length - 2)]; - } - break; - default: - Sys.Debug.fail(""); - } - return ['', value]; -} -Number.prototype.format = function Number$format(format) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "format", type: String} - ]); - if (e) throw e; - return this._toFormattedString(format, Sys.CultureInfo.InvariantCulture); -} -Number.prototype.localeFormat = function Number$localeFormat(format) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "format", type: String} - ]); - if (e) throw e; - return this._toFormattedString(format, Sys.CultureInfo.CurrentCulture); -} -Number.prototype._toFormattedString = function Number$_toFormattedString(format, cultureInfo) { - if (!format || (format.length === 0) || (format === 'i')) { - if (cultureInfo && (cultureInfo.name.length > 0)) { - return this.toLocaleString(); - } - else { - return this.toString(); - } - } - - var _percentPositivePattern = ["n %", "n%", "%n" ]; - var _percentNegativePattern = ["-n %", "-n%", "-%n"]; - var _numberNegativePattern = ["(n)","-n","- n","n-","n -"]; - var _currencyPositivePattern = ["$n","n$","$ n","n $"]; - var _currencyNegativePattern = ["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"]; - function zeroPad(str, count, left) { - for (var l=str.length; l < count; l++) { - str = (left ? ('0' + str) : (str + '0')); - } - return str; - } - - function expandNumber(number, precision, groupSizes, sep, decimalChar) { - Sys.Debug.assert(groupSizes.length > 0, "groupSizes must be an array of at least 1"); - var curSize = groupSizes[0]; - var curGroupIndex = 1; - var factor = Math.pow(10, precision); - var rounded = (Math.round(number * factor) / factor); - if (!isFinite(rounded)) { - rounded = number; - } - number = rounded; - - var numberString = number.toString(); - var right = ""; - var exponent; - - - var split = numberString.split(/e/i); - numberString = split[0]; - exponent = (split.length > 1 ? parseInt(split[1]) : 0); - split = numberString.split('.'); - numberString = split[0]; - right = split.length > 1 ? split[1] : ""; - - var l; - if (exponent > 0) { - right = zeroPad(right, exponent, false); - numberString += right.slice(0, exponent); - right = right.substr(exponent); - } - else if (exponent < 0) { - exponent = -exponent; - numberString = zeroPad(numberString, exponent+1, true); - right = numberString.slice(-exponent, numberString.length) + right; - numberString = numberString.slice(0, -exponent); - } - if (precision > 0) { - if (right.length > precision) { - right = right.slice(0, precision); - } - else { - right = zeroPad(right, precision, false); - } - right = decimalChar + right; - } - else { - right = ""; - } - var stringIndex = numberString.length-1; - var ret = ""; - while (stringIndex >= 0) { - if (curSize === 0 || curSize > stringIndex) { - if (ret.length > 0) - return numberString.slice(0, stringIndex + 1) + sep + ret + right; - else - return numberString.slice(0, stringIndex + 1) + right; - } - if (ret.length > 0) - ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1) + sep + ret; - else - ret = numberString.slice(stringIndex - curSize + 1, stringIndex+1); - stringIndex -= curSize; - if (curGroupIndex < groupSizes.length) { - curSize = groupSizes[curGroupIndex]; - curGroupIndex++; - } - } - return numberString.slice(0, stringIndex + 1) + sep + ret + right; - } - var nf = cultureInfo.numberFormat; - var number = Math.abs(this); - if (!format) - format = "D"; - var precision = -1; - if (format.length > 1) precision = parseInt(format.slice(1), 10); - var pattern; - switch (format.charAt(0)) { - case "d": - case "D": - pattern = 'n'; - if (precision !== -1) { - number = zeroPad(""+number, precision, true); - } - if (this < 0) number = -number; - break; - case "c": - case "C": - if (this < 0) pattern = _currencyNegativePattern[nf.CurrencyNegativePattern]; - else pattern = _currencyPositivePattern[nf.CurrencyPositivePattern]; - if (precision === -1) precision = nf.CurrencyDecimalDigits; - number = expandNumber(Math.abs(this), precision, nf.CurrencyGroupSizes, nf.CurrencyGroupSeparator, nf.CurrencyDecimalSeparator); - break; - case "n": - case "N": - if (this < 0) pattern = _numberNegativePattern[nf.NumberNegativePattern]; - else pattern = 'n'; - if (precision === -1) precision = nf.NumberDecimalDigits; - number = expandNumber(Math.abs(this), precision, nf.NumberGroupSizes, nf.NumberGroupSeparator, nf.NumberDecimalSeparator); - break; - case "p": - case "P": - if (this < 0) pattern = _percentNegativePattern[nf.PercentNegativePattern]; - else pattern = _percentPositivePattern[nf.PercentPositivePattern]; - if (precision === -1) precision = nf.PercentDecimalDigits; - number = expandNumber(Math.abs(this) * 100, precision, nf.PercentGroupSizes, nf.PercentGroupSeparator, nf.PercentDecimalSeparator); - break; - default: - throw Error.format(Sys.Res.formatBadFormatSpecifier); - } - var regex = /n|\$|-|%/g; - var ret = ""; - for (;;) { - var index = regex.lastIndex; - var ar = regex.exec(pattern); - ret += pattern.slice(index, ar ? ar.index : pattern.length); - if (!ar) - break; - switch (ar[0]) { - case "n": - ret += number; - break; - case "$": - ret += nf.CurrencySymbol; - break; - case "-": - if (/[1-9]/.test(number)) { - ret += nf.NegativeSign; - } - break; - case "%": - ret += nf.PercentSymbol; - break; - default: - Sys.Debug.fail("Invalid number format pattern"); - } - } - return ret; -} - -Sys.CultureInfo = function Sys$CultureInfo(name, numberFormat, dateTimeFormat) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "name", type: String}, - {name: "numberFormat", type: Object}, - {name: "dateTimeFormat", type: Object} - ]); - if (e) throw e; - this.name = name; - this.numberFormat = numberFormat; - this.dateTimeFormat = dateTimeFormat; -} - function Sys$CultureInfo$_getDateTimeFormats() { - if (! this._dateTimeFormats) { - var dtf = this.dateTimeFormat; - this._dateTimeFormats = - [ dtf.MonthDayPattern, - dtf.YearMonthPattern, - dtf.ShortDatePattern, - dtf.ShortTimePattern, - dtf.LongDatePattern, - dtf.LongTimePattern, - dtf.FullDateTimePattern, - dtf.RFC1123Pattern, - dtf.SortableDateTimePattern, - dtf.UniversalSortableDateTimePattern ]; - } - return this._dateTimeFormats; - } - function Sys$CultureInfo$_getIndex(value, a1, a2) { - var upper = this._toUpper(value), - i = Array.indexOf(a1, upper); - if (i === -1) { - i = Array.indexOf(a2, upper); - } - return i; - } - function Sys$CultureInfo$_getMonthIndex(value) { - if (!this._upperMonths) { - this._upperMonths = this._toUpperArray(this.dateTimeFormat.MonthNames); - this._upperMonthsGenitive = this._toUpperArray(this.dateTimeFormat.MonthGenitiveNames); - } - return this._getIndex(value, this._upperMonths, this._upperMonthsGenitive); - } - function Sys$CultureInfo$_getAbbrMonthIndex(value) { - if (!this._upperAbbrMonths) { - this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames); - this._upperAbbrMonthsGenitive = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthGenitiveNames); - } - return this._getIndex(value, this._upperAbbrMonths, this._upperAbbrMonthsGenitive); - } - function Sys$CultureInfo$_getDayIndex(value) { - if (!this._upperDays) { - this._upperDays = this._toUpperArray(this.dateTimeFormat.DayNames); - } - return Array.indexOf(this._upperDays, this._toUpper(value)); - } - function Sys$CultureInfo$_getAbbrDayIndex(value) { - if (!this._upperAbbrDays) { - this._upperAbbrDays = this._toUpperArray(this.dateTimeFormat.AbbreviatedDayNames); - } - return Array.indexOf(this._upperAbbrDays, this._toUpper(value)); - } - function Sys$CultureInfo$_toUpperArray(arr) { - var result = []; - for (var i = 0, il = arr.length; i < il; i++) { - result[i] = this._toUpper(arr[i]); - } - return result; - } - function Sys$CultureInfo$_toUpper(value) { - return value.split("\u00A0").join(' ').toUpperCase(); - } -Sys.CultureInfo.prototype = { - _getDateTimeFormats: Sys$CultureInfo$_getDateTimeFormats, - _getIndex: Sys$CultureInfo$_getIndex, - _getMonthIndex: Sys$CultureInfo$_getMonthIndex, - _getAbbrMonthIndex: Sys$CultureInfo$_getAbbrMonthIndex, - _getDayIndex: Sys$CultureInfo$_getDayIndex, - _getAbbrDayIndex: Sys$CultureInfo$_getAbbrDayIndex, - _toUpperArray: Sys$CultureInfo$_toUpperArray, - _toUpper: Sys$CultureInfo$_toUpper -} -Sys.CultureInfo.registerClass('Sys.CultureInfo'); -Sys.CultureInfo._parse = function Sys$CultureInfo$_parse(value) { - var dtf = value.dateTimeFormat; - if (dtf && !dtf.eras) { - dtf.eras = value.eras; - } - return new Sys.CultureInfo(value.name, value.numberFormat, dtf); -} -Sys.CultureInfo.InvariantCulture = Sys.CultureInfo._parse({"name":"","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":true,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"\u00A4","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":true},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, dd MMMM yyyy HH:mm:ss","LongDatePattern":"dddd, dd MMMM yyyy","LongTimePattern":"HH:mm:ss","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"MM/dd/yyyy","ShortTimePattern":"HH:mm","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"yyyy MMMM","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":true,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]}); -if (typeof(__cultureInfo) === "object") { - Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse(__cultureInfo); - delete __cultureInfo; -} -else { - Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse({"name":"en-US","numberFormat":{"CurrencyDecimalDigits":2,"CurrencyDecimalSeparator":".","IsReadOnly":false,"CurrencyGroupSizes":[3],"NumberGroupSizes":[3],"PercentGroupSizes":[3],"CurrencyGroupSeparator":",","CurrencySymbol":"$","NaNSymbol":"NaN","CurrencyNegativePattern":0,"NumberNegativePattern":1,"PercentPositivePattern":0,"PercentNegativePattern":0,"NegativeInfinitySymbol":"-Infinity","NegativeSign":"-","NumberDecimalDigits":2,"NumberDecimalSeparator":".","NumberGroupSeparator":",","CurrencyPositivePattern":0,"PositiveInfinitySymbol":"Infinity","PositiveSign":"+","PercentDecimalDigits":2,"PercentDecimalSeparator":".","PercentGroupSeparator":",","PercentSymbol":"%","PerMilleSymbol":"\u2030","NativeDigits":["0","1","2","3","4","5","6","7","8","9"],"DigitSubstitution":1},"dateTimeFormat":{"AMDesignator":"AM","Calendar":{"MinSupportedDateTime":"@-62135568000000@","MaxSupportedDateTime":"@253402300799999@","AlgorithmType":1,"CalendarType":1,"Eras":[1],"TwoDigitYearMax":2029,"IsReadOnly":false},"DateSeparator":"/","FirstDayOfWeek":0,"CalendarWeekRule":0,"FullDateTimePattern":"dddd, MMMM dd, yyyy h:mm:ss tt","LongDatePattern":"dddd, MMMM dd, yyyy","LongTimePattern":"h:mm:ss tt","MonthDayPattern":"MMMM dd","PMDesignator":"PM","RFC1123Pattern":"ddd, dd MMM yyyy HH\':\'mm\':\'ss \'GMT\'","ShortDatePattern":"M/d/yyyy","ShortTimePattern":"h:mm tt","SortableDateTimePattern":"yyyy\'-\'MM\'-\'dd\'T\'HH\':\'mm\':\'ss","TimeSeparator":":","UniversalSortableDateTimePattern":"yyyy\'-\'MM\'-\'dd HH\':\'mm\':\'ss\'Z\'","YearMonthPattern":"MMMM, yyyy","AbbreviatedDayNames":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"ShortestDayNames":["Su","Mo","Tu","We","Th","Fr","Sa"],"DayNames":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"AbbreviatedMonthNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthNames":["January","February","March","April","May","June","July","August","September","October","November","December",""],"IsReadOnly":false,"NativeCalendarName":"Gregorian Calendar","AbbreviatedMonthGenitiveNames":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],"MonthGenitiveNames":["January","February","March","April","May","June","July","August","September","October","November","December",""]},"eras":[1,"A.D.",null,0]}); -} -Type.registerNamespace('Sys.Serialization'); -Sys.Serialization.JavaScriptSerializer = function Sys$Serialization$JavaScriptSerializer() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); -} -Sys.Serialization.JavaScriptSerializer.registerClass('Sys.Serialization.JavaScriptSerializer'); -Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs = []; -Sys.Serialization.JavaScriptSerializer._charsToEscape = []; -Sys.Serialization.JavaScriptSerializer._dateRegEx = new RegExp('(^|[^\\\\])\\"\\\\/Date\\((-?[0-9]+)(?:[a-zA-Z]|(?:\\+|-)[0-9]{4})?\\)\\\\/\\"', 'g'); -Sys.Serialization.JavaScriptSerializer._escapeChars = {}; -Sys.Serialization.JavaScriptSerializer._escapeRegEx = new RegExp('["\\\\\\x00-\\x1F]', 'i'); -Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal = new RegExp('["\\\\\\x00-\\x1F]', 'g'); -Sys.Serialization.JavaScriptSerializer._jsonRegEx = new RegExp('[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]', 'g'); -Sys.Serialization.JavaScriptSerializer._jsonStringRegEx = new RegExp('"(\\\\.|[^"\\\\])*"', 'g'); -Sys.Serialization.JavaScriptSerializer._serverTypeFieldName = '__type'; -Sys.Serialization.JavaScriptSerializer._init = function Sys$Serialization$JavaScriptSerializer$_init() { - var replaceChars = ['\\u0000','\\u0001','\\u0002','\\u0003','\\u0004','\\u0005','\\u0006','\\u0007', - '\\b','\\t','\\n','\\u000b','\\f','\\r','\\u000e','\\u000f','\\u0010','\\u0011', - '\\u0012','\\u0013','\\u0014','\\u0015','\\u0016','\\u0017','\\u0018','\\u0019', - '\\u001a','\\u001b','\\u001c','\\u001d','\\u001e','\\u001f']; - Sys.Serialization.JavaScriptSerializer._charsToEscape[0] = '\\'; - Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['\\'] = new RegExp('\\\\', 'g'); - Sys.Serialization.JavaScriptSerializer._escapeChars['\\'] = '\\\\'; - Sys.Serialization.JavaScriptSerializer._charsToEscape[1] = '"'; - Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs['"'] = new RegExp('"', 'g'); - Sys.Serialization.JavaScriptSerializer._escapeChars['"'] = '\\"'; - for (var i = 0; i < 32; i++) { - var c = String.fromCharCode(i); - Sys.Serialization.JavaScriptSerializer._charsToEscape[i+2] = c; - Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c] = new RegExp(c, 'g'); - Sys.Serialization.JavaScriptSerializer._escapeChars[c] = replaceChars[i]; - } -} -Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeBooleanWithBuilder(object, stringBuilder) { - stringBuilder.append(object.toString()); -} -Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeNumberWithBuilder(object, stringBuilder) { - if (isFinite(object)) { - stringBuilder.append(String(object)); - } - else { - throw Error.invalidOperation(Sys.Res.cannotSerializeNonFiniteNumbers); - } -} -Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeStringWithBuilder(string, stringBuilder) { - stringBuilder.append('"'); - if (Sys.Serialization.JavaScriptSerializer._escapeRegEx.test(string)) { - if (Sys.Serialization.JavaScriptSerializer._charsToEscape.length === 0) { - Sys.Serialization.JavaScriptSerializer._init(); - } - if (string.length < 128) { - string = string.replace(Sys.Serialization.JavaScriptSerializer._escapeRegExGlobal, - function(x) { return Sys.Serialization.JavaScriptSerializer._escapeChars[x]; }); - } - else { - for (var i = 0; i < 34; i++) { - var c = Sys.Serialization.JavaScriptSerializer._charsToEscape[i]; - if (string.indexOf(c) !== -1) { - if (Sys.Browser.agent === Sys.Browser.Opera || Sys.Browser.agent === Sys.Browser.FireFox) { - string = string.split(c).join(Sys.Serialization.JavaScriptSerializer._escapeChars[c]); - } - else { - string = string.replace(Sys.Serialization.JavaScriptSerializer._charsToEscapeRegExs[c], - Sys.Serialization.JavaScriptSerializer._escapeChars[c]); - } - } - } - } - } - stringBuilder.append(string); - stringBuilder.append('"'); -} -Sys.Serialization.JavaScriptSerializer._serializeWithBuilder = function Sys$Serialization$JavaScriptSerializer$_serializeWithBuilder(object, stringBuilder, sort, prevObjects) { - var i; - switch (typeof object) { - case 'object': - if (object) { - if (prevObjects){ - for( var j = 0; j < prevObjects.length; j++) { - if (prevObjects[j] === object) { - throw Error.invalidOperation(Sys.Res.cannotSerializeObjectWithCycle); - } - } - } - else { - prevObjects = new Array(); - } - try { - Array.add(prevObjects, object); - - if (Number.isInstanceOfType(object)){ - Sys.Serialization.JavaScriptSerializer._serializeNumberWithBuilder(object, stringBuilder); - } - else if (Boolean.isInstanceOfType(object)){ - Sys.Serialization.JavaScriptSerializer._serializeBooleanWithBuilder(object, stringBuilder); - } - else if (String.isInstanceOfType(object)){ - Sys.Serialization.JavaScriptSerializer._serializeStringWithBuilder(object, stringBuilder); - } - - else if (Array.isInstanceOfType(object)) { - stringBuilder.append('['); - - for (i = 0; i < object.length; ++i) { - if (i > 0) { - stringBuilder.append(','); - } - Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object[i], stringBuilder,false,prevObjects); - } - stringBuilder.append(']'); - } - else { - if (Date.isInstanceOfType(object)) { - stringBuilder.append('"\\/Date('); - stringBuilder.append(object.getTime()); - stringBuilder.append(')\\/"'); - break; - } - var properties = []; - var propertyCount = 0; - for (var name in object) { - if (name.startsWith('$')) { - continue; - } - if (name === Sys.Serialization.JavaScriptSerializer._serverTypeFieldName && propertyCount !== 0){ - properties[propertyCount++] = properties[0]; - properties[0] = name; - } - else{ - properties[propertyCount++] = name; - } - } - if (sort) properties.sort(); - stringBuilder.append('{'); - var needComma = false; - - for (i=0; i - /// - /// - var e = Function._validateParams(arguments, [ - {name: "object", mayBeNull: true} - ]); - if (e) throw e; - var stringBuilder = new Sys.StringBuilder(); - Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(object, stringBuilder, false); - return stringBuilder.toString(); -} -Sys.Serialization.JavaScriptSerializer.deserialize = function Sys$Serialization$JavaScriptSerializer$deserialize(data, secure) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "data", type: String}, - {name: "secure", type: Boolean, optional: true} - ]); - if (e) throw e; - - if (data.length === 0) throw Error.argument('data', Sys.Res.cannotDeserializeEmptyString); - try { - var exp = data.replace(Sys.Serialization.JavaScriptSerializer._dateRegEx, "$1new Date($2)"); - - if (secure && Sys.Serialization.JavaScriptSerializer._jsonRegEx.test( - exp.replace(Sys.Serialization.JavaScriptSerializer._jsonStringRegEx, ''))) throw null; - return eval('(' + exp + ')'); - } - catch (e) { - throw Error.argument('data', Sys.Res.cannotDeserializeInvalidJson); - } -} -Type.registerNamespace('Sys.UI'); - -Sys.EventHandlerList = function Sys$EventHandlerList() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - this._list = {}; -} - function Sys$EventHandlerList$_addHandler(id, handler) { - Array.add(this._getEvent(id, true), handler); - } - function Sys$EventHandlerList$addHandler(id, handler) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "id", type: String}, - {name: "handler", type: Function} - ]); - if (e) throw e; - this._addHandler(id, handler); - } - function Sys$EventHandlerList$_removeHandler(id, handler) { - var evt = this._getEvent(id); - if (!evt) return; - Array.remove(evt, handler); - } - function Sys$EventHandlerList$removeHandler(id, handler) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "id", type: String}, - {name: "handler", type: Function} - ]); - if (e) throw e; - this._removeHandler(id, handler); - } - function Sys$EventHandlerList$getHandler(id) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "id", type: String} - ]); - if (e) throw e; - var evt = this._getEvent(id); - if (!evt || (evt.length === 0)) return null; - evt = Array.clone(evt); - return function(source, args) { - for (var i = 0, l = evt.length; i < l; i++) { - evt[i](source, args); - } - }; - } - function Sys$EventHandlerList$_getEvent(id, create) { - if (!this._list[id]) { - if (!create) return null; - this._list[id] = []; - } - return this._list[id]; - } -Sys.EventHandlerList.prototype = { - _addHandler: Sys$EventHandlerList$_addHandler, - addHandler: Sys$EventHandlerList$addHandler, - _removeHandler: Sys$EventHandlerList$_removeHandler, - removeHandler: Sys$EventHandlerList$removeHandler, - getHandler: Sys$EventHandlerList$getHandler, - _getEvent: Sys$EventHandlerList$_getEvent -} -Sys.EventHandlerList.registerClass('Sys.EventHandlerList'); -Sys.CommandEventArgs = function Sys$CommandEventArgs(commandName, commandArgument, commandSource) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "commandName", type: String}, - {name: "commandArgument", mayBeNull: true}, - {name: "commandSource", mayBeNull: true} - ]); - if (e) throw e; - Sys.CommandEventArgs.initializeBase(this); - this._commandName = commandName; - this._commandArgument = commandArgument; - this._commandSource = commandSource; -} - function Sys$CommandEventArgs$get_commandName() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._commandName; - } - function Sys$CommandEventArgs$get_commandArgument() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._commandArgument; - } - function Sys$CommandEventArgs$get_commandSource() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._commandSource; - } -Sys.CommandEventArgs.prototype = { - _commandName: null, - _commandArgument: null, - _commandSource: null, - get_commandName: Sys$CommandEventArgs$get_commandName, - get_commandArgument: Sys$CommandEventArgs$get_commandArgument, - get_commandSource: Sys$CommandEventArgs$get_commandSource -} -Sys.CommandEventArgs.registerClass("Sys.CommandEventArgs", Sys.CancelEventArgs); - -Sys.INotifyPropertyChange = function Sys$INotifyPropertyChange() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); -} - function Sys$INotifyPropertyChange$add_propertyChanged(handler) { - /// - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - throw Error.notImplemented(); - } - function Sys$INotifyPropertyChange$remove_propertyChanged(handler) { - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - throw Error.notImplemented(); - } -Sys.INotifyPropertyChange.prototype = { - add_propertyChanged: Sys$INotifyPropertyChange$add_propertyChanged, - remove_propertyChanged: Sys$INotifyPropertyChange$remove_propertyChanged -} -Sys.INotifyPropertyChange.registerInterface('Sys.INotifyPropertyChange'); - -Sys.PropertyChangedEventArgs = function Sys$PropertyChangedEventArgs(propertyName) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "propertyName", type: String} - ]); - if (e) throw e; - Sys.PropertyChangedEventArgs.initializeBase(this); - this._propertyName = propertyName; -} - - function Sys$PropertyChangedEventArgs$get_propertyName() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._propertyName; - } -Sys.PropertyChangedEventArgs.prototype = { - get_propertyName: Sys$PropertyChangedEventArgs$get_propertyName -} -Sys.PropertyChangedEventArgs.registerClass('Sys.PropertyChangedEventArgs', Sys.EventArgs); - -Sys.INotifyDisposing = function Sys$INotifyDisposing() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); -} - function Sys$INotifyDisposing$add_disposing(handler) { - /// - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - throw Error.notImplemented(); - } - function Sys$INotifyDisposing$remove_disposing(handler) { - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - throw Error.notImplemented(); - } -Sys.INotifyDisposing.prototype = { - add_disposing: Sys$INotifyDisposing$add_disposing, - remove_disposing: Sys$INotifyDisposing$remove_disposing -} -Sys.INotifyDisposing.registerInterface("Sys.INotifyDisposing"); - -Sys.Component = function Sys$Component() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (Sys.Application) Sys.Application.registerDisposableObject(this); -} - function Sys$Component$get_events() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._events) { - this._events = new Sys.EventHandlerList(); - } - return this._events; - } - function Sys$Component$get_id() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._id; - } - function Sys$Component$set_id(value) { - var e = Function._validateParams(arguments, [{name: "value", type: String}]); - if (e) throw e; - if (this._idSet) throw Error.invalidOperation(Sys.Res.componentCantSetIdTwice); - this._idSet = true; - var oldId = this.get_id(); - if (oldId && Sys.Application.findComponent(oldId)) throw Error.invalidOperation(Sys.Res.componentCantSetIdAfterAddedToApp); - this._id = value; - } - function Sys$Component$get_isInitialized() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._initialized; - } - function Sys$Component$get_isUpdating() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._updating; - } - function Sys$Component$add_disposing(handler) { - /// - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this.get_events().addHandler("disposing", handler); - } - function Sys$Component$remove_disposing(handler) { - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this.get_events().removeHandler("disposing", handler); - } - function Sys$Component$add_propertyChanged(handler) { - /// - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this.get_events().addHandler("propertyChanged", handler); - } - function Sys$Component$remove_propertyChanged(handler) { - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this.get_events().removeHandler("propertyChanged", handler); - } - function Sys$Component$beginUpdate() { - this._updating = true; - } - function Sys$Component$dispose() { - if (this._events) { - var handler = this._events.getHandler("disposing"); - if (handler) { - handler(this, Sys.EventArgs.Empty); - } - } - delete this._events; - Sys.Application.unregisterDisposableObject(this); - Sys.Application.removeComponent(this); - } - function Sys$Component$endUpdate() { - this._updating = false; - if (!this._initialized) this.initialize(); - this.updated(); - } - function Sys$Component$initialize() { - this._initialized = true; - } - function Sys$Component$raisePropertyChanged(propertyName) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "propertyName", type: String} - ]); - if (e) throw e; - if (!this._events) return; - var handler = this._events.getHandler("propertyChanged"); - if (handler) { - handler(this, new Sys.PropertyChangedEventArgs(propertyName)); - } - } - function Sys$Component$updated() { - } -Sys.Component.prototype = { - _id: null, - _idSet: false, - _initialized: false, - _updating: false, - get_events: Sys$Component$get_events, - get_id: Sys$Component$get_id, - set_id: Sys$Component$set_id, - get_isInitialized: Sys$Component$get_isInitialized, - get_isUpdating: Sys$Component$get_isUpdating, - add_disposing: Sys$Component$add_disposing, - remove_disposing: Sys$Component$remove_disposing, - add_propertyChanged: Sys$Component$add_propertyChanged, - remove_propertyChanged: Sys$Component$remove_propertyChanged, - beginUpdate: Sys$Component$beginUpdate, - dispose: Sys$Component$dispose, - endUpdate: Sys$Component$endUpdate, - initialize: Sys$Component$initialize, - raisePropertyChanged: Sys$Component$raisePropertyChanged, - updated: Sys$Component$updated -} -Sys.Component.registerClass('Sys.Component', null, Sys.IDisposable, Sys.INotifyPropertyChange, Sys.INotifyDisposing); -function Sys$Component$_setProperties(target, properties) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "target"}, - {name: "properties"} - ]); - if (e) throw e; - var current; - var targetType = Object.getType(target); - var isObject = (targetType === Object) || (targetType === Sys.UI.DomElement); - var isComponent = Sys.Component.isInstanceOfType(target) && !target.get_isUpdating(); - if (isComponent) target.beginUpdate(); - for (var name in properties) { - var val = properties[name]; - var getter = isObject ? null : target["get_" + name]; - if (isObject || typeof(getter) !== 'function') { - var targetVal = target[name]; - if (!isObject && typeof(targetVal) === 'undefined') throw Error.invalidOperation(String.format(Sys.Res.propertyUndefined, name)); - if (!val || (typeof(val) !== 'object') || (isObject && !targetVal)) { - target[name] = val; - } - else { - Sys$Component$_setProperties(targetVal, val); - } - } - else { - var setter = target["set_" + name]; - if (typeof(setter) === 'function') { - setter.apply(target, [val]); - } - else if (val instanceof Array) { - current = getter.apply(target); - if (!(current instanceof Array)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNotAnArray, name)); - for (var i = 0, j = current.length, l= val.length; i < l; i++, j++) { - current[j] = val[i]; - } - } - else if ((typeof(val) === 'object') && (Object.getType(val) === Object)) { - current = getter.apply(target); - if ((typeof(current) === 'undefined') || (current === null)) throw new Error.invalidOperation(String.format(Sys.Res.propertyNullOrUndefined, name)); - Sys$Component$_setProperties(current, val); - } - else { - throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name)); - } - } - } - if (isComponent) target.endUpdate(); -} -function Sys$Component$_setReferences(component, references) { - for (var name in references) { - var setter = component["set_" + name]; - var reference = $find(references[name]); - if (typeof(setter) !== 'function') throw new Error.invalidOperation(String.format(Sys.Res.propertyNotWritable, name)); - if (!reference) throw Error.invalidOperation(String.format(Sys.Res.referenceNotFound, references[name])); - setter.apply(component, [reference]); - } -} -var $create = Sys.Component.create = function Sys$Component$create(type, properties, events, references, element) { - /// - /// - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "type", type: Type}, - {name: "properties", mayBeNull: true, optional: true}, - {name: "events", mayBeNull: true, optional: true}, - {name: "references", mayBeNull: true, optional: true}, - {name: "element", mayBeNull: true, domElement: true, optional: true} - ]); - if (e) throw e; - if (!type.inheritsFrom(Sys.Component)) { - throw Error.argument('type', String.format(Sys.Res.createNotComponent, type.getName())); - } - if (type.inheritsFrom(Sys.UI.Behavior) || type.inheritsFrom(Sys.UI.Control)) { - if (!element) throw Error.argument('element', Sys.Res.createNoDom); - } - else if (element) throw Error.argument('element', Sys.Res.createComponentOnDom); - var component = (element ? new type(element): new type()); - var app = Sys.Application; - var creatingComponents = app.get_isCreatingComponents(); - component.beginUpdate(); - if (properties) { - Sys$Component$_setProperties(component, properties); - } - if (events) { - for (var name in events) { - if (!(component["add_" + name] instanceof Function)) throw new Error.invalidOperation(String.format(Sys.Res.undefinedEvent, name)); - if (!(events[name] instanceof Function)) throw new Error.invalidOperation(Sys.Res.eventHandlerNotFunction); - component["add_" + name](events[name]); - } - } - if (component.get_id()) { - app.addComponent(component); - } - if (creatingComponents) { - app._createdComponents[app._createdComponents.length] = component; - if (references) { - app._addComponentToSecondPass(component, references); - } - else { - component.endUpdate(); - } - } - else { - if (references) { - Sys$Component$_setReferences(component, references); - } - component.endUpdate(); - } - return component; -} - -Sys.UI.MouseButton = function Sys$UI$MouseButton() { - /// - /// - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); -} -Sys.UI.MouseButton.prototype = { - leftButton: 0, - middleButton: 1, - rightButton: 2 -} -Sys.UI.MouseButton.registerEnum("Sys.UI.MouseButton"); - -Sys.UI.Key = function Sys$UI$Key() { - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); -} -Sys.UI.Key.prototype = { - backspace: 8, - tab: 9, - enter: 13, - esc: 27, - space: 32, - pageUp: 33, - pageDown: 34, - end: 35, - home: 36, - left: 37, - up: 38, - right: 39, - down: 40, - del: 127 -} -Sys.UI.Key.registerEnum("Sys.UI.Key"); - -Sys.UI.Point = function Sys$UI$Point(x, y) { - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "x", type: Number, integer: true}, - {name: "y", type: Number, integer: true} - ]); - if (e) throw e; - this.x = x; - this.y = y; -} -Sys.UI.Point.registerClass('Sys.UI.Point'); - -Sys.UI.Bounds = function Sys$UI$Bounds(x, y, width, height) { - /// - /// - /// - /// - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "x", type: Number, integer: true}, - {name: "y", type: Number, integer: true}, - {name: "width", type: Number, integer: true}, - {name: "height", type: Number, integer: true} - ]); - if (e) throw e; - this.x = x; - this.y = y; - this.height = height; - this.width = width; -} -Sys.UI.Bounds.registerClass('Sys.UI.Bounds'); - -Sys.UI.DomEvent = function Sys$UI$DomEvent(eventObject) { - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "eventObject"} - ]); - if (e) throw e; - var ev = eventObject; - var etype = this.type = ev.type.toLowerCase(); - this.rawEvent = ev; - this.altKey = ev.altKey; - if (typeof(ev.button) !== 'undefined') { - this.button = (typeof(ev.which) !== 'undefined') ? ev.button : - (ev.button === 4) ? Sys.UI.MouseButton.middleButton : - (ev.button === 2) ? Sys.UI.MouseButton.rightButton : - Sys.UI.MouseButton.leftButton; - } - if (etype === 'keypress') { - this.charCode = ev.charCode || ev.keyCode; - } - else if (ev.keyCode && (ev.keyCode === 46)) { - this.keyCode = 127; - } - else { - this.keyCode = ev.keyCode; - } - this.clientX = ev.clientX; - this.clientY = ev.clientY; - this.ctrlKey = ev.ctrlKey; - this.target = ev.target ? ev.target : ev.srcElement; - if (!etype.startsWith('key')) { - if ((typeof(ev.offsetX) !== 'undefined') && (typeof(ev.offsetY) !== 'undefined')) { - this.offsetX = ev.offsetX; - this.offsetY = ev.offsetY; - } - else if (this.target && (this.target.nodeType !== 3) && (typeof(ev.clientX) === 'number')) { - var loc = Sys.UI.DomElement.getLocation(this.target); - var w = Sys.UI.DomElement._getWindow(this.target); - this.offsetX = (w.pageXOffset || 0) + ev.clientX - loc.x; - this.offsetY = (w.pageYOffset || 0) + ev.clientY - loc.y; - } - } - this.screenX = ev.screenX; - this.screenY = ev.screenY; - this.shiftKey = ev.shiftKey; -} - function Sys$UI$DomEvent$preventDefault() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (this.rawEvent.preventDefault) { - this.rawEvent.preventDefault(); - } - else if (window.event) { - this.rawEvent.returnValue = false; - } - } - function Sys$UI$DomEvent$stopPropagation() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (this.rawEvent.stopPropagation) { - this.rawEvent.stopPropagation(); - } - else if (window.event) { - this.rawEvent.cancelBubble = true; - } - } -Sys.UI.DomEvent.prototype = { - preventDefault: Sys$UI$DomEvent$preventDefault, - stopPropagation: Sys$UI$DomEvent$stopPropagation -} -Sys.UI.DomEvent.registerClass('Sys.UI.DomEvent'); -var $addHandler = Sys.UI.DomEvent.addHandler = function Sys$UI$DomEvent$addHandler(element, eventName, handler, autoRemove) { - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element"}, - {name: "eventName", type: String}, - {name: "handler", type: Function}, - {name: "autoRemove", type: Boolean, optional: true} - ]); - if (e) throw e; - Sys.UI.DomEvent._ensureDomNode(element); - if (eventName === "error") throw Error.invalidOperation(Sys.Res.addHandlerCantBeUsedForError); - if (!element._events) { - element._events = {}; - } - var eventCache = element._events[eventName]; - if (!eventCache) { - element._events[eventName] = eventCache = []; - } - var browserHandler; - if (element.addEventListener) { - browserHandler = function(e) { - return handler.call(element, new Sys.UI.DomEvent(e)); - } - element.addEventListener(eventName, browserHandler, false); - } - else if (element.attachEvent) { - browserHandler = function() { - var e = {}; - try {e = Sys.UI.DomElement._getWindow(element).event} catch(ex) {} - return handler.call(element, new Sys.UI.DomEvent(e)); - } - element.attachEvent('on' + eventName, browserHandler); - } - eventCache[eventCache.length] = {handler: handler, browserHandler: browserHandler, autoRemove: autoRemove }; - if (autoRemove) { - var d = element.dispose; - if (d !== Sys.UI.DomEvent._disposeHandlers) { - element.dispose = Sys.UI.DomEvent._disposeHandlers; - if (typeof(d) !== "undefined") { - element._chainDispose = d; - } - } - } -} -var $addHandlers = Sys.UI.DomEvent.addHandlers = function Sys$UI$DomEvent$addHandlers(element, events, handlerOwner, autoRemove) { - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element"}, - {name: "events", type: Object}, - {name: "handlerOwner", optional: true}, - {name: "autoRemove", type: Boolean, optional: true} - ]); - if (e) throw e; - Sys.UI.DomEvent._ensureDomNode(element); - for (var name in events) { - var handler = events[name]; - if (typeof(handler) !== 'function') throw Error.invalidOperation(Sys.Res.cantAddNonFunctionhandler); - if (handlerOwner) { - handler = Function.createDelegate(handlerOwner, handler); - } - $addHandler(element, name, handler, autoRemove || false); - } -} -var $clearHandlers = Sys.UI.DomEvent.clearHandlers = function Sys$UI$DomEvent$clearHandlers(element) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element"} - ]); - if (e) throw e; - Sys.UI.DomEvent._ensureDomNode(element); - Sys.UI.DomEvent._clearHandlers(element, false); -} -Sys.UI.DomEvent._clearHandlers = function Sys$UI$DomEvent$_clearHandlers(element, autoRemoving) { - if (element._events) { - var cache = element._events; - for (var name in cache) { - var handlers = cache[name]; - for (var i = handlers.length - 1; i >= 0; i--) { - var entry = handlers[i]; - if (!autoRemoving || entry.autoRemove) { - $removeHandler(element, name, entry.handler); - } - } - } - element._events = null; - } -} -Sys.UI.DomEvent._disposeHandlers = function Sys$UI$DomEvent$_disposeHandlers() { - Sys.UI.DomEvent._clearHandlers(this, true); - var d = this._chainDispose, type = typeof(d); - if (type !== "undefined") { - this.dispose = d; - this._chainDispose = null; - if (type === "function") { - this.dispose(); - } - } -} -var $removeHandler = Sys.UI.DomEvent.removeHandler = function Sys$UI$DomEvent$removeHandler(element, eventName, handler) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element"}, - {name: "eventName", type: String}, - {name: "handler", type: Function} - ]); - if (e) throw e; - Sys.UI.DomEvent._removeHandler(element, eventName, handler); -} -Sys.UI.DomEvent._removeHandler = function Sys$UI$DomEvent$_removeHandler(element, eventName, handler) { - Sys.UI.DomEvent._ensureDomNode(element); - var browserHandler = null; - if ((typeof(element._events) !== 'object') || !element._events) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid); - var cache = element._events[eventName]; - if (!(cache instanceof Array)) throw Error.invalidOperation(Sys.Res.eventHandlerInvalid); - for (var i = 0, l = cache.length; i < l; i++) { - if (cache[i].handler === handler) { - browserHandler = cache[i].browserHandler; - break; - } - } - if (typeof(browserHandler) !== 'function') throw Error.invalidOperation(Sys.Res.eventHandlerInvalid); - if (element.removeEventListener) { - element.removeEventListener(eventName, browserHandler, false); - } - else if (element.detachEvent) { - element.detachEvent('on' + eventName, browserHandler); - } - cache.splice(i, 1); -} -Sys.UI.DomEvent._ensureDomNode = function Sys$UI$DomEvent$_ensureDomNode(element) { - if (element.tagName && (element.tagName.toUpperCase() === "SCRIPT")) return; - - var doc = element.ownerDocument || element.document || element; - if ((typeof(element.document) !== 'object') && (element != doc) && (typeof(element.nodeType) !== 'number')) { - throw Error.argument("element", Sys.Res.argumentDomNode); - } -} - -Sys.UI.DomElement = function Sys$UI$DomElement() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); -} -Sys.UI.DomElement.registerClass('Sys.UI.DomElement'); -Sys.UI.DomElement.addCssClass = function Sys$UI$DomElement$addCssClass(element, className) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true}, - {name: "className", type: String} - ]); - if (e) throw e; - if (!Sys.UI.DomElement.containsCssClass(element, className)) { - if (element.className === '') { - element.className = className; - } - else { - element.className += ' ' + className; - } - } -} -Sys.UI.DomElement.containsCssClass = function Sys$UI$DomElement$containsCssClass(element, className) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true}, - {name: "className", type: String} - ]); - if (e) throw e; - return Array.contains(element.className.split(' '), className); -} -Sys.UI.DomElement.getBounds = function Sys$UI$DomElement$getBounds(element) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true} - ]); - if (e) throw e; - var offset = Sys.UI.DomElement.getLocation(element); - return new Sys.UI.Bounds(offset.x, offset.y, element.offsetWidth || 0, element.offsetHeight || 0); -} -var $get = Sys.UI.DomElement.getElementById = function Sys$UI$DomElement$getElementById(id, element) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "id", type: String}, - {name: "element", mayBeNull: true, domElement: true, optional: true} - ]); - if (e) throw e; - if (!element) return document.getElementById(id); - if (element.getElementById) return element.getElementById(id); - var nodeQueue = []; - var childNodes = element.childNodes; - for (var i = 0; i < childNodes.length; i++) { - var node = childNodes[i]; - if (node.nodeType == 1) { - nodeQueue[nodeQueue.length] = node; - } - } - while (nodeQueue.length) { - node = nodeQueue.shift(); - if (node.id == id) { - return node; - } - childNodes = node.childNodes; - for (i = 0; i < childNodes.length; i++) { - node = childNodes[i]; - if (node.nodeType == 1) { - nodeQueue[nodeQueue.length] = node; - } - } - } - return null; -} -if (document.documentElement.getBoundingClientRect) { - Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true} - ]); - if (e) throw e; - if (element.self || element.nodeType === 9) return new Sys.UI.Point(0,0); - var clientRect = element.getBoundingClientRect(); - if (!clientRect) { - return new Sys.UI.Point(0,0); - } - var documentElement = element.ownerDocument.documentElement, - offsetX = Math.floor(clientRect.left + 0.5) + documentElement.scrollLeft, - offsetY = Math.floor(clientRect.top + 0.5) + documentElement.scrollTop; - if (Sys.Browser.agent === Sys.Browser.InternetExplorer) { - try { - var f = element.ownerDocument.parentWindow.frameElement || null; - if (f) { - var offset = (f.frameBorder === "0" || f.frameBorder === "no") ? 2 : 0; - offsetX += offset; - offsetY += offset; - } - } - catch(ex) { - } - if (Sys.Browser.version <= 7) { - - var multiplier, before, rect, d = document.createElement("div"); - d.style.cssText = "position:absolute !important;left:0px !important;right:0px !important;height:0px !important;width:1px !important;display:hidden !important"; - try { - before = document.body.childNodes[0]; - document.body.insertBefore(d, before); - rect = d.getBoundingClientRect(); - document.body.removeChild(d); - multiplier = (rect.right - rect.left); - } - catch (e) { - } - if (multiplier && (multiplier !== 1)) { - offsetX = Math.floor(offsetX / multiplier); - offsetY = Math.floor(offsetY / multiplier); - } - } - if ((document.documentMode || 0) < 8) { - offsetX -= 2; - offsetY -= 2; - } - } - return new Sys.UI.Point(offsetX, offsetY); - } -} -else if (Sys.Browser.agent === Sys.Browser.Safari) { - Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true} - ]); - if (e) throw e; - if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0); - var offsetX = 0, offsetY = 0, - parent, - previous = null, - previousStyle = null, - currentStyle; - for (parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) { - currentStyle = Sys.UI.DomElement._getCurrentStyle(parent); - var tagName = parent.tagName ? parent.tagName.toUpperCase() : null; - if ((parent.offsetLeft || parent.offsetTop) && - ((tagName !== "BODY") || (!previousStyle || previousStyle.position !== "absolute"))) { - offsetX += parent.offsetLeft; - offsetY += parent.offsetTop; - } - if (previous && Sys.Browser.version >= 3) { - offsetX += parseInt(currentStyle.borderLeftWidth); - offsetY += parseInt(currentStyle.borderTopWidth); - } - } - currentStyle = Sys.UI.DomElement._getCurrentStyle(element); - var elementPosition = currentStyle ? currentStyle.position : null; - if (!elementPosition || (elementPosition !== "absolute")) { - for (parent = element.parentNode; parent; parent = parent.parentNode) { - tagName = parent.tagName ? parent.tagName.toUpperCase() : null; - if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) { - offsetX -= (parent.scrollLeft || 0); - offsetY -= (parent.scrollTop || 0); - } - currentStyle = Sys.UI.DomElement._getCurrentStyle(parent); - var parentPosition = currentStyle ? currentStyle.position : null; - if (parentPosition && (parentPosition === "absolute")) break; - } - } - return new Sys.UI.Point(offsetX, offsetY); - } -} -else { - Sys.UI.DomElement.getLocation = function Sys$UI$DomElement$getLocation(element) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true} - ]); - if (e) throw e; - if ((element.window && (element.window === element)) || element.nodeType === 9) return new Sys.UI.Point(0,0); - var offsetX = 0, offsetY = 0, - parent, - previous = null, - previousStyle = null, - currentStyle = null; - for (parent = element; parent; previous = parent, previousStyle = currentStyle, parent = parent.offsetParent) { - var tagName = parent.tagName ? parent.tagName.toUpperCase() : null; - currentStyle = Sys.UI.DomElement._getCurrentStyle(parent); - if ((parent.offsetLeft || parent.offsetTop) && - !((tagName === "BODY") && - (!previousStyle || previousStyle.position !== "absolute"))) { - offsetX += parent.offsetLeft; - offsetY += parent.offsetTop; - } - if (previous !== null && currentStyle) { - if ((tagName !== "TABLE") && (tagName !== "TD") && (tagName !== "HTML")) { - offsetX += parseInt(currentStyle.borderLeftWidth) || 0; - offsetY += parseInt(currentStyle.borderTopWidth) || 0; - } - if (tagName === "TABLE" && - (currentStyle.position === "relative" || currentStyle.position === "absolute")) { - offsetX += parseInt(currentStyle.marginLeft) || 0; - offsetY += parseInt(currentStyle.marginTop) || 0; - } - } - } - currentStyle = Sys.UI.DomElement._getCurrentStyle(element); - var elementPosition = currentStyle ? currentStyle.position : null; - if (!elementPosition || (elementPosition !== "absolute")) { - for (parent = element.parentNode; parent; parent = parent.parentNode) { - tagName = parent.tagName ? parent.tagName.toUpperCase() : null; - if ((tagName !== "BODY") && (tagName !== "HTML") && (parent.scrollLeft || parent.scrollTop)) { - offsetX -= (parent.scrollLeft || 0); - offsetY -= (parent.scrollTop || 0); - currentStyle = Sys.UI.DomElement._getCurrentStyle(parent); - if (currentStyle) { - offsetX += parseInt(currentStyle.borderLeftWidth) || 0; - offsetY += parseInt(currentStyle.borderTopWidth) || 0; - } - } - } - } - return new Sys.UI.Point(offsetX, offsetY); - } -} -Sys.UI.DomElement.isDomElement = function Sys$UI$DomElement$isDomElement(obj) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "obj"} - ]); - if (e) throw e; - return Sys._isDomElement(obj); -} -Sys.UI.DomElement.removeCssClass = function Sys$UI$DomElement$removeCssClass(element, className) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true}, - {name: "className", type: String} - ]); - if (e) throw e; - var currentClassName = ' ' + element.className + ' '; - var index = currentClassName.indexOf(' ' + className + ' '); - if (index >= 0) { - element.className = (currentClassName.substr(0, index) + ' ' + - currentClassName.substring(index + className.length + 1, currentClassName.length)).trim(); - } -} -Sys.UI.DomElement.resolveElement = function Sys$UI$DomElement$resolveElement(elementOrElementId, containerElement) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "elementOrElementId", mayBeNull: true}, - {name: "containerElement", mayBeNull: true, domElement: true, optional: true} - ]); - if (e) throw e; - var el = elementOrElementId; - if (!el) return null; - if (typeof(el) === "string") { - el = Sys.UI.DomElement.getElementById(el, containerElement); - if (!el) { - throw Error.argument("elementOrElementId", String.format(Sys.Res.elementNotFound, elementOrElementId)); - } - } - else if(!Sys.UI.DomElement.isDomElement(el)) { - throw Error.argument("elementOrElementId", Sys.Res.expectedElementOrId); - } - return el; -} -Sys.UI.DomElement.raiseBubbleEvent = function Sys$UI$DomElement$raiseBubbleEvent(source, args) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "source", domElement: true}, - {name: "args", type: Sys.EventArgs} - ]); - if (e) throw e; - var target = source; - while (target) { - var control = target.control; - if (control && control.onBubbleEvent && control.raiseBubbleEvent) { - Sys.UI.DomElement._raiseBubbleEventFromControl(control, source, args); - return; - } - target = target.parentNode; - } -} -Sys.UI.DomElement._raiseBubbleEventFromControl = function Sys$UI$DomElement$_raiseBubbleEventFromControl(control, source, args) { - if (!control.onBubbleEvent(source, args)) { - control._raiseBubbleEvent(source, args); - } -} -Sys.UI.DomElement.setLocation = function Sys$UI$DomElement$setLocation(element, x, y) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true}, - {name: "x", type: Number, integer: true}, - {name: "y", type: Number, integer: true} - ]); - if (e) throw e; - var style = element.style; - style.position = 'absolute'; - style.left = x + "px"; - style.top = y + "px"; -} -Sys.UI.DomElement.toggleCssClass = function Sys$UI$DomElement$toggleCssClass(element, className) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true}, - {name: "className", type: String} - ]); - if (e) throw e; - if (Sys.UI.DomElement.containsCssClass(element, className)) { - Sys.UI.DomElement.removeCssClass(element, className); - } - else { - Sys.UI.DomElement.addCssClass(element, className); - } -} -Sys.UI.DomElement.getVisibilityMode = function Sys$UI$DomElement$getVisibilityMode(element) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true} - ]); - if (e) throw e; - return (element._visibilityMode === Sys.UI.VisibilityMode.hide) ? - Sys.UI.VisibilityMode.hide : - Sys.UI.VisibilityMode.collapse; -} -Sys.UI.DomElement.setVisibilityMode = function Sys$UI$DomElement$setVisibilityMode(element, value) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true}, - {name: "value", type: Sys.UI.VisibilityMode} - ]); - if (e) throw e; - Sys.UI.DomElement._ensureOldDisplayMode(element); - if (element._visibilityMode !== value) { - element._visibilityMode = value; - if (Sys.UI.DomElement.getVisible(element) === false) { - if (element._visibilityMode === Sys.UI.VisibilityMode.hide) { - element.style.display = element._oldDisplayMode; - } - else { - element.style.display = 'none'; - } - } - element._visibilityMode = value; - } -} -Sys.UI.DomElement.getVisible = function Sys$UI$DomElement$getVisible(element) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true} - ]); - if (e) throw e; - var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element); - if (!style) return true; - return (style.visibility !== 'hidden') && (style.display !== 'none'); -} -Sys.UI.DomElement.setVisible = function Sys$UI$DomElement$setVisible(element, value) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true}, - {name: "value", type: Boolean} - ]); - if (e) throw e; - if (value !== Sys.UI.DomElement.getVisible(element)) { - Sys.UI.DomElement._ensureOldDisplayMode(element); - element.style.visibility = value ? 'visible' : 'hidden'; - if (value || (element._visibilityMode === Sys.UI.VisibilityMode.hide)) { - element.style.display = element._oldDisplayMode; - } - else { - element.style.display = 'none'; - } - } -} -Sys.UI.DomElement._ensureOldDisplayMode = function Sys$UI$DomElement$_ensureOldDisplayMode(element) { - if (!element._oldDisplayMode) { - var style = element.currentStyle || Sys.UI.DomElement._getCurrentStyle(element); - element._oldDisplayMode = style ? style.display : null; - if (!element._oldDisplayMode || element._oldDisplayMode === 'none') { - switch(element.tagName.toUpperCase()) { - case 'DIV': case 'P': case 'ADDRESS': case 'BLOCKQUOTE': case 'BODY': case 'COL': - case 'COLGROUP': case 'DD': case 'DL': case 'DT': case 'FIELDSET': case 'FORM': - case 'H1': case 'H2': case 'H3': case 'H4': case 'H5': case 'H6': case 'HR': - case 'IFRAME': case 'LEGEND': case 'OL': case 'PRE': case 'TABLE': case 'TD': - case 'TH': case 'TR': case 'UL': - element._oldDisplayMode = 'block'; - break; - case 'LI': - element._oldDisplayMode = 'list-item'; - break; - default: - element._oldDisplayMode = 'inline'; - } - } - } -} -Sys.UI.DomElement._getWindow = function Sys$UI$DomElement$_getWindow(element) { - var doc = element.ownerDocument || element.document || element; - return doc.defaultView || doc.parentWindow; -} -Sys.UI.DomElement._getCurrentStyle = function Sys$UI$DomElement$_getCurrentStyle(element) { - if (element.nodeType === 3) return null; - var w = Sys.UI.DomElement._getWindow(element); - if (element.documentElement) element = element.documentElement; - var computedStyle = (w && (element !== w) && w.getComputedStyle) ? - w.getComputedStyle(element, null) : - element.currentStyle || element.style; - if (!computedStyle && (Sys.Browser.agent === Sys.Browser.Safari) && element.style) { - var oldDisplay = element.style.display; - var oldPosition = element.style.position; - element.style.position = 'absolute'; - element.style.display = 'block'; - var style = w.getComputedStyle(element, null); - element.style.display = oldDisplay; - element.style.position = oldPosition; - computedStyle = {}; - for (var n in style) { - computedStyle[n] = style[n]; - } - computedStyle.display = 'none'; - } - return computedStyle; -} - -Sys.IContainer = function Sys$IContainer() { - throw Error.notImplemented(); -} - function Sys$IContainer$addComponent(component) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "component", type: Sys.Component} - ]); - if (e) throw e; - throw Error.notImplemented(); - } - function Sys$IContainer$removeComponent(component) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "component", type: Sys.Component} - ]); - if (e) throw e; - throw Error.notImplemented(); - } - function Sys$IContainer$findComponent(id) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "id", type: String} - ]); - if (e) throw e; - throw Error.notImplemented(); - } - function Sys$IContainer$getComponents() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } -Sys.IContainer.prototype = { - addComponent: Sys$IContainer$addComponent, - removeComponent: Sys$IContainer$removeComponent, - findComponent: Sys$IContainer$findComponent, - getComponents: Sys$IContainer$getComponents -} -Sys.IContainer.registerInterface("Sys.IContainer"); - -Sys.ApplicationLoadEventArgs = function Sys$ApplicationLoadEventArgs(components, isPartialLoad) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "components", type: Array, elementType: Sys.Component}, - {name: "isPartialLoad", type: Boolean} - ]); - if (e) throw e; - Sys.ApplicationLoadEventArgs.initializeBase(this); - this._components = components; - this._isPartialLoad = isPartialLoad; -} - - function Sys$ApplicationLoadEventArgs$get_components() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._components; - } - function Sys$ApplicationLoadEventArgs$get_isPartialLoad() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._isPartialLoad; - } -Sys.ApplicationLoadEventArgs.prototype = { - get_components: Sys$ApplicationLoadEventArgs$get_components, - get_isPartialLoad: Sys$ApplicationLoadEventArgs$get_isPartialLoad -} -Sys.ApplicationLoadEventArgs.registerClass('Sys.ApplicationLoadEventArgs', Sys.EventArgs); - -Sys._Application = function Sys$_Application() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - Sys._Application.initializeBase(this); - this._disposableObjects = []; - this._components = {}; - this._createdComponents = []; - this._secondPassComponents = []; - this._unloadHandlerDelegate = Function.createDelegate(this, this._unloadHandler); - Sys.UI.DomEvent.addHandler(window, "unload", this._unloadHandlerDelegate); - this._domReady(); -} - function Sys$_Application$get_isCreatingComponents() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._creatingComponents; - } - function Sys$_Application$get_isDisposing() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._disposing; - } - function Sys$_Application$add_init(handler) { - /// - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - if (this._initialized) { - handler(this, Sys.EventArgs.Empty); - } - else { - this.get_events().addHandler("init", handler); - } - } - function Sys$_Application$remove_init(handler) { - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this.get_events().removeHandler("init", handler); - } - function Sys$_Application$add_load(handler) { - /// - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this.get_events().addHandler("load", handler); - } - function Sys$_Application$remove_load(handler) { - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this.get_events().removeHandler("load", handler); - } - function Sys$_Application$add_unload(handler) { - /// - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this.get_events().addHandler("unload", handler); - } - function Sys$_Application$remove_unload(handler) { - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this.get_events().removeHandler("unload", handler); - } - function Sys$_Application$addComponent(component) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "component", type: Sys.Component} - ]); - if (e) throw e; - var id = component.get_id(); - if (!id) throw Error.invalidOperation(Sys.Res.cantAddWithoutId); - if (typeof(this._components[id]) !== 'undefined') throw Error.invalidOperation(String.format(Sys.Res.appDuplicateComponent, id)); - this._components[id] = component; - } - function Sys$_Application$beginCreateComponents() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - this._creatingComponents = true; - } - function Sys$_Application$dispose() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._disposing) { - this._disposing = true; - if (this._timerCookie) { - window.clearTimeout(this._timerCookie); - delete this._timerCookie; - } - if (this._endRequestHandler) { - Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler); - delete this._endRequestHandler; - } - if (this._beginRequestHandler) { - Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(this._beginRequestHandler); - delete this._beginRequestHandler; - } - if (window.pageUnload) { - window.pageUnload(this, Sys.EventArgs.Empty); - } - var unloadHandler = this.get_events().getHandler("unload"); - if (unloadHandler) { - unloadHandler(this, Sys.EventArgs.Empty); - } - var disposableObjects = Array.clone(this._disposableObjects); - for (var i = 0, l = disposableObjects.length; i < l; i++) { - var object = disposableObjects[i]; - if (typeof(object) !== "undefined") { - object.dispose(); - } - } - Array.clear(this._disposableObjects); - Sys.UI.DomEvent.removeHandler(window, "unload", this._unloadHandlerDelegate); - if (Sys._ScriptLoader) { - var sl = Sys._ScriptLoader.getInstance(); - if(sl) { - sl.dispose(); - } - } - Sys._Application.callBaseMethod(this, 'dispose'); - } - } - function Sys$_Application$disposeElement(element, childNodesOnly) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element"}, - {name: "childNodesOnly", type: Boolean} - ]); - if (e) throw e; - if (element.nodeType === 1) { - var children = element.getElementsByTagName("*"); - for (var i = children.length - 1; i >= 0; i--) { - this._disposeElementInternal(children[i]); - } - if (!childNodesOnly) { - this._disposeElementInternal(element); - } - } - } - function Sys$_Application$endCreateComponents() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - var components = this._secondPassComponents; - for (var i = 0, l = components.length; i < l; i++) { - var component = components[i].component; - Sys$Component$_setReferences(component, components[i].references); - component.endUpdate(); - } - this._secondPassComponents = []; - this._creatingComponents = false; - } - function Sys$_Application$findComponent(id, parent) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "id", type: String}, - {name: "parent", mayBeNull: true, optional: true} - ]); - if (e) throw e; - return (parent ? - ((Sys.IContainer.isInstanceOfType(parent)) ? - parent.findComponent(id) : - parent[id] || null) : - Sys.Application._components[id] || null); - } - function Sys$_Application$getComponents() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - var res = []; - var components = this._components; - for (var name in components) { - res[res.length] = components[name]; - } - return res; - } - function Sys$_Application$initialize() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if(!this.get_isInitialized() && !this._disposing) { - Sys._Application.callBaseMethod(this, 'initialize'); - this._raiseInit(); - if (this.get_stateString) { - if (Sys.WebForms && Sys.WebForms.PageRequestManager) { - this._beginRequestHandler = Function.createDelegate(this, this._onPageRequestManagerBeginRequest); - Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(this._beginRequestHandler); - this._endRequestHandler = Function.createDelegate(this, this._onPageRequestManagerEndRequest); - Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._endRequestHandler); - } - var loadedEntry = this.get_stateString(); - if (loadedEntry !== this._currentEntry) { - this._navigate(loadedEntry); - } - else { - this._ensureHistory(); - } - } - this.raiseLoad(); - } - } - function Sys$_Application$notifyScriptLoaded() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - } - function Sys$_Application$registerDisposableObject(object) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "object", type: Sys.IDisposable} - ]); - if (e) throw e; - if (!this._disposing) { - var objects = this._disposableObjects, - i = objects.length; - objects[i] = object; - object.__msdisposeindex = i; - } - } - function Sys$_Application$raiseLoad() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - var h = this.get_events().getHandler("load"); - var args = new Sys.ApplicationLoadEventArgs(Array.clone(this._createdComponents), !!this._loaded); - this._loaded = true; - if (h) { - h(this, args); - } - if (window.pageLoad) { - window.pageLoad(this, args); - } - this._createdComponents = []; - } - function Sys$_Application$removeComponent(component) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "component", type: Sys.Component} - ]); - if (e) throw e; - var id = component.get_id(); - if (id) delete this._components[id]; - } - function Sys$_Application$unregisterDisposableObject(object) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "object", type: Sys.IDisposable} - ]); - if (e) throw e; - if (!this._disposing) { - var i = object.__msdisposeindex; - if (typeof(i) === "number") { - var disposableObjects = this._disposableObjects; - delete disposableObjects[i]; - delete object.__msdisposeindex; - if (++this._deleteCount > 1000) { - var newArray = []; - for (var j = 0, l = disposableObjects.length; j < l; j++) { - object = disposableObjects[j]; - if (typeof(object) !== "undefined") { - object.__msdisposeindex = newArray.length; - newArray.push(object); - } - } - this._disposableObjects = newArray; - this._deleteCount = 0; - } - } - } - } - function Sys$_Application$_addComponentToSecondPass(component, references) { - this._secondPassComponents[this._secondPassComponents.length] = {component: component, references: references}; - } - function Sys$_Application$_disposeComponents(list) { - if (list) { - for (var i = list.length - 1; i >= 0; i--) { - var item = list[i]; - if (typeof(item.dispose) === "function") { - item.dispose(); - } - } - } - } - function Sys$_Application$_disposeElementInternal(element) { - var d = element.dispose; - if (d && typeof(d) === "function") { - element.dispose(); - } - else { - var c = element.control; - if (c && typeof(c.dispose) === "function") { - c.dispose(); - } - } - var list = element._behaviors; - if (list) { - this._disposeComponents(list); - } - list = element._components; - if (list) { - this._disposeComponents(list); - element._components = null; - } - } - function Sys$_Application$_domReady() { - var check, er, app = this; - function init() { app.initialize(); } - var onload = function() { - Sys.UI.DomEvent.removeHandler(window, "load", onload); - init(); - } - Sys.UI.DomEvent.addHandler(window, "load", onload); - - if (document.addEventListener) { - try { - document.addEventListener("DOMContentLoaded", check = function() { - document.removeEventListener("DOMContentLoaded", check, false); - init(); - }, false); - } - catch (er) { } - } - else if (document.attachEvent) { - if ((window == window.top) && document.documentElement.doScroll) { - var timeout, el = document.createElement("div"); - check = function() { - try { - el.doScroll("left"); - } - catch (er) { - timeout = window.setTimeout(check, 0); - return; - } - el = null; - init(); - } - check(); - } - else { - document.attachEvent("onreadystatechange", check = function() { - if (document.readyState === "complete") { - document.detachEvent("onreadystatechange", check); - init(); - } - }); - } - } - } - function Sys$_Application$_raiseInit() { - var handler = this.get_events().getHandler("init"); - if (handler) { - this.beginCreateComponents(); - handler(this, Sys.EventArgs.Empty); - this.endCreateComponents(); - } - } - function Sys$_Application$_unloadHandler(event) { - this.dispose(); - } -Sys._Application.prototype = { - _creatingComponents: false, - _disposing: false, - _deleteCount: 0, - get_isCreatingComponents: Sys$_Application$get_isCreatingComponents, - get_isDisposing: Sys$_Application$get_isDisposing, - add_init: Sys$_Application$add_init, - remove_init: Sys$_Application$remove_init, - add_load: Sys$_Application$add_load, - remove_load: Sys$_Application$remove_load, - add_unload: Sys$_Application$add_unload, - remove_unload: Sys$_Application$remove_unload, - addComponent: Sys$_Application$addComponent, - beginCreateComponents: Sys$_Application$beginCreateComponents, - dispose: Sys$_Application$dispose, - disposeElement: Sys$_Application$disposeElement, - endCreateComponents: Sys$_Application$endCreateComponents, - findComponent: Sys$_Application$findComponent, - getComponents: Sys$_Application$getComponents, - initialize: Sys$_Application$initialize, - notifyScriptLoaded: Sys$_Application$notifyScriptLoaded, - registerDisposableObject: Sys$_Application$registerDisposableObject, - raiseLoad: Sys$_Application$raiseLoad, - removeComponent: Sys$_Application$removeComponent, - unregisterDisposableObject: Sys$_Application$unregisterDisposableObject, - _addComponentToSecondPass: Sys$_Application$_addComponentToSecondPass, - _disposeComponents: Sys$_Application$_disposeComponents, - _disposeElementInternal: Sys$_Application$_disposeElementInternal, - _domReady: Sys$_Application$_domReady, - _raiseInit: Sys$_Application$_raiseInit, - _unloadHandler: Sys$_Application$_unloadHandler -} -Sys._Application.registerClass('Sys._Application', Sys.Component, Sys.IContainer); -Sys.Application = new Sys._Application(); -var $find = Sys.Application.findComponent; - -Sys.UI.Behavior = function Sys$UI$Behavior(element) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true} - ]); - if (e) throw e; - Sys.UI.Behavior.initializeBase(this); - this._element = element; - var behaviors = element._behaviors; - if (!behaviors) { - element._behaviors = [this]; - } - else { - behaviors[behaviors.length] = this; - } -} - function Sys$UI$Behavior$get_element() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._element; - } - function Sys$UI$Behavior$get_id() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - var baseId = Sys.UI.Behavior.callBaseMethod(this, 'get_id'); - if (baseId) return baseId; - if (!this._element || !this._element.id) return ''; - return this._element.id + '$' + this.get_name(); - } - function Sys$UI$Behavior$get_name() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (this._name) return this._name; - var name = Object.getTypeName(this); - var i = name.lastIndexOf('.'); - if (i !== -1) name = name.substr(i + 1); - if (!this.get_isInitialized()) this._name = name; - return name; - } - function Sys$UI$Behavior$set_name(value) { - var e = Function._validateParams(arguments, [{name: "value", type: String}]); - if (e) throw e; - if ((value === '') || (value.charAt(0) === ' ') || (value.charAt(value.length - 1) === ' ')) - throw Error.argument('value', Sys.Res.invalidId); - if (typeof(this._element[value]) !== 'undefined') - throw Error.invalidOperation(String.format(Sys.Res.behaviorDuplicateName, value)); - if (this.get_isInitialized()) throw Error.invalidOperation(Sys.Res.cantSetNameAfterInit); - this._name = value; - } - function Sys$UI$Behavior$initialize() { - Sys.UI.Behavior.callBaseMethod(this, 'initialize'); - var name = this.get_name(); - if (name) this._element[name] = this; - } - function Sys$UI$Behavior$dispose() { - Sys.UI.Behavior.callBaseMethod(this, 'dispose'); - var e = this._element; - if (e) { - var name = this.get_name(); - if (name) { - e[name] = null; - } - var behaviors = e._behaviors; - Array.remove(behaviors, this); - if (behaviors.length === 0) { - e._behaviors = null; - } - delete this._element; - } - } -Sys.UI.Behavior.prototype = { - _name: null, - get_element: Sys$UI$Behavior$get_element, - get_id: Sys$UI$Behavior$get_id, - get_name: Sys$UI$Behavior$get_name, - set_name: Sys$UI$Behavior$set_name, - initialize: Sys$UI$Behavior$initialize, - dispose: Sys$UI$Behavior$dispose -} -Sys.UI.Behavior.registerClass('Sys.UI.Behavior', Sys.Component); -Sys.UI.Behavior.getBehaviorByName = function Sys$UI$Behavior$getBehaviorByName(element, name) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true}, - {name: "name", type: String} - ]); - if (e) throw e; - var b = element[name]; - return (b && Sys.UI.Behavior.isInstanceOfType(b)) ? b : null; -} -Sys.UI.Behavior.getBehaviors = function Sys$UI$Behavior$getBehaviors(element) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true} - ]); - if (e) throw e; - if (!element._behaviors) return []; - return Array.clone(element._behaviors); -} -Sys.UI.Behavior.getBehaviorsByType = function Sys$UI$Behavior$getBehaviorsByType(element, type) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true}, - {name: "type", type: Type} - ]); - if (e) throw e; - var behaviors = element._behaviors; - var results = []; - if (behaviors) { - for (var i = 0, l = behaviors.length; i < l; i++) { - if (type.isInstanceOfType(behaviors[i])) { - results[results.length] = behaviors[i]; - } - } - } - return results; -} - -Sys.UI.VisibilityMode = function Sys$UI$VisibilityMode() { - /// - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); -} -Sys.UI.VisibilityMode.prototype = { - hide: 0, - collapse: 1 -} -Sys.UI.VisibilityMode.registerEnum("Sys.UI.VisibilityMode"); - -Sys.UI.Control = function Sys$UI$Control(element) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "element", domElement: true} - ]); - if (e) throw e; - if (typeof(element.control) !== 'undefined') throw Error.invalidOperation(Sys.Res.controlAlreadyDefined); - Sys.UI.Control.initializeBase(this); - this._element = element; - element.control = this; - var role = this.get_role(); - if (role) { - element.setAttribute("role", role); - } -} - function Sys$UI$Control$get_element() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._element; - } - function Sys$UI$Control$get_id() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._element) return ''; - return this._element.id; - } - function Sys$UI$Control$set_id(value) { - var e = Function._validateParams(arguments, [{name: "value", type: String}]); - if (e) throw e; - throw Error.invalidOperation(Sys.Res.cantSetId); - } - function Sys$UI$Control$get_parent() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (this._parent) return this._parent; - if (!this._element) return null; - - var parentElement = this._element.parentNode; - while (parentElement) { - if (parentElement.control) { - return parentElement.control; - } - parentElement = parentElement.parentNode; - } - return null; - } - function Sys$UI$Control$set_parent(value) { - var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.Control}]); - if (e) throw e; - if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); - var parents = [this]; - var current = value; - while (current) { - if (Array.contains(parents, current)) throw Error.invalidOperation(Sys.Res.circularParentChain); - parents[parents.length] = current; - current = current.get_parent(); - } - this._parent = value; - } - function Sys$UI$Control$get_role() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return null; - } - function Sys$UI$Control$get_visibilityMode() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); - return Sys.UI.DomElement.getVisibilityMode(this._element); - } - function Sys$UI$Control$set_visibilityMode(value) { - var e = Function._validateParams(arguments, [{name: "value", type: Sys.UI.VisibilityMode}]); - if (e) throw e; - if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); - Sys.UI.DomElement.setVisibilityMode(this._element, value); - } - function Sys$UI$Control$get_visible() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); - return Sys.UI.DomElement.getVisible(this._element); - } - function Sys$UI$Control$set_visible(value) { - var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]); - if (e) throw e; - if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); - Sys.UI.DomElement.setVisible(this._element, value) - } - function Sys$UI$Control$addCssClass(className) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "className", type: String} - ]); - if (e) throw e; - if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); - Sys.UI.DomElement.addCssClass(this._element, className); - } - function Sys$UI$Control$dispose() { - Sys.UI.Control.callBaseMethod(this, 'dispose'); - if (this._element) { - this._element.control = null; - delete this._element; - } - if (this._parent) delete this._parent; - } - function Sys$UI$Control$onBubbleEvent(source, args) { - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "source"}, - {name: "args", type: Sys.EventArgs} - ]); - if (e) throw e; - return false; - } - function Sys$UI$Control$raiseBubbleEvent(source, args) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "source"}, - {name: "args", type: Sys.EventArgs} - ]); - if (e) throw e; - this._raiseBubbleEvent(source, args); - } - function Sys$UI$Control$_raiseBubbleEvent(source, args) { - var currentTarget = this.get_parent(); - while (currentTarget) { - if (currentTarget.onBubbleEvent(source, args)) { - return; - } - currentTarget = currentTarget.get_parent(); - } - } - function Sys$UI$Control$removeCssClass(className) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "className", type: String} - ]); - if (e) throw e; - if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); - Sys.UI.DomElement.removeCssClass(this._element, className); - } - function Sys$UI$Control$toggleCssClass(className) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "className", type: String} - ]); - if (e) throw e; - if (!this._element) throw Error.invalidOperation(Sys.Res.cantBeCalledAfterDispose); - Sys.UI.DomElement.toggleCssClass(this._element, className); - } -Sys.UI.Control.prototype = { - _parent: null, - _visibilityMode: Sys.UI.VisibilityMode.hide, - get_element: Sys$UI$Control$get_element, - get_id: Sys$UI$Control$get_id, - set_id: Sys$UI$Control$set_id, - get_parent: Sys$UI$Control$get_parent, - set_parent: Sys$UI$Control$set_parent, - get_role: Sys$UI$Control$get_role, - get_visibilityMode: Sys$UI$Control$get_visibilityMode, - set_visibilityMode: Sys$UI$Control$set_visibilityMode, - get_visible: Sys$UI$Control$get_visible, - set_visible: Sys$UI$Control$set_visible, - addCssClass: Sys$UI$Control$addCssClass, - dispose: Sys$UI$Control$dispose, - onBubbleEvent: Sys$UI$Control$onBubbleEvent, - raiseBubbleEvent: Sys$UI$Control$raiseBubbleEvent, - _raiseBubbleEvent: Sys$UI$Control$_raiseBubbleEvent, - removeCssClass: Sys$UI$Control$removeCssClass, - toggleCssClass: Sys$UI$Control$toggleCssClass -} -Sys.UI.Control.registerClass('Sys.UI.Control', Sys.Component); -Sys.HistoryEventArgs = function Sys$HistoryEventArgs(state) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "state", type: Object} - ]); - if (e) throw e; - Sys.HistoryEventArgs.initializeBase(this); - this._state = state; -} - function Sys$HistoryEventArgs$get_state() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._state; - } -Sys.HistoryEventArgs.prototype = { - get_state: Sys$HistoryEventArgs$get_state -} -Sys.HistoryEventArgs.registerClass('Sys.HistoryEventArgs', Sys.EventArgs); -Sys.Application._appLoadHandler = null; -Sys.Application._beginRequestHandler = null; -Sys.Application._clientId = null; -Sys.Application._currentEntry = ''; -Sys.Application._endRequestHandler = null; -Sys.Application._history = null; -Sys.Application._enableHistory = false; -Sys.Application._historyEnabledInScriptManager = false; -Sys.Application._historyFrame = null; -Sys.Application._historyInitialized = false; -Sys.Application._historyPointIsNew = false; -Sys.Application._ignoreTimer = false; -Sys.Application._initialState = null; -Sys.Application._state = {}; -Sys.Application._timerCookie = 0; -Sys.Application._timerHandler = null; -Sys.Application._uniqueId = null; -Sys._Application.prototype.get_stateString = function Sys$_Application$get_stateString() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - var hash = null; - - if (Sys.Browser.agent === Sys.Browser.Firefox) { - var href = window.location.href; - var hashIndex = href.indexOf('#'); - if (hashIndex !== -1) { - hash = href.substring(hashIndex + 1); - } - else { - hash = ""; - } - return hash; - } - else { - hash = window.location.hash; - } - - if ((hash.length > 0) && (hash.charAt(0) === '#')) { - hash = hash.substring(1); - } - return hash; -}; -Sys._Application.prototype.get_enableHistory = function Sys$_Application$get_enableHistory() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._enableHistory; -}; -Sys._Application.prototype.set_enableHistory = function Sys$_Application$set_enableHistory(value) { - if (this._initialized && !this._initializing) { - throw Error.invalidOperation(Sys.Res.historyCannotEnableHistory); - } - else if (this._historyEnabledInScriptManager && !value) { - throw Error.invalidOperation(Sys.Res.invalidHistorySettingCombination); - } - this._enableHistory = value; -}; -Sys._Application.prototype.add_navigate = function Sys$_Application$add_navigate(handler) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "handler", type: Function} - ]); - if (e) throw e; - this.get_events().addHandler("navigate", handler); -}; -Sys._Application.prototype.remove_navigate = function Sys$_Application$remove_navigate(handler) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "handler", type: Function} - ]); - if (e) throw e; - this.get_events().removeHandler("navigate", handler); -}; -Sys._Application.prototype.addHistoryPoint = function Sys$_Application$addHistoryPoint(state, title) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "state", type: Object}, - {name: "title", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - if (!this._enableHistory) throw Error.invalidOperation(Sys.Res.historyCannotAddHistoryPointWithHistoryDisabled); - for (var n in state) { - var v = state[n]; - var t = typeof(v); - if ((v !== null) && ((t === 'object') || (t === 'function') || (t === 'undefined'))) { - throw Error.argument('state', Sys.Res.stateMustBeStringDictionary); - } - } - this._ensureHistory(); - var initialState = this._state; - for (var key in state) { - var value = state[key]; - if (value === null) { - if (typeof(initialState[key]) !== 'undefined') { - delete initialState[key]; - } - } - else { - initialState[key] = value; - } - } - var entry = this._serializeState(initialState); - this._historyPointIsNew = true; - this._setState(entry, title); - this._raiseNavigate(); -}; -Sys._Application.prototype.setServerId = function Sys$_Application$setServerId(clientId, uniqueId) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "clientId", type: String}, - {name: "uniqueId", type: String} - ]); - if (e) throw e; - this._clientId = clientId; - this._uniqueId = uniqueId; -}; -Sys._Application.prototype.setServerState = function Sys$_Application$setServerState(value) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "value", type: String} - ]); - if (e) throw e; - this._ensureHistory(); - this._state.__s = value; - this._updateHiddenField(value); -}; -Sys._Application.prototype._deserializeState = function Sys$_Application$_deserializeState(entry) { - var result = {}; - entry = entry || ''; - var serverSeparator = entry.indexOf('&&'); - if ((serverSeparator !== -1) && (serverSeparator + 2 < entry.length)) { - result.__s = entry.substr(serverSeparator + 2); - entry = entry.substr(0, serverSeparator); - } - var tokens = entry.split('&'); - for (var i = 0, l = tokens.length; i < l; i++) { - var token = tokens[i]; - var equal = token.indexOf('='); - if ((equal !== -1) && (equal + 1 < token.length)) { - var name = token.substr(0, equal); - var value = token.substr(equal + 1); - result[name] = decodeURIComponent(value); - } - } - return result; -}; -Sys._Application.prototype._enableHistoryInScriptManager = function Sys$_Application$_enableHistoryInScriptManager() { - this._enableHistory = true; - this._historyEnabledInScriptManager = true; -}; -Sys._Application.prototype._ensureHistory = function Sys$_Application$_ensureHistory() { - if (!this._historyInitialized && this._enableHistory) { - if ((Sys.Browser.agent === Sys.Browser.InternetExplorer) && (Sys.Browser.documentMode < 8)) { - this._historyFrame = document.getElementById('__historyFrame'); - if (!this._historyFrame) throw Error.invalidOperation(Sys.Res.historyMissingFrame); - this._ignoreIFrame = true; - } - this._timerHandler = Function.createDelegate(this, this._onIdle); - this._timerCookie = window.setTimeout(this._timerHandler, 100); - - try { - this._initialState = this._deserializeState(this.get_stateString()); - } catch(e) {} - - this._historyInitialized = true; - } -}; -Sys._Application.prototype._navigate = function Sys$_Application$_navigate(entry) { - this._ensureHistory(); - var state = this._deserializeState(entry); - - if (this._uniqueId) { - var oldServerEntry = this._state.__s || ''; - var newServerEntry = state.__s || ''; - if (newServerEntry !== oldServerEntry) { - this._updateHiddenField(newServerEntry); - __doPostBack(this._uniqueId, newServerEntry); - this._state = state; - return; - } - } - this._setState(entry); - this._state = state; - this._raiseNavigate(); -}; -Sys._Application.prototype._onIdle = function Sys$_Application$_onIdle() { - delete this._timerCookie; - - var entry = this.get_stateString(); - if (entry !== this._currentEntry) { - if (!this._ignoreTimer) { - this._historyPointIsNew = false; - this._navigate(entry); - } - } - else { - this._ignoreTimer = false; - } - this._timerCookie = window.setTimeout(this._timerHandler, 100); -}; -Sys._Application.prototype._onIFrameLoad = function Sys$_Application$_onIFrameLoad(entry) { - this._ensureHistory(); - if (!this._ignoreIFrame) { - this._historyPointIsNew = false; - this._navigate(entry); - } - this._ignoreIFrame = false; -}; -Sys._Application.prototype._onPageRequestManagerBeginRequest = function Sys$_Application$_onPageRequestManagerBeginRequest(sender, args) { - this._ignoreTimer = true; -}; -Sys._Application.prototype._onPageRequestManagerEndRequest = function Sys$_Application$_onPageRequestManagerEndRequest(sender, args) { - var dataItem = args.get_dataItems()[this._clientId]; - var eventTarget = document.getElementById("__EVENTTARGET"); - if (eventTarget && eventTarget.value === this._uniqueId) { - eventTarget.value = ''; - } - if (typeof(dataItem) !== 'undefined') { - this.setServerState(dataItem); - this._historyPointIsNew = true; - } - else { - this._ignoreTimer = false; - } - var entry = this._serializeState(this._state); - if (entry !== this._currentEntry) { - this._ignoreTimer = true; - this._setState(entry); - this._raiseNavigate(); - } -}; -Sys._Application.prototype._raiseNavigate = function Sys$_Application$_raiseNavigate() { - var h = this.get_events().getHandler("navigate"); - var stateClone = {}; - for (var key in this._state) { - if (key !== '__s') { - stateClone[key] = this._state[key]; - } - } - var args = new Sys.HistoryEventArgs(stateClone); - if (h) { - h(this, args); - } - var err; - try { - if ((Sys.Browser.agent === Sys.Browser.Firefox) && window.location.hash && - (!window.frameElement || window.top.location.hash)) { - window.history.go(0); - } - } - catch(err) { - } -}; -Sys._Application.prototype._serializeState = function Sys$_Application$_serializeState(state) { - var serialized = []; - for (var key in state) { - var value = state[key]; - if (key === '__s') { - var serverState = value; - } - else { - if (key.indexOf('=') !== -1) throw Error.argument('state', Sys.Res.stateFieldNameInvalid); - serialized[serialized.length] = key + '=' + encodeURIComponent(value); - } - } - return serialized.join('&') + (serverState ? '&&' + serverState : ''); -}; -Sys._Application.prototype._setState = function Sys$_Application$_setState(entry, title) { - if (this._enableHistory) { - entry = entry || ''; - if (entry !== this._currentEntry) { - if (window.theForm) { - var action = window.theForm.action; - var hashIndex = action.indexOf('#'); - window.theForm.action = ((hashIndex !== -1) ? action.substring(0, hashIndex) : action) + '#' + entry; - } - - if (this._historyFrame && this._historyPointIsNew) { - this._ignoreIFrame = true; - var frameDoc = this._historyFrame.contentWindow.document; - frameDoc.open("javascript:''"); - frameDoc.write("" + (title || document.title) + - "parent.Sys.Application._onIFrameLoad(" + - Sys.Serialization.JavaScriptSerializer.serialize(entry) + - ");"); - frameDoc.close(); - } - this._ignoreTimer = false; - this._currentEntry = entry; - if (this._historyFrame || this._historyPointIsNew) { - var currentHash = this.get_stateString(); - if (entry !== currentHash) { - var loc = document.location; - if (loc.href.length - loc.hash.length + entry.length > 1024) { - throw Error.invalidOperation(Sys.Res.urlMustBeLessThan1024chars); - } - window.location.hash = entry; - this._currentEntry = this.get_stateString(); - if ((typeof(title) !== 'undefined') && (title !== null)) { - document.title = title; - } - } - } - this._historyPointIsNew = false; - } - } -}; -Sys._Application.prototype._updateHiddenField = function Sys$_Application$_updateHiddenField(value) { - if (this._clientId) { - var serverStateField = document.getElementById(this._clientId); - if (serverStateField) { - serverStateField.value = value; - } - } -}; - -if (!window.XMLHttpRequest) { - window.XMLHttpRequest = function window$XMLHttpRequest() { - var progIDs = [ 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP' ]; - for (var i = 0, l = progIDs.length; i < l; i++) { - try { - return new ActiveXObject(progIDs[i]); - } - catch (ex) { - } - } - return null; - } -} -Type.registerNamespace('Sys.Net'); - -Sys.Net.WebRequestExecutor = function Sys$Net$WebRequestExecutor() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - this._webRequest = null; - this._resultObject = null; -} - function Sys$Net$WebRequestExecutor$get_webRequest() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._webRequest; - } - function Sys$Net$WebRequestExecutor$_set_webRequest(value) { - if (this.get_started()) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'set_webRequest')); - } - this._webRequest = value; - } - function Sys$Net$WebRequestExecutor$get_started() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } - function Sys$Net$WebRequestExecutor$get_responseAvailable() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } - function Sys$Net$WebRequestExecutor$get_timedOut() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } - function Sys$Net$WebRequestExecutor$get_aborted() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } - function Sys$Net$WebRequestExecutor$get_responseData() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } - function Sys$Net$WebRequestExecutor$get_statusCode() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } - function Sys$Net$WebRequestExecutor$get_statusText() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } - function Sys$Net$WebRequestExecutor$get_xml() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } - function Sys$Net$WebRequestExecutor$get_object() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._resultObject) { - this._resultObject = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_responseData()); - } - return this._resultObject; - } - function Sys$Net$WebRequestExecutor$executeRequest() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } - function Sys$Net$WebRequestExecutor$abort() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } - function Sys$Net$WebRequestExecutor$getResponseHeader(header) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "header", type: String} - ]); - if (e) throw e; - throw Error.notImplemented(); - } - function Sys$Net$WebRequestExecutor$getAllResponseHeaders() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - throw Error.notImplemented(); - } -Sys.Net.WebRequestExecutor.prototype = { - get_webRequest: Sys$Net$WebRequestExecutor$get_webRequest, - _set_webRequest: Sys$Net$WebRequestExecutor$_set_webRequest, - get_started: Sys$Net$WebRequestExecutor$get_started, - get_responseAvailable: Sys$Net$WebRequestExecutor$get_responseAvailable, - get_timedOut: Sys$Net$WebRequestExecutor$get_timedOut, - get_aborted: Sys$Net$WebRequestExecutor$get_aborted, - get_responseData: Sys$Net$WebRequestExecutor$get_responseData, - get_statusCode: Sys$Net$WebRequestExecutor$get_statusCode, - get_statusText: Sys$Net$WebRequestExecutor$get_statusText, - get_xml: Sys$Net$WebRequestExecutor$get_xml, - get_object: Sys$Net$WebRequestExecutor$get_object, - executeRequest: Sys$Net$WebRequestExecutor$executeRequest, - abort: Sys$Net$WebRequestExecutor$abort, - getResponseHeader: Sys$Net$WebRequestExecutor$getResponseHeader, - getAllResponseHeaders: Sys$Net$WebRequestExecutor$getAllResponseHeaders -} -Sys.Net.WebRequestExecutor.registerClass('Sys.Net.WebRequestExecutor'); - -Sys.Net.XMLDOM = function Sys$Net$XMLDOM(markup) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "markup", type: String} - ]); - if (e) throw e; - if (!window.DOMParser) { - var progIDs = [ 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ]; - for (var i = 0, l = progIDs.length; i < l; i++) { - try { - var xmlDOM = new ActiveXObject(progIDs[i]); - xmlDOM.async = false; - xmlDOM.loadXML(markup); - xmlDOM.setProperty('SelectionLanguage', 'XPath'); - return xmlDOM; - } - catch (ex) { - } - } - } - else { - try { - var domParser = new window.DOMParser(); - return domParser.parseFromString(markup, 'text/xml'); - } - catch (ex) { - } - } - return null; -} -Sys.Net.XMLHttpExecutor = function Sys$Net$XMLHttpExecutor() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - Sys.Net.XMLHttpExecutor.initializeBase(this); - var _this = this; - this._xmlHttpRequest = null; - this._webRequest = null; - this._responseAvailable = false; - this._timedOut = false; - this._timer = null; - this._aborted = false; - this._started = false; - this._onReadyStateChange = (function () { - - if (_this._xmlHttpRequest.readyState === 4 ) { - try { - if (typeof(_this._xmlHttpRequest.status) === "undefined") { - return; - } - } - catch(ex) { - return; - } - - _this._clearTimer(); - _this._responseAvailable = true; - _this._webRequest.completed(Sys.EventArgs.Empty); - if (_this._xmlHttpRequest != null) { - _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod; - _this._xmlHttpRequest = null; - } - } - }); - this._clearTimer = (function() { - if (_this._timer != null) { - window.clearTimeout(_this._timer); - _this._timer = null; - } - }); - this._onTimeout = (function() { - if (!_this._responseAvailable) { - _this._clearTimer(); - _this._timedOut = true; - _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod; - _this._xmlHttpRequest.abort(); - _this._webRequest.completed(Sys.EventArgs.Empty); - _this._xmlHttpRequest = null; - } - }); -} - function Sys$Net$XMLHttpExecutor$get_timedOut() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._timedOut; - } - function Sys$Net$XMLHttpExecutor$get_started() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._started; - } - function Sys$Net$XMLHttpExecutor$get_responseAvailable() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._responseAvailable; - } - function Sys$Net$XMLHttpExecutor$get_aborted() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._aborted; - } - function Sys$Net$XMLHttpExecutor$executeRequest() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - this._webRequest = this.get_webRequest(); - if (this._started) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallOnceStarted, 'executeRequest')); - } - if (this._webRequest === null) { - throw Error.invalidOperation(Sys.Res.nullWebRequest); - } - var body = this._webRequest.get_body(); - var headers = this._webRequest.get_headers(); - this._xmlHttpRequest = new XMLHttpRequest(); - this._xmlHttpRequest.onreadystatechange = this._onReadyStateChange; - var verb = this._webRequest.get_httpVerb(); - this._xmlHttpRequest.open(verb, this._webRequest.getResolvedUrl(), true ); - this._xmlHttpRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - if (headers) { - for (var header in headers) { - var val = headers[header]; - if (typeof(val) !== "function") - this._xmlHttpRequest.setRequestHeader(header, val); - } - } - if (verb.toLowerCase() === "post") { - if ((headers === null) || !headers['Content-Type']) { - this._xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'); - } - if (!body) { - body = ""; - } - } - var timeout = this._webRequest.get_timeout(); - if (timeout > 0) { - this._timer = window.setTimeout(Function.createDelegate(this, this._onTimeout), timeout); - } - this._xmlHttpRequest.send(body); - this._started = true; - } - function Sys$Net$XMLHttpExecutor$getResponseHeader(header) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "header", type: String} - ]); - if (e) throw e; - if (!this._responseAvailable) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getResponseHeader')); - } - if (!this._xmlHttpRequest) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getResponseHeader')); - } - var result; - try { - result = this._xmlHttpRequest.getResponseHeader(header); - } catch (e) { - } - if (!result) result = ""; - return result; - } - function Sys$Net$XMLHttpExecutor$getAllResponseHeaders() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._responseAvailable) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'getAllResponseHeaders')); - } - if (!this._xmlHttpRequest) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'getAllResponseHeaders')); - } - return this._xmlHttpRequest.getAllResponseHeaders(); - } - function Sys$Net$XMLHttpExecutor$get_responseData() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._responseAvailable) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_responseData')); - } - if (!this._xmlHttpRequest) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_responseData')); - } - return this._xmlHttpRequest.responseText; - } - function Sys$Net$XMLHttpExecutor$get_statusCode() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._responseAvailable) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusCode')); - } - if (!this._xmlHttpRequest) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusCode')); - } - var result = 0; - try { - result = this._xmlHttpRequest.status; - } - catch(ex) { - } - return result; - } - function Sys$Net$XMLHttpExecutor$get_statusText() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._responseAvailable) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_statusText')); - } - if (!this._xmlHttpRequest) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_statusText')); - } - return this._xmlHttpRequest.statusText; - } - function Sys$Net$XMLHttpExecutor$get_xml() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._responseAvailable) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallBeforeResponse, 'get_xml')); - } - if (!this._xmlHttpRequest) { - throw Error.invalidOperation(String.format(Sys.Res.cannotCallOutsideHandler, 'get_xml')); - } - var xml = this._xmlHttpRequest.responseXML; - if (!xml || !xml.documentElement) { - xml = Sys.Net.XMLDOM(this._xmlHttpRequest.responseText); - if (!xml || !xml.documentElement) - return null; - } - else if (navigator.userAgent.indexOf('MSIE') !== -1) { - xml.setProperty('SelectionLanguage', 'XPath'); - } - if (xml.documentElement.namespaceURI === "http://www.mozilla.org/newlayout/xml/parsererror.xml" && - xml.documentElement.tagName === "parsererror") { - return null; - } - - if (xml.documentElement.firstChild && xml.documentElement.firstChild.tagName === "parsererror") { - return null; - } - - return xml; - } - function Sys$Net$XMLHttpExecutor$abort() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (!this._started) { - throw Error.invalidOperation(Sys.Res.cannotAbortBeforeStart); - } - if (this._aborted || this._responseAvailable || this._timedOut) - return; - this._aborted = true; - this._clearTimer(); - if (this._xmlHttpRequest && !this._responseAvailable) { - this._xmlHttpRequest.onreadystatechange = Function.emptyMethod; - this._xmlHttpRequest.abort(); - - this._xmlHttpRequest = null; - this._webRequest.completed(Sys.EventArgs.Empty); - } - } -Sys.Net.XMLHttpExecutor.prototype = { - get_timedOut: Sys$Net$XMLHttpExecutor$get_timedOut, - get_started: Sys$Net$XMLHttpExecutor$get_started, - get_responseAvailable: Sys$Net$XMLHttpExecutor$get_responseAvailable, - get_aborted: Sys$Net$XMLHttpExecutor$get_aborted, - executeRequest: Sys$Net$XMLHttpExecutor$executeRequest, - getResponseHeader: Sys$Net$XMLHttpExecutor$getResponseHeader, - getAllResponseHeaders: Sys$Net$XMLHttpExecutor$getAllResponseHeaders, - get_responseData: Sys$Net$XMLHttpExecutor$get_responseData, - get_statusCode: Sys$Net$XMLHttpExecutor$get_statusCode, - get_statusText: Sys$Net$XMLHttpExecutor$get_statusText, - get_xml: Sys$Net$XMLHttpExecutor$get_xml, - abort: Sys$Net$XMLHttpExecutor$abort -} -Sys.Net.XMLHttpExecutor.registerClass('Sys.Net.XMLHttpExecutor', Sys.Net.WebRequestExecutor); - -Sys.Net._WebRequestManager = function Sys$Net$_WebRequestManager() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - this._defaultTimeout = 0; - this._defaultExecutorType = "Sys.Net.XMLHttpExecutor"; -} - function Sys$Net$_WebRequestManager$add_invokingRequest(handler) { - /// - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this._get_eventHandlerList().addHandler("invokingRequest", handler); - } - function Sys$Net$_WebRequestManager$remove_invokingRequest(handler) { - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this._get_eventHandlerList().removeHandler("invokingRequest", handler); - } - function Sys$Net$_WebRequestManager$add_completedRequest(handler) { - /// - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this._get_eventHandlerList().addHandler("completedRequest", handler); - } - function Sys$Net$_WebRequestManager$remove_completedRequest(handler) { - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this._get_eventHandlerList().removeHandler("completedRequest", handler); - } - function Sys$Net$_WebRequestManager$_get_eventHandlerList() { - if (!this._events) { - this._events = new Sys.EventHandlerList(); - } - return this._events; - } - function Sys$Net$_WebRequestManager$get_defaultTimeout() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._defaultTimeout; - } - function Sys$Net$_WebRequestManager$set_defaultTimeout(value) { - var e = Function._validateParams(arguments, [{name: "value", type: Number}]); - if (e) throw e; - if (value < 0) { - throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout); - } - this._defaultTimeout = value; - } - function Sys$Net$_WebRequestManager$get_defaultExecutorType() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._defaultExecutorType; - } - function Sys$Net$_WebRequestManager$set_defaultExecutorType(value) { - var e = Function._validateParams(arguments, [{name: "value", type: String}]); - if (e) throw e; - this._defaultExecutorType = value; - } - function Sys$Net$_WebRequestManager$executeRequest(webRequest) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "webRequest", type: Sys.Net.WebRequest} - ]); - if (e) throw e; - var executor = webRequest.get_executor(); - if (!executor) { - var failed = false; - try { - var executorType = eval(this._defaultExecutorType); - executor = new executorType(); - } catch (e) { - failed = true; - } - if (failed || !Sys.Net.WebRequestExecutor.isInstanceOfType(executor) || !executor) { - throw Error.argument("defaultExecutorType", String.format(Sys.Res.invalidExecutorType, this._defaultExecutorType)); - } - webRequest.set_executor(executor); - } - if (executor.get_aborted()) { - return; - } - var evArgs = new Sys.Net.NetworkRequestEventArgs(webRequest); - var handler = this._get_eventHandlerList().getHandler("invokingRequest"); - if (handler) { - handler(this, evArgs); - } - if (!evArgs.get_cancel()) { - executor.executeRequest(); - } - } -Sys.Net._WebRequestManager.prototype = { - add_invokingRequest: Sys$Net$_WebRequestManager$add_invokingRequest, - remove_invokingRequest: Sys$Net$_WebRequestManager$remove_invokingRequest, - add_completedRequest: Sys$Net$_WebRequestManager$add_completedRequest, - remove_completedRequest: Sys$Net$_WebRequestManager$remove_completedRequest, - _get_eventHandlerList: Sys$Net$_WebRequestManager$_get_eventHandlerList, - get_defaultTimeout: Sys$Net$_WebRequestManager$get_defaultTimeout, - set_defaultTimeout: Sys$Net$_WebRequestManager$set_defaultTimeout, - get_defaultExecutorType: Sys$Net$_WebRequestManager$get_defaultExecutorType, - set_defaultExecutorType: Sys$Net$_WebRequestManager$set_defaultExecutorType, - executeRequest: Sys$Net$_WebRequestManager$executeRequest -} -Sys.Net._WebRequestManager.registerClass('Sys.Net._WebRequestManager'); -Sys.Net.WebRequestManager = new Sys.Net._WebRequestManager(); - -Sys.Net.NetworkRequestEventArgs = function Sys$Net$NetworkRequestEventArgs(webRequest) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "webRequest", type: Sys.Net.WebRequest} - ]); - if (e) throw e; - Sys.Net.NetworkRequestEventArgs.initializeBase(this); - this._webRequest = webRequest; -} - function Sys$Net$NetworkRequestEventArgs$get_webRequest() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._webRequest; - } -Sys.Net.NetworkRequestEventArgs.prototype = { - get_webRequest: Sys$Net$NetworkRequestEventArgs$get_webRequest -} -Sys.Net.NetworkRequestEventArgs.registerClass('Sys.Net.NetworkRequestEventArgs', Sys.CancelEventArgs); - -Sys.Net.WebRequest = function Sys$Net$WebRequest() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - this._url = ""; - this._headers = { }; - this._body = null; - this._userContext = null; - this._httpVerb = null; - this._executor = null; - this._invokeCalled = false; - this._timeout = 0; -} - function Sys$Net$WebRequest$add_completed(handler) { - /// - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this._get_eventHandlerList().addHandler("completed", handler); - } - function Sys$Net$WebRequest$remove_completed(handler) { - var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); - if (e) throw e; - this._get_eventHandlerList().removeHandler("completed", handler); - } - function Sys$Net$WebRequest$completed(eventArgs) { - /// - /// - var e = Function._validateParams(arguments, [ - {name: "eventArgs", type: Sys.EventArgs} - ]); - if (e) throw e; - var handler = Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest"); - if (handler) { - handler(this._executor, eventArgs); - } - handler = this._get_eventHandlerList().getHandler("completed"); - if (handler) { - handler(this._executor, eventArgs); - } - } - function Sys$Net$WebRequest$_get_eventHandlerList() { - if (!this._events) { - this._events = new Sys.EventHandlerList(); - } - return this._events; - } - function Sys$Net$WebRequest$get_url() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._url; - } - function Sys$Net$WebRequest$set_url(value) { - var e = Function._validateParams(arguments, [{name: "value", type: String}]); - if (e) throw e; - this._url = value; - } - function Sys$Net$WebRequest$get_headers() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._headers; - } - function Sys$Net$WebRequest$get_httpVerb() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (this._httpVerb === null) { - if (this._body === null) { - return "GET"; - } - return "POST"; - } - return this._httpVerb; - } - function Sys$Net$WebRequest$set_httpVerb(value) { - var e = Function._validateParams(arguments, [{name: "value", type: String}]); - if (e) throw e; - if (value.length === 0) { - throw Error.argument('value', Sys.Res.invalidHttpVerb); - } - this._httpVerb = value; - } - function Sys$Net$WebRequest$get_body() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._body; - } - function Sys$Net$WebRequest$set_body(value) { - var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]); - if (e) throw e; - this._body = value; - } - function Sys$Net$WebRequest$get_userContext() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._userContext; - } - function Sys$Net$WebRequest$set_userContext(value) { - var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]); - if (e) throw e; - this._userContext = value; - } - function Sys$Net$WebRequest$get_executor() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._executor; - } - function Sys$Net$WebRequest$set_executor(value) { - var e = Function._validateParams(arguments, [{name: "value", type: Sys.Net.WebRequestExecutor}]); - if (e) throw e; - if (this._executor !== null && this._executor.get_started()) { - throw Error.invalidOperation(Sys.Res.setExecutorAfterActive); - } - this._executor = value; - this._executor._set_webRequest(this); - } - function Sys$Net$WebRequest$get_timeout() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (this._timeout === 0) { - return Sys.Net.WebRequestManager.get_defaultTimeout(); - } - return this._timeout; - } - function Sys$Net$WebRequest$set_timeout(value) { - var e = Function._validateParams(arguments, [{name: "value", type: Number}]); - if (e) throw e; - if (value < 0) { - throw Error.argumentOutOfRange("value", value, Sys.Res.invalidTimeout); - } - this._timeout = value; - } - function Sys$Net$WebRequest$getResolvedUrl() { - /// - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return Sys.Net.WebRequest._resolveUrl(this._url); - } - function Sys$Net$WebRequest$invoke() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - if (this._invokeCalled) { - throw Error.invalidOperation(Sys.Res.invokeCalledTwice); - } - Sys.Net.WebRequestManager.executeRequest(this); - this._invokeCalled = true; - } -Sys.Net.WebRequest.prototype = { - add_completed: Sys$Net$WebRequest$add_completed, - remove_completed: Sys$Net$WebRequest$remove_completed, - completed: Sys$Net$WebRequest$completed, - _get_eventHandlerList: Sys$Net$WebRequest$_get_eventHandlerList, - get_url: Sys$Net$WebRequest$get_url, - set_url: Sys$Net$WebRequest$set_url, - get_headers: Sys$Net$WebRequest$get_headers, - get_httpVerb: Sys$Net$WebRequest$get_httpVerb, - set_httpVerb: Sys$Net$WebRequest$set_httpVerb, - get_body: Sys$Net$WebRequest$get_body, - set_body: Sys$Net$WebRequest$set_body, - get_userContext: Sys$Net$WebRequest$get_userContext, - set_userContext: Sys$Net$WebRequest$set_userContext, - get_executor: Sys$Net$WebRequest$get_executor, - set_executor: Sys$Net$WebRequest$set_executor, - get_timeout: Sys$Net$WebRequest$get_timeout, - set_timeout: Sys$Net$WebRequest$set_timeout, - getResolvedUrl: Sys$Net$WebRequest$getResolvedUrl, - invoke: Sys$Net$WebRequest$invoke -} -Sys.Net.WebRequest._resolveUrl = function Sys$Net$WebRequest$_resolveUrl(url, baseUrl) { - if (url && url.indexOf('://') !== -1) { - return url; - } - if (!baseUrl || baseUrl.length === 0) { - var baseElement = document.getElementsByTagName('base')[0]; - if (baseElement && baseElement.href && baseElement.href.length > 0) { - baseUrl = baseElement.href; - } - else { - baseUrl = document.URL; - } - } - var qsStart = baseUrl.indexOf('?'); - if (qsStart !== -1) { - baseUrl = baseUrl.substr(0, qsStart); - } - qsStart = baseUrl.indexOf('#'); - if (qsStart !== -1) { - baseUrl = baseUrl.substr(0, qsStart); - } - baseUrl = baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1); - if (!url || url.length === 0) { - return baseUrl; - } - if (url.charAt(0) === '/') { - var slashslash = baseUrl.indexOf('://'); - if (slashslash === -1) { - throw Error.argument("baseUrl", Sys.Res.badBaseUrl1); - } - var nextSlash = baseUrl.indexOf('/', slashslash + 3); - if (nextSlash === -1) { - throw Error.argument("baseUrl", Sys.Res.badBaseUrl2); - } - return baseUrl.substr(0, nextSlash) + url; - } - else { - var lastSlash = baseUrl.lastIndexOf('/'); - if (lastSlash === -1) { - throw Error.argument("baseUrl", Sys.Res.badBaseUrl3); - } - return baseUrl.substr(0, lastSlash+1) + url; - } -} -Sys.Net.WebRequest._createQueryString = function Sys$Net$WebRequest$_createQueryString(queryString, encodeMethod, addParams) { - encodeMethod = encodeMethod || encodeURIComponent; - var i = 0, obj, val, arg, sb = new Sys.StringBuilder(); - if (queryString) { - for (arg in queryString) { - obj = queryString[arg]; - if (typeof(obj) === "function") continue; - val = Sys.Serialization.JavaScriptSerializer.serialize(obj); - if (i++) { - sb.append('&'); - } - sb.append(arg); - sb.append('='); - sb.append(encodeMethod(val)); - } - } - if (addParams) { - if (i) { - sb.append('&'); - } - sb.append(addParams); - } - return sb.toString(); -} -Sys.Net.WebRequest._createUrl = function Sys$Net$WebRequest$_createUrl(url, queryString, addParams) { - if (!queryString && !addParams) { - return url; - } - var qs = Sys.Net.WebRequest._createQueryString(queryString, null, addParams); - return qs.length - ? url + ((url && url.indexOf('?') >= 0) ? "&" : "?") + qs - : url; -} -Sys.Net.WebRequest.registerClass('Sys.Net.WebRequest'); - -Sys._ScriptLoaderTask = function Sys$_ScriptLoaderTask(scriptElement, completedCallback) { - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "scriptElement", domElement: true}, - {name: "completedCallback", type: Function} - ]); - if (e) throw e; - this._scriptElement = scriptElement; - this._completedCallback = completedCallback; -} - function Sys$_ScriptLoaderTask$get_scriptElement() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._scriptElement; - } - function Sys$_ScriptLoaderTask$dispose() { - if(this._disposed) { - return; - } - this._disposed = true; - this._removeScriptElementHandlers(); - Sys._ScriptLoaderTask._clearScript(this._scriptElement); - this._scriptElement = null; - } - function Sys$_ScriptLoaderTask$execute() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - this._addScriptElementHandlers(); - var headElements = document.getElementsByTagName('head'); - if (headElements.length === 0) { - throw new Error.invalidOperation(Sys.Res.scriptLoadFailedNoHead); - } - else { - headElements[0].appendChild(this._scriptElement); - } - } - function Sys$_ScriptLoaderTask$_addScriptElementHandlers() { - this._scriptLoadDelegate = Function.createDelegate(this, this._scriptLoadHandler); - - if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) { - this._scriptElement.readyState = 'loaded'; - $addHandler(this._scriptElement, 'load', this._scriptLoadDelegate); - } - else { - $addHandler(this._scriptElement, 'readystatechange', this._scriptLoadDelegate); - } - if (this._scriptElement.addEventListener) { - this._scriptErrorDelegate = Function.createDelegate(this, this._scriptErrorHandler); - this._scriptElement.addEventListener('error', this._scriptErrorDelegate, false); - } - } - function Sys$_ScriptLoaderTask$_removeScriptElementHandlers() { - if(this._scriptLoadDelegate) { - var scriptElement = this.get_scriptElement(); - if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) { - $removeHandler(scriptElement, 'load', this._scriptLoadDelegate); - } - else { - $removeHandler(scriptElement, 'readystatechange', this._scriptLoadDelegate); - } - if (this._scriptErrorDelegate) { - this._scriptElement.removeEventListener('error', this._scriptErrorDelegate, false); - this._scriptErrorDelegate = null; - } - this._scriptLoadDelegate = null; - } - } - function Sys$_ScriptLoaderTask$_scriptErrorHandler() { - if(this._disposed) { - return; - } - - this._completedCallback(this.get_scriptElement(), false); - } - function Sys$_ScriptLoaderTask$_scriptLoadHandler() { - if(this._disposed) { - return; - } - var scriptElement = this.get_scriptElement(); - if ((scriptElement.readyState !== 'loaded') && - (scriptElement.readyState !== 'complete')) { - return; - } - - this._completedCallback(scriptElement, true); - } -Sys._ScriptLoaderTask.prototype = { - get_scriptElement: Sys$_ScriptLoaderTask$get_scriptElement, - dispose: Sys$_ScriptLoaderTask$dispose, - execute: Sys$_ScriptLoaderTask$execute, - _addScriptElementHandlers: Sys$_ScriptLoaderTask$_addScriptElementHandlers, - _removeScriptElementHandlers: Sys$_ScriptLoaderTask$_removeScriptElementHandlers, - _scriptErrorHandler: Sys$_ScriptLoaderTask$_scriptErrorHandler, - _scriptLoadHandler: Sys$_ScriptLoaderTask$_scriptLoadHandler -} -Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask", null, Sys.IDisposable); -Sys._ScriptLoaderTask._clearScript = function Sys$_ScriptLoaderTask$_clearScript(scriptElement) { - if (!Sys.Debug.isDebug) { - scriptElement.parentNode.removeChild(scriptElement); - } -} -Type.registerNamespace('Sys.Net'); - -Sys.Net.WebServiceProxy = function Sys$Net$WebServiceProxy() { -} - function Sys$Net$WebServiceProxy$get_timeout() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._timeout || 0; - } - function Sys$Net$WebServiceProxy$set_timeout(value) { - var e = Function._validateParams(arguments, [{name: "value", type: Number}]); - if (e) throw e; - if (value < 0) { throw Error.argumentOutOfRange('value', value, Sys.Res.invalidTimeout); } - this._timeout = value; - } - function Sys$Net$WebServiceProxy$get_defaultUserContext() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return (typeof(this._userContext) === "undefined") ? null : this._userContext; - } - function Sys$Net$WebServiceProxy$set_defaultUserContext(value) { - var e = Function._validateParams(arguments, [{name: "value", mayBeNull: true}]); - if (e) throw e; - this._userContext = value; - } - function Sys$Net$WebServiceProxy$get_defaultSucceededCallback() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._succeeded || null; - } - function Sys$Net$WebServiceProxy$set_defaultSucceededCallback(value) { - var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]); - if (e) throw e; - this._succeeded = value; - } - function Sys$Net$WebServiceProxy$get_defaultFailedCallback() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._failed || null; - } - function Sys$Net$WebServiceProxy$set_defaultFailedCallback(value) { - var e = Function._validateParams(arguments, [{name: "value", type: Function, mayBeNull: true}]); - if (e) throw e; - this._failed = value; - } - function Sys$Net$WebServiceProxy$get_enableJsonp() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return !!this._jsonp; - } - function Sys$Net$WebServiceProxy$set_enableJsonp(value) { - var e = Function._validateParams(arguments, [{name: "value", type: Boolean}]); - if (e) throw e; - this._jsonp = value; - } - function Sys$Net$WebServiceProxy$get_path() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._path || null; - } - function Sys$Net$WebServiceProxy$set_path(value) { - var e = Function._validateParams(arguments, [{name: "value", type: String}]); - if (e) throw e; - this._path = value; - } - function Sys$Net$WebServiceProxy$get_jsonpCallbackParameter() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._callbackParameter || "callback"; - } - function Sys$Net$WebServiceProxy$set_jsonpCallbackParameter(value) { - var e = Function._validateParams(arguments, [{name: "value", type: String}]); - if (e) throw e; - this._callbackParameter = value; - } - function Sys$Net$WebServiceProxy$_invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext) { - /// - /// - /// - /// - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "servicePath", type: String}, - {name: "methodName", type: String}, - {name: "useGet", type: Boolean}, - {name: "params"}, - {name: "onSuccess", type: Function, mayBeNull: true, optional: true}, - {name: "onFailure", type: Function, mayBeNull: true, optional: true}, - {name: "userContext", mayBeNull: true, optional: true} - ]); - if (e) throw e; - onSuccess = onSuccess || this.get_defaultSucceededCallback(); - onFailure = onFailure || this.get_defaultFailedCallback(); - if (userContext === null || typeof userContext === 'undefined') userContext = this.get_defaultUserContext(); - return Sys.Net.WebServiceProxy.invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, this.get_timeout(), this.get_enableJsonp(), this.get_jsonpCallbackParameter()); - } -Sys.Net.WebServiceProxy.prototype = { - get_timeout: Sys$Net$WebServiceProxy$get_timeout, - set_timeout: Sys$Net$WebServiceProxy$set_timeout, - get_defaultUserContext: Sys$Net$WebServiceProxy$get_defaultUserContext, - set_defaultUserContext: Sys$Net$WebServiceProxy$set_defaultUserContext, - get_defaultSucceededCallback: Sys$Net$WebServiceProxy$get_defaultSucceededCallback, - set_defaultSucceededCallback: Sys$Net$WebServiceProxy$set_defaultSucceededCallback, - get_defaultFailedCallback: Sys$Net$WebServiceProxy$get_defaultFailedCallback, - set_defaultFailedCallback: Sys$Net$WebServiceProxy$set_defaultFailedCallback, - get_enableJsonp: Sys$Net$WebServiceProxy$get_enableJsonp, - set_enableJsonp: Sys$Net$WebServiceProxy$set_enableJsonp, - get_path: Sys$Net$WebServiceProxy$get_path, - set_path: Sys$Net$WebServiceProxy$set_path, - get_jsonpCallbackParameter: Sys$Net$WebServiceProxy$get_jsonpCallbackParameter, - set_jsonpCallbackParameter: Sys$Net$WebServiceProxy$set_jsonpCallbackParameter, - _invoke: Sys$Net$WebServiceProxy$_invoke -} -Sys.Net.WebServiceProxy.registerClass('Sys.Net.WebServiceProxy'); -Sys.Net.WebServiceProxy.invoke = function Sys$Net$WebServiceProxy$invoke(servicePath, methodName, useGet, params, onSuccess, onFailure, userContext, timeout, enableJsonp, jsonpCallbackParameter) { - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "servicePath", type: String}, - {name: "methodName", type: String, mayBeNull: true, optional: true}, - {name: "useGet", type: Boolean, optional: true}, - {name: "params", mayBeNull: true, optional: true}, - {name: "onSuccess", type: Function, mayBeNull: true, optional: true}, - {name: "onFailure", type: Function, mayBeNull: true, optional: true}, - {name: "userContext", mayBeNull: true, optional: true}, - {name: "timeout", type: Number, optional: true}, - {name: "enableJsonp", type: Boolean, mayBeNull: true, optional: true}, - {name: "jsonpCallbackParameter", type: String, mayBeNull: true, optional: true} - ]); - if (e) throw e; - var schemeHost = (enableJsonp !== false) ? Sys.Net.WebServiceProxy._xdomain.exec(servicePath) : null, - tempCallback, jsonp = schemeHost && (schemeHost.length === 3) && - ((schemeHost[1] !== location.protocol) || (schemeHost[2] !== location.host)); - useGet = jsonp || useGet; - if (jsonp) { - jsonpCallbackParameter = jsonpCallbackParameter || "callback"; - tempCallback = "_jsonp" + Sys._jsonp++; - } - if (!params) params = {}; - var urlParams = params; - if (!useGet || !urlParams) urlParams = {}; - var script, error, timeoutcookie = null, loader, body = null, - url = Sys.Net.WebRequest._createUrl(methodName - ? (servicePath+"/"+encodeURIComponent(methodName)) - : servicePath, urlParams, jsonp ? (jsonpCallbackParameter + "=Sys." + tempCallback) : null); - if (jsonp) { - script = document.createElement("script"); - script.src = url; - loader = new Sys._ScriptLoaderTask(script, function(script, loaded) { - if (!loaded || tempCallback) { - jsonpComplete({ Message: String.format(Sys.Res.webServiceFailedNoMsg, methodName) }, -1); - } - }); - function jsonpComplete(data, statusCode) { - if (timeoutcookie !== null) { - window.clearTimeout(timeoutcookie); - timeoutcookie = null; - } - loader.dispose(); - delete Sys[tempCallback]; - tempCallback = null; - if ((typeof(statusCode) !== "undefined") && (statusCode !== 200)) { - if (onFailure) { - error = new Sys.Net.WebServiceError(false, - data.Message || String.format(Sys.Res.webServiceFailedNoMsg, methodName), - data.StackTrace || null, - data.ExceptionType || null, - data); - error._statusCode = statusCode; - onFailure(error, userContext, methodName); - } - else { - if (data.StackTrace && data.Message) { - error = data.StackTrace + "-- " + data.Message; - } - else { - error = data.StackTrace || data.Message; - } - error = String.format(error ? Sys.Res.webServiceFailed : Sys.Res.webServiceFailedNoMsg, methodName, error); - throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error)); - } - } - else if (onSuccess) { - onSuccess(data, userContext, methodName); - } - } - Sys[tempCallback] = jsonpComplete; - loader.execute(); - return null; - } - var request = new Sys.Net.WebRequest(); - request.set_url(url); - request.get_headers()['Content-Type'] = 'application/json; charset=utf-8'; - if (!useGet) { - body = Sys.Serialization.JavaScriptSerializer.serialize(params); - if (body === "{}") body = ""; - } - request.set_body(body); - request.add_completed(onComplete); - if (timeout && timeout > 0) request.set_timeout(timeout); - request.invoke(); - - function onComplete(response, eventArgs) { - if (response.get_responseAvailable()) { - var statusCode = response.get_statusCode(); - var result = null; - - try { - var contentType = response.getResponseHeader("Content-Type"); - if (contentType.startsWith("application/json")) { - result = response.get_object(); - } - else if (contentType.startsWith("text/xml")) { - result = response.get_xml(); - } - else { - result = response.get_responseData(); - } - } catch (ex) { - } - var error = response.getResponseHeader("jsonerror"); - var errorObj = (error === "true"); - if (errorObj) { - if (result) { - result = new Sys.Net.WebServiceError(false, result.Message, result.StackTrace, result.ExceptionType, result); - } - } - else if (contentType.startsWith("application/json")) { - result = (!result || (typeof(result.d) === "undefined")) ? result : result.d; - } - if (((statusCode < 200) || (statusCode >= 300)) || errorObj) { - if (onFailure) { - if (!result || !errorObj) { - result = new Sys.Net.WebServiceError(false , String.format(Sys.Res.webServiceFailedNoMsg, methodName)); - } - result._statusCode = statusCode; - onFailure(result, userContext, methodName); - } - else { - if (result && errorObj) { - error = result.get_exceptionType() + "-- " + result.get_message(); - } - else { - error = response.get_responseData(); - } - throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error)); - } - } - else if (onSuccess) { - onSuccess(result, userContext, methodName); - } - } - else { - var msg; - if (response.get_timedOut()) { - msg = String.format(Sys.Res.webServiceTimedOut, methodName); - } - else { - msg = String.format(Sys.Res.webServiceFailedNoMsg, methodName) - } - if (onFailure) { - onFailure(new Sys.Net.WebServiceError(response.get_timedOut(), msg, "", ""), userContext, methodName); - } - else { - throw Sys.Net.WebServiceProxy._createFailedError(methodName, msg); - } - } - } - return request; -} -Sys.Net.WebServiceProxy._createFailedError = function Sys$Net$WebServiceProxy$_createFailedError(methodName, errorMessage) { - var displayMessage = "Sys.Net.WebServiceFailedException: " + errorMessage; - var e = Error.create(displayMessage, { 'name': 'Sys.Net.WebServiceFailedException', 'methodName': methodName }); - e.popStackFrame(); - return e; -} -Sys.Net.WebServiceProxy._defaultFailedCallback = function Sys$Net$WebServiceProxy$_defaultFailedCallback(err, methodName) { - var error = err.get_exceptionType() + "-- " + err.get_message(); - throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error)); -} -Sys.Net.WebServiceProxy._generateTypedConstructor = function Sys$Net$WebServiceProxy$_generateTypedConstructor(type) { - return function(properties) { - if (properties) { - for (var name in properties) { - this[name] = properties[name]; - } - } - this.__type = type; - } -} -Sys._jsonp = 0; -Sys.Net.WebServiceProxy._xdomain = /^\s*([a-zA-Z0-9\+\-\.]+\:)\/\/([^?#\/]+)/; - -Sys.Net.WebServiceError = function Sys$Net$WebServiceError(timedOut, message, stackTrace, exceptionType, errorObject) { - /// - /// - /// - /// - /// - /// - var e = Function._validateParams(arguments, [ - {name: "timedOut", type: Boolean}, - {name: "message", type: String, mayBeNull: true}, - {name: "stackTrace", type: String, mayBeNull: true, optional: true}, - {name: "exceptionType", type: String, mayBeNull: true, optional: true}, - {name: "errorObject", type: Object, mayBeNull: true, optional: true} - ]); - if (e) throw e; - this._timedOut = timedOut; - this._message = message; - this._stackTrace = stackTrace; - this._exceptionType = exceptionType; - this._errorObject = errorObject; - this._statusCode = -1; -} - function Sys$Net$WebServiceError$get_timedOut() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._timedOut; - } - function Sys$Net$WebServiceError$get_statusCode() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._statusCode; - } - function Sys$Net$WebServiceError$get_message() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._message; - } - function Sys$Net$WebServiceError$get_stackTrace() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._stackTrace || ""; - } - function Sys$Net$WebServiceError$get_exceptionType() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._exceptionType || ""; - } - function Sys$Net$WebServiceError$get_errorObject() { - /// - if (arguments.length !== 0) throw Error.parameterCount(); - return this._errorObject || null; - } -Sys.Net.WebServiceError.prototype = { - get_timedOut: Sys$Net$WebServiceError$get_timedOut, - get_statusCode: Sys$Net$WebServiceError$get_statusCode, - get_message: Sys$Net$WebServiceError$get_message, - get_stackTrace: Sys$Net$WebServiceError$get_stackTrace, - get_exceptionType: Sys$Net$WebServiceError$get_exceptionType, - get_errorObject: Sys$Net$WebServiceError$get_errorObject -} -Sys.Net.WebServiceError.registerClass('Sys.Net.WebServiceError'); - - -Type.registerNamespace('Sys'); - -Sys.Res={ -'urlMustBeLessThan1024chars':'The history state must be small enough to not make the url larger than 1024 characters.', -'argumentTypeName':'Value is not the name of an existing type.', -'cantBeCalledAfterDispose':'Can\'t be called after dispose.', -'componentCantSetIdAfterAddedToApp':'The id property of a component can\'t be set after it\'s been added to the Application object.', -'behaviorDuplicateName':'A behavior with name \'{0}\' already exists or it is the name of an existing property on the target element.', -'notATypeName':'Value is not a valid type name.', -'elementNotFound':'An element with id \'{0}\' could not be found.', -'stateMustBeStringDictionary':'The state object can only have null and string fields.', -'boolTrueOrFalse':'Value must be \'true\' or \'false\'.', -'scriptLoadFailedNoHead':'ScriptLoader requires pages to contain a element.', -'stringFormatInvalid':'The format string is invalid.', -'referenceNotFound':'Component \'{0}\' was not found.', -'enumReservedName':'\'{0}\' is a reserved name that can\'t be used as an enum value name.', -'circularParentChain':'The chain of control parents can\'t have circular references.', -'namespaceContainsNonObject':'Object {0} already exists and is not an object.', -'undefinedEvent':'\'{0}\' is not an event.', -'propertyUndefined':'\'{0}\' is not a property or an existing field.', -'observableConflict':'Object already contains a member with the name \'{0}\'.', -'historyCannotEnableHistory':'Cannot set enableHistory after initialization.', -'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.', -'scriptLoadFailedDebug':'The script \'{0}\' failed to load. Check for:\r\n Inaccessible path.\r\n Script errors. (IE) Enable \'Display a notification about every script error\' under advanced settings.', -'propertyNotWritable':'\'{0}\' is not a writable property.', -'enumInvalidValueName':'\'{0}\' is not a valid name for an enum value.', -'controlAlreadyDefined':'A control is already associated with the element.', -'addHandlerCantBeUsedForError':'Can\'t add a handler for the error event using this method. Please set the window.onerror property instead.', -'cantAddNonFunctionhandler':'Can\'t add a handler that is not a function.', -'invalidNameSpace':'Value is not a valid namespace identifier.', -'notAnInterface':'Value is not a valid interface.', -'eventHandlerNotFunction':'Handler must be a function.', -'propertyNotAnArray':'\'{0}\' is not an Array property.', -'namespaceContainsClass':'Object {0} already exists as a class, enum, or interface.', -'typeRegisteredTwice':'Type {0} has already been registered. The type may be defined multiple times or the script file that defines it may have already been loaded. A possible cause is a change of settings during a partial update.', -'cantSetNameAfterInit':'The name property can\'t be set on this object after initialization.', -'historyMissingFrame':'For the history feature to work in IE, the page must have an iFrame element with id \'__historyFrame\' pointed to a page that gets its title from the \'title\' query string parameter and calls Sys.Application._onIFrameLoad() on the parent window. This can be done by setting EnableHistory to true on ScriptManager.', -'appDuplicateComponent':'Two components with the same id \'{0}\' can\'t be added to the application.', -'historyCannotAddHistoryPointWithHistoryDisabled':'A history point can only be added if enableHistory is set to true.', -'baseNotAClass':'Value is not a class.', -'expectedElementOrId':'Value must be a DOM element or DOM element Id.', -'methodNotFound':'No method found with name \'{0}\'.', -'arrayParseBadFormat':'Value must be a valid string representation for an array. It must start with a \'[\' and end with a \']\'.', -'stateFieldNameInvalid':'State field names must not contain any \'=\' characters.', -'cantSetId':'The id property can\'t be set on this object.', -'stringFormatBraceMismatch':'The format string contains an unmatched opening or closing brace.', -'enumValueNotInteger':'An enumeration definition can only contain integer values.', -'propertyNullOrUndefined':'Cannot set the properties of \'{0}\' because it returned a null value.', -'argumentDomNode':'Value must be a DOM element or a text node.', -'componentCantSetIdTwice':'The id property of a component can\'t be set more than once.', -'createComponentOnDom':'Value must be null for Components that are not Controls or Behaviors.', -'createNotComponent':'{0} does not derive from Sys.Component.', -'createNoDom':'Value must not be null for Controls and Behaviors.', -'cantAddWithoutId':'Can\'t add a component that doesn\'t have an id.', -'notObservable':'Instances of type \'{0}\' cannot be observed.', -'badTypeName':'Value is not the name of the type being registered or the name is a reserved word.', -'argumentInteger':'Value must be an integer.', -'invokeCalledTwice':'Cannot call invoke more than once.', -'webServiceFailed':'The server method \'{0}\' failed with the following error: {1}', -'argumentType':'Object cannot be converted to the required type.', -'argumentNull':'Value cannot be null.', -'scriptAlreadyLoaded':'The script \'{0}\' has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode property of the ScriptManager to Explicit.', -'scriptDependencyNotFound':'The script \'{0}\' failed to load because it is dependent on script \'{1}\'.', -'formatBadFormatSpecifier':'Format specifier was invalid.', -'requiredScriptReferenceNotIncluded':'\'{0}\' requires that you have included a script reference to \'{1}\'.', -'webServiceFailedNoMsg':'The server method \'{0}\' failed.', -'argumentDomElement':'Value must be a DOM element.', -'invalidExecutorType':'Could not create a valid Sys.Net.WebRequestExecutor from: {0}.', -'cannotCallBeforeResponse':'Cannot call {0} when responseAvailable is false.', -'actualValue':'Actual value was {0}.', -'enumInvalidValue':'\'{0}\' is not a valid value for enum {1}.', -'scriptLoadFailed':'The script \'{0}\' could not be loaded.', -'parameterCount':'Parameter count mismatch.', -'cannotDeserializeEmptyString':'Cannot deserialize empty string.', -'formatInvalidString':'Input string was not in a correct format.', -'invalidTimeout':'Value must be greater than or equal to zero.', -'cannotAbortBeforeStart':'Cannot abort when executor has not started.', -'argument':'Value does not fall within the expected range.', -'cannotDeserializeInvalidJson':'Cannot deserialize. The data does not correspond to valid JSON.', -'invalidHttpVerb':'httpVerb cannot be set to an empty or null string.', -'nullWebRequest':'Cannot call executeRequest with a null webRequest.', -'eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.', -'cannotSerializeNonFiniteNumbers':'Cannot serialize non finite numbers.', -'argumentUndefined':'Value cannot be undefined.', -'webServiceInvalidReturnType':'The server method \'{0}\' returned an invalid type. Expected type: {1}', -'servicePathNotSet':'The path to the web service has not been set.', -'argumentTypeWithTypes':'Object of type \'{0}\' cannot be converted to type \'{1}\'.', -'cannotCallOnceStarted':'Cannot call {0} once started.', -'badBaseUrl1':'Base URL does not contain ://.', -'badBaseUrl2':'Base URL does not contain another /.', -'badBaseUrl3':'Cannot find last / in base URL.', -'setExecutorAfterActive':'Cannot set executor after it has become active.', -'paramName':'Parameter name: {0}', -'nullReferenceInPath':'Null reference while evaluating data path: \'{0}\'.', -'cannotCallOutsideHandler':'Cannot call {0} outside of a completed event handler.', -'cannotSerializeObjectWithCycle':'Cannot serialize object with cyclic reference within child properties.', -'format':'One of the identified items was in an invalid format.', -'assertFailedCaller':'Assertion Failed: {0}\r\nat {1}', -'argumentOutOfRange':'Specified argument was out of the range of valid values.', -'webServiceTimedOut':'The server method \'{0}\' timed out.', -'notImplemented':'The method or operation is not implemented.', -'assertFailed':'Assertion Failed: {0}', -'invalidOperation':'Operation is not valid due to the current state of the object.', -'breakIntoDebugger':'{0}\r\n\r\nBreak into debugger?' -}; diff --git a/NzbDrone.Web/Scripts2/MicrosoftAjax.js b/NzbDrone.Web/Scripts2/MicrosoftAjax.js deleted file mode 100644 index 52e6626a0..000000000 --- a/NzbDrone.Web/Scripts2/MicrosoftAjax.js +++ /dev/null @@ -1,6 +0,0 @@ -//---------------------------------------------------------- -// Copyright (C) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------- -// MicrosoftAjax.js -Function.__typeName="Function";Function.__class=true;Function.createCallback=function(b,a){return function(){var e=arguments.length;if(e>0){var d=[];for(var c=0;c=d)break;a=Function._validateParameter(g[b],f,h);if(a){a.popStackFrame();return a}}return null};Function._validateParameterCount=function(j,d,i){var a,c,b=d.length,e=j.length;if(eb){c=true;for(a=0;a0&&(d=0};Array.dequeue=function(a){return a.shift()};Array.forEach=function(b,e,d){for(var a=0,f=b.length;a=0)b.splice(a,1);return a>=0};Array.removeAt=function(a,b){a.splice(b,1)};Sys._indexOf=function(d,e,a){if(typeof e==="undefined")return -1;var c=d.length;if(c!==0){a=a-0;if(isNaN(a))a=0;else{if(isFinite(a))a=a-a%1;if(a<0)a=Math.max(0,c+a)}for(var b=a;b-1){Sys.Browser.agent=Sys.Browser.InternetExplorer;Sys.Browser.version=parseFloat(navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1]);if(Sys.Browser.version>=8)if(document.documentMode>=7)Sys.Browser.documentMode=document.documentMode;Sys.Browser.hasDebuggerStatement=true}else if(navigator.userAgent.indexOf(" Firefox/")>-1){Sys.Browser.agent=Sys.Browser.Firefox;Sys.Browser.version=parseFloat(navigator.userAgent.match(/Firefox\/(\d+\.\d+)/)[1]);Sys.Browser.name="Firefox";Sys.Browser.hasDebuggerStatement=true}else if(navigator.userAgent.indexOf(" AppleWebKit/")>-1){Sys.Browser.agent=Sys.Browser.Safari;Sys.Browser.version=parseFloat(navigator.userAgent.match(/AppleWebKit\/(\d+(\.\d+)?)/)[1]);Sys.Browser.name="Safari"}else if(navigator.userAgent.indexOf("Opera/")>-1)Sys.Browser.agent=Sys.Browser.Opera;Sys.EventArgs=function(){};Sys.EventArgs.registerClass("Sys.EventArgs");Sys.EventArgs.Empty=new Sys.EventArgs;Sys.CancelEventArgs=function(){Sys.CancelEventArgs.initializeBase(this);this._cancel=false};Sys.CancelEventArgs.prototype={get_cancel:function(){return this._cancel},set_cancel:function(a){this._cancel=a}};Sys.CancelEventArgs.registerClass("Sys.CancelEventArgs",Sys.EventArgs);Type.registerNamespace("Sys.UI");Sys._Debug=function(){};Sys._Debug.prototype={_appendConsole:function(a){if(typeof Debug!=="undefined"&&Debug.writeln)Debug.writeln(a);if(window.console&&window.console.log)window.console.log(a);if(window.opera)window.opera.postError(a);if(window.debugService)window.debugService.trace(a)},_appendTrace:function(b){var a=document.getElementById("TraceConsole");if(a&&a.tagName.toUpperCase()==="TEXTAREA")a.value+=b+"\n"},assert:function(c,a,b){if(!c){a=b&&this.assert.caller?String.format(Sys.Res.assertFailedCaller,a,this.assert.caller):String.format(Sys.Res.assertFailed,a);if(confirm(String.format(Sys.Res.breakIntoDebugger,a)))this.fail(a)}},clearTrace:function(){var a=document.getElementById("TraceConsole");if(a&&a.tagName.toUpperCase()==="TEXTAREA")a.value=""},fail:function(message){this._appendConsole(message);if(Sys.Browser.hasDebuggerStatement)eval("debugger")},trace:function(a){this._appendConsole(a);this._appendTrace(a)},traceDump:function(a,b){var c=this._traceDump(a,b,true)},_traceDump:function(a,c,f,b,d){c=c?c:"traceDump";b=b?b:"";if(a===null){this.trace(b+c+": null");return}switch(typeof a){case "undefined":this.trace(b+c+": Undefined");break;case "number":case "string":case "boolean":this.trace(b+c+": "+a);break;default:if(Date.isInstanceOfType(a)||RegExp.isInstanceOfType(a)){this.trace(b+c+": "+a.toString());break}if(!d)d=[];else if(Array.contains(d,a)){this.trace(b+c+": ...");return}Array.add(d,a);if(a==window||a===document||window.HTMLElement&&a instanceof HTMLElement||typeof a.nodeName==="string"){var k=a.tagName?a.tagName:"DomElement";if(a.id)k+=" - "+a.id;this.trace(b+c+" {"+k+"}")}else{var i=Object.getTypeName(a);this.trace(b+c+(typeof i==="string"?" {"+i+"}":""));if(b===""||f){b+=" ";var e,j,l,g,h;if(Array.isInstanceOfType(a)){j=a.length;for(e=0;e=0;d--){var k=h[d].trim();b=a[k];if(typeof b!=="number")throw Error.argument("value",String.format(Sys.Res.enumInvalidValue,c.split(",")[d].trim(),this.__typeName));j|=b}return j}}function Sys$Enum$toString(c){if(typeof c==="undefined"||c===null)return this.__string;var d=this.prototype,a;if(!this.__flags||c===0){for(a in d)if(d[a]===c)return a}else{var b=this.__sortedValues;if(!b){b=[];for(a in d)b[b.length]={key:a,value:d[a]};b.sort(function(a,b){return a.value-b.value});this.__sortedValues=b}var e=[],g=c;for(a=b.length-1;a>=0;a--){var h=b[a],f=h.value;if(f===0)continue;if((f&c)===f){e[e.length]=h.key;g-=f;if(g===0)break}}if(e.length&&g===0)return e.reverse().join(", ")}return ""}Type.prototype.registerEnum=function(b,c){Sys.__upperCaseTypes[b.toUpperCase()]=this;for(var a in this.prototype)this[a]=this.prototype[a];this.__typeName=b;this.parse=Sys$Enum$parse;this.__string=this.toString();this.toString=Sys$Enum$toString;this.__flags=c;this.__enum=true};Type.isEnum=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__enum};Type.isFlags=function(a){if(typeof a==="undefined"||a===null)return false;return !!a.__flags};Sys.CollectionChange=function(e,a,c,b,d){this.action=e;if(a)if(!(a instanceof Array))a=[a];this.newItems=a||null;if(typeof c!=="number")c=-1;this.newStartingIndex=c;if(b)if(!(b instanceof Array))b=[b];this.oldItems=b||null;if(typeof d!=="number")d=-1;this.oldStartingIndex=d};Sys.CollectionChange.registerClass("Sys.CollectionChange");Sys.NotifyCollectionChangedAction=function(){throw Error.notImplemented()};Sys.NotifyCollectionChangedAction.prototype={add:0,remove:1,reset:2};Sys.NotifyCollectionChangedAction.registerEnum("Sys.NotifyCollectionChangedAction");Sys.NotifyCollectionChangedEventArgs=function(a){this._changes=a;Sys.NotifyCollectionChangedEventArgs.initializeBase(this)};Sys.NotifyCollectionChangedEventArgs.prototype={get_changes:function(){return this._changes||[]}};Sys.NotifyCollectionChangedEventArgs.registerClass("Sys.NotifyCollectionChangedEventArgs",Sys.EventArgs);Sys.Observer=function(){};Sys.Observer.registerClass("Sys.Observer");Sys.Observer.makeObservable=function(a){var c=a instanceof Array,b=Sys.Observer;if(a.setValue===b._observeMethods.setValue)return a;b._addMethods(a,b._observeMethods);if(c)b._addMethods(a,b._arrayMethods);return a};Sys.Observer._addMethods=function(c,b){for(var a in b)c[a]=b[a]};Sys.Observer._addEventHandler=function(c,a,b){Sys.Observer._getContext(c,true).events._addHandler(a,b)};Sys.Observer.addEventHandler=function(c,a,b){Sys.Observer._addEventHandler(c,a,b)};Sys.Observer._removeEventHandler=function(c,a,b){Sys.Observer._getContext(c,true).events._removeHandler(a,b)};Sys.Observer.removeEventHandler=function(c,a,b){Sys.Observer._removeEventHandler(c,a,b)};Sys.Observer.raiseEvent=function(b,e,d){var c=Sys.Observer._getContext(b);if(!c)return;var a=c.events.getHandler(e);if(a)a(b,d)};Sys.Observer.addPropertyChanged=function(b,a){Sys.Observer._addEventHandler(b,"propertyChanged",a)};Sys.Observer.removePropertyChanged=function(b,a){Sys.Observer._removeEventHandler(b,"propertyChanged",a)};Sys.Observer.beginUpdate=function(a){Sys.Observer._getContext(a,true).updating=true};Sys.Observer.endUpdate=function(b){var a=Sys.Observer._getContext(b);if(!a||!a.updating)return;a.updating=false;var d=a.dirty;a.dirty=false;if(d){if(b instanceof Array){var c=a.changes;a.changes=null;Sys.Observer.raiseCollectionChanged(b,c)}Sys.Observer.raisePropertyChanged(b,"")}};Sys.Observer.isUpdating=function(b){var a=Sys.Observer._getContext(b);return a?a.updating:false};Sys.Observer._setValue=function(a,j,g){var b,f,k=a,d=j.split(".");for(var i=0,m=d.length-1;i-1&&ac.Calendar.TwoDigitYearMax)a-=100}return a};Date._getEra=function(e,c){if(!c)return 0;var b,d=e.getTime();for(var a=0,f=c.length;a=b)return a}return 0};Date._getEraYear=function(d,b,e,c){var a=d.getFullYear();if(!c&&b.eras)a-=b.eras[e+3];return a};Date._getParseRegExp=function(b,e){if(!b._parseRegExp)b._parseRegExp={};else if(b._parseRegExp[e])return b._parseRegExp[e];var c=Date._expandFormat(b,e);c=c.replace(/([\^\$\.\*\+\?\|\[\]\(\)\{\}])/g,"\\\\$1");var a=new Sys.StringBuilder("^"),j=[],f=0,i=0,h=Date._getTokenRegExp(),d;while((d=h.exec(c))!==null){var l=c.slice(f,d.index);f=h.lastIndex;i+=Date._appendPreOrPostMatch(l,a);if(i%2===1){a.append(d[0]);continue}switch(d[0]){case "dddd":case "ddd":case "MMMM":case "MMM":case "gg":case "g":a.append("(\\D+)");break;case "tt":case "t":a.append("(\\D*)");break;case "yyyy":a.append("(\\d{4})");break;case "fff":a.append("(\\d{3})");break;case "ff":a.append("(\\d{2})");break;case "f":a.append("(\\d)");break;case "dd":case "d":case "MM":case "M":case "yy":case "y":case "HH":case "H":case "hh":case "h":case "mm":case "m":case "ss":case "s":a.append("(\\d\\d?)");break;case "zzz":a.append("([+-]?\\d\\d?:\\d{2})");break;case "zz":case "z":a.append("([+-]?\\d\\d?)");break;case "/":a.append("(\\"+b.DateSeparator+")")}Array.add(j,d[0])}Date._appendPreOrPostMatch(c.slice(f),a);a.append("$");var k=a.toString().replace(/\s+/g,"\\s+"),g={"regExp":k,"groups":j};b._parseRegExp[e]=g;return g};Date._getTokenRegExp=function(){return /\/|dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yy|y|hh|h|HH|H|mm|m|ss|s|tt|t|fff|ff|f|zzz|zz|z|gg|g/g};Date.parseLocale=function(a){return Date._parse(a,Sys.CultureInfo.CurrentCulture,arguments)};Date.parseInvariant=function(a){return Date._parse(a,Sys.CultureInfo.InvariantCulture,arguments)};Date._parse=function(h,d,i){var a,c,b,f,e,g=false;for(a=1,c=i.length;a31)return null;break;case "MMMM":c=k._getMonthIndex(a);if(c<0||c>11)return null;break;case "MMM":c=k._getAbbrMonthIndex(a);if(c<0||c>11)return null;break;case "M":case "MM":c=parseInt(a,10)-1;if(c<0||c>11)return null;break;case "y":case "yy":e=Date._expandYear(g,parseInt(a,10));if(e<0||e>9999)return null;break;case "yyyy":e=parseInt(a,10);if(e<0||e>9999)return null;break;case "h":case "hh":d=parseInt(a,10);if(d===12)d=0;if(d<0||d>11)return null;break;case "H":case "HH":d=parseInt(a,10);if(d<0||d>23)return null;break;case "m":case "mm":q=parseInt(a,10);if(q<0||q>59)return null;break;case "s":case "ss":r=parseInt(a,10);if(r<0||r>59)return null;break;case "tt":case "t":var z=a.toUpperCase();v=z===g.PMDesignator.toUpperCase();if(!v&&z!==g.AMDesignator.toUpperCase())return null;break;case "f":f=parseInt(a,10)*100;if(f<0||f>999)return null;break;case "ff":f=parseInt(a,10)*10;if(f<0||f>999)return null;break;case "fff":f=parseInt(a,10);if(f<0||f>999)return null;break;case "dddd":i=k._getDayIndex(a);if(i<0||i>6)return null;break;case "ddd":i=k._getAbbrDayIndex(a);if(i<0||i>6)return null;break;case "zzz":var u=a.split(/:/);if(u.length!==2)return null;h=parseInt(u[0],10);if(h<-12||h>13)return null;var o=parseInt(u[1],10);if(o<0||o>59)return null;n=h*60+(a.startsWith("-")?-o:o);break;case "z":case "zz":h=parseInt(a,10);if(h<-12||h>13)return null;n=h*60;break;case "g":case "gg":var p=a;if(!p||!g.eras)return null;p=p.toLowerCase().trim();for(var s=0,F=g.eras.length;s0)return this.toLocaleString();else return this.toString();var o=["n %","n%","%n"],n=["-n %","-n%","-%n"],p=["(n)","-n","- n","n-","n -"],m=["$n","n$","$ n","n $"],l=["($n)","-$n","$-n","$n-","(n$)","-n$","n-$","n$-","-n $","-$ n","n $-","$ n-","$ -n","n- $","($ n)","(n $)"];function g(a,c,d){for(var b=a.length;b1?parseInt(e[1]):0;e=b.split(".");b=e[0];a=e.length>1?e[1]:"";var q;if(c>0){a=g(a,c,false);b+=a.slice(0,c);a=a.substr(c)}else if(c<0){c=-c;b=g(b,c+1,true);a=b.slice(-c,b.length)+a;b=b.slice(0,-c)}if(i>0){if(a.length>i)a=a.slice(0,i);else a=g(a,i,false);a=p+a}else a="";var d=b.length-1,f="";while(d>=0){if(h===0||h>d)if(f.length>0)return b.slice(0,d+1)+n+f+a;else return b.slice(0,d+1)+a;if(f.length>0)f=b.slice(d-h+1,d+1)+n+f;else f=b.slice(d-h+1,d+1);d-=h;if(k1)b=parseInt(e.slice(1),10);var c;switch(e.charAt(0)){case "d":case "D":c="n";if(b!==-1)d=g(""+d,b,true);if(this<0)d=-d;break;case "c":case "C":if(this<0)c=l[a.CurrencyNegativePattern];else c=m[a.CurrencyPositivePattern];if(b===-1)b=a.CurrencyDecimalDigits;d=i(Math.abs(this),b,a.CurrencyGroupSizes,a.CurrencyGroupSeparator,a.CurrencyDecimalSeparator);break;case "n":case "N":if(this<0)c=p[a.NumberNegativePattern];else c="n";if(b===-1)b=a.NumberDecimalDigits;d=i(Math.abs(this),b,a.NumberGroupSizes,a.NumberGroupSeparator,a.NumberDecimalSeparator);break;case "p":case "P":if(this<0)c=n[a.PercentNegativePattern];else c=o[a.PercentPositivePattern];if(b===-1)b=a.PercentDecimalDigits;d=i(Math.abs(this)*100,b,a.PercentGroupSizes,a.PercentGroupSeparator,a.PercentDecimalSeparator);break;default:throw Error.format(Sys.Res.formatBadFormatSpecifier)}var k=/n|\$|-|%/g,f="";for(;true;){var q=k.lastIndex,h=k.exec(c);f+=c.slice(q,h?h.index:c.length);if(!h)break;switch(h[0]){case "n":f+=d;break;case "$":f+=a.CurrencySymbol;break;case "-":if(/[1-9]/.test(d))f+=a.NegativeSign;break;case "%":f+=a.PercentSymbol}}return f};Sys.CultureInfo=function(c,b,a){this.name=c;this.numberFormat=b;this.dateTimeFormat=a};Sys.CultureInfo.prototype={_getDateTimeFormats:function(){if(!this._dateTimeFormats){var a=this.dateTimeFormat;this._dateTimeFormats=[a.MonthDayPattern,a.YearMonthPattern,a.ShortDatePattern,a.ShortTimePattern,a.LongDatePattern,a.LongTimePattern,a.FullDateTimePattern,a.RFC1123Pattern,a.SortableDateTimePattern,a.UniversalSortableDateTimePattern]}return this._dateTimeFormats},_getIndex:function(c,d,e){var b=this._toUpper(c),a=Array.indexOf(d,b);if(a===-1)a=Array.indexOf(e,b);return a},_getMonthIndex:function(a){if(!this._upperMonths){this._upperMonths=this._toUpperArray(this.dateTimeFormat.MonthNames);this._upperMonthsGenitive=this._toUpperArray(this.dateTimeFormat.MonthGenitiveNames)}return this._getIndex(a,this._upperMonths,this._upperMonthsGenitive)},_getAbbrMonthIndex:function(a){if(!this._upperAbbrMonths){this._upperAbbrMonths=this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);this._upperAbbrMonthsGenitive=this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthGenitiveNames)}return this._getIndex(a,this._upperAbbrMonths,this._upperAbbrMonthsGenitive)},_getDayIndex:function(a){if(!this._upperDays)this._upperDays=this._toUpperArray(this.dateTimeFormat.DayNames);return Array.indexOf(this._upperDays,this._toUpper(a))},_getAbbrDayIndex:function(a){if(!this._upperAbbrDays)this._upperAbbrDays=this._toUpperArray(this.dateTimeFormat.AbbreviatedDayNames);return Array.indexOf(this._upperAbbrDays,this._toUpper(a))},_toUpperArray:function(c){var b=[];for(var a=0,d=c.length;a0)a.append(",");Sys.Serialization.JavaScriptSerializer._serializeWithBuilder(b[c],a,false,g)}a.append("]")}else{if(Date.isInstanceOfType(b)){a.append('"\\/Date(');a.append(b.getTime());a.append(')\\/"');break}var d=[],f=0;for(var e in b){if(e.startsWith("$"))continue;if(e===Sys.Serialization.JavaScriptSerializer._serverTypeFieldName&&f!==0){d[f++]=d[0];d[0]=e}else d[f++]=e}if(i)d.sort();a.append("{");var j=false;for(c=0;c=0;c--){var f=d[c];if(!g||f.autoRemove)$removeHandler(a,b,f.handler)}}a._events=null}};Sys.UI.DomEvent._disposeHandlers=function(){Sys.UI.DomEvent._clearHandlers(this,true);var b=this._chainDispose,a=typeof b;if(a!=="undefined"){this.dispose=b;this._chainDispose=null;if(a==="function")this.dispose()}};var $removeHandler=Sys.UI.DomEvent.removeHandler=function(b,a,c){Sys.UI.DomEvent._removeHandler(b,a,c)};Sys.UI.DomEvent._removeHandler=function(a,e,f){var d=null,c=a._events[e];for(var b=0,g=c.length;b=3){d+=parseInt(b.borderLeftWidth);e+=parseInt(b.borderTopWidth)}}b=Sys.UI.DomElement._getCurrentStyle(c);var h=b?b.position:null;if(!h||h!=="absolute")for(a=c.parentNode;a;a=a.parentNode){f=a.tagName?a.tagName.toUpperCase():null;if(f!=="BODY"&&f!=="HTML"&&(a.scrollLeft||a.scrollTop)){d-=a.scrollLeft||0;e-=a.scrollTop||0}b=Sys.UI.DomElement._getCurrentStyle(a);var i=b?b.position:null;if(i&&i==="absolute")break}return new Sys.UI.Point(d,e)};else Sys.UI.DomElement.getLocation=function(d){if(d.window&&d.window===d||d.nodeType===9)return new Sys.UI.Point(0,0);var e=0,f=0,a,i=null,g=null,b=null;for(a=d;a;i=a,(g=b,a=a.offsetParent)){var c=a.tagName?a.tagName.toUpperCase():null;b=Sys.UI.DomElement._getCurrentStyle(a);if((a.offsetLeft||a.offsetTop)&&!(c==="BODY"&&(!g||g.position!=="absolute"))){e+=a.offsetLeft;f+=a.offsetTop}if(i!==null&&b){if(c!=="TABLE"&&c!=="TD"&&c!=="HTML"){e+=parseInt(b.borderLeftWidth)||0;f+=parseInt(b.borderTopWidth)||0}if(c==="TABLE"&&(b.position==="relative"||b.position==="absolute")){e+=parseInt(b.marginLeft)||0;f+=parseInt(b.marginTop)||0}}}b=Sys.UI.DomElement._getCurrentStyle(d);var h=b?b.position:null;if(!h||h!=="absolute")for(a=d.parentNode;a;a=a.parentNode){c=a.tagName?a.tagName.toUpperCase():null;if(c!=="BODY"&&c!=="HTML"&&(a.scrollLeft||a.scrollTop)){e-=a.scrollLeft||0;f-=a.scrollTop||0;b=Sys.UI.DomElement._getCurrentStyle(a);if(b){e+=parseInt(b.borderLeftWidth)||0;f+=parseInt(b.borderTopWidth)||0}}}return new Sys.UI.Point(e,f)};Sys.UI.DomElement.isDomElement=function(a){return Sys._isDomElement(a)};Sys.UI.DomElement.removeCssClass=function(d,c){var a=" "+d.className+" ",b=a.indexOf(" "+c+" ");if(b>=0)d.className=(a.substr(0,b)+" "+a.substring(b+c.length+1,a.length)).trim()};Sys.UI.DomElement.resolveElement=function(b,c){var a=b;if(!a)return null;if(typeof a==="string")a=Sys.UI.DomElement.getElementById(a,c);return a};Sys.UI.DomElement.raiseBubbleEvent=function(c,d){var b=c;while(b){var a=b.control;if(a&&a.onBubbleEvent&&a.raiseBubbleEvent){Sys.UI.DomElement._raiseBubbleEventFromControl(a,c,d);return}b=b.parentNode}};Sys.UI.DomElement._raiseBubbleEventFromControl=function(a,b,c){if(!a.onBubbleEvent(b,c))a._raiseBubbleEvent(b,c)};Sys.UI.DomElement.setLocation=function(b,c,d){var a=b.style;a.position="absolute";a.left=c+"px";a.top=d+"px"};Sys.UI.DomElement.toggleCssClass=function(b,a){if(Sys.UI.DomElement.containsCssClass(b,a))Sys.UI.DomElement.removeCssClass(b,a);else Sys.UI.DomElement.addCssClass(b,a)};Sys.UI.DomElement.getVisibilityMode=function(a){return a._visibilityMode===Sys.UI.VisibilityMode.hide?Sys.UI.VisibilityMode.hide:Sys.UI.VisibilityMode.collapse};Sys.UI.DomElement.setVisibilityMode=function(a,b){Sys.UI.DomElement._ensureOldDisplayMode(a);if(a._visibilityMode!==b){a._visibilityMode=b;if(Sys.UI.DomElement.getVisible(a)===false)if(a._visibilityMode===Sys.UI.VisibilityMode.hide)a.style.display=a._oldDisplayMode;else a.style.display="none";a._visibilityMode=b}};Sys.UI.DomElement.getVisible=function(b){var a=b.currentStyle||Sys.UI.DomElement._getCurrentStyle(b);if(!a)return true;return a.visibility!=="hidden"&&a.display!=="none"};Sys.UI.DomElement.setVisible=function(a,b){if(b!==Sys.UI.DomElement.getVisible(a)){Sys.UI.DomElement._ensureOldDisplayMode(a);a.style.visibility=b?"visible":"hidden";if(b||a._visibilityMode===Sys.UI.VisibilityMode.hide)a.style.display=a._oldDisplayMode;else a.style.display="none"}};Sys.UI.DomElement._ensureOldDisplayMode=function(a){if(!a._oldDisplayMode){var b=a.currentStyle||Sys.UI.DomElement._getCurrentStyle(a);a._oldDisplayMode=b?b.display:null;if(!a._oldDisplayMode||a._oldDisplayMode==="none")switch(a.tagName.toUpperCase()){case "DIV":case "P":case "ADDRESS":case "BLOCKQUOTE":case "BODY":case "COL":case "COLGROUP":case "DD":case "DL":case "DT":case "FIELDSET":case "FORM":case "H1":case "H2":case "H3":case "H4":case "H5":case "H6":case "HR":case "IFRAME":case "LEGEND":case "OL":case "PRE":case "TABLE":case "TD":case "TH":case "TR":case "UL":a._oldDisplayMode="block";break;case "LI":a._oldDisplayMode="list-item";break;default:a._oldDisplayMode="inline"}}};Sys.UI.DomElement._getWindow=function(a){var b=a.ownerDocument||a.document||a;return b.defaultView||b.parentWindow};Sys.UI.DomElement._getCurrentStyle=function(a){if(a.nodeType===3)return null;var c=Sys.UI.DomElement._getWindow(a);if(a.documentElement)a=a.documentElement;var b=c&&a!==c&&c.getComputedStyle?c.getComputedStyle(a,null):a.currentStyle||a.style;if(!b&&Sys.Browser.agent===Sys.Browser.Safari&&a.style){var g=a.style.display,f=a.style.position;a.style.position="absolute";a.style.display="block";var e=c.getComputedStyle(a,null);a.style.display=g;a.style.position=f;b={};for(var d in e)b[d]=e[d];b.display="none"}return b};Sys.IContainer=function(){};Sys.IContainer.prototype={};Sys.IContainer.registerInterface("Sys.IContainer");Sys.ApplicationLoadEventArgs=function(b,a){Sys.ApplicationLoadEventArgs.initializeBase(this);this._components=b;this._isPartialLoad=a};Sys.ApplicationLoadEventArgs.prototype={get_components:function(){return this._components},get_isPartialLoad:function(){return this._isPartialLoad}};Sys.ApplicationLoadEventArgs.registerClass("Sys.ApplicationLoadEventArgs",Sys.EventArgs);Sys._Application=function(){Sys._Application.initializeBase(this);this._disposableObjects=[];this._components={};this._createdComponents=[];this._secondPassComponents=[];this._unloadHandlerDelegate=Function.createDelegate(this,this._unloadHandler);Sys.UI.DomEvent.addHandler(window,"unload",this._unloadHandlerDelegate);this._domReady()};Sys._Application.prototype={_creatingComponents:false,_disposing:false,_deleteCount:0,get_isCreatingComponents:function(){return this._creatingComponents},get_isDisposing:function(){return this._disposing},add_init:function(a){if(this._initialized)a(this,Sys.EventArgs.Empty);else this.get_events().addHandler("init",a)},remove_init:function(a){this.get_events().removeHandler("init",a)},add_load:function(a){this.get_events().addHandler("load",a)},remove_load:function(a){this.get_events().removeHandler("load",a)},add_unload:function(a){this.get_events().addHandler("unload",a)},remove_unload:function(a){this.get_events().removeHandler("unload",a)},addComponent:function(a){this._components[a.get_id()]=a},beginCreateComponents:function(){this._creatingComponents=true},dispose:function(){if(!this._disposing){this._disposing=true;if(this._timerCookie){window.clearTimeout(this._timerCookie);delete this._timerCookie}if(this._endRequestHandler){Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(this._endRequestHandler);delete this._endRequestHandler}if(this._beginRequestHandler){Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(this._beginRequestHandler);delete this._beginRequestHandler}if(window.pageUnload)window.pageUnload(this,Sys.EventArgs.Empty);var c=this.get_events().getHandler("unload");if(c)c(this,Sys.EventArgs.Empty);var b=Array.clone(this._disposableObjects);for(var a=0,f=b.length;a=0;b--)this._disposeElementInternal(c[b]);if(!d)this._disposeElementInternal(a)}},endCreateComponents:function(){var b=this._secondPassComponents;for(var a=0,d=b.length;a1000){var c=[];for(var d=0,f=b.length;d=0;b--){var c=a[b];if(typeof c.dispose==="function")c.dispose()}},_disposeElementInternal:function(a){var d=a.dispose;if(d&&typeof d==="function")a.dispose();else{var c=a.control;if(c&&typeof c.dispose==="function")c.dispose()}var b=a._behaviors;if(b)this._disposeComponents(b);b=a._components;if(b){this._disposeComponents(b);a._components=null}},_domReady:function(){var a,g,f=this;function b(){f.initialize()}var c=function(){Sys.UI.DomEvent.removeHandler(window,"load",c);b()};Sys.UI.DomEvent.addHandler(window,"load",c);if(document.addEventListener)try{document.addEventListener("DOMContentLoaded",a=function(){document.removeEventListener("DOMContentLoaded",a,false);b()},false)}catch(h){}else if(document.attachEvent)if(window==window.top&&document.documentElement.doScroll){var e,d=document.createElement("div");a=function(){try{d.doScroll("left")}catch(c){e=window.setTimeout(a,0);return}d=null;b()};a()}else document.attachEvent("onreadystatechange",a=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",a);b()}})},_raiseInit:function(){var a=this.get_events().getHandler("init");if(a){this.beginCreateComponents();a(this,Sys.EventArgs.Empty);this.endCreateComponents()}},_unloadHandler:function(){this.dispose()}};Sys._Application.registerClass("Sys._Application",Sys.Component,Sys.IContainer);Sys.Application=new Sys._Application;var $find=Sys.Application.findComponent;Sys.UI.Behavior=function(b){Sys.UI.Behavior.initializeBase(this);this._element=b;var a=b._behaviors;if(!a)b._behaviors=[this];else a[a.length]=this};Sys.UI.Behavior.prototype={_name:null,get_element:function(){return this._element},get_id:function(){var a=Sys.UI.Behavior.callBaseMethod(this,"get_id");if(a)return a;if(!this._element||!this._element.id)return "";return this._element.id+"$"+this.get_name()},get_name:function(){if(this._name)return this._name;var a=Object.getTypeName(this),b=a.lastIndexOf(".");if(b!==-1)a=a.substr(b+1);if(!this.get_isInitialized())this._name=a;return a},set_name:function(a){this._name=a},initialize:function(){Sys.UI.Behavior.callBaseMethod(this,"initialize");var a=this.get_name();if(a)this._element[a]=this},dispose:function(){Sys.UI.Behavior.callBaseMethod(this,"dispose");var a=this._element;if(a){var c=this.get_name();if(c)a[c]=null;var b=a._behaviors;Array.remove(b,this);if(b.length===0)a._behaviors=null;delete this._element}}};Sys.UI.Behavior.registerClass("Sys.UI.Behavior",Sys.Component);Sys.UI.Behavior.getBehaviorByName=function(b,c){var a=b[c];return a&&Sys.UI.Behavior.isInstanceOfType(a)?a:null};Sys.UI.Behavior.getBehaviors=function(a){if(!a._behaviors)return [];return Array.clone(a._behaviors)};Sys.UI.Behavior.getBehaviorsByType=function(d,e){var a=d._behaviors,c=[];if(a)for(var b=0,f=a.length;b0&&a.charAt(0)==="#")a=a.substring(1);return a};Sys._Application.prototype.get_enableHistory=function(){return this._enableHistory};Sys._Application.prototype.set_enableHistory=function(a){this._enableHistory=a};Sys._Application.prototype.add_navigate=function(a){this.get_events().addHandler("navigate",a)};Sys._Application.prototype.remove_navigate=function(a){this.get_events().removeHandler("navigate",a)};Sys._Application.prototype.addHistoryPoint=function(c,f){this._ensureHistory();var b=this._state;for(var a in c){var d=c[a];if(d===null){if(typeof b[a]!=="undefined")delete b[a]}else b[a]=d}var e=this._serializeState(b);this._historyPointIsNew=true;this._setState(e,f);this._raiseNavigate()};Sys._Application.prototype.setServerId=function(a,b){this._clientId=a;this._uniqueId=b};Sys._Application.prototype.setServerState=function(a){this._ensureHistory();this._state.__s=a;this._updateHiddenField(a)};Sys._Application.prototype._deserializeState=function(a){var e={};a=a||"";var b=a.indexOf("&&");if(b!==-1&&b+2'");c.write(""+(b||document.title)+"parent.Sys.Application._onIFrameLoad('+Sys.Serialization.JavaScriptSerializer.serialize(a)+");");c.close()}this._ignoreTimer=false;this._currentEntry=a;if(this._historyFrame||this._historyPointIsNew){var f=this.get_stateString();if(a!==f){window.location.hash=a;this._currentEntry=this.get_stateString();if(typeof b!=="undefined"&&b!==null)document.title=b}}this._historyPointIsNew=false}}};Sys._Application.prototype._updateHiddenField=function(b){if(this._clientId){var a=document.getElementById(this._clientId);if(a)a.value=b}};if(!window.XMLHttpRequest)window.XMLHttpRequest=function(){var b=["Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP"];for(var a=0,c=b.length;a0)this._timer=window.setTimeout(Function.createDelegate(this,this._onTimeout),d);this._xmlHttpRequest.send(c);this._started=true},getResponseHeader:function(b){var a;try{a=this._xmlHttpRequest.getResponseHeader(b)}catch(c){}if(!a)a="";return a},getAllResponseHeaders:function(){return this._xmlHttpRequest.getAllResponseHeaders()},get_responseData:function(){return this._xmlHttpRequest.responseText},get_statusCode:function(){var a=0;try{a=this._xmlHttpRequest.status}catch(b){}return a},get_statusText:function(){return this._xmlHttpRequest.statusText},get_xml:function(){var a=this._xmlHttpRequest.responseXML;if(!a||!a.documentElement){a=Sys.Net.XMLDOM(this._xmlHttpRequest.responseText);if(!a||!a.documentElement)return null}else if(navigator.userAgent.indexOf("MSIE")!==-1)a.setProperty("SelectionLanguage","XPath");if(a.documentElement.namespaceURI==="http://www.mozilla.org/newlayout/xml/parsererror.xml"&&a.documentElement.tagName==="parsererror")return null;if(a.documentElement.firstChild&&a.documentElement.firstChild.tagName==="parsererror")return null;return a},abort:function(){if(this._aborted||this._responseAvailable||this._timedOut)return;this._aborted=true;this._clearTimer();if(this._xmlHttpRequest&&!this._responseAvailable){this._xmlHttpRequest.onreadystatechange=Function.emptyMethod;this._xmlHttpRequest.abort();this._xmlHttpRequest=null;this._webRequest.completed(Sys.EventArgs.Empty)}}};Sys.Net.XMLHttpExecutor.registerClass("Sys.Net.XMLHttpExecutor",Sys.Net.WebRequestExecutor);Sys.Net._WebRequestManager=function(){this._defaultTimeout=0;this._defaultExecutorType="Sys.Net.XMLHttpExecutor"};Sys.Net._WebRequestManager.prototype={add_invokingRequest:function(a){this._get_eventHandlerList().addHandler("invokingRequest",a)},remove_invokingRequest:function(a){this._get_eventHandlerList().removeHandler("invokingRequest",a)},add_completedRequest:function(a){this._get_eventHandlerList().addHandler("completedRequest",a)},remove_completedRequest:function(a){this._get_eventHandlerList().removeHandler("completedRequest",a)},_get_eventHandlerList:function(){if(!this._events)this._events=new Sys.EventHandlerList;return this._events},get_defaultTimeout:function(){return this._defaultTimeout},set_defaultTimeout:function(a){this._defaultTimeout=a},get_defaultExecutorType:function(){return this._defaultExecutorType},set_defaultExecutorType:function(a){this._defaultExecutorType=a},executeRequest:function(webRequest){var executor=webRequest.get_executor();if(!executor){var failed=false;try{var executorType=eval(this._defaultExecutorType);executor=new executorType}catch(a){failed=true}webRequest.set_executor(executor)}if(executor.get_aborted())return;var evArgs=new Sys.Net.NetworkRequestEventArgs(webRequest),handler=this._get_eventHandlerList().getHandler("invokingRequest");if(handler)handler(this,evArgs);if(!evArgs.get_cancel())executor.executeRequest()}};Sys.Net._WebRequestManager.registerClass("Sys.Net._WebRequestManager");Sys.Net.WebRequestManager=new Sys.Net._WebRequestManager;Sys.Net.NetworkRequestEventArgs=function(a){Sys.Net.NetworkRequestEventArgs.initializeBase(this);this._webRequest=a};Sys.Net.NetworkRequestEventArgs.prototype={get_webRequest:function(){return this._webRequest}};Sys.Net.NetworkRequestEventArgs.registerClass("Sys.Net.NetworkRequestEventArgs",Sys.CancelEventArgs);Sys.Net.WebRequest=function(){this._url="";this._headers={};this._body=null;this._userContext=null;this._httpVerb=null;this._executor=null;this._invokeCalled=false;this._timeout=0};Sys.Net.WebRequest.prototype={add_completed:function(a){this._get_eventHandlerList().addHandler("completed",a)},remove_completed:function(a){this._get_eventHandlerList().removeHandler("completed",a)},completed:function(b){var a=Sys.Net.WebRequestManager._get_eventHandlerList().getHandler("completedRequest");if(a)a(this._executor,b);a=this._get_eventHandlerList().getHandler("completed");if(a)a(this._executor,b)},_get_eventHandlerList:function(){if(!this._events)this._events=new Sys.EventHandlerList;return this._events},get_url:function(){return this._url},set_url:function(a){this._url=a},get_headers:function(){return this._headers},get_httpVerb:function(){if(this._httpVerb===null){if(this._body===null)return "GET";return "POST"}return this._httpVerb},set_httpVerb:function(a){this._httpVerb=a},get_body:function(){return this._body},set_body:function(a){this._body=a},get_userContext:function(){return this._userContext},set_userContext:function(a){this._userContext=a},get_executor:function(){return this._executor},set_executor:function(a){this._executor=a;this._executor._set_webRequest(this)},get_timeout:function(){if(this._timeout===0)return Sys.Net.WebRequestManager.get_defaultTimeout();return this._timeout},set_timeout:function(a){this._timeout=a},getResolvedUrl:function(){return Sys.Net.WebRequest._resolveUrl(this._url)},invoke:function(){Sys.Net.WebRequestManager.executeRequest(this);this._invokeCalled=true}};Sys.Net.WebRequest._resolveUrl=function(b,a){if(b&&b.indexOf("://")!==-1)return b;if(!a||a.length===0){var d=document.getElementsByTagName("base")[0];if(d&&d.href&&d.href.length>0)a=d.href;else a=document.URL}var c=a.indexOf("?");if(c!==-1)a=a.substr(0,c);c=a.indexOf("#");if(c!==-1)a=a.substr(0,c);a=a.substr(0,a.lastIndexOf("/")+1);if(!b||b.length===0)return a;if(b.charAt(0)==="/"){var e=a.indexOf("://"),g=a.indexOf("/",e+3);return a.substr(0,g)+b}else{var f=a.lastIndexOf("/");return a.substr(0,f+1)+b}};Sys.Net.WebRequest._createQueryString=function(c,b,f){b=b||encodeURIComponent;var h=0,e,g,d,a=new Sys.StringBuilder;if(c)for(d in c){e=c[d];if(typeof e==="function")continue;g=Sys.Serialization.JavaScriptSerializer.serialize(e);if(h++)a.append("&");a.append(d);a.append("=");a.append(b(g))}if(f){if(h)a.append("&");a.append(f)}return a.toString()};Sys.Net.WebRequest._createUrl=function(a,b,c){if(!b&&!c)return a;var d=Sys.Net.WebRequest._createQueryString(b,null,c);return d.length?a+(a&&a.indexOf("?")>=0?"&":"?")+d:a};Sys.Net.WebRequest.registerClass("Sys.Net.WebRequest");Sys._ScriptLoaderTask=function(b,a){this._scriptElement=b;this._completedCallback=a};Sys._ScriptLoaderTask.prototype={get_scriptElement:function(){return this._scriptElement},dispose:function(){if(this._disposed)return;this._disposed=true;this._removeScriptElementHandlers();Sys._ScriptLoaderTask._clearScript(this._scriptElement);this._scriptElement=null},execute:function(){this._addScriptElementHandlers();document.getElementsByTagName("head")[0].appendChild(this._scriptElement)},_addScriptElementHandlers:function(){this._scriptLoadDelegate=Function.createDelegate(this,this._scriptLoadHandler);if(Sys.Browser.agent!==Sys.Browser.InternetExplorer){this._scriptElement.readyState="loaded";$addHandler(this._scriptElement,"load",this._scriptLoadDelegate)}else $addHandler(this._scriptElement,"readystatechange",this._scriptLoadDelegate);if(this._scriptElement.addEventListener){this._scriptErrorDelegate=Function.createDelegate(this,this._scriptErrorHandler);this._scriptElement.addEventListener("error",this._scriptErrorDelegate,false)}},_removeScriptElementHandlers:function(){if(this._scriptLoadDelegate){var a=this.get_scriptElement();if(Sys.Browser.agent!==Sys.Browser.InternetExplorer)$removeHandler(a,"load",this._scriptLoadDelegate);else $removeHandler(a,"readystatechange",this._scriptLoadDelegate);if(this._scriptErrorDelegate){this._scriptElement.removeEventListener("error",this._scriptErrorDelegate,false);this._scriptErrorDelegate=null}this._scriptLoadDelegate=null}},_scriptErrorHandler:function(){if(this._disposed)return;this._completedCallback(this.get_scriptElement(),false)},_scriptLoadHandler:function(){if(this._disposed)return;var a=this.get_scriptElement();if(a.readyState!=="loaded"&&a.readyState!=="complete")return;this._completedCallback(a,true)}};Sys._ScriptLoaderTask.registerClass("Sys._ScriptLoaderTask",null,Sys.IDisposable);Sys._ScriptLoaderTask._clearScript=function(a){if(!Sys.Debug.isDebug)a.parentNode.removeChild(a)};Type.registerNamespace("Sys.Net");Sys.Net.WebServiceProxy=function(){};Sys.Net.WebServiceProxy.prototype={get_timeout:function(){return this._timeout||0},set_timeout:function(a){if(a<0)throw Error.argumentOutOfRange("value",a,Sys.Res.invalidTimeout);this._timeout=a},get_defaultUserContext:function(){return typeof this._userContext==="undefined"?null:this._userContext},set_defaultUserContext:function(a){this._userContext=a},get_defaultSucceededCallback:function(){return this._succeeded||null},set_defaultSucceededCallback:function(a){this._succeeded=a},get_defaultFailedCallback:function(){return this._failed||null},set_defaultFailedCallback:function(a){this._failed=a},get_enableJsonp:function(){return !!this._jsonp},set_enableJsonp:function(a){this._jsonp=a},get_path:function(){return this._path||null},set_path:function(a){this._path=a},get_jsonpCallbackParameter:function(){return this._callbackParameter||"callback"},set_jsonpCallbackParameter:function(a){this._callbackParameter=a},_invoke:function(d,e,g,f,c,b,a){c=c||this.get_defaultSucceededCallback();b=b||this.get_defaultFailedCallback();if(a===null||typeof a==="undefined")a=this.get_defaultUserContext();return Sys.Net.WebServiceProxy.invoke(d,e,g,f,c,b,a,this.get_timeout(),this.get_enableJsonp(),this.get_jsonpCallbackParameter())}};Sys.Net.WebServiceProxy.registerClass("Sys.Net.WebServiceProxy");Sys.Net.WebServiceProxy.invoke=function(q,a,m,l,j,b,g,e,w,p){var i=w!==false?Sys.Net.WebServiceProxy._xdomain.exec(q):null,c,n=i&&i.length===3&&(i[1]!==location.protocol||i[2]!==location.host);m=n||m;if(n){p=p||"callback";c="_jsonp"+Sys._jsonp++}if(!l)l={};var r=l;if(!m||!r)r={};var s,h,f=null,k,o=null,u=Sys.Net.WebRequest._createUrl(a?q+"/"+encodeURIComponent(a):q,r,n?p+"=Sys."+c:null);if(n){s=document.createElement("script");s.src=u;k=new Sys._ScriptLoaderTask(s,function(d,b){if(!b||c)t({Message:String.format(Sys.Res.webServiceFailedNoMsg,a)},-1)});function v(){if(f===null)return;f=null;h=new Sys.Net.WebServiceError(true,String.format(Sys.Res.webServiceTimedOut,a));k.dispose();delete Sys[c];if(b)b(h,g,a)}function t(d,e){if(f!==null){window.clearTimeout(f);f=null}k.dispose();delete Sys[c];c=null;if(typeof e!=="undefined"&&e!==200){if(b){h=new Sys.Net.WebServiceError(false,d.Message||String.format(Sys.Res.webServiceFailedNoMsg,a),d.StackTrace||null,d.ExceptionType||null,d);h._statusCode=e;b(h,g,a)}}else if(j)j(d,g,a)}Sys[c]=t;e=e||Sys.Net.WebRequestManager.get_defaultTimeout();if(e>0)f=window.setTimeout(v,e);k.execute();return null}var d=new Sys.Net.WebRequest;d.set_url(u);d.get_headers()["Content-Type"]="application/json; charset=utf-8";if(!m){o=Sys.Serialization.JavaScriptSerializer.serialize(l);if(o==="{}")o=""}d.set_body(o);d.add_completed(x);if(e&&e>0)d.set_timeout(e);d.invoke();function x(d){if(d.get_responseAvailable()){var f=d.get_statusCode(),c=null;try{var e=d.getResponseHeader("Content-Type");if(e.startsWith("application/json"))c=d.get_object();else if(e.startsWith("text/xml"))c=d.get_xml();else c=d.get_responseData()}catch(m){}var k=d.getResponseHeader("jsonerror"),h=k==="true";if(h){if(c)c=new Sys.Net.WebServiceError(false,c.Message,c.StackTrace,c.ExceptionType,c)}else if(e.startsWith("application/json"))c=!c||typeof c.d==="undefined"?c:c.d;if(f<200||f>=300||h){if(b){if(!c||!h)c=new Sys.Net.WebServiceError(false,String.format(Sys.Res.webServiceFailedNoMsg,a));c._statusCode=f;b(c,g,a)}}else if(j)j(c,g,a)}else{var i;if(d.get_timedOut())i=String.format(Sys.Res.webServiceTimedOut,a);else i=String.format(Sys.Res.webServiceFailedNoMsg,a);if(b)b(new Sys.Net.WebServiceError(d.get_timedOut(),i,"",""),g,a)}}return d};Sys.Net.WebServiceProxy._generateTypedConstructor=function(a){return function(b){if(b)for(var c in b)this[c]=b[c];this.__type=a}};Sys._jsonp=0;Sys.Net.WebServiceProxy._xdomain=/^\s*([a-zA-Z0-9\+\-\.]+\:)\/\/([^?#\/]+)/;Sys.Net.WebServiceError=function(d,e,c,a,b){this._timedOut=d;this._message=e;this._stackTrace=c;this._exceptionType=a;this._errorObject=b;this._statusCode=-1};Sys.Net.WebServiceError.prototype={get_timedOut:function(){return this._timedOut},get_statusCode:function(){return this._statusCode},get_message:function(){return this._message},get_stackTrace:function(){return this._stackTrace||""},get_exceptionType:function(){return this._exceptionType||""},get_errorObject:function(){return this._errorObject||null}};Sys.Net.WebServiceError.registerClass("Sys.Net.WebServiceError"); -Type.registerNamespace('Sys');Sys.Res={'argumentInteger':'Value must be an integer.','invokeCalledTwice':'Cannot call invoke more than once.','webServiceFailed':'The server method \'{0}\' failed with the following error: {1}','argumentType':'Object cannot be converted to the required type.','argumentNull':'Value cannot be null.','scriptAlreadyLoaded':'The script \'{0}\' has been referenced multiple times. If referencing Microsoft AJAX scripts explicitly, set the MicrosoftAjaxMode property of the ScriptManager to Explicit.','scriptDependencyNotFound':'The script \'{0}\' failed to load because it is dependent on script \'{1}\'.','formatBadFormatSpecifier':'Format specifier was invalid.','requiredScriptReferenceNotIncluded':'\'{0}\' requires that you have included a script reference to \'{1}\'.','webServiceFailedNoMsg':'The server method \'{0}\' failed.','argumentDomElement':'Value must be a DOM element.','invalidExecutorType':'Could not create a valid Sys.Net.WebRequestExecutor from: {0}.','cannotCallBeforeResponse':'Cannot call {0} when responseAvailable is false.','actualValue':'Actual value was {0}.','enumInvalidValue':'\'{0}\' is not a valid value for enum {1}.','scriptLoadFailed':'The script \'{0}\' could not be loaded.','parameterCount':'Parameter count mismatch.','cannotDeserializeEmptyString':'Cannot deserialize empty string.','formatInvalidString':'Input string was not in a correct format.','invalidTimeout':'Value must be greater than or equal to zero.','cannotAbortBeforeStart':'Cannot abort when executor has not started.','argument':'Value does not fall within the expected range.','cannotDeserializeInvalidJson':'Cannot deserialize. The data does not correspond to valid JSON.','invalidHttpVerb':'httpVerb cannot be set to an empty or null string.','nullWebRequest':'Cannot call executeRequest with a null webRequest.','eventHandlerInvalid':'Handler was not added through the Sys.UI.DomEvent.addHandler method.','cannotSerializeNonFiniteNumbers':'Cannot serialize non finite numbers.','argumentUndefined':'Value cannot be undefined.','webServiceInvalidReturnType':'The server method \'{0}\' returned an invalid type. Expected type: {1}','servicePathNotSet':'The path to the web service has not been set.','argumentTypeWithTypes':'Object of type \'{0}\' cannot be converted to type \'{1}\'.','cannotCallOnceStarted':'Cannot call {0} once started.','badBaseUrl1':'Base URL does not contain ://.','badBaseUrl2':'Base URL does not contain another /.','badBaseUrl3':'Cannot find last / in base URL.','setExecutorAfterActive':'Cannot set executor after it has become active.','paramName':'Parameter name: {0}','nullReferenceInPath':'Null reference while evaluating data path: \'{0}\'.','cannotCallOutsideHandler':'Cannot call {0} outside of a completed event handler.','cannotSerializeObjectWithCycle':'Cannot serialize object with cyclic reference within child properties.','format':'One of the identified items was in an invalid format.','assertFailedCaller':'Assertion Failed: {0}\r\nat {1}','argumentOutOfRange':'Specified argument was out of the range of valid values.','webServiceTimedOut':'The server method \'{0}\' timed out.','notImplemented':'The method or operation is not implemented.','assertFailed':'Assertion Failed: {0}','invalidOperation':'Operation is not valid due to the current state of the object.','breakIntoDebugger':'{0}\r\n\r\nBreak into debugger?'}; diff --git a/NzbDrone.Web/Scripts2/MicrosoftMvcAjax.debug.js b/NzbDrone.Web/Scripts2/MicrosoftMvcAjax.debug.js deleted file mode 100644 index eb68ba7e7..000000000 --- a/NzbDrone.Web/Scripts2/MicrosoftMvcAjax.debug.js +++ /dev/null @@ -1,408 +0,0 @@ -//!---------------------------------------------------------- -//! Copyright (C) Microsoft Corporation. All rights reserved. -//!---------------------------------------------------------- -//! MicrosoftMvcAjax.js - -Type.registerNamespace('Sys.Mvc'); - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.AjaxOptions - -Sys.Mvc.$create_AjaxOptions = function Sys_Mvc_AjaxOptions() { return {}; } - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.InsertionMode - -Sys.Mvc.InsertionMode = function() { - /// - /// - /// - /// - /// - /// -}; -Sys.Mvc.InsertionMode.prototype = { - replace: 0, - insertBefore: 1, - insertAfter: 2 -} -Sys.Mvc.InsertionMode.registerEnum('Sys.Mvc.InsertionMode', false); - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.AjaxContext - -Sys.Mvc.AjaxContext = function Sys_Mvc_AjaxContext(request, updateTarget, loadingElement, insertionMode) { - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - this._request = request; - this._updateTarget = updateTarget; - this._loadingElement = loadingElement; - this._insertionMode = insertionMode; -} -Sys.Mvc.AjaxContext.prototype = { - _insertionMode: 0, - _loadingElement: null, - _response: null, - _request: null, - _updateTarget: null, - - get_data: function Sys_Mvc_AjaxContext$get_data() { - /// - if (this._response) { - return this._response.get_responseData(); - } - else { - return null; - } - }, - - get_insertionMode: function Sys_Mvc_AjaxContext$get_insertionMode() { - /// - return this._insertionMode; - }, - - get_loadingElement: function Sys_Mvc_AjaxContext$get_loadingElement() { - /// - return this._loadingElement; - }, - - get_object: function Sys_Mvc_AjaxContext$get_object() { - /// - var executor = this.get_response(); - return (executor) ? executor.get_object() : null; - }, - - get_response: function Sys_Mvc_AjaxContext$get_response() { - /// - return this._response; - }, - set_response: function Sys_Mvc_AjaxContext$set_response(value) { - /// - this._response = value; - return value; - }, - - get_request: function Sys_Mvc_AjaxContext$get_request() { - /// - return this._request; - }, - - get_updateTarget: function Sys_Mvc_AjaxContext$get_updateTarget() { - /// - return this._updateTarget; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.AsyncHyperlink - -Sys.Mvc.AsyncHyperlink = function Sys_Mvc_AsyncHyperlink() { -} -Sys.Mvc.AsyncHyperlink.handleClick = function Sys_Mvc_AsyncHyperlink$handleClick(anchor, evt, ajaxOptions) { - /// - /// - /// - /// - /// - /// - evt.preventDefault(); - Sys.Mvc.MvcHelpers._asyncRequest(anchor.href, 'post', '', anchor, ajaxOptions); -} - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.MvcHelpers - -Sys.Mvc.MvcHelpers = function Sys_Mvc_MvcHelpers() { -} -Sys.Mvc.MvcHelpers._serializeSubmitButton = function Sys_Mvc_MvcHelpers$_serializeSubmitButton(element, offsetX, offsetY) { - /// - /// - /// - /// - /// - /// - /// - if (element.disabled) { - return null; - } - var name = element.name; - if (name) { - var tagName = element.tagName.toUpperCase(); - var encodedName = encodeURIComponent(name); - var inputElement = element; - if (tagName === 'INPUT') { - var type = inputElement.type; - if (type === 'submit') { - return encodedName + '=' + encodeURIComponent(inputElement.value); - } - else if (type === 'image') { - return encodedName + '.x=' + offsetX + '&' + encodedName + '.y=' + offsetY; - } - } - else if ((tagName === 'BUTTON') && (name.length) && (inputElement.type === 'submit')) { - return encodedName + '=' + encodeURIComponent(inputElement.value); - } - } - return null; -} -Sys.Mvc.MvcHelpers._serializeForm = function Sys_Mvc_MvcHelpers$_serializeForm(form) { - /// - /// - /// - var formElements = form.elements; - var formBody = new Sys.StringBuilder(); - var count = formElements.length; - for (var i = 0; i < count; i++) { - var element = formElements[i]; - var name = element.name; - if (!name || !name.length) { - continue; - } - var tagName = element.tagName.toUpperCase(); - if (tagName === 'INPUT') { - var inputElement = element; - var type = inputElement.type; - if ((type === 'text') || (type === 'password') || (type === 'hidden') || (((type === 'checkbox') || (type === 'radio')) && element.checked)) { - formBody.append(encodeURIComponent(name)); - formBody.append('='); - formBody.append(encodeURIComponent(inputElement.value)); - formBody.append('&'); - } - } - else if (tagName === 'SELECT') { - var selectElement = element; - var optionCount = selectElement.options.length; - for (var j = 0; j < optionCount; j++) { - var optionElement = selectElement.options[j]; - if (optionElement.selected) { - formBody.append(encodeURIComponent(name)); - formBody.append('='); - formBody.append(encodeURIComponent(optionElement.value)); - formBody.append('&'); - } - } - } - else if (tagName === 'TEXTAREA') { - formBody.append(encodeURIComponent(name)); - formBody.append('='); - formBody.append(encodeURIComponent((element.value))); - formBody.append('&'); - } - } - var additionalInput = form._additionalInput; - if (additionalInput) { - formBody.append(additionalInput); - formBody.append('&'); - } - return formBody.toString(); -} -Sys.Mvc.MvcHelpers._asyncRequest = function Sys_Mvc_MvcHelpers$_asyncRequest(url, verb, body, triggerElement, ajaxOptions) { - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - if (ajaxOptions.confirm) { - if (!confirm(ajaxOptions.confirm)) { - return; - } - } - if (ajaxOptions.url) { - url = ajaxOptions.url; - } - if (ajaxOptions.httpMethod) { - verb = ajaxOptions.httpMethod; - } - if (body.length > 0 && !body.endsWith('&')) { - body += '&'; - } - body += 'X-Requested-With=XMLHttpRequest'; - var upperCaseVerb = verb.toUpperCase(); - var isGetOrPost = (upperCaseVerb === 'GET' || upperCaseVerb === 'POST'); - if (!isGetOrPost) { - body += '&'; - body += 'X-HTTP-Method-Override=' + upperCaseVerb; - } - var requestBody = ''; - if (upperCaseVerb === 'GET' || upperCaseVerb === 'DELETE') { - if (url.indexOf('?') > -1) { - if (!url.endsWith('&')) { - url += '&'; - } - url += body; - } - else { - url += '?'; - url += body; - } - } - else { - requestBody = body; - } - var request = new Sys.Net.WebRequest(); - request.set_url(url); - if (isGetOrPost) { - request.set_httpVerb(verb); - } - else { - request.set_httpVerb('POST'); - request.get_headers()['X-HTTP-Method-Override'] = upperCaseVerb; - } - request.set_body(requestBody); - if (verb.toUpperCase() === 'PUT') { - request.get_headers()['Content-Type'] = 'application/x-www-form-urlencoded;'; - } - request.get_headers()['X-Requested-With'] = 'XMLHttpRequest'; - var updateElement = null; - if (ajaxOptions.updateTargetId) { - updateElement = $get(ajaxOptions.updateTargetId); - } - var loadingElement = null; - if (ajaxOptions.loadingElementId) { - loadingElement = $get(ajaxOptions.loadingElementId); - } - var ajaxContext = new Sys.Mvc.AjaxContext(request, updateElement, loadingElement, ajaxOptions.insertionMode); - var continueRequest = true; - if (ajaxOptions.onBegin) { - continueRequest = ajaxOptions.onBegin(ajaxContext) !== false; - } - if (loadingElement) { - Sys.UI.DomElement.setVisible(ajaxContext.get_loadingElement(), true); - } - if (continueRequest) { - request.add_completed(Function.createDelegate(null, function(executor) { - Sys.Mvc.MvcHelpers._onComplete(request, ajaxOptions, ajaxContext); - })); - request.invoke(); - } -} -Sys.Mvc.MvcHelpers._onComplete = function Sys_Mvc_MvcHelpers$_onComplete(request, ajaxOptions, ajaxContext) { - /// - /// - /// - /// - /// - /// - ajaxContext.set_response(request.get_executor()); - if (ajaxOptions.onComplete && ajaxOptions.onComplete(ajaxContext) === false) { - return; - } - var statusCode = ajaxContext.get_response().get_statusCode(); - if ((statusCode >= 200 && statusCode < 300) || statusCode === 304 || statusCode === 1223) { - if (statusCode !== 204 && statusCode !== 304 && statusCode !== 1223) { - var contentType = ajaxContext.get_response().getResponseHeader('Content-Type'); - if ((contentType) && (contentType.indexOf('application/x-javascript') !== -1)) { - eval(ajaxContext.get_data()); - } - else { - Sys.Mvc.MvcHelpers.updateDomElement(ajaxContext.get_updateTarget(), ajaxContext.get_insertionMode(), ajaxContext.get_data()); - } - } - if (ajaxOptions.onSuccess) { - ajaxOptions.onSuccess(ajaxContext); - } - } - else { - if (ajaxOptions.onFailure) { - ajaxOptions.onFailure(ajaxContext); - } - } - if (ajaxContext.get_loadingElement()) { - Sys.UI.DomElement.setVisible(ajaxContext.get_loadingElement(), false); - } -} -Sys.Mvc.MvcHelpers.updateDomElement = function Sys_Mvc_MvcHelpers$updateDomElement(target, insertionMode, content) { - /// - /// - /// - /// - /// - /// - if (target) { - switch (insertionMode) { - case Sys.Mvc.InsertionMode.replace: - target.innerHTML = content; - break; - case Sys.Mvc.InsertionMode.insertBefore: - if (content && content.length > 0) { - target.innerHTML = content + target.innerHTML.trimStart(); - } - break; - case Sys.Mvc.InsertionMode.insertAfter: - if (content && content.length > 0) { - target.innerHTML = target.innerHTML.trimEnd() + content; - } - break; - } - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.AsyncForm - -Sys.Mvc.AsyncForm = function Sys_Mvc_AsyncForm() { -} -Sys.Mvc.AsyncForm.handleClick = function Sys_Mvc_AsyncForm$handleClick(form, evt) { - /// - /// - /// - /// - var additionalInput = Sys.Mvc.MvcHelpers._serializeSubmitButton(evt.target, evt.offsetX, evt.offsetY); - form._additionalInput = additionalInput; -} -Sys.Mvc.AsyncForm.handleSubmit = function Sys_Mvc_AsyncForm$handleSubmit(form, evt, ajaxOptions) { - /// - /// - /// - /// - /// - /// - evt.preventDefault(); - var validationCallbacks = form.validationCallbacks; - if (validationCallbacks) { - for (var i = 0; i < validationCallbacks.length; i++) { - var callback = validationCallbacks[i]; - if (!callback()) { - return; - } - } - } - var body = Sys.Mvc.MvcHelpers._serializeForm(form); - Sys.Mvc.MvcHelpers._asyncRequest(form.action, form.method || 'post', body, form, ajaxOptions); -} - - -Sys.Mvc.AjaxContext.registerClass('Sys.Mvc.AjaxContext'); -Sys.Mvc.AsyncHyperlink.registerClass('Sys.Mvc.AsyncHyperlink'); -Sys.Mvc.MvcHelpers.registerClass('Sys.Mvc.MvcHelpers'); -Sys.Mvc.AsyncForm.registerClass('Sys.Mvc.AsyncForm'); - -// ---- Do not remove this footer ---- -// Generated using Script# v0.5.0.0 (http://projects.nikhilk.net) -// ----------------------------------- diff --git a/NzbDrone.Web/Scripts2/MicrosoftMvcAjax.js b/NzbDrone.Web/Scripts2/MicrosoftMvcAjax.js deleted file mode 100644 index c5a6165e7..000000000 --- a/NzbDrone.Web/Scripts2/MicrosoftMvcAjax.js +++ /dev/null @@ -1,25 +0,0 @@ -//---------------------------------------------------------- -// Copyright (C) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------- -// MicrosoftMvcAjax.js - -Type.registerNamespace('Sys.Mvc');Sys.Mvc.$create_AjaxOptions=function(){return {};} -Sys.Mvc.InsertionMode=function(){};Sys.Mvc.InsertionMode.prototype = {replace:0,insertBefore:1,insertAfter:2} -Sys.Mvc.InsertionMode.registerEnum('Sys.Mvc.InsertionMode',false);Sys.Mvc.AjaxContext=function(request,updateTarget,loadingElement,insertionMode){this.$3=request;this.$4=updateTarget;this.$1=loadingElement;this.$0=insertionMode;} -Sys.Mvc.AjaxContext.prototype={$0:0,$1:null,$2:null,$3:null,$4:null,get_data:function(){if(this.$2){return this.$2.get_responseData();}else{return null;}},get_insertionMode:function(){return this.$0;},get_loadingElement:function(){return this.$1;},get_object:function(){var $0=this.get_response();return ($0)?$0.get_object():null;},get_response:function(){return this.$2;},set_response:function(value){this.$2=value;return value;},get_request:function(){return this.$3;},get_updateTarget:function(){return this.$4;}} -Sys.Mvc.AsyncHyperlink=function(){} -Sys.Mvc.AsyncHyperlink.handleClick=function(anchor,evt,ajaxOptions){evt.preventDefault();Sys.Mvc.MvcHelpers.$2(anchor.href,'post','',anchor,ajaxOptions);} -Sys.Mvc.MvcHelpers=function(){} -Sys.Mvc.MvcHelpers.$0=function($p0,$p1,$p2){if($p0.disabled){return null;}var $0=$p0.name;if($0){var $1=$p0.tagName.toUpperCase();var $2=encodeURIComponent($0);var $3=$p0;if($1==='INPUT'){var $4=$3.type;if($4==='submit'){return $2+'='+encodeURIComponent($3.value);}else if($4==='image'){return $2+'.x='+$p1+'&'+$2+'.y='+$p2;}}else if(($1==='BUTTON')&&($0.length)&&($3.type==='submit')){return $2+'='+encodeURIComponent($3.value);}}return null;} -Sys.Mvc.MvcHelpers.$1=function($p0){var $0=$p0.elements;var $1=new Sys.StringBuilder();var $2=$0.length;for(var $4=0;$4<$2;$4++){var $5=$0[$4];var $6=$5.name;if(!$6||!$6.length){continue;}var $7=$5.tagName.toUpperCase();if($7==='INPUT'){var $8=$5;var $9=$8.type;if(($9==='text')||($9==='password')||($9==='hidden')||((($9==='checkbox')||($9==='radio'))&&$5.checked)){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($8.value));$1.append('&');}}else if($7==='SELECT'){var $A=$5;var $B=$A.options.length;for(var $C=0;$C<$B;$C++){var $D=$A.options[$C];if($D.selected){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent($D.value));$1.append('&');}}}else if($7==='TEXTAREA'){$1.append(encodeURIComponent($6));$1.append('=');$1.append(encodeURIComponent(($5.value)));$1.append('&');}}var $3=$p0._additionalInput;if($3){$1.append($3);$1.append('&');}return $1.toString();} -Sys.Mvc.MvcHelpers.$2=function($p0,$p1,$p2,$p3,$p4){if($p4.confirm){if(!confirm($p4.confirm)){return;}}if($p4.url){$p0=$p4.url;}if($p4.httpMethod){$p1=$p4.httpMethod;}if($p2.length>0&&!$p2.endsWith('&')){$p2+='&';}$p2+='X-Requested-With=XMLHttpRequest';var $0=$p1.toUpperCase();var $1=($0==='GET'||$0==='POST');if(!$1){$p2+='&';$p2+='X-HTTP-Method-Override='+$0;}var $2='';if($0==='GET'||$0==='DELETE'){if($p0.indexOf('?')>-1){if(!$p0.endsWith('&')){$p0+='&';}$p0+=$p2;}else{$p0+='?';$p0+=$p2;}}else{$2=$p2;}var $3=new Sys.Net.WebRequest();$3.set_url($p0);if($1){$3.set_httpVerb($p1);}else{$3.set_httpVerb('POST');$3.get_headers()['X-HTTP-Method-Override']=$0;}$3.set_body($2);if($p1.toUpperCase()==='PUT'){$3.get_headers()['Content-Type']='application/x-www-form-urlencoded;';}$3.get_headers()['X-Requested-With']='XMLHttpRequest';var $4=null;if($p4.updateTargetId){$4=$get($p4.updateTargetId);}var $5=null;if($p4.loadingElementId){$5=$get($p4.loadingElementId);}var $6=new Sys.Mvc.AjaxContext($3,$4,$5,$p4.insertionMode);var $7=true;if($p4.onBegin){$7=$p4.onBegin($6)!==false;}if($5){Sys.UI.DomElement.setVisible($6.get_loadingElement(),true);}if($7){$3.add_completed(Function.createDelegate(null,function($p1_0){ -Sys.Mvc.MvcHelpers.$3($3,$p4,$6);}));$3.invoke();}} -Sys.Mvc.MvcHelpers.$3=function($p0,$p1,$p2){$p2.set_response($p0.get_executor());if($p1.onComplete&&$p1.onComplete($p2)===false){return;}var $0=$p2.get_response().get_statusCode();if(($0>=200&&$0<300)||$0===304||$0===1223){if($0!==204&&$0!==304&&$0!==1223){var $1=$p2.get_response().getResponseHeader('Content-Type');if(($1)&&($1.indexOf('application/x-javascript')!==-1)){eval($p2.get_data());}else{Sys.Mvc.MvcHelpers.updateDomElement($p2.get_updateTarget(),$p2.get_insertionMode(),$p2.get_data());}}if($p1.onSuccess){$p1.onSuccess($p2);}}else{if($p1.onFailure){$p1.onFailure($p2);}}if($p2.get_loadingElement()){Sys.UI.DomElement.setVisible($p2.get_loadingElement(),false);}} -Sys.Mvc.MvcHelpers.updateDomElement=function(target,insertionMode,content){if(target){switch(insertionMode){case 0:target.innerHTML=content;break;case 1:if(content&&content.length>0){target.innerHTML=content+target.innerHTML.trimStart();}break;case 2:if(content&&content.length>0){target.innerHTML=target.innerHTML.trimEnd()+content;}break;}}} -Sys.Mvc.AsyncForm=function(){} -Sys.Mvc.AsyncForm.handleClick=function(form,evt){var $0=Sys.Mvc.MvcHelpers.$0(evt.target,evt.offsetX,evt.offsetY);form._additionalInput = $0;} -Sys.Mvc.AsyncForm.handleSubmit=function(form,evt,ajaxOptions){evt.preventDefault();var $0=form.validationCallbacks;if($0){for(var $2=0;$2<$0.length;$2++){var $3=$0[$2];if(!$3()){return;}}}var $1=Sys.Mvc.MvcHelpers.$1(form);Sys.Mvc.MvcHelpers.$2(form.action,form.method||'post',$1,form,ajaxOptions);} -Sys.Mvc.AjaxContext.registerClass('Sys.Mvc.AjaxContext');Sys.Mvc.AsyncHyperlink.registerClass('Sys.Mvc.AsyncHyperlink');Sys.Mvc.MvcHelpers.registerClass('Sys.Mvc.MvcHelpers');Sys.Mvc.AsyncForm.registerClass('Sys.Mvc.AsyncForm'); -// ---- Do not remove this footer ---- -// Generated using Script# v0.5.0.0 (http://projects.nikhilk.net) -// ----------------------------------- diff --git a/NzbDrone.Web/Scripts2/MicrosoftMvcValidation.debug.js b/NzbDrone.Web/Scripts2/MicrosoftMvcValidation.debug.js deleted file mode 100644 index 346ba4818..000000000 --- a/NzbDrone.Web/Scripts2/MicrosoftMvcValidation.debug.js +++ /dev/null @@ -1,883 +0,0 @@ -//!---------------------------------------------------------- -//! Copyright (C) Microsoft Corporation. All rights reserved. -//!---------------------------------------------------------- -//! MicrosoftMvcValidation.js - - -Type.registerNamespace('Sys.Mvc'); - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.Validation - -Sys.Mvc.$create_Validation = function Sys_Mvc_Validation() { return {}; } - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.JsonValidationField - -Sys.Mvc.$create_JsonValidationField = function Sys_Mvc_JsonValidationField() { return {}; } - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.JsonValidationOptions - -Sys.Mvc.$create_JsonValidationOptions = function Sys_Mvc_JsonValidationOptions() { return {}; } - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.JsonValidationRule - -Sys.Mvc.$create_JsonValidationRule = function Sys_Mvc_JsonValidationRule() { return {}; } - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.ValidationContext - -Sys.Mvc.$create_ValidationContext = function Sys_Mvc_ValidationContext() { return {}; } - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.NumberValidator - -Sys.Mvc.NumberValidator = function Sys_Mvc_NumberValidator() { -} -Sys.Mvc.NumberValidator.create = function Sys_Mvc_NumberValidator$create(rule) { - /// - /// - /// - return Function.createDelegate(new Sys.Mvc.NumberValidator(), new Sys.Mvc.NumberValidator().validate); -} -Sys.Mvc.NumberValidator.prototype = { - - validate: function Sys_Mvc_NumberValidator$validate(value, context) { - /// - /// - /// - /// - /// - if (Sys.Mvc._validationUtil.stringIsNullOrEmpty(value)) { - return true; - } - var n = Number.parseLocale(value); - return (!isNaN(n)); - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.FormContext - -Sys.Mvc.FormContext = function Sys_Mvc_FormContext(formElement, validationSummaryElement) { - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - this._errors = []; - this.fields = new Array(0); - this._formElement = formElement; - this._validationSummaryElement = validationSummaryElement; - formElement[Sys.Mvc.FormContext._formValidationTag] = this; - if (validationSummaryElement) { - var ulElements = validationSummaryElement.getElementsByTagName('ul'); - if (ulElements.length > 0) { - this._validationSummaryULElement = ulElements[0]; - } - } - this._onClickHandler = Function.createDelegate(this, this._form_OnClick); - this._onSubmitHandler = Function.createDelegate(this, this._form_OnSubmit); -} -Sys.Mvc.FormContext._Application_Load = function Sys_Mvc_FormContext$_Application_Load() { - var allFormOptions = window.mvcClientValidationMetadata; - if (allFormOptions) { - while (allFormOptions.length > 0) { - var thisFormOptions = allFormOptions.pop(); - Sys.Mvc.FormContext._parseJsonOptions(thisFormOptions); - } - } -} -Sys.Mvc.FormContext._getFormElementsWithName = function Sys_Mvc_FormContext$_getFormElementsWithName(formElement, name) { - /// - /// - /// - /// - /// - var allElementsWithNameInForm = []; - var allElementsWithName = document.getElementsByName(name); - for (var i = 0; i < allElementsWithName.length; i++) { - var thisElement = allElementsWithName[i]; - if (Sys.Mvc.FormContext._isElementInHierarchy(formElement, thisElement)) { - Array.add(allElementsWithNameInForm, thisElement); - } - } - return allElementsWithNameInForm; -} -Sys.Mvc.FormContext.getValidationForForm = function Sys_Mvc_FormContext$getValidationForForm(formElement) { - /// - /// - /// - return formElement[Sys.Mvc.FormContext._formValidationTag]; -} -Sys.Mvc.FormContext._isElementInHierarchy = function Sys_Mvc_FormContext$_isElementInHierarchy(parent, child) { - /// - /// - /// - /// - /// - while (child) { - if (parent === child) { - return true; - } - child = child.parentNode; - } - return false; -} -Sys.Mvc.FormContext._parseJsonOptions = function Sys_Mvc_FormContext$_parseJsonOptions(options) { - /// - /// - /// - var formElement = $get(options.FormId); - var validationSummaryElement = (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(options.ValidationSummaryId)) ? $get(options.ValidationSummaryId) : null; - var formContext = new Sys.Mvc.FormContext(formElement, validationSummaryElement); - formContext.enableDynamicValidation(); - formContext.replaceValidationSummary = options.ReplaceValidationSummary; - for (var i = 0; i < options.Fields.length; i++) { - var field = options.Fields[i]; - var fieldElements = Sys.Mvc.FormContext._getFormElementsWithName(formElement, field.FieldName); - var validationMessageElement = (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(field.ValidationMessageId)) ? $get(field.ValidationMessageId) : null; - var fieldContext = new Sys.Mvc.FieldContext(formContext); - Array.addRange(fieldContext.elements, fieldElements); - fieldContext.validationMessageElement = validationMessageElement; - fieldContext.replaceValidationMessageContents = field.ReplaceValidationMessageContents; - for (var j = 0; j < field.ValidationRules.length; j++) { - var rule = field.ValidationRules[j]; - var validator = Sys.Mvc.ValidatorRegistry.getValidator(rule); - if (validator) { - var validation = Sys.Mvc.$create_Validation(); - validation.fieldErrorMessage = rule.ErrorMessage; - validation.validator = validator; - Array.add(fieldContext.validations, validation); - } - } - fieldContext.enableDynamicValidation(); - Array.add(formContext.fields, fieldContext); - } - var registeredValidatorCallbacks = formElement.validationCallbacks; - if (!registeredValidatorCallbacks) { - registeredValidatorCallbacks = []; - formElement.validationCallbacks = registeredValidatorCallbacks; - } - registeredValidatorCallbacks.push(Function.createDelegate(null, function() { - return Sys.Mvc._validationUtil.arrayIsNullOrEmpty(formContext.validate('submit')); - })); - return formContext; -} -Sys.Mvc.FormContext.prototype = { - _onClickHandler: null, - _onSubmitHandler: null, - _submitButtonClicked: null, - _validationSummaryElement: null, - _validationSummaryULElement: null, - _formElement: null, - replaceValidationSummary: false, - - addError: function Sys_Mvc_FormContext$addError(message) { - /// - /// - this.addErrors([ message ]); - }, - - addErrors: function Sys_Mvc_FormContext$addErrors(messages) { - /// - /// - if (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(messages)) { - Array.addRange(this._errors, messages); - this._onErrorCountChanged(); - } - }, - - clearErrors: function Sys_Mvc_FormContext$clearErrors() { - Array.clear(this._errors); - this._onErrorCountChanged(); - }, - - _displayError: function Sys_Mvc_FormContext$_displayError() { - if (this._validationSummaryElement) { - if (this._validationSummaryULElement) { - Sys.Mvc._validationUtil.removeAllChildren(this._validationSummaryULElement); - for (var i = 0; i < this._errors.length; i++) { - var liElement = document.createElement('li'); - Sys.Mvc._validationUtil.setInnerText(liElement, this._errors[i]); - this._validationSummaryULElement.appendChild(liElement); - } - } - Sys.UI.DomElement.removeCssClass(this._validationSummaryElement, Sys.Mvc.FormContext._validationSummaryValidCss); - Sys.UI.DomElement.addCssClass(this._validationSummaryElement, Sys.Mvc.FormContext._validationSummaryErrorCss); - } - }, - - _displaySuccess: function Sys_Mvc_FormContext$_displaySuccess() { - var validationSummaryElement = this._validationSummaryElement; - if (validationSummaryElement) { - var validationSummaryULElement = this._validationSummaryULElement; - if (validationSummaryULElement) { - validationSummaryULElement.innerHTML = ''; - } - Sys.UI.DomElement.removeCssClass(validationSummaryElement, Sys.Mvc.FormContext._validationSummaryErrorCss); - Sys.UI.DomElement.addCssClass(validationSummaryElement, Sys.Mvc.FormContext._validationSummaryValidCss); - } - }, - - enableDynamicValidation: function Sys_Mvc_FormContext$enableDynamicValidation() { - Sys.UI.DomEvent.addHandler(this._formElement, 'click', this._onClickHandler); - Sys.UI.DomEvent.addHandler(this._formElement, 'submit', this._onSubmitHandler); - }, - - _findSubmitButton: function Sys_Mvc_FormContext$_findSubmitButton(element) { - /// - /// - /// - if (element.disabled) { - return null; - } - var tagName = element.tagName.toUpperCase(); - var inputElement = element; - if (tagName === 'INPUT') { - var type = inputElement.type; - if (type === 'submit' || type === 'image') { - return inputElement; - } - } - else if ((tagName === 'BUTTON') && (inputElement.type === 'submit')) { - return inputElement; - } - return null; - }, - - _form_OnClick: function Sys_Mvc_FormContext$_form_OnClick(e) { - /// - /// - this._submitButtonClicked = this._findSubmitButton(e.target); - }, - - _form_OnSubmit: function Sys_Mvc_FormContext$_form_OnSubmit(e) { - /// - /// - var form = e.target; - var submitButton = this._submitButtonClicked; - if (submitButton && submitButton.disableValidation) { - return; - } - var errorMessages = this.validate('submit'); - if (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(errorMessages)) { - e.preventDefault(); - } - }, - - _onErrorCountChanged: function Sys_Mvc_FormContext$_onErrorCountChanged() { - if (!this._errors.length) { - this._displaySuccess(); - } - else { - this._displayError(); - } - }, - - validate: function Sys_Mvc_FormContext$validate(eventName) { - /// - /// - /// - var fields = this.fields; - var errors = []; - for (var i = 0; i < fields.length; i++) { - var field = fields[i]; - if (!field.elements[0].disabled) { - var thisErrors = field.validate(eventName); - if (thisErrors) { - Array.addRange(errors, thisErrors); - } - } - } - if (this.replaceValidationSummary) { - this.clearErrors(); - this.addErrors(errors); - } - return errors; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.FieldContext - -Sys.Mvc.FieldContext = function Sys_Mvc_FieldContext(formContext) { - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - this._errors = []; - this.elements = new Array(0); - this.validations = new Array(0); - this.formContext = formContext; - this._onBlurHandler = Function.createDelegate(this, this._element_OnBlur); - this._onChangeHandler = Function.createDelegate(this, this._element_OnChange); - this._onInputHandler = Function.createDelegate(this, this._element_OnInput); - this._onPropertyChangeHandler = Function.createDelegate(this, this._element_OnPropertyChange); -} -Sys.Mvc.FieldContext.prototype = { - _onBlurHandler: null, - _onChangeHandler: null, - _onInputHandler: null, - _onPropertyChangeHandler: null, - defaultErrorMessage: null, - formContext: null, - replaceValidationMessageContents: false, - validationMessageElement: null, - - addError: function Sys_Mvc_FieldContext$addError(message) { - /// - /// - this.addErrors([ message ]); - }, - - addErrors: function Sys_Mvc_FieldContext$addErrors(messages) { - /// - /// - if (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(messages)) { - Array.addRange(this._errors, messages); - this._onErrorCountChanged(); - } - }, - - clearErrors: function Sys_Mvc_FieldContext$clearErrors() { - Array.clear(this._errors); - this._onErrorCountChanged(); - }, - - _displayError: function Sys_Mvc_FieldContext$_displayError() { - var validationMessageElement = this.validationMessageElement; - if (validationMessageElement) { - if (this.replaceValidationMessageContents) { - Sys.Mvc._validationUtil.setInnerText(validationMessageElement, this._errors[0]); - } - Sys.UI.DomElement.removeCssClass(validationMessageElement, Sys.Mvc.FieldContext._validationMessageValidCss); - Sys.UI.DomElement.addCssClass(validationMessageElement, Sys.Mvc.FieldContext._validationMessageErrorCss); - } - var elements = this.elements; - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - Sys.UI.DomElement.removeCssClass(element, Sys.Mvc.FieldContext._inputElementValidCss); - Sys.UI.DomElement.addCssClass(element, Sys.Mvc.FieldContext._inputElementErrorCss); - } - }, - - _displaySuccess: function Sys_Mvc_FieldContext$_displaySuccess() { - var validationMessageElement = this.validationMessageElement; - if (validationMessageElement) { - if (this.replaceValidationMessageContents) { - Sys.Mvc._validationUtil.setInnerText(validationMessageElement, ''); - } - Sys.UI.DomElement.removeCssClass(validationMessageElement, Sys.Mvc.FieldContext._validationMessageErrorCss); - Sys.UI.DomElement.addCssClass(validationMessageElement, Sys.Mvc.FieldContext._validationMessageValidCss); - } - var elements = this.elements; - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - Sys.UI.DomElement.removeCssClass(element, Sys.Mvc.FieldContext._inputElementErrorCss); - Sys.UI.DomElement.addCssClass(element, Sys.Mvc.FieldContext._inputElementValidCss); - } - }, - - _element_OnBlur: function Sys_Mvc_FieldContext$_element_OnBlur(e) { - /// - /// - if (e.target[Sys.Mvc.FieldContext._hasTextChangedTag] || e.target[Sys.Mvc.FieldContext._hasValidationFiredTag]) { - this.validate('blur'); - } - }, - - _element_OnChange: function Sys_Mvc_FieldContext$_element_OnChange(e) { - /// - /// - e.target[Sys.Mvc.FieldContext._hasTextChangedTag] = true; - }, - - _element_OnInput: function Sys_Mvc_FieldContext$_element_OnInput(e) { - /// - /// - e.target[Sys.Mvc.FieldContext._hasTextChangedTag] = true; - if (e.target[Sys.Mvc.FieldContext._hasValidationFiredTag]) { - this.validate('input'); - } - }, - - _element_OnPropertyChange: function Sys_Mvc_FieldContext$_element_OnPropertyChange(e) { - /// - /// - if (e.rawEvent.propertyName === 'value') { - e.target[Sys.Mvc.FieldContext._hasTextChangedTag] = true; - if (e.target[Sys.Mvc.FieldContext._hasValidationFiredTag]) { - this.validate('input'); - } - } - }, - - enableDynamicValidation: function Sys_Mvc_FieldContext$enableDynamicValidation() { - var elements = this.elements; - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - if (Sys.Mvc._validationUtil.elementSupportsEvent(element, 'onpropertychange')) { - var compatMode = document.documentMode; - if (compatMode && compatMode >= 8) { - Sys.UI.DomEvent.addHandler(element, 'propertychange', this._onPropertyChangeHandler); - } - } - else { - Sys.UI.DomEvent.addHandler(element, 'input', this._onInputHandler); - } - Sys.UI.DomEvent.addHandler(element, 'change', this._onChangeHandler); - Sys.UI.DomEvent.addHandler(element, 'blur', this._onBlurHandler); - } - }, - - _getErrorString: function Sys_Mvc_FieldContext$_getErrorString(validatorReturnValue, fieldErrorMessage) { - /// - /// - /// - /// - /// - var fallbackErrorMessage = fieldErrorMessage || this.defaultErrorMessage; - if (Boolean.isInstanceOfType(validatorReturnValue)) { - return (validatorReturnValue) ? null : fallbackErrorMessage; - } - if (String.isInstanceOfType(validatorReturnValue)) { - return ((validatorReturnValue).length) ? validatorReturnValue : fallbackErrorMessage; - } - return null; - }, - - _getStringValue: function Sys_Mvc_FieldContext$_getStringValue() { - /// - var elements = this.elements; - return (elements.length > 0) ? elements[0].value : null; - }, - - _markValidationFired: function Sys_Mvc_FieldContext$_markValidationFired() { - var elements = this.elements; - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - element[Sys.Mvc.FieldContext._hasValidationFiredTag] = true; - } - }, - - _onErrorCountChanged: function Sys_Mvc_FieldContext$_onErrorCountChanged() { - if (!this._errors.length) { - this._displaySuccess(); - } - else { - this._displayError(); - } - }, - - validate: function Sys_Mvc_FieldContext$validate(eventName) { - /// - /// - /// - var validations = this.validations; - var errors = []; - var value = this._getStringValue(); - for (var i = 0; i < validations.length; i++) { - var validation = validations[i]; - var context = Sys.Mvc.$create_ValidationContext(); - context.eventName = eventName; - context.fieldContext = this; - context.validation = validation; - var retVal = validation.validator(value, context); - var errorMessage = this._getErrorString(retVal, validation.fieldErrorMessage); - if (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(errorMessage)) { - Array.add(errors, errorMessage); - } - } - this._markValidationFired(); - this.clearErrors(); - this.addErrors(errors); - return errors; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.RangeValidator - -Sys.Mvc.RangeValidator = function Sys_Mvc_RangeValidator(minimum, maximum) { - /// - /// - /// - /// - /// - /// - /// - /// - this._minimum = minimum; - this._maximum = maximum; -} -Sys.Mvc.RangeValidator.create = function Sys_Mvc_RangeValidator$create(rule) { - /// - /// - /// - var min = rule.ValidationParameters['min']; - var max = rule.ValidationParameters['max']; - return Function.createDelegate(new Sys.Mvc.RangeValidator(min, max), new Sys.Mvc.RangeValidator(min, max).validate); -} -Sys.Mvc.RangeValidator.prototype = { - _minimum: null, - _maximum: null, - - validate: function Sys_Mvc_RangeValidator$validate(value, context) { - /// - /// - /// - /// - /// - if (Sys.Mvc._validationUtil.stringIsNullOrEmpty(value)) { - return true; - } - var n = Number.parseLocale(value); - return (!isNaN(n) && this._minimum <= n && n <= this._maximum); - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.RegularExpressionValidator - -Sys.Mvc.RegularExpressionValidator = function Sys_Mvc_RegularExpressionValidator(pattern) { - /// - /// - /// - /// - this._pattern = pattern; -} -Sys.Mvc.RegularExpressionValidator.create = function Sys_Mvc_RegularExpressionValidator$create(rule) { - /// - /// - /// - var pattern = rule.ValidationParameters['pattern']; - return Function.createDelegate(new Sys.Mvc.RegularExpressionValidator(pattern), new Sys.Mvc.RegularExpressionValidator(pattern).validate); -} -Sys.Mvc.RegularExpressionValidator.prototype = { - _pattern: null, - - validate: function Sys_Mvc_RegularExpressionValidator$validate(value, context) { - /// - /// - /// - /// - /// - if (Sys.Mvc._validationUtil.stringIsNullOrEmpty(value)) { - return true; - } - var regExp = new RegExp(this._pattern); - var matches = regExp.exec(value); - return (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(matches) && matches[0].length === value.length); - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.RequiredValidator - -Sys.Mvc.RequiredValidator = function Sys_Mvc_RequiredValidator() { -} -Sys.Mvc.RequiredValidator.create = function Sys_Mvc_RequiredValidator$create(rule) { - /// - /// - /// - return Function.createDelegate(new Sys.Mvc.RequiredValidator(), new Sys.Mvc.RequiredValidator().validate); -} -Sys.Mvc.RequiredValidator._isRadioInputElement = function Sys_Mvc_RequiredValidator$_isRadioInputElement(element) { - /// - /// - /// - if (element.tagName.toUpperCase() === 'INPUT') { - var inputType = (element.type).toUpperCase(); - if (inputType === 'RADIO') { - return true; - } - } - return false; -} -Sys.Mvc.RequiredValidator._isSelectInputElement = function Sys_Mvc_RequiredValidator$_isSelectInputElement(element) { - /// - /// - /// - if (element.tagName.toUpperCase() === 'SELECT') { - return true; - } - return false; -} -Sys.Mvc.RequiredValidator._isTextualInputElement = function Sys_Mvc_RequiredValidator$_isTextualInputElement(element) { - /// - /// - /// - if (element.tagName.toUpperCase() === 'INPUT') { - var inputType = (element.type).toUpperCase(); - switch (inputType) { - case 'TEXT': - case 'PASSWORD': - case 'FILE': - return true; - } - } - if (element.tagName.toUpperCase() === 'TEXTAREA') { - return true; - } - return false; -} -Sys.Mvc.RequiredValidator._validateRadioInput = function Sys_Mvc_RequiredValidator$_validateRadioInput(elements) { - /// - /// - /// - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - if (element.checked) { - return true; - } - } - return false; -} -Sys.Mvc.RequiredValidator._validateSelectInput = function Sys_Mvc_RequiredValidator$_validateSelectInput(optionElements) { - /// - /// - /// - for (var i = 0; i < optionElements.length; i++) { - var element = optionElements[i]; - if (element.selected) { - if (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(element.value)) { - return true; - } - } - } - return false; -} -Sys.Mvc.RequiredValidator._validateTextualInput = function Sys_Mvc_RequiredValidator$_validateTextualInput(element) { - /// - /// - /// - return (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(element.value)); -} -Sys.Mvc.RequiredValidator.prototype = { - - validate: function Sys_Mvc_RequiredValidator$validate(value, context) { - /// - /// - /// - /// - /// - var elements = context.fieldContext.elements; - if (!elements.length) { - return true; - } - var sampleElement = elements[0]; - if (Sys.Mvc.RequiredValidator._isTextualInputElement(sampleElement)) { - return Sys.Mvc.RequiredValidator._validateTextualInput(sampleElement); - } - if (Sys.Mvc.RequiredValidator._isRadioInputElement(sampleElement)) { - return Sys.Mvc.RequiredValidator._validateRadioInput(elements); - } - if (Sys.Mvc.RequiredValidator._isSelectInputElement(sampleElement)) { - return Sys.Mvc.RequiredValidator._validateSelectInput((sampleElement).options); - } - return true; - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.StringLengthValidator - -Sys.Mvc.StringLengthValidator = function Sys_Mvc_StringLengthValidator(minLength, maxLength) { - /// - /// - /// - /// - /// - /// - /// - /// - this._minLength = minLength; - this._maxLength = maxLength; -} -Sys.Mvc.StringLengthValidator.create = function Sys_Mvc_StringLengthValidator$create(rule) { - /// - /// - /// - var minLength = (rule.ValidationParameters['min'] || 0); - var maxLength = (rule.ValidationParameters['max'] || Number.MAX_VALUE); - return Function.createDelegate(new Sys.Mvc.StringLengthValidator(minLength, maxLength), new Sys.Mvc.StringLengthValidator(minLength, maxLength).validate); -} -Sys.Mvc.StringLengthValidator.prototype = { - _maxLength: 0, - _minLength: 0, - - validate: function Sys_Mvc_StringLengthValidator$validate(value, context) { - /// - /// - /// - /// - /// - if (Sys.Mvc._validationUtil.stringIsNullOrEmpty(value)) { - return true; - } - return (this._minLength <= value.length && value.length <= this._maxLength); - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc._validationUtil - -Sys.Mvc._validationUtil = function Sys_Mvc__validationUtil() { -} -Sys.Mvc._validationUtil.arrayIsNullOrEmpty = function Sys_Mvc__validationUtil$arrayIsNullOrEmpty(array) { - /// - /// - /// - return (!array || !array.length); -} -Sys.Mvc._validationUtil.stringIsNullOrEmpty = function Sys_Mvc__validationUtil$stringIsNullOrEmpty(value) { - /// - /// - /// - return (!value || !value.length); -} -Sys.Mvc._validationUtil.elementSupportsEvent = function Sys_Mvc__validationUtil$elementSupportsEvent(element, eventAttributeName) { - /// - /// - /// - /// - /// - return (eventAttributeName in element); -} -Sys.Mvc._validationUtil.removeAllChildren = function Sys_Mvc__validationUtil$removeAllChildren(element) { - /// - /// - while (element.firstChild) { - element.removeChild(element.firstChild); - } -} -Sys.Mvc._validationUtil.setInnerText = function Sys_Mvc__validationUtil$setInnerText(element, innerText) { - /// - /// - /// - /// - var textNode = document.createTextNode(innerText); - Sys.Mvc._validationUtil.removeAllChildren(element); - element.appendChild(textNode); -} - - -//////////////////////////////////////////////////////////////////////////////// -// Sys.Mvc.ValidatorRegistry - -Sys.Mvc.ValidatorRegistry = function Sys_Mvc_ValidatorRegistry() { - /// - /// -} -Sys.Mvc.ValidatorRegistry.getValidator = function Sys_Mvc_ValidatorRegistry$getValidator(rule) { - /// - /// - /// - var creator = Sys.Mvc.ValidatorRegistry.validators[rule.ValidationType]; - return (creator) ? creator(rule) : null; -} -Sys.Mvc.ValidatorRegistry._getDefaultValidators = function Sys_Mvc_ValidatorRegistry$_getDefaultValidators() { - /// - return { required: Function.createDelegate(null, Sys.Mvc.RequiredValidator.create), length: Function.createDelegate(null, Sys.Mvc.StringLengthValidator.create), regex: Function.createDelegate(null, Sys.Mvc.RegularExpressionValidator.create), range: Function.createDelegate(null, Sys.Mvc.RangeValidator.create), number: Function.createDelegate(null, Sys.Mvc.NumberValidator.create) }; -} - - -Sys.Mvc.NumberValidator.registerClass('Sys.Mvc.NumberValidator'); -Sys.Mvc.FormContext.registerClass('Sys.Mvc.FormContext'); -Sys.Mvc.FieldContext.registerClass('Sys.Mvc.FieldContext'); -Sys.Mvc.RangeValidator.registerClass('Sys.Mvc.RangeValidator'); -Sys.Mvc.RegularExpressionValidator.registerClass('Sys.Mvc.RegularExpressionValidator'); -Sys.Mvc.RequiredValidator.registerClass('Sys.Mvc.RequiredValidator'); -Sys.Mvc.StringLengthValidator.registerClass('Sys.Mvc.StringLengthValidator'); -Sys.Mvc._validationUtil.registerClass('Sys.Mvc._validationUtil'); -Sys.Mvc.ValidatorRegistry.registerClass('Sys.Mvc.ValidatorRegistry'); -Sys.Mvc.FormContext._validationSummaryErrorCss = 'validation-summary-errors'; -Sys.Mvc.FormContext._validationSummaryValidCss = 'validation-summary-valid'; -Sys.Mvc.FormContext._formValidationTag = '__MVC_FormValidation'; -Sys.Mvc.FieldContext._hasTextChangedTag = '__MVC_HasTextChanged'; -Sys.Mvc.FieldContext._hasValidationFiredTag = '__MVC_HasValidationFired'; -Sys.Mvc.FieldContext._inputElementErrorCss = 'input-validation-error'; -Sys.Mvc.FieldContext._inputElementValidCss = 'input-validation-valid'; -Sys.Mvc.FieldContext._validationMessageErrorCss = 'field-validation-error'; -Sys.Mvc.FieldContext._validationMessageValidCss = 'field-validation-valid'; -Sys.Mvc.ValidatorRegistry.validators = Sys.Mvc.ValidatorRegistry._getDefaultValidators(); - -// ---- Do not remove this footer ---- -// Generated using Script# v0.5.0.0 (http://projects.nikhilk.net) -// ----------------------------------- - -// register validation -Sys.Application.add_load(function() { - Sys.Application.remove_load(arguments.callee); - Sys.Mvc.FormContext._Application_Load(); -}); diff --git a/NzbDrone.Web/Scripts2/MicrosoftMvcValidation.js b/NzbDrone.Web/Scripts2/MicrosoftMvcValidation.js deleted file mode 100644 index 9483492f1..000000000 --- a/NzbDrone.Web/Scripts2/MicrosoftMvcValidation.js +++ /dev/null @@ -1,55 +0,0 @@ -//---------------------------------------------------------- -// Copyright (C) Microsoft Corporation. All rights reserved. -//---------------------------------------------------------- -// MicrosoftMvcValidation.js - -Type.registerNamespace('Sys.Mvc');Sys.Mvc.$create_Validation=function(){return {};} -Sys.Mvc.$create_JsonValidationField=function(){return {};} -Sys.Mvc.$create_JsonValidationOptions=function(){return {};} -Sys.Mvc.$create_JsonValidationRule=function(){return {};} -Sys.Mvc.$create_ValidationContext=function(){return {};} -Sys.Mvc.NumberValidator=function(){} -Sys.Mvc.NumberValidator.create=function(rule){return Function.createDelegate(new Sys.Mvc.NumberValidator(),new Sys.Mvc.NumberValidator().validate);} -Sys.Mvc.NumberValidator.prototype={validate:function(value,context){if(Sys.Mvc._ValidationUtil.$1(value)){return true;}var $0=Number.parseLocale(value);return (!isNaN($0));}} -Sys.Mvc.FormContext=function(formElement,validationSummaryElement){this.$5=[];this.fields=new Array(0);this.$9=formElement;this.$7=validationSummaryElement;formElement['__MVC_FormValidation'] = this;if(validationSummaryElement){var $0=validationSummaryElement.getElementsByTagName('ul');if($0.length>0){this.$8=$0[0];}}this.$3=Function.createDelegate(this,this.$D);this.$4=Function.createDelegate(this,this.$E);} -Sys.Mvc.FormContext._Application_Load=function(){var $0=window.mvcClientValidationMetadata;if($0){while($0.length>0){var $1=$0.pop();Sys.Mvc.FormContext.$12($1);}}} -Sys.Mvc.FormContext.$F=function($p0,$p1){var $0=[];var $1=document.getElementsByName($p1);for(var $2=0;$2<$1.length;$2++){var $3=$1[$2];if(Sys.Mvc.FormContext.$10($p0,$3)){Array.add($0,$3);}}return $0;} -Sys.Mvc.FormContext.getValidationForForm=function(formElement){return formElement['__MVC_FormValidation'];} -Sys.Mvc.FormContext.$10=function($p0,$p1){while($p1){if($p0===$p1){return true;}$p1=$p1.parentNode;}return false;} -Sys.Mvc.FormContext.$12=function($p0){var $0=$get($p0.FormId);var $1=(!Sys.Mvc._ValidationUtil.$1($p0.ValidationSummaryId))?$get($p0.ValidationSummaryId):null;var $2=new Sys.Mvc.FormContext($0,$1);$2.enableDynamicValidation();$2.replaceValidationSummary=$p0.ReplaceValidationSummary;for(var $4=0;$4<$p0.Fields.length;$4++){var $5=$p0.Fields[$4];var $6=Sys.Mvc.FormContext.$F($0,$5.FieldName);var $7=(!Sys.Mvc._ValidationUtil.$1($5.ValidationMessageId))?$get($5.ValidationMessageId):null;var $8=new Sys.Mvc.FieldContext($2);Array.addRange($8.elements,$6);$8.validationMessageElement=$7;$8.replaceValidationMessageContents=$5.ReplaceValidationMessageContents;for(var $9=0;$9<$5.ValidationRules.length;$9++){var $A=$5.ValidationRules[$9];var $B=Sys.Mvc.ValidatorRegistry.getValidator($A);if($B){var $C=Sys.Mvc.$create_Validation();$C.fieldErrorMessage=$A.ErrorMessage;$C.validator=$B;Array.add($8.validations,$C);}}$8.enableDynamicValidation();Array.add($2.fields,$8);}var $3=$0.validationCallbacks;if(!$3){$3=[];$0.validationCallbacks = $3;}$3.push(Function.createDelegate(null,function(){ -return Sys.Mvc._ValidationUtil.$0($2.validate('submit'));}));return $2;} -Sys.Mvc.FormContext.prototype={$3:null,$4:null,$6:null,$7:null,$8:null,$9:null,replaceValidationSummary:false,addError:function(message){this.addErrors([message]);},addErrors:function(messages){if(!Sys.Mvc._ValidationUtil.$0(messages)){Array.addRange(this.$5,messages);this.$11();}},clearErrors:function(){Array.clear(this.$5);this.$11();},$A:function(){if(this.$7){if(this.$8){Sys.Mvc._ValidationUtil.$3(this.$8);for(var $0=0;$0=8){Sys.UI.DomEvent.addHandler($2,'propertychange',this.$9);}}else{Sys.UI.DomEvent.addHandler($2,'input',this.$8);}Sys.UI.DomEvent.addHandler($2,'change',this.$7);Sys.UI.DomEvent.addHandler($2,'blur',this.$6);}},$11:function($p0,$p1){var $0=$p1||this.defaultErrorMessage;if(Boolean.isInstanceOfType($p0)){return ($p0)?null:$0;}if(String.isInstanceOfType($p0)){return (($p0).length)?$p0:$0;}return null;},$12:function(){var $0=this.elements;return ($0.length>0)?$0[0].value:null;},$13:function(){var $0=this.elements;for(var $1=0;$1<$0.length;$1++){var $2=$0[$1];$2['__MVC_HasValidationFired'] = true;}},$14:function(){if(!this.$A.length){this.$C();}else{this.$B();}},validate:function(eventName){var $0=this.validations;var $1=[];var $2=this.$12();for(var $3=0;$3<$0.length;$3++){var $4=$0[$3];var $5=Sys.Mvc.$create_ValidationContext();$5.eventName=eventName;$5.fieldContext=this;$5.validation=$4;var $6=$4.validator($2,$5);var $7=this.$11($6,$4.fieldErrorMessage);if(!Sys.Mvc._ValidationUtil.$1($7)){Array.add($1,$7);}}this.$13();this.clearErrors();this.addErrors($1);return $1;}} -Sys.Mvc.RangeValidator=function(minimum,maximum){this.$0=minimum;this.$1=maximum;} -Sys.Mvc.RangeValidator.create=function(rule){var $0=rule.ValidationParameters['min'];var $1=rule.ValidationParameters['max'];return Function.createDelegate(new Sys.Mvc.RangeValidator($0,$1),new Sys.Mvc.RangeValidator($0,$1).validate);} -Sys.Mvc.RangeValidator.prototype={$0:null,$1:null,validate:function(value,context){if(Sys.Mvc._ValidationUtil.$1(value)){return true;}var $0=Number.parseLocale(value);return (!isNaN($0)&&this.$0<=$0&&$0<=this.$1);}} -Sys.Mvc.RegularExpressionValidator=function(pattern){this.$0=pattern;} -Sys.Mvc.RegularExpressionValidator.create=function(rule){var $0=rule.ValidationParameters['pattern'];return Function.createDelegate(new Sys.Mvc.RegularExpressionValidator($0),new Sys.Mvc.RegularExpressionValidator($0).validate);} -Sys.Mvc.RegularExpressionValidator.prototype={$0:null,validate:function(value,context){if(Sys.Mvc._ValidationUtil.$1(value)){return true;}var $0=new RegExp(this.$0);var $1=$0.exec(value);return (!Sys.Mvc._ValidationUtil.$0($1)&&$1[0].length===value.length);}} -Sys.Mvc.RequiredValidator=function(){} -Sys.Mvc.RequiredValidator.create=function(rule){return Function.createDelegate(new Sys.Mvc.RequiredValidator(),new Sys.Mvc.RequiredValidator().validate);} -Sys.Mvc.RequiredValidator.$0=function($p0){if($p0.tagName.toUpperCase()==='INPUT'){var $0=($p0.type).toUpperCase();if($0==='RADIO'){return true;}}return false;} -Sys.Mvc.RequiredValidator.$1=function($p0){if($p0.tagName.toUpperCase()==='SELECT'){return true;}return false;} -Sys.Mvc.RequiredValidator.$2=function($p0){if($p0.tagName.toUpperCase()==='INPUT'){var $0=($p0.type).toUpperCase();switch($0){case 'TEXT':case 'PASSWORD':case 'FILE':return true;}}if($p0.tagName.toUpperCase()==='TEXTAREA'){return true;}return false;} -Sys.Mvc.RequiredValidator.$3=function($p0){for(var $0=0;$0<$p0.length;$0++){var $1=$p0[$0];if($1.checked){return true;}}return false;} -Sys.Mvc.RequiredValidator.$4=function($p0){for(var $0=0;$0<$p0.length;$0++){var $1=$p0[$0];if($1.selected){if(!Sys.Mvc._ValidationUtil.$1($1.value)){return true;}}}return false;} -Sys.Mvc.RequiredValidator.$5=function($p0){return (!Sys.Mvc._ValidationUtil.$1($p0.value));} -Sys.Mvc.RequiredValidator.prototype={validate:function(value,context){var $0=context.fieldContext.elements;if(!$0.length){return true;}var $1=$0[0];if(Sys.Mvc.RequiredValidator.$2($1)){return Sys.Mvc.RequiredValidator.$5($1);}if(Sys.Mvc.RequiredValidator.$0($1)){return Sys.Mvc.RequiredValidator.$3($0);}if(Sys.Mvc.RequiredValidator.$1($1)){return Sys.Mvc.RequiredValidator.$4(($1).options);}return true;}} -Sys.Mvc.StringLengthValidator=function(minLength,maxLength){this.$1=minLength;this.$0=maxLength;} -Sys.Mvc.StringLengthValidator.create=function(rule){var $0=(rule.ValidationParameters['min']||0);var $1=(rule.ValidationParameters['max']||Number.MAX_VALUE);return Function.createDelegate(new Sys.Mvc.StringLengthValidator($0,$1),new Sys.Mvc.StringLengthValidator($0,$1).validate);} -Sys.Mvc.StringLengthValidator.prototype={$0:0,$1:0,validate:function(value,context){if(Sys.Mvc._ValidationUtil.$1(value)){return true;}return (this.$1<=value.length&&value.length<=this.$0);}} -Sys.Mvc._ValidationUtil=function(){} -Sys.Mvc._ValidationUtil.$0=function($p0){return (!$p0||!$p0.length);} -Sys.Mvc._ValidationUtil.$1=function($p0){return (!$p0||!$p0.length);} -Sys.Mvc._ValidationUtil.$2=function($p0,$p1){return ($p1 in $p0);} -Sys.Mvc._ValidationUtil.$3=function($p0){while($p0.firstChild){$p0.removeChild($p0.firstChild);}} -Sys.Mvc._ValidationUtil.$4=function($p0,$p1){var $0=document.createTextNode($p1);Sys.Mvc._ValidationUtil.$3($p0);$p0.appendChild($0);} -Sys.Mvc.ValidatorRegistry=function(){} -Sys.Mvc.ValidatorRegistry.getValidator=function(rule){var $0=Sys.Mvc.ValidatorRegistry.validators[rule.ValidationType];return ($0)?$0(rule):null;} -Sys.Mvc.ValidatorRegistry.$0=function(){return {required:Function.createDelegate(null,Sys.Mvc.RequiredValidator.create),length:Function.createDelegate(null,Sys.Mvc.StringLengthValidator.create),regex:Function.createDelegate(null,Sys.Mvc.RegularExpressionValidator.create),range:Function.createDelegate(null,Sys.Mvc.RangeValidator.create),number:Function.createDelegate(null,Sys.Mvc.NumberValidator.create)};} -Sys.Mvc.NumberValidator.registerClass('Sys.Mvc.NumberValidator');Sys.Mvc.FormContext.registerClass('Sys.Mvc.FormContext');Sys.Mvc.FieldContext.registerClass('Sys.Mvc.FieldContext');Sys.Mvc.RangeValidator.registerClass('Sys.Mvc.RangeValidator');Sys.Mvc.RegularExpressionValidator.registerClass('Sys.Mvc.RegularExpressionValidator');Sys.Mvc.RequiredValidator.registerClass('Sys.Mvc.RequiredValidator');Sys.Mvc.StringLengthValidator.registerClass('Sys.Mvc.StringLengthValidator');Sys.Mvc._ValidationUtil.registerClass('Sys.Mvc._ValidationUtil');Sys.Mvc.ValidatorRegistry.registerClass('Sys.Mvc.ValidatorRegistry');Sys.Mvc.ValidatorRegistry.validators=Sys.Mvc.ValidatorRegistry.$0(); -// ---- Do not remove this footer ---- -// Generated using Script# v0.5.0.0 (http://projects.nikhilk.net) -// ----------------------------------- -Sys.Application.add_load(function(){Sys.Application.remove_load(arguments.callee);Sys.Mvc.FormContext._Application_Load();}); \ No newline at end of file diff --git a/NzbDrone.Web/Scripts2/bootstrap-mvc.js b/NzbDrone.Web/Scripts2/bootstrap-mvc.js deleted file mode 100644 index 154339b3a..000000000 --- a/NzbDrone.Web/Scripts2/bootstrap-mvc.js +++ /dev/null @@ -1,33 +0,0 @@ - -jQuery(document).ready(function ($) { - - $('span.field-validation-valid, span.field-validation-error').each(function () { - $(this).addClass('help-inline'); - }); - - $("button, input[type='submit'],input[type='button']").each(function () { - $(this).addClass('btn btn-madmin'); - }); - - $(".btn").each(function () { - $(this).addClass('btn-madmin'); - }); - - $("input[type='submit']").each(function () { - $(this).addClass('btn-primary btn-large'); - }); - - $('.validation-summary-errors').livequery(function () { - $(this).addClass('alert alert-error'); - }); - - $('.field-validation-error').livequery(function () { - $('.control-group').each(function () { - if ($(this).find('span.field-validation-error').length == 0) { - $(this).removeClass('error'); - } else { - $(this).addClass('error'); - } - }); - }); -}); \ No newline at end of file diff --git a/NzbDrone.Web/Scripts2/jquery-1.8.2.intellisense.js b/NzbDrone.Web/Scripts2/jquery-1.8.2.intellisense.js deleted file mode 100644 index 5514196d2..000000000 --- a/NzbDrone.Web/Scripts2/jquery-1.8.2.intellisense.js +++ /dev/null @@ -1,2494 +0,0 @@ -intellisense.annotate(jQuery, { - 'ajax': function() { - /// - /// Perform an asynchronous HTTP (Ajax) request. - /// A string containing the URL to which the request is sent. - /// A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) below for a complete list of all settings. - /// - /// - /// - /// Perform an asynchronous HTTP (Ajax) request. - /// A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). - /// - /// - }, - 'ajaxPrefilter': function() { - /// - /// Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). - /// An optional string containing one or more space-separated dataTypes - /// A handler to set default values for future Ajax requests. - /// - }, - 'ajaxSetup': function() { - /// - /// Set default values for future Ajax requests. - /// A set of key/value pairs that configure the default Ajax request. All options are optional. - /// - }, - 'boxModel': function() { - /// Deprecated in jQuery 1.3 (see jQuery.support). States if the current page, in the user's browser, is being rendered using the W3C CSS Box Model. - /// - }, - 'browser': function() { - /// Contains flags for the useragent, read from navigator.userAgent. We recommend against using this property; please try to use feature detection instead (see jQuery.support). jQuery.browser may be moved to a plugin in a future release of jQuery. - /// - }, - 'browser.version': function() { - /// The version number of the rendering engine for the user's browser. - /// - }, - 'Callbacks': function() { - /// - /// A multi-purpose callbacks list object that provides a powerful way to manage callback lists. - /// An optional list of space-separated flags that change how the callback list behaves. - /// - }, - 'contains': function() { - /// - /// Check to see if a DOM element is within another DOM element. - /// The DOM element that may contain the other element. - /// The DOM element that may be contained by the other element. - /// - /// - }, - 'cssHooks': function() { - /// Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. - /// - }, - 'data': function() { - /// - /// Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. - /// The DOM element to query for the data. - /// Name of the data stored. - /// - /// - /// - /// Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. - /// The DOM element to query for the data. - /// - /// - }, - 'dequeue': function() { - /// - /// Execute the next function on the queue for the matched element. - /// A DOM element from which to remove and execute a queued function. - /// A string containing the name of the queue. Defaults to fx, the standard effects queue. - /// - }, - 'each': function() { - /// - /// A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - /// The object or array to iterate over. - /// The function that will be executed on every object. - /// - /// - }, - 'error': function() { - /// - /// Takes a string and throws an exception containing it. - /// The message to send out. - /// - }, - 'extend': function() { - /// - /// Merge the contents of two or more objects together into the first object. - /// An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument. - /// An object containing additional properties to merge in. - /// Additional objects containing properties to merge in. - /// - /// - /// - /// Merge the contents of two or more objects together into the first object. - /// If true, the merge becomes recursive (aka. deep copy). - /// The object to extend. It will receive the new properties. - /// An object containing additional properties to merge in. - /// Additional objects containing properties to merge in. - /// - /// - }, - 'get': function() { - /// - /// Load data from the server using a HTTP GET request. - /// A string containing the URL to which the request is sent. - /// A map or string that is sent to the server with the request. - /// A callback function that is executed if the request succeeds. - /// The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). - /// - /// - }, - 'getJSON': function() { - /// - /// Load JSON-encoded data from the server using a GET HTTP request. - /// A string containing the URL to which the request is sent. - /// A map or string that is sent to the server with the request. - /// A callback function that is executed if the request succeeds. - /// - /// - }, - 'getScript': function() { - /// - /// Load a JavaScript file from the server using a GET HTTP request, then execute it. - /// A string containing the URL to which the request is sent. - /// A callback function that is executed if the request succeeds. - /// - /// - }, - 'globalEval': function() { - /// - /// Execute some JavaScript code globally. - /// The JavaScript code to execute. - /// - }, - 'grep': function() { - /// - /// Finds the elements of an array which satisfy a filter function. The original array is not affected. - /// The array to search through. - /// The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object. - /// If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false. - /// - /// - }, - 'hasData': function() { - /// - /// Determine whether an element has any jQuery data associated with it. - /// A DOM element to be checked for data. - /// - /// - }, - 'holdReady': function() { - /// - /// Holds or releases the execution of jQuery's ready event. - /// Indicates whether the ready hold is being requested or released - /// - }, - 'inArray': function() { - /// - /// Search for a specified value within an array and return its index (or -1 if not found). - /// The value to search for. - /// An array through which to search. - /// The index of the array at which to begin the search. The default is 0, which will search the whole array. - /// - /// - }, - 'isArray': function() { - /// - /// Determine whether the argument is an array. - /// Object to test whether or not it is an array. - /// - /// - }, - 'isEmptyObject': function() { - /// - /// Check to see if an object is empty (contains no properties). - /// The object that will be checked to see if it's empty. - /// - /// - }, - 'isFunction': function() { - /// - /// Determine if the argument passed is a Javascript function object. - /// Object to test whether or not it is a function. - /// - /// - }, - 'isNumeric': function() { - /// - /// Determines whether its argument is a number. - /// The value to be tested. - /// - /// - }, - 'isPlainObject': function() { - /// - /// Check to see if an object is a plain object (created using "{}" or "new Object"). - /// The object that will be checked to see if it's a plain object. - /// - /// - }, - 'isWindow': function() { - /// - /// Determine whether the argument is a window. - /// Object to test whether or not it is a window. - /// - /// - }, - 'isXMLDoc': function() { - /// - /// Check to see if a DOM node is within an XML document (or is an XML document). - /// The DOM node that will be checked to see if it's in an XML document. - /// - /// - }, - 'makeArray': function() { - /// - /// Convert an array-like object into a true JavaScript array. - /// Any object to turn into a native Array. - /// - /// - }, - 'map': function() { - /// - /// Translate all items in an array or object to new array of items. - /// The Array to translate. - /// The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object. - /// - /// - /// - /// Translate all items in an array or object to new array of items. - /// The Array or Object to translate. - /// The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. - /// - /// - }, - 'merge': function() { - /// - /// Merge the contents of two arrays together into the first array. - /// The first array to merge, the elements of second added. - /// The second array to merge into the first, unaltered. - /// - /// - }, - 'noConflict': function() { - /// - /// Relinquish jQuery's control of the $ variable. - /// A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). - /// - /// - }, - 'noop': function() { - /// An empty function. - /// - }, - 'now': function() { - /// Return a number representing the current time. - /// - }, - 'param': function() { - /// - /// Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - /// An array or object to serialize. - /// - /// - /// - /// Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - /// An array or object to serialize. - /// A Boolean indicating whether to perform a traditional "shallow" serialization. - /// - /// - }, - 'parseJSON': function() { - /// - /// Takes a well-formed JSON string and returns the resulting JavaScript object. - /// The JSON string to parse. - /// - /// - }, - 'parseXML': function() { - /// - /// Parses a string into an XML document. - /// a well-formed XML string to be parsed - /// - /// - }, - 'post': function() { - /// - /// Load data from the server using a HTTP POST request. - /// A string containing the URL to which the request is sent. - /// A map or string that is sent to the server with the request. - /// A callback function that is executed if the request succeeds. - /// The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - /// - /// - }, - 'proxy': function() { - /// - /// Takes a function and returns a new one that will always have a particular context. - /// The function whose context will be changed. - /// The object to which the context (this) of the function should be set. - /// - /// - /// - /// Takes a function and returns a new one that will always have a particular context. - /// The object to which the context of the function should be set. - /// The name of the function whose context will be changed (should be a property of the context object). - /// - /// - }, - 'queue': function() { - /// - /// Manipulate the queue of functions to be executed on the matched element. - /// A DOM element where the array of queued functions is attached. - /// A string containing the name of the queue. Defaults to fx, the standard effects queue. - /// An array of functions to replace the current queue contents. - /// - /// - /// - /// Manipulate the queue of functions to be executed on the matched element. - /// A DOM element on which to add a queued function. - /// A string containing the name of the queue. Defaults to fx, the standard effects queue. - /// The new function to add to the queue. - /// - /// - }, - 'removeData': function() { - /// - /// Remove a previously-stored piece of data. - /// A DOM element from which to remove data. - /// A string naming the piece of data to remove. - /// - /// - }, - 'sub': function() { - /// Creates a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object. - /// - }, - 'support': function() { - /// A collection of properties that represent the presence of different browser features or bugs. Primarily intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. - /// - }, - 'trim': function() { - /// - /// Remove the whitespace from the beginning and end of a string. - /// The string to trim. - /// - /// - }, - 'type': function() { - /// - /// Determine the internal JavaScript [[Class]] of an object. - /// Object to get the internal JavaScript [[Class]] of. - /// - /// - }, - 'unique': function() { - /// - /// Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. - /// The Array of DOM elements. - /// - /// - }, - 'when': function() { - /// - /// Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. - /// One or more Deferred objects, or plain JavaScript objects. - /// - /// - }, -}); - -var _1228819969 = jQuery.Callbacks; -jQuery.Callbacks = function(flags) { -var _object = _1228819969(flags); -intellisense.annotate(_object, { - 'add': function() { - /// - /// Add a callback or a collection of callbacks to a callback list. - /// A function, or array of functions, that are to be added to the callback list. - /// - }, - 'disable': function() { - /// Disable a callback list from doing anything more. - }, - 'empty': function() { - /// Remove all of the callbacks from a list. - }, - 'fire': function() { - /// - /// Call all of the callbacks with the given arguments - /// The argument or list of arguments to pass back to the callback list. - /// - }, - 'fired': function() { - /// Determine if the callbacks have already been called at least once. - /// - }, - 'fireWith': function() { - /// - /// Call all callbacks in a list with the given context and arguments. - /// A reference to the context in which the callbacks in the list should be fired. - /// An argument, or array of arguments, to pass to the callbacks in the list. - /// - }, - 'has': function() { - /// - /// Determine whether a supplied callback is in a list - /// The callback to search for. - /// - /// - }, - 'lock': function() { - /// Lock a callback list in its current state. - }, - 'locked': function() { - /// Determine if the callbacks list has been locked. - /// - }, - 'remove': function() { - /// - /// Remove a callback or a collection of callbacks from a callback list. - /// A function, or array of functions, that are to be removed from the callback list. - /// - }, -}); - -return _object; -}; -intellisense.redirectDefinition(jQuery.Callbacks, _1228819969); - -var _731531622 = jQuery.Deferred; -jQuery.Deferred = function(func) { -var _object = _731531622(func); -intellisense.annotate(_object, { - 'always': function() { - /// - /// Add handlers to be called when the Deferred object is either resolved or rejected. - /// A function, or array of functions, that is called when the Deferred is resolved or rejected. - /// Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - /// - /// - }, - 'done': function() { - /// - /// Add handlers to be called when the Deferred object is resolved. - /// A function, or array of functions, that are called when the Deferred is resolved. - /// Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - /// - /// - }, - 'fail': function() { - /// - /// Add handlers to be called when the Deferred object is rejected. - /// A function, or array of functions, that are called when the Deferred is rejected. - /// Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - /// - /// - }, - 'isRejected': function() { - /// Determine whether a Deferred object has been rejected. - /// - }, - 'isResolved': function() { - /// Determine whether a Deferred object has been resolved. - /// - }, - 'notify': function() { - /// - /// Call the progressCallbacks on a Deferred object with the given args. - /// Optional arguments that are passed to the progressCallbacks. - /// - /// - }, - 'notifyWith': function() { - /// - /// Call the progressCallbacks on a Deferred object with the given context and args. - /// Context passed to the progressCallbacks as the this object. - /// Optional arguments that are passed to the progressCallbacks. - /// - /// - }, - 'pipe': function() { - /// - /// Utility method to filter and/or chain Deferreds. - /// An optional function that is called when the Deferred is resolved. - /// An optional function that is called when the Deferred is rejected. - /// - /// - /// - /// Utility method to filter and/or chain Deferreds. - /// An optional function that is called when the Deferred is resolved. - /// An optional function that is called when the Deferred is rejected. - /// An optional function that is called when progress notifications are sent to the Deferred. - /// - /// - }, - 'progress': function() { - /// - /// Add handlers to be called when the Deferred object generates progress notifications. - /// A function, or array of functions, that is called when the Deferred generates progress notifications. - /// - /// - }, - 'promise': function() { - /// - /// Return a Deferred's Promise object. - /// Object onto which the promise methods have to be attached - /// - /// - }, - 'reject': function() { - /// - /// Reject a Deferred object and call any failCallbacks with the given args. - /// Optional arguments that are passed to the failCallbacks. - /// - /// - }, - 'rejectWith': function() { - /// - /// Reject a Deferred object and call any failCallbacks with the given context and args. - /// Context passed to the failCallbacks as the this object. - /// An optional array of arguments that are passed to the failCallbacks. - /// - /// - }, - 'resolve': function() { - /// - /// Resolve a Deferred object and call any doneCallbacks with the given args. - /// Optional arguments that are passed to the doneCallbacks. - /// - /// - }, - 'resolveWith': function() { - /// - /// Resolve a Deferred object and call any doneCallbacks with the given context and args. - /// Context passed to the doneCallbacks as the this object. - /// An optional array of arguments that are passed to the doneCallbacks. - /// - /// - }, - 'state': function() { - /// Determine the current state of a Deferred object. - /// - }, - 'then': function() { - /// - /// Add handlers to be called when the Deferred object is resolved or rejected. - /// A function, or array of functions, called when the Deferred is resolved. - /// A function, or array of functions, called when the Deferred is rejected. - /// - /// - /// - /// Add handlers to be called when the Deferred object is resolved or rejected. - /// A function, or array of functions, called when the Deferred is resolved. - /// A function, or array of functions, called when the Deferred is rejected. - /// A function, or array of functions, called when the Deferred notifies progress. - /// - /// - }, -}); - -return _object; -}; -intellisense.redirectDefinition(jQuery.Callbacks, _731531622); - -intellisense.annotate(jQuery.Event.prototype, { - 'currentTarget': function() { - /// The current DOM element within the event bubbling phase. - /// - }, - 'data': function() { - /// An optional data map passed to an event method when the current executing handler is bound. - }, - 'delegateTarget': function() { - /// The element where the currently-called jQuery event handler was attached. - /// - }, - 'isDefaultPrevented': function() { - /// Returns whether event.preventDefault() was ever called on this event object. - /// - }, - 'isImmediatePropagationStopped': function() { - /// Returns whether event.stopImmediatePropagation() was ever called on this event object. - /// - }, - 'isPropagationStopped': function() { - /// Returns whether event.stopPropagation() was ever called on this event object. - /// - }, - 'namespace': function() { - /// The namespace specified when the event was triggered. - /// - }, - 'pageX': function() { - /// The mouse position relative to the left edge of the document. - /// - }, - 'pageY': function() { - /// The mouse position relative to the top edge of the document. - /// - }, - 'preventDefault': function() { - /// If this method is called, the default action of the event will not be triggered. - }, - 'relatedTarget': function() { - /// The other DOM element involved in the event, if any. - /// - }, - 'result': function() { - /// The last value returned by an event handler that was triggered by this event, unless the value was undefined. - /// - }, - 'stopImmediatePropagation': function() { - /// Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree. - }, - 'stopPropagation': function() { - /// Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. - }, - 'target': function() { - /// The DOM element that initiated the event. - /// - }, - 'timeStamp': function() { - /// The difference in milliseconds between the time the browser created the event and January 1, 1970. - /// - }, - 'type': function() { - /// Describes the nature of the event. - /// - }, - 'which': function() { - /// For key or mouse events, this property indicates the specific key or button that was pressed. - /// - }, -}); - -intellisense.annotate(jQuery.fn, { - 'add': function() { - /// - /// Add elements to the set of matched elements. - /// A string representing a selector expression to find additional elements to add to the set of matched elements. - /// - /// - /// - /// Add elements to the set of matched elements. - /// One or more elements to add to the set of matched elements. - /// - /// - /// - /// Add elements to the set of matched elements. - /// An HTML fragment to add to the set of matched elements. - /// - /// - /// - /// Add elements to the set of matched elements. - /// An existing jQuery object to add to the set of matched elements. - /// - /// - /// - /// Add elements to the set of matched elements. - /// A string representing a selector expression to find additional elements to add to the set of matched elements. - /// The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method. - /// - /// - }, - 'addClass': function() { - /// - /// Adds the specified class(es) to each of the set of matched elements. - /// One or more class names to be added to the class attribute of each matched element. - /// - /// - /// - /// Adds the specified class(es) to each of the set of matched elements. - /// A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. - /// - /// - }, - 'after': function() { - /// - /// Insert content, specified by the parameter, after each element in the set of matched elements. - /// HTML string, DOM element, or jQuery object to insert after each element in the set of matched elements. - /// One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. - /// - /// - /// - /// Insert content, specified by the parameter, after each element in the set of matched elements. - /// A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - /// - /// - }, - 'ajaxComplete': function() { - /// - /// Register a handler to be called when Ajax requests complete. This is an Ajax Event. - /// The function to be invoked. - /// - /// - }, - 'ajaxError': function() { - /// - /// Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. - /// The function to be invoked. - /// - /// - }, - 'ajaxSend': function() { - /// - /// Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. - /// The function to be invoked. - /// - /// - }, - 'ajaxStart': function() { - /// - /// Register a handler to be called when the first Ajax request begins. This is an Ajax Event. - /// The function to be invoked. - /// - /// - }, - 'ajaxStop': function() { - /// - /// Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. - /// The function to be invoked. - /// - /// - }, - 'ajaxSuccess': function() { - /// - /// Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. - /// The function to be invoked. - /// - /// - }, - 'all': function() { - /// Selects all elements. - }, - 'andSelf': function() { - /// Add the previous set of elements on the stack to the current set. - /// - }, - 'animate': function() { - /// - /// Perform a custom animation of a set of CSS properties. - /// A map of CSS properties that the animation will move toward. - /// A string or number determining how long the animation will run. - /// A string indicating which easing function to use for the transition. - /// A function to call once the animation is complete. - /// - /// - /// - /// Perform a custom animation of a set of CSS properties. - /// A map of CSS properties that the animation will move toward. - /// A map of additional options to pass to the method. Supported keys: duration: A string or number determining how long the animation will run.easing: A string indicating which easing function to use for the transition.complete: A function to call once the animation is complete.step: A function to be called after each step of the animation.queue: A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string.specialEasing: A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions (added 1.4). - /// - /// - }, - 'animated': function() { - /// Select all elements that are in the progress of an animation at the time the selector is run. - }, - 'append': function() { - /// - /// Insert content, specified by the parameter, to the end of each element in the set of matched elements. - /// DOM element, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. - /// One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. - /// - /// - /// - /// Insert content, specified by the parameter, to the end of each element in the set of matched elements. - /// A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. - /// - /// - }, - 'appendTo': function() { - /// - /// Insert every element in the set of matched elements to the end of the target. - /// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. - /// - /// - }, - 'attr': function() { - /// - /// Set one or more attributes for the set of matched elements. - /// The name of the attribute to set. - /// A value to set for the attribute. - /// - /// - /// - /// Set one or more attributes for the set of matched elements. - /// A map of attribute-value pairs to set. - /// - /// - /// - /// Set one or more attributes for the set of matched elements. - /// The name of the attribute to set. - /// A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments. - /// - /// - }, - 'attributeContains': function() { - /// - /// Selects elements that have the specified attribute with a value containing the a given substring. - /// An attribute name. - /// An attribute value. Can be either an unquoted single word or a quoted string. - /// - }, - 'attributeContainsPrefix': function() { - /// - /// Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-). - /// An attribute name. - /// An attribute value. Can be either an unquoted single word or a quoted string. - /// - }, - 'attributeContainsWord': function() { - /// - /// Selects elements that have the specified attribute with a value containing a given word, delimited by spaces. - /// An attribute name. - /// An attribute value. Can be either an unquoted single word or a quoted string. - /// - }, - 'attributeEndsWith': function() { - /// - /// Selects elements that have the specified attribute with a value ending exactly with a given string. The comparison is case sensitive. - /// An attribute name. - /// An attribute value. Can be either an unquoted single word or a quoted string. - /// - }, - 'attributeEquals': function() { - /// - /// Selects elements that have the specified attribute with a value exactly equal to a certain value. - /// An attribute name. - /// An attribute value. Can be either an unquoted single word or a quoted string. - /// - }, - 'attributeHas': function() { - /// - /// Selects elements that have the specified attribute, with any value. - /// An attribute name. - /// - }, - 'attributeMultiple': function() { - /// - /// Matches elements that match all of the specified attribute filters. - /// An attribute filter. - /// Another attribute filter, reducing the selection even more - /// As many more attribute filters as necessary - /// - }, - 'attributeNotEqual': function() { - /// - /// Select elements that either don't have the specified attribute, or do have the specified attribute but not with a certain value. - /// An attribute name. - /// An attribute value. Can be either an unquoted single word or a quoted string. - /// - }, - 'attributeStartsWith': function() { - /// - /// Selects elements that have the specified attribute with a value beginning exactly with a given string. - /// An attribute name. - /// An attribute value. Can be either an unquoted single word or a quoted string. - /// - }, - 'before': function() { - /// - /// Insert content, specified by the parameter, before each element in the set of matched elements. - /// HTML string, DOM element, or jQuery object to insert before each element in the set of matched elements. - /// One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. - /// - /// - /// - /// Insert content, specified by the parameter, before each element in the set of matched elements. - /// A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - /// - /// - }, - 'bind': function() { - /// - /// Attach a handler to an event for the elements. - /// A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Attach a handler to an event for the elements. - /// A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - /// A map of data that will be passed to the event handler. - /// Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. - /// - /// - /// - /// Attach a handler to an event for the elements. - /// A map of one or more DOM event types and functions to execute for them. - /// - /// - }, - 'blur': function() { - /// - /// Bind an event handler to the "blur" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "blur" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'button': function() { - /// Selects all button elements and elements of type button. - }, - 'change': function() { - /// - /// Bind an event handler to the "change" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "change" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'checkbox': function() { - /// Selects all elements of type checkbox. - }, - 'checked': function() { - /// Matches all elements that are checked. - }, - 'child': function() { - /// - /// Selects all direct child elements specified by "child" of elements specified by "parent". - /// Any valid selector. - /// A selector to filter the child elements. - /// - }, - 'children': function() { - /// - /// Get the children of each element in the set of matched elements, optionally filtered by a selector. - /// A string containing a selector expression to match elements against. - /// - /// - }, - 'class': function() { - /// - /// Selects all elements with the given class. - /// A class to search for. An element can have multiple classes; only one of them must match. - /// - }, - 'clearQueue': function() { - /// - /// Remove from the queue all items that have not yet been run. - /// A string containing the name of the queue. Defaults to fx, the standard effects queue. - /// - /// - }, - 'click': function() { - /// - /// Bind an event handler to the "click" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "click" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'clone': function() { - /// - /// Create a deep copy of the set of matched elements. - /// A Boolean indicating whether event handlers should be copied along with the elements. As of jQuery 1.4, element data will be copied as well. - /// - /// - /// - /// Create a deep copy of the set of matched elements. - /// A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. *In jQuery 1.5.0 the default value was incorrectly true; it was changed back to false in 1.5.1 and up. - /// A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false). - /// - /// - }, - 'closest': function() { - /// - /// Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree. - /// A string containing a selector expression to match elements against. - /// - /// - /// - /// Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree. - /// A string containing a selector expression to match elements against. - /// A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. - /// - /// - /// - /// Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree. - /// A jQuery object to match elements against. - /// - /// - /// - /// Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree. - /// An element to match elements against. - /// - /// - }, - 'contains': function() { - /// - /// Select all elements that contain the specified text. - /// A string of text to look for. It's case sensitive. - /// - }, - 'contents': function() { - /// Get the children of each element in the set of matched elements, including text and comment nodes. - /// - }, - 'context': function() { - /// The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. - /// - }, - 'css': function() { - /// - /// Set one or more CSS properties for the set of matched elements. - /// A CSS property name. - /// A value to set for the property. - /// - /// - /// - /// Set one or more CSS properties for the set of matched elements. - /// A CSS property name. - /// A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - /// - /// - /// - /// Set one or more CSS properties for the set of matched elements. - /// A map of property-value pairs to set. - /// - /// - }, - 'data': function() { - /// - /// Store arbitrary data associated with the matched elements. - /// A string naming the piece of data to set. - /// The new data value; it can be any Javascript type including Array or Object. - /// - /// - /// - /// Store arbitrary data associated with the matched elements. - /// An object of key-value pairs of data to update. - /// - /// - }, - 'dblclick': function() { - /// - /// Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'delay': function() { - /// - /// Set a timer to delay execution of subsequent items in the queue. - /// An integer indicating the number of milliseconds to delay execution of the next item in the queue. - /// A string containing the name of the queue. Defaults to fx, the standard effects queue. - /// - /// - }, - 'delegate': function() { - /// - /// Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. - /// A selector to filter the elements that trigger the event. - /// A string containing one or more space-separated JavaScript event types, such as "click" or "keydown," or custom event names. - /// A function to execute at the time the event is triggered. - /// - /// - /// - /// Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. - /// A selector to filter the elements that trigger the event. - /// A string containing one or more space-separated JavaScript event types, such as "click" or "keydown," or custom event names. - /// A map of data that will be passed to the event handler. - /// A function to execute at the time the event is triggered. - /// - /// - /// - /// Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. - /// A selector to filter the elements that trigger the event. - /// A map of one or more event types and functions to execute for them. - /// - /// - }, - 'dequeue': function() { - /// - /// Execute the next function on the queue for the matched elements. - /// A string containing the name of the queue. Defaults to fx, the standard effects queue. - /// - /// - }, - 'descendant': function() { - /// - /// Selects all elements that are descendants of a given ancestor. - /// Any valid selector. - /// A selector to filter the descendant elements. - /// - }, - 'detach': function() { - /// - /// Remove the set of matched elements from the DOM. - /// A selector expression that filters the set of matched elements to be removed. - /// - /// - }, - 'die': function() { - /// - /// Remove an event handler previously attached using .live() from the elements. - /// A string containing a JavaScript event type, such as click or keydown. - /// The function that is no longer to be executed. - /// - /// - /// - /// Remove an event handler previously attached using .live() from the elements. - /// A map of one or more event types, such as click or keydown and their corresponding functions that are no longer to be executed. - /// - /// - }, - 'disabled': function() { - /// Selects all elements that are disabled. - }, - 'each': function() { - /// - /// Iterate over a jQuery object, executing a function for each matched element. - /// A function to execute for each matched element. - /// - /// - }, - 'element': function() { - /// - /// Selects all elements with the given tag name. - /// An element to search for. Refers to the tagName of DOM nodes. - /// - }, - 'empty': function() { - /// Select all elements that have no children (including text nodes). - }, - 'enabled': function() { - /// Selects all elements that are enabled. - }, - 'end': function() { - /// End the most recent filtering operation in the current chain and return the set of matched elements to its previous state. - /// - }, - 'eq': function() { - /// - /// Reduce the set of matched elements to the one at the specified index. - /// An integer indicating the 0-based position of the element. - /// - /// - /// - /// Reduce the set of matched elements to the one at the specified index. - /// An integer indicating the position of the element, counting backwards from the last element in the set. - /// - /// - }, - 'error': function() { - /// - /// Bind an event handler to the "error" JavaScript event. - /// A function to execute when the event is triggered. - /// - /// - /// - /// Bind an event handler to the "error" JavaScript event. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'even': function() { - /// Selects even elements, zero-indexed. See also odd. - }, - 'fadeIn': function() { - /// - /// Display the matched elements by fading them to opaque. - /// A string or number determining how long the animation will run. - /// A function to call once the animation is complete. - /// - /// - /// - /// Display the matched elements by fading them to opaque. - /// A string or number determining how long the animation will run. - /// A string indicating which easing function to use for the transition. - /// A function to call once the animation is complete. - /// - /// - }, - 'fadeOut': function() { - /// - /// Hide the matched elements by fading them to transparent. - /// A string or number determining how long the animation will run. - /// A function to call once the animation is complete. - /// - /// - /// - /// Hide the matched elements by fading them to transparent. - /// A string or number determining how long the animation will run. - /// A string indicating which easing function to use for the transition. - /// A function to call once the animation is complete. - /// - /// - }, - 'fadeTo': function() { - /// - /// Adjust the opacity of the matched elements. - /// A string or number determining how long the animation will run. - /// A number between 0 and 1 denoting the target opacity. - /// A function to call once the animation is complete. - /// - /// - /// - /// Adjust the opacity of the matched elements. - /// A string or number determining how long the animation will run. - /// A number between 0 and 1 denoting the target opacity. - /// A string indicating which easing function to use for the transition. - /// A function to call once the animation is complete. - /// - /// - }, - 'fadeToggle': function() { - /// - /// Display or hide the matched elements by animating their opacity. - /// A string or number determining how long the animation will run. - /// A string indicating which easing function to use for the transition. - /// A function to call once the animation is complete. - /// - /// - }, - 'file': function() { - /// Selects all elements of type file. - }, - 'filter': function() { - /// - /// Reduce the set of matched elements to those that match the selector or pass the function's test. - /// A string containing a selector expression to match the current set of elements against. - /// - /// - /// - /// Reduce the set of matched elements to those that match the selector or pass the function's test. - /// A function used as a test for each element in the set. this is the current DOM element. - /// - /// - /// - /// Reduce the set of matched elements to those that match the selector or pass the function's test. - /// An element to match the current set of elements against. - /// - /// - /// - /// Reduce the set of matched elements to those that match the selector or pass the function's test. - /// An existing jQuery object to match the current set of elements against. - /// - /// - }, - 'find': function() { - /// - /// Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - /// A string containing a selector expression to match elements against. - /// - /// - /// - /// Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - /// A jQuery object to match elements against. - /// - /// - /// - /// Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - /// An element to match elements against. - /// - /// - }, - 'first': function() { - /// Selects the first matched element. - }, - 'first-child': function() { - /// Selects all elements that are the first child of their parent. - }, - 'focus': function() { - /// - /// Bind an event handler to the "focus" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "focus" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'focusin': function() { - /// - /// Bind an event handler to the "focusin" event. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "focusin" event. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'focusout': function() { - /// - /// Bind an event handler to the "focusout" JavaScript event. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "focusout" JavaScript event. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'get': function() { - /// - /// Retrieve the DOM elements matched by the jQuery object. - /// A zero-based integer indicating which element to retrieve. - /// - /// - }, - 'gt': function() { - /// - /// Select all elements at an index greater than index within the matched set. - /// Zero-based index. - /// - }, - 'has': function() { - /// - /// Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - /// A string containing a selector expression to match elements against. - /// - /// - /// - /// Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - /// A DOM element to match elements against. - /// - /// - }, - 'hasClass': function() { - /// - /// Determine whether any of the matched elements are assigned the given class. - /// The class name to search for. - /// - /// - }, - 'header': function() { - /// Selects all elements that are headers, like h1, h2, h3 and so on. - }, - 'height': function() { - /// - /// Set the CSS height of every matched element. - /// An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). - /// - /// - /// - /// Set the CSS height of every matched element. - /// A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. - /// - /// - }, - 'hidden': function() { - /// Selects all elements that are hidden. - }, - 'hide': function() { - /// - /// Hide the matched elements. - /// A string or number determining how long the animation will run. - /// A function to call once the animation is complete. - /// - /// - /// - /// Hide the matched elements. - /// A string or number determining how long the animation will run. - /// A string indicating which easing function to use for the transition. - /// A function to call once the animation is complete. - /// - /// - }, - 'hover': function() { - /// - /// Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. - /// A function to execute when the mouse pointer enters the element. - /// A function to execute when the mouse pointer leaves the element. - /// - /// - }, - 'html': function() { - /// - /// Set the HTML contents of each element in the set of matched elements. - /// A string of HTML to set as the content of each matched element. - /// - /// - /// - /// Set the HTML contents of each element in the set of matched elements. - /// A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. - /// - /// - }, - 'id': function() { - /// - /// Selects a single element with the given id attribute. - /// An ID to search for, specified via the id attribute of an element. - /// - }, - 'image': function() { - /// Selects all elements of type image. - }, - 'index': function() { - /// - /// Search for a given element from among the matched elements. - /// A selector representing a jQuery collection in which to look for an element. - /// - /// - /// - /// Search for a given element from among the matched elements. - /// The DOM element or first element within the jQuery object to look for. - /// - /// - }, - 'init': function() { - /// - /// Accepts a string containing a CSS selector which is then used to match a set of elements. - /// A string containing a selector expression - /// A DOM Element, Document, or jQuery to use as context - /// - /// - /// - /// Accepts a string containing a CSS selector which is then used to match a set of elements. - /// A DOM element to wrap in a jQuery object. - /// - /// - /// - /// Accepts a string containing a CSS selector which is then used to match a set of elements. - /// A plain object to wrap in a jQuery object. - /// - /// - /// - /// Accepts a string containing a CSS selector which is then used to match a set of elements. - /// An array containing a set of DOM elements to wrap in a jQuery object. - /// - /// - /// - /// Accepts a string containing a CSS selector which is then used to match a set of elements. - /// An existing jQuery object to clone. - /// - /// - }, - 'innerHeight': function() { - /// Get the current computed height for the first element in the set of matched elements, including padding but not border. - /// - }, - 'innerWidth': function() { - /// Get the current computed width for the first element in the set of matched elements, including padding but not border. - /// - }, - 'input': function() { - /// Selects all input, textarea, select and button elements. - }, - 'insertAfter': function() { - /// - /// Insert every element in the set of matched elements after the target. - /// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. - /// - /// - }, - 'insertBefore': function() { - /// - /// Insert every element in the set of matched elements before the target. - /// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. - /// - /// - }, - 'is': function() { - /// - /// Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - /// A string containing a selector expression to match elements against. - /// - /// - /// - /// Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - /// A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element. - /// - /// - /// - /// Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - /// An existing jQuery object to match the current set of elements against. - /// - /// - /// - /// Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - /// An element to match the current set of elements against. - /// - /// - }, - 'jquery': function() { - /// A string containing the jQuery version number. - /// - }, - 'keydown': function() { - /// - /// Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'keypress': function() { - /// - /// Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'keyup': function() { - /// - /// Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'last': function() { - /// Selects the last matched element. - }, - 'last-child': function() { - /// Selects all elements that are the last child of their parent. - }, - 'length': function() { - /// The number of elements in the jQuery object. - /// - }, - 'live': function() { - /// - /// Attach an event handler for all elements which match the current selector, now and in the future. - /// A string containing a JavaScript event type, such as "click" or "keydown." As of jQuery 1.4 the string can contain multiple, space-separated event types or custom event names. - /// A function to execute at the time the event is triggered. - /// - /// - /// - /// Attach an event handler for all elements which match the current selector, now and in the future. - /// A string containing a JavaScript event type, such as "click" or "keydown." As of jQuery 1.4 the string can contain multiple, space-separated event types or custom event names. - /// A map of data that will be passed to the event handler. - /// A function to execute at the time the event is triggered. - /// - /// - /// - /// Attach an event handler for all elements which match the current selector, now and in the future. - /// A map of one or more JavaScript event types and functions to execute for them. - /// - /// - }, - 'load': function() { - /// - /// Bind an event handler to the "load" JavaScript event. - /// A function to execute when the event is triggered. - /// - /// - /// - /// Bind an event handler to the "load" JavaScript event. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'lt': function() { - /// - /// Select all elements at an index less than index within the matched set. - /// Zero-based index. - /// - }, - 'map': function() { - /// - /// Pass each element in the current matched set through a function, producing a new jQuery object containing the return values. - /// A function object that will be invoked for each element in the current set. - /// - /// - }, - 'mousedown': function() { - /// - /// Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'mouseenter': function() { - /// - /// Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'mouseleave': function() { - /// - /// Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'mousemove': function() { - /// - /// Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'mouseout': function() { - /// - /// Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'mouseover': function() { - /// - /// Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'mouseup': function() { - /// - /// Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'multiple': function() { - /// - /// Selects the combined results of all the specified selectors. - /// Any valid selector. - /// Another valid selector. - /// As many more valid selectors as you like. - /// - }, - 'next': function() { - /// - /// Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. - /// A string containing a selector expression to match elements against. - /// - /// - }, - 'next adjacent': function() { - /// - /// Selects all next elements matching "next" that are immediately preceded by a sibling "prev". - /// Any valid selector. - /// A selector to match the element that is next to the first selector. - /// - }, - 'next siblings': function() { - /// - /// Selects all sibling elements that follow after the "prev" element, have the same parent, and match the filtering "siblings" selector. - /// Any valid selector. - /// A selector to filter elements that are the following siblings of the first selector. - /// - }, - 'nextAll': function() { - /// - /// Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. - /// A string containing a selector expression to match elements against. - /// - /// - }, - 'nextUntil': function() { - /// - /// Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - /// A string containing a selector expression to indicate where to stop matching following sibling elements. - /// A string containing a selector expression to match elements against. - /// - /// - /// - /// Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - /// A DOM node or jQuery object indicating where to stop matching following sibling elements. - /// A string containing a selector expression to match elements against. - /// - /// - }, - 'not': function() { - /// - /// Remove elements from the set of matched elements. - /// A string containing a selector expression to match elements against. - /// - /// - /// - /// Remove elements from the set of matched elements. - /// One or more DOM elements to remove from the matched set. - /// - /// - /// - /// Remove elements from the set of matched elements. - /// A function used as a test for each element in the set. this is the current DOM element. - /// - /// - /// - /// Remove elements from the set of matched elements. - /// An existing jQuery object to match the current set of elements against. - /// - /// - }, - 'nth-child': function() { - /// - /// Selects all elements that are the nth-child of their parent. - /// The index of each child to match, starting with 1, the string even or odd, or an equation ( eg. :nth-child(even), :nth-child(4n) ) - /// - }, - 'odd': function() { - /// Selects odd elements, zero-indexed. See also even. - }, - 'off': function() { - /// - /// Remove an event handler. - /// One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - /// A selector which should match the one originally passed to .on() when attaching event handlers. - /// A handler function previously attached for the event(s), or the special value false. - /// - /// - /// - /// Remove an event handler. - /// A map where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s). - /// A selector which should match the one originally passed to .on() when attaching event handlers. - /// - /// - }, - 'offset': function() { - /// - /// Set the current coordinates of every element in the set of matched elements, relative to the document. - /// An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - /// - /// - /// - /// Set the current coordinates of every element in the set of matched elements, relative to the document. - /// A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties. - /// - /// - }, - 'offsetParent': function() { - /// Get the closest ancestor element that is positioned. - /// - }, - 'on': function() { - /// - /// Attach an event handler function for one or more events to the selected elements. - /// One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - /// A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - /// Data to be passed to the handler in event.data when an event is triggered. - /// A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - /// - /// - /// - /// Attach an event handler function for one or more events to the selected elements. - /// A map in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - /// A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. - /// Data to be passed to the handler in event.data when an event occurs. - /// - /// - }, - 'one': function() { - /// - /// Attach a handler to an event for the elements. The handler is executed at most once per element. - /// A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - /// A map of data that will be passed to the event handler. - /// A function to execute at the time the event is triggered. - /// - /// - /// - /// Attach a handler to an event for the elements. The handler is executed at most once per element. - /// One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - /// A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - /// Data to be passed to the handler in event.data when an event is triggered. - /// A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - /// - /// - /// - /// Attach a handler to an event for the elements. The handler is executed at most once per element. - /// A map in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - /// A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. - /// Data to be passed to the handler in event.data when an event occurs. - /// - /// - }, - 'only-child': function() { - /// Selects all elements that are the only child of their parent. - }, - 'outerHeight': function() { - /// - /// Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements. - /// A Boolean indicating whether to include the element's margin in the calculation. - /// - /// - }, - 'outerWidth': function() { - /// - /// Get the current computed width for the first element in the set of matched elements, including padding and border. - /// A Boolean indicating whether to include the element's margin in the calculation. - /// - /// - }, - 'parent': function() { - /// - /// Get the parent of each element in the current set of matched elements, optionally filtered by a selector. - /// A string containing a selector expression to match elements against. - /// - /// - }, - 'parents': function() { - /// - /// Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. - /// A string containing a selector expression to match elements against. - /// - /// - }, - 'parentsUntil': function() { - /// - /// Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - /// A string containing a selector expression to indicate where to stop matching ancestor elements. - /// A string containing a selector expression to match elements against. - /// - /// - /// - /// Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - /// A DOM node or jQuery object indicating where to stop matching ancestor elements. - /// A string containing a selector expression to match elements against. - /// - /// - }, - 'password': function() { - /// Selects all elements of type password. - }, - 'position': function() { - /// Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. - /// - }, - 'prepend': function() { - /// - /// Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - /// DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. - /// One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. - /// - /// - /// - /// Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - /// A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. - /// - /// - }, - 'prependTo': function() { - /// - /// Insert every element in the set of matched elements to the beginning of the target. - /// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. - /// - /// - }, - 'prev': function() { - /// - /// Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector. - /// A string containing a selector expression to match elements against. - /// - /// - }, - 'prevAll': function() { - /// - /// Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. - /// A string containing a selector expression to match elements against. - /// - /// - }, - 'prevUntil': function() { - /// - /// Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - /// A string containing a selector expression to indicate where to stop matching preceding sibling elements. - /// A string containing a selector expression to match elements against. - /// - /// - /// - /// Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - /// A DOM node or jQuery object indicating where to stop matching preceding sibling elements. - /// A string containing a selector expression to match elements against. - /// - /// - }, - 'promise': function() { - /// - /// Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. - /// The type of queue that needs to be observed. - /// Object onto which the promise methods have to be attached - /// - /// - }, - 'prop': function() { - /// - /// Set one or more properties for the set of matched elements. - /// The name of the property to set. - /// A value to set for the property. - /// - /// - /// - /// Set one or more properties for the set of matched elements. - /// A map of property-value pairs to set. - /// - /// - /// - /// Set one or more properties for the set of matched elements. - /// The name of the property to set. - /// A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element. - /// - /// - }, - 'pushStack': function() { - /// - /// Add a collection of DOM elements onto the jQuery stack. - /// An array of elements to push onto the stack and make into a new jQuery object. - /// - /// - /// - /// Add a collection of DOM elements onto the jQuery stack. - /// An array of elements to push onto the stack and make into a new jQuery object. - /// The name of a jQuery method that generated the array of elements. - /// The arguments that were passed in to the jQuery method (for serialization). - /// - /// - }, - 'queue': function() { - /// - /// Manipulate the queue of functions to be executed on the matched elements. - /// A string containing the name of the queue. Defaults to fx, the standard effects queue. - /// An array of functions to replace the current queue contents. - /// - /// - /// - /// Manipulate the queue of functions to be executed on the matched elements. - /// A string containing the name of the queue. Defaults to fx, the standard effects queue. - /// The new function to add to the queue, with a function to call that will dequeue the next item. - /// - /// - }, - 'radio': function() { - /// Selects all elements of type radio. - }, - 'ready': function() { - /// - /// Specify a function to execute when the DOM is fully loaded. - /// A function to execute after the DOM is ready. - /// - /// - }, - 'remove': function() { - /// - /// Remove the set of matched elements from the DOM. - /// A selector expression that filters the set of matched elements to be removed. - /// - /// - }, - 'removeAttr': function() { - /// - /// Remove an attribute from each element in the set of matched elements. - /// An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. - /// - /// - }, - 'removeClass': function() { - /// - /// Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - /// One or more space-separated classes to be removed from the class attribute of each matched element. - /// - /// - /// - /// Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - /// A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments. - /// - /// - }, - 'removeData': function() { - /// - /// Remove a previously-stored piece of data. - /// A string naming the piece of data to delete. - /// - /// - /// - /// Remove a previously-stored piece of data. - /// An array or space-separated string naming the pieces of data to delete. - /// - /// - }, - 'removeProp': function() { - /// - /// Remove a property for the set of matched elements. - /// The name of the property to set. - /// - /// - }, - 'replaceAll': function() { - /// - /// Replace each target element with the set of matched elements. - /// A selector expression indicating which element(s) to replace. - /// - /// - }, - 'replaceWith': function() { - /// - /// Replace each element in the set of matched elements with the provided new content. - /// The content to insert. May be an HTML string, DOM element, or jQuery object. - /// - /// - /// - /// Replace each element in the set of matched elements with the provided new content. - /// A function that returns content with which to replace the set of matched elements. - /// - /// - }, - 'reset': function() { - /// Selects all elements of type reset. - }, - 'resize': function() { - /// - /// Bind an event handler to the "resize" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "resize" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'scroll': function() { - /// - /// Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'scrollLeft': function() { - /// - /// Set the current horizontal position of the scroll bar for each of the set of matched elements. - /// An integer indicating the new position to set the scroll bar to. - /// - /// - }, - 'scrollTop': function() { - /// - /// Set the current vertical position of the scroll bar for each of the set of matched elements. - /// An integer indicating the new position to set the scroll bar to. - /// - /// - }, - 'select': function() { - /// - /// Bind an event handler to the "select" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "select" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'selected': function() { - /// Selects all elements that are selected. - }, - 'serialize': function() { - /// Encode a set of form elements as a string for submission. - /// - }, - 'serializeArray': function() { - /// Encode a set of form elements as an array of names and values. - /// - }, - 'show': function() { - /// - /// Display the matched elements. - /// A string or number determining how long the animation will run. - /// A function to call once the animation is complete. - /// - /// - /// - /// Display the matched elements. - /// A string or number determining how long the animation will run. - /// A string indicating which easing function to use for the transition. - /// A function to call once the animation is complete. - /// - /// - }, - 'siblings': function() { - /// - /// Get the siblings of each element in the set of matched elements, optionally filtered by a selector. - /// A string containing a selector expression to match elements against. - /// - /// - }, - 'size': function() { - /// Return the number of elements in the jQuery object. - /// - }, - 'slice': function() { - /// - /// Reduce the set of matched elements to a subset specified by a range of indices. - /// An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set. - /// An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. - /// - /// - }, - 'slideDown': function() { - /// - /// Display the matched elements with a sliding motion. - /// A string or number determining how long the animation will run. - /// A function to call once the animation is complete. - /// - /// - /// - /// Display the matched elements with a sliding motion. - /// A string or number determining how long the animation will run. - /// A string indicating which easing function to use for the transition. - /// A function to call once the animation is complete. - /// - /// - }, - 'slideToggle': function() { - /// - /// Display or hide the matched elements with a sliding motion. - /// A string or number determining how long the animation will run. - /// A function to call once the animation is complete. - /// - /// - /// - /// Display or hide the matched elements with a sliding motion. - /// A string or number determining how long the animation will run. - /// A string indicating which easing function to use for the transition. - /// A function to call once the animation is complete. - /// - /// - }, - 'slideUp': function() { - /// - /// Hide the matched elements with a sliding motion. - /// A string or number determining how long the animation will run. - /// A function to call once the animation is complete. - /// - /// - /// - /// Hide the matched elements with a sliding motion. - /// A string or number determining how long the animation will run. - /// A string indicating which easing function to use for the transition. - /// A function to call once the animation is complete. - /// - /// - }, - 'stop': function() { - /// - /// Stop the currently-running animation on the matched elements. - /// A Boolean indicating whether to remove queued animation as well. Defaults to false. - /// A Boolean indicating whether to complete the current animation immediately. Defaults to false. - /// - /// - /// - /// Stop the currently-running animation on the matched elements. - /// The name of the queue in which to stop animations. - /// A Boolean indicating whether to remove queued animation as well. Defaults to false. - /// A Boolean indicating whether to complete the current animation immediately. Defaults to false. - /// - /// - }, - 'submit': function() { - /// - /// Bind an event handler to the "submit" JavaScript event, or trigger that event on an element. - /// A function to execute each time the event is triggered. - /// - /// - /// - /// Bind an event handler to the "submit" JavaScript event, or trigger that event on an element. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'text': function() { - /// - /// Set the content of each element in the set of matched elements to the specified text. - /// A string of text to set as the content of each matched element. - /// - /// - /// - /// Set the content of each element in the set of matched elements to the specified text. - /// A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments. - /// - /// - }, - 'toArray': function() { - /// Retrieve all the DOM elements contained in the jQuery set, as an array. - /// - }, - 'toggle': function() { - /// - /// Display or hide the matched elements. - /// A string or number determining how long the animation will run. - /// A function to call once the animation is complete. - /// - /// - /// - /// Display or hide the matched elements. - /// A string or number determining how long the animation will run. - /// A string indicating which easing function to use for the transition. - /// A function to call once the animation is complete. - /// - /// - /// - /// Display or hide the matched elements. - /// A Boolean indicating whether to show or hide the elements. - /// - /// - }, - 'toggleClass': function() { - /// - /// Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - /// One or more class names (separated by spaces) to be toggled for each element in the matched set. - /// - /// - /// - /// Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - /// One or more class names (separated by spaces) to be toggled for each element in the matched set. - /// A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. - /// - /// - /// - /// Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - /// A boolean value to determine whether the class should be added or removed. - /// - /// - /// - /// Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - /// A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments. - /// A boolean value to determine whether the class should be added or removed. - /// - /// - }, - 'trigger': function() { - /// - /// Execute all handlers and behaviors attached to the matched elements for the given event type. - /// A string containing a JavaScript event type, such as click or submit. - /// Additional parameters to pass along to the event handler. - /// - /// - /// - /// Execute all handlers and behaviors attached to the matched elements for the given event type. - /// A jQuery.Event object. - /// - /// - }, - 'triggerHandler': function() { - /// - /// Execute all handlers attached to an element for an event. - /// A string containing a JavaScript event type, such as click or submit. - /// An array of additional parameters to pass along to the event handler. - /// - /// - }, - 'unbind': function() { - /// - /// Remove a previously-attached event handler from the elements. - /// A string containing a JavaScript event type, such as click or submit. - /// The function that is to be no longer executed. - /// - /// - /// - /// Remove a previously-attached event handler from the elements. - /// A string containing a JavaScript event type, such as click or submit. - /// Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). - /// - /// - /// - /// Remove a previously-attached event handler from the elements. - /// A JavaScript event object as passed to an event handler. - /// - /// - }, - 'undelegate': function() { - /// - /// Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - /// A selector which will be used to filter the event results. - /// A string containing a JavaScript event type, such as "click" or "keydown" - /// - /// - /// - /// Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - /// A selector which will be used to filter the event results. - /// A string containing a JavaScript event type, such as "click" or "keydown" - /// A function to execute at the time the event is triggered. - /// - /// - /// - /// Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - /// A selector which will be used to filter the event results. - /// A map of one or more event types and previously bound functions to unbind from them. - /// - /// - /// - /// Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - /// A string containing a namespace to unbind all events from. - /// - /// - }, - 'unload': function() { - /// - /// Bind an event handler to the "unload" JavaScript event. - /// A function to execute when the event is triggered. - /// - /// - /// - /// Bind an event handler to the "unload" JavaScript event. - /// A map of data that will be passed to the event handler. - /// A function to execute each time the event is triggered. - /// - /// - }, - 'unwrap': function() { - /// Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. - /// - }, - 'val': function() { - /// - /// Set the value of each element in the set of matched elements. - /// A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked. - /// - /// - /// - /// Set the value of each element in the set of matched elements. - /// A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - /// - /// - }, - 'visible': function() { - /// Selects all elements that are visible. - }, - 'width': function() { - /// - /// Set the CSS width of each element in the set of matched elements. - /// An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - /// - /// - /// - /// Set the CSS width of each element in the set of matched elements. - /// A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. - /// - /// - }, - 'wrap': function() { - /// - /// Wrap an HTML structure around each element in the set of matched elements. - /// An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the matched elements. - /// - /// - /// - /// Wrap an HTML structure around each element in the set of matched elements. - /// A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - /// - /// - }, - 'wrapAll': function() { - /// - /// Wrap an HTML structure around all elements in the set of matched elements. - /// An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the matched elements. - /// - /// - }, - 'wrapInner': function() { - /// - /// Wrap an HTML structure around the content of each element in the set of matched elements. - /// An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. - /// - /// - /// - /// Wrap an HTML structure around the content of each element in the set of matched elements. - /// A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - /// - /// - }, -}); - -intellisense.annotate(window, { - '$': function() { - /// - /// Accepts a string containing a CSS selector which is then used to match a set of elements. - /// A string containing a selector expression - /// A DOM Element, Document, or jQuery to use as context - /// - /// - /// - /// Accepts a string containing a CSS selector which is then used to match a set of elements. - /// A DOM element to wrap in a jQuery object. - /// - /// - /// - /// Accepts a string containing a CSS selector which is then used to match a set of elements. - /// A plain object to wrap in a jQuery object. - /// - /// - /// - /// Accepts a string containing a CSS selector which is then used to match a set of elements. - /// An array containing a set of DOM elements to wrap in a jQuery object. - /// - /// - /// - /// Accepts a string containing a CSS selector which is then used to match a set of elements. - /// An existing jQuery object to clone. - /// - /// - }, -}); - diff --git a/NzbDrone.Web/Scripts2/jquery-1.8.2.js b/NzbDrone.Web/Scripts2/jquery-1.8.2.js deleted file mode 100644 index 12c7797fd..000000000 --- a/NzbDrone.Web/Scripts2/jquery-1.8.2.js +++ /dev/null @@ -1,9440 +0,0 @@ -/*! - * jQuery JavaScript Library v1.8.2 - * http://jquery.com/ - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight Time) - */ -(function( window, undefined ) { -var - // A central reference to the root jQuery(document) - rootjQuery, - - // The deferred used on DOM ready - readyList, - - // Use the correct document accordingly with window argument (sandbox) - document = window.document, - location = window.location, - navigator = window.navigator, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // Save a reference to some core methods - core_push = Array.prototype.push, - core_slice = Array.prototype.slice, - core_indexOf = Array.prototype.indexOf, - core_toString = Object.prototype.toString, - core_hasOwn = Object.prototype.hasOwnProperty, - core_trim = String.prototype.trim, - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Used for matching numbers - core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, - - // Used for detecting and trimming whitespace - core_rnotwhite = /\S/, - core_rspace = /\s+/, - - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // The ready event handler and self cleanup method - DOMContentLoaded = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - } else if ( document.readyState === "complete" ) { - // we're here because readyState === "complete" in oldIE - // which is good enough for us to call the dom ready! - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context && context.nodeType ? context.ownerDocument || context : document ); - - // scripts is true for back-compat - selector = jQuery.parseHTML( match[1], doc, true ); - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - this.attr.call( selector, context, true ); - } - - return jQuery.merge( this, selector ); - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.8.2", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return core_slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ), - "slice", core_slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ core_toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // scripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, scripts ) { - var parsed; - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - scripts = context; - context = 0; - } - context = context || document; - - // Single tag - if ( (parsed = rsingleTag.exec( data )) ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); - return jQuery.merge( [], - (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); - }, - - parseJSON: function( data ) { - if ( !data || typeof data !== "string") { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && core_rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var name, - i = 0, - length = obj.length, - isObj = length === undefined || jQuery.isFunction( obj ); - - if ( args ) { - if ( isObj ) { - for ( name in obj ) { - if ( callback.apply( obj[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( obj[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in obj ) { - if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { - break; - } - } - } - } - - return obj; - }, - - // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - core_trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var type, - ret = results || []; - - if ( arr != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - type = jQuery.type( arr ); - - if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { - core_push.call( ret, arr ); - } else { - jQuery.merge( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, - ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var tmp, args, proxy; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, pass ) { - var exec, - bulk = key == null, - i = 0, - length = elems.length; - - // Sets many values - if ( key && typeof key === "object" ) { - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); - } - chainable = 1; - - // Sets one value - } else if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = pass === undefined && jQuery.isFunction( value ); - - if ( bulk ) { - // Bulk operations only iterate when executing function values - if ( exec ) { - exec = fn; - fn = function( elem, key, value ) { - return exec.call( jQuery( elem ), value ); - }; - - // Otherwise they run against the entire set - } else { - fn.call( elems, value ); - fn = null; - } - } - - if ( fn ) { - for (; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - } - - chainable = 1; - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - } -}); - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready, 1 ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.split( core_rspace ), function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" && ( !options.unique || !self.has( arg ) ) ) { - list.push( arg ); - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - return jQuery.inArray( fn, list ) > -1; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( list && ( !fired || stack ) ) { - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? - function() { - var returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - } : - newDefer[ action ] - ); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] = list.fire - deferred[ tuple[0] ] = list.fire; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = core_slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - fragment, - eventName, - i, - isSupported, - clickFn, - div = document.createElement("div"); - - // Preliminary tests - div.setAttribute( "className", "t" ); - div.innerHTML = "
      a"; - - all = div.getElementsByTagName("*"); - a = div.getElementsByTagName("a")[ 0 ]; - a.style.cssText = "top:1px;float:left;opacity:.5"; - - // Can't get basic test support - if ( !all || !all.length ) { - return {}; - } - - // First batch of supports tests - select = document.createElement("select"); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName("input")[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.5/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode - boxModel: ( document.compatMode === "CSS1Compat" ), - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - boxSizingReliable: true, - pixelPosition: false - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", clickFn = function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent("onclick"); - div.detachEvent( "onclick", clickFn ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute( "type", "radio" ); - support.radioValue = input.value === "t"; - - input.setAttribute( "checked", "checked" ); - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for ( i in { - submit: true, - change: true, - focusin: true - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - // Run tests that need a body at doc ready - jQuery(function() { - var container, div, tds, marginDiv, - divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - container = document.createElement("div"); - container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
      t
      "; - tds = div.getElementsByTagName("td"); - tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check box-sizing and margin behavior - div.innerHTML = ""; - div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; - support.boxSizing = ( div.offsetWidth === 4 ); - support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); - - // NOTE: To any future maintainer, we've window.getComputedStyle - // because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = document.createElement("div"); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.innerHTML = ""; - div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = "block"; - div.style.overflow = "visible"; - div.innerHTML = "
      "; - div.firstChild.style.width = "5px"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - - container.style.zoom = 1; - } - - // Null elements to avoid leaks in IE - body.removeChild( container ); - container = div = tds = marginDiv = null; - }); - - // Null elements to avoid leaks in IE - fragment.removeChild( div ); - all = a = select = opt = input = fragment = div = null; - - return support; -})(); -var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - deletedIds: [], - - // Remove at next major release (1.9/2.0) - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } - - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); - - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - } else if ( jQuery.support.deleteExpando || cache != cache.window ) { - delete cache[ id ]; - - // When all else fails, null - } else { - cache[ id ] = null; - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; - - // nodes accept data unless otherwise specified; rejection can be conditional - return !noData || noData !== true && elem.getAttribute("classid") === noData; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, part, attr, name, l, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attr = elem.attributes; - for ( l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( !name.indexOf( "data-" ) ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split( ".", 2 ); - parts[1] = parts[1] ? "." + parts[1] : ""; - part = parts[1] + "!"; - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - data = this.triggerHandler( "getData" + part, [ parts[0] ] ); - - // Try to fetch any internally stored data first - if ( data === undefined && elem ) { - data = jQuery.data( elem, key ); - data = dataAttr( elem, key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } - - parts[1] = value; - this.each(function() { - var self = jQuery( this ); - - self.triggerHandler( "setData" + part, parts ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + part, parts ); - }); - }, null, value, arguments.length > 1, null, false ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery.removeData( elem, type + "queue", true ); - jQuery.removeData( elem, key, true ); - }) - }); - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -}); -var nodeHook, boolHook, fixSpecified, - rclass = /[\t\r\n]/g, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea|)$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( core_rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var removes, className, elem, c, cl, i, l; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - if ( (value && typeof value === "string") || value === undefined ) { - removes = ( value || "" ).split( core_rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - if ( elem.nodeType === 1 && elem.className ) { - - className = (" " + elem.className + " ").replace( rclass, " " ); - - // loop over each item in the removal list - for ( c = 0, cl = removes.length; c < cl; c++ ) { - // Remove until there is nothing to remove, - while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { - className = className.replace( " " + removes[ c ] + " " , " " ); - } - } - elem.className = value ? jQuery.trim( className ) : ""; - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( core_rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var val, - self = jQuery(this); - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 - attrFn: {}, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, value + "" ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, isBool, - i = 0; - - if ( value && elem.nodeType === 1 ) { - - attrNames = value.split( core_rspace ); - - for ( ; i < attrNames.length; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - isBool = rboolean.test( name ); - - // See #9699 for explanation of this approach (setting first, then removal) - // Do not do this for boolean attributes (see #10870) - if ( !isBool ) { - jQuery.attr( elem, name, "" ); - } - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( isBool && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true, - coords: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? - ret.value : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.value = value + "" ); - } - }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = value + "" ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, - rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var t, tns, type, origType, namespaces, origCount, - j, events, special, eventType, handleObj, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, "events", true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, - type = event.type || event, - namespaces = []; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - for ( old = elem; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old === (elem.ownerDocument || document) ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, - handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = core_slice.call( arguments ), - run_all = !event.exclusive && !event.namespace, - special = jQuery.event.special[ event.type ] || {}, - handlerQueue = []; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers that should run if there are delegated events - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !(event.button && event.type === "click") ) { - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - - // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.disabled !== true || event.type !== "click" ) { - selMatch = {}; - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) - event.metaKey = !!event.metaKey; - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 – - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === "undefined" ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "_submit_attached" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "_submit_attached", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "_change_attached", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { // && selector != null - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); -/*! - * Sizzle CSS Selector Engine - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license - * http://sizzlejs.com/ - */ -(function( window, undefined ) { - -var cachedruns, - assertGetIdNotName, - Expr, - getText, - isXML, - contains, - compile, - sortOrder, - hasDuplicate, - outermostContext, - - baseHasDuplicate = true, - strundefined = "undefined", - - expando = ( "sizcache" + Math.random() ).replace( ".", "" ), - - Token = String, - document = window.document, - docElem = document.documentElement, - dirruns = 0, - done = 0, - pop = [].pop, - push = [].push, - slice = [].slice, - // Use a stripped-down indexOf if a native one is unavailable - indexOf = [].indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - // Augment a function for special use by Sizzle - markFunction = function( fn, value ) { - fn[ expando ] = value == null || value; - return fn; - }, - - createCache = function() { - var cache = {}, - keys = []; - - return markFunction(function( key, value ) { - // Only keep the most recent entries - if ( keys.push( key ) > Expr.cacheLength ) { - delete cache[ keys.shift() ]; - } - - return (cache[ key ] = value); - }, cache ); - }, - - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - - // Regex - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - operators = "([*^$|!~]?=)", - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments not in parens/brackets, - // then attribute selectors and non-pseudos (denoted by :), - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", - - // For matchExpr.POS and matchExpr.needsContext - pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + - "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), - rpseudo = new RegExp( pseudos ), - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, - - rnot = /^:not/, - rsibling = /[\x20\t\r\n\f]*[+~]/, - rendsWithNot = /:not\($/, - - rheader = /h\d/i, - rinputs = /input|select|textarea|button/i, - - rbackslash = /\\(?!\\)/g, - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "POS": new RegExp( pos, "i" ), - "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - // For use in libraries implementing .is() - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) - }, - - // Support - - // Used for testing something on an element - assert = function( fn ) { - var div = document.createElement("div"); - - try { - return fn( div ); - } catch (e) { - return false; - } finally { - // release memory in IE - div = null; - } - }, - - // Check if getElementsByTagName("*") returns only elements - assertTagNameNoComments = assert(function( div ) { - div.appendChild( document.createComment("") ); - return !div.getElementsByTagName("*").length; - }), - - // Check if getAttribute returns normalized href attributes - assertHrefNotNormalized = assert(function( div ) { - div.innerHTML = ""; - return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && - div.firstChild.getAttribute("href") === "#"; - }), - - // Check if attributes should be retrieved by attribute nodes - assertAttributes = assert(function( div ) { - div.innerHTML = ""; - var type = typeof div.lastChild.getAttribute("multiple"); - // IE8 returns a string for some attributes even when not present - return type !== "boolean" && type !== "string"; - }), - - // Check if getElementsByClassName can be trusted - assertUsableClassName = assert(function( div ) { - // Opera can't find a second classname (in 9.6) - div.innerHTML = ""; - if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { - return false; - } - - // Safari 3.2 caches class attributes and doesn't catch changes - div.lastChild.className = "e"; - return div.getElementsByClassName("e").length === 2; - }), - - // Check if getElementById returns elements by name - // Check if getElementsByName privileges form controls or returns elements by ID - assertUsableName = assert(function( div ) { - // Inject content - div.id = expando + 0; - div.innerHTML = "
      "; - docElem.insertBefore( div, docElem.firstChild ); - - // Test - var pass = document.getElementsByName && - // buggy browsers will return fewer than the correct 2 - document.getElementsByName( expando ).length === 2 + - // buggy browsers will return more than the correct 0 - document.getElementsByName( expando + 0 ).length; - assertGetIdNotName = !document.getElementById( expando ); - - // Cleanup - docElem.removeChild( div ); - - return pass; - }); - -// If slice is not available, provide a backup -try { - slice.call( docElem.childNodes, 0 )[0].nodeType; -} catch ( e ) { - slice = function( i ) { - var elem, - results = []; - for ( ; (elem = this[i]); i++ ) { - results.push( elem ); - } - return results; - }; -} - -function Sizzle( selector, context, results, seed ) { - results = results || []; - context = context || document; - var match, elem, xml, m, - nodeType = context.nodeType; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( nodeType !== 1 && nodeType !== 9 ) { - return []; - } - - xml = isXML( context ); - - if ( !xml && !seed ) { - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { - push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); - return results; - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); -} - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - return Sizzle( expr, null, null, [ elem ] ).length > 0; -}; - -// Returns a function to use in pseudos for input types -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -// Returns a function to use in pseudos for buttons -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -// Returns a function to use in pseudos for positionals -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - } else { - - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } - return ret; -}; - -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -// Element contains another -contains = Sizzle.contains = docElem.contains ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); - } : - docElem.compareDocumentPosition ? - function( a, b ) { - return b && !!( a.compareDocumentPosition( b ) & 16 ); - } : - function( a, b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - return false; - }; - -Sizzle.attr = function( elem, name ) { - var val, - xml = isXML( elem ); - - if ( !xml ) { - name = name.toLowerCase(); - } - if ( (val = Expr.attrHandle[ name ]) ) { - return val( elem ); - } - if ( xml || assertAttributes ) { - return elem.getAttribute( name ); - } - val = elem.getAttributeNode( name ); - return val ? - typeof elem[ name ] === "boolean" ? - elem[ name ] ? name : null : - val.specified ? val.value : null : - null; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - // IE6/7 return a modified href - attrHandle: assertHrefNotNormalized ? - {} : - { - "href": function( elem ) { - return elem.getAttribute( "href", 2 ); - }, - "type": function( elem ) { - return elem.getAttribute("type"); - } - }, - - find: { - "ID": assertGetIdNotName ? - function( id, context, xml ) { - if ( typeof context.getElementById !== strundefined && !xml ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - } : - function( id, context, xml ) { - if ( typeof context.getElementById !== strundefined && !xml ) { - var m = context.getElementById( id ); - - return m ? - m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? - [m] : - undefined : - []; - } - }, - - "TAG": assertTagNameNoComments ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - var elem, - tmp = [], - i = 0; - - for ( ; (elem = results[i]); i++ ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }, - - "NAME": assertUsableName && function( tag, context ) { - if ( typeof context.getElementsByName !== strundefined ) { - return context.getElementsByName( name ); - } - }, - - "CLASS": assertUsableClassName && function( className, context, xml ) { - if ( typeof context.getElementsByClassName !== strundefined && !xml ) { - return context.getElementsByClassName( className ); - } - } - }, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( rbackslash, "" ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 3 xn-component of xn+y argument ([+-]?\d*n|) - 4 sign of xn-component - 5 x of xn-component - 6 sign of y-component - 7 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1] === "nth" ) { - // nth-child requires argument - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); - match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); - - // other types prohibit arguments - } else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var unquoted, excess; - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - if ( match[3] ) { - match[2] = match[3]; - } else if ( (unquoted = match[4]) ) { - // Only check arguments that contain a pseudo - if ( rpseudo.test(unquoted) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - unquoted = unquoted.slice( 0, excess ); - match[0] = match[0].slice( 0, excess ); - } - match[2] = unquoted; - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - "ID": assertGetIdNotName ? - function( id ) { - id = id.replace( rbackslash, "" ); - return function( elem ) { - return elem.getAttribute("id") === id; - }; - } : - function( id ) { - id = id.replace( rbackslash, "" ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === id; - }; - }, - - "TAG": function( nodeName ) { - if ( nodeName === "*" ) { - return function() { return true; }; - } - nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); - - return function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ expando ][ className ]; - if ( !pattern ) { - pattern = classCache( className, new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)") ); - } - return function( elem ) { - return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); - }; - }, - - "ATTR": function( name, operator, check ) { - return function( elem, context ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.substr( result.length - check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, argument, first, last ) { - - if ( type === "nth" ) { - return function( elem ) { - var node, diff, - parent = elem.parentNode; - - if ( first === 1 && last === 0 ) { - return true; - } - - if ( parent ) { - diff = 0; - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - diff++; - if ( elem === node ) { - break; - } - } - } - } - - // Incorporate the offset (or cast to NaN), then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - }; - } - - return function( elem ) { - var node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - /* falls through */ - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - var nodeType; - elem = elem.firstChild; - while ( elem ) { - if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { - return false; - } - elem = elem.nextSibling; - } - return true; - }, - - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "text": function( elem ) { - var type, attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - (type = elem.type) === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); - }, - - // Input types - "radio": createInputPseudo("radio"), - "checkbox": createInputPseudo("checkbox"), - "file": createInputPseudo("file"), - "password": createInputPseudo("password"), - "image": createInputPseudo("image"), - - "submit": createButtonPseudo("submit"), - "reset": createButtonPseudo("reset"), - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "focus": function( elem ) { - var doc = elem.ownerDocument; - return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href); - }, - - "active": function( elem ) { - return elem === elem.ownerDocument.activeElement; - }, - - // Positional types - "first": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length, argument ) { - for ( var i = 0; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length, argument ) { - for ( var i = 1; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -function siblingCheck( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; -} - -sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? - a.compareDocumentPosition : - a.compareDocumentPosition(b) & 4 - ) ? -1 : 1; - } : - function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - -// Always assume the presence of duplicates if sort doesn't -// pass them to our comparison function (as in Google Chrome). -[0, 0].sort( sortOrder ); -baseHasDuplicate = !hasDuplicate; - -// Document sorting and removing duplicates -Sizzle.uniqueSort = function( results ) { - var elem, - i = 1; - - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( ; (elem = results[i]); i++ ) { - if ( elem === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - - return results; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, soFar, groups, preFilters, - cached = tokenCache[ expando ][ selector ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - soFar = soFar.slice( match[0].length ); - } - groups.push( tokens = [] ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - tokens.push( matched = new Token( match.shift() ) ); - soFar = soFar.slice( matched.length ); - - // Cast descendant combinators to space - matched.type = match[0].replace( rtrim, " " ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - // The last two arguments here are (context, xml) for backCompat - (match = preFilters[ type ]( match, document, true ))) ) { - - tokens.push( matched = new Token( match.shift() ) ); - soFar = soFar.slice( matched.length ); - matched.type = type; - matched.matches = match; - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && combinator.dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( checkNonElements || elem.nodeType === 1 ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( !xml ) { - var cache, - dirkey = dirruns + " " + doneName + " ", - cachedkey = dirkey + cachedruns; - while ( (elem = elem[ dir ]) ) { - if ( checkNonElements || elem.nodeType === 1 ) { - if ( (cache = elem[ expando ]) === cachedkey ) { - return elem.sizset; - } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { - if ( elem.sizset ) { - return elem; - } - } else { - elem[ expando ] = cachedkey; - if ( matcher( elem, context, xml ) ) { - elem.sizset = true; - return elem; - } - elem.sizset = false; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( checkNonElements || elem.nodeType === 1 ) { - if ( matcher( elem, context, xml ) ) { - return elem; - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - // Positional selectors apply to seed elements, so it is invalid to follow them with relative ones - if ( seed && postFinder ) { - return; - } - - var i, elem, postFilterIn, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [], seed ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - postFilterIn = condense( matcherOut, postMap ); - postFilter( postFilterIn, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = postFilterIn.length; - while ( i-- ) { - if ( (elem = postFilterIn[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - // Keep seed and results synchronized - if ( seed ) { - // Ignore postFinder because it can't coexist with seed - i = preFilter && matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - seed[ preMap[i] ] = !(results[ preMap[i] ] = elem); - } - } - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; - } else { - // The concatenated values are (context, xml) for backCompat - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && tokens.join("") - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Nested matchers should use non-integer dirruns - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); - - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = superMatcher.el; - } - - // Add elements passing elementMatchers directly to results - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - for ( j = 0; (matcher = elementMatchers[j]); j++ ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++superMatcher.el; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - for ( j = 0; (matcher = setMatchers[j]); j++ ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - superMatcher.el = 0; - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ expando ][ selector ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; -}; - -function multipleContexts( selector, contexts, results, seed ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results, seed ); - } - return results; -} - -function select( selector, context, results, seed, xml ) { - var i, tokens, token, type, find, - match = tokenize( selector ), - j = match.length; - - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - context.nodeType === 9 && !xml && - Expr.relative[ tokens[1].type ] ) { - - context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0]; - if ( !context ) { - return results; - } - - selector = selector.slice( tokens.shift().length ); - } - - // Fetch a seed set for right-to-left matching - for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( rbackslash, "" ), - rsibling.test( tokens[0].type ) && context.parentNode || context, - xml - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && tokens.join(""); - if ( !selector ) { - push.apply( results, slice.call( seed, 0 ) ); - return results; - } - - break; - } - } - } - } - } - - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - xml, - results, - rsibling.test( selector ) - ); - return results; -} - -if ( document.querySelectorAll ) { - (function() { - var disconnectedMatch, - oldSelect = select, - rescape = /'|\\/g, - rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, - - // qSa(:focus) reports false when true (Chrome 21), - // A support test would require too much code (would include document ready) - rbuggyQSA = [":focus"], - - // matchesSelector(:focus) reports false when true (Chrome 21), - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - // A support test would require too much code (would include document ready) - // just skip matchesSelector for :active - rbuggyMatches = [ ":active", ":focus" ], - matches = docElem.matchesSelector || - docElem.mozMatchesSelector || - docElem.webkitMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector; - - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explictly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = ""; - - // IE8 - Some boolean attributes are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here (do not put tests after this one) - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - - // Opera 10-12/IE9 - ^= $= *= and empty values - // Should not select anything - div.innerHTML = "

      "; - if ( div.querySelectorAll("[test^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here (do not put tests after this one) - div.innerHTML = ""; - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push(":enabled", ":disabled"); - } - }); - - // rbuggyQSA always contains :focus, so no need for a length check - rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") ); - - select = function( selector, context, results, seed, xml ) { - // Only use querySelectorAll when not filtering, - // when this is not xml, - // and when no QSA bugs apply - if ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - var groups, i, - old = true, - nid = expando, - newContext = context, - newSelector = context.nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + groups[i].join(""); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, slice.call( newContext.querySelectorAll( - newSelector - ), 0 ) ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - - return oldSelect( selector, context, results, seed, xml ); - }; - - if ( matches ) { - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - try { - matches.call( div, "[test!='']:sizzle" ); - rbuggyMatches.push( "!=", pseudos ); - } catch ( e ) {} - }); - - // rbuggyMatches always contains :active and :focus, so no need for a length check - rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") ); - - Sizzle.matchesSelector = function( elem, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - // rbuggyMatches always contains :active, so no need for an existence check - if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) { - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, null, null, [ elem ] ).length > 0; - }; - } - })(); -} - -// Deprecated -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Back-compat -function setFilters() {} -Expr.filters = setFilters.prototype = Expr.pseudos; -Expr.setFilters = new setFilters(); - -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})( window ); -var runtil = /Until$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - isSimple = /^.[^:#\[\.,]*$/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var i, l, length, n, r, ret, - self = this; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - ret = this.pushStack( "", "find", selector ); - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; - - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - rneedsContext.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - ret = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - cur = this[i]; - - while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - } - cur = cur.parentNode; - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -jQuery.fn.andSelf = jQuery.fn.addBack; - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( this.length > 1 && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /]", "i"), - rcheckableType = /^(?:checkbox|radio)$/, - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /\/(java|ecma)script/i, - rcleanScript = /^\s*\s*$/g, - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
      ", "
      " ], - thead: [ 1, "", "
      " ], - tr: [ 2, "", "
      " ], - td: [ 3, "", "
      " ], - col: [ 2, "", "
      " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, -// unless wrapped in a div with non-breaking characters in front of it. -if ( !jQuery.support.htmlSerialize ) { - wrapMap._default = [ 1, "X
      ", "
      " ]; -} - -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } - - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } - - return elem; - }).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); - - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - }, - - append: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 ) { - this.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 ) { - this.insertBefore( elem, this.firstChild ); - } - }); - }, - - before: function() { - if ( !isDisconnected( this[0] ) ) { - return this.domManip(arguments, false, function( elem ) { - this.parentNode.insertBefore( elem, this ); - }); - } - - if ( arguments.length ) { - var set = jQuery.clean( arguments ); - return this.pushStack( jQuery.merge( set, this ), "before", this.selector ); - } - }, - - after: function() { - if ( !isDisconnected( this[0] ) ) { - return this.domManip(arguments, false, function( elem ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - }); - } - - if ( arguments.length ) { - var set = jQuery.clean( arguments ); - return this.pushStack( jQuery.merge( this, set ), "after", this.selector ); - } - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName("*") ); - jQuery.cleanData( [ elem ] ); - } - - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName("*") ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[0] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( elem.getElementsByTagName( "*" ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function( value ) { - if ( !isDisconnected( this[0] ) ) { - // Make sure that the elements are removed from the DOM before they are inserted - // this can help fix replacing a parent with child elements - if ( jQuery.isFunction( value ) ) { - return this.each(function(i) { - var self = jQuery(this), old = self.html(); - self.replaceWith( value.call( this, i, old ) ); - }); - } - - if ( typeof value !== "string" ) { - value = jQuery( value ).detach(); - } - - return this.each(function() { - var next = this.nextSibling, - parent = this.parentNode; - - jQuery( this ).remove(); - - if ( next ) { - jQuery(next).before( value ); - } else { - jQuery(parent).append( value ); - } - }); - } - - return this.length ? - this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : - this; - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, table, callback ) { - - // Flatten any nested arrays - args = [].concat.apply( [], args ); - - var results, first, fragment, iNoClone, - i = 0, - value = args[0], - scripts = [], - l = this.length; - - // We can't cloneNode fragments that contain checked, in WebKit - if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) { - return this.each(function() { - jQuery(this).domManip( args, table, callback ); - }); - } - - if ( jQuery.isFunction(value) ) { - return this.each(function(i) { - var self = jQuery(this); - args[0] = value.call( this, i, table ? self.html() : undefined ); - self.domManip( args, table, callback ); - }); - } - - if ( this[0] ) { - results = jQuery.buildFragment( args, this, scripts ); - fragment = results.fragment; - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - table = table && jQuery.nodeName( first, "tr" ); - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - // Fragments from the fragment cache must always be cloned and never used in place. - for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) { - callback.call( - table && jQuery.nodeName( this[i], "table" ) ? - findOrAppend( this[i], "tbody" ) : - this[i], - i === iNoClone ? - fragment : - jQuery.clone( fragment, true, true ) - ); - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - - if ( scripts.length ) { - jQuery.each( scripts, function( i, elem ) { - if ( elem.src ) { - if ( jQuery.ajax ) { - jQuery.ajax({ - url: elem.src, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } else { - jQuery.error("no ajax"); - } - } else { - jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - - if ( elem.parentNode ) { - elem.parentNode.removeChild( elem ); - } - }); - } - } - - return this; - } -}); - -function findOrAppend( elem, tag ) { - return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function cloneFixAttributes( src, dest ) { - var nodeName; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - // clearAttributes removes the attributes, which we don't want, - // but also removes the attachEvent events, which we *do* want - if ( dest.clearAttributes ) { - dest.clearAttributes(); - } - - // mergeAttributes, in contrast, only merges back on the - // original attributes, not the events - if ( dest.mergeAttributes ) { - dest.mergeAttributes( src ); - } - - nodeName = dest.nodeName.toLowerCase(); - - if ( nodeName === "object" ) { - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - - // IE blanks contents when cloning scripts - } else if ( nodeName === "script" && dest.text !== src.text ) { - dest.text = src.text; - } - - // Event data gets referenced instead of copied if the expando - // gets copied too - dest.removeAttribute( jQuery.expando ); -} - -jQuery.buildFragment = function( args, context, scripts ) { - var fragment, cacheable, cachehit, - first = args[ 0 ]; - - // Set context from what may come in as undefined or a jQuery collection or a node - // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & - // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception - context = context || document; - context = !context.nodeType && context[0] || context; - context = context.ownerDocument || context; - - // Only cache "small" (1/2 KB) HTML strings that are associated with the main document - // Cloning options loses the selected state, so don't cache them - // IE 6 doesn't like it when you put or elements in a fragment - // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache - // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 - if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document && - first.charAt(0) === "<" && !rnocache.test( first ) && - (jQuery.support.checkClone || !rchecked.test( first )) && - (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { - - // Mark cacheable and look for a hit - cacheable = true; - fragment = jQuery.fragments[ first ]; - cachehit = fragment !== undefined; - } - - if ( !fragment ) { - fragment = context.createDocumentFragment(); - jQuery.clean( args, context, fragment, scripts ); - - // Update the cache, but only store false - // unless this is a second parsing of the same content - if ( cacheable ) { - jQuery.fragments[ first ] = cachehit && fragment; - } - } - - return { fragment: fragment, cacheable: cacheable }; -}; - -jQuery.fragments = {}; - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - l = insert.length, - parent = this.length === 1 && this[0].parentNode; - - if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) { - insert[ original ]( this[0] ); - return this; - } else { - for ( ; i < l; i++ ) { - elems = ( i > 0 ? this.clone(true) : this ).get(); - jQuery( insert[i] )[ original ]( elems ); - ret = ret.concat( elems ); - } - - return this.pushStack( ret, name, insert.selector ); - } - }; -}); - -function getAll( elem ) { - if ( typeof elem.getElementsByTagName !== "undefined" ) { - return elem.getElementsByTagName( "*" ); - - } else if ( typeof elem.querySelectorAll !== "undefined" ) { - return elem.querySelectorAll( "*" ); - - } else { - return []; - } -} - -// Used in clean, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var srcElements, - destElements, - i, - clone; - - if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - // IE copies events bound via attachEvent when using cloneNode. - // Calling detachEvent on the clone will also remove the events - // from the original. In order to get around this, we use some - // proprietary methods to clear the events. Thanks to MooTools - // guys for this hotness. - - cloneFixAttributes( elem, clone ); - - // Using Sizzle here is crazy slow, so we use getElementsByTagName instead - srcElements = getAll( elem ); - destElements = getAll( clone ); - - // Weird iteration because IE will replace the length property - // with an element if you are cloning the body and one of the - // elements on the page has a name or id of "length" - for ( i = 0; srcElements[i]; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - cloneFixAttributes( srcElements[i], destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - cloneCopyEvent( elem, clone ); - - if ( deepDataAndEvents ) { - srcElements = getAll( elem ); - destElements = getAll( clone ); - - for ( i = 0; srcElements[i]; ++i ) { - cloneCopyEvent( srcElements[i], destElements[i] ); - } - } - } - - srcElements = destElements = null; - - // Return the cloned set - return clone; - }, - - clean: function( elems, context, fragment, scripts ) { - var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, - safe = context === document && safeFragment, - ret = []; - - // Ensure that context is a document - if ( !context || typeof context.createDocumentFragment === "undefined" ) { - context = document; - } - - // Use the already-created safe fragment if context permits - for ( i = 0; (elem = elems[i]) != null; i++ ) { - if ( typeof elem === "number" ) { - elem += ""; - } - - if ( !elem ) { - continue; - } - - // Convert html string into DOM nodes - if ( typeof elem === "string" ) { - if ( !rhtml.test( elem ) ) { - elem = context.createTextNode( elem ); - } else { - // Ensure a safe container in which to render the html - safe = safe || createSafeFragment( context ); - div = context.createElement("div"); - safe.appendChild( div ); - - // Fix "XHTML"-style tags in all browsers - elem = elem.replace(rxhtmlTag, "<$1>"); - - // Go to html and back, then peel off extra wrappers - tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - depth = wrap[0]; - div.innerHTML = wrap[1] + elem + wrap[2]; - - // Move to the right depth - while ( depth-- ) { - div = div.lastChild; - } - - // Remove IE's autoinserted from table fragments - if ( !jQuery.support.tbody ) { - - // String was a , *may* have spurious - hasBody = rtbody.test(elem); - tbody = tag === "table" && !hasBody ? - div.firstChild && div.firstChild.childNodes : - - // String was a bare or - wrap[1] === "
      " && !hasBody ? - div.childNodes : - []; - - for ( j = tbody.length - 1; j >= 0 ; --j ) { - if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { - tbody[ j ].parentNode.removeChild( tbody[ j ] ); - } - } - } - - // IE completely kills leading whitespace when innerHTML is used - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); - } - - elem = div.childNodes; - - // Take out of fragment container (we need a fresh div each time) - div.parentNode.removeChild( div ); - } - } - - if ( elem.nodeType ) { - ret.push( elem ); - } else { - jQuery.merge( ret, elem ); - } - } - - // Fix #11356: Clear elements from safeFragment - if ( div ) { - elem = div = safe = null; - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !jQuery.support.appendChecked ) { - for ( i = 0; (elem = ret[i]) != null; i++ ) { - if ( jQuery.nodeName( elem, "input" ) ) { - fixDefaultChecked( elem ); - } else if ( typeof elem.getElementsByTagName !== "undefined" ) { - jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); - } - } - } - - // Append elements to a provided document fragment - if ( fragment ) { - // Special handling of each script element - handleScript = function( elem ) { - // Check if we consider it executable - if ( !elem.type || rscriptType.test( elem.type ) ) { - // Detach the script and store it in the scripts array (if provided) or the fragment - // Return truthy to indicate that it has been handled - return scripts ? - scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : - fragment.appendChild( elem ); - } - }; - - for ( i = 0; (elem = ret[i]) != null; i++ ) { - // Check if we're done after handling an executable script - if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { - // Append to fragment and handle embedded scripts - fragment.appendChild( elem ); - if ( typeof elem.getElementsByTagName !== "undefined" ) { - // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration - jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); - - // Splice the scripts into ret after their former ancestor and advance our index beyond them - ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); - i += jsTags.length; - } - } - } - } - - return ret; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var data, id, elem, type, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = jQuery.support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - jQuery.deletedIds.push( id ); - } - } - } - } - } -}); -// Limit scope pollution from any deprecated API -(function() { - -var matched, browser; - -// Use of jQuery.browser is frowned upon. -// More details: http://api.jquery.com/jQuery.browser -// jQuery.uaMatch maintained for back-compat -jQuery.uaMatch = function( ua ) { - ua = ua.toLowerCase(); - - var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || - /(webkit)[ \/]([\w.]+)/.exec( ua ) || - /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || - /(msie) ([\w.]+)/.exec( ua ) || - ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || - []; - - return { - browser: match[ 1 ] || "", - version: match[ 2 ] || "0" - }; -}; - -matched = jQuery.uaMatch( navigator.userAgent ); -browser = {}; - -if ( matched.browser ) { - browser[ matched.browser ] = true; - browser.version = matched.version; -} - -// Chrome is Webkit, but Webkit is also Safari. -if ( browser.chrome ) { - browser.webkit = true; -} else if ( browser.webkit ) { - browser.safari = true; -} - -jQuery.browser = browser; - -jQuery.sub = function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; -}; - -})(); -var curCSS, iframe, iframeDoc, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity=([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), - elemdisplay = {}, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, - - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], - - eventsToggle = jQuery.fn.toggle; - -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { - - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } - - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } - - return origName; -} - -function isHidden( elem, el ) { - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} - -function showHide( elements, show ) { - var elem, display, - values = [], - index = 0, - length = elements.length; - - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - values[ index ] = jQuery._data( elem, "olddisplay" ); - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && elem.style.display === "none" ) { - elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - display = curCSS( elem, "display" ); - - if ( !values[ index ] && display !== "none" ) { - jQuery._data( elem, "olddisplay", display ); - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } - - return elements; -} - -jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state, fn2 ) { - var bool = typeof state === "boolean"; - - if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { - return eventsToggle.apply( this, arguments ); - } - - return this.each(function() { - if ( bool ? state : isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } -}); - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - - } - } - } - }, - - // Exclude the following css properties to add px - cssNumber: { - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, numeric, extra ) { - var val, num, hooks, - origName = jQuery.camelCase( name ); - - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name ); - } - - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( numeric || extra !== undefined ) { - num = parseFloat( val ); - return numeric || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations - swap: function( elem, options, callback ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.call( elem ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; - } -}); - -// NOTE: To any future maintainer, we've window.getComputedStyle -// because jsdom on node.js will break without it. -if ( window.getComputedStyle ) { - curCSS = function( elem, name ) { - var ret, width, minWidth, maxWidth, - computed = window.getComputedStyle( elem, null ), - style = elem.style; - - if ( computed ) { - - ret = computed[ name ]; - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret; - }; -} else if ( document.documentElement.currentStyle ) { - curCSS = function( elem, name ) { - var left, rsLeft, - ret = elem.currentStyle && elem.currentStyle[ name ], - style = elem.style; - - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - - // Remember the original values - left = style.left; - rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - elem.runtimeStyle.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - elem.runtimeStyle.left = rsLeft; - } - } - - return ret === "" ? "auto" : ret; - }; -} - -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} - -function augmentWidthOrHeight( elem, name, extra, isBorderBox ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, - - val = 0; - - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - // we use jQuery.css instead of curCSS here - // because of the reliableMarginRight CSS hook! - val += jQuery.css( elem, extra + cssExpand[ i ], true ); - } - - // From this point on we use curCSS for maximum performance (relevant in animations) - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; - } - - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; - } - } else { - // at this point, extra isn't content, so add padding - val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; - - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; - } - } - } - - return val; -} - -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - valueIsBorderBox = true, - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } - - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox - ) - ) + "px"; -} - - -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - if ( elemdisplay[ nodeName ] ) { - return elemdisplay[ nodeName ]; - } - - var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), - display = elem.css("display"); - elem.remove(); - - // If the simple way fails, - // get element's real default display by attaching it to a temp iframe - if ( display === "none" || display === "" ) { - // Use the already-created iframe if possible - iframe = document.body.appendChild( - iframe || jQuery.extend( document.createElement("iframe"), { - frameBorder: 0, - width: 0, - height: 0 - }) - ); - - // Create a cacheable copy of the iframe document on first call. - // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML - // document to it; WebKit & Firefox won't allow reusing the iframe document. - if ( !iframeDoc || !iframe.createElement ) { - iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; - iframeDoc.write(""); - iframeDoc.close(); - } - - elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); - - display = curCSS( elem, "display" ); - document.body.removeChild( iframe ); - } - - // Store the correct default display - elemdisplay[ nodeName ] = display; - - return display; -} - -jQuery.each([ "height", "width" ], function( i, name ) { - jQuery.cssHooks[ name ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - // certain elements can have dimension info if we invisibly show them - // however, it must have a current display style that would benefit from this - if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) { - return jQuery.swap( elem, cssShow, function() { - return getWidthOrHeight( elem, name, extra ); - }); - } else { - return getWidthOrHeight( elem, name, extra ); - } - } - }, - - set: function( elem, value, extra ) { - return setPositiveNumber( elem, value, extra ? - augmentWidthOrHeight( - elem, - name, - extra, - jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box" - ) : 0 - ); - } - }; -}); - -if ( !jQuery.support.opacity ) { - jQuery.cssHooks.opacity = { - get: function( elem, computed ) { - // IE uses filters for opacity - return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? - ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : - computed ? "1" : ""; - }, - - set: function( elem, value ) { - var style = elem.style, - currentStyle = elem.currentStyle, - opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", - filter = currentStyle && currentStyle.filter || style.filter || ""; - - // IE has trouble with opacity if it does not have layout - // Force it by setting the zoom level - style.zoom = 1; - - // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 - if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && - style.removeAttribute ) { - - // Setting style.filter to null, "" & " " still leave "filter:" in the cssText - // if "filter:" is present at all, clearType is disabled, we want to avoid this - // style.removeAttribute is IE Only, but so apparently is this code path... - style.removeAttribute( "filter" ); - - // if there there is no filter style applied in a css rule, we are done - if ( currentStyle && !currentStyle.filter ) { - return; - } - } - - // otherwise, set new filter values - style.filter = ralpha.test( filter ) ? - filter.replace( ralpha, opacity ) : - filter + " " + opacity; - } - }; -} - -// These hooks cannot be added until DOM ready because the support test -// for it is not run until after DOM ready -jQuery(function() { - if ( !jQuery.support.reliableMarginRight ) { - jQuery.cssHooks.marginRight = { - get: function( elem, computed ) { - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - // Work around by temporarily setting element display to inline-block - return jQuery.swap( elem, { "display": "inline-block" }, function() { - if ( computed ) { - return curCSS( elem, "marginRight" ); - } - }); - } - }; - } - - // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 - // getComputedStyle returns percent when specified for top/left/bottom/right - // rather than make the css module depend on the offset module, we just check for it here - if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { - jQuery.each( [ "top", "left" ], function( i, prop ) { - jQuery.cssHooks[ prop ] = { - get: function( elem, computed ) { - if ( computed ) { - var ret = curCSS( elem, prop ); - // if curCSS returns percentage, fallback to offset - return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret; - } - } - }; - }); - } - -}); - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.hidden = function( elem ) { - return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none"); - }; - - jQuery.expr.filters.visible = function( elem ) { - return !jQuery.expr.filters.hidden( elem ); - }; -} - -// These hooks are used by animate to expand properties -jQuery.each({ - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i, - - // assumes a single number if not a string - parts = typeof value === "string" ? value.split(" ") : [ value ], - expanded = {}; - - for ( i = 0; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( !rmargin.test( prefix ) ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -}); -var r20 = /%20/g, - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, - rselectTextarea = /^(?:select|textarea)/i; - -jQuery.fn.extend({ - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map(function(){ - return this.elements ? jQuery.makeArray( this.elements ) : this; - }) - .filter(function(){ - return this.name && !this.disabled && - ( this.checked || rselectTextarea.test( this.nodeName ) || - rinput.test( this.type ) ); - }) - .map(function( i, elem ){ - var val = jQuery( this ).val(); - - return val == null ? - null : - jQuery.isArray( val ) ? - jQuery.map( val, function( val, i ){ - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }) : - { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }).get(); - } -}); - -//Serialize an array of form elements or a set of -//key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, value ) { - // If value is a function, invoke it and return its value - value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); - s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); - }; - - // Set traditional to true for jQuery <= 1.3.2 behavior. - if ( traditional === undefined ) { - traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - }); - - } else { - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ).replace( r20, "+" ); -}; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( jQuery.isArray( obj ) ) { - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - // If array item is non-scalar (array or object), encode its - // numeric index to resolve deserialization ambiguity issues. - // Note that rack (as of 1.0.0) can't currently deserialize - // nested arrays properly, and attempting to do so may cause - // a server error. Possible fixes are to modify rack's - // deserialization algorithm or to provide an option or flag - // to force array serialization to be shallow. - buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); - } - }); - - } else if ( !traditional && jQuery.type( obj ) === "object" ) { - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - // Serialize scalar item. - add( prefix, obj ); - } -} -var - // Document location - ajaxLocParts, - ajaxLocation, - - rhash = /#.*$/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - rquery = /\?/, - rscript = /)<[^<]*)*<\/script>/gi, - rts = /([?&])_=[^&]*/, - rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, - - // Keep a copy of the old load method - _load = jQuery.fn.load, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = ["*/"] + ["*"]; - -// #8138, IE may throw an exception when accessing -// a field from window.location if document.domain has been set -try { - ajaxLocation = location.href; -} catch( e ) { - // Use the href attribute of an A element - // since IE will modify it given document.location - ajaxLocation = document.createElement( "a" ); - ajaxLocation.href = ""; - ajaxLocation = ajaxLocation.href; -} - -// Segment location into parts -ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, list, placeBefore, - dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), - i = 0, - length = dataTypes.length; - - if ( jQuery.isFunction( func ) ) { - // For each dataType in the dataTypeExpression - for ( ; i < length; i++ ) { - dataType = dataTypes[ i ]; - // We control if we're asked to add before - // any existing element - placeBefore = /^\+/.test( dataType ); - if ( placeBefore ) { - dataType = dataType.substr( 1 ) || "*"; - } - list = structure[ dataType ] = structure[ dataType ] || []; - // then we add to the structure accordingly - list[ placeBefore ? "unshift" : "push" ]( func ); - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, - dataType /* internal */, inspected /* internal */ ) { - - dataType = dataType || options.dataTypes[ 0 ]; - inspected = inspected || {}; - - inspected[ dataType ] = true; - - var selection, - list = structure[ dataType ], - i = 0, - length = list ? list.length : 0, - executeOnly = ( structure === prefilters ); - - for ( ; i < length && ( executeOnly || !selection ); i++ ) { - selection = list[ i ]( options, originalOptions, jqXHR ); - // If we got redirected to another dataType - // we try there if executing only and not done already - if ( typeof selection === "string" ) { - if ( !executeOnly || inspected[ selection ] ) { - selection = undefined; - } else { - options.dataTypes.unshift( selection ); - selection = inspectPrefiltersOrTransports( - structure, options, originalOptions, jqXHR, selection, inspected ); - } - } - } - // If we're only executing or nothing was selected - // we try the catchall dataType if not done already - if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { - selection = inspectPrefiltersOrTransports( - structure, options, originalOptions, jqXHR, "*", inspected ); - } - // unnecessary when only executing (prefilters) - // but it'll be ignored by the caller in that case - return selection; -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } -} - -jQuery.fn.load = function( url, params, callback ) { - if ( typeof url !== "string" && _load ) { - return _load.apply( this, arguments ); - } - - // Don't do a request if no elements are being requested - if ( !this.length ) { - return this; - } - - var selector, type, response, - self = this, - off = url.indexOf(" "); - - if ( off >= 0 ) { - selector = url.slice( off, url.length ); - url = url.slice( 0, off ); - } - - // If it's a function - if ( jQuery.isFunction( params ) ) { - - // We assume that it's the callback - callback = params; - params = undefined; - - // Otherwise, build a param string - } else if ( params && typeof params === "object" ) { - type = "POST"; - } - - // Request the remote document - jQuery.ajax({ - url: url, - - // if "type" variable is undefined, then "GET" method will be used - type: type, - dataType: "html", - data: params, - complete: function( jqXHR, status ) { - if ( callback ) { - self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); - } - } - }).done(function( responseText ) { - - // Save response for use in complete callback - response = arguments; - - // See if a selector was specified - self.html( selector ? - - // Create a dummy div to hold the results - jQuery("
      ") - - // inject the contents of the document in, removing the scripts - // to avoid any 'Permission Denied' errors in IE - .append( responseText.replace( rscript, "" ) ) - - // Locate the specified elements - .find( selector ) : - - // If not, just inject the full result - responseText ); - - }); - - return this; -}; - -// Attach a bunch of functions for handling common AJAX events -jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ - jQuery.fn[ o ] = function( f ){ - return this.on( o, f ); - }; -}); - -jQuery.each( [ "get", "post" ], function( i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - // shift arguments if data argument was omitted - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - return jQuery.ajax({ - type: method, - url: url, - data: data, - success: callback, - dataType: type - }); - }; -}); - -jQuery.extend({ - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - if ( settings ) { - // Building a settings object - ajaxExtend( target, jQuery.ajaxSettings ); - } else { - // Extending ajaxSettings - settings = target; - target = jQuery.ajaxSettings; - } - ajaxExtend( target, settings ); - return target; - }, - - ajaxSettings: { - url: ajaxLocation, - isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), - global: true, - type: "GET", - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - processData: true, - async: true, - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - xml: "application/xml, text/xml", - html: "text/html", - text: "text/plain", - json: "application/json, text/javascript", - "*": allTypes - }, - - contents: { - xml: /xml/, - html: /html/, - json: /json/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText" - }, - - // List of data converters - // 1) key format is "source_type destination_type" (a single space in-between) - // 2) the catchall symbol "*" can be used for source_type - converters: { - - // Convert anything to text - "* text": window.String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": jQuery.parseJSON, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - context: true, - url: true - } - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var // ifModified key - ifModifiedKey, - // Response headers - responseHeadersString, - responseHeaders, - // transport - transport, - // timeout handle - timeoutTimer, - // Cross-domain detection vars - parts, - // To know if global events are to be dispatched - fireGlobals, - // Loop variable - i, - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - // Callbacks context - callbackContext = s.context || s, - // Context for global events - // It's the callbackContext if one was provided in the options - // and if it's a DOM node or a jQuery collection - globalEventContext = callbackContext !== s && - ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? - jQuery( callbackContext ) : jQuery.event, - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - // Status-dependent callbacks - statusCode = s.statusCode || {}, - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - // The jqXHR state - state = 0, - // Default abort message - strAbort = "canceled", - // Fake xhr - jqXHR = { - - readyState: 0, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( !state ) { - var lname = name.toLowerCase(); - name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Raw string - getAllResponseHeaders: function() { - return state === 2 ? responseHeadersString : null; - }, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( state === 2 ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; - } - } - match = responseHeaders[ key.toLowerCase() ]; - } - return match === undefined ? null : match; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( !state ) { - s.mimeType = type; - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - statusText = statusText || strAbort; - if ( transport ) { - transport.abort( statusText ); - } - done( 0, statusText ); - return this; - } - }; - - // Callback for when everything is done - // It is defined here because jslint complains if it is declared - // at the end of the function (which would be more logical and readable) - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Called once - if ( state === 2 ) { - return; - } - - // State is "done" now - state = 2; - - // Clear timeout if it exists - if ( timeoutTimer ) { - clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // If successful, handle type chaining - if ( status >= 200 && status < 300 || status === 304 ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - - modified = jqXHR.getResponseHeader("Last-Modified"); - if ( modified ) { - jQuery.lastModified[ ifModifiedKey ] = modified; - } - modified = jqXHR.getResponseHeader("Etag"); - if ( modified ) { - jQuery.etag[ ifModifiedKey ] = modified; - } - } - - // If not modified - if ( status === 304 ) { - - statusText = "notmodified"; - isSuccess = true; - - // If we have data - } else { - - isSuccess = ajaxConvert( s, response ); - statusText = isSuccess.state; - success = isSuccess.data; - error = isSuccess.error; - isSuccess = !error; - } - } else { - // We extract error from statusText - // then normalize statusText and status for non-aborts - error = statusText; - if ( !statusText || status ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - // Attach deferreds - deferred.promise( jqXHR ); - jqXHR.success = jqXHR.done; - jqXHR.error = jqXHR.fail; - jqXHR.complete = completeDeferred.add; - - // Status-dependent callbacks - jqXHR.statusCode = function( map ) { - if ( map ) { - var tmp; - if ( state < 2 ) { - for ( tmp in map ) { - statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; - } - } else { - tmp = map[ jqXHR.status ]; - jqXHR.always( tmp ); - } - } - return this; - }; - - // Remove hash character (#7531: and string promotion) - // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) - // We also use the url parameter if available - s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); - - // Extract dataTypes list - s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); - - // A cross-domain request is in order when we have a protocol:host:port mismatch - if ( s.crossDomain == null ) { - parts = rurl.exec( s.url.toLowerCase() ) || false; - s.crossDomain = parts && ( parts.join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !== - ( ajaxLocParts.join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ); - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( state === 2 ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - fireGlobals = s.global; - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // If data is available, append data to url - if ( s.data ) { - s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Get ifModifiedKey before adding the anti-cache parameter - ifModifiedKey = s.url; - - // Add anti-cache in url if needed - if ( s.cache === false ) { - - var ts = jQuery.now(), - // try replacing _= if it is there - ret = s.url.replace( rts, "$1_=" + ts ); - - // if nothing was replaced, add timestamp to the end - s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - ifModifiedKey = ifModifiedKey || s.url; - if ( jQuery.lastModified[ ifModifiedKey ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); - } - if ( jQuery.etag[ ifModifiedKey ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); - } - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { - // Abort if not done already and return - return jqXHR.abort(); - - } - - // aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - for ( i in { success: 1, error: 1, complete: 1 } ) { - jqXHR[ i ]( s[ i ] ); - } - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = setTimeout( function(){ - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - state = 1; - transport.send( requestHeaders, done ); - } catch (e) { - // Propagate exception as error if not done - if ( state < 2 ) { - done( -1, e ); - // Simply rethrow otherwise - } else { - throw e; - } - } - } - - return jqXHR; - }, - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {} - -}); - -/* Handles responses to an ajax request: - * - sets all responseXXX fields accordingly - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes, - responseFields = s.responseFields; - - // Fill responseXXX fields - for ( type in responseFields ) { - if ( type in responses ) { - jqXHR[ responseFields[type] ] = responses[ type ]; - } - } - - // Remove auto dataType and get content-type in the process - while( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -// Chain conversions given the request and the original response -function ajaxConvert( s, response ) { - - var conv, conv2, current, tmp, - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(), - prev = dataTypes[ 0 ], - converters = {}, - i = 0; - - // Apply the dataFilter if provided - if ( s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - // Convert to each sequential dataType, tolerating list modification - for ( ; (current = dataTypes[++i]); ) { - - // There's only work to do if current dataType is non-auto - if ( current !== "*" ) { - - // Convert response if prev dataType is non-auto and differs from current - if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split(" "); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.splice( i--, 0, current ); - } - - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s["throws"] ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; - } - } - } - } - - // Update prev for next iteration - prev = current; - } - } - - return { state: "success", data: response }; -} -var oldCallbacks = [], - rquestion = /\?/, - rjsonp = /(=)\?(?=&|$)|\?\?/, - nonce = jQuery.now(); - -// Default jsonp settings -jQuery.ajaxSetup({ - jsonp: "callback", - jsonpCallback: function() { - var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); - this[ callback ] = true; - return callback; - } -}); - -// Detect, normalize options and install callbacks for jsonp requests -jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { - - var callbackName, overwritten, responseContainer, - data = s.data, - url = s.url, - hasCallback = s.jsonp !== false, - replaceInUrl = hasCallback && rjsonp.test( url ), - replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && - !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && - rjsonp.test( data ); - - // Handle iff the expected data type is "jsonp" or we have a parameter to set - if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) { - - // Get callback name, remembering preexisting value associated with it - callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? - s.jsonpCallback() : - s.jsonpCallback; - overwritten = window[ callbackName ]; - - // Insert callback into url or form data - if ( replaceInUrl ) { - s.url = url.replace( rjsonp, "$1" + callbackName ); - } else if ( replaceInData ) { - s.data = data.replace( rjsonp, "$1" + callbackName ); - } else if ( hasCallback ) { - s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; - } - - // Use data converter to retrieve json after script execution - s.converters["script json"] = function() { - if ( !responseContainer ) { - jQuery.error( callbackName + " was not called" ); - } - return responseContainer[ 0 ]; - }; - - // force json dataType - s.dataTypes[ 0 ] = "json"; - - // Install callback - window[ callbackName ] = function() { - responseContainer = arguments; - }; - - // Clean-up function (fires after converters) - jqXHR.always(function() { - // Restore preexisting value - window[ callbackName ] = overwritten; - - // Save back as free - if ( s[ callbackName ] ) { - // make sure that re-using the options doesn't screw things around - s.jsonpCallback = originalSettings.jsonpCallback; - - // save the callback name for future use - oldCallbacks.push( callbackName ); - } - - // Call if it was a function and we have a response - if ( responseContainer && jQuery.isFunction( overwritten ) ) { - overwritten( responseContainer[ 0 ] ); - } - - responseContainer = overwritten = undefined; - }); - - // Delegate to script - return "script"; - } -}); -// Install script dataType -jQuery.ajaxSetup({ - accepts: { - script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /javascript|ecmascript/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -}); - -// Handle cache's special case and global -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - s.global = false; - } -}); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function(s) { - - // This transport only deals with cross domain requests - if ( s.crossDomain ) { - - var script, - head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; - - return { - - send: function( _, callback ) { - - script = document.createElement( "script" ); - - script.async = "async"; - - if ( s.scriptCharset ) { - script.charset = s.scriptCharset; - } - - script.src = s.url; - - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function( _, isAbort ) { - - if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { - - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; - - // Remove the script - if ( head && script.parentNode ) { - head.removeChild( script ); - } - - // Dereference the script - script = undefined; - - // Callback if not abort - if ( !isAbort ) { - callback( 200, "success" ); - } - } - }; - // Use insertBefore instead of appendChild to circumvent an IE6 bug. - // This arises when a base node is used (#2709 and #4378). - head.insertBefore( script, head.firstChild ); - }, - - abort: function() { - if ( script ) { - script.onload( 0, 1 ); - } - } - }; - } -}); -var xhrCallbacks, - // #5280: Internet Explorer will keep connections alive if we don't abort on unload - xhrOnUnloadAbort = window.ActiveXObject ? function() { - // Abort all pending requests - for ( var key in xhrCallbacks ) { - xhrCallbacks[ key ]( 0, 1 ); - } - } : false, - xhrId = 0; - -// Functions to create xhrs -function createStandardXHR() { - try { - return new window.XMLHttpRequest(); - } catch( e ) {} -} - -function createActiveXHR() { - try { - return new window.ActiveXObject( "Microsoft.XMLHTTP" ); - } catch( e ) {} -} - -// Create the request object -// (This is still attached to ajaxSettings for backward compatibility) -jQuery.ajaxSettings.xhr = window.ActiveXObject ? - /* Microsoft failed to properly - * implement the XMLHttpRequest in IE7 (can't request local files), - * so we use the ActiveXObject when it is available - * Additionally XMLHttpRequest can be disabled in IE7/IE8 so - * we need a fallback. - */ - function() { - return !this.isLocal && createStandardXHR() || createActiveXHR(); - } : - // For all other browsers, use the standard XMLHttpRequest object - createStandardXHR; - -// Determine support properties -(function( xhr ) { - jQuery.extend( jQuery.support, { - ajax: !!xhr, - cors: !!xhr && ( "withCredentials" in xhr ) - }); -})( jQuery.ajaxSettings.xhr() ); - -// Create transport if the browser can provide an xhr -if ( jQuery.support.ajax ) { - - jQuery.ajaxTransport(function( s ) { - // Cross domain only allowed if supported through XMLHttpRequest - if ( !s.crossDomain || jQuery.support.cors ) { - - var callback; - - return { - send: function( headers, complete ) { - - // Get a new xhr - var handle, i, - xhr = s.xhr(); - - // Open the socket - // Passing null username, generates a login popup on Opera (#2865) - if ( s.username ) { - xhr.open( s.type, s.url, s.async, s.username, s.password ); - } else { - xhr.open( s.type, s.url, s.async ); - } - - // Apply custom fields if provided - if ( s.xhrFields ) { - for ( i in s.xhrFields ) { - xhr[ i ] = s.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( s.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( s.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !s.crossDomain && !headers["X-Requested-With"] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Need an extra try/catch for cross domain requests in Firefox 3 - try { - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - } catch( _ ) {} - - // Do send the request - // This may raise an exception which is actually - // handled in jQuery.ajax (so no try/catch here) - xhr.send( ( s.hasContent && s.data ) || null ); - - // Listener - callback = function( _, isAbort ) { - - var status, - statusText, - responseHeaders, - responses, - xml; - - // Firefox throws exceptions when accessing properties - // of an xhr when a network error occurred - // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) - try { - - // Was never called and is aborted or complete - if ( callback && ( isAbort || xhr.readyState === 4 ) ) { - - // Only called once - callback = undefined; - - // Do not keep as active anymore - if ( handle ) { - xhr.onreadystatechange = jQuery.noop; - if ( xhrOnUnloadAbort ) { - delete xhrCallbacks[ handle ]; - } - } - - // If it's an abort - if ( isAbort ) { - // Abort it manually if needed - if ( xhr.readyState !== 4 ) { - xhr.abort(); - } - } else { - status = xhr.status; - responseHeaders = xhr.getAllResponseHeaders(); - responses = {}; - xml = xhr.responseXML; - - // Construct response list - if ( xml && xml.documentElement /* #4958 */ ) { - responses.xml = xml; - } - - // When requesting binary data, IE6-9 will throw an exception - // on any attempt to access responseText (#11426) - try { - responses.text = xhr.responseText; - } catch( _ ) { - } - - // Firefox throws an exception when accessing - // statusText for faulty cross-domain requests - try { - statusText = xhr.statusText; - } catch( e ) { - // We normalize with Webkit giving an empty statusText - statusText = ""; - } - - // Filter status for non standard behaviors - - // If the request is local and we have data: assume a success - // (success with no data won't get notified, that's the best we - // can do given current implementations) - if ( !status && s.isLocal && !s.crossDomain ) { - status = responses.text ? 200 : 404; - // IE - #1450: sometimes returns 1223 when it should be 204 - } else if ( status === 1223 ) { - status = 204; - } - } - } - } catch( firefoxAccessException ) { - if ( !isAbort ) { - complete( -1, firefoxAccessException ); - } - } - - // Call complete if needed - if ( responses ) { - complete( status, statusText, responses, responseHeaders ); - } - }; - - if ( !s.async ) { - // if we're in sync mode we fire the callback - callback(); - } else if ( xhr.readyState === 4 ) { - // (IE6 & IE7) if it's in cache and has been - // retrieved directly we need to fire the callback - setTimeout( callback, 0 ); - } else { - handle = ++xhrId; - if ( xhrOnUnloadAbort ) { - // Create the active xhrs callbacks list if needed - // and attach the unload handler - if ( !xhrCallbacks ) { - xhrCallbacks = {}; - jQuery( window ).unload( xhrOnUnloadAbort ); - } - // Add to list of active xhrs callbacks - xhrCallbacks[ handle ] = callback; - } - xhr.onreadystatechange = callback; - } - }, - - abort: function() { - if ( callback ) { - callback(0,1); - } - } - }; - } - }); -} -var fxNow, timerId, - rfxtypes = /^(?:toggle|show|hide)$/, - rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), - rrun = /queueHooks$/, - animationPrefilters = [ defaultPrefilter ], - tweeners = { - "*": [function( prop, value ) { - var end, unit, - tween = this.createTween( prop, value ), - parts = rfxnum.exec( value ), - target = tween.cur(), - start = +target || 0, - scale = 1, - maxIterations = 20; - - if ( parts ) { - end = +parts[2]; - unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - - // We need to compute starting value - if ( unit !== "px" && start ) { - // Iteratively approximate from a nonzero starting point - // Prefer the current property, because this process will be trivial if it uses the same units - // Fallback to end or a simple constant - start = jQuery.css( tween.elem, prop, true ) || end || 1; - - do { - // If previous iteration zeroed out, double until we get *something* - // Use a string for doubling factor so we don't accidentally see scale as unchanged below - scale = scale || ".5"; - - // Adjust and apply - start = start / scale; - jQuery.style( tween.elem, prop, start + unit ); - - // Update scale, tolerating zero or NaN from tween.cur() - // And breaking the loop if scale is unchanged or perfect, or if we've just had enough - } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); - } - - tween.unit = unit; - tween.start = start; - // If a +=/-= token was provided, we're doing a relative animation - tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; - } - return tween; - }] - }; - -// Animations created synchronously will run synchronously -function createFxNow() { - setTimeout(function() { - fxNow = undefined; - }, 0 ); - return ( fxNow = jQuery.now() ); -} - -function createTweens( animation, props ) { - jQuery.each( props, function( prop, value ) { - var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( collection[ index ].call( animation, prop, value ) ) { - - // we're done with this property - return; - } - } - }); -} - -function Animation( elem, properties, options ) { - var result, - index = 0, - tweenerIndex = 0, - length = animationPrefilters.length, - deferred = jQuery.Deferred().always( function() { - // don't match elem in the :animated selector - delete tick.elem; - }), - tick = function() { - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - percent = 1 - ( remaining / animation.duration || 0 ), - index = 0, - length = animation.tweens.length; - - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ]); - - if ( percent < 1 && length ) { - return remaining; - } else { - deferred.resolveWith( elem, [ animation ] ); - return false; - } - }, - animation = deferred.promise({ - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { specialEasing: {} }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end, easing ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - // if we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // resolve when we played the last frame - // otherwise, reject - if ( gotoEnd ) { - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - }), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length ; index++ ) { - result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - return result; - } - } - - createTweens( animation, props ); - - if ( jQuery.isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - jQuery.fx.timer( - jQuery.extend( tick, { - anim: animation, - queue: animation.opts.queue, - elem: elem - }) - ); - - // attach callbacks from options - return animation.progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = jQuery.camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( jQuery.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // not quite $.extend, this wont overwrite keys already present. - // also - reusing 'index' from above because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweener: function( props, callback ) { - if ( jQuery.isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.split(" "); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length ; index++ ) { - prop = props[ index ]; - tweeners[ prop ] = tweeners[ prop ] || []; - tweeners[ prop ].unshift( callback ); - } - }, - - prefilter: function( callback, prepend ) { - if ( prepend ) { - animationPrefilters.unshift( callback ); - } else { - animationPrefilters.push( callback ); - } - } -}); - -function defaultPrefilter( elem, props, opts ) { - var index, prop, value, length, dataShow, tween, hooks, oldfire, - anim = this, - style = elem.style, - orig = {}, - handled = [], - hidden = elem.nodeType && isHidden( elem ); - - // handle queue: false promises - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always(function() { - // doing this makes sure that the complete handler will be called - // before this completes - anim.always(function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - }); - }); - } - - // height/width overflow pass - if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { - // Make sure that nothing sneaks out - // Record all 3 overflow attributes because IE does not - // change the overflow attribute when overflowX and - // overflowY are set to the same value - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Set display property to inline-block for height/width - // animations on inline elements that are having width/height animated - if ( jQuery.css( elem, "display" ) === "inline" && - jQuery.css( elem, "float" ) === "none" ) { - - // inline-level elements accept inline-block; - // block-level elements need to be inline with layout - if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { - style.display = "inline-block"; - - } else { - style.zoom = 1; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - if ( !jQuery.support.shrinkWrapBlocks ) { - anim.done(function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - }); - } - } - - - // show/hide pass - for ( index in props ) { - value = props[ index ]; - if ( rfxtypes.exec( value ) ) { - delete props[ index ]; - if ( value === ( hidden ? "hide" : "show" ) ) { - continue; - } - handled.push( index ); - } - } - - length = handled.length; - if ( length ) { - dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); - if ( hidden ) { - jQuery( elem ).show(); - } else { - anim.done(function() { - jQuery( elem ).hide(); - }); - } - anim.done(function() { - var prop; - jQuery.removeData( elem, "fxshow", true ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - }); - for ( index = 0 ; index < length ; index++ ) { - prop = handled[ index ]; - tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); - orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); - - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = tween.start; - if ( hidden ) { - tween.end = tween.start; - tween.start = prop === "width" || prop === "height" ? 1 : 0; - } - } - } - } -} - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || "swing"; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - if ( tween.elem[ tween.prop ] != null && - (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { - return tween.elem[ tween.prop ]; - } - - // passing any value as a 4th parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails - // so, simple values such as "10px" are parsed to Float. - // complex values such as "rotate(1rad)" are returned as is. - result = jQuery.css( tween.elem, tween.prop, false, "" ); - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - // use step hook for back compat - use cssHook if its there - use .style if its - // available and use plain properties where available - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Remove in 2.0 - this supports IE8's panic based approach -// to setting things on disconnected nodes - -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" || - // special check for .toggle( handler, handler, ... ) - ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -}); - -jQuery.fn.extend({ - fadeTo: function( speed, to, easing, callback ) { - - // show any hidden elements after setting opacity to 0 - return this.filter( isHidden ).css( "opacity", 0 ).show() - - // animate to the value specified - .end().animate({ opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations resolve immediately - if ( empty ) { - anim.stop( true ); - } - }; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue && type !== false ) { - this.queue( type || "fx", [] ); - } - - return this.each(function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = jQuery._data( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // start the next in the queue if the last step wasn't forced - // timers currently will call their complete callbacks, which will dequeue - // but only if they were gotoEnd - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - }); - } -}); - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - attrs = { height: type }, - i = 0; - - // if we include width, step value is 1 to do all cssExpand values, - // if we don't include width, step value is 2 to skip over Left and Right - includeWidth = includeWidth? 1 : 0; - for( ; i < 4 ; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -// Generate shortcuts for custom animations -jQuery.each({ - slideDown: genFx("show"), - slideUp: genFx("hide"), - slideToggle: genFx("toggle"), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -}); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - jQuery.isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing - }; - - opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : - opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; - - // normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( jQuery.isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p*Math.PI ) / 2; - } -}; - -jQuery.timers = []; -jQuery.fx = Tween.prototype.init; -jQuery.fx.tick = function() { - var timer, - timers = jQuery.timers, - i = 0; - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - // Checks the timer has not already been removed - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } -}; - -jQuery.fx.timer = function( timer ) { - if ( timer() && jQuery.timers.push( timer ) && !timerId ) { - timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); - } -}; - -jQuery.fx.interval = 13; - -jQuery.fx.stop = function() { - clearInterval( timerId ); - timerId = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - // Default speed - _default: 400 -}; - -// Back Compat <1.8 extension point -jQuery.fx.step = {}; - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.animated = function( elem ) { - return jQuery.grep(jQuery.timers, function( fn ) { - return elem === fn.elem; - }).length; - }; -} -var rroot = /^(?:body|html)$/i; - -jQuery.fn.offset = function( options ) { - if ( arguments.length ) { - return options === undefined ? - this : - this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } - - var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, - box = { top: 0, left: 0 }, - elem = this[ 0 ], - doc = elem && elem.ownerDocument; - - if ( !doc ) { - return; - } - - if ( (body = doc.body) === elem ) { - return jQuery.offset.bodyOffset( elem ); - } - - docElem = doc.documentElement; - - // Make sure it's not a disconnected DOM node - if ( !jQuery.contains( docElem, elem ) ) { - return box; - } - - // If we don't have gBCR, just use 0,0 rather than error - // BlackBerry 5, iOS 3 (original iPhone) - if ( typeof elem.getBoundingClientRect !== "undefined" ) { - box = elem.getBoundingClientRect(); - } - win = getWindow( doc ); - clientTop = docElem.clientTop || body.clientTop || 0; - clientLeft = docElem.clientLeft || body.clientLeft || 0; - scrollTop = win.pageYOffset || docElem.scrollTop; - scrollLeft = win.pageXOffset || docElem.scrollLeft; - return { - top: box.top + scrollTop - clientTop, - left: box.left + scrollLeft - clientLeft - }; -}; - -jQuery.offset = { - - bodyOffset: function( body ) { - var top = body.offsetTop, - left = body.offsetLeft; - - if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { - top += parseFloat( jQuery.css(body, "marginTop") ) || 0; - left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; - } - - return { top: top, left: left }; - }, - - setOffset: function( elem, options, i ) { - var position = jQuery.css( elem, "position" ); - - // set position first, in-case top/left are set even on static elem - if ( position === "static" ) { - elem.style.position = "relative"; - } - - var curElem = jQuery( elem ), - curOffset = curElem.offset(), - curCSSTop = jQuery.css( elem, "top" ), - curCSSLeft = jQuery.css( elem, "left" ), - calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, - props = {}, curPosition = {}, curTop, curLeft; - - // need to be able to calculate position if either top or left is auto and position is either absolute or fixed - if ( calculatePosition ) { - curPosition = curElem.position(); - curTop = curPosition.top; - curLeft = curPosition.left; - } else { - curTop = parseFloat( curCSSTop ) || 0; - curLeft = parseFloat( curCSSLeft ) || 0; - } - - if ( jQuery.isFunction( options ) ) { - options = options.call( elem, i, curOffset ); - } - - if ( options.top != null ) { - props.top = ( options.top - curOffset.top ) + curTop; - } - if ( options.left != null ) { - props.left = ( options.left - curOffset.left ) + curLeft; - } - - if ( "using" in options ) { - options.using.call( elem, props ); - } else { - curElem.css( props ); - } - } -}; - - -jQuery.fn.extend({ - - position: function() { - if ( !this[0] ) { - return; - } - - var elem = this[0], - - // Get *real* offsetParent - offsetParent = this.offsetParent(), - - // Get correct offsets - offset = this.offset(), - parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); - - // Subtract element margins - // note: when an element has margin: auto the offsetLeft and marginLeft - // are the same in Safari causing offset.left to incorrectly be 0 - offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; - offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; - - // Add offsetParent borders - parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; - parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; - - // Subtract the two offsets - return { - top: offset.top - parentOffset.top, - left: offset.left - parentOffset.left - }; - }, - - offsetParent: function() { - return this.map(function() { - var offsetParent = this.offsetParent || document.body; - while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { - offsetParent = offsetParent.offsetParent; - } - return offsetParent || document.body; - }); - } -}); - - -// Create scrollLeft and scrollTop methods -jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { - var top = /Y/.test( prop ); - - jQuery.fn[ method ] = function( val ) { - return jQuery.access( this, function( elem, method, val ) { - var win = getWindow( elem ); - - if ( val === undefined ) { - return win ? (prop in win) ? win[ prop ] : - win.document.documentElement[ method ] : - elem[ method ]; - } - - if ( win ) { - win.scrollTo( - !top ? val : jQuery( win ).scrollLeft(), - top ? val : jQuery( win ).scrollTop() - ); - - } else { - elem[ method ] = val; - } - }, method, val, arguments.length, null ); - }; -}); - -function getWindow( elem ) { - return jQuery.isWindow( elem ) ? - elem : - elem.nodeType === 9 ? - elem.defaultView || elem.parentWindow : - false; -} -// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods -jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { - jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { - // margin is only for outerHeight, outerWidth - jQuery.fn[ funcName ] = function( margin, value ) { - var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), - extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); - - return jQuery.access( this, function( elem, type, value ) { - var doc; - - if ( jQuery.isWindow( elem ) ) { - // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there - // isn't a whole lot we can do. See pull request at this URL for discussion: - // https://github.com/jquery/jquery/pull/764 - return elem.document.documentElement[ "client" + name ]; - } - - // Get document width or height - if ( elem.nodeType === 9 ) { - doc = elem.documentElement; - - // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest - // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. - return Math.max( - elem.body[ "scroll" + name ], doc[ "scroll" + name ], - elem.body[ "offset" + name ], doc[ "offset" + name ], - doc[ "client" + name ] - ); - } - - return value === undefined ? - // Get width or height on the element, requesting but not forcing parseFloat - jQuery.css( elem, type, value, extra ) : - - // Set width or height on the element - jQuery.style( elem, type, value, extra ); - }, type, chainable ? margin : undefined, chainable, null ); - }; - }); -}); -// Expose jQuery to the global object -window.jQuery = window.$ = jQuery; - -// Expose jQuery as an AMD module, but only for AMD loaders that -// understand the issues with loading multiple versions of jQuery -// in a page that all might call define(). The loader will indicate -// they have special allowances for multiple jQuery versions by -// specifying define.amd.jQuery = true. Register as a named module, -// since jQuery can be concatenated with other files that may use define, -// but not use a proper concatenation script that understands anonymous -// AMD modules. A named AMD is safest and most robust way to register. -// Lowercase jquery is used because AMD module names are derived from -// file names, and jQuery is normally delivered in a lowercase file name. -// Do this after creating the global so that if an AMD module wants to call -// noConflict to hide this version of jQuery, it will work. -if ( typeof define === "function" && define.amd && define.amd.jQuery ) { - define( "jquery", [], function () { return jQuery; } ); -} - -})( window ); diff --git a/NzbDrone.Web/Scripts2/jquery-ui-1.8.23.js b/NzbDrone.Web/Scripts2/jquery-ui-1.8.23.js deleted file mode 100644 index f077cb9c2..000000000 --- a/NzbDrone.Web/Scripts2/jquery-ui-1.8.23.js +++ /dev/null @@ -1,11363 +0,0 @@ -/*! jQuery UI - v1.8.23 - 2012-08-15 -* https://github.com/jquery/jquery-ui -* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js, jquery.effects.blind.js, jquery.effects.bounce.js, jquery.effects.clip.js, jquery.effects.drop.js, jquery.effects.explode.js, jquery.effects.fade.js, jquery.effects.fold.js, jquery.effects.highlight.js, jquery.effects.pulsate.js, jquery.effects.scale.js, jquery.effects.shake.js, jquery.effects.slide.js, jquery.effects.transfer.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.tabs.js -* Copyright (c) 2012 AUTHORS.txt; Licensed MIT */ - -(function( $, undefined ) { - -// prevent duplicate loading -// this is only a problem because we proxy existing functions -// and we don't want to double proxy them -$.ui = $.ui || {}; -if ( $.ui.version ) { - return; -} - -$.extend( $.ui, { - version: "1.8.23", - - keyCode: { - ALT: 18, - BACKSPACE: 8, - CAPS_LOCK: 20, - COMMA: 188, - COMMAND: 91, - COMMAND_LEFT: 91, // COMMAND - COMMAND_RIGHT: 93, - CONTROL: 17, - DELETE: 46, - DOWN: 40, - END: 35, - ENTER: 13, - ESCAPE: 27, - HOME: 36, - INSERT: 45, - LEFT: 37, - MENU: 93, // COMMAND_RIGHT - NUMPAD_ADD: 107, - NUMPAD_DECIMAL: 110, - NUMPAD_DIVIDE: 111, - NUMPAD_ENTER: 108, - NUMPAD_MULTIPLY: 106, - NUMPAD_SUBTRACT: 109, - PAGE_DOWN: 34, - PAGE_UP: 33, - PERIOD: 190, - RIGHT: 39, - SHIFT: 16, - SPACE: 32, - TAB: 9, - UP: 38, - WINDOWS: 91 // COMMAND - } -}); - -// plugins -$.fn.extend({ - propAttr: $.fn.prop || $.fn.attr, - - _focus: $.fn.focus, - focus: function( delay, fn ) { - return typeof delay === "number" ? - this.each(function() { - var elem = this; - setTimeout(function() { - $( elem ).focus(); - if ( fn ) { - fn.call( elem ); - } - }, delay ); - }) : - this._focus.apply( this, arguments ); - }, - - scrollParent: function() { - var scrollParent; - if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { - scrollParent = this.parents().filter(function() { - return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); - }).eq(0); - } else { - scrollParent = this.parents().filter(function() { - return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1)); - }).eq(0); - } - - return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; - }, - - zIndex: function( zIndex ) { - if ( zIndex !== undefined ) { - return this.css( "zIndex", zIndex ); - } - - if ( this.length ) { - var elem = $( this[ 0 ] ), position, value; - while ( elem.length && elem[ 0 ] !== document ) { - // Ignore z-index if position is set to a value where z-index is ignored by the browser - // This makes behavior of this function consistent across browsers - // WebKit always returns auto if the element is positioned - position = elem.css( "position" ); - if ( position === "absolute" || position === "relative" || position === "fixed" ) { - // IE returns 0 when zIndex is not specified - // other browsers return a string - // we ignore the case of nested elements with an explicit value of 0 - //
      - value = parseInt( elem.css( "zIndex" ), 10 ); - if ( !isNaN( value ) && value !== 0 ) { - return value; - } - } - elem = elem.parent(); - } - } - - return 0; - }, - - disableSelection: function() { - return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + - ".ui-disableSelection", function( event ) { - event.preventDefault(); - }); - }, - - enableSelection: function() { - return this.unbind( ".ui-disableSelection" ); - } -}); - -// support: jQuery <1.8 -if ( !$( "" ).outerWidth( 1 ).jquery ) { - $.each( [ "Width", "Height" ], function( i, name ) { - var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], - type = name.toLowerCase(), - orig = { - innerWidth: $.fn.innerWidth, - innerHeight: $.fn.innerHeight, - outerWidth: $.fn.outerWidth, - outerHeight: $.fn.outerHeight - }; - - function reduce( elem, size, border, margin ) { - $.each( side, function() { - size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0; - if ( border ) { - size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0; - } - if ( margin ) { - size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0; - } - }); - return size; - } - - $.fn[ "inner" + name ] = function( size ) { - if ( size === undefined ) { - return orig[ "inner" + name ].call( this ); - } - - return this.each(function() { - $( this ).css( type, reduce( this, size ) + "px" ); - }); - }; - - $.fn[ "outer" + name] = function( size, margin ) { - if ( typeof size !== "number" ) { - return orig[ "outer" + name ].call( this, size ); - } - - return this.each(function() { - $( this).css( type, reduce( this, size, true, margin ) + "px" ); - }); - }; - }); -} - -// selectors -function focusable( element, isTabIndexNotNaN ) { - var nodeName = element.nodeName.toLowerCase(); - if ( "area" === nodeName ) { - var map = element.parentNode, - mapName = map.name, - img; - if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { - return false; - } - img = $( "img[usemap=#" + mapName + "]" )[0]; - return !!img && visible( img ); - } - return ( /input|select|textarea|button|object/.test( nodeName ) - ? !element.disabled - : "a" == nodeName - ? element.href || isTabIndexNotNaN - : isTabIndexNotNaN) - // the element and all of its ancestors must be visible - && visible( element ); -} - -function visible( element ) { - return !$( element ).parents().andSelf().filter(function() { - return $.curCSS( this, "visibility" ) === "hidden" || - $.expr.filters.hidden( this ); - }).length; -} - -$.extend( $.expr[ ":" ], { - data: $.expr.createPseudo ? - $.expr.createPseudo(function( dataName ) { - return function( elem ) { - return !!$.data( elem, dataName ); - }; - }) : - // support: jQuery <1.8 - function( elem, i, match ) { - return !!$.data( elem, match[ 3 ] ); - }, - - focusable: function( element ) { - return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); - }, - - tabbable: function( element ) { - var tabIndex = $.attr( element, "tabindex" ), - isTabIndexNaN = isNaN( tabIndex ); - return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); - } -}); - -// support -$(function() { - var body = document.body, - div = body.appendChild( div = document.createElement( "div" ) ); - - // access offsetHeight before setting the style to prevent a layout bug - // in IE 9 which causes the elemnt to continue to take up space even - // after it is removed from the DOM (#8026) - div.offsetHeight; - - $.extend( div.style, { - minHeight: "100px", - height: "auto", - padding: 0, - borderWidth: 0 - }); - - $.support.minHeight = div.offsetHeight === 100; - $.support.selectstart = "onselectstart" in div; - - // set display to none to avoid a layout bug in IE - // http://dev.jquery.com/ticket/4014 - body.removeChild( div ).style.display = "none"; -}); - -// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css -if ( !$.curCSS ) { - $.curCSS = $.css; -} - - - - - -// deprecated -$.extend( $.ui, { - // $.ui.plugin is deprecated. Use the proxy pattern instead. - plugin: { - add: function( module, option, set ) { - var proto = $.ui[ module ].prototype; - for ( var i in set ) { - proto.plugins[ i ] = proto.plugins[ i ] || []; - proto.plugins[ i ].push( [ option, set[ i ] ] ); - } - }, - call: function( instance, name, args ) { - var set = instance.plugins[ name ]; - if ( !set || !instance.element[ 0 ].parentNode ) { - return; - } - - for ( var i = 0; i < set.length; i++ ) { - if ( instance.options[ set[ i ][ 0 ] ] ) { - set[ i ][ 1 ].apply( instance.element, args ); - } - } - } - }, - - // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains() - contains: function( a, b ) { - return document.compareDocumentPosition ? - a.compareDocumentPosition( b ) & 16 : - a !== b && a.contains( b ); - }, - - // only used by resizable - hasScroll: function( el, a ) { - - //If overflow is hidden, the element might have extra content, but the user wants to hide it - if ( $( el ).css( "overflow" ) === "hidden") { - return false; - } - - var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", - has = false; - - if ( el[ scroll ] > 0 ) { - return true; - } - - // TODO: determine which cases actually cause this to happen - // if the element doesn't have the scroll set, see if it's possible to - // set the scroll - el[ scroll ] = 1; - has = ( el[ scroll ] > 0 ); - el[ scroll ] = 0; - return has; - }, - - // these are odd functions, fix the API or move into individual plugins - isOverAxis: function( x, reference, size ) { - //Determines when x coordinate is over "b" element axis - return ( x > reference ) && ( x < ( reference + size ) ); - }, - isOver: function( y, x, top, left, height, width ) { - //Determines when x, y coordinates is over "b" element - return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); - } -}); - -})( jQuery ); - -(function( $, undefined ) { - -// jQuery 1.4+ -if ( $.cleanData ) { - var _cleanData = $.cleanData; - $.cleanData = function( elems ) { - for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { - try { - $( elem ).triggerHandler( "remove" ); - // http://bugs.jquery.com/ticket/8235 - } catch( e ) {} - } - _cleanData( elems ); - }; -} else { - var _remove = $.fn.remove; - $.fn.remove = function( selector, keepData ) { - return this.each(function() { - if ( !keepData ) { - if ( !selector || $.filter( selector, [ this ] ).length ) { - $( "*", this ).add( [ this ] ).each(function() { - try { - $( this ).triggerHandler( "remove" ); - // http://bugs.jquery.com/ticket/8235 - } catch( e ) {} - }); - } - } - return _remove.call( $(this), selector, keepData ); - }); - }; -} - -$.widget = function( name, base, prototype ) { - var namespace = name.split( "." )[ 0 ], - fullName; - name = name.split( "." )[ 1 ]; - fullName = namespace + "-" + name; - - if ( !prototype ) { - prototype = base; - base = $.Widget; - } - - // create selector for plugin - $.expr[ ":" ][ fullName ] = function( elem ) { - return !!$.data( elem, name ); - }; - - $[ namespace ] = $[ namespace ] || {}; - $[ namespace ][ name ] = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } - }; - - var basePrototype = new base(); - // we need to make the options hash a property directly on the new instance - // otherwise we'll modify the options hash on the prototype that we're - // inheriting from -// $.each( basePrototype, function( key, val ) { -// if ( $.isPlainObject(val) ) { -// basePrototype[ key ] = $.extend( {}, val ); -// } -// }); - basePrototype.options = $.extend( true, {}, basePrototype.options ); - $[ namespace ][ name ].prototype = $.extend( true, basePrototype, { - namespace: namespace, - widgetName: name, - widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name, - widgetBaseClass: fullName - }, prototype ); - - $.widget.bridge( name, $[ namespace ][ name ] ); -}; - -$.widget.bridge = function( name, object ) { - $.fn[ name ] = function( options ) { - var isMethodCall = typeof options === "string", - args = Array.prototype.slice.call( arguments, 1 ), - returnValue = this; - - // allow multiple hashes to be passed on init - options = !isMethodCall && args.length ? - $.extend.apply( null, [ true, options ].concat(args) ) : - options; - - // prevent calls to internal methods - if ( isMethodCall && options.charAt( 0 ) === "_" ) { - return returnValue; - } - - if ( isMethodCall ) { - this.each(function() { - var instance = $.data( this, name ), - methodValue = instance && $.isFunction( instance[options] ) ? - instance[ options ].apply( instance, args ) : - instance; - // TODO: add this back in 1.9 and use $.error() (see #5972) -// if ( !instance ) { -// throw "cannot call methods on " + name + " prior to initialization; " + -// "attempted to call method '" + options + "'"; -// } -// if ( !$.isFunction( instance[options] ) ) { -// throw "no such method '" + options + "' for " + name + " widget instance"; -// } -// var methodValue = instance[ options ].apply( instance, args ); - if ( methodValue !== instance && methodValue !== undefined ) { - returnValue = methodValue; - return false; - } - }); - } else { - this.each(function() { - var instance = $.data( this, name ); - if ( instance ) { - instance.option( options || {} )._init(); - } else { - $.data( this, name, new object( options, this ) ); - } - }); - } - - return returnValue; - }; -}; - -$.Widget = function( options, element ) { - // allow instantiation without initializing for simple inheritance - if ( arguments.length ) { - this._createWidget( options, element ); - } -}; - -$.Widget.prototype = { - widgetName: "widget", - widgetEventPrefix: "", - options: { - disabled: false - }, - _createWidget: function( options, element ) { - // $.widget.bridge stores the plugin instance, but we do it anyway - // so that it's stored even before the _create function runs - $.data( element, this.widgetName, this ); - this.element = $( element ); - this.options = $.extend( true, {}, - this.options, - this._getCreateOptions(), - options ); - - var self = this; - this.element.bind( "remove." + this.widgetName, function() { - self.destroy(); - }); - - this._create(); - this._trigger( "create" ); - this._init(); - }, - _getCreateOptions: function() { - return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ]; - }, - _create: function() {}, - _init: function() {}, - - destroy: function() { - this.element - .unbind( "." + this.widgetName ) - .removeData( this.widgetName ); - this.widget() - .unbind( "." + this.widgetName ) - .removeAttr( "aria-disabled" ) - .removeClass( - this.widgetBaseClass + "-disabled " + - "ui-state-disabled" ); - }, - - widget: function() { - return this.element; - }, - - option: function( key, value ) { - var options = key; - - if ( arguments.length === 0 ) { - // don't return a reference to the internal hash - return $.extend( {}, this.options ); - } - - if (typeof key === "string" ) { - if ( value === undefined ) { - return this.options[ key ]; - } - options = {}; - options[ key ] = value; - } - - this._setOptions( options ); - - return this; - }, - _setOptions: function( options ) { - var self = this; - $.each( options, function( key, value ) { - self._setOption( key, value ); - }); - - return this; - }, - _setOption: function( key, value ) { - this.options[ key ] = value; - - if ( key === "disabled" ) { - this.widget() - [ value ? "addClass" : "removeClass"]( - this.widgetBaseClass + "-disabled" + " " + - "ui-state-disabled" ) - .attr( "aria-disabled", value ); - } - - return this; - }, - - enable: function() { - return this._setOption( "disabled", false ); - }, - disable: function() { - return this._setOption( "disabled", true ); - }, - - _trigger: function( type, event, data ) { - var prop, orig, - callback = this.options[ type ]; - - data = data || {}; - event = $.Event( event ); - event.type = ( type === this.widgetEventPrefix ? - type : - this.widgetEventPrefix + type ).toLowerCase(); - // the original event may come from any element - // so we need to reset the target on the new event - event.target = this.element[ 0 ]; - - // copy original event properties over to the new event - orig = event.originalEvent; - if ( orig ) { - for ( prop in orig ) { - if ( !( prop in event ) ) { - event[ prop ] = orig[ prop ]; - } - } - } - - this.element.trigger( event, data ); - - return !( $.isFunction(callback) && - callback.call( this.element[0], event, data ) === false || - event.isDefaultPrevented() ); - } -}; - -})( jQuery ); - -(function( $, undefined ) { - -var mouseHandled = false; -$( document ).mouseup( function( e ) { - mouseHandled = false; -}); - -$.widget("ui.mouse", { - options: { - cancel: ':input,option', - distance: 1, - delay: 0 - }, - _mouseInit: function() { - var self = this; - - this.element - .bind('mousedown.'+this.widgetName, function(event) { - return self._mouseDown(event); - }) - .bind('click.'+this.widgetName, function(event) { - if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) { - $.removeData(event.target, self.widgetName + '.preventClickEvent'); - event.stopImmediatePropagation(); - return false; - } - }); - - this.started = false; - }, - - // TODO: make sure destroying one instance of mouse doesn't mess with - // other instances of mouse - _mouseDestroy: function() { - this.element.unbind('.'+this.widgetName); - if ( this._mouseMoveDelegate ) { - $(document) - .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) - .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); - } - }, - - _mouseDown: function(event) { - // don't let more than one widget handle mouseStart - if( mouseHandled ) { return }; - - // we may have missed mouseup (out of window) - (this._mouseStarted && this._mouseUp(event)); - - this._mouseDownEvent = event; - - var self = this, - btnIsLeft = (event.which == 1), - // event.target.nodeName works around a bug in IE 8 with - // disabled inputs (#7620) - elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); - if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { - return true; - } - - this.mouseDelayMet = !this.options.delay; - if (!this.mouseDelayMet) { - this._mouseDelayTimer = setTimeout(function() { - self.mouseDelayMet = true; - }, this.options.delay); - } - - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { - this._mouseStarted = (this._mouseStart(event) !== false); - if (!this._mouseStarted) { - event.preventDefault(); - return true; - } - } - - // Click event may never have fired (Gecko & Opera) - if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) { - $.removeData(event.target, this.widgetName + '.preventClickEvent'); - } - - // these delegates are required to keep context - this._mouseMoveDelegate = function(event) { - return self._mouseMove(event); - }; - this._mouseUpDelegate = function(event) { - return self._mouseUp(event); - }; - $(document) - .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) - .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); - - event.preventDefault(); - - mouseHandled = true; - return true; - }, - - _mouseMove: function(event) { - // IE mouseup check - mouseup happened when mouse was out of window - if ($.browser.msie && !(document.documentMode >= 9) && !event.button) { - return this._mouseUp(event); - } - - if (this._mouseStarted) { - this._mouseDrag(event); - return event.preventDefault(); - } - - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { - this._mouseStarted = - (this._mouseStart(this._mouseDownEvent, event) !== false); - (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); - } - - return !this._mouseStarted; - }, - - _mouseUp: function(event) { - $(document) - .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate) - .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate); - - if (this._mouseStarted) { - this._mouseStarted = false; - - if (event.target == this._mouseDownEvent.target) { - $.data(event.target, this.widgetName + '.preventClickEvent', true); - } - - this._mouseStop(event); - } - - return false; - }, - - _mouseDistanceMet: function(event) { - return (Math.max( - Math.abs(this._mouseDownEvent.pageX - event.pageX), - Math.abs(this._mouseDownEvent.pageY - event.pageY) - ) >= this.options.distance - ); - }, - - _mouseDelayMet: function(event) { - return this.mouseDelayMet; - }, - - // These are placeholder methods, to be overriden by extending plugin - _mouseStart: function(event) {}, - _mouseDrag: function(event) {}, - _mouseStop: function(event) {}, - _mouseCapture: function(event) { return true; } -}); - -})(jQuery); - -(function( $, undefined ) { - -$.widget("ui.draggable", $.ui.mouse, { - widgetEventPrefix: "drag", - options: { - addClasses: true, - appendTo: "parent", - axis: false, - connectToSortable: false, - containment: false, - cursor: "auto", - cursorAt: false, - grid: false, - handle: false, - helper: "original", - iframeFix: false, - opacity: false, - refreshPositions: false, - revert: false, - revertDuration: 500, - scope: "default", - scroll: true, - scrollSensitivity: 20, - scrollSpeed: 20, - snap: false, - snapMode: "both", - snapTolerance: 20, - stack: false, - zIndex: false - }, - _create: function() { - - if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) - this.element[0].style.position = 'relative'; - - (this.options.addClasses && this.element.addClass("ui-draggable")); - (this.options.disabled && this.element.addClass("ui-draggable-disabled")); - - this._mouseInit(); - - }, - - destroy: function() { - if(!this.element.data('draggable')) return; - this.element - .removeData("draggable") - .unbind(".draggable") - .removeClass("ui-draggable" - + " ui-draggable-dragging" - + " ui-draggable-disabled"); - this._mouseDestroy(); - - return this; - }, - - _mouseCapture: function(event) { - - var o = this.options; - - // among others, prevent a drag on a resizable-handle - if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) - return false; - - //Quit if we're not on a valid handle - this.handle = this._getHandle(event); - if (!this.handle) - return false; - - if ( o.iframeFix ) { - $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { - $('
      ') - .css({ - width: this.offsetWidth+"px", height: this.offsetHeight+"px", - position: "absolute", opacity: "0.001", zIndex: 1000 - }) - .css($(this).offset()) - .appendTo("body"); - }); - } - - return true; - - }, - - _mouseStart: function(event) { - - var o = this.options; - - //Create and append the visible helper - this.helper = this._createHelper(event); - - this.helper.addClass("ui-draggable-dragging"); - - //Cache the helper size - this._cacheHelperProportions(); - - //If ddmanager is used for droppables, set the global draggable - if($.ui.ddmanager) - $.ui.ddmanager.current = this; - - /* - * - Position generation - - * This block generates everything position related - it's the core of draggables. - */ - - //Cache the margins of the original element - this._cacheMargins(); - - //Store the helper's css position - this.cssPosition = this.helper.css("position"); - this.scrollParent = this.helper.scrollParent(); - - //The element's absolute position on the page minus margins - this.offset = this.positionAbs = this.element.offset(); - this.offset = { - top: this.offset.top - this.margins.top, - left: this.offset.left - this.margins.left - }; - - $.extend(this.offset, { - click: { //Where the click happened, relative to the element - left: event.pageX - this.offset.left, - top: event.pageY - this.offset.top - }, - parent: this._getParentOffset(), - relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper - }); - - //Generate the original position - this.originalPosition = this.position = this._generatePosition(event); - this.originalPageX = event.pageX; - this.originalPageY = event.pageY; - - //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied - (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); - - //Set a containment if given in the options - if(o.containment) - this._setContainment(); - - //Trigger event + callbacks - if(this._trigger("start", event) === false) { - this._clear(); - return false; - } - - //Recache the helper size - this._cacheHelperProportions(); - - //Prepare the droppable offsets - if ($.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(this, event); - - - this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position - - //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) - if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event); - - return true; - }, - - _mouseDrag: function(event, noPropagation) { - - //Compute the helpers position - this.position = this._generatePosition(event); - this.positionAbs = this._convertPositionTo("absolute"); - - //Call plugins and callbacks and use the resulting position if something is returned - if (!noPropagation) { - var ui = this._uiHash(); - if(this._trigger('drag', event, ui) === false) { - this._mouseUp({}); - return false; - } - this.position = ui.position; - } - - if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; - if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; - if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); - - return false; - }, - - _mouseStop: function(event) { - - //If we are using droppables, inform the manager about the drop - var dropped = false; - if ($.ui.ddmanager && !this.options.dropBehaviour) - dropped = $.ui.ddmanager.drop(this, event); - - //if a drop comes from outside (a sortable) - if(this.dropped) { - dropped = this.dropped; - this.dropped = false; - } - - //if the original element is no longer in the DOM don't bother to continue (see #8269) - var element = this.element[0], elementInDom = false; - while ( element && (element = element.parentNode) ) { - if (element == document ) { - elementInDom = true; - } - } - if ( !elementInDom && this.options.helper === "original" ) - return false; - - if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { - var self = this; - $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { - if(self._trigger("stop", event) !== false) { - self._clear(); - } - }); - } else { - if(this._trigger("stop", event) !== false) { - this._clear(); - } - } - - return false; - }, - - _mouseUp: function(event) { - if (this.options.iframeFix === true) { - $("div.ui-draggable-iframeFix").each(function() { - this.parentNode.removeChild(this); - }); //Remove frame helpers - } - - //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) - if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event); - - return $.ui.mouse.prototype._mouseUp.call(this, event); - }, - - cancel: function() { - - if(this.helper.is(".ui-draggable-dragging")) { - this._mouseUp({}); - } else { - this._clear(); - } - - return this; - - }, - - _getHandle: function(event) { - - var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false; - $(this.options.handle, this.element) - .find("*") - .andSelf() - .each(function() { - if(this == event.target) handle = true; - }); - - return handle; - - }, - - _createHelper: function(event) { - - var o = this.options; - var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element); - - if(!helper.parents('body').length) - helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); - - if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) - helper.css("position", "absolute"); - - return helper; - - }, - - _adjustOffsetFromHelper: function(obj) { - if (typeof obj == 'string') { - obj = obj.split(' '); - } - if ($.isArray(obj)) { - obj = {left: +obj[0], top: +obj[1] || 0}; - } - if ('left' in obj) { - this.offset.click.left = obj.left + this.margins.left; - } - if ('right' in obj) { - this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; - } - if ('top' in obj) { - this.offset.click.top = obj.top + this.margins.top; - } - if ('bottom' in obj) { - this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; - } - }, - - _getParentOffset: function() { - - //Get the offsetParent and cache its position - this.offsetParent = this.helper.offsetParent(); - var po = this.offsetParent.offset(); - - // This is a special case where we need to modify a offset calculated on start, since the following happened: - // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent - // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that - // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag - if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { - po.left += this.scrollParent.scrollLeft(); - po.top += this.scrollParent.scrollTop(); - } - - if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information - || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix - po = { top: 0, left: 0 }; - - return { - top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), - left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) - }; - - }, - - _getRelativeOffset: function() { - - if(this.cssPosition == "relative") { - var p = this.element.position(); - return { - top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), - left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() - }; - } else { - return { top: 0, left: 0 }; - } - - }, - - _cacheMargins: function() { - this.margins = { - left: (parseInt(this.element.css("marginLeft"),10) || 0), - top: (parseInt(this.element.css("marginTop"),10) || 0), - right: (parseInt(this.element.css("marginRight"),10) || 0), - bottom: (parseInt(this.element.css("marginBottom"),10) || 0) - }; - }, - - _cacheHelperProportions: function() { - this.helperProportions = { - width: this.helper.outerWidth(), - height: this.helper.outerHeight() - }; - }, - - _setContainment: function() { - - var o = this.options; - if(o.containment == 'parent') o.containment = this.helper[0].parentNode; - if(o.containment == 'document' || o.containment == 'window') this.containment = [ - o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, - o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, - (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, - (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top - ]; - - if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { - var c = $(o.containment); - var ce = c[0]; if(!ce) return; - var co = c.offset(); - var over = ($(ce).css("overflow") != 'hidden'); - - this.containment = [ - (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), - (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0), - (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, - (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom - ]; - this.relative_container = c; - - } else if(o.containment.constructor == Array) { - this.containment = o.containment; - } - - }, - - _convertPositionTo: function(d, pos) { - - if(!pos) pos = this.position; - var mod = d == "absolute" ? 1 : -1; - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); - - return { - top: ( - pos.top // The absolute mouse position - + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) - - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) - ), - left: ( - pos.left // The absolute mouse position - + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) - - ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) - ) - }; - - }, - - _generatePosition: function(event) { - - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); - var pageX = event.pageX; - var pageY = event.pageY; - - /* - * - Position constraining - - * Constrain the position to a mix of grid, containment. - */ - - if(this.originalPosition) { //If we are not dragging yet, we won't check for options - var containment; - if(this.containment) { - if (this.relative_container){ - var co = this.relative_container.offset(); - containment = [ this.containment[0] + co.left, - this.containment[1] + co.top, - this.containment[2] + co.left, - this.containment[3] + co.top ]; - } - else { - containment = this.containment; - } - - if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left; - if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top; - if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left; - if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top; - } - - if(o.grid) { - //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) - var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; - pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; - - var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; - pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; - } - - } - - return { - top: ( - pageY // The absolute mouse position - - this.offset.click.top // Click offset (relative to the element) - - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.top // The offsetParent's offset without borders (offset + border) - + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) - ), - left: ( - pageX // The absolute mouse position - - this.offset.click.left // Click offset (relative to the element) - - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.left // The offsetParent's offset without borders (offset + border) - + ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) - ) - }; - - }, - - _clear: function() { - this.helper.removeClass("ui-draggable-dragging"); - if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove(); - //if($.ui.ddmanager) $.ui.ddmanager.current = null; - this.helper = null; - this.cancelHelperRemoval = false; - }, - - // From now on bulk stuff - mainly helpers - - _trigger: function(type, event, ui) { - ui = ui || this._uiHash(); - $.ui.plugin.call(this, type, [event, ui]); - if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins - return $.Widget.prototype._trigger.call(this, type, event, ui); - }, - - plugins: {}, - - _uiHash: function(event) { - return { - helper: this.helper, - position: this.position, - originalPosition: this.originalPosition, - offset: this.positionAbs - }; - } - -}); - -$.extend($.ui.draggable, { - version: "1.8.23" -}); - -$.ui.plugin.add("draggable", "connectToSortable", { - start: function(event, ui) { - - var inst = $(this).data("draggable"), o = inst.options, - uiSortable = $.extend({}, ui, { item: inst.element }); - inst.sortables = []; - $(o.connectToSortable).each(function() { - var sortable = $.data(this, 'sortable'); - if (sortable && !sortable.options.disabled) { - inst.sortables.push({ - instance: sortable, - shouldRevert: sortable.options.revert - }); - sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). - sortable._trigger("activate", event, uiSortable); - } - }); - - }, - stop: function(event, ui) { - - //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper - var inst = $(this).data("draggable"), - uiSortable = $.extend({}, ui, { item: inst.element }); - - $.each(inst.sortables, function() { - if(this.instance.isOver) { - - this.instance.isOver = 0; - - inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance - this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) - - //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' - if(this.shouldRevert) this.instance.options.revert = true; - - //Trigger the stop of the sortable - this.instance._mouseStop(event); - - this.instance.options.helper = this.instance.options._helper; - - //If the helper has been the original item, restore properties in the sortable - if(inst.options.helper == 'original') - this.instance.currentItem.css({ top: 'auto', left: 'auto' }); - - } else { - this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance - this.instance._trigger("deactivate", event, uiSortable); - } - - }); - - }, - drag: function(event, ui) { - - var inst = $(this).data("draggable"), self = this; - - var checkPos = function(o) { - var dyClick = this.offset.click.top, dxClick = this.offset.click.left; - var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left; - var itemHeight = o.height, itemWidth = o.width; - var itemTop = o.top, itemLeft = o.left; - - return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth); - }; - - $.each(inst.sortables, function(i) { - - //Copy over some variables to allow calling the sortable's native _intersectsWith - this.instance.positionAbs = inst.positionAbs; - this.instance.helperProportions = inst.helperProportions; - this.instance.offset.click = inst.offset.click; - - if(this.instance._intersectsWith(this.instance.containerCache)) { - - //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once - if(!this.instance.isOver) { - - this.instance.isOver = 1; - //Now we fake the start of dragging for the sortable instance, - //by cloning the list group item, appending it to the sortable and using it as inst.currentItem - //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) - this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true); - this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it - this.instance.options.helper = function() { return ui.helper[0]; }; - - event.target = this.instance.currentItem[0]; - this.instance._mouseCapture(event, true); - this.instance._mouseStart(event, true, true); - - //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes - this.instance.offset.click.top = inst.offset.click.top; - this.instance.offset.click.left = inst.offset.click.left; - this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; - this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; - - inst._trigger("toSortable", event); - inst.dropped = this.instance.element; //draggable revert needs that - //hack so receive/update callbacks work (mostly) - inst.currentItem = inst.element; - this.instance.fromOutside = inst; - - } - - //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable - if(this.instance.currentItem) this.instance._mouseDrag(event); - - } else { - - //If it doesn't intersect with the sortable, and it intersected before, - //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval - if(this.instance.isOver) { - - this.instance.isOver = 0; - this.instance.cancelHelperRemoval = true; - - //Prevent reverting on this forced stop - this.instance.options.revert = false; - - // The out event needs to be triggered independently - this.instance._trigger('out', event, this.instance._uiHash(this.instance)); - - this.instance._mouseStop(event, true); - this.instance.options.helper = this.instance.options._helper; - - //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size - this.instance.currentItem.remove(); - if(this.instance.placeholder) this.instance.placeholder.remove(); - - inst._trigger("fromSortable", event); - inst.dropped = false; //draggable revert needs that - } - - }; - - }); - - } -}); - -$.ui.plugin.add("draggable", "cursor", { - start: function(event, ui) { - var t = $('body'), o = $(this).data('draggable').options; - if (t.css("cursor")) o._cursor = t.css("cursor"); - t.css("cursor", o.cursor); - }, - stop: function(event, ui) { - var o = $(this).data('draggable').options; - if (o._cursor) $('body').css("cursor", o._cursor); - } -}); - -$.ui.plugin.add("draggable", "opacity", { - start: function(event, ui) { - var t = $(ui.helper), o = $(this).data('draggable').options; - if(t.css("opacity")) o._opacity = t.css("opacity"); - t.css('opacity', o.opacity); - }, - stop: function(event, ui) { - var o = $(this).data('draggable').options; - if(o._opacity) $(ui.helper).css('opacity', o._opacity); - } -}); - -$.ui.plugin.add("draggable", "scroll", { - start: function(event, ui) { - var i = $(this).data("draggable"); - if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); - }, - drag: function(event, ui) { - - var i = $(this).data("draggable"), o = i.options, scrolled = false; - - if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { - - if(!o.axis || o.axis != 'x') { - if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) - i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; - else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) - i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; - } - - if(!o.axis || o.axis != 'y') { - if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) - i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; - else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) - i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; - } - - } else { - - if(!o.axis || o.axis != 'x') { - if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); - else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); - } - - if(!o.axis || o.axis != 'y') { - if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); - else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); - } - - } - - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(i, event); - - } -}); - -$.ui.plugin.add("draggable", "snap", { - start: function(event, ui) { - - var i = $(this).data("draggable"), o = i.options; - i.snapElements = []; - - $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() { - var $t = $(this); var $o = $t.offset(); - if(this != i.element[0]) i.snapElements.push({ - item: this, - width: $t.outerWidth(), height: $t.outerHeight(), - top: $o.top, left: $o.left - }); - }); - - }, - drag: function(event, ui) { - - var inst = $(this).data("draggable"), o = inst.options; - var d = o.snapTolerance; - - var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, - y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; - - for (var i = inst.snapElements.length - 1; i >= 0; i--){ - - var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, - t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; - - //Yes, I know, this is insane ;) - if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { - if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); - inst.snapElements[i].snapping = false; - continue; - } - - if(o.snapMode != 'inner') { - var ts = Math.abs(t - y2) <= d; - var bs = Math.abs(b - y1) <= d; - var ls = Math.abs(l - x2) <= d; - var rs = Math.abs(r - x1) <= d; - if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; - if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; - if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; - if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; - } - - var first = (ts || bs || ls || rs); - - if(o.snapMode != 'outer') { - var ts = Math.abs(t - y1) <= d; - var bs = Math.abs(b - y2) <= d; - var ls = Math.abs(l - x1) <= d; - var rs = Math.abs(r - x2) <= d; - if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; - if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; - if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; - if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; - } - - if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) - (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); - inst.snapElements[i].snapping = (ts || bs || ls || rs || first); - - }; - - } -}); - -$.ui.plugin.add("draggable", "stack", { - start: function(event, ui) { - - var o = $(this).data("draggable").options; - - var group = $.makeArray($(o.stack)).sort(function(a,b) { - return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); - }); - if (!group.length) { return; } - - var min = parseInt(group[0].style.zIndex) || 0; - $(group).each(function(i) { - this.style.zIndex = min + i; - }); - - this[0].style.zIndex = min + group.length; - - } -}); - -$.ui.plugin.add("draggable", "zIndex", { - start: function(event, ui) { - var t = $(ui.helper), o = $(this).data("draggable").options; - if(t.css("zIndex")) o._zIndex = t.css("zIndex"); - t.css('zIndex', o.zIndex); - }, - stop: function(event, ui) { - var o = $(this).data("draggable").options; - if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex); - } -}); - -})(jQuery); - -(function( $, undefined ) { - -$.widget("ui.droppable", { - widgetEventPrefix: "drop", - options: { - accept: '*', - activeClass: false, - addClasses: true, - greedy: false, - hoverClass: false, - scope: 'default', - tolerance: 'intersect' - }, - _create: function() { - - var o = this.options, accept = o.accept; - this.isover = 0; this.isout = 1; - - this.accept = $.isFunction(accept) ? accept : function(d) { - return d.is(accept); - }; - - //Store the droppable's proportions - this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; - - // Add the reference and positions to the manager - $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || []; - $.ui.ddmanager.droppables[o.scope].push(this); - - (o.addClasses && this.element.addClass("ui-droppable")); - - }, - - destroy: function() { - var drop = $.ui.ddmanager.droppables[this.options.scope]; - for ( var i = 0; i < drop.length; i++ ) - if ( drop[i] == this ) - drop.splice(i, 1); - - this.element - .removeClass("ui-droppable ui-droppable-disabled") - .removeData("droppable") - .unbind(".droppable"); - - return this; - }, - - _setOption: function(key, value) { - - if(key == 'accept') { - this.accept = $.isFunction(value) ? value : function(d) { - return d.is(value); - }; - } - $.Widget.prototype._setOption.apply(this, arguments); - }, - - _activate: function(event) { - var draggable = $.ui.ddmanager.current; - if(this.options.activeClass) this.element.addClass(this.options.activeClass); - (draggable && this._trigger('activate', event, this.ui(draggable))); - }, - - _deactivate: function(event) { - var draggable = $.ui.ddmanager.current; - if(this.options.activeClass) this.element.removeClass(this.options.activeClass); - (draggable && this._trigger('deactivate', event, this.ui(draggable))); - }, - - _over: function(event) { - - var draggable = $.ui.ddmanager.current; - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element - - if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.hoverClass) this.element.addClass(this.options.hoverClass); - this._trigger('over', event, this.ui(draggable)); - } - - }, - - _out: function(event) { - - var draggable = $.ui.ddmanager.current; - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element - - if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); - this._trigger('out', event, this.ui(draggable)); - } - - }, - - _drop: function(event,custom) { - - var draggable = custom || $.ui.ddmanager.current; - if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element - - var childrenIntersection = false; - this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { - var inst = $.data(this, 'droppable'); - if( - inst.options.greedy - && !inst.options.disabled - && inst.options.scope == draggable.options.scope - && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) - && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) - ) { childrenIntersection = true; return false; } - }); - if(childrenIntersection) return false; - - if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - if(this.options.activeClass) this.element.removeClass(this.options.activeClass); - if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); - this._trigger('drop', event, this.ui(draggable)); - return this.element; - } - - return false; - - }, - - ui: function(c) { - return { - draggable: (c.currentItem || c.element), - helper: c.helper, - position: c.position, - offset: c.positionAbs - }; - } - -}); - -$.extend($.ui.droppable, { - version: "1.8.23" -}); - -$.ui.intersect = function(draggable, droppable, toleranceMode) { - - if (!droppable.offset) return false; - - var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, - y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; - var l = droppable.offset.left, r = l + droppable.proportions.width, - t = droppable.offset.top, b = t + droppable.proportions.height; - - switch (toleranceMode) { - case 'fit': - return (l <= x1 && x2 <= r - && t <= y1 && y2 <= b); - break; - case 'intersect': - return (l < x1 + (draggable.helperProportions.width / 2) // Right Half - && x2 - (draggable.helperProportions.width / 2) < r // Left Half - && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half - && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half - break; - case 'pointer': - var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), - draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), - isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); - return isOver; - break; - case 'touch': - return ( - (y1 >= t && y1 <= b) || // Top edge touching - (y2 >= t && y2 <= b) || // Bottom edge touching - (y1 < t && y2 > b) // Surrounded vertically - ) && ( - (x1 >= l && x1 <= r) || // Left edge touching - (x2 >= l && x2 <= r) || // Right edge touching - (x1 < l && x2 > r) // Surrounded horizontally - ); - break; - default: - return false; - break; - } - -}; - -/* - This manager tracks offsets of draggables and droppables -*/ -$.ui.ddmanager = { - current: null, - droppables: { 'default': [] }, - prepareOffsets: function(t, event) { - - var m = $.ui.ddmanager.droppables[t.options.scope] || []; - var type = event ? event.type : null; // workaround for #2317 - var list = (t.currentItem || t.element).find(":data(droppable)").andSelf(); - - droppablesLoop: for (var i = 0; i < m.length; i++) { - - if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted - for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item - m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue - - if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables - - m[i].offset = m[i].element.offset(); - m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; - - } - - }, - drop: function(draggable, event) { - - var dropped = false; - $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { - - if(!this.options) return; - if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) - dropped = this._drop.call(this, event) || dropped; - - if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { - this.isout = 1; this.isover = 0; - this._deactivate.call(this, event); - } - - }); - return dropped; - - }, - dragStart: function( draggable, event ) { - //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) - draggable.element.parents( ":not(body,html)" ).bind( "scroll.droppable", function() { - if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); - }); - }, - drag: function(draggable, event) { - - //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. - if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); - - //Run through all droppables and check their positions based on specific tolerance options - $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { - - if(this.options.disabled || this.greedyChild || !this.visible) return; - var intersects = $.ui.intersect(draggable, this, this.options.tolerance); - - var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); - if(!c) return; - - var parentInstance; - if (this.options.greedy) { - var parent = this.element.parents(':data(droppable):eq(0)'); - if (parent.length) { - parentInstance = $.data(parent[0], 'droppable'); - parentInstance.greedyChild = (c == 'isover' ? 1 : 0); - } - } - - // we just moved into a greedy child - if (parentInstance && c == 'isover') { - parentInstance['isover'] = 0; - parentInstance['isout'] = 1; - parentInstance._out.call(parentInstance, event); - } - - this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; - this[c == "isover" ? "_over" : "_out"].call(this, event); - - // we just moved out of a greedy child - if (parentInstance && c == 'isout') { - parentInstance['isout'] = 0; - parentInstance['isover'] = 1; - parentInstance._over.call(parentInstance, event); - } - }); - - }, - dragStop: function( draggable, event ) { - draggable.element.parents( ":not(body,html)" ).unbind( "scroll.droppable" ); - //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) - if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); - } -}; - -})(jQuery); - -(function( $, undefined ) { - -$.widget("ui.resizable", $.ui.mouse, { - widgetEventPrefix: "resize", - options: { - alsoResize: false, - animate: false, - animateDuration: "slow", - animateEasing: "swing", - aspectRatio: false, - autoHide: false, - containment: false, - ghost: false, - grid: false, - handles: "e,s,se", - helper: false, - maxHeight: null, - maxWidth: null, - minHeight: 10, - minWidth: 10, - zIndex: 1000 - }, - _create: function() { - - var self = this, o = this.options; - this.element.addClass("ui-resizable"); - - $.extend(this, { - _aspectRatio: !!(o.aspectRatio), - aspectRatio: o.aspectRatio, - originalElement: this.element, - _proportionallyResizeElements: [], - _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null - }); - - //Wrap the element if it cannot hold child nodes - if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { - - //Create a wrapper element and set the wrapper to the new current internal element - this.element.wrap( - $('
      ').css({ - position: this.element.css('position'), - width: this.element.outerWidth(), - height: this.element.outerHeight(), - top: this.element.css('top'), - left: this.element.css('left') - }) - ); - - //Overwrite the original this.element - this.element = this.element.parent().data( - "resizable", this.element.data('resizable') - ); - - this.elementIsWrapper = true; - - //Move margins to the wrapper - this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); - this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0}); - - //Prevent Safari textarea resize - this.originalResizeStyle = this.originalElement.css('resize'); - this.originalElement.css('resize', 'none'); - - //Push the actual element to our proportionallyResize internal array - this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' })); - - // avoid IE jump (hard set the margin) - this.originalElement.css({ margin: this.originalElement.css('margin') }); - - // fix handlers offset - this._proportionallyResize(); - - } - - this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' }); - if(this.handles.constructor == String) { - - if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw'; - var n = this.handles.split(","); this.handles = {}; - - for(var i = 0; i < n.length; i++) { - - var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; - var axis = $('
      '); - - // Apply zIndex to all handles - see #7960 - axis.css({ zIndex: o.zIndex }); - - //TODO : What's going on here? - if ('se' == handle) { - axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se'); - }; - - //Insert into internal handles object and append to element - this.handles[handle] = '.ui-resizable-'+handle; - this.element.append(axis); - } - - } - - this._renderAxis = function(target) { - - target = target || this.element; - - for(var i in this.handles) { - - if(this.handles[i].constructor == String) - this.handles[i] = $(this.handles[i], this.element).show(); - - //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) - if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { - - var axis = $(this.handles[i], this.element), padWrapper = 0; - - //Checking the correct pad and border - padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); - - //The padding type i have to apply... - var padPos = [ 'padding', - /ne|nw|n/.test(i) ? 'Top' : - /se|sw|s/.test(i) ? 'Bottom' : - /^e$/.test(i) ? 'Right' : 'Left' ].join(""); - - target.css(padPos, padWrapper); - - this._proportionallyResize(); - - } - - //TODO: What's that good for? There's not anything to be executed left - if(!$(this.handles[i]).length) - continue; - - } - }; - - //TODO: make renderAxis a prototype function - this._renderAxis(this.element); - - this._handles = $('.ui-resizable-handle', this.element) - .disableSelection(); - - //Matching axis name - this._handles.mouseover(function() { - if (!self.resizing) { - if (this.className) - var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); - //Axis, default = se - self.axis = axis && axis[1] ? axis[1] : 'se'; - } - }); - - //If we want to auto hide the elements - if (o.autoHide) { - this._handles.hide(); - $(this.element) - .addClass("ui-resizable-autohide") - .hover(function() { - if (o.disabled) return; - $(this).removeClass("ui-resizable-autohide"); - self._handles.show(); - }, - function(){ - if (o.disabled) return; - if (!self.resizing) { - $(this).addClass("ui-resizable-autohide"); - self._handles.hide(); - } - }); - } - - //Initialize the mouse interaction - this._mouseInit(); - - }, - - destroy: function() { - - this._mouseDestroy(); - - var _destroy = function(exp) { - $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") - .removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); - }; - - //TODO: Unwrap at same DOM position - if (this.elementIsWrapper) { - _destroy(this.element); - var wrapper = this.element; - wrapper.after( - this.originalElement.css({ - position: wrapper.css('position'), - width: wrapper.outerWidth(), - height: wrapper.outerHeight(), - top: wrapper.css('top'), - left: wrapper.css('left') - }) - ).remove(); - } - - this.originalElement.css('resize', this.originalResizeStyle); - _destroy(this.originalElement); - - return this; - }, - - _mouseCapture: function(event) { - var handle = false; - for (var i in this.handles) { - if ($(this.handles[i])[0] == event.target) { - handle = true; - } - } - - return !this.options.disabled && handle; - }, - - _mouseStart: function(event) { - - var o = this.options, iniPos = this.element.position(), el = this.element; - - this.resizing = true; - this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() }; - - // bugfix for http://dev.jquery.com/ticket/1749 - if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { - el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left }); - } - - this._renderProxy(); - - var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); - - if (o.containment) { - curleft += $(o.containment).scrollLeft() || 0; - curtop += $(o.containment).scrollTop() || 0; - } - - //Store needed variables - this.offset = this.helper.offset(); - this.position = { left: curleft, top: curtop }; - this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; - this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; - this.originalPosition = { left: curleft, top: curtop }; - this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; - this.originalMousePosition = { left: event.pageX, top: event.pageY }; - - //Aspect Ratio - this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); - - var cursor = $('.ui-resizable-' + this.axis).css('cursor'); - $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); - - el.addClass("ui-resizable-resizing"); - this._propagate("start", event); - return true; - }, - - _mouseDrag: function(event) { - - //Increase performance, avoid regex - var el = this.helper, o = this.options, props = {}, - self = this, smp = this.originalMousePosition, a = this.axis; - - var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; - var trigger = this._change[a]; - if (!trigger) return false; - - // Calculate the attrs that will be change - var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff; - - // Put this in the mouseDrag handler since the user can start pressing shift while resizing - this._updateVirtualBoundaries(event.shiftKey); - if (this._aspectRatio || event.shiftKey) - data = this._updateRatio(data, event); - - data = this._respectSize(data, event); - - // plugins callbacks need to be called first - this._propagate("resize", event); - - el.css({ - top: this.position.top + "px", left: this.position.left + "px", - width: this.size.width + "px", height: this.size.height + "px" - }); - - if (!this._helper && this._proportionallyResizeElements.length) - this._proportionallyResize(); - - this._updateCache(data); - - // calling the user callback at the end - this._trigger('resize', event, this.ui()); - - return false; - }, - - _mouseStop: function(event) { - - this.resizing = false; - var o = this.options, self = this; - - if(this._helper) { - var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), - soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, - soffsetw = ista ? 0 : self.sizeDiff.width; - - var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) }, - left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, - top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; - - if (!o.animate) - this.element.css($.extend(s, { top: top, left: left })); - - self.helper.height(self.size.height); - self.helper.width(self.size.width); - - if (this._helper && !o.animate) this._proportionallyResize(); - } - - $('body').css('cursor', 'auto'); - - this.element.removeClass("ui-resizable-resizing"); - - this._propagate("stop", event); - - if (this._helper) this.helper.remove(); - return false; - - }, - - _updateVirtualBoundaries: function(forceAspectRatio) { - var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b; - - b = { - minWidth: isNumber(o.minWidth) ? o.minWidth : 0, - maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity, - minHeight: isNumber(o.minHeight) ? o.minHeight : 0, - maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity - }; - - if(this._aspectRatio || forceAspectRatio) { - // We want to create an enclosing box whose aspect ration is the requested one - // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension - pMinWidth = b.minHeight * this.aspectRatio; - pMinHeight = b.minWidth / this.aspectRatio; - pMaxWidth = b.maxHeight * this.aspectRatio; - pMaxHeight = b.maxWidth / this.aspectRatio; - - if(pMinWidth > b.minWidth) b.minWidth = pMinWidth; - if(pMinHeight > b.minHeight) b.minHeight = pMinHeight; - if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth; - if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight; - } - this._vBoundaries = b; - }, - - _updateCache: function(data) { - var o = this.options; - this.offset = this.helper.offset(); - if (isNumber(data.left)) this.position.left = data.left; - if (isNumber(data.top)) this.position.top = data.top; - if (isNumber(data.height)) this.size.height = data.height; - if (isNumber(data.width)) this.size.width = data.width; - }, - - _updateRatio: function(data, event) { - - var o = this.options, cpos = this.position, csize = this.size, a = this.axis; - - if (isNumber(data.height)) data.width = (data.height * this.aspectRatio); - else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio); - - if (a == 'sw') { - data.left = cpos.left + (csize.width - data.width); - data.top = null; - } - if (a == 'nw') { - data.top = cpos.top + (csize.height - data.height); - data.left = cpos.left + (csize.width - data.width); - } - - return data; - }, - - _respectSize: function(data, event) { - - var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, - ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), - isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); - - if (isminw) data.width = o.minWidth; - if (isminh) data.height = o.minHeight; - if (ismaxw) data.width = o.maxWidth; - if (ismaxh) data.height = o.maxHeight; - - var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; - var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); - - if (isminw && cw) data.left = dw - o.minWidth; - if (ismaxw && cw) data.left = dw - o.maxWidth; - if (isminh && ch) data.top = dh - o.minHeight; - if (ismaxh && ch) data.top = dh - o.maxHeight; - - // fixing jump error on top/left - bug #2330 - var isNotwh = !data.width && !data.height; - if (isNotwh && !data.left && data.top) data.top = null; - else if (isNotwh && !data.top && data.left) data.left = null; - - return data; - }, - - _proportionallyResize: function() { - - var o = this.options; - if (!this._proportionallyResizeElements.length) return; - var element = this.helper || this.element; - - for (var i=0; i < this._proportionallyResizeElements.length; i++) { - - var prel = this._proportionallyResizeElements[i]; - - if (!this.borderDif) { - var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], - p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; - - this.borderDif = $.map(b, function(v, i) { - var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; - return border + padding; - }); - } - - if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length))) - continue; - - prel.css({ - height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0, - width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0 - }); - - }; - - }, - - _renderProxy: function() { - - var el = this.element, o = this.options; - this.elementOffset = el.offset(); - - if(this._helper) { - - this.helper = this.helper || $('
      '); - - // fix ie6 offset TODO: This seems broken - var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0), - pxyoffset = ( ie6 ? 2 : -1 ); - - this.helper.addClass(this._helper).css({ - width: this.element.outerWidth() + pxyoffset, - height: this.element.outerHeight() + pxyoffset, - position: 'absolute', - left: this.elementOffset.left - ie6offset +'px', - top: this.elementOffset.top - ie6offset +'px', - zIndex: ++o.zIndex //TODO: Don't modify option - }); - - this.helper - .appendTo("body") - .disableSelection(); - - } else { - this.helper = this.element; - } - - }, - - _change: { - e: function(event, dx, dy) { - return { width: this.originalSize.width + dx }; - }, - w: function(event, dx, dy) { - var o = this.options, cs = this.originalSize, sp = this.originalPosition; - return { left: sp.left + dx, width: cs.width - dx }; - }, - n: function(event, dx, dy) { - var o = this.options, cs = this.originalSize, sp = this.originalPosition; - return { top: sp.top + dy, height: cs.height - dy }; - }, - s: function(event, dx, dy) { - return { height: this.originalSize.height + dy }; - }, - se: function(event, dx, dy) { - return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); - }, - sw: function(event, dx, dy) { - return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); - }, - ne: function(event, dx, dy) { - return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy])); - }, - nw: function(event, dx, dy) { - return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy])); - } - }, - - _propagate: function(n, event) { - $.ui.plugin.call(this, n, [event, this.ui()]); - (n != "resize" && this._trigger(n, event, this.ui())); - }, - - plugins: {}, - - ui: function() { - return { - originalElement: this.originalElement, - element: this.element, - helper: this.helper, - position: this.position, - size: this.size, - originalSize: this.originalSize, - originalPosition: this.originalPosition - }; - } - -}); - -$.extend($.ui.resizable, { - version: "1.8.23" -}); - -/* - * Resizable Extensions - */ - -$.ui.plugin.add("resizable", "alsoResize", { - - start: function (event, ui) { - var self = $(this).data("resizable"), o = self.options; - - var _store = function (exp) { - $(exp).each(function() { - var el = $(this); - el.data("resizable-alsoresize", { - width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), - left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10) - }); - }); - }; - - if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { - if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } - else { $.each(o.alsoResize, function (exp) { _store(exp); }); } - }else{ - _store(o.alsoResize); - } - }, - - resize: function (event, ui) { - var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition; - - var delta = { - height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0, - top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0 - }, - - _alsoResize = function (exp, c) { - $(exp).each(function() { - var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, - css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; - - $.each(css, function (i, prop) { - var sum = (start[prop]||0) + (delta[prop]||0); - if (sum && sum >= 0) - style[prop] = sum || null; - }); - - el.css(style); - }); - }; - - if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { - $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); - }else{ - _alsoResize(o.alsoResize); - } - }, - - stop: function (event, ui) { - $(this).removeData("resizable-alsoresize"); - } -}); - -$.ui.plugin.add("resizable", "animate", { - - stop: function(event, ui) { - var self = $(this).data("resizable"), o = self.options; - - var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), - soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height, - soffsetw = ista ? 0 : self.sizeDiff.width; - - var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) }, - left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null, - top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null; - - self.element.animate( - $.extend(style, top && left ? { top: top, left: left } : {}), { - duration: o.animateDuration, - easing: o.animateEasing, - step: function() { - - var data = { - width: parseInt(self.element.css('width'), 10), - height: parseInt(self.element.css('height'), 10), - top: parseInt(self.element.css('top'), 10), - left: parseInt(self.element.css('left'), 10) - }; - - if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height }); - - // propagating resize, and updating values for each animation step - self._updateCache(data); - self._propagate("resize", event); - - } - } - ); - } - -}); - -$.ui.plugin.add("resizable", "containment", { - - start: function(event, ui) { - var self = $(this).data("resizable"), o = self.options, el = self.element; - var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; - if (!ce) return; - - self.containerElement = $(ce); - - if (/document/.test(oc) || oc == document) { - self.containerOffset = { left: 0, top: 0 }; - self.containerPosition = { left: 0, top: 0 }; - - self.parentData = { - element: $(document), left: 0, top: 0, - width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight - }; - } - - // i'm a node, so compute top, left, right, bottom - else { - var element = $(ce), p = []; - $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); - - self.containerOffset = element.offset(); - self.containerPosition = element.position(); - self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; - - var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width, - width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); - - self.parentData = { - element: ce, left: co.left, top: co.top, width: width, height: height - }; - } - }, - - resize: function(event, ui) { - var self = $(this).data("resizable"), o = self.options, - ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position, - pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement; - - if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co; - - if (cp.left < (self._helper ? co.left : 0)) { - self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left)); - if (pRatio) self.size.height = self.size.width / self.aspectRatio; - self.position.left = o.helper ? co.left : 0; - } - - if (cp.top < (self._helper ? co.top : 0)) { - self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top); - if (pRatio) self.size.width = self.size.height * self.aspectRatio; - self.position.top = self._helper ? co.top : 0; - } - - self.offset.left = self.parentData.left+self.position.left; - self.offset.top = self.parentData.top+self.position.top; - - var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ), - hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height ); - - var isParent = self.containerElement.get(0) == self.element.parent().get(0), - isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position')); - - if(isParent && isOffsetRelative) woset -= self.parentData.left; - - if (woset + self.size.width >= self.parentData.width) { - self.size.width = self.parentData.width - woset; - if (pRatio) self.size.height = self.size.width / self.aspectRatio; - } - - if (hoset + self.size.height >= self.parentData.height) { - self.size.height = self.parentData.height - hoset; - if (pRatio) self.size.width = self.size.height * self.aspectRatio; - } - }, - - stop: function(event, ui){ - var self = $(this).data("resizable"), o = self.options, cp = self.position, - co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement; - - var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height; - - if (self._helper && !o.animate && (/relative/).test(ce.css('position'))) - $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); - - if (self._helper && !o.animate && (/static/).test(ce.css('position'))) - $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); - - } -}); - -$.ui.plugin.add("resizable", "ghost", { - - start: function(event, ui) { - - var self = $(this).data("resizable"), o = self.options, cs = self.size; - - self.ghost = self.originalElement.clone(); - self.ghost - .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) - .addClass('ui-resizable-ghost') - .addClass(typeof o.ghost == 'string' ? o.ghost : ''); - - self.ghost.appendTo(self.helper); - - }, - - resize: function(event, ui){ - var self = $(this).data("resizable"), o = self.options; - if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width }); - }, - - stop: function(event, ui){ - var self = $(this).data("resizable"), o = self.options; - if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0)); - } - -}); - -$.ui.plugin.add("resizable", "grid", { - - resize: function(event, ui) { - var self = $(this).data("resizable"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey; - o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; - var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1); - - if (/^(se|s|e)$/.test(a)) { - self.size.width = os.width + ox; - self.size.height = os.height + oy; - } - else if (/^(ne)$/.test(a)) { - self.size.width = os.width + ox; - self.size.height = os.height + oy; - self.position.top = op.top - oy; - } - else if (/^(sw)$/.test(a)) { - self.size.width = os.width + ox; - self.size.height = os.height + oy; - self.position.left = op.left - ox; - } - else { - self.size.width = os.width + ox; - self.size.height = os.height + oy; - self.position.top = op.top - oy; - self.position.left = op.left - ox; - } - } - -}); - -var num = function(v) { - return parseInt(v, 10) || 0; -}; - -var isNumber = function(value) { - return !isNaN(parseInt(value, 10)); -}; - -})(jQuery); - -(function( $, undefined ) { - -$.widget("ui.selectable", $.ui.mouse, { - options: { - appendTo: 'body', - autoRefresh: true, - distance: 0, - filter: '*', - tolerance: 'touch' - }, - _create: function() { - var self = this; - - this.element.addClass("ui-selectable"); - - this.dragged = false; - - // cache selectee children based on filter - var selectees; - this.refresh = function() { - selectees = $(self.options.filter, self.element[0]); - selectees.addClass("ui-selectee"); - selectees.each(function() { - var $this = $(this); - var pos = $this.offset(); - $.data(this, "selectable-item", { - element: this, - $element: $this, - left: pos.left, - top: pos.top, - right: pos.left + $this.outerWidth(), - bottom: pos.top + $this.outerHeight(), - startselected: false, - selected: $this.hasClass('ui-selected'), - selecting: $this.hasClass('ui-selecting'), - unselecting: $this.hasClass('ui-unselecting') - }); - }); - }; - this.refresh(); - - this.selectees = selectees.addClass("ui-selectee"); - - this._mouseInit(); - - this.helper = $("
      "); - }, - - destroy: function() { - this.selectees - .removeClass("ui-selectee") - .removeData("selectable-item"); - this.element - .removeClass("ui-selectable ui-selectable-disabled") - .removeData("selectable") - .unbind(".selectable"); - this._mouseDestroy(); - - return this; - }, - - _mouseStart: function(event) { - var self = this; - - this.opos = [event.pageX, event.pageY]; - - if (this.options.disabled) - return; - - var options = this.options; - - this.selectees = $(options.filter, this.element[0]); - - this._trigger("start", event); - - $(options.appendTo).append(this.helper); - // position helper (lasso) - this.helper.css({ - "left": event.clientX, - "top": event.clientY, - "width": 0, - "height": 0 - }); - - if (options.autoRefresh) { - this.refresh(); - } - - this.selectees.filter('.ui-selected').each(function() { - var selectee = $.data(this, "selectable-item"); - selectee.startselected = true; - if (!event.metaKey && !event.ctrlKey) { - selectee.$element.removeClass('ui-selected'); - selectee.selected = false; - selectee.$element.addClass('ui-unselecting'); - selectee.unselecting = true; - // selectable UNSELECTING callback - self._trigger("unselecting", event, { - unselecting: selectee.element - }); - } - }); - - $(event.target).parents().andSelf().each(function() { - var selectee = $.data(this, "selectable-item"); - if (selectee) { - var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected'); - selectee.$element - .removeClass(doSelect ? "ui-unselecting" : "ui-selected") - .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); - selectee.unselecting = !doSelect; - selectee.selecting = doSelect; - selectee.selected = doSelect; - // selectable (UN)SELECTING callback - if (doSelect) { - self._trigger("selecting", event, { - selecting: selectee.element - }); - } else { - self._trigger("unselecting", event, { - unselecting: selectee.element - }); - } - return false; - } - }); - - }, - - _mouseDrag: function(event) { - var self = this; - this.dragged = true; - - if (this.options.disabled) - return; - - var options = this.options; - - var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY; - if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; } - if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; } - this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1}); - - this.selectees.each(function() { - var selectee = $.data(this, "selectable-item"); - //prevent helper from being selected if appendTo: selectable - if (!selectee || selectee.element == self.element[0]) - return; - var hit = false; - if (options.tolerance == 'touch') { - hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); - } else if (options.tolerance == 'fit') { - hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); - } - - if (hit) { - // SELECT - if (selectee.selected) { - selectee.$element.removeClass('ui-selected'); - selectee.selected = false; - } - if (selectee.unselecting) { - selectee.$element.removeClass('ui-unselecting'); - selectee.unselecting = false; - } - if (!selectee.selecting) { - selectee.$element.addClass('ui-selecting'); - selectee.selecting = true; - // selectable SELECTING callback - self._trigger("selecting", event, { - selecting: selectee.element - }); - } - } else { - // UNSELECT - if (selectee.selecting) { - if ((event.metaKey || event.ctrlKey) && selectee.startselected) { - selectee.$element.removeClass('ui-selecting'); - selectee.selecting = false; - selectee.$element.addClass('ui-selected'); - selectee.selected = true; - } else { - selectee.$element.removeClass('ui-selecting'); - selectee.selecting = false; - if (selectee.startselected) { - selectee.$element.addClass('ui-unselecting'); - selectee.unselecting = true; - } - // selectable UNSELECTING callback - self._trigger("unselecting", event, { - unselecting: selectee.element - }); - } - } - if (selectee.selected) { - if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { - selectee.$element.removeClass('ui-selected'); - selectee.selected = false; - - selectee.$element.addClass('ui-unselecting'); - selectee.unselecting = true; - // selectable UNSELECTING callback - self._trigger("unselecting", event, { - unselecting: selectee.element - }); - } - } - } - }); - - return false; - }, - - _mouseStop: function(event) { - var self = this; - - this.dragged = false; - - var options = this.options; - - $('.ui-unselecting', this.element[0]).each(function() { - var selectee = $.data(this, "selectable-item"); - selectee.$element.removeClass('ui-unselecting'); - selectee.unselecting = false; - selectee.startselected = false; - self._trigger("unselected", event, { - unselected: selectee.element - }); - }); - $('.ui-selecting', this.element[0]).each(function() { - var selectee = $.data(this, "selectable-item"); - selectee.$element.removeClass('ui-selecting').addClass('ui-selected'); - selectee.selecting = false; - selectee.selected = true; - selectee.startselected = true; - self._trigger("selected", event, { - selected: selectee.element - }); - }); - this._trigger("stop", event); - - this.helper.remove(); - - return false; - } - -}); - -$.extend($.ui.selectable, { - version: "1.8.23" -}); - -})(jQuery); - -(function( $, undefined ) { - -$.widget("ui.sortable", $.ui.mouse, { - widgetEventPrefix: "sort", - ready: false, - options: { - appendTo: "parent", - axis: false, - connectWith: false, - containment: false, - cursor: 'auto', - cursorAt: false, - dropOnEmpty: true, - forcePlaceholderSize: false, - forceHelperSize: false, - grid: false, - handle: false, - helper: "original", - items: '> *', - opacity: false, - placeholder: false, - revert: false, - scroll: true, - scrollSensitivity: 20, - scrollSpeed: 20, - scope: "default", - tolerance: "intersect", - zIndex: 1000 - }, - _create: function() { - - var o = this.options; - this.containerCache = {}; - this.element.addClass("ui-sortable"); - - //Get the items - this.refresh(); - - //Let's determine if the items are being displayed horizontally - this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false; - - //Let's determine the parent's offset - this.offset = this.element.offset(); - - //Initialize mouse events for interaction - this._mouseInit(); - - //We're ready to go - this.ready = true - - }, - - destroy: function() { - $.Widget.prototype.destroy.call( this ); - this.element - .removeClass("ui-sortable ui-sortable-disabled"); - this._mouseDestroy(); - - for ( var i = this.items.length - 1; i >= 0; i-- ) - this.items[i].item.removeData(this.widgetName + "-item"); - - return this; - }, - - _setOption: function(key, value){ - if ( key === "disabled" ) { - this.options[ key ] = value; - - this.widget() - [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" ); - } else { - // Don't call widget base _setOption for disable as it adds ui-state-disabled class - $.Widget.prototype._setOption.apply(this, arguments); - } - }, - - _mouseCapture: function(event, overrideHandle) { - var that = this; - - if (this.reverting) { - return false; - } - - if(this.options.disabled || this.options.type == 'static') return false; - - //We have to refresh the items data once first - this._refreshItems(event); - - //Find out if the clicked node (or one of its parents) is a actual item in this.items - var currentItem = null, self = this, nodes = $(event.target).parents().each(function() { - if($.data(this, that.widgetName + '-item') == self) { - currentItem = $(this); - return false; - } - }); - if($.data(event.target, that.widgetName + '-item') == self) currentItem = $(event.target); - - if(!currentItem) return false; - if(this.options.handle && !overrideHandle) { - var validHandle = false; - - $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; }); - if(!validHandle) return false; - } - - this.currentItem = currentItem; - this._removeCurrentsFromItems(); - return true; - - }, - - _mouseStart: function(event, overrideHandle, noActivation) { - - var o = this.options, self = this; - this.currentContainer = this; - - //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture - this.refreshPositions(); - - //Create and append the visible helper - this.helper = this._createHelper(event); - - //Cache the helper size - this._cacheHelperProportions(); - - /* - * - Position generation - - * This block generates everything position related - it's the core of draggables. - */ - - //Cache the margins of the original element - this._cacheMargins(); - - //Get the next scrolling parent - this.scrollParent = this.helper.scrollParent(); - - //The element's absolute position on the page minus margins - this.offset = this.currentItem.offset(); - this.offset = { - top: this.offset.top - this.margins.top, - left: this.offset.left - this.margins.left - }; - - $.extend(this.offset, { - click: { //Where the click happened, relative to the element - left: event.pageX - this.offset.left, - top: event.pageY - this.offset.top - }, - parent: this._getParentOffset(), - relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper - }); - - // Only after we got the offset, we can change the helper's position to absolute - // TODO: Still need to figure out a way to make relative sorting possible - this.helper.css("position", "absolute"); - this.cssPosition = this.helper.css("position"); - - //Generate the original position - this.originalPosition = this._generatePosition(event); - this.originalPageX = event.pageX; - this.originalPageY = event.pageY; - - //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied - (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); - - //Cache the former DOM position - this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; - - //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way - if(this.helper[0] != this.currentItem[0]) { - this.currentItem.hide(); - } - - //Create the placeholder - this._createPlaceholder(); - - //Set a containment if given in the options - if(o.containment) - this._setContainment(); - - if(o.cursor) { // cursor option - if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor"); - $('body').css("cursor", o.cursor); - } - - if(o.opacity) { // opacity option - if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity"); - this.helper.css("opacity", o.opacity); - } - - if(o.zIndex) { // zIndex option - if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex"); - this.helper.css("zIndex", o.zIndex); - } - - //Prepare scrolling - if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') - this.overflowOffset = this.scrollParent.offset(); - - //Call callbacks - this._trigger("start", event, this._uiHash()); - - //Recache the helper size - if(!this._preserveHelperProportions) - this._cacheHelperProportions(); - - - //Post 'activate' events to possible containers - if(!noActivation) { - for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); } - } - - //Prepare possible droppables - if($.ui.ddmanager) - $.ui.ddmanager.current = this; - - if ($.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(this, event); - - this.dragging = true; - - this.helper.addClass("ui-sortable-helper"); - this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position - return true; - - }, - - _mouseDrag: function(event) { - - //Compute the helpers position - this.position = this._generatePosition(event); - this.positionAbs = this._convertPositionTo("absolute"); - - if (!this.lastPositionAbs) { - this.lastPositionAbs = this.positionAbs; - } - - //Do scrolling - if(this.options.scroll) { - var o = this.options, scrolled = false; - if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') { - - if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) - this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; - else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) - this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; - - if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) - this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; - else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) - this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; - - } else { - - if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); - else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) - scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); - - if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); - else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) - scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); - - } - - if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) - $.ui.ddmanager.prepareOffsets(this, event); - } - - //Regenerate the absolute position used for position checks - this.positionAbs = this._convertPositionTo("absolute"); - - //Set the helper position - if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; - if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; - - //Rearrange - for (var i = this.items.length - 1; i >= 0; i--) { - - //Cache variables and intersection, continue if no intersection - var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item); - if (!intersection) continue; - - if(itemElement != this.currentItem[0] //cannot intersect with itself - && this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before - && !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked - && (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true) - //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container - ) { - - this.direction = intersection == 1 ? "down" : "up"; - - if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) { - this._rearrange(event, item); - } else { - break; - } - - this._trigger("change", event, this._uiHash()); - break; - } - } - - //Post events to containers - this._contactContainers(event); - - //Interconnect with droppables - if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); - - //Call callbacks - this._trigger('sort', event, this._uiHash()); - - this.lastPositionAbs = this.positionAbs; - return false; - - }, - - _mouseStop: function(event, noPropagation) { - - if(!event) return; - - //If we are using droppables, inform the manager about the drop - if ($.ui.ddmanager && !this.options.dropBehaviour) - $.ui.ddmanager.drop(this, event); - - if(this.options.revert) { - var self = this; - var cur = self.placeholder.offset(); - - self.reverting = true; - - $(this.helper).animate({ - left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), - top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) - }, parseInt(this.options.revert, 10) || 500, function() { - self._clear(event); - }); - } else { - this._clear(event, noPropagation); - } - - return false; - - }, - - cancel: function() { - - var self = this; - - if(this.dragging) { - - this._mouseUp({ target: null }); - - if(this.options.helper == "original") - this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); - else - this.currentItem.show(); - - //Post deactivating events to containers - for (var i = this.containers.length - 1; i >= 0; i--){ - this.containers[i]._trigger("deactivate", null, self._uiHash(this)); - if(this.containers[i].containerCache.over) { - this.containers[i]._trigger("out", null, self._uiHash(this)); - this.containers[i].containerCache.over = 0; - } - } - - } - - if (this.placeholder) { - //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! - if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); - if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); - - $.extend(this, { - helper: null, - dragging: false, - reverting: false, - _noFinalSort: null - }); - - if(this.domPosition.prev) { - $(this.domPosition.prev).after(this.currentItem); - } else { - $(this.domPosition.parent).prepend(this.currentItem); - } - } - - return this; - - }, - - serialize: function(o) { - - var items = this._getItemsAsjQuery(o && o.connected); - var str = []; o = o || {}; - - $(items).each(function() { - var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/)); - if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2])); - }); - - if(!str.length && o.key) { - str.push(o.key + '='); - } - - return str.join('&'); - - }, - - toArray: function(o) { - - var items = this._getItemsAsjQuery(o && o.connected); - var ret = []; o = o || {}; - - items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); }); - return ret; - - }, - - /* Be careful with the following core functions */ - _intersectsWith: function(item) { - - var x1 = this.positionAbs.left, - x2 = x1 + this.helperProportions.width, - y1 = this.positionAbs.top, - y2 = y1 + this.helperProportions.height; - - var l = item.left, - r = l + item.width, - t = item.top, - b = t + item.height; - - var dyClick = this.offset.click.top, - dxClick = this.offset.click.left; - - var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r; - - if( this.options.tolerance == "pointer" - || this.options.forcePointerForContainers - || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height']) - ) { - return isOverElement; - } else { - - return (l < x1 + (this.helperProportions.width / 2) // Right Half - && x2 - (this.helperProportions.width / 2) < r // Left Half - && t < y1 + (this.helperProportions.height / 2) // Bottom Half - && y2 - (this.helperProportions.height / 2) < b ); // Top Half - - } - }, - - _intersectsWithPointer: function(item) { - - var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), - isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), - isOverElement = isOverElementHeight && isOverElementWidth, - verticalDirection = this._getDragVerticalDirection(), - horizontalDirection = this._getDragHorizontalDirection(); - - if (!isOverElement) - return false; - - return this.floating ? - ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 ) - : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) ); - - }, - - _intersectsWithSides: function(item) { - - var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), - isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), - verticalDirection = this._getDragVerticalDirection(), - horizontalDirection = this._getDragHorizontalDirection(); - - if (this.floating && horizontalDirection) { - return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf)); - } else { - return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf)); - } - - }, - - _getDragVerticalDirection: function() { - var delta = this.positionAbs.top - this.lastPositionAbs.top; - return delta != 0 && (delta > 0 ? "down" : "up"); - }, - - _getDragHorizontalDirection: function() { - var delta = this.positionAbs.left - this.lastPositionAbs.left; - return delta != 0 && (delta > 0 ? "right" : "left"); - }, - - refresh: function(event) { - this._refreshItems(event); - this.refreshPositions(); - return this; - }, - - _connectWith: function() { - var options = this.options; - return options.connectWith.constructor == String - ? [options.connectWith] - : options.connectWith; - }, - - _getItemsAsjQuery: function(connected) { - - var self = this; - var items = []; - var queries = []; - var connectWith = this._connectWith(); - - if(connectWith && connected) { - for (var i = connectWith.length - 1; i >= 0; i--){ - var cur = $(connectWith[i]); - for (var j = cur.length - 1; j >= 0; j--){ - var inst = $.data(cur[j], this.widgetName); - if(inst && inst != this && !inst.options.disabled) { - queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]); - } - }; - }; - } - - queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]); - - for (var i = queries.length - 1; i >= 0; i--){ - queries[i][0].each(function() { - items.push(this); - }); - }; - - return $(items); - - }, - - _removeCurrentsFromItems: function() { - - var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); - - for (var i=0; i < this.items.length; i++) { - - for (var j=0; j < list.length; j++) { - if(list[j] == this.items[i].item[0]) - this.items.splice(i,1); - }; - - }; - - }, - - _refreshItems: function(event) { - - this.items = []; - this.containers = [this]; - var items = this.items; - var self = this; - var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; - var connectWith = this._connectWith(); - - if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down - for (var i = connectWith.length - 1; i >= 0; i--){ - var cur = $(connectWith[i]); - for (var j = cur.length - 1; j >= 0; j--){ - var inst = $.data(cur[j], this.widgetName); - if(inst && inst != this && !inst.options.disabled) { - queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); - this.containers.push(inst); - } - }; - }; - } - - for (var i = queries.length - 1; i >= 0; i--) { - var targetData = queries[i][1]; - var _queries = queries[i][0]; - - for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) { - var item = $(_queries[j]); - - item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager) - - items.push({ - item: item, - instance: targetData, - width: 0, height: 0, - left: 0, top: 0 - }); - }; - }; - - }, - - refreshPositions: function(fast) { - - //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change - if(this.offsetParent && this.helper) { - this.offset.parent = this._getParentOffset(); - } - - for (var i = this.items.length - 1; i >= 0; i--){ - var item = this.items[i]; - - //We ignore calculating positions of all connected containers when we're not over them - if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) - continue; - - var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; - - if (!fast) { - item.width = t.outerWidth(); - item.height = t.outerHeight(); - } - - var p = t.offset(); - item.left = p.left; - item.top = p.top; - }; - - if(this.options.custom && this.options.custom.refreshContainers) { - this.options.custom.refreshContainers.call(this); - } else { - for (var i = this.containers.length - 1; i >= 0; i--){ - var p = this.containers[i].element.offset(); - this.containers[i].containerCache.left = p.left; - this.containers[i].containerCache.top = p.top; - this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); - this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); - }; - } - - return this; - }, - - _createPlaceholder: function(that) { - - var self = that || this, o = self.options; - - if(!o.placeholder || o.placeholder.constructor == String) { - var className = o.placeholder; - o.placeholder = { - element: function() { - - var el = $(document.createElement(self.currentItem[0].nodeName)) - .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder") - .removeClass("ui-sortable-helper")[0]; - - if(!className) - el.style.visibility = "hidden"; - - return el; - }, - update: function(container, p) { - - // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that - // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified - if(className && !o.forcePlaceholderSize) return; - - //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item - if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); }; - if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); }; - } - }; - } - - //Create the placeholder - self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)); - - //Append it after the actual current item - self.currentItem.after(self.placeholder); - - //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) - o.placeholder.update(self, self.placeholder); - - }, - - _contactContainers: function(event) { - - // get innermost container that intersects with item - var innermostContainer = null, innermostIndex = null; - - - for (var i = this.containers.length - 1; i >= 0; i--){ - - // never consider a container that's located within the item itself - if($.ui.contains(this.currentItem[0], this.containers[i].element[0])) - continue; - - if(this._intersectsWith(this.containers[i].containerCache)) { - - // if we've already found a container and it's more "inner" than this, then continue - if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0])) - continue; - - innermostContainer = this.containers[i]; - innermostIndex = i; - - } else { - // container doesn't intersect. trigger "out" event if necessary - if(this.containers[i].containerCache.over) { - this.containers[i]._trigger("out", event, this._uiHash(this)); - this.containers[i].containerCache.over = 0; - } - } - - } - - // if no intersecting containers found, return - if(!innermostContainer) return; - - // move the item into the container if it's not there already - if(this.containers.length === 1) { - this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); - this.containers[innermostIndex].containerCache.over = 1; - } else if(this.currentContainer != this.containers[innermostIndex]) { - - //When entering a new container, we will find the item with the least distance and append our item near it - var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top']; - for (var j = this.items.length - 1; j >= 0; j--) { - if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue; - var cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top; - if(Math.abs(cur - base) < dist) { - dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j]; - this.direction = (cur - base > 0) ? 'down' : 'up'; - } - } - - if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled - return; - - this.currentContainer = this.containers[innermostIndex]; - itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); - this._trigger("change", event, this._uiHash()); - this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); - - //Update the placeholder - this.options.placeholder.update(this.currentContainer, this.placeholder); - - this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); - this.containers[innermostIndex].containerCache.over = 1; - } - - - }, - - _createHelper: function(event) { - - var o = this.options; - var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem); - - if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already - $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); - - if(helper[0] == this.currentItem[0]) - this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; - - if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width()); - if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height()); - - return helper; - - }, - - _adjustOffsetFromHelper: function(obj) { - if (typeof obj == 'string') { - obj = obj.split(' '); - } - if ($.isArray(obj)) { - obj = {left: +obj[0], top: +obj[1] || 0}; - } - if ('left' in obj) { - this.offset.click.left = obj.left + this.margins.left; - } - if ('right' in obj) { - this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; - } - if ('top' in obj) { - this.offset.click.top = obj.top + this.margins.top; - } - if ('bottom' in obj) { - this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; - } - }, - - _getParentOffset: function() { - - - //Get the offsetParent and cache its position - this.offsetParent = this.helper.offsetParent(); - var po = this.offsetParent.offset(); - - // This is a special case where we need to modify a offset calculated on start, since the following happened: - // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent - // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that - // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag - if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) { - po.left += this.scrollParent.scrollLeft(); - po.top += this.scrollParent.scrollTop(); - } - - if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information - || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix - po = { top: 0, left: 0 }; - - return { - top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), - left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) - }; - - }, - - _getRelativeOffset: function() { - - if(this.cssPosition == "relative") { - var p = this.currentItem.position(); - return { - top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), - left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() - }; - } else { - return { top: 0, left: 0 }; - } - - }, - - _cacheMargins: function() { - this.margins = { - left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), - top: (parseInt(this.currentItem.css("marginTop"),10) || 0) - }; - }, - - _cacheHelperProportions: function() { - this.helperProportions = { - width: this.helper.outerWidth(), - height: this.helper.outerHeight() - }; - }, - - _setContainment: function() { - - var o = this.options; - if(o.containment == 'parent') o.containment = this.helper[0].parentNode; - if(o.containment == 'document' || o.containment == 'window') this.containment = [ - 0 - this.offset.relative.left - this.offset.parent.left, - 0 - this.offset.relative.top - this.offset.parent.top, - $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, - ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top - ]; - - if(!(/^(document|window|parent)$/).test(o.containment)) { - var ce = $(o.containment)[0]; - var co = $(o.containment).offset(); - var over = ($(ce).css("overflow") != 'hidden'); - - this.containment = [ - co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, - co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, - co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, - co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - ]; - } - - }, - - _convertPositionTo: function(d, pos) { - - if(!pos) pos = this.position; - var mod = d == "absolute" ? 1 : -1; - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); - - return { - top: ( - pos.top // The absolute mouse position - + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) - - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) - ), - left: ( - pos.left // The absolute mouse position - + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent - + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) - - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) - ) - }; - - }, - - _generatePosition: function(event) { - - var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); - - // This is another very weird special case that only happens for relative elements: - // 1. If the css position is relative - // 2. and the scroll parent is the document or similar to the offset parent - // we have to refresh the relative offset during the scroll so there are no jumps - if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { - this.offset.relative = this._getRelativeOffset(); - } - - var pageX = event.pageX; - var pageY = event.pageY; - - /* - * - Position constraining - - * Constrain the position to a mix of grid, containment. - */ - - if(this.originalPosition) { //If we are not dragging yet, we won't check for options - - if(this.containment) { - if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; - if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; - if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; - if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; - } - - if(o.grid) { - var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; - pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; - - var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; - pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; - } - - } - - return { - top: ( - pageY // The absolute mouse position - - this.offset.click.top // Click offset (relative to the element) - - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.top // The offsetParent's offset without borders (offset + border) - + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) - ), - left: ( - pageX // The absolute mouse position - - this.offset.click.left // Click offset (relative to the element) - - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent - - this.offset.parent.left // The offsetParent's offset without borders (offset + border) - + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) - ) - }; - - }, - - _rearrange: function(event, i, a, hardRefresh) { - - a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); - - //Various things done here to improve the performance: - // 1. we create a setTimeout, that calls refreshPositions - // 2. on the instance, we have a counter variable, that get's higher after every append - // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same - // 4. this lets only the last addition to the timeout stack through - this.counter = this.counter ? ++this.counter : 1; - var self = this, counter = this.counter; - - window.setTimeout(function() { - if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove - },0); - - }, - - _clear: function(event, noPropagation) { - - this.reverting = false; - // We delay all events that have to be triggered to after the point where the placeholder has been removed and - // everything else normalized again - var delayedTriggers = [], self = this; - - // We first have to update the dom position of the actual currentItem - // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) - if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem); - this._noFinalSort = null; - - if(this.helper[0] == this.currentItem[0]) { - for(var i in this._storedCSS) { - if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; - } - this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); - } else { - this.currentItem.show(); - } - - if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); - if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed - if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element - if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); - for (var i = this.containers.length - 1; i >= 0; i--){ - if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) { - delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i])); - delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i])); - } - }; - }; - - //Post events to containers - for (var i = this.containers.length - 1; i >= 0; i--){ - if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i])); - if(this.containers[i].containerCache.over) { - delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i])); - this.containers[i].containerCache.over = 0; - } - } - - //Do what was originally in plugins - if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor - if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity - if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index - - this.dragging = false; - if(this.cancelHelperRemoval) { - if(!noPropagation) { - this._trigger("beforeStop", event, this._uiHash()); - for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events - this._trigger("stop", event, this._uiHash()); - } - - this.fromOutside = false; - return false; - } - - if(!noPropagation) this._trigger("beforeStop", event, this._uiHash()); - - //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! - this.placeholder[0].parentNode.removeChild(this.placeholder[0]); - - if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; - - if(!noPropagation) { - for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events - this._trigger("stop", event, this._uiHash()); - } - - this.fromOutside = false; - return true; - - }, - - _trigger: function() { - if ($.Widget.prototype._trigger.apply(this, arguments) === false) { - this.cancel(); - } - }, - - _uiHash: function(inst) { - var self = inst || this; - return { - helper: self.helper, - placeholder: self.placeholder || $([]), - position: self.position, - originalPosition: self.originalPosition, - offset: self.positionAbs, - item: self.currentItem, - sender: inst ? inst.element : null - }; - } - -}); - -$.extend($.ui.sortable, { - version: "1.8.23" -}); - -})(jQuery); - -;jQuery.effects || (function($, undefined) { - -$.effects = {}; - - - -/******************************************************************************/ -/****************************** COLOR ANIMATIONS ******************************/ -/******************************************************************************/ - -// override the animation for color styles -$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', - 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'], -function(i, attr) { - $.fx.step[attr] = function(fx) { - if (!fx.colorInit) { - fx.start = getColor(fx.elem, attr); - fx.end = getRGB(fx.end); - fx.colorInit = true; - } - - fx.elem.style[attr] = 'rgb(' + - Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' + - Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' + - Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')'; - }; -}); - -// Color Conversion functions from highlightFade -// By Blair Mitchelmore -// http://jquery.offput.ca/highlightFade/ - -// Parse strings looking for color tuples [255,255,255] -function getRGB(color) { - var result; - - // Check if we're already dealing with an array of colors - if ( color && color.constructor == Array && color.length == 3 ) - return color; - - // Look for rgb(num,num,num) - if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) - return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)]; - - // Look for rgb(num%,num%,num%) - if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) - return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; - - // Look for #a0b1c2 - if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) - return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; - - // Look for #fff - if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) - return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; - - // Look for rgba(0, 0, 0, 0) == transparent in Safari 3 - if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) - return colors['transparent']; - - // Otherwise, we're most likely dealing with a named color - return colors[$.trim(color).toLowerCase()]; -} - -function getColor(elem, attr) { - var color; - - do { - // jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css - color = ($.curCSS || $.css)(elem, attr); - - // Keep going until we find an element that has color, or we hit the body - if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") ) - break; - - attr = "backgroundColor"; - } while ( elem = elem.parentNode ); - - return getRGB(color); -}; - -// Some named colors to work with -// From Interface by Stefan Petre -// http://interface.eyecon.ro/ - -var colors = { - aqua:[0,255,255], - azure:[240,255,255], - beige:[245,245,220], - black:[0,0,0], - blue:[0,0,255], - brown:[165,42,42], - cyan:[0,255,255], - darkblue:[0,0,139], - darkcyan:[0,139,139], - darkgrey:[169,169,169], - darkgreen:[0,100,0], - darkkhaki:[189,183,107], - darkmagenta:[139,0,139], - darkolivegreen:[85,107,47], - darkorange:[255,140,0], - darkorchid:[153,50,204], - darkred:[139,0,0], - darksalmon:[233,150,122], - darkviolet:[148,0,211], - fuchsia:[255,0,255], - gold:[255,215,0], - green:[0,128,0], - indigo:[75,0,130], - khaki:[240,230,140], - lightblue:[173,216,230], - lightcyan:[224,255,255], - lightgreen:[144,238,144], - lightgrey:[211,211,211], - lightpink:[255,182,193], - lightyellow:[255,255,224], - lime:[0,255,0], - magenta:[255,0,255], - maroon:[128,0,0], - navy:[0,0,128], - olive:[128,128,0], - orange:[255,165,0], - pink:[255,192,203], - purple:[128,0,128], - violet:[128,0,128], - red:[255,0,0], - silver:[192,192,192], - white:[255,255,255], - yellow:[255,255,0], - transparent: [255,255,255] -}; - - - -/******************************************************************************/ -/****************************** CLASS ANIMATIONS ******************************/ -/******************************************************************************/ - -var classAnimationActions = ['add', 'remove', 'toggle'], - shorthandStyles = { - border: 1, - borderBottom: 1, - borderColor: 1, - borderLeft: 1, - borderRight: 1, - borderTop: 1, - borderWidth: 1, - margin: 1, - padding: 1 - }; - -function getElementStyles() { - var style = document.defaultView - ? document.defaultView.getComputedStyle(this, null) - : this.currentStyle, - newStyle = {}, - key, - camelCase; - - // webkit enumerates style porperties - if (style && style.length && style[0] && style[style[0]]) { - var len = style.length; - while (len--) { - key = style[len]; - if (typeof style[key] == 'string') { - camelCase = key.replace(/\-(\w)/g, function(all, letter){ - return letter.toUpperCase(); - }); - newStyle[camelCase] = style[key]; - } - } - } else { - for (key in style) { - if (typeof style[key] === 'string') { - newStyle[key] = style[key]; - } - } - } - - return newStyle; -} - -function filterStyles(styles) { - var name, value; - for (name in styles) { - value = styles[name]; - if ( - // ignore null and undefined values - value == null || - // ignore functions (when does this occur?) - $.isFunction(value) || - // shorthand styles that need to be expanded - name in shorthandStyles || - // ignore scrollbars (break in IE) - (/scrollbar/).test(name) || - - // only colors or values that can be converted to numbers - (!(/color/i).test(name) && isNaN(parseFloat(value))) - ) { - delete styles[name]; - } - } - - return styles; -} - -function styleDifference(oldStyle, newStyle) { - var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459 - name; - - for (name in newStyle) { - if (oldStyle[name] != newStyle[name]) { - diff[name] = newStyle[name]; - } - } - - return diff; -} - -$.effects.animateClass = function(value, duration, easing, callback) { - if ($.isFunction(easing)) { - callback = easing; - easing = null; - } - - return this.queue(function() { - var that = $(this), - originalStyleAttr = that.attr('style') || ' ', - originalStyle = filterStyles(getElementStyles.call(this)), - newStyle, - className = that.attr('class') || ""; - - $.each(classAnimationActions, function(i, action) { - if (value[action]) { - that[action + 'Class'](value[action]); - } - }); - newStyle = filterStyles(getElementStyles.call(this)); - that.attr('class', className); - - that.animate(styleDifference(originalStyle, newStyle), { - queue: false, - duration: duration, - easing: easing, - complete: function() { - $.each(classAnimationActions, function(i, action) { - if (value[action]) { that[action + 'Class'](value[action]); } - }); - // work around bug in IE by clearing the cssText before setting it - if (typeof that.attr('style') == 'object') { - that.attr('style').cssText = ''; - that.attr('style').cssText = originalStyleAttr; - } else { - that.attr('style', originalStyleAttr); - } - if (callback) { callback.apply(this, arguments); } - $.dequeue( this ); - } - }); - }); -}; - -$.fn.extend({ - _addClass: $.fn.addClass, - addClass: function(classNames, speed, easing, callback) { - return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames); - }, - - _removeClass: $.fn.removeClass, - removeClass: function(classNames,speed,easing,callback) { - return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames); - }, - - _toggleClass: $.fn.toggleClass, - toggleClass: function(classNames, force, speed, easing, callback) { - if ( typeof force == "boolean" || force === undefined ) { - if ( !speed ) { - // without speed parameter; - return this._toggleClass(classNames, force); - } else { - return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]); - } - } else { - // without switch parameter; - return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]); - } - }, - - switchClass: function(remove,add,speed,easing,callback) { - return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]); - } -}); - - - -/******************************************************************************/ -/*********************************** EFFECTS **********************************/ -/******************************************************************************/ - -$.extend($.effects, { - version: "1.8.23", - - // 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("ec.storage."+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("ec.storage."+set[i])); - } - }, - - setMode: function(el, mode) { - if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle - return mode; - }, - - getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value - // this should be a little more flexible in the future to handle a string & hash - var y, x; - switch (origin[0]) { - case 'top': y = 0; break; - case 'middle': y = 0.5; break; - case 'bottom': y = 1; break; - default: y = origin[0] / original.height; - }; - switch (origin[1]) { - case 'left': x = 0; break; - case 'center': x = 0.5; break; - case 'right': x = 1; break; - default: x = origin[1] / original.width; - }; - return {x: x, y: y}; - }, - - // 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 - }), - active = document.activeElement; - - // support: Firefox - // Firefox incorrectly exposes anonymous content - // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 - try { - active.id; - } catch( e ) { - active = document.body; - } - - 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' }); - } - - return wrapper.css(props).show(); - }, - - removeWrapper: function(element) { - var parent, - active = document.activeElement; - - if (element.parent().is('.ui-effects-wrapper')) { - parent = element.parent().replaceWith(element); - // Fixes #7595 - Elements lose focus when wrapped. - if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { - $( active ).focus(); - } - return parent; - } - - return element; - }, - - setTransition: function(element, list, factor, value) { - value = value || {}; - $.each(list, function(i, x){ - var unit = element.cssUnit(x); - if (unit[0] > 0) value[x] = unit[0] * factor + unit[1]; - }); - return value; - } -}); - - -function _normalizeArguments(effect, options, speed, callback) { - // shift params for method overloading - if (typeof effect == 'object') { - callback = options; - speed = null; - options = effect; - effect = options.effect; - } - if ($.isFunction(options)) { - callback = options; - speed = null; - options = {}; - } - if (typeof options == 'number' || $.fx.speeds[options]) { - callback = speed; - speed = options; - options = {}; - } - if ($.isFunction(speed)) { - callback = speed; - speed = null; - } - - options = options || {}; - - speed = speed || options.duration; - speed = $.fx.off ? 0 : typeof speed == 'number' - ? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default; - - callback = callback || options.complete; - - return [effect, options, speed, callback]; -} - -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" && !$.effects[ speed ] ) { - return true; - } - - return false; -} - -$.fn.extend({ - effect: function(effect, options, speed, callback) { - var args = _normalizeArguments.apply(this, arguments), - // TODO: make effects take actual parameters instead of a hash - args2 = { - options: args[1], - duration: args[2], - callback: args[3] - }, - mode = args2.options.mode, - effectMethod = $.effects[effect]; - - if ( $.fx.off || !effectMethod ) { - // delegate to the original method (e.g., .show()) if possible - if ( mode ) { - return this[ mode ]( args2.duration, args2.callback ); - } else { - return this.each(function() { - if ( args2.callback ) { - args2.callback.call( this ); - } - }); - } - } - - return effectMethod.call(this, args2); - }, - - _show: $.fn.show, - show: function(speed) { - if ( standardSpeed( speed ) ) { - return this._show.apply(this, arguments); - } else { - var args = _normalizeArguments.apply(this, arguments); - args[1].mode = 'show'; - return this.effect.apply(this, args); - } - }, - - _hide: $.fn.hide, - hide: function(speed) { - if ( standardSpeed( speed ) ) { - return this._hide.apply(this, arguments); - } else { - var args = _normalizeArguments.apply(this, arguments); - args[1].mode = 'hide'; - return this.effect.apply(this, args); - } - }, - - // jQuery core overloads toggle and creates _toggle - __toggle: $.fn.toggle, - toggle: function(speed) { - if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) { - return this.__toggle.apply(this, arguments); - } else { - var args = _normalizeArguments.apply(this, arguments); - args[1].mode = 'toggle'; - return this.effect.apply(this, args); - } - }, - - // helper functions - cssUnit: function(key) { - var style = this.css(key), val = []; - $.each( ['em','px','%','pt'], function(i, unit){ - if(style.indexOf(unit) > 0) - val = [parseFloat(style), unit]; - }); - return val; - } -}); - - - -/******************************************************************************/ -/*********************************** EASING ***********************************/ -/******************************************************************************/ - -// based on easing equations from Robert Penner (http://www.robertpenner.com/easing) - -var baseEasings = {}; - -$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { - baseEasings[ name ] = function( p ) { - return Math.pow( p, i + 2 ); - }; -}); - -$.extend( baseEasings, { - Sine: function ( p ) { - return 1 - Math.cos( p * Math.PI / 2 ); - }, - Circ: function ( p ) { - return 1 - Math.sqrt( 1 - p * p ); - }, - Elastic: function( p ) { - return p === 0 || p === 1 ? p : - -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 ); - }, - Back: function( p ) { - return p * p * ( 3 * p - 2 ); - }, - Bounce: function ( p ) { - var pow2, - bounce = 4; - - while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} - return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); - } -}); - -$.each( baseEasings, function( name, easeIn ) { - $.easing[ "easeIn" + name ] = easeIn; - $.easing[ "easeOut" + name ] = function( p ) { - return 1 - easeIn( 1 - p ); - }; - $.easing[ "easeInOut" + name ] = function( p ) { - return p < .5 ? - easeIn( p * 2 ) / 2 : - easeIn( p * -2 + 2 ) / -2 + 1; - }; -}); - -})(jQuery); - -(function( $, undefined ) { - -$.effects.blind = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var direction = o.options.direction || 'vertical'; // Default direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var ref = (direction == 'vertical') ? 'height' : 'width'; - var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width(); - if(mode == 'show') wrapper.css(ref, 0); // Shift - - // Animation - var animation = {}; - animation[ref] = mode == 'show' ? distance : 0; - - // Animate - wrapper.animate(animation, o.duration, o.options.easing, function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(el[0], arguments); // Callback - el.dequeue(); - }); - - }); - -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.bounce = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var direction = o.options.direction || 'up'; // Default direction - var distance = o.options.distance || 20; // Default distance - var times = o.options.times || 5; // Default # of times - var speed = o.duration || 250; // Default speed per bounce - if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight(true) / 3 : el.outerWidth(true) / 3); - if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift - if (mode == 'hide') distance = distance / (times * 2); - if (mode != 'hide') times--; - - // Animate - if (mode == 'show') { // Show Bounce - var animation = {opacity: 1}; - animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance; - el.animate(animation, speed / 2, o.options.easing); - distance = distance / 2; - times--; - }; - for (var i = 0; i < times; i++) { // Bounces - var animation1 = {}, animation2 = {}; - animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; - el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing); - distance = (mode == 'hide') ? distance * 2 : distance / 2; - }; - if (mode == 'hide') { // Last Bounce - var animation = {opacity: 0}; - animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - el.animate(animation, speed / 2, o.options.easing, function(){ - el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - }); - } else { - var animation1 = {}, animation2 = {}; - animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance; - el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){ - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - }); - }; - el.queue('fx', function() { el.dequeue(); }); - el.dequeue(); - }); - -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.clip = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right','height','width']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var direction = o.options.direction || 'vertical'; // Default direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var animate = el[0].tagName == 'IMG' ? wrapper : el; - var ref = { - size: (direction == 'vertical') ? 'height' : 'width', - position: (direction == 'vertical') ? 'top' : 'left' - }; - var distance = (direction == 'vertical') ? animate.height() : animate.width(); - if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift - - // Animation - var animation = {}; - animation[ref.size] = mode == 'show' ? distance : 0; - animation[ref.position] = mode == 'show' ? 0 : distance / 2; - - // Animate - animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(el[0], arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.drop = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right','opacity']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var direction = o.options.direction || 'left'; // Default Direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight( true ) / 2 : el.outerWidth( true ) / 2); - if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift - - // Animation - var animation = {opacity: mode == 'show' ? 1 : 0}; - animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; - - // Animate - el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.explode = function(o) { - - return this.queue(function() { - - var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; - var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3; - - o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode; - var el = $(this).show().css('visibility', 'hidden'); - var offset = el.offset(); - - //Substract the margins - not fixing the problem yet. - offset.top -= parseInt(el.css("marginTop"),10) || 0; - offset.left -= parseInt(el.css("marginLeft"),10) || 0; - - var width = el.outerWidth(true); - var height = el.outerHeight(true); - - for(var i=0;i
      ') - .css({ - position: 'absolute', - visibility: 'visible', - left: -j*(width/cells), - top: -i*(height/rows) - }) - .parent() - .addClass('ui-effects-explode') - .css({ - position: 'absolute', - overflow: 'hidden', - width: width/cells, - height: height/rows, - left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0), - top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0), - opacity: o.options.mode == 'show' ? 0 : 1 - }).animate({ - left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)), - top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)), - opacity: o.options.mode == 'show' ? 1 : 0 - }, o.duration || 500); - } - } - - // Set a timeout, to call the callback approx. when the other animations have finished - setTimeout(function() { - - o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide(); - if(o.callback) o.callback.apply(el[0]); // Callback - el.dequeue(); - - $('div.ui-effects-explode').remove(); - - }, o.duration || 500); - - - }); - -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.fade = function(o) { - return this.queue(function() { - var elem = $(this), - mode = $.effects.setMode(elem, o.options.mode || 'hide'); - - elem.animate({ opacity: mode }, { - queue: false, - duration: o.duration, - easing: o.options.easing, - complete: function() { - (o.callback && o.callback.apply(this, arguments)); - elem.dequeue(); - } - }); - }); -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.fold = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode - var size = o.options.size || 15; // Default fold size - var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value - var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2; - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var widthFirst = ((mode == 'show') != horizFirst); - var ref = widthFirst ? ['width', 'height'] : ['height', 'width']; - var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()]; - var percent = /([0-9]+)%/.exec(size); - if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1]; - if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift - - // Animation - var animation1 = {}, animation2 = {}; - animation1[ref[0]] = mode == 'show' ? distance[0] : size; - animation2[ref[1]] = mode == 'show' ? distance[1] : 0; - - // Animate - wrapper.animate(animation1, duration, o.options.easing) - .animate(animation2, duration, o.options.easing, function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(el[0], arguments); // Callback - el.dequeue(); - }); - - }); - -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.highlight = function(o) { - return this.queue(function() { - var elem = $(this), - props = ['backgroundImage', 'backgroundColor', 'opacity'], - mode = $.effects.setMode(elem, o.options.mode || 'show'), - animation = { - backgroundColor: elem.css('backgroundColor') - }; - - if (mode == 'hide') { - animation.opacity = 0; - } - - $.effects.save(elem, props); - elem - .show() - .css({ - backgroundImage: 'none', - backgroundColor: o.options.color || '#ffff99' - }) - .animate(animation, { - queue: false, - duration: o.duration, - easing: o.options.easing, - complete: function() { - (mode == 'hide' && elem.hide()); - $.effects.restore(elem, props); - (mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter')); - (o.callback && o.callback.apply(this, arguments)); - elem.dequeue(); - } - }); - }); -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.pulsate = function(o) { - return this.queue(function() { - var elem = $(this), - mode = $.effects.setMode(elem, o.options.mode || 'show'), - times = ((o.options.times || 5) * 2) - 1, - duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2, - isVisible = elem.is(':visible'), - animateTo = 0; - - if (!isVisible) { - elem.css('opacity', 0).show(); - animateTo = 1; - } - - if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) { - times--; - } - - for (var i = 0; i < times; i++) { - elem.animate({ opacity: animateTo }, duration, o.options.easing); - animateTo = (animateTo + 1) % 2; - } - - elem.animate({ opacity: animateTo }, duration, o.options.easing, function() { - if (animateTo == 0) { - elem.hide(); - } - (o.callback && o.callback.apply(this, arguments)); - }); - - elem - .queue('fx', function() { elem.dequeue(); }) - .dequeue(); - }); -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.puff = function(o) { - return this.queue(function() { - var elem = $(this), - mode = $.effects.setMode(elem, o.options.mode || 'hide'), - percent = parseInt(o.options.percent, 10) || 150, - factor = percent / 100, - original = { height: elem.height(), width: elem.width() }; - - $.extend(o.options, { - fade: true, - mode: mode, - percent: mode == 'hide' ? percent : 100, - from: mode == 'hide' - ? original - : { - height: original.height * factor, - width: original.width * factor - } - }); - - elem.effect('scale', o.options, o.duration, o.callback); - elem.dequeue(); - }); -}; - -$.effects.scale = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this); - - // Set options - var options = $.extend(true, {}, o.options); - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent - var direction = o.options.direction || 'both'; // Set default axis - var origin = o.options.origin; // The origin of the scaling - if (mode != 'effect') { // Set default origin and restore for show/hide - options.origin = origin || ['middle','center']; - options.restore = true; - } - var original = {height: el.height(), width: el.width()}; // Save original - el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state - - // Adjust - var factor = { // Set scaling factor - y: direction != 'horizontal' ? (percent / 100) : 1, - x: direction != 'vertical' ? (percent / 100) : 1 - }; - el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state - - if (o.options.fade) { // Fade option to support puff - if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;}; - if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;}; - }; - - // Animation - options.from = el.from; options.to = el.to; options.mode = mode; - - // Animate - el.effect('size', options, o.duration, o.callback); - el.dequeue(); - }); - -}; - -$.effects.size = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right','width','height','overflow','opacity']; - var props1 = ['position','top','bottom','left','right','overflow','opacity']; // Always restore - var props2 = ['width','height','overflow']; // Copy for children - var cProps = ['fontSize']; - var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom']; - var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var restore = o.options.restore || false; // Default restore - var scale = o.options.scale || 'both'; // Default scale mode - var origin = o.options.origin; // The origin of the sizing - var original = {height: el.height(), width: el.width()}; // Save original - el.from = o.options.from || original; // Default from state - el.to = o.options.to || original; // Default to state - // Adjust - if (origin) { // Calculate baseline shifts - var baseline = $.effects.getBaseline(origin, original); - el.from.top = (original.height - el.from.height) * baseline.y; - el.from.left = (original.width - el.from.width) * baseline.x; - el.to.top = (original.height - el.to.height) * baseline.y; - el.to.left = (original.width - el.to.width) * baseline.x; - }; - var factor = { // Set scaling factor - from: {y: el.from.height / original.height, x: el.from.width / original.width}, - to: {y: el.to.height / original.height, x: el.to.width / original.width} - }; - if (scale == 'box' || scale == 'both') { // Scale the css box - if (factor.from.y != factor.to.y) { // Vertical props scaling - props = props.concat(vProps); - el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from); - el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to); - }; - if (factor.from.x != factor.to.x) { // Horizontal props scaling - props = props.concat(hProps); - el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from); - el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to); - }; - }; - if (scale == 'content' || scale == 'both') { // Scale the content - if (factor.from.y != factor.to.y) { // Vertical props scaling - props = props.concat(cProps); - el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from); - el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to); - }; - }; - $.effects.save(el, restore ? props : props1); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - el.css('overflow','hidden').css(el.from); // Shift - - // Animate - if (scale == 'content' || scale == 'both') { // Scale the children - vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size - hProps = hProps.concat(['marginLeft','marginRight']); // Add margins - props2 = props.concat(vProps).concat(hProps); // Concat - el.find("*[width]").each(function(){ - var child = $(this); - if (restore) $.effects.save(child, props2); - var c_original = {height: child.height(), width: child.width()}; // Save original - child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x}; - child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x}; - if (factor.from.y != factor.to.y) { // Vertical props scaling - child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from); - child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to); - }; - if (factor.from.x != factor.to.x) { // Horizontal props scaling - child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from); - child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to); - }; - child.css(child.from); // Shift children - child.animate(child.to, o.duration, o.options.easing, function(){ - if (restore) $.effects.restore(child, props2); // Restore children - }); // Animate children - }); - }; - - // Animate - el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if (el.to.opacity === 0) { - el.css('opacity', el.from.opacity); - } - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.shake = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode - var direction = o.options.direction || 'left'; // Default direction - var distance = o.options.distance || 20; // Default distance - var times = o.options.times || 3; // Default # of times - var speed = o.duration || o.options.duration || 140; // Default speed per shake - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - - // Animation - var animation = {}, animation1 = {}, animation2 = {}; - animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance; - animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2; - animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2; - - // Animate - el.animate(animation, speed, o.options.easing); - for (var i = 1; i < times; i++) { // Shakes - el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing); - }; - el.animate(animation1, speed, o.options.easing). - animate(animation, speed / 2, o.options.easing, function(){ // Last shake - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - }); - el.queue('fx', function() { el.dequeue(); }); - el.dequeue(); - }); - -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.slide = function(o) { - - return this.queue(function() { - - // Create element - var el = $(this), props = ['position','top','bottom','left','right']; - - // Set options - var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode - var direction = o.options.direction || 'left'; // Default Direction - - // Adjust - $.effects.save(el, props); el.show(); // Save & Show - $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper - var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; - var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight( true ) : el.outerWidth( true )); - if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift - - // Animation - var animation = {}; - animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance; - - // Animate - el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() { - if(mode == 'hide') el.hide(); // Hide - $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore - if(o.callback) o.callback.apply(this, arguments); // Callback - el.dequeue(); - }}); - - }); - -}; - -})(jQuery); - -(function( $, undefined ) { - -$.effects.transfer = function(o) { - return this.queue(function() { - var elem = $(this), - target = $(o.options.to), - endPosition = target.offset(), - animation = { - top: endPosition.top, - left: endPosition.left, - height: target.innerHeight(), - width: target.innerWidth() - }, - startPosition = elem.offset(), - transfer = $('
      ') - .appendTo(document.body) - .addClass(o.options.className) - .css({ - top: startPosition.top, - left: startPosition.left, - height: elem.innerHeight(), - width: elem.innerWidth(), - position: 'absolute' - }) - .animate(animation, o.duration, o.options.easing, function() { - transfer.remove(); - (o.callback && o.callback.apply(elem[0], arguments)); - elem.dequeue(); - }); - }); -}; - -})(jQuery); - -(function( $, undefined ) { - -$.widget( "ui.accordion", { - options: { - active: 0, - animated: "slide", - autoHeight: true, - clearStyle: false, - collapsible: false, - event: "click", - fillSpace: false, - header: "> li > :first-child,> :not(li):even", - icons: { - header: "ui-icon-triangle-1-e", - headerSelected: "ui-icon-triangle-1-s" - }, - navigation: false, - navigationFilter: function() { - return this.href.toLowerCase() === location.href.toLowerCase(); - } - }, - - _create: function() { - var self = this, - options = self.options; - - self.running = 0; - - self.element - .addClass( "ui-accordion ui-widget ui-helper-reset" ) - // in lack of child-selectors in CSS - // we need to mark top-LIs in a UL-accordion for some IE-fix - .children( "li" ) - .addClass( "ui-accordion-li-fix" ); - - self.headers = self.element.find( options.header ) - .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ) - .bind( "mouseenter.accordion", function() { - if ( options.disabled ) { - return; - } - $( this ).addClass( "ui-state-hover" ); - }) - .bind( "mouseleave.accordion", function() { - if ( options.disabled ) { - return; - } - $( this ).removeClass( "ui-state-hover" ); - }) - .bind( "focus.accordion", function() { - if ( options.disabled ) { - return; - } - $( this ).addClass( "ui-state-focus" ); - }) - .bind( "blur.accordion", function() { - if ( options.disabled ) { - return; - } - $( this ).removeClass( "ui-state-focus" ); - }); - - self.headers.next() - .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ); - - if ( options.navigation ) { - var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 ); - if ( current.length ) { - var header = current.closest( ".ui-accordion-header" ); - if ( header.length ) { - // anchor within header - self.active = header; - } else { - // anchor within content - self.active = current.closest( ".ui-accordion-content" ).prev(); - } - } - } - - self.active = self._findActive( self.active || options.active ) - .addClass( "ui-state-default ui-state-active" ) - .toggleClass( "ui-corner-all" ) - .toggleClass( "ui-corner-top" ); - self.active.next().addClass( "ui-accordion-content-active" ); - - self._createIcons(); - self.resize(); - - // ARIA - self.element.attr( "role", "tablist" ); - - self.headers - .attr( "role", "tab" ) - .bind( "keydown.accordion", function( event ) { - return self._keydown( event ); - }) - .next() - .attr( "role", "tabpanel" ); - - self.headers - .not( self.active || "" ) - .attr({ - "aria-expanded": "false", - "aria-selected": "false", - tabIndex: -1 - }) - .next() - .hide(); - - // make sure at least one header is in the tab order - if ( !self.active.length ) { - self.headers.eq( 0 ).attr( "tabIndex", 0 ); - } else { - self.active - .attr({ - "aria-expanded": "true", - "aria-selected": "true", - tabIndex: 0 - }); - } - - // only need links in tab order for Safari - if ( !$.browser.safari ) { - self.headers.find( "a" ).attr( "tabIndex", -1 ); - } - - if ( options.event ) { - self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) { - self._clickHandler.call( self, event, this ); - event.preventDefault(); - }); - } - }, - - _createIcons: function() { - var options = this.options; - if ( options.icons ) { - $( "" ) - .addClass( "ui-icon " + options.icons.header ) - .prependTo( this.headers ); - this.active.children( ".ui-icon" ) - .toggleClass(options.icons.header) - .toggleClass(options.icons.headerSelected); - this.element.addClass( "ui-accordion-icons" ); - } - }, - - _destroyIcons: function() { - this.headers.children( ".ui-icon" ).remove(); - this.element.removeClass( "ui-accordion-icons" ); - }, - - destroy: function() { - var options = this.options; - - this.element - .removeClass( "ui-accordion ui-widget ui-helper-reset" ) - .removeAttr( "role" ); - - this.headers - .unbind( ".accordion" ) - .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) - .removeAttr( "role" ) - .removeAttr( "aria-expanded" ) - .removeAttr( "aria-selected" ) - .removeAttr( "tabIndex" ); - - this.headers.find( "a" ).removeAttr( "tabIndex" ); - this._destroyIcons(); - var contents = this.headers.next() - .css( "display", "" ) - .removeAttr( "role" ) - .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" ); - if ( options.autoHeight || options.fillHeight ) { - contents.css( "height", "" ); - } - - return $.Widget.prototype.destroy.call( this ); - }, - - _setOption: function( key, value ) { - $.Widget.prototype._setOption.apply( this, arguments ); - - if ( key == "active" ) { - this.activate( value ); - } - if ( key == "icons" ) { - this._destroyIcons(); - if ( value ) { - this._createIcons(); - } - } - // #5332 - opacity doesn't cascade to positioned elements in IE - // so we need to add the disabled class to the headers and panels - if ( key == "disabled" ) { - this.headers.add(this.headers.next()) - [ value ? "addClass" : "removeClass" ]( - "ui-accordion-disabled ui-state-disabled" ); - } - }, - - _keydown: function( event ) { - if ( this.options.disabled || event.altKey || event.ctrlKey ) { - return; - } - - var keyCode = $.ui.keyCode, - length = this.headers.length, - currentIndex = this.headers.index( event.target ), - toFocus = false; - - switch ( event.keyCode ) { - case keyCode.RIGHT: - case keyCode.DOWN: - toFocus = this.headers[ ( currentIndex + 1 ) % length ]; - break; - case keyCode.LEFT: - case keyCode.UP: - toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; - break; - case keyCode.SPACE: - case keyCode.ENTER: - this._clickHandler( { target: event.target }, event.target ); - event.preventDefault(); - } - - if ( toFocus ) { - $( event.target ).attr( "tabIndex", -1 ); - $( toFocus ).attr( "tabIndex", 0 ); - toFocus.focus(); - return false; - } - - return true; - }, - - resize: function() { - var options = this.options, - maxHeight; - - if ( options.fillSpace ) { - if ( $.browser.msie ) { - var defOverflow = this.element.parent().css( "overflow" ); - this.element.parent().css( "overflow", "hidden"); - } - maxHeight = this.element.parent().height(); - if ($.browser.msie) { - this.element.parent().css( "overflow", defOverflow ); - } - - this.headers.each(function() { - maxHeight -= $( this ).outerHeight( true ); - }); - - this.headers.next() - .each(function() { - $( this ).height( Math.max( 0, maxHeight - - $( this ).innerHeight() + $( this ).height() ) ); - }) - .css( "overflow", "auto" ); - } else if ( options.autoHeight ) { - maxHeight = 0; - this.headers.next() - .each(function() { - maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); - }) - .height( maxHeight ); - } - - return this; - }, - - activate: function( index ) { - // TODO this gets called on init, changing the option without an explicit call for that - this.options.active = index; - // call clickHandler with custom event - var active = this._findActive( index )[ 0 ]; - this._clickHandler( { target: active }, active ); - - return this; - }, - - _findActive: function( selector ) { - return selector - ? typeof selector === "number" - ? this.headers.filter( ":eq(" + selector + ")" ) - : this.headers.not( this.headers.not( selector ) ) - : selector === false - ? $( [] ) - : this.headers.filter( ":eq(0)" ); - }, - - // TODO isn't event.target enough? why the separate target argument? - _clickHandler: function( event, target ) { - var options = this.options; - if ( options.disabled ) { - return; - } - - // called only when using activate(false) to close all parts programmatically - if ( !event.target ) { - if ( !options.collapsible ) { - return; - } - this.active - .removeClass( "ui-state-active ui-corner-top" ) - .addClass( "ui-state-default ui-corner-all" ) - .children( ".ui-icon" ) - .removeClass( options.icons.headerSelected ) - .addClass( options.icons.header ); - this.active.next().addClass( "ui-accordion-content-active" ); - var toHide = this.active.next(), - data = { - options: options, - newHeader: $( [] ), - oldHeader: options.active, - newContent: $( [] ), - oldContent: toHide - }, - toShow = ( this.active = $( [] ) ); - this._toggle( toShow, toHide, data ); - return; - } - - // get the click target - var clicked = $( event.currentTarget || target ), - clickedIsActive = clicked[0] === this.active[0]; - - // TODO the option is changed, is that correct? - // TODO if it is correct, shouldn't that happen after determining that the click is valid? - options.active = options.collapsible && clickedIsActive ? - false : - this.headers.index( clicked ); - - // if animations are still active, or the active header is the target, ignore click - if ( this.running || ( !options.collapsible && clickedIsActive ) ) { - return; - } - - // find elements to show and hide - var active = this.active, - toShow = clicked.next(), - toHide = this.active.next(), - data = { - options: options, - newHeader: clickedIsActive && options.collapsible ? $([]) : clicked, - oldHeader: this.active, - newContent: clickedIsActive && options.collapsible ? $([]) : toShow, - oldContent: toHide - }, - down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] ); - - // when the call to ._toggle() comes after the class changes - // it causes a very odd bug in IE 8 (see #6720) - this.active = clickedIsActive ? $([]) : clicked; - this._toggle( toShow, toHide, data, clickedIsActive, down ); - - // switch classes - active - .removeClass( "ui-state-active ui-corner-top" ) - .addClass( "ui-state-default ui-corner-all" ) - .children( ".ui-icon" ) - .removeClass( options.icons.headerSelected ) - .addClass( options.icons.header ); - if ( !clickedIsActive ) { - clicked - .removeClass( "ui-state-default ui-corner-all" ) - .addClass( "ui-state-active ui-corner-top" ) - .children( ".ui-icon" ) - .removeClass( options.icons.header ) - .addClass( options.icons.headerSelected ); - clicked - .next() - .addClass( "ui-accordion-content-active" ); - } - - return; - }, - - _toggle: function( toShow, toHide, data, clickedIsActive, down ) { - var self = this, - options = self.options; - - self.toShow = toShow; - self.toHide = toHide; - self.data = data; - - var complete = function() { - if ( !self ) { - return; - } - return self._completed.apply( self, arguments ); - }; - - // trigger changestart event - self._trigger( "changestart", null, self.data ); - - // count elements to animate - self.running = toHide.size() === 0 ? toShow.size() : toHide.size(); - - if ( options.animated ) { - var animOptions = {}; - - if ( options.collapsible && clickedIsActive ) { - animOptions = { - toShow: $( [] ), - toHide: toHide, - complete: complete, - down: down, - autoHeight: options.autoHeight || options.fillSpace - }; - } else { - animOptions = { - toShow: toShow, - toHide: toHide, - complete: complete, - down: down, - autoHeight: options.autoHeight || options.fillSpace - }; - } - - if ( !options.proxied ) { - options.proxied = options.animated; - } - - if ( !options.proxiedDuration ) { - options.proxiedDuration = options.duration; - } - - options.animated = $.isFunction( options.proxied ) ? - options.proxied( animOptions ) : - options.proxied; - - options.duration = $.isFunction( options.proxiedDuration ) ? - options.proxiedDuration( animOptions ) : - options.proxiedDuration; - - var animations = $.ui.accordion.animations, - duration = options.duration, - easing = options.animated; - - if ( easing && !animations[ easing ] && !$.easing[ easing ] ) { - easing = "slide"; - } - if ( !animations[ easing ] ) { - animations[ easing ] = function( options ) { - this.slide( options, { - easing: easing, - duration: duration || 700 - }); - }; - } - - animations[ easing ]( animOptions ); - } else { - if ( options.collapsible && clickedIsActive ) { - toShow.toggle(); - } else { - toHide.hide(); - toShow.show(); - } - - complete( true ); - } - - // TODO assert that the blur and focus triggers are really necessary, remove otherwise - toHide.prev() - .attr({ - "aria-expanded": "false", - "aria-selected": "false", - tabIndex: -1 - }) - .blur(); - toShow.prev() - .attr({ - "aria-expanded": "true", - "aria-selected": "true", - tabIndex: 0 - }) - .focus(); - }, - - _completed: function( cancel ) { - this.running = cancel ? 0 : --this.running; - if ( this.running ) { - return; - } - - if ( this.options.clearStyle ) { - this.toShow.add( this.toHide ).css({ - height: "", - overflow: "" - }); - } - - // other classes are removed before the animation; this one needs to stay until completed - this.toHide.removeClass( "ui-accordion-content-active" ); - // Work around for rendering bug in IE (#5421) - if ( this.toHide.length ) { - this.toHide.parent()[0].className = this.toHide.parent()[0].className; - } - - this._trigger( "change", null, this.data ); - } -}); - -$.extend( $.ui.accordion, { - version: "1.8.23", - animations: { - slide: function( options, additions ) { - options = $.extend({ - easing: "swing", - duration: 300 - }, options, additions ); - if ( !options.toHide.size() ) { - options.toShow.animate({ - height: "show", - paddingTop: "show", - paddingBottom: "show" - }, options ); - return; - } - if ( !options.toShow.size() ) { - options.toHide.animate({ - height: "hide", - paddingTop: "hide", - paddingBottom: "hide" - }, options ); - return; - } - var overflow = options.toShow.css( "overflow" ), - percentDone = 0, - showProps = {}, - hideProps = {}, - fxAttrs = [ "height", "paddingTop", "paddingBottom" ], - originalWidth; - // fix width before calculating height of hidden element - var s = options.toShow; - originalWidth = s[0].style.width; - s.width( s.parent().width() - - parseFloat( s.css( "paddingLeft" ) ) - - parseFloat( s.css( "paddingRight" ) ) - - ( parseFloat( s.css( "borderLeftWidth" ) ) || 0 ) - - ( parseFloat( s.css( "borderRightWidth" ) ) || 0 ) ); - - $.each( fxAttrs, function( i, prop ) { - hideProps[ prop ] = "hide"; - - var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ ); - showProps[ prop ] = { - value: parts[ 1 ], - unit: parts[ 2 ] || "px" - }; - }); - options.toShow.css({ height: 0, overflow: "hidden" }).show(); - options.toHide - .filter( ":hidden" ) - .each( options.complete ) - .end() - .filter( ":visible" ) - .animate( hideProps, { - step: function( now, settings ) { - // only calculate the percent when animating height - // IE gets very inconsistent results when animating elements - // with small values, which is common for padding - if ( settings.prop == "height" ) { - percentDone = ( settings.end - settings.start === 0 ) ? 0 : - ( settings.now - settings.start ) / ( settings.end - settings.start ); - } - - options.toShow[ 0 ].style[ settings.prop ] = - ( percentDone * showProps[ settings.prop ].value ) - + showProps[ settings.prop ].unit; - }, - duration: options.duration, - easing: options.easing, - complete: function() { - if ( !options.autoHeight ) { - options.toShow.css( "height", "" ); - } - options.toShow.css({ - width: originalWidth, - overflow: overflow - }); - options.complete(); - } - }); - }, - bounceslide: function( options ) { - this.slide( options, { - easing: options.down ? "easeOutBounce" : "swing", - duration: options.down ? 1000 : 200 - }); - } - } -}); - -})( jQuery ); - -(function( $, undefined ) { - -// used to prevent race conditions with remote data sources -var requestIndex = 0; - -$.widget( "ui.autocomplete", { - options: { - appendTo: "body", - autoFocus: false, - delay: 300, - minLength: 1, - position: { - my: "left top", - at: "left bottom", - collision: "none" - }, - source: null - }, - - pending: 0, - - _create: function() { - var self = this, - doc = this.element[ 0 ].ownerDocument, - suppressKeyPress; - this.isMultiLine = this.element.is( "textarea" ); - - this.element - .addClass( "ui-autocomplete-input" ) - .attr( "autocomplete", "off" ) - // TODO verify these actually work as intended - .attr({ - role: "textbox", - "aria-autocomplete": "list", - "aria-haspopup": "true" - }) - .bind( "keydown.autocomplete", function( event ) { - if ( self.options.disabled || self.element.propAttr( "readOnly" ) ) { - return; - } - - suppressKeyPress = false; - var keyCode = $.ui.keyCode; - switch( event.keyCode ) { - case keyCode.PAGE_UP: - self._move( "previousPage", event ); - break; - case keyCode.PAGE_DOWN: - self._move( "nextPage", event ); - break; - case keyCode.UP: - self._keyEvent( "previous", event ); - break; - case keyCode.DOWN: - self._keyEvent( "next", event ); - break; - case keyCode.ENTER: - case keyCode.NUMPAD_ENTER: - // when menu is open and has focus - if ( self.menu.active ) { - // #6055 - Opera still allows the keypress to occur - // which causes forms to submit - suppressKeyPress = true; - event.preventDefault(); - } - //passthrough - ENTER and TAB both select the current element - case keyCode.TAB: - if ( !self.menu.active ) { - return; - } - self.menu.select( event ); - break; - case keyCode.ESCAPE: - self.element.val( self.term ); - self.close( event ); - break; - default: - // keypress is triggered before the input value is changed - clearTimeout( self.searching ); - self.searching = setTimeout(function() { - // only search if the value has changed - if ( self.term != self.element.val() ) { - self.selectedItem = null; - self.search( null, event ); - } - }, self.options.delay ); - break; - } - }) - .bind( "keypress.autocomplete", function( event ) { - if ( suppressKeyPress ) { - suppressKeyPress = false; - event.preventDefault(); - } - }) - .bind( "focus.autocomplete", function() { - if ( self.options.disabled ) { - return; - } - - self.selectedItem = null; - self.previous = self.element.val(); - }) - .bind( "blur.autocomplete", function( event ) { - if ( self.options.disabled ) { - return; - } - - clearTimeout( self.searching ); - // clicks on the menu (or a button to trigger a search) will cause a blur event - self.closing = setTimeout(function() { - self.close( event ); - self._change( event ); - }, 150 ); - }); - this._initSource(); - this.menu = $( "
        " ) - .addClass( "ui-autocomplete" ) - .appendTo( $( this.options.appendTo || "body", doc )[0] ) - // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown) - .mousedown(function( event ) { - // clicking on the scrollbar causes focus to shift to the body - // but we can't detect a mouseup or a click immediately afterward - // so we have to track the next mousedown and close the menu if - // the user clicks somewhere outside of the autocomplete - var menuElement = self.menu.element[ 0 ]; - if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { - setTimeout(function() { - $( document ).one( 'mousedown', function( event ) { - if ( event.target !== self.element[ 0 ] && - event.target !== menuElement && - !$.ui.contains( menuElement, event.target ) ) { - self.close(); - } - }); - }, 1 ); - } - - // use another timeout to make sure the blur-event-handler on the input was already triggered - setTimeout(function() { - clearTimeout( self.closing ); - }, 13); - }) - .menu({ - focus: function( event, ui ) { - var item = ui.item.data( "item.autocomplete" ); - if ( false !== self._trigger( "focus", event, { item: item } ) ) { - // use value to match what will end up in the input, if it was a key event - if ( /^key/.test(event.originalEvent.type) ) { - self.element.val( item.value ); - } - } - }, - selected: function( event, ui ) { - var item = ui.item.data( "item.autocomplete" ), - previous = self.previous; - - // only trigger when focus was lost (click on menu) - if ( self.element[0] !== doc.activeElement ) { - self.element.focus(); - self.previous = previous; - // #6109 - IE triggers two focus events and the second - // is asynchronous, so we need to reset the previous - // term synchronously and asynchronously :-( - setTimeout(function() { - self.previous = previous; - self.selectedItem = item; - }, 1); - } - - if ( false !== self._trigger( "select", event, { item: item } ) ) { - self.element.val( item.value ); - } - // reset the term after the select event - // this allows custom select handling to work properly - self.term = self.element.val(); - - self.close( event ); - self.selectedItem = item; - }, - blur: function( event, ui ) { - // don't set the value of the text field if it's already correct - // this prevents moving the cursor unnecessarily - if ( self.menu.element.is(":visible") && - ( self.element.val() !== self.term ) ) { - self.element.val( self.term ); - } - } - }) - .zIndex( this.element.zIndex() + 1 ) - // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 - .css({ top: 0, left: 0 }) - .hide() - .data( "menu" ); - if ( $.fn.bgiframe ) { - this.menu.element.bgiframe(); - } - // turning off autocomplete prevents the browser from remembering the - // value when navigating through history, so we re-enable autocomplete - // if the page is unloaded before the widget is destroyed. #7790 - self.beforeunloadHandler = function() { - self.element.removeAttr( "autocomplete" ); - }; - $( window ).bind( "beforeunload", self.beforeunloadHandler ); - }, - - destroy: function() { - this.element - .removeClass( "ui-autocomplete-input" ) - .removeAttr( "autocomplete" ) - .removeAttr( "role" ) - .removeAttr( "aria-autocomplete" ) - .removeAttr( "aria-haspopup" ); - this.menu.element.remove(); - $( window ).unbind( "beforeunload", this.beforeunloadHandler ); - $.Widget.prototype.destroy.call( this ); - }, - - _setOption: function( key, value ) { - $.Widget.prototype._setOption.apply( this, arguments ); - if ( key === "source" ) { - this._initSource(); - } - if ( key === "appendTo" ) { - this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] ) - } - if ( key === "disabled" && value && this.xhr ) { - this.xhr.abort(); - } - }, - - _initSource: function() { - var self = this, - array, - url; - if ( $.isArray(this.options.source) ) { - array = this.options.source; - this.source = function( request, response ) { - response( $.ui.autocomplete.filter(array, request.term) ); - }; - } else if ( typeof this.options.source === "string" ) { - url = this.options.source; - this.source = function( request, response ) { - if ( self.xhr ) { - self.xhr.abort(); - } - self.xhr = $.ajax({ - url: url, - data: request, - dataType: "json", - success: function( data, status ) { - response( data ); - }, - error: function() { - response( [] ); - } - }); - }; - } else { - this.source = this.options.source; - } - }, - - search: function( value, event ) { - value = value != null ? value : this.element.val(); - - // always save the actual value, not the one passed as an argument - this.term = this.element.val(); - - if ( value.length < this.options.minLength ) { - return this.close( event ); - } - - clearTimeout( this.closing ); - if ( this._trigger( "search", event ) === false ) { - return; - } - - return this._search( value ); - }, - - _search: function( value ) { - this.pending++; - this.element.addClass( "ui-autocomplete-loading" ); - - this.source( { term: value }, this._response() ); - }, - - _response: function() { - var that = this, - index = ++requestIndex; - - return function( content ) { - if ( index === requestIndex ) { - that.__response( content ); - } - - that.pending--; - if ( !that.pending ) { - that.element.removeClass( "ui-autocomplete-loading" ); - } - }; - }, - - __response: function( content ) { - if ( !this.options.disabled && content && content.length ) { - content = this._normalize( content ); - this._suggest( content ); - this._trigger( "open" ); - } else { - this.close(); - } - }, - - close: function( event ) { - clearTimeout( this.closing ); - if ( this.menu.element.is(":visible") ) { - this.menu.element.hide(); - this.menu.deactivate(); - this._trigger( "close", event ); - } - }, - - _change: function( event ) { - if ( this.previous !== this.element.val() ) { - this._trigger( "change", event, { item: this.selectedItem } ); - } - }, - - _normalize: function( items ) { - // assume all items have the right format when the first item is complete - if ( items.length && items[0].label && items[0].value ) { - return items; - } - return $.map( items, function(item) { - if ( typeof item === "string" ) { - return { - label: item, - value: item - }; - } - return $.extend({ - label: item.label || item.value, - value: item.value || item.label - }, item ); - }); - }, - - _suggest: function( items ) { - var ul = this.menu.element - .empty() - .zIndex( this.element.zIndex() + 1 ); - this._renderMenu( ul, items ); - // TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate - this.menu.deactivate(); - this.menu.refresh(); - - // size and position menu - ul.show(); - this._resizeMenu(); - ul.position( $.extend({ - of: this.element - }, this.options.position )); - - if ( this.options.autoFocus ) { - this.menu.next( new $.Event("mouseover") ); - } - }, - - _resizeMenu: function() { - var ul = this.menu.element; - ul.outerWidth( Math.max( - // Firefox wraps long text (possibly a rounding bug) - // so we add 1px to avoid the wrapping (#7513) - ul.width( "" ).outerWidth() + 1, - this.element.outerWidth() - ) ); - }, - - _renderMenu: function( ul, items ) { - var self = this; - $.each( items, function( index, item ) { - self._renderItem( ul, item ); - }); - }, - - _renderItem: function( ul, item) { - return $( "
      • " ) - .data( "item.autocomplete", item ) - .append( $( "
        " ).text( item.label ) ) - .appendTo( ul ); - }, - - _move: function( direction, event ) { - if ( !this.menu.element.is(":visible") ) { - this.search( null, event ); - return; - } - if ( this.menu.first() && /^previous/.test(direction) || - this.menu.last() && /^next/.test(direction) ) { - this.element.val( this.term ); - this.menu.deactivate(); - return; - } - this.menu[ direction ]( event ); - }, - - widget: function() { - return this.menu.element; - }, - _keyEvent: function( keyEvent, event ) { - if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { - this._move( keyEvent, event ); - - // prevents moving cursor to beginning/end of the text field in some browsers - event.preventDefault(); - } - } -}); - -$.extend( $.ui.autocomplete, { - escapeRegex: function( value ) { - return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - }, - filter: function(array, term) { - var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" ); - return $.grep( array, function(value) { - return matcher.test( value.label || value.value || value ); - }); - } -}); - -}( jQuery )); - -/* - * jQuery UI Menu (not officially released) - * - * This widget isn't yet finished and the API is subject to change. We plan to finish - * it for the next release. You're welcome to give it a try anyway and give us feedback, - * as long as you're okay with migrating your code later on. We can help with that, too. - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Licensed under the MIT license. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Menu - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function($) { - -$.widget("ui.menu", { - _create: function() { - var self = this; - this.element - .addClass("ui-menu ui-widget ui-widget-content ui-corner-all") - .attr({ - role: "listbox", - "aria-activedescendant": "ui-active-menuitem" - }) - .click(function( event ) { - if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) { - return; - } - // temporary - event.preventDefault(); - self.select( event ); - }); - this.refresh(); - }, - - refresh: function() { - var self = this; - - // don't refresh list items that are already adapted - var items = this.element.children("li:not(.ui-menu-item):has(a)") - .addClass("ui-menu-item") - .attr("role", "menuitem"); - - items.children("a") - .addClass("ui-corner-all") - .attr("tabindex", -1) - // mouseenter doesn't work with event delegation - .mouseenter(function( event ) { - self.activate( event, $(this).parent() ); - }) - .mouseleave(function() { - self.deactivate(); - }); - }, - - activate: function( event, item ) { - this.deactivate(); - if (this.hasScroll()) { - var offset = item.offset().top - this.element.offset().top, - scroll = this.element.scrollTop(), - elementHeight = this.element.height(); - if (offset < 0) { - this.element.scrollTop( scroll + offset); - } else if (offset >= elementHeight) { - this.element.scrollTop( scroll + offset - elementHeight + item.height()); - } - } - this.active = item.eq(0) - .children("a") - .addClass("ui-state-hover") - .attr("id", "ui-active-menuitem") - .end(); - this._trigger("focus", event, { item: item }); - }, - - deactivate: function() { - if (!this.active) { return; } - - this.active.children("a") - .removeClass("ui-state-hover") - .removeAttr("id"); - this._trigger("blur"); - this.active = null; - }, - - next: function(event) { - this.move("next", ".ui-menu-item:first", event); - }, - - previous: function(event) { - this.move("prev", ".ui-menu-item:last", event); - }, - - first: function() { - return this.active && !this.active.prevAll(".ui-menu-item").length; - }, - - last: function() { - return this.active && !this.active.nextAll(".ui-menu-item").length; - }, - - move: function(direction, edge, event) { - if (!this.active) { - this.activate(event, this.element.children(edge)); - return; - } - var next = this.active[direction + "All"](".ui-menu-item").eq(0); - if (next.length) { - this.activate(event, next); - } else { - this.activate(event, this.element.children(edge)); - } - }, - - // TODO merge with previousPage - nextPage: function(event) { - if (this.hasScroll()) { - // TODO merge with no-scroll-else - if (!this.active || this.last()) { - this.activate(event, this.element.children(".ui-menu-item:first")); - return; - } - var base = this.active.offset().top, - height = this.element.height(), - result = this.element.children(".ui-menu-item").filter(function() { - var close = $(this).offset().top - base - height + $(this).height(); - // TODO improve approximation - return close < 10 && close > -10; - }); - - // TODO try to catch this earlier when scrollTop indicates the last page anyway - if (!result.length) { - result = this.element.children(".ui-menu-item:last"); - } - this.activate(event, result); - } else { - this.activate(event, this.element.children(".ui-menu-item") - .filter(!this.active || this.last() ? ":first" : ":last")); - } - }, - - // TODO merge with nextPage - previousPage: function(event) { - if (this.hasScroll()) { - // TODO merge with no-scroll-else - if (!this.active || this.first()) { - this.activate(event, this.element.children(".ui-menu-item:last")); - return; - } - - var base = this.active.offset().top, - height = this.element.height(), - result = this.element.children(".ui-menu-item").filter(function() { - var close = $(this).offset().top - base + height - $(this).height(); - // TODO improve approximation - return close < 10 && close > -10; - }); - - // TODO try to catch this earlier when scrollTop indicates the last page anyway - if (!result.length) { - result = this.element.children(".ui-menu-item:first"); - } - this.activate(event, result); - } else { - this.activate(event, this.element.children(".ui-menu-item") - .filter(!this.active || this.first() ? ":last" : ":first")); - } - }, - - hasScroll: function() { - return this.element.height() < this.element[ $.fn.prop ? "prop" : "attr" ]("scrollHeight"); - }, - - select: function( event ) { - this._trigger("selected", event, { item: this.active }); - } -}); - -}(jQuery)); - -(function( $, undefined ) { - -var lastActive, startXPos, startYPos, clickDragged, - baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", - stateClasses = "ui-state-hover ui-state-active ", - typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", - formResetHandler = function() { - var buttons = $( this ).find( ":ui-button" ); - setTimeout(function() { - buttons.button( "refresh" ); - }, 1 ); - }, - radioGroup = function( radio ) { - var name = radio.name, - form = radio.form, - radios = $( [] ); - if ( name ) { - if ( form ) { - radios = $( form ).find( "[name='" + name + "']" ); - } else { - radios = $( "[name='" + name + "']", radio.ownerDocument ) - .filter(function() { - return !this.form; - }); - } - } - return radios; - }; - -$.widget( "ui.button", { - options: { - disabled: null, - text: true, - label: null, - icons: { - primary: null, - secondary: null - } - }, - _create: function() { - this.element.closest( "form" ) - .unbind( "reset.button" ) - .bind( "reset.button", formResetHandler ); - - if ( typeof this.options.disabled !== "boolean" ) { - this.options.disabled = !!this.element.propAttr( "disabled" ); - } else { - this.element.propAttr( "disabled", this.options.disabled ); - } - - this._determineButtonType(); - this.hasTitle = !!this.buttonElement.attr( "title" ); - - var self = this, - options = this.options, - toggleButton = this.type === "checkbox" || this.type === "radio", - hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ), - focusClass = "ui-state-focus"; - - if ( options.label === null ) { - options.label = this.buttonElement.html(); - } - - this.buttonElement - .addClass( baseClasses ) - .attr( "role", "button" ) - .bind( "mouseenter.button", function() { - if ( options.disabled ) { - return; - } - $( this ).addClass( "ui-state-hover" ); - if ( this === lastActive ) { - $( this ).addClass( "ui-state-active" ); - } - }) - .bind( "mouseleave.button", function() { - if ( options.disabled ) { - return; - } - $( this ).removeClass( hoverClass ); - }) - .bind( "click.button", function( event ) { - if ( options.disabled ) { - event.preventDefault(); - event.stopImmediatePropagation(); - } - }); - - this.element - .bind( "focus.button", function() { - // no need to check disabled, focus won't be triggered anyway - self.buttonElement.addClass( focusClass ); - }) - .bind( "blur.button", function() { - self.buttonElement.removeClass( focusClass ); - }); - - if ( toggleButton ) { - this.element.bind( "change.button", function() { - if ( clickDragged ) { - return; - } - self.refresh(); - }); - // if mouse moves between mousedown and mouseup (drag) set clickDragged flag - // prevents issue where button state changes but checkbox/radio checked state - // does not in Firefox (see ticket #6970) - this.buttonElement - .bind( "mousedown.button", function( event ) { - if ( options.disabled ) { - return; - } - clickDragged = false; - startXPos = event.pageX; - startYPos = event.pageY; - }) - .bind( "mouseup.button", function( event ) { - if ( options.disabled ) { - return; - } - if ( startXPos !== event.pageX || startYPos !== event.pageY ) { - clickDragged = true; - } - }); - } - - if ( this.type === "checkbox" ) { - this.buttonElement.bind( "click.button", function() { - if ( options.disabled || clickDragged ) { - return false; - } - $( this ).toggleClass( "ui-state-active" ); - self.buttonElement.attr( "aria-pressed", self.element[0].checked ); - }); - } else if ( this.type === "radio" ) { - this.buttonElement.bind( "click.button", function() { - if ( options.disabled || clickDragged ) { - return false; - } - $( this ).addClass( "ui-state-active" ); - self.buttonElement.attr( "aria-pressed", "true" ); - - var radio = self.element[ 0 ]; - radioGroup( radio ) - .not( radio ) - .map(function() { - return $( this ).button( "widget" )[ 0 ]; - }) - .removeClass( "ui-state-active" ) - .attr( "aria-pressed", "false" ); - }); - } else { - this.buttonElement - .bind( "mousedown.button", function() { - if ( options.disabled ) { - return false; - } - $( this ).addClass( "ui-state-active" ); - lastActive = this; - $( document ).one( "mouseup", function() { - lastActive = null; - }); - }) - .bind( "mouseup.button", function() { - if ( options.disabled ) { - return false; - } - $( this ).removeClass( "ui-state-active" ); - }) - .bind( "keydown.button", function(event) { - if ( options.disabled ) { - return false; - } - if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) { - $( this ).addClass( "ui-state-active" ); - } - }) - .bind( "keyup.button", function() { - $( this ).removeClass( "ui-state-active" ); - }); - - if ( this.buttonElement.is("a") ) { - this.buttonElement.keyup(function(event) { - if ( event.keyCode === $.ui.keyCode.SPACE ) { - // TODO pass through original event correctly (just as 2nd argument doesn't work) - $( this ).click(); - } - }); - } - } - - // TODO: pull out $.Widget's handling for the disabled option into - // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can - // be overridden by individual plugins - this._setOption( "disabled", options.disabled ); - this._resetButton(); - }, - - _determineButtonType: function() { - - if ( this.element.is(":checkbox") ) { - this.type = "checkbox"; - } else if ( this.element.is(":radio") ) { - this.type = "radio"; - } else if ( this.element.is("input") ) { - this.type = "input"; - } else { - this.type = "button"; - } - - if ( this.type === "checkbox" || this.type === "radio" ) { - // we don't search against the document in case the element - // is disconnected from the DOM - var ancestor = this.element.parents().filter(":last"), - labelSelector = "label[for='" + this.element.attr("id") + "']"; - this.buttonElement = ancestor.find( labelSelector ); - if ( !this.buttonElement.length ) { - ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); - this.buttonElement = ancestor.filter( labelSelector ); - if ( !this.buttonElement.length ) { - this.buttonElement = ancestor.find( labelSelector ); - } - } - this.element.addClass( "ui-helper-hidden-accessible" ); - - var checked = this.element.is( ":checked" ); - if ( checked ) { - this.buttonElement.addClass( "ui-state-active" ); - } - this.buttonElement.attr( "aria-pressed", checked ); - } else { - this.buttonElement = this.element; - } - }, - - widget: function() { - return this.buttonElement; - }, - - destroy: function() { - this.element - .removeClass( "ui-helper-hidden-accessible" ); - this.buttonElement - .removeClass( baseClasses + " " + stateClasses + " " + typeClasses ) - .removeAttr( "role" ) - .removeAttr( "aria-pressed" ) - .html( this.buttonElement.find(".ui-button-text").html() ); - - if ( !this.hasTitle ) { - this.buttonElement.removeAttr( "title" ); - } - - $.Widget.prototype.destroy.call( this ); - }, - - _setOption: function( key, value ) { - $.Widget.prototype._setOption.apply( this, arguments ); - if ( key === "disabled" ) { - if ( value ) { - this.element.propAttr( "disabled", true ); - } else { - this.element.propAttr( "disabled", false ); - } - return; - } - this._resetButton(); - }, - - refresh: function() { - var isDisabled = this.element.is( ":disabled" ); - if ( isDisabled !== this.options.disabled ) { - this._setOption( "disabled", isDisabled ); - } - if ( this.type === "radio" ) { - radioGroup( this.element[0] ).each(function() { - if ( $( this ).is( ":checked" ) ) { - $( this ).button( "widget" ) - .addClass( "ui-state-active" ) - .attr( "aria-pressed", "true" ); - } else { - $( this ).button( "widget" ) - .removeClass( "ui-state-active" ) - .attr( "aria-pressed", "false" ); - } - }); - } else if ( this.type === "checkbox" ) { - if ( this.element.is( ":checked" ) ) { - this.buttonElement - .addClass( "ui-state-active" ) - .attr( "aria-pressed", "true" ); - } else { - this.buttonElement - .removeClass( "ui-state-active" ) - .attr( "aria-pressed", "false" ); - } - } - }, - - _resetButton: function() { - if ( this.type === "input" ) { - if ( this.options.label ) { - this.element.val( this.options.label ); - } - return; - } - var buttonElement = this.buttonElement.removeClass( typeClasses ), - buttonText = $( "", this.element[0].ownerDocument ) - .addClass( "ui-button-text" ) - .html( this.options.label ) - .appendTo( buttonElement.empty() ) - .text(), - icons = this.options.icons, - multipleIcons = icons.primary && icons.secondary, - buttonClasses = []; - - if ( icons.primary || icons.secondary ) { - if ( this.options.text ) { - buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) ); - } - - if ( icons.primary ) { - buttonElement.prepend( "" ); - } - - if ( icons.secondary ) { - buttonElement.append( "" ); - } - - if ( !this.options.text ) { - buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ); - - if ( !this.hasTitle ) { - buttonElement.attr( "title", buttonText ); - } - } - } else { - buttonClasses.push( "ui-button-text-only" ); - } - buttonElement.addClass( buttonClasses.join( " " ) ); - } -}); - -$.widget( "ui.buttonset", { - options: { - items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" - }, - - _create: function() { - this.element.addClass( "ui-buttonset" ); - }, - - _init: function() { - this.refresh(); - }, - - _setOption: function( key, value ) { - if ( key === "disabled" ) { - this.buttons.button( "option", key, value ); - } - - $.Widget.prototype._setOption.apply( this, arguments ); - }, - - refresh: function() { - var rtl = this.element.css( "direction" ) === "rtl"; - - this.buttons = this.element.find( this.options.items ) - .filter( ":ui-button" ) - .button( "refresh" ) - .end() - .not( ":ui-button" ) - .button() - .end() - .map(function() { - return $( this ).button( "widget" )[ 0 ]; - }) - .removeClass( "ui-corner-all ui-corner-left ui-corner-right" ) - .filter( ":first" ) - .addClass( rtl ? "ui-corner-right" : "ui-corner-left" ) - .end() - .filter( ":last" ) - .addClass( rtl ? "ui-corner-left" : "ui-corner-right" ) - .end() - .end(); - }, - - destroy: function() { - this.element.removeClass( "ui-buttonset" ); - this.buttons - .map(function() { - return $( this ).button( "widget" )[ 0 ]; - }) - .removeClass( "ui-corner-left ui-corner-right" ) - .end() - .button( "destroy" ); - - $.Widget.prototype.destroy.call( this ); - } -}); - -}( jQuery ) ); - -(function( $, undefined ) { - -$.extend($.ui, { datepicker: { version: "1.8.23" } }); - -var PROP_NAME = 'datepicker'; -var dpuuid = new Date().getTime(); -var instActive; - -/* Date picker manager. - Use the singleton instance of this class, $.datepicker, to interact with the date picker. - Settings for (groups of) date pickers are maintained in an instance object, - allowing multiple different settings on the same page. */ - -function Datepicker() { - this.debug = false; // Change this to true to start debugging - this._curInst = null; // The current instance in use - this._keyEvent = false; // If the last event was a key event - this._disabledInputs = []; // List of date picker inputs that have been disabled - this._datepickerShowing = false; // True if the popup picker is showing , false if not - this._inDialog = false; // True if showing within a "dialog", false if not - this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division - this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class - this._appendClass = 'ui-datepicker-append'; // The name of the append marker class - this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class - this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class - this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class - this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class - this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class - this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class - this.regional = []; // Available regional settings, indexed by language code - this.regional[''] = { // Default regional settings - closeText: 'Done', // Display text for close link - prevText: 'Prev', // Display text for previous month link - nextText: 'Next', // Display text for next month link - currentText: 'Today', // Display text for current month link - monthNames: ['January','February','March','April','May','June', - 'July','August','September','October','November','December'], // Names of months for drop-down and formatting - monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting - dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting - dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting - dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday - weekHeader: 'Wk', // Column header for week of the year - dateFormat: 'mm/dd/yy', // See format options on parseDate - firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... - isRTL: false, // True if right-to-left language, false if left-to-right - showMonthAfterYear: false, // True if the year select precedes month, false for month then year - yearSuffix: '' // Additional text to append to the year in the month headers - }; - this._defaults = { // Global defaults for all the date picker instances - showOn: 'focus', // 'focus' for popup on focus, - // 'button' for trigger button, or 'both' for either - showAnim: 'fadeIn', // Name of jQuery animation for popup - showOptions: {}, // Options for enhanced animations - defaultDate: null, // Used when field is blank: actual date, - // +/-number for offset from today, null for today - appendText: '', // Display text following the input box, e.g. showing the format - buttonText: '...', // Text for trigger button - buttonImage: '', // URL for trigger button image - buttonImageOnly: false, // True if the image appears alone, false if it appears on a button - hideIfNoPrevNext: false, // True to hide next/previous month links - // if not applicable, false to just disable them - navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links - gotoCurrent: false, // True if today link goes back to current selection instead - changeMonth: false, // True if month can be selected directly, false if only prev/next - changeYear: false, // True if year can be selected directly, false if only prev/next - yearRange: 'c-10:c+10', // Range of years to display in drop-down, - // either relative to today's year (-nn:+nn), relative to currently displayed year - // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) - showOtherMonths: false, // True to show dates in other months, false to leave blank - selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable - showWeek: false, // True to show week of the year, false to not show it - calculateWeek: this.iso8601Week, // How to calculate the week of the year, - // takes a Date and returns the number of the week for it - shortYearCutoff: '+10', // Short year values < this are in the current century, - // > this are in the previous century, - // string value starting with '+' for current year + value - minDate: null, // The earliest selectable date, or null for no limit - maxDate: null, // The latest selectable date, or null for no limit - duration: 'fast', // Duration of display/closure - beforeShowDay: null, // Function that takes a date and returns an array with - // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', - // [2] = cell title (optional), e.g. $.datepicker.noWeekends - beforeShow: null, // Function that takes an input field and - // returns a set of custom settings for the date picker - onSelect: null, // Define a callback function when a date is selected - onChangeMonthYear: null, // Define a callback function when the month or year is changed - onClose: null, // Define a callback function when the datepicker is closed - numberOfMonths: 1, // Number of months to show at a time - showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) - stepMonths: 1, // Number of months to step back/forward - stepBigMonths: 12, // Number of months to step back/forward for the big links - altField: '', // Selector for an alternate field to store selected dates into - altFormat: '', // The date format to use for the alternate field - constrainInput: true, // The input is constrained by the current date format - showButtonPanel: false, // True to show button panel, false to not show it - autoSize: false, // True to size the input for the date format, false to leave as is - disabled: false // The initial disabled state - }; - $.extend(this._defaults, this.regional['']); - this.dpDiv = bindHover($('
        ')); -} - -$.extend(Datepicker.prototype, { - /* Class name added to elements to indicate already configured with a date picker. */ - markerClassName: 'hasDatepicker', - - //Keep track of the maximum number of rows displayed (see #7043) - maxRows: 4, - - /* Debug logging (if enabled). */ - log: function () { - if (this.debug) - console.log.apply('', arguments); - }, - - // TODO rename to "widget" when switching to widget factory - _widgetDatepicker: function() { - return this.dpDiv; - }, - - /* Override the default settings for all instances of the date picker. - @param settings object - the new settings to use as defaults (anonymous object) - @return the manager object */ - setDefaults: function(settings) { - extendRemove(this._defaults, settings || {}); - return this; - }, - - /* Attach the date picker to a jQuery selection. - @param target element - the target input field or division or span - @param settings object - the new settings to use for this date picker instance (anonymous) */ - _attachDatepicker: function(target, settings) { - // check for settings on the control itself - in namespace 'date:' - var inlineSettings = null; - for (var attrName in this._defaults) { - var attrValue = target.getAttribute('date:' + attrName); - if (attrValue) { - inlineSettings = inlineSettings || {}; - try { - inlineSettings[attrName] = eval(attrValue); - } catch (err) { - inlineSettings[attrName] = attrValue; - } - } - } - var nodeName = target.nodeName.toLowerCase(); - var inline = (nodeName == 'div' || nodeName == 'span'); - if (!target.id) { - this.uuid += 1; - target.id = 'dp' + this.uuid; - } - var inst = this._newInst($(target), inline); - inst.settings = $.extend({}, settings || {}, inlineSettings || {}); - if (nodeName == 'input') { - this._connectDatepicker(target, inst); - } else if (inline) { - this._inlineDatepicker(target, inst); - } - }, - - /* Create a new instance object. */ - _newInst: function(target, inline) { - var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars - return {id: id, input: target, // associated target - selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection - drawMonth: 0, drawYear: 0, // month being drawn - inline: inline, // is datepicker inline or not - dpDiv: (!inline ? this.dpDiv : // presentation div - bindHover($('
        ')))}; - }, - - /* Attach the date picker to an input field. */ - _connectDatepicker: function(target, inst) { - var input = $(target); - inst.append = $([]); - inst.trigger = $([]); - if (input.hasClass(this.markerClassName)) - return; - this._attachments(input, inst); - input.addClass(this.markerClassName).keydown(this._doKeyDown). - keypress(this._doKeyPress).keyup(this._doKeyUp). - bind("setData.datepicker", function(event, key, value) { - inst.settings[key] = value; - }).bind("getData.datepicker", function(event, key) { - return this._get(inst, key); - }); - this._autoSize(inst); - $.data(target, PROP_NAME, inst); - //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) - if( inst.settings.disabled ) { - this._disableDatepicker( target ); - } - }, - - /* Make attachments based on settings. */ - _attachments: function(input, inst) { - var appendText = this._get(inst, 'appendText'); - var isRTL = this._get(inst, 'isRTL'); - if (inst.append) - inst.append.remove(); - if (appendText) { - inst.append = $('' + appendText + ''); - input[isRTL ? 'before' : 'after'](inst.append); - } - input.unbind('focus', this._showDatepicker); - if (inst.trigger) - inst.trigger.remove(); - var showOn = this._get(inst, 'showOn'); - if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field - input.focus(this._showDatepicker); - if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked - var buttonText = this._get(inst, 'buttonText'); - var buttonImage = this._get(inst, 'buttonImage'); - inst.trigger = $(this._get(inst, 'buttonImageOnly') ? - $('').addClass(this._triggerClass). - attr({ src: buttonImage, alt: buttonText, title: buttonText }) : - $('').addClass(this._triggerClass). - html(buttonImage == '' ? buttonText : $('').attr( - { src:buttonImage, alt:buttonText, title:buttonText }))); - input[isRTL ? 'before' : 'after'](inst.trigger); - inst.trigger.click(function() { - if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0]) - $.datepicker._hideDatepicker(); - else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) { - $.datepicker._hideDatepicker(); - $.datepicker._showDatepicker(input[0]); - } else - $.datepicker._showDatepicker(input[0]); - return false; - }); - } - }, - - /* Apply the maximum length for the date format. */ - _autoSize: function(inst) { - if (this._get(inst, 'autoSize') && !inst.inline) { - var date = new Date(2009, 12 - 1, 20); // Ensure double digits - var dateFormat = this._get(inst, 'dateFormat'); - if (dateFormat.match(/[DM]/)) { - var findMax = function(names) { - var max = 0; - var maxI = 0; - for (var i = 0; i < names.length; i++) { - if (names[i].length > max) { - max = names[i].length; - maxI = i; - } - } - return maxI; - }; - date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? - 'monthNames' : 'monthNamesShort')))); - date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? - 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay()); - } - inst.input.attr('size', this._formatDate(inst, date).length); - } - }, - - /* Attach an inline date picker to a div. */ - _inlineDatepicker: function(target, inst) { - var divSpan = $(target); - if (divSpan.hasClass(this.markerClassName)) - return; - divSpan.addClass(this.markerClassName).append(inst.dpDiv). - bind("setData.datepicker", function(event, key, value){ - inst.settings[key] = value; - }).bind("getData.datepicker", function(event, key){ - return this._get(inst, key); - }); - $.data(target, PROP_NAME, inst); - this._setDate(inst, this._getDefaultDate(inst), true); - this._updateDatepicker(inst); - this._updateAlternate(inst); - //If disabled option is true, disable the datepicker before showing it (see ticket #5665) - if( inst.settings.disabled ) { - this._disableDatepicker( target ); - } - // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements - // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height - inst.dpDiv.css( "display", "block" ); - }, - - /* Pop-up the date picker in a "dialog" box. - @param input element - ignored - @param date string or Date - the initial date to display - @param onSelect function - the function to call when a date is selected - @param settings object - update the dialog date picker instance's settings (anonymous object) - @param pos int[2] - coordinates for the dialog's position within the screen or - event - with x/y coordinates or - leave empty for default (screen centre) - @return the manager object */ - _dialogDatepicker: function(input, date, onSelect, settings, pos) { - var inst = this._dialogInst; // internal instance - if (!inst) { - this.uuid += 1; - var id = 'dp' + this.uuid; - this._dialogInput = $(''); - this._dialogInput.keydown(this._doKeyDown); - $('body').append(this._dialogInput); - inst = this._dialogInst = this._newInst(this._dialogInput, false); - inst.settings = {}; - $.data(this._dialogInput[0], PROP_NAME, inst); - } - extendRemove(inst.settings, settings || {}); - date = (date && date.constructor == Date ? this._formatDate(inst, date) : date); - this._dialogInput.val(date); - - this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); - if (!this._pos) { - var browserWidth = document.documentElement.clientWidth; - var browserHeight = document.documentElement.clientHeight; - var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; - var scrollY = document.documentElement.scrollTop || document.body.scrollTop; - this._pos = // should use actual width/height below - [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; - } - - // move input on screen for focus, but hidden behind dialog - this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px'); - inst.settings.onSelect = onSelect; - this._inDialog = true; - this.dpDiv.addClass(this._dialogClass); - this._showDatepicker(this._dialogInput[0]); - if ($.blockUI) - $.blockUI(this.dpDiv); - $.data(this._dialogInput[0], PROP_NAME, inst); - return this; - }, - - /* Detach a datepicker from its control. - @param target element - the target input field or division or span */ - _destroyDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); - if (!$target.hasClass(this.markerClassName)) { - return; - } - var nodeName = target.nodeName.toLowerCase(); - $.removeData(target, PROP_NAME); - if (nodeName == 'input') { - inst.append.remove(); - inst.trigger.remove(); - $target.removeClass(this.markerClassName). - unbind('focus', this._showDatepicker). - unbind('keydown', this._doKeyDown). - unbind('keypress', this._doKeyPress). - unbind('keyup', this._doKeyUp); - } else if (nodeName == 'div' || nodeName == 'span') - $target.removeClass(this.markerClassName).empty(); - }, - - /* Enable the date picker to a jQuery selection. - @param target element - the target input field or division or span */ - _enableDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); - if (!$target.hasClass(this.markerClassName)) { - return; - } - var nodeName = target.nodeName.toLowerCase(); - if (nodeName == 'input') { - target.disabled = false; - inst.trigger.filter('button'). - each(function() { this.disabled = false; }).end(). - filter('img').css({opacity: '1.0', cursor: ''}); - } - else if (nodeName == 'div' || nodeName == 'span') { - var inline = $target.children('.' + this._inlineClass); - inline.children().removeClass('ui-state-disabled'); - inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). - removeAttr("disabled"); - } - this._disabledInputs = $.map(this._disabledInputs, - function(value) { return (value == target ? null : value); }); // delete entry - }, - - /* Disable the date picker to a jQuery selection. - @param target element - the target input field or division or span */ - _disableDatepicker: function(target) { - var $target = $(target); - var inst = $.data(target, PROP_NAME); - if (!$target.hasClass(this.markerClassName)) { - return; - } - var nodeName = target.nodeName.toLowerCase(); - if (nodeName == 'input') { - target.disabled = true; - inst.trigger.filter('button'). - each(function() { this.disabled = true; }).end(). - filter('img').css({opacity: '0.5', cursor: 'default'}); - } - else if (nodeName == 'div' || nodeName == 'span') { - var inline = $target.children('.' + this._inlineClass); - inline.children().addClass('ui-state-disabled'); - inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). - attr("disabled", "disabled"); - } - this._disabledInputs = $.map(this._disabledInputs, - function(value) { return (value == target ? null : value); }); // delete entry - this._disabledInputs[this._disabledInputs.length] = target; - }, - - /* Is the first field in a jQuery collection disabled as a datepicker? - @param target element - the target input field or division or span - @return boolean - true if disabled, false if enabled */ - _isDisabledDatepicker: function(target) { - if (!target) { - return false; - } - for (var i = 0; i < this._disabledInputs.length; i++) { - if (this._disabledInputs[i] == target) - return true; - } - return false; - }, - - /* Retrieve the instance data for the target control. - @param target element - the target input field or division or span - @return object - the associated instance data - @throws error if a jQuery problem getting data */ - _getInst: function(target) { - try { - return $.data(target, PROP_NAME); - } - catch (err) { - throw 'Missing instance data for this datepicker'; - } - }, - - /* Update or retrieve the settings for a date picker attached to an input field or division. - @param target element - the target input field or division or span - @param name object - the new settings to update or - string - the name of the setting to change or retrieve, - when retrieving also 'all' for all instance settings or - 'defaults' for all global defaults - @param value any - the new value for the setting - (omit if above is an object or to retrieve a value) */ - _optionDatepicker: function(target, name, value) { - var inst = this._getInst(target); - if (arguments.length == 2 && typeof name == 'string') { - return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) : - (inst ? (name == 'all' ? $.extend({}, inst.settings) : - this._get(inst, name)) : null)); - } - var settings = name || {}; - if (typeof name == 'string') { - settings = {}; - settings[name] = value; - } - if (inst) { - if (this._curInst == inst) { - this._hideDatepicker(); - } - var date = this._getDateDatepicker(target, true); - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - extendRemove(inst.settings, settings); - // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided - if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined) - inst.settings.minDate = this._formatDate(inst, minDate); - if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined) - inst.settings.maxDate = this._formatDate(inst, maxDate); - this._attachments($(target), inst); - this._autoSize(inst); - this._setDate(inst, date); - this._updateAlternate(inst); - this._updateDatepicker(inst); - } - }, - - // change method deprecated - _changeDatepicker: function(target, name, value) { - this._optionDatepicker(target, name, value); - }, - - /* Redraw the date picker attached to an input field or division. - @param target element - the target input field or division or span */ - _refreshDatepicker: function(target) { - var inst = this._getInst(target); - if (inst) { - this._updateDatepicker(inst); - } - }, - - /* Set the dates for a jQuery selection. - @param target element - the target input field or division or span - @param date Date - the new date */ - _setDateDatepicker: function(target, date) { - var inst = this._getInst(target); - if (inst) { - this._setDate(inst, date); - this._updateDatepicker(inst); - this._updateAlternate(inst); - } - }, - - /* Get the date(s) for the first entry in a jQuery selection. - @param target element - the target input field or division or span - @param noDefault boolean - true if no default date is to be used - @return Date - the current date */ - _getDateDatepicker: function(target, noDefault) { - var inst = this._getInst(target); - if (inst && !inst.inline) - this._setDateFromField(inst, noDefault); - return (inst ? this._getDate(inst) : null); - }, - - /* Handle keystrokes. */ - _doKeyDown: function(event) { - var inst = $.datepicker._getInst(event.target); - var handled = true; - var isRTL = inst.dpDiv.is('.ui-datepicker-rtl'); - inst._keyEvent = true; - if ($.datepicker._datepickerShowing) - switch (event.keyCode) { - case 9: $.datepicker._hideDatepicker(); - handled = false; - break; // hide on tab out - case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' + - $.datepicker._currentClass + ')', inst.dpDiv); - if (sel[0]) - $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); - var onSelect = $.datepicker._get(inst, 'onSelect'); - if (onSelect) { - var dateStr = $.datepicker._formatDate(inst); - - // trigger custom callback - onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); - } - else - $.datepicker._hideDatepicker(); - return false; // don't submit the form - break; // select the value on enter - case 27: $.datepicker._hideDatepicker(); - break; // hide on escape - case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? - -$.datepicker._get(inst, 'stepBigMonths') : - -$.datepicker._get(inst, 'stepMonths')), 'M'); - break; // previous month/year on page up/+ ctrl - case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? - +$.datepicker._get(inst, 'stepBigMonths') : - +$.datepicker._get(inst, 'stepMonths')), 'M'); - break; // next month/year on page down/+ ctrl - case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target); - handled = event.ctrlKey || event.metaKey; - break; // clear on ctrl or command +end - case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target); - handled = event.ctrlKey || event.metaKey; - break; // current on ctrl or command +home - case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D'); - handled = event.ctrlKey || event.metaKey; - // -1 day on ctrl or command +left - if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? - -$.datepicker._get(inst, 'stepBigMonths') : - -$.datepicker._get(inst, 'stepMonths')), 'M'); - // next month/year on alt +left on Mac - break; - case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D'); - handled = event.ctrlKey || event.metaKey; - break; // -1 week on ctrl or command +up - case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D'); - handled = event.ctrlKey || event.metaKey; - // +1 day on ctrl or command +right - if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? - +$.datepicker._get(inst, 'stepBigMonths') : - +$.datepicker._get(inst, 'stepMonths')), 'M'); - // next month/year on alt +right - break; - case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D'); - handled = event.ctrlKey || event.metaKey; - break; // +1 week on ctrl or command +down - default: handled = false; - } - else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home - $.datepicker._showDatepicker(this); - else { - handled = false; - } - if (handled) { - event.preventDefault(); - event.stopPropagation(); - } - }, - - /* Filter entered characters - based on date format. */ - _doKeyPress: function(event) { - var inst = $.datepicker._getInst(event.target); - if ($.datepicker._get(inst, 'constrainInput')) { - var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); - var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); - return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); - } - }, - - /* Synchronise manual entry and field/alternate field. */ - _doKeyUp: function(event) { - var inst = $.datepicker._getInst(event.target); - if (inst.input.val() != inst.lastVal) { - try { - var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), - (inst.input ? inst.input.val() : null), - $.datepicker._getFormatConfig(inst)); - if (date) { // only if valid - $.datepicker._setDateFromField(inst); - $.datepicker._updateAlternate(inst); - $.datepicker._updateDatepicker(inst); - } - } - catch (err) { - $.datepicker.log(err); - } - } - return true; - }, - - /* Pop-up the date picker for a given input field. - If false returned from beforeShow event handler do not show. - @param input element - the input field attached to the date picker or - event - if triggered by focus */ - _showDatepicker: function(input) { - input = input.target || input; - if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger - input = $('input', input.parentNode)[0]; - if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here - return; - var inst = $.datepicker._getInst(input); - if ($.datepicker._curInst && $.datepicker._curInst != inst) { - $.datepicker._curInst.dpDiv.stop(true, true); - if ( inst && $.datepicker._datepickerShowing ) { - $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] ); - } - } - var beforeShow = $.datepicker._get(inst, 'beforeShow'); - var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; - if(beforeShowSettings === false){ - //false - return; - } - extendRemove(inst.settings, beforeShowSettings); - inst.lastVal = null; - $.datepicker._lastInput = input; - $.datepicker._setDateFromField(inst); - if ($.datepicker._inDialog) // hide cursor - input.value = ''; - if (!$.datepicker._pos) { // position below input - $.datepicker._pos = $.datepicker._findPos(input); - $.datepicker._pos[1] += input.offsetHeight; // add the height - } - var isFixed = false; - $(input).parents().each(function() { - isFixed |= $(this).css('position') == 'fixed'; - return !isFixed; - }); - if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled - $.datepicker._pos[0] -= document.documentElement.scrollLeft; - $.datepicker._pos[1] -= document.documentElement.scrollTop; - } - var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; - $.datepicker._pos = null; - //to avoid flashes on Firefox - inst.dpDiv.empty(); - // determine sizing offscreen - inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'}); - $.datepicker._updateDatepicker(inst); - // fix width for dynamic number of date pickers - // and adjust position before showing - offset = $.datepicker._checkOffset(inst, offset, isFixed); - inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? - 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', - left: offset.left + 'px', top: offset.top + 'px'}); - if (!inst.inline) { - var showAnim = $.datepicker._get(inst, 'showAnim'); - var duration = $.datepicker._get(inst, 'duration'); - var postProcess = function() { - var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only - if( !! cover.length ){ - var borders = $.datepicker._getBorders(inst.dpDiv); - cover.css({left: -borders[0], top: -borders[1], - width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}); - } - }; - inst.dpDiv.zIndex($(input).zIndex()+1); - $.datepicker._datepickerShowing = true; - if ($.effects && $.effects[showAnim]) - inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); - else - inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); - if (!showAnim || !duration) - postProcess(); - if (inst.input.is(':visible') && !inst.input.is(':disabled')) - inst.input.focus(); - $.datepicker._curInst = inst; - } - }, - - /* Generate the date picker content. */ - _updateDatepicker: function(inst) { - var self = this; - self.maxRows = 4; //Reset the max number of rows being displayed (see #7043) - var borders = $.datepicker._getBorders(inst.dpDiv); - instActive = inst; // for delegate hover events - inst.dpDiv.empty().append(this._generateHTML(inst)); - this._attachHandlers(inst); - var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only - if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6 - cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) - } - inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover(); - var numMonths = this._getNumberOfMonths(inst); - var cols = numMonths[1]; - var width = 17; - inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width(''); - if (cols > 1) - inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em'); - inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + - 'Class']('ui-datepicker-multi'); - inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + - 'Class']('ui-datepicker-rtl'); - if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input && - // #6694 - don't focus the input if it's already focused - // this breaks the change event in IE - inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement) - inst.input.focus(); - // deffered render of the years select (to avoid flashes on Firefox) - if( inst.yearshtml ){ - var origyearshtml = inst.yearshtml; - setTimeout(function(){ - //assure that inst.yearshtml didn't change. - if( origyearshtml === inst.yearshtml && inst.yearshtml ){ - inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml); - } - origyearshtml = inst.yearshtml = null; - }, 0); - } - }, - - /* Retrieve the size of left and top borders for an element. - @param elem (jQuery object) the element of interest - @return (number[2]) the left and top borders */ - _getBorders: function(elem) { - var convert = function(value) { - return {thin: 1, medium: 2, thick: 3}[value] || value; - }; - return [parseFloat(convert(elem.css('border-left-width'))), - parseFloat(convert(elem.css('border-top-width')))]; - }, - - /* Check positioning to remain on screen. */ - _checkOffset: function(inst, offset, isFixed) { - var dpWidth = inst.dpDiv.outerWidth(); - var dpHeight = inst.dpDiv.outerHeight(); - var inputWidth = inst.input ? inst.input.outerWidth() : 0; - var inputHeight = inst.input ? inst.input.outerHeight() : 0; - var viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()); - var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); - - offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); - offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; - offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; - - // now check if datepicker is showing outside window viewport - move to a better place if so. - offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? - Math.abs(offset.left + dpWidth - viewWidth) : 0); - offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? - Math.abs(dpHeight + inputHeight) : 0); - - return offset; - }, - - /* Find an object's position on the screen. */ - _findPos: function(obj) { - var inst = this._getInst(obj); - var isRTL = this._get(inst, 'isRTL'); - while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) { - obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; - } - var position = $(obj).offset(); - return [position.left, position.top]; - }, - - /* Hide the date picker from view. - @param input element - the input field attached to the date picker */ - _hideDatepicker: function(input) { - var inst = this._curInst; - if (!inst || (input && inst != $.data(input, PROP_NAME))) - return; - if (this._datepickerShowing) { - var showAnim = this._get(inst, 'showAnim'); - var duration = this._get(inst, 'duration'); - var postProcess = function() { - $.datepicker._tidyDialog(inst); - }; - if ($.effects && $.effects[showAnim]) - inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); - else - inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' : - (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess); - if (!showAnim) - postProcess(); - this._datepickerShowing = false; - var onClose = this._get(inst, 'onClose'); - if (onClose) - onClose.apply((inst.input ? inst.input[0] : null), - [(inst.input ? inst.input.val() : ''), inst]); - this._lastInput = null; - if (this._inDialog) { - this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); - if ($.blockUI) { - $.unblockUI(); - $('body').append(this.dpDiv); - } - } - this._inDialog = false; - } - }, - - /* Tidy up after a dialog display. */ - _tidyDialog: function(inst) { - inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar'); - }, - - /* Close date picker if clicked elsewhere. */ - _checkExternalClick: function(event) { - if (!$.datepicker._curInst) - return; - - var $target = $(event.target), - inst = $.datepicker._getInst($target[0]); - - if ( ( ( $target[0].id != $.datepicker._mainDivId && - $target.parents('#' + $.datepicker._mainDivId).length == 0 && - !$target.hasClass($.datepicker.markerClassName) && - !$target.closest("." + $.datepicker._triggerClass).length && - $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) || - ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) ) - $.datepicker._hideDatepicker(); - }, - - /* Adjust one of the date sub-fields. */ - _adjustDate: function(id, offset, period) { - var target = $(id); - var inst = this._getInst(target[0]); - if (this._isDisabledDatepicker(target[0])) { - return; - } - this._adjustInstDate(inst, offset + - (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning - period); - this._updateDatepicker(inst); - }, - - /* Action for current link. */ - _gotoToday: function(id) { - var target = $(id); - var inst = this._getInst(target[0]); - if (this._get(inst, 'gotoCurrent') && inst.currentDay) { - inst.selectedDay = inst.currentDay; - inst.drawMonth = inst.selectedMonth = inst.currentMonth; - inst.drawYear = inst.selectedYear = inst.currentYear; - } - else { - var date = new Date(); - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - } - this._notifyChange(inst); - this._adjustDate(target); - }, - - /* Action for selecting a new month/year. */ - _selectMonthYear: function(id, select, period) { - var target = $(id); - var inst = this._getInst(target[0]); - inst['selected' + (period == 'M' ? 'Month' : 'Year')] = - inst['draw' + (period == 'M' ? 'Month' : 'Year')] = - parseInt(select.options[select.selectedIndex].value,10); - this._notifyChange(inst); - this._adjustDate(target); - }, - - /* Action for selecting a day. */ - _selectDay: function(id, month, year, td) { - var target = $(id); - if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { - return; - } - var inst = this._getInst(target[0]); - inst.selectedDay = inst.currentDay = $('a', td).html(); - inst.selectedMonth = inst.currentMonth = month; - inst.selectedYear = inst.currentYear = year; - this._selectDate(id, this._formatDate(inst, - inst.currentDay, inst.currentMonth, inst.currentYear)); - }, - - /* Erase the input field and hide the date picker. */ - _clearDate: function(id) { - var target = $(id); - var inst = this._getInst(target[0]); - this._selectDate(target, ''); - }, - - /* Update the input field with the selected date. */ - _selectDate: function(id, dateStr) { - var target = $(id); - var inst = this._getInst(target[0]); - dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); - if (inst.input) - inst.input.val(dateStr); - this._updateAlternate(inst); - var onSelect = this._get(inst, 'onSelect'); - if (onSelect) - onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback - else if (inst.input) - inst.input.trigger('change'); // fire the change event - if (inst.inline) - this._updateDatepicker(inst); - else { - this._hideDatepicker(); - this._lastInput = inst.input[0]; - if (typeof(inst.input[0]) != 'object') - inst.input.focus(); // restore focus - this._lastInput = null; - } - }, - - /* Update any alternate field to synchronise with the main field. */ - _updateAlternate: function(inst) { - var altField = this._get(inst, 'altField'); - if (altField) { // update alternate field too - var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat'); - var date = this._getDate(inst); - var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); - $(altField).each(function() { $(this).val(dateStr); }); - } - }, - - /* Set as beforeShowDay function to prevent selection of weekends. - @param date Date - the date to customise - @return [boolean, string] - is this date selectable?, what is its CSS class? */ - noWeekends: function(date) { - var day = date.getDay(); - return [(day > 0 && day < 6), '']; - }, - - /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. - @param date Date - the date to get the week for - @return number - the number of the week within the year that contains this date */ - iso8601Week: function(date) { - var checkDate = new Date(date.getTime()); - // Find Thursday of this week starting on Monday - checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); - var time = checkDate.getTime(); - checkDate.setMonth(0); // Compare with Jan 1 - checkDate.setDate(1); - return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; - }, - - /* Parse a string value into a date object. - See formatDate below for the possible formats. - - @param format string - the expected format of the date - @param value string - the date in the above format - @param settings Object - attributes include: - shortYearCutoff number - the cutoff year for determining the century (optional) - dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) - dayNames string[7] - names of the days from Sunday (optional) - monthNamesShort string[12] - abbreviated names of the months (optional) - monthNames string[12] - names of the months (optional) - @return Date - the extracted date value or null if value is blank */ - parseDate: function (format, value, settings) { - if (format == null || value == null) - throw 'Invalid arguments'; - value = (typeof value == 'object' ? value.toString() : value + ''); - if (value == '') - return null; - var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; - shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : - new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); - var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; - var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; - var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; - var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; - var year = -1; - var month = -1; - var day = -1; - var doy = -1; - var literal = false; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - // Extract a number from the string value - var getNumber = function(match) { - var isDoubled = lookAhead(match); - var size = (match == '@' ? 14 : (match == '!' ? 20 : - (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2)))); - var digits = new RegExp('^\\d{1,' + size + '}'); - var num = value.substring(iValue).match(digits); - if (!num) - throw 'Missing number at position ' + iValue; - iValue += num[0].length; - return parseInt(num[0], 10); - }; - // Extract a name from the string value and convert to an index - var getName = function(match, shortNames, longNames) { - var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { - return [ [k, v] ]; - }).sort(function (a, b) { - return -(a[1].length - b[1].length); - }); - var index = -1; - $.each(names, function (i, pair) { - var name = pair[1]; - if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) { - index = pair[0]; - iValue += name.length; - return false; - } - }); - if (index != -1) - return index + 1; - else - throw 'Unknown name at position ' + iValue; - }; - // Confirm that a literal character matches the string value - var checkLiteral = function() { - if (value.charAt(iValue) != format.charAt(iFormat)) - throw 'Unexpected literal at position ' + iValue; - iValue++; - }; - var iValue = 0; - for (var iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) - literal = false; - else - checkLiteral(); - else - switch (format.charAt(iFormat)) { - case 'd': - day = getNumber('d'); - break; - case 'D': - getName('D', dayNamesShort, dayNames); - break; - case 'o': - doy = getNumber('o'); - break; - case 'm': - month = getNumber('m'); - break; - case 'M': - month = getName('M', monthNamesShort, monthNames); - break; - case 'y': - year = getNumber('y'); - break; - case '@': - var date = new Date(getNumber('@')); - year = date.getFullYear(); - month = date.getMonth() + 1; - day = date.getDate(); - break; - case '!': - var date = new Date((getNumber('!') - this._ticksTo1970) / 10000); - year = date.getFullYear(); - month = date.getMonth() + 1; - day = date.getDate(); - break; - case "'": - if (lookAhead("'")) - checkLiteral(); - else - literal = true; - break; - default: - checkLiteral(); - } - } - if (iValue < value.length){ - throw "Extra/unparsed characters found in date: " + value.substring(iValue); - } - if (year == -1) - year = new Date().getFullYear(); - else if (year < 100) - year += new Date().getFullYear() - new Date().getFullYear() % 100 + - (year <= shortYearCutoff ? 0 : -100); - if (doy > -1) { - month = 1; - day = doy; - do { - var dim = this._getDaysInMonth(year, month - 1); - if (day <= dim) - break; - month++; - day -= dim; - } while (true); - } - var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); - if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) - throw 'Invalid date'; // E.g. 31/02/00 - return date; - }, - - /* Standard date formats. */ - ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601) - COOKIE: 'D, dd M yy', - ISO_8601: 'yy-mm-dd', - RFC_822: 'D, d M y', - RFC_850: 'DD, dd-M-y', - RFC_1036: 'D, d M y', - RFC_1123: 'D, d M yy', - RFC_2822: 'D, d M yy', - RSS: 'D, d M y', // RFC 822 - TICKS: '!', - TIMESTAMP: '@', - W3C: 'yy-mm-dd', // ISO 8601 - - _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + - Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), - - /* Format a date object into a string value. - The format can be combinations of the following: - d - day of month (no leading zero) - dd - day of month (two digit) - o - day of year (no leading zeros) - oo - day of year (three digit) - D - day name short - DD - day name long - m - month of year (no leading zero) - mm - month of year (two digit) - M - month name short - MM - month name long - y - year (two digit) - yy - year (four digit) - @ - Unix timestamp (ms since 01/01/1970) - ! - Windows ticks (100ns since 01/01/0001) - '...' - literal text - '' - single quote - - @param format string - the desired format of the date - @param date Date - the date value to format - @param settings Object - attributes include: - dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) - dayNames string[7] - names of the days from Sunday (optional) - monthNamesShort string[12] - abbreviated names of the months (optional) - monthNames string[12] - names of the months (optional) - @return string - the date in the above format */ - formatDate: function (format, date, settings) { - if (!date) - return ''; - var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; - var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; - var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; - var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - // Format a number, with leading zero if necessary - var formatNumber = function(match, value, len) { - var num = '' + value; - if (lookAhead(match)) - while (num.length < len) - num = '0' + num; - return num; - }; - // Format a name, short or long as requested - var formatName = function(match, value, shortNames, longNames) { - return (lookAhead(match) ? longNames[value] : shortNames[value]); - }; - var output = ''; - var literal = false; - if (date) - for (var iFormat = 0; iFormat < format.length; iFormat++) { - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) - literal = false; - else - output += format.charAt(iFormat); - else - switch (format.charAt(iFormat)) { - case 'd': - output += formatNumber('d', date.getDate(), 2); - break; - case 'D': - output += formatName('D', date.getDay(), dayNamesShort, dayNames); - break; - case 'o': - output += formatNumber('o', - Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); - break; - case 'm': - output += formatNumber('m', date.getMonth() + 1, 2); - break; - case 'M': - output += formatName('M', date.getMonth(), monthNamesShort, monthNames); - break; - case 'y': - output += (lookAhead('y') ? date.getFullYear() : - (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); - break; - case '@': - output += date.getTime(); - break; - case '!': - output += date.getTime() * 10000 + this._ticksTo1970; - break; - case "'": - if (lookAhead("'")) - output += "'"; - else - literal = true; - break; - default: - output += format.charAt(iFormat); - } - } - return output; - }, - - /* Extract all possible characters from the date format. */ - _possibleChars: function (format) { - var chars = ''; - var literal = false; - // Check whether a format character is doubled - var lookAhead = function(match) { - var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); - if (matches) - iFormat++; - return matches; - }; - for (var iFormat = 0; iFormat < format.length; iFormat++) - if (literal) - if (format.charAt(iFormat) == "'" && !lookAhead("'")) - literal = false; - else - chars += format.charAt(iFormat); - else - switch (format.charAt(iFormat)) { - case 'd': case 'm': case 'y': case '@': - chars += '0123456789'; - break; - case 'D': case 'M': - return null; // Accept anything - case "'": - if (lookAhead("'")) - chars += "'"; - else - literal = true; - break; - default: - chars += format.charAt(iFormat); - } - return chars; - }, - - /* Get a setting value, defaulting if necessary. */ - _get: function(inst, name) { - return inst.settings[name] !== undefined ? - inst.settings[name] : this._defaults[name]; - }, - - /* Parse existing date and initialise date picker. */ - _setDateFromField: function(inst, noDefault) { - if (inst.input.val() == inst.lastVal) { - return; - } - var dateFormat = this._get(inst, 'dateFormat'); - var dates = inst.lastVal = inst.input ? inst.input.val() : null; - var date, defaultDate; - date = defaultDate = this._getDefaultDate(inst); - var settings = this._getFormatConfig(inst); - try { - date = this.parseDate(dateFormat, dates, settings) || defaultDate; - } catch (event) { - this.log(event); - dates = (noDefault ? '' : dates); - } - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - inst.currentDay = (dates ? date.getDate() : 0); - inst.currentMonth = (dates ? date.getMonth() : 0); - inst.currentYear = (dates ? date.getFullYear() : 0); - this._adjustInstDate(inst); - }, - - /* Retrieve the default date shown on opening. */ - _getDefaultDate: function(inst) { - return this._restrictMinMax(inst, - this._determineDate(inst, this._get(inst, 'defaultDate'), new Date())); - }, - - /* A date may be specified as an exact value or a relative one. */ - _determineDate: function(inst, date, defaultDate) { - var offsetNumeric = function(offset) { - var date = new Date(); - date.setDate(date.getDate() + offset); - return date; - }; - var offsetString = function(offset) { - try { - return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), - offset, $.datepicker._getFormatConfig(inst)); - } - catch (e) { - // Ignore - } - var date = (offset.toLowerCase().match(/^c/) ? - $.datepicker._getDate(inst) : null) || new Date(); - var year = date.getFullYear(); - var month = date.getMonth(); - var day = date.getDate(); - var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; - var matches = pattern.exec(offset); - while (matches) { - switch (matches[2] || 'd') { - case 'd' : case 'D' : - day += parseInt(matches[1],10); break; - case 'w' : case 'W' : - day += parseInt(matches[1],10) * 7; break; - case 'm' : case 'M' : - month += parseInt(matches[1],10); - day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); - break; - case 'y': case 'Y' : - year += parseInt(matches[1],10); - day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); - break; - } - matches = pattern.exec(offset); - } - return new Date(year, month, day); - }; - var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) : - (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); - newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate); - if (newDate) { - newDate.setHours(0); - newDate.setMinutes(0); - newDate.setSeconds(0); - newDate.setMilliseconds(0); - } - return this._daylightSavingAdjust(newDate); - }, - - /* Handle switch to/from daylight saving. - Hours may be non-zero on daylight saving cut-over: - > 12 when midnight changeover, but then cannot generate - midnight datetime, so jump to 1AM, otherwise reset. - @param date (Date) the date to check - @return (Date) the corrected date */ - _daylightSavingAdjust: function(date) { - if (!date) return null; - date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); - return date; - }, - - /* Set the date(s) directly. */ - _setDate: function(inst, date, noChange) { - var clear = !date; - var origMonth = inst.selectedMonth; - var origYear = inst.selectedYear; - var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); - inst.selectedDay = inst.currentDay = newDate.getDate(); - inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); - inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); - if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange) - this._notifyChange(inst); - this._adjustInstDate(inst); - if (inst.input) { - inst.input.val(clear ? '' : this._formatDate(inst)); - } - }, - - /* Retrieve the date(s) directly. */ - _getDate: function(inst) { - var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : - this._daylightSavingAdjust(new Date( - inst.currentYear, inst.currentMonth, inst.currentDay))); - return startDate; - }, - - /* Attach the onxxx handlers. These are declared statically so - * they work with static code transformers like Caja. - */ - _attachHandlers: function(inst) { - var stepMonths = this._get(inst, 'stepMonths'); - var id = '#' + inst.id.replace( /\\\\/g, "\\" ); - inst.dpDiv.find('[data-handler]').map(function () { - var handler = { - prev: function () { - window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M'); - }, - next: function () { - window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M'); - }, - hide: function () { - window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker(); - }, - today: function () { - window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id); - }, - selectDay: function () { - window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this); - return false; - }, - selectMonth: function () { - window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M'); - return false; - }, - selectYear: function () { - window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y'); - return false; - } - }; - $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]); - }); - }, - - /* Generate the HTML for the current state of the date picker. */ - _generateHTML: function(inst) { - var today = new Date(); - today = this._daylightSavingAdjust( - new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time - var isRTL = this._get(inst, 'isRTL'); - var showButtonPanel = this._get(inst, 'showButtonPanel'); - var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); - var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); - var numMonths = this._getNumberOfMonths(inst); - var showCurrentAtPos = this._get(inst, 'showCurrentAtPos'); - var stepMonths = this._get(inst, 'stepMonths'); - var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); - var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : - new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - var drawMonth = inst.drawMonth - showCurrentAtPos; - var drawYear = inst.drawYear; - if (drawMonth < 0) { - drawMonth += 12; - drawYear--; - } - if (maxDate) { - var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), - maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); - maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); - while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { - drawMonth--; - if (drawMonth < 0) { - drawMonth = 11; - drawYear--; - } - } - } - inst.drawMonth = drawMonth; - inst.drawYear = drawYear; - var prevText = this._get(inst, 'prevText'); - prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, - this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), - this._getFormatConfig(inst))); - var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? - '' + prevText + '' : - (hideIfNoPrevNext ? '' : '' + prevText + '')); - var nextText = this._get(inst, 'nextText'); - nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, - this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), - this._getFormatConfig(inst))); - var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? - '' + nextText + '' : - (hideIfNoPrevNext ? '' : '' + nextText + '')); - var currentText = this._get(inst, 'currentText'); - var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); - currentText = (!navigationAsDateFormat ? currentText : - this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); - var controls = (!inst.inline ? '' : ''); - var buttonPanel = (showButtonPanel) ? '
        ' + (isRTL ? controls : '') + - (this._isInRange(inst, gotoDate) ? '' : '') + (isRTL ? '' : controls) + '
        ' : ''; - var firstDay = parseInt(this._get(inst, 'firstDay'),10); - firstDay = (isNaN(firstDay) ? 0 : firstDay); - var showWeek = this._get(inst, 'showWeek'); - var dayNames = this._get(inst, 'dayNames'); - var dayNamesShort = this._get(inst, 'dayNamesShort'); - var dayNamesMin = this._get(inst, 'dayNamesMin'); - var monthNames = this._get(inst, 'monthNames'); - var monthNamesShort = this._get(inst, 'monthNamesShort'); - var beforeShowDay = this._get(inst, 'beforeShowDay'); - var showOtherMonths = this._get(inst, 'showOtherMonths'); - var selectOtherMonths = this._get(inst, 'selectOtherMonths'); - var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; - var defaultDate = this._getDefaultDate(inst); - var html = ''; - for (var row = 0; row < numMonths[0]; row++) { - var group = ''; - this.maxRows = 4; - for (var col = 0; col < numMonths[1]; col++) { - var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); - var cornerClass = ' ui-corner-all'; - var calender = ''; - if (isMultiMonth) { - calender += '
        '; - } - calender += '
        ' + - (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') + - (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') + - this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, - row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers - '
        ' + - ''; - var thead = (showWeek ? '' : ''); - for (var dow = 0; dow < 7; dow++) { // days of the week - var day = (dow + firstDay) % 7; - thead += '= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' + - '' + dayNamesMin[day] + ''; - } - calender += thead + ''; - var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); - if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) - inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); - var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; - var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate - var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) - this.maxRows = numRows; - var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); - for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows - calender += ''; - var tbody = (!showWeek ? '' : ''); - for (var dow = 0; dow < 7; dow++) { // create date picker days - var daySettings = (beforeShowDay ? - beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); - var otherMonth = (printDate.getMonth() != drawMonth); - var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || - (minDate && printDate < minDate) || (maxDate && printDate > maxDate); - tbody += ''; // display selectable date - printDate.setDate(printDate.getDate() + 1); - printDate = this._daylightSavingAdjust(printDate); - } - calender += tbody + ''; - } - drawMonth++; - if (drawMonth > 11) { - drawMonth = 0; - drawYear++; - } - calender += '
        ' + this._get(inst, 'weekHeader') + '
        ' + - this._get(inst, 'calculateWeek')(printDate) + '' + // actions - (otherMonth && !showOtherMonths ? ' ' : // display for other months - (unselectable ? '' + printDate.getDate() + '' : '' + printDate.getDate() + '')) + '
        ' + (isMultiMonth ? '' + - ((numMonths[0] > 0 && col == numMonths[1]-1) ? '
        ' : '') : ''); - group += calender; - } - html += group; - } - html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ? - '' : ''); - inst._keyEvent = false; - return html; - }, - - /* Generate the month and year header. */ - _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, - secondary, monthNames, monthNamesShort) { - var changeMonth = this._get(inst, 'changeMonth'); - var changeYear = this._get(inst, 'changeYear'); - var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); - var html = '
        '; - var monthHtml = ''; - // month selection - if (secondary || !changeMonth) - monthHtml += '' + monthNames[drawMonth] + ''; - else { - var inMinYear = (minDate && minDate.getFullYear() == drawYear); - var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); - monthHtml += ''; - } - if (!showMonthAfterYear) - html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : ''); - // year selection - if ( !inst.yearshtml ) { - inst.yearshtml = ''; - if (secondary || !changeYear) - html += '' + drawYear + ''; - else { - // determine range of years to display - var years = this._get(inst, 'yearRange').split(':'); - var thisYear = new Date().getFullYear(); - var determineYear = function(value) { - var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : - (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : - parseInt(value, 10))); - return (isNaN(year) ? thisYear : year); - }; - var year = determineYear(years[0]); - var endYear = Math.max(year, determineYear(years[1] || '')); - year = (minDate ? Math.max(year, minDate.getFullYear()) : year); - endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); - inst.yearshtml += ''; - - html += inst.yearshtml; - inst.yearshtml = null; - } - } - html += this._get(inst, 'yearSuffix'); - if (showMonthAfterYear) - html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml; - html += '
        '; // Close datepicker_header - return html; - }, - - /* Adjust one of the date sub-fields. */ - _adjustInstDate: function(inst, offset, period) { - var year = inst.drawYear + (period == 'Y' ? offset : 0); - var month = inst.drawMonth + (period == 'M' ? offset : 0); - var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + - (period == 'D' ? offset : 0); - var date = this._restrictMinMax(inst, - this._daylightSavingAdjust(new Date(year, month, day))); - inst.selectedDay = date.getDate(); - inst.drawMonth = inst.selectedMonth = date.getMonth(); - inst.drawYear = inst.selectedYear = date.getFullYear(); - if (period == 'M' || period == 'Y') - this._notifyChange(inst); - }, - - /* Ensure a date is within any min/max bounds. */ - _restrictMinMax: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - var newDate = (minDate && date < minDate ? minDate : date); - newDate = (maxDate && newDate > maxDate ? maxDate : newDate); - return newDate; - }, - - /* Notify change of month/year. */ - _notifyChange: function(inst) { - var onChange = this._get(inst, 'onChangeMonthYear'); - if (onChange) - onChange.apply((inst.input ? inst.input[0] : null), - [inst.selectedYear, inst.selectedMonth + 1, inst]); - }, - - /* Determine the number of months to show. */ - _getNumberOfMonths: function(inst) { - var numMonths = this._get(inst, 'numberOfMonths'); - return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); - }, - - /* Determine the current maximum date - ensure no time components are set. */ - _getMinMaxDate: function(inst, minMax) { - return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); - }, - - /* Find the number of days in a given month. */ - _getDaysInMonth: function(year, month) { - return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); - }, - - /* Find the day of the week of the first of a month. */ - _getFirstDayOfMonth: function(year, month) { - return new Date(year, month, 1).getDay(); - }, - - /* Determines if we should allow a "next/prev" month display change. */ - _canAdjustMonth: function(inst, offset, curYear, curMonth) { - var numMonths = this._getNumberOfMonths(inst); - var date = this._daylightSavingAdjust(new Date(curYear, - curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); - if (offset < 0) - date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); - return this._isInRange(inst, date); - }, - - /* Is the given date in the accepted range? */ - _isInRange: function(inst, date) { - var minDate = this._getMinMaxDate(inst, 'min'); - var maxDate = this._getMinMaxDate(inst, 'max'); - return ((!minDate || date.getTime() >= minDate.getTime()) && - (!maxDate || date.getTime() <= maxDate.getTime())); - }, - - /* Provide the configuration settings for formatting/parsing. */ - _getFormatConfig: function(inst) { - var shortYearCutoff = this._get(inst, 'shortYearCutoff'); - shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : - new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); - return {shortYearCutoff: shortYearCutoff, - dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), - monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')}; - }, - - /* Format the given date for display. */ - _formatDate: function(inst, day, month, year) { - if (!day) { - inst.currentDay = inst.selectedDay; - inst.currentMonth = inst.selectedMonth; - inst.currentYear = inst.selectedYear; - } - var date = (day ? (typeof day == 'object' ? day : - this._daylightSavingAdjust(new Date(year, month, day))) : - this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); - return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); - } -}); - -/* - * Bind hover events for datepicker elements. - * Done via delegate so the binding only occurs once in the lifetime of the parent div. - * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. - */ -function bindHover(dpDiv) { - var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a'; - return dpDiv.bind('mouseout', function(event) { - var elem = $( event.target ).closest( selector ); - if ( !elem.length ) { - return; - } - elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover" ); - }) - .bind('mouseover', function(event) { - var elem = $( event.target ).closest( selector ); - if ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) || - !elem.length ) { - return; - } - elem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); - elem.addClass('ui-state-hover'); - if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover'); - if (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover'); - }); -} - -/* jQuery extend now ignores nulls! */ -function extendRemove(target, props) { - $.extend(target, props); - for (var name in props) - if (props[name] == null || props[name] == undefined) - target[name] = props[name]; - return target; -}; - -/* Determine whether an object is an array. */ -function isArray(a) { - return (a && (($.browser.safari && typeof a == 'object' && a.length) || - (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); -}; - -/* Invoke the datepicker functionality. - @param options string - a command, optionally followed by additional parameters or - Object - settings for attaching new datepicker functionality - @return jQuery object */ -$.fn.datepicker = function(options){ - - /* Verify an empty collection wasn't passed - Fixes #6976 */ - if ( !this.length ) { - return this; - } - - /* Initialise the date picker. */ - if (!$.datepicker.initialized) { - $(document).mousedown($.datepicker._checkExternalClick). - find('body').append($.datepicker.dpDiv); - $.datepicker.initialized = true; - } - - var otherArgs = Array.prototype.slice.call(arguments, 1); - if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) - return $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this[0]].concat(otherArgs)); - if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') - return $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this[0]].concat(otherArgs)); - return this.each(function() { - typeof options == 'string' ? - $.datepicker['_' + options + 'Datepicker']. - apply($.datepicker, [this].concat(otherArgs)) : - $.datepicker._attachDatepicker(this, options); - }); -}; - -$.datepicker = new Datepicker(); // singleton instance -$.datepicker.initialized = false; -$.datepicker.uuid = new Date().getTime(); -$.datepicker.version = "1.8.23"; - -// Workaround for #4055 -// Add another global to avoid noConflict issues with inline event handlers -window['DP_jQuery_' + dpuuid] = $; - -})(jQuery); - -(function( $, undefined ) { - -var uiDialogClasses = - 'ui-dialog ' + - 'ui-widget ' + - 'ui-widget-content ' + - 'ui-corner-all ', - sizeRelatedOptions = { - buttons: true, - height: true, - maxHeight: true, - maxWidth: true, - minHeight: true, - minWidth: true, - width: true - }, - resizableRelatedOptions = { - maxHeight: true, - maxWidth: true, - minHeight: true, - minWidth: true - }; - -$.widget("ui.dialog", { - options: { - autoOpen: true, - buttons: {}, - closeOnEscape: true, - closeText: 'close', - dialogClass: '', - draggable: true, - hide: null, - height: 'auto', - maxHeight: false, - maxWidth: false, - minHeight: 150, - minWidth: 150, - modal: false, - position: { - my: 'center', - at: 'center', - collision: 'fit', - // ensure that the titlebar is never outside the document - using: function(pos) { - var topOffset = $(this).css(pos).offset().top; - if (topOffset < 0) { - $(this).css('top', pos.top - topOffset); - } - } - }, - resizable: true, - show: null, - stack: true, - title: '', - width: 300, - zIndex: 1000 - }, - - _create: function() { - this.originalTitle = this.element.attr('title'); - // #5742 - .attr() might return a DOMElement - if ( typeof this.originalTitle !== "string" ) { - this.originalTitle = ""; - } - - this.options.title = this.options.title || this.originalTitle; - var self = this, - options = self.options, - - title = options.title || ' ', - titleId = $.ui.dialog.getTitleId(self.element), - - uiDialog = (self.uiDialog = $('
        ')) - .appendTo(document.body) - .hide() - .addClass(uiDialogClasses + options.dialogClass) - .css({ - zIndex: options.zIndex - }) - // setting tabIndex makes the div focusable - // setting outline to 0 prevents a border on focus in Mozilla - .attr('tabIndex', -1).css('outline', 0).keydown(function(event) { - if (options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && - event.keyCode === $.ui.keyCode.ESCAPE) { - - self.close(event); - event.preventDefault(); - } - }) - .attr({ - role: 'dialog', - 'aria-labelledby': titleId - }) - .mousedown(function(event) { - self.moveToTop(false, event); - }), - - uiDialogContent = self.element - .show() - .removeAttr('title') - .addClass( - 'ui-dialog-content ' + - 'ui-widget-content') - .appendTo(uiDialog), - - uiDialogTitlebar = (self.uiDialogTitlebar = $('
        ')) - .addClass( - 'ui-dialog-titlebar ' + - 'ui-widget-header ' + - 'ui-corner-all ' + - 'ui-helper-clearfix' - ) - .prependTo(uiDialog), - - uiDialogTitlebarClose = $('') - .addClass( - 'ui-dialog-titlebar-close ' + - 'ui-corner-all' - ) - .attr('role', 'button') - .hover( - function() { - uiDialogTitlebarClose.addClass('ui-state-hover'); - }, - function() { - uiDialogTitlebarClose.removeClass('ui-state-hover'); - } - ) - .focus(function() { - uiDialogTitlebarClose.addClass('ui-state-focus'); - }) - .blur(function() { - uiDialogTitlebarClose.removeClass('ui-state-focus'); - }) - .click(function(event) { - self.close(event); - return false; - }) - .appendTo(uiDialogTitlebar), - - uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('')) - .addClass( - 'ui-icon ' + - 'ui-icon-closethick' - ) - .text(options.closeText) - .appendTo(uiDialogTitlebarClose), - - uiDialogTitle = $('') - .addClass('ui-dialog-title') - .attr('id', titleId) - .html(title) - .prependTo(uiDialogTitlebar); - - //handling of deprecated beforeclose (vs beforeClose) option - //Ticket #4669 http://dev.jqueryui.com/ticket/4669 - //TODO: remove in 1.9pre - if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) { - options.beforeClose = options.beforeclose; - } - - uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); - - if (options.draggable && $.fn.draggable) { - self._makeDraggable(); - } - if (options.resizable && $.fn.resizable) { - self._makeResizable(); - } - - self._createButtons(options.buttons); - self._isOpen = false; - - if ($.fn.bgiframe) { - uiDialog.bgiframe(); - } - }, - - _init: function() { - if ( this.options.autoOpen ) { - this.open(); - } - }, - - destroy: function() { - var self = this; - - if (self.overlay) { - self.overlay.destroy(); - } - self.uiDialog.hide(); - self.element - .unbind('.dialog') - .removeData('dialog') - .removeClass('ui-dialog-content ui-widget-content') - .hide().appendTo('body'); - self.uiDialog.remove(); - - if (self.originalTitle) { - self.element.attr('title', self.originalTitle); - } - - return self; - }, - - widget: function() { - return this.uiDialog; - }, - - close: function(event) { - var self = this, - maxZ, thisZ; - - if (false === self._trigger('beforeClose', event)) { - return; - } - - if (self.overlay) { - self.overlay.destroy(); - } - self.uiDialog.unbind('keypress.ui-dialog'); - - self._isOpen = false; - - if (self.options.hide) { - self.uiDialog.hide(self.options.hide, function() { - self._trigger('close', event); - }); - } else { - self.uiDialog.hide(); - self._trigger('close', event); - } - - $.ui.dialog.overlay.resize(); - - // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) - if (self.options.modal) { - maxZ = 0; - $('.ui-dialog').each(function() { - if (this !== self.uiDialog[0]) { - thisZ = $(this).css('z-index'); - if(!isNaN(thisZ)) { - maxZ = Math.max(maxZ, thisZ); - } - } - }); - $.ui.dialog.maxZ = maxZ; - } - - return self; - }, - - isOpen: function() { - return this._isOpen; - }, - - // the force parameter allows us to move modal dialogs to their correct - // position on open - moveToTop: function(force, event) { - var self = this, - options = self.options, - saveScroll; - - if ((options.modal && !force) || - (!options.stack && !options.modal)) { - return self._trigger('focus', event); - } - - if (options.zIndex > $.ui.dialog.maxZ) { - $.ui.dialog.maxZ = options.zIndex; - } - if (self.overlay) { - $.ui.dialog.maxZ += 1; - self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ); - } - - //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. - // http://ui.jquery.com/bugs/ticket/3193 - saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() }; - $.ui.dialog.maxZ += 1; - self.uiDialog.css('z-index', $.ui.dialog.maxZ); - self.element.attr(saveScroll); - self._trigger('focus', event); - - return self; - }, - - open: function() { - if (this._isOpen) { return; } - - var self = this, - options = self.options, - uiDialog = self.uiDialog; - - self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null; - self._size(); - self._position(options.position); - uiDialog.show(options.show); - self.moveToTop(true); - - // prevent tabbing out of modal dialogs - if ( options.modal ) { - uiDialog.bind( "keydown.ui-dialog", function( event ) { - if ( event.keyCode !== $.ui.keyCode.TAB ) { - return; - } - - var tabbables = $(':tabbable', this), - first = tabbables.filter(':first'), - last = tabbables.filter(':last'); - - if (event.target === last[0] && !event.shiftKey) { - first.focus(1); - return false; - } else if (event.target === first[0] && event.shiftKey) { - last.focus(1); - return false; - } - }); - } - - // set focus to the first tabbable element in the content area or the first button - // if there are no tabbable elements, set focus on the dialog itself - $(self.element.find(':tabbable').get().concat( - uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat( - uiDialog.get()))).eq(0).focus(); - - self._isOpen = true; - self._trigger('open'); - - return self; - }, - - _createButtons: function(buttons) { - var self = this, - hasButtons = false, - uiDialogButtonPane = $('
        ') - .addClass( - 'ui-dialog-buttonpane ' + - 'ui-widget-content ' + - 'ui-helper-clearfix' - ), - uiButtonSet = $( "
        " ) - .addClass( "ui-dialog-buttonset" ) - .appendTo( uiDialogButtonPane ); - - // if we already have a button pane, remove it - self.uiDialog.find('.ui-dialog-buttonpane').remove(); - - if (typeof buttons === 'object' && buttons !== null) { - $.each(buttons, function() { - return !(hasButtons = true); - }); - } - if (hasButtons) { - $.each(buttons, function(name, props) { - props = $.isFunction( props ) ? - { click: props, text: name } : - props; - var button = $('') - .click(function() { - props.click.apply(self.element[0], arguments); - }) - .appendTo(uiButtonSet); - // can't use .attr( props, true ) with jQuery 1.3.2. - $.each( props, function( key, value ) { - if ( key === "click" ) { - return; - } - if ( key in button ) { - button[ key ]( value ); - } else { - button.attr( key, value ); - } - }); - if ($.fn.button) { - button.button(); - } - }); - uiDialogButtonPane.appendTo(self.uiDialog); - } - }, - - _makeDraggable: function() { - var self = this, - options = self.options, - doc = $(document), - heightBeforeDrag; - - function filteredUi(ui) { - return { - position: ui.position, - offset: ui.offset - }; - } - - self.uiDialog.draggable({ - cancel: '.ui-dialog-content, .ui-dialog-titlebar-close', - handle: '.ui-dialog-titlebar', - containment: 'document', - start: function(event, ui) { - heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height(); - $(this).height($(this).height()).addClass("ui-dialog-dragging"); - self._trigger('dragStart', event, filteredUi(ui)); - }, - drag: function(event, ui) { - self._trigger('drag', event, filteredUi(ui)); - }, - stop: function(event, ui) { - options.position = [ui.position.left - doc.scrollLeft(), - ui.position.top - doc.scrollTop()]; - $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); - self._trigger('dragStop', event, filteredUi(ui)); - $.ui.dialog.overlay.resize(); - } - }); - }, - - _makeResizable: function(handles) { - handles = (handles === undefined ? this.options.resizable : handles); - var self = this, - options = self.options, - // .ui-resizable has position: relative defined in the stylesheet - // but dialogs have to use absolute or fixed positioning - position = self.uiDialog.css('position'), - resizeHandles = (typeof handles === 'string' ? - handles : - 'n,e,s,w,se,sw,ne,nw' - ); - - function filteredUi(ui) { - return { - originalPosition: ui.originalPosition, - originalSize: ui.originalSize, - position: ui.position, - size: ui.size - }; - } - - self.uiDialog.resizable({ - cancel: '.ui-dialog-content', - containment: 'document', - alsoResize: self.element, - maxWidth: options.maxWidth, - maxHeight: options.maxHeight, - minWidth: options.minWidth, - minHeight: self._minHeight(), - handles: resizeHandles, - start: function(event, ui) { - $(this).addClass("ui-dialog-resizing"); - self._trigger('resizeStart', event, filteredUi(ui)); - }, - resize: function(event, ui) { - self._trigger('resize', event, filteredUi(ui)); - }, - stop: function(event, ui) { - $(this).removeClass("ui-dialog-resizing"); - options.height = $(this).height(); - options.width = $(this).width(); - self._trigger('resizeStop', event, filteredUi(ui)); - $.ui.dialog.overlay.resize(); - } - }) - .css('position', position) - .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); - }, - - _minHeight: function() { - var options = this.options; - - if (options.height === 'auto') { - return options.minHeight; - } else { - return Math.min(options.minHeight, options.height); - } - }, - - _position: function(position) { - var myAt = [], - offset = [0, 0], - isVisible; - - if (position) { - // deep extending converts arrays to objects in jQuery <= 1.3.2 :-( - // if (typeof position == 'string' || $.isArray(position)) { - // myAt = $.isArray(position) ? position : position.split(' '); - - if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) { - myAt = position.split ? position.split(' ') : [position[0], position[1]]; - if (myAt.length === 1) { - myAt[1] = myAt[0]; - } - - $.each(['left', 'top'], function(i, offsetPosition) { - if (+myAt[i] === myAt[i]) { - offset[i] = myAt[i]; - myAt[i] = offsetPosition; - } - }); - - position = { - my: myAt.join(" "), - at: myAt.join(" "), - offset: offset.join(" ") - }; - } - - position = $.extend({}, $.ui.dialog.prototype.options.position, position); - } else { - position = $.ui.dialog.prototype.options.position; - } - - // need to show the dialog to get the actual offset in the position plugin - isVisible = this.uiDialog.is(':visible'); - if (!isVisible) { - this.uiDialog.show(); - } - this.uiDialog - // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781 - .css({ top: 0, left: 0 }) - .position($.extend({ of: window }, position)); - if (!isVisible) { - this.uiDialog.hide(); - } - }, - - _setOptions: function( options ) { - var self = this, - resizableOptions = {}, - resize = false; - - $.each( options, function( key, value ) { - self._setOption( key, value ); - - if ( key in sizeRelatedOptions ) { - resize = true; - } - if ( key in resizableRelatedOptions ) { - resizableOptions[ key ] = value; - } - }); - - if ( resize ) { - this._size(); - } - if ( this.uiDialog.is( ":data(resizable)" ) ) { - this.uiDialog.resizable( "option", resizableOptions ); - } - }, - - _setOption: function(key, value){ - var self = this, - uiDialog = self.uiDialog; - - switch (key) { - //handling of deprecated beforeclose (vs beforeClose) option - //Ticket #4669 http://dev.jqueryui.com/ticket/4669 - //TODO: remove in 1.9pre - case "beforeclose": - key = "beforeClose"; - break; - case "buttons": - self._createButtons(value); - break; - case "closeText": - // ensure that we always pass a string - self.uiDialogTitlebarCloseText.text("" + value); - break; - case "dialogClass": - uiDialog - .removeClass(self.options.dialogClass) - .addClass(uiDialogClasses + value); - break; - case "disabled": - if (value) { - uiDialog.addClass('ui-dialog-disabled'); - } else { - uiDialog.removeClass('ui-dialog-disabled'); - } - break; - case "draggable": - var isDraggable = uiDialog.is( ":data(draggable)" ); - if ( isDraggable && !value ) { - uiDialog.draggable( "destroy" ); - } - - if ( !isDraggable && value ) { - self._makeDraggable(); - } - break; - case "position": - self._position(value); - break; - case "resizable": - // currently resizable, becoming non-resizable - var isResizable = uiDialog.is( ":data(resizable)" ); - if (isResizable && !value) { - uiDialog.resizable('destroy'); - } - - // currently resizable, changing handles - if (isResizable && typeof value === 'string') { - uiDialog.resizable('option', 'handles', value); - } - - // currently non-resizable, becoming resizable - if (!isResizable && value !== false) { - self._makeResizable(value); - } - break; - case "title": - // convert whatever was passed in o a string, for html() to not throw up - $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' ')); - break; - } - - $.Widget.prototype._setOption.apply(self, arguments); - }, - - _size: function() { - /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content - * divs will both have width and height set, so we need to reset them - */ - var options = this.options, - nonContentHeight, - minContentHeight, - isVisible = this.uiDialog.is( ":visible" ); - - // reset content sizing - this.element.show().css({ - width: 'auto', - minHeight: 0, - height: 0 - }); - - if (options.minWidth > options.width) { - options.width = options.minWidth; - } - - // reset wrapper sizing - // determine the height of all the non-content elements - nonContentHeight = this.uiDialog.css({ - height: 'auto', - width: options.width - }) - .height(); - minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); - - if ( options.height === "auto" ) { - // only needed for IE6 support - if ( $.support.minHeight ) { - this.element.css({ - minHeight: minContentHeight, - height: "auto" - }); - } else { - this.uiDialog.show(); - var autoHeight = this.element.css( "height", "auto" ).height(); - if ( !isVisible ) { - this.uiDialog.hide(); - } - this.element.height( Math.max( autoHeight, minContentHeight ) ); - } - } else { - this.element.height( Math.max( options.height - nonContentHeight, 0 ) ); - } - - if (this.uiDialog.is(':data(resizable)')) { - this.uiDialog.resizable('option', 'minHeight', this._minHeight()); - } - } -}); - -$.extend($.ui.dialog, { - version: "1.8.23", - - uuid: 0, - maxZ: 0, - - getTitleId: function($el) { - var id = $el.attr('id'); - if (!id) { - this.uuid += 1; - id = this.uuid; - } - return 'ui-dialog-title-' + id; - }, - - overlay: function(dialog) { - this.$el = $.ui.dialog.overlay.create(dialog); - } -}); - -$.extend($.ui.dialog.overlay, { - instances: [], - // reuse old instances due to IE memory leak with alpha transparency (see #5185) - oldInstances: [], - maxZ: 0, - events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), - function(event) { return event + '.dialog-overlay'; }).join(' '), - create: function(dialog) { - if (this.instances.length === 0) { - // prevent use of anchors and inputs - // we use a setTimeout in case the overlay is created from an - // event that we're going to be cancelling (see #2804) - setTimeout(function() { - // handle $(el).dialog().dialog('close') (see #4065) - if ($.ui.dialog.overlay.instances.length) { - $(document).bind($.ui.dialog.overlay.events, function(event) { - // stop events if the z-index of the target is < the z-index of the overlay - // we cannot return true when we don't want to cancel the event (#3523) - if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) { - return false; - } - }); - } - }, 1); - - // allow closing by pressing the escape key - $(document).bind('keydown.dialog-overlay', function(event) { - if (dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && - event.keyCode === $.ui.keyCode.ESCAPE) { - - dialog.close(event); - event.preventDefault(); - } - }); - - // handle window resize - $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); - } - - var $el = (this.oldInstances.pop() || $('
        ').addClass('ui-widget-overlay')) - .appendTo(document.body) - .css({ - width: this.width(), - height: this.height() - }); - - if ($.fn.bgiframe) { - $el.bgiframe(); - } - - this.instances.push($el); - return $el; - }, - - destroy: function($el) { - var indexOf = $.inArray($el, this.instances); - if (indexOf != -1){ - this.oldInstances.push(this.instances.splice(indexOf, 1)[0]); - } - - if (this.instances.length === 0) { - $([document, window]).unbind('.dialog-overlay'); - } - - $el.remove(); - - // adjust the maxZ to allow other modal dialogs to continue to work (see #4309) - var maxZ = 0; - $.each(this.instances, function() { - maxZ = Math.max(maxZ, this.css('z-index')); - }); - this.maxZ = maxZ; - }, - - height: function() { - var scrollHeight, - offsetHeight; - // handle IE 6 - if ($.browser.msie && $.browser.version < 7) { - scrollHeight = Math.max( - document.documentElement.scrollHeight, - document.body.scrollHeight - ); - offsetHeight = Math.max( - document.documentElement.offsetHeight, - document.body.offsetHeight - ); - - if (scrollHeight < offsetHeight) { - return $(window).height() + 'px'; - } else { - return scrollHeight + 'px'; - } - // handle "good" browsers - } else { - return $(document).height() + 'px'; - } - }, - - width: function() { - var scrollWidth, - offsetWidth; - // handle IE - if ( $.browser.msie ) { - scrollWidth = Math.max( - document.documentElement.scrollWidth, - document.body.scrollWidth - ); - offsetWidth = Math.max( - document.documentElement.offsetWidth, - document.body.offsetWidth - ); - - if (scrollWidth < offsetWidth) { - return $(window).width() + 'px'; - } else { - return scrollWidth + 'px'; - } - // handle "good" browsers - } else { - return $(document).width() + 'px'; - } - }, - - resize: function() { - /* If the dialog is draggable and the user drags it past the - * right edge of the window, the document becomes wider so we - * need to stretch the overlay. If the user then drags the - * dialog back to the left, the document will become narrower, - * so we need to shrink the overlay to the appropriate size. - * This is handled by shrinking the overlay before setting it - * to the full document size. - */ - var $overlays = $([]); - $.each($.ui.dialog.overlay.instances, function() { - $overlays = $overlays.add(this); - }); - - $overlays.css({ - width: 0, - height: 0 - }).css({ - width: $.ui.dialog.overlay.width(), - height: $.ui.dialog.overlay.height() - }); - } -}); - -$.extend($.ui.dialog.overlay.prototype, { - destroy: function() { - $.ui.dialog.overlay.destroy(this.$el); - } -}); - -}(jQuery)); - -(function( $, undefined ) { - -$.ui = $.ui || {}; - -var horizontalPositions = /left|center|right/, - verticalPositions = /top|center|bottom/, - center = "center", - support = {}, - _position = $.fn.position, - _offset = $.fn.offset; - -$.fn.position = function( options ) { - if ( !options || !options.of ) { - return _position.apply( this, arguments ); - } - - // make a copy, we don't want to modify arguments - options = $.extend( {}, options ); - - var target = $( options.of ), - targetElem = target[0], - collision = ( options.collision || "flip" ).split( " " ), - offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ], - targetWidth, - targetHeight, - basePosition; - - if ( targetElem.nodeType === 9 ) { - targetWidth = target.width(); - targetHeight = target.height(); - basePosition = { top: 0, left: 0 }; - // TODO: use $.isWindow() in 1.9 - } else if ( targetElem.setTimeout ) { - targetWidth = target.width(); - targetHeight = target.height(); - basePosition = { top: target.scrollTop(), left: target.scrollLeft() }; - } else if ( targetElem.preventDefault ) { - // force left top to allow flipping - options.at = "left top"; - targetWidth = targetHeight = 0; - basePosition = { top: options.of.pageY, left: options.of.pageX }; - } else { - targetWidth = target.outerWidth(); - targetHeight = target.outerHeight(); - basePosition = target.offset(); - } - - // force my and at to have valid horizontal and veritcal positions - // if a value is missing or invalid, it will be converted to center - $.each( [ "my", "at" ], function() { - var pos = ( options[this] || "" ).split( " " ); - if ( pos.length === 1) { - pos = horizontalPositions.test( pos[0] ) ? - pos.concat( [center] ) : - verticalPositions.test( pos[0] ) ? - [ center ].concat( pos ) : - [ center, center ]; - } - pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center; - pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center; - options[ this ] = pos; - }); - - // normalize collision option - if ( collision.length === 1 ) { - collision[ 1 ] = collision[ 0 ]; - } - - // normalize offset option - offset[ 0 ] = parseInt( offset[0], 10 ) || 0; - if ( offset.length === 1 ) { - offset[ 1 ] = offset[ 0 ]; - } - offset[ 1 ] = parseInt( offset[1], 10 ) || 0; - - if ( options.at[0] === "right" ) { - basePosition.left += targetWidth; - } else if ( options.at[0] === center ) { - basePosition.left += targetWidth / 2; - } - - if ( options.at[1] === "bottom" ) { - basePosition.top += targetHeight; - } else if ( options.at[1] === center ) { - basePosition.top += targetHeight / 2; - } - - basePosition.left += offset[ 0 ]; - basePosition.top += offset[ 1 ]; - - return this.each(function() { - var elem = $( this ), - elemWidth = elem.outerWidth(), - elemHeight = elem.outerHeight(), - marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0, - marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0, - collisionWidth = elemWidth + marginLeft + - ( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ), - collisionHeight = elemHeight + marginTop + - ( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ), - position = $.extend( {}, basePosition ), - collisionPosition; - - if ( options.my[0] === "right" ) { - position.left -= elemWidth; - } else if ( options.my[0] === center ) { - position.left -= elemWidth / 2; - } - - if ( options.my[1] === "bottom" ) { - position.top -= elemHeight; - } else if ( options.my[1] === center ) { - position.top -= elemHeight / 2; - } - - // prevent fractions if jQuery version doesn't support them (see #5280) - if ( !support.fractions ) { - position.left = Math.round( position.left ); - position.top = Math.round( position.top ); - } - - collisionPosition = { - left: position.left - marginLeft, - top: position.top - marginTop - }; - - $.each( [ "left", "top" ], function( i, dir ) { - if ( $.ui.position[ collision[i] ] ) { - $.ui.position[ collision[i] ][ dir ]( position, { - targetWidth: targetWidth, - targetHeight: targetHeight, - elemWidth: elemWidth, - elemHeight: elemHeight, - collisionPosition: collisionPosition, - collisionWidth: collisionWidth, - collisionHeight: collisionHeight, - offset: offset, - my: options.my, - at: options.at - }); - } - }); - - if ( $.fn.bgiframe ) { - elem.bgiframe(); - } - elem.offset( $.extend( position, { using: options.using } ) ); - }); -}; - -$.ui.position = { - fit: { - left: function( position, data ) { - var win = $( window ), - over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(); - position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left ); - }, - top: function( position, data ) { - var win = $( window ), - over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(); - position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top ); - } - }, - - flip: { - left: function( position, data ) { - if ( data.at[0] === center ) { - return; - } - var win = $( window ), - over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(), - myOffset = data.my[ 0 ] === "left" ? - -data.elemWidth : - data.my[ 0 ] === "right" ? - data.elemWidth : - 0, - atOffset = data.at[ 0 ] === "left" ? - data.targetWidth : - -data.targetWidth, - offset = -2 * data.offset[ 0 ]; - position.left += data.collisionPosition.left < 0 ? - myOffset + atOffset + offset : - over > 0 ? - myOffset + atOffset + offset : - 0; - }, - top: function( position, data ) { - if ( data.at[1] === center ) { - return; - } - var win = $( window ), - over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(), - myOffset = data.my[ 1 ] === "top" ? - -data.elemHeight : - data.my[ 1 ] === "bottom" ? - data.elemHeight : - 0, - atOffset = data.at[ 1 ] === "top" ? - data.targetHeight : - -data.targetHeight, - offset = -2 * data.offset[ 1 ]; - position.top += data.collisionPosition.top < 0 ? - myOffset + atOffset + offset : - over > 0 ? - myOffset + atOffset + offset : - 0; - } - } -}; - -// offset setter from jQuery 1.4 -if ( !$.offset.setOffset ) { - $.offset.setOffset = function( elem, options ) { - // set position first, in-case top/left are set even on static elem - if ( /static/.test( $.curCSS( elem, "position" ) ) ) { - elem.style.position = "relative"; - } - var curElem = $( elem ), - curOffset = curElem.offset(), - curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0, - curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0, - props = { - top: (options.top - curOffset.top) + curTop, - left: (options.left - curOffset.left) + curLeft - }; - - if ( 'using' in options ) { - options.using.call( elem, props ); - } else { - curElem.css( props ); - } - }; - - $.fn.offset = function( options ) { - var elem = this[ 0 ]; - if ( !elem || !elem.ownerDocument ) { return null; } - if ( options ) { - if ( $.isFunction( options ) ) { - return this.each(function( i ) { - $( this ).offset( options.call( this, i, $( this ).offset() ) ); - }); - } - return this.each(function() { - $.offset.setOffset( this, options ); - }); - } - return _offset.call( this ); - }; -} - -// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css -if ( !$.curCSS ) { - $.curCSS = $.css; -} - -// fraction support test (older versions of jQuery don't support fractions) -(function () { - var body = document.getElementsByTagName( "body" )[ 0 ], - div = document.createElement( "div" ), - testElement, testElementParent, testElementStyle, offset, offsetTotal; - - //Create a "fake body" for testing based on method used in jQuery.support - testElement = document.createElement( body ? "div" : "body" ); - testElementStyle = { - visibility: "hidden", - width: 0, - height: 0, - border: 0, - margin: 0, - background: "none" - }; - if ( body ) { - $.extend( testElementStyle, { - position: "absolute", - left: "-1000px", - top: "-1000px" - }); - } - for ( var i in testElementStyle ) { - testElement.style[ i ] = testElementStyle[ i ]; - } - testElement.appendChild( div ); - testElementParent = body || document.documentElement; - testElementParent.insertBefore( testElement, testElementParent.firstChild ); - - div.style.cssText = "position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;"; - - offset = $( div ).offset( function( _, offset ) { - return offset; - }).offset(); - - testElement.innerHTML = ""; - testElementParent.removeChild( testElement ); - - offsetTotal = offset.top + offset.left + ( body ? 2000 : 0 ); - support.fractions = offsetTotal > 21 && offsetTotal < 22; -})(); - -}( jQuery )); - -(function( $, undefined ) { - -$.widget( "ui.progressbar", { - options: { - value: 0, - max: 100 - }, - - min: 0, - - _create: function() { - this.element - .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) - .attr({ - role: "progressbar", - "aria-valuemin": this.min, - "aria-valuemax": this.options.max, - "aria-valuenow": this._value() - }); - - this.valueDiv = $( "
        " ) - .appendTo( this.element ); - - this.oldValue = this._value(); - this._refreshValue(); - }, - - destroy: function() { - this.element - .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) - .removeAttr( "role" ) - .removeAttr( "aria-valuemin" ) - .removeAttr( "aria-valuemax" ) - .removeAttr( "aria-valuenow" ); - - this.valueDiv.remove(); - - $.Widget.prototype.destroy.apply( this, arguments ); - }, - - value: function( newValue ) { - if ( newValue === undefined ) { - return this._value(); - } - - this._setOption( "value", newValue ); - return this; - }, - - _setOption: function( key, value ) { - if ( key === "value" ) { - this.options.value = value; - this._refreshValue(); - if ( this._value() === this.options.max ) { - this._trigger( "complete" ); - } - } - - $.Widget.prototype._setOption.apply( this, arguments ); - }, - - _value: function() { - var val = this.options.value; - // normalize invalid value - if ( typeof val !== "number" ) { - val = 0; - } - return Math.min( this.options.max, Math.max( this.min, val ) ); - }, - - _percentage: function() { - return 100 * this._value() / this.options.max; - }, - - _refreshValue: function() { - var value = this.value(); - var percentage = this._percentage(); - - if ( this.oldValue !== value ) { - this.oldValue = value; - this._trigger( "change" ); - } - - this.valueDiv - .toggle( value > this.min ) - .toggleClass( "ui-corner-right", value === this.options.max ) - .width( percentage.toFixed(0) + "%" ); - this.element.attr( "aria-valuenow", value ); - } -}); - -$.extend( $.ui.progressbar, { - version: "1.8.23" -}); - -})( jQuery ); - -(function( $, undefined ) { - -// number of pages in a slider -// (how many times can you page up/down to go through the whole range) -var numPages = 5; - -$.widget( "ui.slider", $.ui.mouse, { - - widgetEventPrefix: "slide", - - options: { - animate: false, - distance: 0, - max: 100, - min: 0, - orientation: "horizontal", - range: false, - step: 1, - value: 0, - values: null - }, - - _create: function() { - var self = this, - o = this.options, - existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), - handle = "", - handleCount = ( o.values && o.values.length ) || 1, - handles = []; - - this._keySliding = false; - this._mouseSliding = false; - this._animateOff = true; - this._handleIndex = null; - this._detectOrientation(); - this._mouseInit(); - - this.element - .addClass( "ui-slider" + - " ui-slider-" + this.orientation + - " ui-widget" + - " ui-widget-content" + - " ui-corner-all" + - ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) ); - - this.range = $([]); - - if ( o.range ) { - if ( o.range === true ) { - if ( !o.values ) { - o.values = [ this._valueMin(), this._valueMin() ]; - } - if ( o.values.length && o.values.length !== 2 ) { - o.values = [ o.values[0], o.values[0] ]; - } - } - - this.range = $( "
        " ) - .appendTo( this.element ) - .addClass( "ui-slider-range" + - // note: this isn't the most fittingly semantic framework class for this element, - // but worked best visually with a variety of themes - " ui-widget-header" + - ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) ); - } - - for ( var i = existingHandles.length; i < handleCount; i += 1 ) { - handles.push( handle ); - } - - this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( self.element ) ); - - this.handle = this.handles.eq( 0 ); - - this.handles.add( this.range ).filter( "a" ) - .click(function( event ) { - event.preventDefault(); - }) - .hover(function() { - if ( !o.disabled ) { - $( this ).addClass( "ui-state-hover" ); - } - }, function() { - $( this ).removeClass( "ui-state-hover" ); - }) - .focus(function() { - if ( !o.disabled ) { - $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" ); - $( this ).addClass( "ui-state-focus" ); - } else { - $( this ).blur(); - } - }) - .blur(function() { - $( this ).removeClass( "ui-state-focus" ); - }); - - this.handles.each(function( i ) { - $( this ).data( "index.ui-slider-handle", i ); - }); - - this.handles - .keydown(function( event ) { - var index = $( this ).data( "index.ui-slider-handle" ), - allowed, - curVal, - newVal, - step; - - if ( self.options.disabled ) { - return; - } - - switch ( event.keyCode ) { - case $.ui.keyCode.HOME: - case $.ui.keyCode.END: - case $.ui.keyCode.PAGE_UP: - case $.ui.keyCode.PAGE_DOWN: - case $.ui.keyCode.UP: - case $.ui.keyCode.RIGHT: - case $.ui.keyCode.DOWN: - case $.ui.keyCode.LEFT: - event.preventDefault(); - if ( !self._keySliding ) { - self._keySliding = true; - $( this ).addClass( "ui-state-active" ); - allowed = self._start( event, index ); - if ( allowed === false ) { - return; - } - } - break; - } - - step = self.options.step; - if ( self.options.values && self.options.values.length ) { - curVal = newVal = self.values( index ); - } else { - curVal = newVal = self.value(); - } - - switch ( event.keyCode ) { - case $.ui.keyCode.HOME: - newVal = self._valueMin(); - break; - case $.ui.keyCode.END: - newVal = self._valueMax(); - break; - case $.ui.keyCode.PAGE_UP: - newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) ); - break; - case $.ui.keyCode.PAGE_DOWN: - newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) ); - break; - case $.ui.keyCode.UP: - case $.ui.keyCode.RIGHT: - if ( curVal === self._valueMax() ) { - return; - } - newVal = self._trimAlignValue( curVal + step ); - break; - case $.ui.keyCode.DOWN: - case $.ui.keyCode.LEFT: - if ( curVal === self._valueMin() ) { - return; - } - newVal = self._trimAlignValue( curVal - step ); - break; - } - - self._slide( event, index, newVal ); - }) - .keyup(function( event ) { - var index = $( this ).data( "index.ui-slider-handle" ); - - if ( self._keySliding ) { - self._keySliding = false; - self._stop( event, index ); - self._change( event, index ); - $( this ).removeClass( "ui-state-active" ); - } - - }); - - this._refreshValue(); - - this._animateOff = false; - }, - - destroy: function() { - this.handles.remove(); - this.range.remove(); - - this.element - .removeClass( "ui-slider" + - " ui-slider-horizontal" + - " ui-slider-vertical" + - " ui-slider-disabled" + - " ui-widget" + - " ui-widget-content" + - " ui-corner-all" ) - .removeData( "slider" ) - .unbind( ".slider" ); - - this._mouseDestroy(); - - return this; - }, - - _mouseCapture: function( event ) { - var o = this.options, - position, - normValue, - distance, - closestHandle, - self, - index, - allowed, - offset, - mouseOverHandle; - - if ( o.disabled ) { - return false; - } - - this.elementSize = { - width: this.element.outerWidth(), - height: this.element.outerHeight() - }; - this.elementOffset = this.element.offset(); - - position = { x: event.pageX, y: event.pageY }; - normValue = this._normValueFromMouse( position ); - distance = this._valueMax() - this._valueMin() + 1; - self = this; - this.handles.each(function( i ) { - var thisDistance = Math.abs( normValue - self.values(i) ); - if ( distance > thisDistance ) { - distance = thisDistance; - closestHandle = $( this ); - index = i; - } - }); - - // workaround for bug #3736 (if both handles of a range are at 0, - // the first is always used as the one with least distance, - // and moving it is obviously prevented by preventing negative ranges) - if( o.range === true && this.values(1) === o.min ) { - index += 1; - closestHandle = $( this.handles[index] ); - } - - allowed = this._start( event, index ); - if ( allowed === false ) { - return false; - } - this._mouseSliding = true; - - self._handleIndex = index; - - closestHandle - .addClass( "ui-state-active" ) - .focus(); - - offset = closestHandle.offset(); - mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" ); - this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { - left: event.pageX - offset.left - ( closestHandle.width() / 2 ), - top: event.pageY - offset.top - - ( closestHandle.height() / 2 ) - - ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) - - ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) + - ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) - }; - - if ( !this.handles.hasClass( "ui-state-hover" ) ) { - this._slide( event, index, normValue ); - } - this._animateOff = true; - return true; - }, - - _mouseStart: function( event ) { - return true; - }, - - _mouseDrag: function( event ) { - var position = { x: event.pageX, y: event.pageY }, - normValue = this._normValueFromMouse( position ); - - this._slide( event, this._handleIndex, normValue ); - - return false; - }, - - _mouseStop: function( event ) { - this.handles.removeClass( "ui-state-active" ); - this._mouseSliding = false; - - this._stop( event, this._handleIndex ); - this._change( event, this._handleIndex ); - - this._handleIndex = null; - this._clickOffset = null; - this._animateOff = false; - - return false; - }, - - _detectOrientation: function() { - this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; - }, - - _normValueFromMouse: function( position ) { - var pixelTotal, - pixelMouse, - percentMouse, - valueTotal, - valueMouse; - - if ( this.orientation === "horizontal" ) { - pixelTotal = this.elementSize.width; - pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 ); - } else { - pixelTotal = this.elementSize.height; - pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 ); - } - - percentMouse = ( pixelMouse / pixelTotal ); - if ( percentMouse > 1 ) { - percentMouse = 1; - } - if ( percentMouse < 0 ) { - percentMouse = 0; - } - if ( this.orientation === "vertical" ) { - percentMouse = 1 - percentMouse; - } - - valueTotal = this._valueMax() - this._valueMin(); - valueMouse = this._valueMin() + percentMouse * valueTotal; - - return this._trimAlignValue( valueMouse ); - }, - - _start: function( event, index ) { - var uiHash = { - handle: this.handles[ index ], - value: this.value() - }; - if ( this.options.values && this.options.values.length ) { - uiHash.value = this.values( index ); - uiHash.values = this.values(); - } - return this._trigger( "start", event, uiHash ); - }, - - _slide: function( event, index, newVal ) { - var otherVal, - newValues, - allowed; - - if ( this.options.values && this.options.values.length ) { - otherVal = this.values( index ? 0 : 1 ); - - if ( ( this.options.values.length === 2 && this.options.range === true ) && - ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) - ) { - newVal = otherVal; - } - - if ( newVal !== this.values( index ) ) { - newValues = this.values(); - newValues[ index ] = newVal; - // A slide can be canceled by returning false from the slide callback - allowed = this._trigger( "slide", event, { - handle: this.handles[ index ], - value: newVal, - values: newValues - } ); - otherVal = this.values( index ? 0 : 1 ); - if ( allowed !== false ) { - this.values( index, newVal, true ); - } - } - } else { - if ( newVal !== this.value() ) { - // A slide can be canceled by returning false from the slide callback - allowed = this._trigger( "slide", event, { - handle: this.handles[ index ], - value: newVal - } ); - if ( allowed !== false ) { - this.value( newVal ); - } - } - } - }, - - _stop: function( event, index ) { - var uiHash = { - handle: this.handles[ index ], - value: this.value() - }; - if ( this.options.values && this.options.values.length ) { - uiHash.value = this.values( index ); - uiHash.values = this.values(); - } - - this._trigger( "stop", event, uiHash ); - }, - - _change: function( event, index ) { - if ( !this._keySliding && !this._mouseSliding ) { - var uiHash = { - handle: this.handles[ index ], - value: this.value() - }; - if ( this.options.values && this.options.values.length ) { - uiHash.value = this.values( index ); - uiHash.values = this.values(); - } - - this._trigger( "change", event, uiHash ); - } - }, - - value: function( newValue ) { - if ( arguments.length ) { - this.options.value = this._trimAlignValue( newValue ); - this._refreshValue(); - this._change( null, 0 ); - return; - } - - return this._value(); - }, - - values: function( index, newValue ) { - var vals, - newValues, - i; - - if ( arguments.length > 1 ) { - this.options.values[ index ] = this._trimAlignValue( newValue ); - this._refreshValue(); - this._change( null, index ); - return; - } - - if ( arguments.length ) { - if ( $.isArray( arguments[ 0 ] ) ) { - vals = this.options.values; - newValues = arguments[ 0 ]; - for ( i = 0; i < vals.length; i += 1 ) { - vals[ i ] = this._trimAlignValue( newValues[ i ] ); - this._change( null, i ); - } - this._refreshValue(); - } else { - if ( this.options.values && this.options.values.length ) { - return this._values( index ); - } else { - return this.value(); - } - } - } else { - return this._values(); - } - }, - - _setOption: function( key, value ) { - var i, - valsLength = 0; - - if ( $.isArray( this.options.values ) ) { - valsLength = this.options.values.length; - } - - $.Widget.prototype._setOption.apply( this, arguments ); - - switch ( key ) { - case "disabled": - if ( value ) { - this.handles.filter( ".ui-state-focus" ).blur(); - this.handles.removeClass( "ui-state-hover" ); - this.handles.propAttr( "disabled", true ); - this.element.addClass( "ui-disabled" ); - } else { - this.handles.propAttr( "disabled", false ); - this.element.removeClass( "ui-disabled" ); - } - break; - case "orientation": - this._detectOrientation(); - this.element - .removeClass( "ui-slider-horizontal ui-slider-vertical" ) - .addClass( "ui-slider-" + this.orientation ); - this._refreshValue(); - break; - case "value": - this._animateOff = true; - this._refreshValue(); - this._change( null, 0 ); - this._animateOff = false; - break; - case "values": - this._animateOff = true; - this._refreshValue(); - for ( i = 0; i < valsLength; i += 1 ) { - this._change( null, i ); - } - this._animateOff = false; - break; - } - }, - - //internal value getter - // _value() returns value trimmed by min and max, aligned by step - _value: function() { - var val = this.options.value; - val = this._trimAlignValue( val ); - - return val; - }, - - //internal values getter - // _values() returns array of values trimmed by min and max, aligned by step - // _values( index ) returns single value trimmed by min and max, aligned by step - _values: function( index ) { - var val, - vals, - i; - - if ( arguments.length ) { - val = this.options.values[ index ]; - val = this._trimAlignValue( val ); - - return val; - } else { - // .slice() creates a copy of the array - // this copy gets trimmed by min and max and then returned - vals = this.options.values.slice(); - for ( i = 0; i < vals.length; i+= 1) { - vals[ i ] = this._trimAlignValue( vals[ i ] ); - } - - return vals; - } - }, - - // returns the step-aligned value that val is closest to, between (inclusive) min and max - _trimAlignValue: function( val ) { - if ( val <= this._valueMin() ) { - return this._valueMin(); - } - if ( val >= this._valueMax() ) { - return this._valueMax(); - } - var step = ( this.options.step > 0 ) ? this.options.step : 1, - valModStep = (val - this._valueMin()) % step, - alignValue = val - valModStep; - - if ( Math.abs(valModStep) * 2 >= step ) { - alignValue += ( valModStep > 0 ) ? step : ( -step ); - } - - // Since JavaScript has problems with large floats, round - // the final value to 5 digits after the decimal point (see #4124) - return parseFloat( alignValue.toFixed(5) ); - }, - - _valueMin: function() { - return this.options.min; - }, - - _valueMax: function() { - return this.options.max; - }, - - _refreshValue: function() { - var oRange = this.options.range, - o = this.options, - self = this, - animate = ( !this._animateOff ) ? o.animate : false, - valPercent, - _set = {}, - lastValPercent, - value, - valueMin, - valueMax; - - if ( this.options.values && this.options.values.length ) { - this.handles.each(function( i, j ) { - valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100; - _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; - $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); - if ( self.options.range === true ) { - if ( self.orientation === "horizontal" ) { - if ( i === 0 ) { - self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); - } - if ( i === 1 ) { - self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - } else { - if ( i === 0 ) { - self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate ); - } - if ( i === 1 ) { - self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - } - } - lastValPercent = valPercent; - }); - } else { - value = this.value(); - valueMin = this._valueMin(); - valueMax = this._valueMax(); - valPercent = ( valueMax !== valueMin ) ? - ( value - valueMin ) / ( valueMax - valueMin ) * 100 : - 0; - _set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; - this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); - - if ( oRange === "min" && this.orientation === "horizontal" ) { - this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate ); - } - if ( oRange === "max" && this.orientation === "horizontal" ) { - this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - if ( oRange === "min" && this.orientation === "vertical" ) { - this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate ); - } - if ( oRange === "max" && this.orientation === "vertical" ) { - this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); - } - } - } - -}); - -$.extend( $.ui.slider, { - version: "1.8.23" -}); - -}(jQuery)); - -(function( $, undefined ) { - -var tabId = 0, - listId = 0; - -function getNextTabId() { - return ++tabId; -} - -function getNextListId() { - return ++listId; -} - -$.widget( "ui.tabs", { - options: { - add: null, - ajaxOptions: null, - cache: false, - cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true } - collapsible: false, - disable: null, - disabled: [], - enable: null, - event: "click", - fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } - idPrefix: "ui-tabs-", - load: null, - panelTemplate: "
        ", - remove: null, - select: null, - show: null, - spinner: "Loading…", - tabTemplate: "
      • #{label}
      • " - }, - - _create: function() { - this._tabify( true ); - }, - - _setOption: function( key, value ) { - if ( key == "selected" ) { - if (this.options.collapsible && value == this.options.selected ) { - return; - } - this.select( value ); - } else { - this.options[ key ] = value; - this._tabify(); - } - }, - - _tabId: function( a ) { - return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) || - this.options.idPrefix + getNextTabId(); - }, - - _sanitizeSelector: function( hash ) { - // we need this because an id may contain a ":" - return hash.replace( /:/g, "\\:" ); - }, - - _cookie: function() { - var cookie = this.cookie || - ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() ); - return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) ); - }, - - _ui: function( tab, panel ) { - return { - tab: tab, - panel: panel, - index: this.anchors.index( tab ) - }; - }, - - _cleanup: function() { - // restore all former loading tabs labels - this.lis.filter( ".ui-state-processing" ) - .removeClass( "ui-state-processing" ) - .find( "span:data(label.tabs)" ) - .each(function() { - var el = $( this ); - el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" ); - }); - }, - - _tabify: function( init ) { - var self = this, - o = this.options, - fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash - - this.list = this.element.find( "ol,ul" ).eq( 0 ); - this.lis = $( " > li:has(a[href])", this.list ); - this.anchors = this.lis.map(function() { - return $( "a", this )[ 0 ]; - }); - this.panels = $( [] ); - - this.anchors.each(function( i, a ) { - var href = $( a ).attr( "href" ); - // For dynamically created HTML that contains a hash as href IE < 8 expands - // such href to the full page url with hash and then misinterprets tab as ajax. - // Same consideration applies for an added tab with a fragment identifier - // since a[href=#fragment-identifier] does unexpectedly not match. - // Thus normalize href attribute... - var hrefBase = href.split( "#" )[ 0 ], - baseEl; - if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] || - ( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) { - href = a.hash; - a.href = href; - } - - // inline tab - if ( fragmentId.test( href ) ) { - self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) ); - // remote tab - // prevent loading the page itself if href is just "#" - } else if ( href && href !== "#" ) { - // required for restore on destroy - $.data( a, "href.tabs", href ); - - // TODO until #3808 is fixed strip fragment identifier from url - // (IE fails to load from such url) - $.data( a, "load.tabs", href.replace( /#.*$/, "" ) ); - - var id = self._tabId( a ); - a.href = "#" + id; - var $panel = self.element.find( "#" + id ); - if ( !$panel.length ) { - $panel = $( o.panelTemplate ) - .attr( "id", id ) - .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) - .insertAfter( self.panels[ i - 1 ] || self.list ); - $panel.data( "destroy.tabs", true ); - } - self.panels = self.panels.add( $panel ); - // invalid tab href - } else { - o.disabled.push( i ); - } - }); - - // initialization from scratch - if ( init ) { - // attach necessary classes for styling - this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ); - this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); - this.lis.addClass( "ui-state-default ui-corner-top" ); - this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ); - - // Selected tab - // use "selected" option or try to retrieve: - // 1. from fragment identifier in url - // 2. from cookie - // 3. from selected class attribute on
      • - if ( o.selected === undefined ) { - if ( location.hash ) { - this.anchors.each(function( i, a ) { - if ( a.hash == location.hash ) { - o.selected = i; - return false; - } - }); - } - if ( typeof o.selected !== "number" && o.cookie ) { - o.selected = parseInt( self._cookie(), 10 ); - } - if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) { - o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); - } - o.selected = o.selected || ( this.lis.length ? 0 : -1 ); - } else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release - o.selected = -1; - } - - // sanity check - default to first tab... - o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 ) - ? o.selected - : 0; - - // Take disabling tabs via class attribute from HTML - // into account and update option properly. - // A selected tab cannot become disabled. - o.disabled = $.unique( o.disabled.concat( - $.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) { - return self.lis.index( n ); - }) - ) ).sort(); - - if ( $.inArray( o.selected, o.disabled ) != -1 ) { - o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 ); - } - - // highlight selected tab - this.panels.addClass( "ui-tabs-hide" ); - this.lis.removeClass( "ui-tabs-selected ui-state-active" ); - // check for length avoids error when initializing empty list - if ( o.selected >= 0 && this.anchors.length ) { - self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" ); - this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" ); - - // seems to be expected behavior that the show callback is fired - self.element.queue( "tabs", function() { - self._trigger( "show", null, - self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) ); - }); - - this.load( o.selected ); - } - - // clean up to avoid memory leaks in certain versions of IE 6 - // TODO: namespace this event - $( window ).bind( "unload", function() { - self.lis.add( self.anchors ).unbind( ".tabs" ); - self.lis = self.anchors = self.panels = null; - }); - // update selected after add/remove - } else { - o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); - } - - // update collapsible - // TODO: use .toggleClass() - this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" ); - - // set or update cookie after init and add/remove respectively - if ( o.cookie ) { - this._cookie( o.selected, o.cookie ); - } - - // disable tabs - for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) { - $( li )[ $.inArray( i, o.disabled ) != -1 && - // TODO: use .toggleClass() - !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" ); - } - - // reset cache if switching from cached to not cached - if ( o.cache === false ) { - this.anchors.removeData( "cache.tabs" ); - } - - // remove all handlers before, tabify may run on existing tabs after add or option change - this.lis.add( this.anchors ).unbind( ".tabs" ); - - if ( o.event !== "mouseover" ) { - var addState = function( state, el ) { - if ( el.is( ":not(.ui-state-disabled)" ) ) { - el.addClass( "ui-state-" + state ); - } - }; - var removeState = function( state, el ) { - el.removeClass( "ui-state-" + state ); - }; - this.lis.bind( "mouseover.tabs" , function() { - addState( "hover", $( this ) ); - }); - this.lis.bind( "mouseout.tabs", function() { - removeState( "hover", $( this ) ); - }); - this.anchors.bind( "focus.tabs", function() { - addState( "focus", $( this ).closest( "li" ) ); - }); - this.anchors.bind( "blur.tabs", function() { - removeState( "focus", $( this ).closest( "li" ) ); - }); - } - - // set up animations - var hideFx, showFx; - if ( o.fx ) { - if ( $.isArray( o.fx ) ) { - hideFx = o.fx[ 0 ]; - showFx = o.fx[ 1 ]; - } else { - hideFx = showFx = o.fx; - } - } - - // Reset certain styles left over from animation - // and prevent IE's ClearType bug... - function resetStyle( $el, fx ) { - $el.css( "display", "" ); - if ( !$.support.opacity && fx.opacity ) { - $el[ 0 ].style.removeAttribute( "filter" ); - } - } - - // Show a tab... - var showTab = showFx - ? function( clicked, $show ) { - $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); - $show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way - .animate( showFx, showFx.duration || "normal", function() { - resetStyle( $show, showFx ); - self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); - }); - } - : function( clicked, $show ) { - $( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" ); - $show.removeClass( "ui-tabs-hide" ); - self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) ); - }; - - // Hide a tab, $show is optional... - var hideTab = hideFx - ? function( clicked, $hide ) { - $hide.animate( hideFx, hideFx.duration || "normal", function() { - self.lis.removeClass( "ui-tabs-selected ui-state-active" ); - $hide.addClass( "ui-tabs-hide" ); - resetStyle( $hide, hideFx ); - self.element.dequeue( "tabs" ); - }); - } - : function( clicked, $hide, $show ) { - self.lis.removeClass( "ui-tabs-selected ui-state-active" ); - $hide.addClass( "ui-tabs-hide" ); - self.element.dequeue( "tabs" ); - }; - - // attach tab event handler, unbind to avoid duplicates from former tabifying... - this.anchors.bind( o.event + ".tabs", function() { - var el = this, - $li = $(el).closest( "li" ), - $hide = self.panels.filter( ":not(.ui-tabs-hide)" ), - $show = self.element.find( self._sanitizeSelector( el.hash ) ); - - // If tab is already selected and not collapsible or tab disabled or - // or is already loading or click callback returns false stop here. - // Check if click handler returns false last so that it is not executed - // for a disabled or loading tab! - if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) || - $li.hasClass( "ui-state-disabled" ) || - $li.hasClass( "ui-state-processing" ) || - self.panels.filter( ":animated" ).length || - self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) { - this.blur(); - return false; - } - - o.selected = self.anchors.index( this ); - - self.abort(); - - // if tab may be closed - if ( o.collapsible ) { - if ( $li.hasClass( "ui-tabs-selected" ) ) { - o.selected = -1; - - if ( o.cookie ) { - self._cookie( o.selected, o.cookie ); - } - - self.element.queue( "tabs", function() { - hideTab( el, $hide ); - }).dequeue( "tabs" ); - - this.blur(); - return false; - } else if ( !$hide.length ) { - if ( o.cookie ) { - self._cookie( o.selected, o.cookie ); - } - - self.element.queue( "tabs", function() { - showTab( el, $show ); - }); - - // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171 - self.load( self.anchors.index( this ) ); - - this.blur(); - return false; - } - } - - if ( o.cookie ) { - self._cookie( o.selected, o.cookie ); - } - - // show new tab - if ( $show.length ) { - if ( $hide.length ) { - self.element.queue( "tabs", function() { - hideTab( el, $hide ); - }); - } - self.element.queue( "tabs", function() { - showTab( el, $show ); - }); - - self.load( self.anchors.index( this ) ); - } else { - throw "jQuery UI Tabs: Mismatching fragment identifier."; - } - - // Prevent IE from keeping other link focussed when using the back button - // and remove dotted border from clicked link. This is controlled via CSS - // in modern browsers; blur() removes focus from address bar in Firefox - // which can become a usability and annoying problem with tabs('rotate'). - if ( $.browser.msie ) { - this.blur(); - } - }); - - // disable click in any case - this.anchors.bind( "click.tabs", function(){ - return false; - }); - }, - - _getIndex: function( index ) { - // meta-function to give users option to provide a href string instead of a numerical index. - // also sanitizes numerical indexes to valid values. - if ( typeof index == "string" ) { - index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); - } - - return index; - }, - - destroy: function() { - var o = this.options; - - this.abort(); - - this.element - .unbind( ".tabs" ) - .removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ) - .removeData( "tabs" ); - - this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ); - - this.anchors.each(function() { - var href = $.data( this, "href.tabs" ); - if ( href ) { - this.href = href; - } - var $this = $( this ).unbind( ".tabs" ); - $.each( [ "href", "load", "cache" ], function( i, prefix ) { - $this.removeData( prefix + ".tabs" ); - }); - }); - - this.lis.unbind( ".tabs" ).add( this.panels ).each(function() { - if ( $.data( this, "destroy.tabs" ) ) { - $( this ).remove(); - } else { - $( this ).removeClass([ - "ui-state-default", - "ui-corner-top", - "ui-tabs-selected", - "ui-state-active", - "ui-state-hover", - "ui-state-focus", - "ui-state-disabled", - "ui-tabs-panel", - "ui-widget-content", - "ui-corner-bottom", - "ui-tabs-hide" - ].join( " " ) ); - } - }); - - if ( o.cookie ) { - this._cookie( null, o.cookie ); - } - - return this; - }, - - add: function( url, label, index ) { - if ( index === undefined ) { - index = this.anchors.length; - } - - var self = this, - o = this.options, - $li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ), - id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] ); - - $li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true ); - - // try to find an existing element before creating a new one - var $panel = self.element.find( "#" + id ); - if ( !$panel.length ) { - $panel = $( o.panelTemplate ) - .attr( "id", id ) - .data( "destroy.tabs", true ); - } - $panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" ); - - if ( index >= this.lis.length ) { - $li.appendTo( this.list ); - $panel.appendTo( this.list[ 0 ].parentNode ); - } else { - $li.insertBefore( this.lis[ index ] ); - $panel.insertBefore( this.panels[ index ] ); - } - - o.disabled = $.map( o.disabled, function( n, i ) { - return n >= index ? ++n : n; - }); - - this._tabify(); - - if ( this.anchors.length == 1 ) { - o.selected = 0; - $li.addClass( "ui-tabs-selected ui-state-active" ); - $panel.removeClass( "ui-tabs-hide" ); - this.element.queue( "tabs", function() { - self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) ); - }); - - this.load( 0 ); - } - - this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - return this; - }, - - remove: function( index ) { - index = this._getIndex( index ); - var o = this.options, - $li = this.lis.eq( index ).remove(), - $panel = this.panels.eq( index ).remove(); - - // If selected tab was removed focus tab to the right or - // in case the last tab was removed the tab to the left. - if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) { - this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) ); - } - - o.disabled = $.map( - $.grep( o.disabled, function(n, i) { - return n != index; - }), - function( n, i ) { - return n >= index ? --n : n; - }); - - this._tabify(); - - this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) ); - return this; - }, - - enable: function( index ) { - index = this._getIndex( index ); - var o = this.options; - if ( $.inArray( index, o.disabled ) == -1 ) { - return; - } - - this.lis.eq( index ).removeClass( "ui-state-disabled" ); - o.disabled = $.grep( o.disabled, function( n, i ) { - return n != index; - }); - - this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - return this; - }, - - disable: function( index ) { - index = this._getIndex( index ); - var self = this, o = this.options; - // cannot disable already selected tab - if ( index != o.selected ) { - this.lis.eq( index ).addClass( "ui-state-disabled" ); - - o.disabled.push( index ); - o.disabled.sort(); - - this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) ); - } - - return this; - }, - - select: function( index ) { - index = this._getIndex( index ); - if ( index == -1 ) { - if ( this.options.collapsible && this.options.selected != -1 ) { - index = this.options.selected; - } else { - return this; - } - } - this.anchors.eq( index ).trigger( this.options.event + ".tabs" ); - return this; - }, - - load: function( index ) { - index = this._getIndex( index ); - var self = this, - o = this.options, - a = this.anchors.eq( index )[ 0 ], - url = $.data( a, "load.tabs" ); - - this.abort(); - - // not remote or from cache - if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) { - this.element.dequeue( "tabs" ); - return; - } - - // load remote from here on - this.lis.eq( index ).addClass( "ui-state-processing" ); - - if ( o.spinner ) { - var span = $( "span", a ); - span.data( "label.tabs", span.html() ).html( o.spinner ); - } - - this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, { - url: url, - success: function( r, s ) { - self.element.find( self._sanitizeSelector( a.hash ) ).html( r ); - - // take care of tab labels - self._cleanup(); - - if ( o.cache ) { - $.data( a, "cache.tabs", true ); - } - - self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); - try { - o.ajaxOptions.success( r, s ); - } - catch ( e ) {} - }, - error: function( xhr, s, e ) { - // take care of tab labels - self._cleanup(); - - self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) ); - try { - // Passing index avoid a race condition when this method is - // called after the user has selected another tab. - // Pass the anchor that initiated this request allows - // loadError to manipulate the tab content panel via $(a.hash) - o.ajaxOptions.error( xhr, s, index, a ); - } - catch ( e ) {} - } - } ) ); - - // last, so that load event is fired before show... - self.element.dequeue( "tabs" ); - - return this; - }, - - abort: function() { - // stop possibly running animations - this.element.queue( [] ); - this.panels.stop( false, true ); - - // "tabs" queue must not contain more than two elements, - // which are the callbacks for the latest clicked tab... - this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) ); - - // terminate pending requests from other tabs - if ( this.xhr ) { - this.xhr.abort(); - delete this.xhr; - } - - // take care of tab labels - this._cleanup(); - return this; - }, - - url: function( index, url ) { - this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url ); - return this; - }, - - length: function() { - return this.anchors.length; - } -}); - -$.extend( $.ui.tabs, { - version: "1.8.23" -}); - -/* - * Tabs Extensions - */ - -/* - * Rotate - */ -$.extend( $.ui.tabs.prototype, { - rotation: null, - rotate: function( ms, continuing ) { - var self = this, - o = this.options; - - var rotate = self._rotate || ( self._rotate = function( e ) { - clearTimeout( self.rotation ); - self.rotation = setTimeout(function() { - var t = o.selected; - self.select( ++t < self.anchors.length ? t : 0 ); - }, ms ); - - if ( e ) { - e.stopPropagation(); - } - }); - - var stop = self._unrotate || ( self._unrotate = !continuing - ? function(e) { - if (e.clientX) { // in case of a true click - self.rotate(null); - } - } - : function( e ) { - rotate(); - }); - - // start rotation - if ( ms ) { - this.element.bind( "tabsshow", rotate ); - this.anchors.bind( o.event + ".tabs", stop ); - rotate(); - // stop rotation - } else { - clearTimeout( self.rotation ); - this.element.unbind( "tabsshow", rotate ); - this.anchors.unbind( o.event + ".tabs", stop ); - delete this._rotate; - delete this._unrotate; - } - - return this; - } -}); - -})( jQuery ); diff --git a/NzbDrone.Web/Scripts2/jquery.livequery.js b/NzbDrone.Web/Scripts2/jquery.livequery.js deleted file mode 100644 index b504cbb3d..000000000 --- a/NzbDrone.Web/Scripts2/jquery.livequery.js +++ /dev/null @@ -1,226 +0,0 @@ -/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) - * Dual licensed under the MIT (MIT_LICENSE.txt) - * and GPL Version 2 (GPL_LICENSE.txt) licenses. - * - * Version: 1.1.1 - * Requires jQuery 1.3+ - * Docs: http://docs.jquery.com/Plugins/livequery - */ - -(function($) { - -$.extend($.fn, { - livequery: function(type, fn, fn2) { - var self = this, q; - - // Handle different call patterns - if ($.isFunction(type)) - fn2 = fn, fn = type, type = undefined; - - // See if Live Query already exists - $.each( $.livequery.queries, function(i, query) { - if ( self.selector == query.selector && self.context == query.context && - type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) ) - // Found the query, exit the each loop - return (q = query) && false; - }); - - // Create new Live Query if it wasn't found - q = q || new $.livequery(this.selector, this.context, type, fn, fn2); - - // Make sure it is running - q.stopped = false; - - // Run it immediately for the first time - q.run(); - - // Contnue the chain - return this; - }, - - expire: function(type, fn, fn2) { - var self = this; - - // Handle different call patterns - if ($.isFunction(type)) - fn2 = fn, fn = type, type = undefined; - - // Find the Live Query based on arguments and stop it - $.each( $.livequery.queries, function(i, query) { - if ( self.selector == query.selector && self.context == query.context && - (!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped ) - $.livequery.stop(query.id); - }); - - // Continue the chain - return this; - } -}); - -$.livequery = function(selector, context, type, fn, fn2) { - this.selector = selector; - this.context = context; - this.type = type; - this.fn = fn; - this.fn2 = fn2; - this.elements = []; - this.stopped = false; - - // The id is the index of the Live Query in $.livequery.queries - this.id = $.livequery.queries.push(this)-1; - - // Mark the functions for matching later on - fn.$lqguid = fn.$lqguid || $.livequery.guid++; - if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++; - - // Return the Live Query - return this; -}; - -$.livequery.prototype = { - stop: function() { - var query = this; - - if ( this.type ) - // Unbind all bound events - this.elements.unbind(this.type, this.fn); - else if (this.fn2) - // Call the second function for all matched elements - this.elements.each(function(i, el) { - query.fn2.apply(el); - }); - - // Clear out matched elements - this.elements = []; - - // Stop the Live Query from running until restarted - this.stopped = true; - }, - - run: function() { - // Short-circuit if stopped - if ( this.stopped ) return; - var query = this; - - var oEls = this.elements, - els = $(this.selector, this.context), - nEls = els.not(oEls); - - // Set elements to the latest set of matched elements - this.elements = els; - - if (this.type) { - // Bind events to newly matched elements - nEls.bind(this.type, this.fn); - - // Unbind events to elements no longer matched - if (oEls.length > 0) - $.each(oEls, function(i, el) { - if ( $.inArray(el, els) < 0 ) - $.event.remove(el, query.type, query.fn); - }); - } - else { - // Call the first function for newly matched elements - nEls.each(function() { - query.fn.apply(this); - }); - - // Call the second function for elements no longer matched - if ( this.fn2 && oEls.length > 0 ) - $.each(oEls, function(i, el) { - if ( $.inArray(el, els) < 0 ) - query.fn2.apply(el); - }); - } - } -}; - -$.extend($.livequery, { - guid: 0, - queries: [], - queue: [], - running: false, - timeout: null, - - checkQueue: function() { - if ( $.livequery.running && $.livequery.queue.length ) { - var length = $.livequery.queue.length; - // Run each Live Query currently in the queue - while ( length-- ) - $.livequery.queries[ $.livequery.queue.shift() ].run(); - } - }, - - pause: function() { - // Don't run anymore Live Queries until restarted - $.livequery.running = false; - }, - - play: function() { - // Restart Live Queries - $.livequery.running = true; - // Request a run of the Live Queries - $.livequery.run(); - }, - - registerPlugin: function() { - $.each( arguments, function(i,n) { - // Short-circuit if the method doesn't exist - if (!$.fn[n]) return; - - // Save a reference to the original method - var old = $.fn[n]; - - // Create a new method - $.fn[n] = function() { - // Call the original method - var r = old.apply(this, arguments); - - // Request a run of the Live Queries - $.livequery.run(); - - // Return the original methods result - return r; - } - }); - }, - - run: function(id) { - if (id != undefined) { - // Put the particular Live Query in the queue if it doesn't already exist - if ( $.inArray(id, $.livequery.queue) < 0 ) - $.livequery.queue.push( id ); - } - else - // Put each Live Query in the queue if it doesn't already exist - $.each( $.livequery.queries, function(id) { - if ( $.inArray(id, $.livequery.queue) < 0 ) - $.livequery.queue.push( id ); - }); - - // Clear timeout if it already exists - if ($.livequery.timeout) clearTimeout($.livequery.timeout); - // Create a timeout to check the queue and actually run the Live Queries - $.livequery.timeout = setTimeout($.livequery.checkQueue, 20); - }, - - stop: function(id) { - if (id != undefined) - // Stop are particular Live Query - $.livequery.queries[ id ].stop(); - else - // Stop all Live Queries - $.each( $.livequery.queries, function(id) { - $.livequery.queries[ id ].stop(); - }); - } -}); - -// Register core DOM manipulation methods -$.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove', 'html'); - -// Run Live Queries when the Document is ready -$(function() { $.livequery.play(); }); - -})(jQuery); \ No newline at end of file diff --git a/NzbDrone.Web/Scripts2/jquery.unobtrusive-ajax.js b/NzbDrone.Web/Scripts2/jquery.unobtrusive-ajax.js deleted file mode 100644 index 02ace0135..000000000 --- a/NzbDrone.Web/Scripts2/jquery.unobtrusive-ajax.js +++ /dev/null @@ -1,165 +0,0 @@ -/// - -/*! -** Unobtrusive Ajax support library for jQuery -** Copyright (C) Microsoft Corporation. All rights reserved. -*/ - -/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ -/*global window: false, jQuery: false */ - -(function ($) { - var data_click = "unobtrusiveAjaxClick", - data_validation = "unobtrusiveValidation"; - - function getFunction(code, argNames) { - var fn = window, parts = (code || "").split("."); - while (fn && parts.length) { - fn = fn[parts.shift()]; - } - if (typeof (fn) === "function") { - return fn; - } - argNames.push(code); - return Function.constructor.apply(null, argNames); - } - - function isMethodProxySafe(method) { - return method === "GET" || method === "POST"; - } - - function asyncOnBeforeSend(xhr, method) { - if (!isMethodProxySafe(method)) { - xhr.setRequestHeader("X-HTTP-Method-Override", method); - } - } - - function asyncOnSuccess(element, data, contentType) { - var mode; - - if (contentType.indexOf("application/x-javascript") !== -1) { // jQuery already executes JavaScript for us - return; - } - - mode = (element.getAttribute("data-ajax-mode") || "").toUpperCase(); - $(element.getAttribute("data-ajax-update")).each(function (i, update) { - var top; - - switch (mode) { - case "BEFORE": - top = update.firstChild; - $("
        ").html(data).contents().each(function () { - update.insertBefore(this, top); - }); - break; - case "AFTER": - $("
        ").html(data).contents().each(function () { - update.appendChild(this); - }); - break; - default: - $(update).html(data); - break; - } - }); - } - - function asyncRequest(element, options) { - var confirm, loading, method, duration; - - confirm = element.getAttribute("data-ajax-confirm"); - if (confirm && !window.confirm(confirm)) { - return; - } - - loading = $(element.getAttribute("data-ajax-loading")); - duration = element.getAttribute("data-ajax-loading-duration") || 0; - - $.extend(options, { - type: element.getAttribute("data-ajax-method") || undefined, - url: element.getAttribute("data-ajax-url") || undefined, - beforeSend: function (xhr) { - var result; - asyncOnBeforeSend(xhr, method); - result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(this, arguments); - if (result !== false) { - loading.show(duration); - } - return result; - }, - complete: function () { - loading.hide(duration); - getFunction(element.getAttribute("data-ajax-complete"), ["xhr", "status"]).apply(this, arguments); - }, - success: function (data, status, xhr) { - asyncOnSuccess(element, data, xhr.getResponseHeader("Content-Type") || "text/html"); - getFunction(element.getAttribute("data-ajax-success"), ["data", "status", "xhr"]).apply(this, arguments); - }, - error: getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"]) - }); - - options.data.push({ name: "X-Requested-With", value: "XMLHttpRequest" }); - - method = options.type.toUpperCase(); - if (!isMethodProxySafe(method)) { - options.type = "POST"; - options.data.push({ name: "X-HTTP-Method-Override", value: method }); - } - - $.ajax(options); - } - - function validate(form) { - var validationInfo = $(form).data(data_validation); - return !validationInfo || !validationInfo.validate || validationInfo.validate(); - } - - $("a[data-ajax=true]").live("click", function (evt) { - evt.preventDefault(); - asyncRequest(this, { - url: this.href, - type: "GET", - data: [] - }); - }); - - $("form[data-ajax=true] input[type=image]").live("click", function (evt) { - var name = evt.target.name, - $target = $(evt.target), - form = $target.parents("form")[0], - offset = $target.offset(); - - $(form).data(data_click, [ - { name: name + ".x", value: Math.round(evt.pageX - offset.left) }, - { name: name + ".y", value: Math.round(evt.pageY - offset.top) } - ]); - - setTimeout(function () { - $(form).removeData(data_click); - }, 0); - }); - - $("form[data-ajax=true] :submit").live("click", function (evt) { - var name = evt.target.name, - form = $(evt.target).parents("form")[0]; - - $(form).data(data_click, name ? [{ name: name, value: evt.target.value }] : []); - - setTimeout(function () { - $(form).removeData(data_click); - }, 0); - }); - - $("form[data-ajax=true]").live("submit", function (evt) { - var clickInfo = $(this).data(data_click) || []; - evt.preventDefault(); - if (!validate(this)) { - return; - } - asyncRequest(this, { - url: this.action, - type: this.method || "GET", - data: clickInfo.concat($(this).serializeArray()) - }); - }); -}(jQuery)); \ No newline at end of file diff --git a/NzbDrone.Web/Scripts2/jquery.validate-vsdoc.js b/NzbDrone.Web/Scripts2/jquery.validate-vsdoc.js deleted file mode 100644 index cd62a6a75..000000000 --- a/NzbDrone.Web/Scripts2/jquery.validate-vsdoc.js +++ /dev/null @@ -1,1291 +0,0 @@ -/* -* This file has been commented to support Visual Studio Intellisense. -* You should not use this file at runtime inside the browser--it is only -* intended to be used only for design-time IntelliSense. Please use the -* standard jQuery library for all production use. -* -* Comment version: 1.10.0 -*/ - -/* -* Note: While Microsoft is not the author of this file, Microsoft is -* offering you a license subject to the terms of the Microsoft Software -* License Terms for Microsoft ASP.NET Model View Controller 3. -* Microsoft reserves all other rights. The notices below are provided -* for informational purposes only and are not the license terms under -* which Microsoft distributed this file. -* -* jQuery validation plugin 1.10.0 -* -* http://bassistance.de/jquery-plugins/jquery-plugin-validation/ -* http://docs.jquery.com/Plugins/Validation -* -* Copyright (c) 2006 - 2011 Jörn Zaefferer -* -*/ - -(function($) { - -$.extend($.fn, { - // http://docs.jquery.com/Plugins/Validation/validate - validate: function( options ) { - /// - /// Validates the selected form. This method sets up event handlers for submit, focus, - /// keyup, blur and click to trigger validation of the entire form or individual - /// elements. Each one can be disabled, see the onxxx options (onsubmit, onfocusout, - /// onkeyup, onclick). focusInvalid focuses elements when submitting a invalid form. - /// - /// - /// A set of key/value pairs that configure the validate. All options are optional. - /// - - // if nothing is selected, return nothing; can't chain anyway - if (!this.length) { - options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" ); - return; - } - - // check if a validator for this form was already created - var validator = $.data(this[0], 'validator'); - if ( validator ) { - return validator; - } - - validator = new $.validator( options, this[0] ); - $.data(this[0], 'validator', validator); - - if ( validator.settings.onsubmit ) { - - // allow suppresing validation by adding a cancel class to the submit button - this.find("input, button").filter(".cancel").click(function() { - validator.cancelSubmit = true; - }); - - // when a submitHandler is used, capture the submitting button - if (validator.settings.submitHandler) { - this.find("input, button").filter(":submit").click(function() { - validator.submitButton = this; - }); - } - - // validate the form on submit - this.submit( function( event ) { - if ( validator.settings.debug ) - // prevent form submit to be able to see console output - event.preventDefault(); - - function handle() { - if ( validator.settings.submitHandler ) { - if (validator.submitButton) { - // insert a hidden input as a replacement for the missing submit button - var hidden = $("").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm); - } - validator.settings.submitHandler.call( validator, validator.currentForm ); - if (validator.submitButton) { - // and clean up afterwards; thanks to no-block-scope, hidden can be referenced - hidden.remove(); - } - return false; - } - return true; - } - - // prevent submit for invalid forms or custom submit handlers - if ( validator.cancelSubmit ) { - validator.cancelSubmit = false; - return handle(); - } - if ( validator.form() ) { - if ( validator.pendingRequest ) { - validator.formSubmitted = true; - return false; - } - return handle(); - } else { - validator.focusInvalid(); - return false; - } - }); - } - - return validator; - }, - // http://docs.jquery.com/Plugins/Validation/valid - valid: function() { - /// - /// Checks if the selected form is valid or if all selected elements are valid. - /// validate() needs to be called on the form before checking it using this method. - /// - /// - - if ( $(this[0]).is('form')) { - return this.validate().form(); - } else { - var valid = true; - var validator = $(this[0].form).validate(); - this.each(function() { - valid &= validator.element(this); - }); - return valid; - } - }, - // attributes: space seperated list of attributes to retrieve and remove - removeAttrs: function(attributes) { - /// - /// Remove the specified attributes from the first matched element and return them. - /// - /// - /// A space-seperated list of attribute names to remove. - /// - - var result = {}, - $element = this; - $.each(attributes.split(/\s/), function(index, value) { - result[value] = $element.attr(value); - $element.removeAttr(value); - }); - return result; - }, - // http://docs.jquery.com/Plugins/Validation/rules - rules: function(command, argument) { - /// - /// Return the validations rules for the first selected element. - /// - /// - /// Can be either "add" or "remove". - /// - /// - /// A list of rules to add or remove. - /// - - var element = this[0]; - - if (command) { - var settings = $.data(element.form, 'validator').settings; - var staticRules = settings.rules; - var existingRules = $.validator.staticRules(element); - switch(command) { - case "add": - $.extend(existingRules, $.validator.normalizeRule(argument)); - staticRules[element.name] = existingRules; - if (argument.messages) - settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages ); - break; - case "remove": - if (!argument) { - delete staticRules[element.name]; - return existingRules; - } - var filtered = {}; - $.each(argument.split(/\s/), function(index, method) { - filtered[method] = existingRules[method]; - delete existingRules[method]; - }); - return filtered; - } - } - - var data = $.validator.normalizeRules( - $.extend( - {}, - $.validator.metadataRules(element), - $.validator.classRules(element), - $.validator.attributeRules(element), - $.validator.staticRules(element) - ), element); - - // make sure required is at front - if (data.required) { - var param = data.required; - delete data.required; - data = $.extend({required: param}, data); - } - - return data; - } -}); - -// Custom selectors -$.extend($.expr[":"], { - // http://docs.jquery.com/Plugins/Validation/blank - blank: function(a) {return !$.trim("" + a.value);}, - // http://docs.jquery.com/Plugins/Validation/filled - filled: function(a) {return !!$.trim("" + a.value);}, - // http://docs.jquery.com/Plugins/Validation/unchecked - unchecked: function(a) {return !a.checked;} -}); - -// constructor for validator -$.validator = function( options, form ) { - this.settings = $.extend( true, {}, $.validator.defaults, options ); - this.currentForm = form; - this.init(); -}; - -$.validator.format = function(source, params) { - /// - /// Replaces {n} placeholders with arguments. - /// One or more arguments can be passed, in addition to the string template itself, to insert - /// into the string. - /// - /// - /// The string to format. - /// - /// - /// The first argument to insert, or an array of Strings to insert - /// - /// - - if ( arguments.length == 1 ) - return function() { - var args = $.makeArray(arguments); - args.unshift(source); - return $.validator.format.apply( this, args ); - }; - if ( arguments.length > 2 && params.constructor != Array ) { - params = $.makeArray(arguments).slice(1); - } - if ( params.constructor != Array ) { - params = [ params ]; - } - $.each(params, function(i, n) { - source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n); - }); - return source; -}; - -$.extend($.validator, { - - defaults: { - messages: {}, - groups: {}, - rules: {}, - errorClass: "error", - validClass: "valid", - errorElement: "label", - focusInvalid: true, - errorContainer: $( [] ), - errorLabelContainer: $( [] ), - onsubmit: true, - ignore: [], - ignoreTitle: false, - onfocusin: function(element) { - this.lastActive = element; - - // hide error label and remove error class on focus if enabled - if ( this.settings.focusCleanup && !this.blockFocusCleanup ) { - this.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); - this.addWrapper(this.errorsFor(element)).hide(); - } - }, - onfocusout: function(element) { - if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) { - this.element(element); - } - }, - onkeyup: function(element) { - if ( element.name in this.submitted || element == this.lastElement ) { - this.element(element); - } - }, - onclick: function(element) { - // click on selects, radiobuttons and checkboxes - if ( element.name in this.submitted ) - this.element(element); - // or option elements, check parent select in that case - else if (element.parentNode.name in this.submitted) - this.element(element.parentNode); - }, - highlight: function( element, errorClass, validClass ) { - $(element).addClass(errorClass).removeClass(validClass); - }, - unhighlight: function( element, errorClass, validClass ) { - $(element).removeClass(errorClass).addClass(validClass); - } - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults - setDefaults: function(settings) { - /// - /// Modify default settings for validation. - /// Accepts everything that Plugins/Validation/validate accepts. - /// - /// - /// Options to set as default. - /// - - $.extend( $.validator.defaults, settings ); - }, - - messages: { - required: "This field is required.", - remote: "Please fix this field.", - email: "Please enter a valid email address.", - url: "Please enter a valid URL.", - date: "Please enter a valid date.", - dateISO: "Please enter a valid date (ISO).", - number: "Please enter a valid number.", - digits: "Please enter only digits.", - creditcard: "Please enter a valid credit card number.", - equalTo: "Please enter the same value again.", - accept: "Please enter a value with a valid extension.", - maxlength: $.validator.format("Please enter no more than {0} characters."), - minlength: $.validator.format("Please enter at least {0} characters."), - rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), - range: $.validator.format("Please enter a value between {0} and {1}."), - max: $.validator.format("Please enter a value less than or equal to {0}."), - min: $.validator.format("Please enter a value greater than or equal to {0}.") - }, - - autoCreateRanges: false, - - prototype: { - - init: function() { - this.labelContainer = $(this.settings.errorLabelContainer); - this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); - this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer ); - this.submitted = {}; - this.valueCache = {}; - this.pendingRequest = 0; - this.pending = {}; - this.invalid = {}; - this.reset(); - - var groups = (this.groups = {}); - $.each(this.settings.groups, function(key, value) { - $.each(value.split(/\s/), function(index, name) { - groups[name] = key; - }); - }); - var rules = this.settings.rules; - $.each(rules, function(key, value) { - rules[key] = $.validator.normalizeRule(value); - }); - - function delegate(event) { - var validator = $.data(this[0].form, "validator"), - eventType = "on" + event.type.replace(/^validate/, ""); - validator.settings[eventType] && validator.settings[eventType].call(validator, this[0] ); - } - $(this.currentForm) - .validateDelegate(":text, :password, :file, select, textarea", "focusin focusout keyup", delegate) - .validateDelegate(":radio, :checkbox, select, option", "click", delegate); - - if (this.settings.invalidHandler) - $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/form - form: function() { - /// - /// Validates the form, returns true if it is valid, false otherwise. - /// This behaves as a normal submit event, but returns the result. - /// - /// - - this.checkForm(); - $.extend(this.submitted, this.errorMap); - this.invalid = $.extend({}, this.errorMap); - if (!this.valid()) - $(this.currentForm).triggerHandler("invalid-form", [this]); - this.showErrors(); - return this.valid(); - }, - - checkForm: function() { - this.prepareForm(); - for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { - this.check( elements[i] ); - } - return this.valid(); - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/element - element: function( element ) { - /// - /// Validates a single element, returns true if it is valid, false otherwise. - /// This behaves as validation on blur or keyup, but returns the result. - /// - /// - /// An element to validate, must be inside the validated form. - /// - /// - - element = this.clean( element ); - this.lastElement = element; - this.prepareElement( element ); - this.currentElements = $(element); - var result = this.check( element ); - if ( result ) { - delete this.invalid[element.name]; - } else { - this.invalid[element.name] = true; - } - if ( !this.numberOfInvalids() ) { - // Hide error containers on last error - this.toHide = this.toHide.add( this.containers ); - } - this.showErrors(); - return result; - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/showErrors - showErrors: function(errors) { - /// - /// Show the specified messages. - /// Keys have to refer to the names of elements, values are displayed for those elements, using the configured error placement. - /// - /// - /// One or more key/value pairs of input names and messages. - /// - - if(errors) { - // add items to error list and map - $.extend( this.errorMap, errors ); - this.errorList = []; - for ( var name in errors ) { - this.errorList.push({ - message: errors[name], - element: this.findByName(name)[0] - }); - } - // remove items from success list - this.successList = $.grep( this.successList, function(element) { - return !(element.name in errors); - }); - } - this.settings.showErrors - ? this.settings.showErrors.call( this, this.errorMap, this.errorList ) - : this.defaultShowErrors(); - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/resetForm - resetForm: function() { - /// - /// Resets the controlled form. - /// Resets input fields to their original value (requires form plugin), removes classes - /// indicating invalid elements and hides error messages. - /// - - if ( $.fn.resetForm ) - $( this.currentForm ).resetForm(); - this.submitted = {}; - this.prepareForm(); - this.hideErrors(); - this.elements().removeClass( this.settings.errorClass ); - }, - - numberOfInvalids: function() { - /// - /// Returns the number of invalid fields. - /// This depends on the internal validator state. It covers all fields only after - /// validating the complete form (on submit or via $("form").valid()). After validating - /// a single element, only that element is counted. Most useful in combination with the - /// invalidHandler-option. - /// - /// - - return this.objectLength(this.invalid); - }, - - objectLength: function( obj ) { - var count = 0; - for ( var i in obj ) - count++; - return count; - }, - - hideErrors: function() { - this.addWrapper( this.toHide ).hide(); - }, - - valid: function() { - return this.size() == 0; - }, - - size: function() { - return this.errorList.length; - }, - - focusInvalid: function() { - if( this.settings.focusInvalid ) { - try { - $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []) - .filter(":visible") - .focus() - // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find - .trigger("focusin"); - } catch(e) { - // ignore IE throwing errors when focusing hidden elements - } - } - }, - - findLastActive: function() { - var lastActive = this.lastActive; - return lastActive && $.grep(this.errorList, function(n) { - return n.element.name == lastActive.name; - }).length == 1 && lastActive; - }, - - elements: function() { - var validator = this, - rulesCache = {}; - - // select all valid inputs inside the form (no submit or reset buttons) - // workaround $Query([]).add until http://dev.jquery.com/ticket/2114 is solved - return $([]).add(this.currentForm.elements) - .filter(":input") - .not(":submit, :reset, :image, [disabled]") - .not( this.settings.ignore ) - .filter(function() { - !this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this); - - // select only the first element for each name, and only those with rules specified - if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) - return false; - - rulesCache[this.name] = true; - return true; - }); - }, - - clean: function( selector ) { - return $( selector )[0]; - }, - - errors: function() { - return $( this.settings.errorElement + "." + this.settings.errorClass, this.errorContext ); - }, - - reset: function() { - this.successList = []; - this.errorList = []; - this.errorMap = {}; - this.toShow = $([]); - this.toHide = $([]); - this.currentElements = $([]); - }, - - prepareForm: function() { - this.reset(); - this.toHide = this.errors().add( this.containers ); - }, - - prepareElement: function( element ) { - this.reset(); - this.toHide = this.errorsFor(element); - }, - - check: function( element ) { - element = this.clean( element ); - - // if radio/checkbox, validate first element in group instead - if (this.checkable(element)) { - element = this.findByName(element.name).not(this.settings.ignore)[0]; - } - - var rules = $(element).rules(); - var dependencyMismatch = false; - for (var method in rules) { - var rule = { method: method, parameters: rules[method] }; - try { - var result = $.validator.methods[method].call( this, element.value.replace(/\r/g, ""), element, rule.parameters ); - - // if a method indicates that the field is optional and therefore valid, - // don't mark it as valid when there are no other rules - if ( result == "dependency-mismatch" ) { - dependencyMismatch = true; - continue; - } - dependencyMismatch = false; - - if ( result == "pending" ) { - this.toHide = this.toHide.not( this.errorsFor(element) ); - return; - } - - if( !result ) { - this.formatAndAdd( element, rule ); - return false; - } - } catch(e) { - this.settings.debug && window.console && console.log("exception occured when checking element " + element.id - + ", check the '" + rule.method + "' method", e); - throw e; - } - } - if (dependencyMismatch) - return; - if ( this.objectLength(rules) ) - this.successList.push(element); - return true; - }, - - // return the custom message for the given element and validation method - // specified in the element's "messages" metadata - customMetaMessage: function(element, method) { - if (!$.metadata) - return; - - var meta = this.settings.meta - ? $(element).metadata()[this.settings.meta] - : $(element).metadata(); - - return meta && meta.messages && meta.messages[method]; - }, - - // return the custom message for the given element name and validation method - customMessage: function( name, method ) { - var m = this.settings.messages[name]; - return m && (m.constructor == String - ? m - : m[method]); - }, - - // return the first defined argument, allowing empty strings - findDefined: function() { - for(var i = 0; i < arguments.length; i++) { - if (arguments[i] !== undefined) - return arguments[i]; - } - return undefined; - }, - - defaultMessage: function( element, method) { - return this.findDefined( - this.customMessage( element.name, method ), - this.customMetaMessage( element, method ), - // title is never undefined, so handle empty string as undefined - !this.settings.ignoreTitle && element.title || undefined, - $.validator.messages[method], - "Warning: No message defined for " + element.name + "" - ); - }, - - formatAndAdd: function( element, rule ) { - var message = this.defaultMessage( element, rule.method ), - theregex = /\$?\{(\d+)\}/g; - if ( typeof message == "function" ) { - message = message.call(this, rule.parameters, element); - } else if (theregex.test(message)) { - message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters); - } - this.errorList.push({ - message: message, - element: element - }); - - this.errorMap[element.name] = message; - this.submitted[element.name] = message; - }, - - addWrapper: function(toToggle) { - if ( this.settings.wrapper ) - toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); - return toToggle; - }, - - defaultShowErrors: function() { - for ( var i = 0; this.errorList[i]; i++ ) { - var error = this.errorList[i]; - this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass ); - this.showLabel( error.element, error.message ); - } - if( this.errorList.length ) { - this.toShow = this.toShow.add( this.containers ); - } - if (this.settings.success) { - for ( var i = 0; this.successList[i]; i++ ) { - this.showLabel( this.successList[i] ); - } - } - if (this.settings.unhighlight) { - for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) { - this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass ); - } - } - this.toHide = this.toHide.not( this.toShow ); - this.hideErrors(); - this.addWrapper( this.toShow ).show(); - }, - - validElements: function() { - return this.currentElements.not(this.invalidElements()); - }, - - invalidElements: function() { - return $(this.errorList).map(function() { - return this.element; - }); - }, - - showLabel: function(element, message) { - var label = this.errorsFor( element ); - if ( label.length ) { - // refresh error/success class - label.removeClass().addClass( this.settings.errorClass ); - - // check if we have a generated label, replace the message then - label.attr("generated") && label.html(message); - } else { - // create label - label = $("<" + this.settings.errorElement + "/>") - .attr({"for": this.idOrName(element), generated: true}) - .addClass(this.settings.errorClass) - .html(message || ""); - if ( this.settings.wrapper ) { - // make sure the element is visible, even in IE - // actually showing the wrapped element is handled elsewhere - label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); - } - if ( !this.labelContainer.append(label).length ) - this.settings.errorPlacement - ? this.settings.errorPlacement(label, $(element) ) - : label.insertAfter(element); - } - if ( !message && this.settings.success ) { - label.text(""); - typeof this.settings.success == "string" - ? label.addClass( this.settings.success ) - : this.settings.success( label ); - } - this.toShow = this.toShow.add(label); - }, - - errorsFor: function(element) { - var name = this.idOrName(element); - return this.errors().filter(function() { - return $(this).attr('for') == name; - }); - }, - - idOrName: function(element) { - return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name); - }, - - checkable: function( element ) { - return /radio|checkbox/i.test(element.type); - }, - - findByName: function( name ) { - // select by name and filter by form for performance over form.find("[name=...]") - var form = this.currentForm; - return $(document.getElementsByName(name)).map(function(index, element) { - return element.form == form && element.name == name && element || null; - }); - }, - - getLength: function(value, element) { - switch( element.nodeName.toLowerCase() ) { - case 'select': - return $("option:selected", element).length; - case 'input': - if( this.checkable( element) ) - return this.findByName(element.name).filter(':checked').length; - } - return value.length; - }, - - depend: function(param, element) { - return this.dependTypes[typeof param] - ? this.dependTypes[typeof param](param, element) - : true; - }, - - dependTypes: { - "boolean": function(param, element) { - return param; - }, - "string": function(param, element) { - return !!$(param, element.form).length; - }, - "function": function(param, element) { - return param(element); - } - }, - - optional: function(element) { - return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch"; - }, - - startRequest: function(element) { - if (!this.pending[element.name]) { - this.pendingRequest++; - this.pending[element.name] = true; - } - }, - - stopRequest: function(element, valid) { - this.pendingRequest--; - // sometimes synchronization fails, make sure pendingRequest is never < 0 - if (this.pendingRequest < 0) - this.pendingRequest = 0; - delete this.pending[element.name]; - if ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) { - $(this.currentForm).submit(); - this.formSubmitted = false; - } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) { - $(this.currentForm).triggerHandler("invalid-form", [this]); - this.formSubmitted = false; - } - }, - - previousValue: function(element) { - return $.data(element, "previousValue") || $.data(element, "previousValue", { - old: null, - valid: true, - message: this.defaultMessage( element, "remote" ) - }); - } - - }, - - classRuleSettings: { - required: {required: true}, - email: {email: true}, - url: {url: true}, - date: {date: true}, - dateISO: {dateISO: true}, - dateDE: {dateDE: true}, - number: {number: true}, - numberDE: {numberDE: true}, - digits: {digits: true}, - creditcard: {creditcard: true} - }, - - addClassRules: function(className, rules) { - /// - /// Add a compound class method - useful to refactor common combinations of rules into a single - /// class. - /// - /// - /// The name of the class rule to add - /// - /// - /// The compound rules - /// - - className.constructor == String ? - this.classRuleSettings[className] = rules : - $.extend(this.classRuleSettings, className); - }, - - classRules: function(element) { - var rules = {}; - var classes = $(element).attr('class'); - classes && $.each(classes.split(' '), function() { - if (this in $.validator.classRuleSettings) { - $.extend(rules, $.validator.classRuleSettings[this]); - } - }); - return rules; - }, - - attributeRules: function(element) { - var rules = {}; - var $element = $(element); - - for (var method in $.validator.methods) { - var value = $element.attr(method); - if (value) { - rules[method] = value; - } - } - - // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs - if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) { - delete rules.maxlength; - } - - return rules; - }, - - metadataRules: function(element) { - if (!$.metadata) return {}; - - var meta = $.data(element.form, 'validator').settings.meta; - return meta ? - $(element).metadata()[meta] : - $(element).metadata(); - }, - - staticRules: function(element) { - var rules = {}; - var validator = $.data(element.form, 'validator'); - if (validator.settings.rules) { - rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; - } - return rules; - }, - - normalizeRules: function(rules, element) { - // handle dependency check - $.each(rules, function(prop, val) { - // ignore rule when param is explicitly false, eg. required:false - if (val === false) { - delete rules[prop]; - return; - } - if (val.param || val.depends) { - var keepRule = true; - switch (typeof val.depends) { - case "string": - keepRule = !!$(val.depends, element.form).length; - break; - case "function": - keepRule = val.depends.call(element, element); - break; - } - if (keepRule) { - rules[prop] = val.param !== undefined ? val.param : true; - } else { - delete rules[prop]; - } - } - }); - - // evaluate parameters - $.each(rules, function(rule, parameter) { - rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; - }); - - // clean number parameters - $.each(['minlength', 'maxlength', 'min', 'max'], function() { - if (rules[this]) { - rules[this] = Number(rules[this]); - } - }); - $.each(['rangelength', 'range'], function() { - if (rules[this]) { - rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; - } - }); - - if ($.validator.autoCreateRanges) { - // auto-create ranges - if (rules.min && rules.max) { - rules.range = [rules.min, rules.max]; - delete rules.min; - delete rules.max; - } - if (rules.minlength && rules.maxlength) { - rules.rangelength = [rules.minlength, rules.maxlength]; - delete rules.minlength; - delete rules.maxlength; - } - } - - // To support custom messages in metadata ignore rule methods titled "messages" - if (rules.messages) { - delete rules.messages; - } - - return rules; - }, - - // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} - normalizeRule: function(data) { - if( typeof data == "string" ) { - var transformed = {}; - $.each(data.split(/\s/), function() { - transformed[this] = true; - }); - data = transformed; - } - return data; - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/addMethod - addMethod: function(name, method, message) { - /// - /// Add a custom validation method. It must consist of a name (must be a legal javascript - /// identifier), a javascript based function and a default string message. - /// - /// - /// The name of the method, used to identify and referencing it, must be a valid javascript - /// identifier - /// - /// - /// The actual method implementation, returning true if an element is valid - /// - /// - /// (Optional) The default message to display for this method. Can be a function created by - /// jQuery.validator.format(value). When undefined, an already existing message is used - /// (handy for localization), otherwise the field-specific messages have to be defined. - /// - - $.validator.methods[name] = method; - $.validator.messages[name] = message != undefined ? message : $.validator.messages[name]; - if (method.length < 3) { - $.validator.addClassRules(name, $.validator.normalizeRule(name)); - } - }, - - methods: { - - // http://docs.jquery.com/Plugins/Validation/Methods/required - required: function(value, element, param) { - // check if dependency is met - if ( !this.depend(param, element) ) - return "dependency-mismatch"; - switch( element.nodeName.toLowerCase() ) { - case 'select': - // could be an array for select-multiple or a string, both are fine this way - var val = $(element).val(); - return val && val.length > 0; - case 'input': - if ( this.checkable(element) ) - return this.getLength(value, element) > 0; - default: - return $.trim(value).length > 0; - } - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/remote - remote: function(value, element, param) { - if ( this.optional(element) ) - return "dependency-mismatch"; - - var previous = this.previousValue(element); - if (!this.settings.messages[element.name] ) - this.settings.messages[element.name] = {}; - previous.originalMessage = this.settings.messages[element.name].remote; - this.settings.messages[element.name].remote = previous.message; - - param = typeof param == "string" && {url:param} || param; - - if ( this.pending[element.name] ) { - return "pending"; - } - if ( previous.old === value ) { - return previous.valid; - } - - previous.old = value; - var validator = this; - this.startRequest(element); - var data = {}; - data[element.name] = value; - $.ajax($.extend(true, { - url: param, - mode: "abort", - port: "validate" + element.name, - dataType: "json", - data: data, - success: function(response) { - validator.settings.messages[element.name].remote = previous.originalMessage; - var valid = response === true; - if ( valid ) { - var submitted = validator.formSubmitted; - validator.prepareElement(element); - validator.formSubmitted = submitted; - validator.successList.push(element); - validator.showErrors(); - } else { - var errors = {}; - var message = response || validator.defaultMessage(element, "remote"); - errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; - validator.showErrors(errors); - } - previous.valid = valid; - validator.stopRequest(element, valid); - } - }, param)); - return "pending"; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/minlength - minlength: function(value, element, param) { - return this.optional(element) || this.getLength($.trim(value), element) >= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/maxlength - maxlength: function(value, element, param) { - return this.optional(element) || this.getLength($.trim(value), element) <= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/rangelength - rangelength: function(value, element, param) { - var length = this.getLength($.trim(value), element); - return this.optional(element) || ( length >= param[0] && length <= param[1] ); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/min - min: function( value, element, param ) { - return this.optional(element) || value >= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/max - max: function( value, element, param ) { - return this.optional(element) || value <= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/range - range: function( value, element, param ) { - return this.optional(element) || ( value >= param[0] && value <= param[1] ); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/email - email: function(value, element) { - // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ - return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/url - url: function(value, element) { - // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ - return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/date - date: function(value, element) { - return this.optional(element) || !/Invalid|NaN/.test(new Date(value)); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/dateISO - dateISO: function(value, element) { - return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/number - number: function(value, element) { - return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/digits - digits: function(value, element) { - return this.optional(element) || /^\d+$/.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/creditcard - // based on http://en.wikipedia.org/wiki/Luhn - creditcard: function(value, element) { - if ( this.optional(element) ) - return "dependency-mismatch"; - // accept only digits and dashes - if (/[^0-9-]+/.test(value)) - return false; - var nCheck = 0, - nDigit = 0, - bEven = false; - - value = value.replace(/\D/g, ""); - - for (var n = value.length - 1; n >= 0; n--) { - var cDigit = value.charAt(n); - var nDigit = parseInt(cDigit, 10); - if (bEven) { - if ((nDigit *= 2) > 9) - nDigit -= 9; - } - nCheck += nDigit; - bEven = !bEven; - } - - return (nCheck % 10) == 0; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/accept - accept: function(value, element, param) { - param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif"; - return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i")); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/equalTo - equalTo: function(value, element, param) { - // bind to the blur event of the target in order to revalidate whenever the target field is updated - // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead - var target = $(param).unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { - $(element).valid(); - }); - return value == target.val(); - } - - } - -}); - -// deprecated, use $.validator.format instead -$.format = $.validator.format; - -})(jQuery); - -// ajax mode: abort -// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); -// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() -;(function($) { - var pendingRequests = {}; - // Use a prefilter if available (1.5+) - if ( $.ajaxPrefilter ) { - $.ajaxPrefilter(function(settings, _, xhr) { - var port = settings.port; - if (settings.mode == "abort") { - if ( pendingRequests[port] ) { - pendingRequests[port].abort(); - } pendingRequests[port] = xhr; - } - }); - } else { - // Proxy ajax - var ajax = $.ajax; - $.ajax = function(settings) { - var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, - port = ( "port" in settings ? settings : $.ajaxSettings ).port; - if (mode == "abort") { - if ( pendingRequests[port] ) { - pendingRequests[port].abort(); - } - - return (pendingRequests[port] = ajax.apply(this, arguments)); - } - return ajax.apply(this, arguments); - }; - } -})(jQuery); - -// provides cross-browser focusin and focusout events -// IE has native support, in other browsers, use event caputuring (neither bubbles) - -// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation -// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target -;(function($) { - // only implement if not provided by jQuery core (since 1.4) - // TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs - if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) { - $.each({ - focus: 'focusin', - blur: 'focusout' - }, function( original, fix ){ - $.event.special[fix] = { - setup:function() { - this.addEventListener( original, handler, true ); - }, - teardown:function() { - this.removeEventListener( original, handler, true ); - }, - handler: function(e) { - arguments[0] = $.event.fix(e); - arguments[0].type = fix; - return $.event.handle.apply(this, arguments); - } - }; - function handler(e) { - e = $.event.fix(e); - e.type = fix; - return $.event.handle.call(this, e); - } - }); - }; - $.extend($.fn, { - validateDelegate: function(delegate, type, handler) { - return this.bind(type, function(event) { - var target = $(event.target); - if (target.is(delegate)) { - return handler.apply(target, arguments); - } - }); - } - }); -})(jQuery); diff --git a/NzbDrone.Web/Scripts2/jquery.validate.js b/NzbDrone.Web/Scripts2/jquery.validate.js deleted file mode 100644 index 0dbb7e444..000000000 --- a/NzbDrone.Web/Scripts2/jquery.validate.js +++ /dev/null @@ -1,1248 +0,0 @@ -/*! jQuery Validation Plugin - v1.10.0 - 9/7/2012 -* https://github.com/jzaefferer/jquery-validation -* Copyright (c) 2012 Jörn Zaefferer; Licensed MIT */ - -(function($) { - -$.extend($.fn, { - // http://docs.jquery.com/Plugins/Validation/validate - validate: function( options ) { - - // if nothing is selected, return nothing; can't chain anyway - if (!this.length) { - if (options && options.debug && window.console) { - console.warn( "nothing selected, can't validate, returning nothing" ); - } - return; - } - - // check if a validator for this form was already created - var validator = $.data(this[0], 'validator'); - if ( validator ) { - return validator; - } - - // Add novalidate tag if HTML5. - this.attr('novalidate', 'novalidate'); - - validator = new $.validator( options, this[0] ); - $.data(this[0], 'validator', validator); - - if ( validator.settings.onsubmit ) { - - this.validateDelegate( ":submit", "click", function(ev) { - if ( validator.settings.submitHandler ) { - validator.submitButton = ev.target; - } - // allow suppressing validation by adding a cancel class to the submit button - if ( $(ev.target).hasClass('cancel') ) { - validator.cancelSubmit = true; - } - }); - - // validate the form on submit - this.submit( function( event ) { - if ( validator.settings.debug ) { - // prevent form submit to be able to see console output - event.preventDefault(); - } - function handle() { - var hidden; - if ( validator.settings.submitHandler ) { - if (validator.submitButton) { - // insert a hidden input as a replacement for the missing submit button - hidden = $("").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm); - } - validator.settings.submitHandler.call( validator, validator.currentForm, event ); - if (validator.submitButton) { - // and clean up afterwards; thanks to no-block-scope, hidden can be referenced - hidden.remove(); - } - return false; - } - return true; - } - - // prevent submit for invalid forms or custom submit handlers - if ( validator.cancelSubmit ) { - validator.cancelSubmit = false; - return handle(); - } - if ( validator.form() ) { - if ( validator.pendingRequest ) { - validator.formSubmitted = true; - return false; - } - return handle(); - } else { - validator.focusInvalid(); - return false; - } - }); - } - - return validator; - }, - // http://docs.jquery.com/Plugins/Validation/valid - valid: function() { - if ( $(this[0]).is('form')) { - return this.validate().form(); - } else { - var valid = true; - var validator = $(this[0].form).validate(); - this.each(function() { - valid &= validator.element(this); - }); - return valid; - } - }, - // attributes: space seperated list of attributes to retrieve and remove - removeAttrs: function(attributes) { - var result = {}, - $element = this; - $.each(attributes.split(/\s/), function(index, value) { - result[value] = $element.attr(value); - $element.removeAttr(value); - }); - return result; - }, - // http://docs.jquery.com/Plugins/Validation/rules - rules: function(command, argument) { - var element = this[0]; - - if (command) { - var settings = $.data(element.form, 'validator').settings; - var staticRules = settings.rules; - var existingRules = $.validator.staticRules(element); - switch(command) { - case "add": - $.extend(existingRules, $.validator.normalizeRule(argument)); - staticRules[element.name] = existingRules; - if (argument.messages) { - settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages ); - } - break; - case "remove": - if (!argument) { - delete staticRules[element.name]; - return existingRules; - } - var filtered = {}; - $.each(argument.split(/\s/), function(index, method) { - filtered[method] = existingRules[method]; - delete existingRules[method]; - }); - return filtered; - } - } - - var data = $.validator.normalizeRules( - $.extend( - {}, - $.validator.metadataRules(element), - $.validator.classRules(element), - $.validator.attributeRules(element), - $.validator.staticRules(element) - ), element); - - // make sure required is at front - if (data.required) { - var param = data.required; - delete data.required; - data = $.extend({required: param}, data); - } - - return data; - } -}); - -// Custom selectors -$.extend($.expr[":"], { - // http://docs.jquery.com/Plugins/Validation/blank - blank: function(a) {return !$.trim("" + a.value);}, - // http://docs.jquery.com/Plugins/Validation/filled - filled: function(a) {return !!$.trim("" + a.value);}, - // http://docs.jquery.com/Plugins/Validation/unchecked - unchecked: function(a) {return !a.checked;} -}); - -// constructor for validator -$.validator = function( options, form ) { - this.settings = $.extend( true, {}, $.validator.defaults, options ); - this.currentForm = form; - this.init(); -}; - -$.validator.format = function(source, params) { - if ( arguments.length === 1 ) { - return function() { - var args = $.makeArray(arguments); - args.unshift(source); - return $.validator.format.apply( this, args ); - }; - } - if ( arguments.length > 2 && params.constructor !== Array ) { - params = $.makeArray(arguments).slice(1); - } - if ( params.constructor !== Array ) { - params = [ params ]; - } - $.each(params, function(i, n) { - source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n); - }); - return source; -}; - -$.extend($.validator, { - - defaults: { - messages: {}, - groups: {}, - rules: {}, - errorClass: "error", - validClass: "valid", - errorElement: "label", - focusInvalid: true, - errorContainer: $( [] ), - errorLabelContainer: $( [] ), - onsubmit: true, - ignore: ":hidden", - ignoreTitle: false, - onfocusin: function(element, event) { - this.lastActive = element; - - // hide error label and remove error class on focus if enabled - if ( this.settings.focusCleanup && !this.blockFocusCleanup ) { - if ( this.settings.unhighlight ) { - this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); - } - this.addWrapper(this.errorsFor(element)).hide(); - } - }, - onfocusout: function(element, event) { - if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) { - this.element(element); - } - }, - onkeyup: function(element, event) { - if ( event.which === 9 && this.elementValue(element) === '' ) { - return; - } else if ( element.name in this.submitted || element === this.lastActive ) { - this.element(element); - } - }, - onclick: function(element, event) { - // click on selects, radiobuttons and checkboxes - if ( element.name in this.submitted ) { - this.element(element); - } - // or option elements, check parent select in that case - else if (element.parentNode.name in this.submitted) { - this.element(element.parentNode); - } - }, - highlight: function(element, errorClass, validClass) { - if (element.type === 'radio') { - this.findByName(element.name).addClass(errorClass).removeClass(validClass); - } else { - $(element).addClass(errorClass).removeClass(validClass); - } - }, - unhighlight: function(element, errorClass, validClass) { - if (element.type === 'radio') { - this.findByName(element.name).removeClass(errorClass).addClass(validClass); - } else { - $(element).removeClass(errorClass).addClass(validClass); - } - } - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults - setDefaults: function(settings) { - $.extend( $.validator.defaults, settings ); - }, - - messages: { - required: "This field is required.", - remote: "Please fix this field.", - email: "Please enter a valid email address.", - url: "Please enter a valid URL.", - date: "Please enter a valid date.", - dateISO: "Please enter a valid date (ISO).", - number: "Please enter a valid number.", - digits: "Please enter only digits.", - creditcard: "Please enter a valid credit card number.", - equalTo: "Please enter the same value again.", - maxlength: $.validator.format("Please enter no more than {0} characters."), - minlength: $.validator.format("Please enter at least {0} characters."), - rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), - range: $.validator.format("Please enter a value between {0} and {1}."), - max: $.validator.format("Please enter a value less than or equal to {0}."), - min: $.validator.format("Please enter a value greater than or equal to {0}.") - }, - - autoCreateRanges: false, - - prototype: { - - init: function() { - this.labelContainer = $(this.settings.errorLabelContainer); - this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); - this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer ); - this.submitted = {}; - this.valueCache = {}; - this.pendingRequest = 0; - this.pending = {}; - this.invalid = {}; - this.reset(); - - var groups = (this.groups = {}); - $.each(this.settings.groups, function(key, value) { - $.each(value.split(/\s/), function(index, name) { - groups[name] = key; - }); - }); - var rules = this.settings.rules; - $.each(rules, function(key, value) { - rules[key] = $.validator.normalizeRule(value); - }); - - function delegate(event) { - var validator = $.data(this[0].form, "validator"), - eventType = "on" + event.type.replace(/^validate/, ""); - if (validator.settings[eventType]) { - validator.settings[eventType].call(validator, this[0], event); - } - } - $(this.currentForm) - .validateDelegate(":text, [type='password'], [type='file'], select, textarea, " + - "[type='number'], [type='search'] ,[type='tel'], [type='url'], " + - "[type='email'], [type='datetime'], [type='date'], [type='month'], " + - "[type='week'], [type='time'], [type='datetime-local'], " + - "[type='range'], [type='color'] ", - "focusin focusout keyup", delegate) - .validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate); - - if (this.settings.invalidHandler) { - $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); - } - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/form - form: function() { - this.checkForm(); - $.extend(this.submitted, this.errorMap); - this.invalid = $.extend({}, this.errorMap); - if (!this.valid()) { - $(this.currentForm).triggerHandler("invalid-form", [this]); - } - this.showErrors(); - return this.valid(); - }, - - checkForm: function() { - this.prepareForm(); - for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { - this.check( elements[i] ); - } - return this.valid(); - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/element - element: function( element ) { - element = this.validationTargetFor( this.clean( element ) ); - this.lastElement = element; - this.prepareElement( element ); - this.currentElements = $(element); - var result = this.check( element ) !== false; - if (result) { - delete this.invalid[element.name]; - } else { - this.invalid[element.name] = true; - } - if ( !this.numberOfInvalids() ) { - // Hide error containers on last error - this.toHide = this.toHide.add( this.containers ); - } - this.showErrors(); - return result; - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/showErrors - showErrors: function(errors) { - if(errors) { - // add items to error list and map - $.extend( this.errorMap, errors ); - this.errorList = []; - for ( var name in errors ) { - this.errorList.push({ - message: errors[name], - element: this.findByName(name)[0] - }); - } - // remove items from success list - this.successList = $.grep( this.successList, function(element) { - return !(element.name in errors); - }); - } - if (this.settings.showErrors) { - this.settings.showErrors.call( this, this.errorMap, this.errorList ); - } else { - this.defaultShowErrors(); - } - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/resetForm - resetForm: function() { - if ( $.fn.resetForm ) { - $( this.currentForm ).resetForm(); - } - this.submitted = {}; - this.lastElement = null; - this.prepareForm(); - this.hideErrors(); - this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" ); - }, - - numberOfInvalids: function() { - return this.objectLength(this.invalid); - }, - - objectLength: function( obj ) { - var count = 0; - for ( var i in obj ) { - count++; - } - return count; - }, - - hideErrors: function() { - this.addWrapper( this.toHide ).hide(); - }, - - valid: function() { - return this.size() === 0; - }, - - size: function() { - return this.errorList.length; - }, - - focusInvalid: function() { - if( this.settings.focusInvalid ) { - try { - $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []) - .filter(":visible") - .focus() - // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find - .trigger("focusin"); - } catch(e) { - // ignore IE throwing errors when focusing hidden elements - } - } - }, - - findLastActive: function() { - var lastActive = this.lastActive; - return lastActive && $.grep(this.errorList, function(n) { - return n.element.name === lastActive.name; - }).length === 1 && lastActive; - }, - - elements: function() { - var validator = this, - rulesCache = {}; - - // select all valid inputs inside the form (no submit or reset buttons) - return $(this.currentForm) - .find("input, select, textarea") - .not(":submit, :reset, :image, [disabled]") - .not( this.settings.ignore ) - .filter(function() { - if ( !this.name && validator.settings.debug && window.console ) { - console.error( "%o has no name assigned", this); - } - - // select only the first element for each name, and only those with rules specified - if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) { - return false; - } - - rulesCache[this.name] = true; - return true; - }); - }, - - clean: function( selector ) { - return $( selector )[0]; - }, - - errors: function() { - var errorClass = this.settings.errorClass.replace(' ', '.'); - return $( this.settings.errorElement + "." + errorClass, this.errorContext ); - }, - - reset: function() { - this.successList = []; - this.errorList = []; - this.errorMap = {}; - this.toShow = $([]); - this.toHide = $([]); - this.currentElements = $([]); - }, - - prepareForm: function() { - this.reset(); - this.toHide = this.errors().add( this.containers ); - }, - - prepareElement: function( element ) { - this.reset(); - this.toHide = this.errorsFor(element); - }, - - elementValue: function( element ) { - var type = $(element).attr('type'), - val = $(element).val(); - - if ( type === 'radio' || type === 'checkbox' ) { - return $('input[name="' + $(element).attr('name') + '"]:checked').val(); - } - - if ( typeof val === 'string' ) { - return val.replace(/\r/g, ""); - } - return val; - }, - - check: function( element ) { - element = this.validationTargetFor( this.clean( element ) ); - - var rules = $(element).rules(); - var dependencyMismatch = false; - var val = this.elementValue(element); - var result; - - for (var method in rules ) { - var rule = { method: method, parameters: rules[method] }; - try { - - result = $.validator.methods[method].call( this, val, element, rule.parameters ); - - // if a method indicates that the field is optional and therefore valid, - // don't mark it as valid when there are no other rules - if ( result === "dependency-mismatch" ) { - dependencyMismatch = true; - continue; - } - dependencyMismatch = false; - - if ( result === "pending" ) { - this.toHide = this.toHide.not( this.errorsFor(element) ); - return; - } - - if( !result ) { - this.formatAndAdd( element, rule ); - return false; - } - } catch(e) { - if ( this.settings.debug && window.console ) { - console.log("exception occured when checking element " + element.id + ", check the '" + rule.method + "' method", e); - } - throw e; - } - } - if (dependencyMismatch) { - return; - } - if ( this.objectLength(rules) ) { - this.successList.push(element); - } - return true; - }, - - // return the custom message for the given element and validation method - // specified in the element's "messages" metadata - customMetaMessage: function(element, method) { - if (!$.metadata) { - return; - } - var meta = this.settings.meta ? $(element).metadata()[this.settings.meta] : $(element).metadata(); - return meta && meta.messages && meta.messages[method]; - }, - - // return the custom message for the given element and validation method - // specified in the element's HTML5 data attribute - customDataMessage: function(element, method) { - return $(element).data('msg-' + method.toLowerCase()) || (element.attributes && $(element).attr('data-msg-' + method.toLowerCase())); - }, - - // return the custom message for the given element name and validation method - customMessage: function( name, method ) { - var m = this.settings.messages[name]; - return m && (m.constructor === String ? m : m[method]); - }, - - // return the first defined argument, allowing empty strings - findDefined: function() { - for(var i = 0; i < arguments.length; i++) { - if (arguments[i] !== undefined) { - return arguments[i]; - } - } - return undefined; - }, - - defaultMessage: function( element, method) { - return this.findDefined( - this.customMessage( element.name, method ), - this.customDataMessage( element, method ), - this.customMetaMessage( element, method ), - // title is never undefined, so handle empty string as undefined - !this.settings.ignoreTitle && element.title || undefined, - $.validator.messages[method], - "Warning: No message defined for " + element.name + "" - ); - }, - - formatAndAdd: function( element, rule ) { - var message = this.defaultMessage( element, rule.method ), - theregex = /\$?\{(\d+)\}/g; - if ( typeof message === "function" ) { - message = message.call(this, rule.parameters, element); - } else if (theregex.test(message)) { - message = $.validator.format(message.replace(theregex, '{$1}'), rule.parameters); - } - this.errorList.push({ - message: message, - element: element - }); - - this.errorMap[element.name] = message; - this.submitted[element.name] = message; - }, - - addWrapper: function(toToggle) { - if ( this.settings.wrapper ) { - toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); - } - return toToggle; - }, - - defaultShowErrors: function() { - var i, elements; - for ( i = 0; this.errorList[i]; i++ ) { - var error = this.errorList[i]; - if ( this.settings.highlight ) { - this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass ); - } - this.showLabel( error.element, error.message ); - } - if( this.errorList.length ) { - this.toShow = this.toShow.add( this.containers ); - } - if (this.settings.success) { - for ( i = 0; this.successList[i]; i++ ) { - this.showLabel( this.successList[i] ); - } - } - if (this.settings.unhighlight) { - for ( i = 0, elements = this.validElements(); elements[i]; i++ ) { - this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass ); - } - } - this.toHide = this.toHide.not( this.toShow ); - this.hideErrors(); - this.addWrapper( this.toShow ).show(); - }, - - validElements: function() { - return this.currentElements.not(this.invalidElements()); - }, - - invalidElements: function() { - return $(this.errorList).map(function() { - return this.element; - }); - }, - - showLabel: function(element, message) { - var label = this.errorsFor( element ); - if ( label.length ) { - // refresh error/success class - label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass ); - - // check if we have a generated label, replace the message then - if ( label.attr("generated") ) { - label.html(message); - } - } else { - // create label - label = $("<" + this.settings.errorElement + "/>") - .attr({"for": this.idOrName(element), generated: true}) - .addClass(this.settings.errorClass) - .html(message || ""); - if ( this.settings.wrapper ) { - // make sure the element is visible, even in IE - // actually showing the wrapped element is handled elsewhere - label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); - } - if ( !this.labelContainer.append(label).length ) { - if ( this.settings.errorPlacement ) { - this.settings.errorPlacement(label, $(element) ); - } else { - label.insertAfter(element); - } - } - } - if ( !message && this.settings.success ) { - label.text(""); - if ( typeof this.settings.success === "string" ) { - label.addClass( this.settings.success ); - } else { - this.settings.success( label, element ); - } - } - this.toShow = this.toShow.add(label); - }, - - errorsFor: function(element) { - var name = this.idOrName(element); - return this.errors().filter(function() { - return $(this).attr('for') === name; - }); - }, - - idOrName: function(element) { - return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name); - }, - - validationTargetFor: function(element) { - // if radio/checkbox, validate first element in group instead - if (this.checkable(element)) { - element = this.findByName( element.name ).not(this.settings.ignore)[0]; - } - return element; - }, - - checkable: function( element ) { - return (/radio|checkbox/i).test(element.type); - }, - - findByName: function( name ) { - return $(this.currentForm).find('[name="' + name + '"]'); - }, - - getLength: function(value, element) { - switch( element.nodeName.toLowerCase() ) { - case 'select': - return $("option:selected", element).length; - case 'input': - if( this.checkable( element) ) { - return this.findByName(element.name).filter(':checked').length; - } - } - return value.length; - }, - - depend: function(param, element) { - return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true; - }, - - dependTypes: { - "boolean": function(param, element) { - return param; - }, - "string": function(param, element) { - return !!$(param, element.form).length; - }, - "function": function(param, element) { - return param(element); - } - }, - - optional: function(element) { - var val = this.elementValue(element); - return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch"; - }, - - startRequest: function(element) { - if (!this.pending[element.name]) { - this.pendingRequest++; - this.pending[element.name] = true; - } - }, - - stopRequest: function(element, valid) { - this.pendingRequest--; - // sometimes synchronization fails, make sure pendingRequest is never < 0 - if (this.pendingRequest < 0) { - this.pendingRequest = 0; - } - delete this.pending[element.name]; - if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { - $(this.currentForm).submit(); - this.formSubmitted = false; - } else if (!valid && this.pendingRequest === 0 && this.formSubmitted) { - $(this.currentForm).triggerHandler("invalid-form", [this]); - this.formSubmitted = false; - } - }, - - previousValue: function(element) { - return $.data(element, "previousValue") || $.data(element, "previousValue", { - old: null, - valid: true, - message: this.defaultMessage( element, "remote" ) - }); - } - - }, - - classRuleSettings: { - required: {required: true}, - email: {email: true}, - url: {url: true}, - date: {date: true}, - dateISO: {dateISO: true}, - number: {number: true}, - digits: {digits: true}, - creditcard: {creditcard: true} - }, - - addClassRules: function(className, rules) { - if ( className.constructor === String ) { - this.classRuleSettings[className] = rules; - } else { - $.extend(this.classRuleSettings, className); - } - }, - - classRules: function(element) { - var rules = {}; - var classes = $(element).attr('class'); - if ( classes ) { - $.each(classes.split(' '), function() { - if (this in $.validator.classRuleSettings) { - $.extend(rules, $.validator.classRuleSettings[this]); - } - }); - } - return rules; - }, - - attributeRules: function(element) { - var rules = {}; - var $element = $(element); - - for (var method in $.validator.methods) { - var value; - - // support for in both html5 and older browsers - if (method === 'required') { - value = $element.get(0).getAttribute(method); - // Some browsers return an empty string for the required attribute - // and non-HTML5 browsers might have required="" markup - if (value === "") { - value = true; - } - // force non-HTML5 browsers to return bool - value = !!value; - } else { - value = $element.attr(method); - } - - if (value) { - rules[method] = value; - } else if ($element[0].getAttribute("type") === method) { - rules[method] = true; - } - } - - // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs - if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) { - delete rules.maxlength; - } - - return rules; - }, - - metadataRules: function(element) { - if (!$.metadata) { - return {}; - } - - var meta = $.data(element.form, 'validator').settings.meta; - return meta ? - $(element).metadata()[meta] : - $(element).metadata(); - }, - - staticRules: function(element) { - var rules = {}; - var validator = $.data(element.form, 'validator'); - if (validator.settings.rules) { - rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; - } - return rules; - }, - - normalizeRules: function(rules, element) { - // handle dependency check - $.each(rules, function(prop, val) { - // ignore rule when param is explicitly false, eg. required:false - if (val === false) { - delete rules[prop]; - return; - } - if (val.param || val.depends) { - var keepRule = true; - switch (typeof val.depends) { - case "string": - keepRule = !!$(val.depends, element.form).length; - break; - case "function": - keepRule = val.depends.call(element, element); - break; - } - if (keepRule) { - rules[prop] = val.param !== undefined ? val.param : true; - } else { - delete rules[prop]; - } - } - }); - - // evaluate parameters - $.each(rules, function(rule, parameter) { - rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; - }); - - // clean number parameters - $.each(['minlength', 'maxlength', 'min', 'max'], function() { - if (rules[this]) { - rules[this] = Number(rules[this]); - } - }); - $.each(['rangelength', 'range'], function() { - if (rules[this]) { - rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; - } - }); - - if ($.validator.autoCreateRanges) { - // auto-create ranges - if (rules.min && rules.max) { - rules.range = [rules.min, rules.max]; - delete rules.min; - delete rules.max; - } - if (rules.minlength && rules.maxlength) { - rules.rangelength = [rules.minlength, rules.maxlength]; - delete rules.minlength; - delete rules.maxlength; - } - } - - // To support custom messages in metadata ignore rule methods titled "messages" - if (rules.messages) { - delete rules.messages; - } - - return rules; - }, - - // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} - normalizeRule: function(data) { - if( typeof data === "string" ) { - var transformed = {}; - $.each(data.split(/\s/), function() { - transformed[this] = true; - }); - data = transformed; - } - return data; - }, - - // http://docs.jquery.com/Plugins/Validation/Validator/addMethod - addMethod: function(name, method, message) { - $.validator.methods[name] = method; - $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name]; - if (method.length < 3) { - $.validator.addClassRules(name, $.validator.normalizeRule(name)); - } - }, - - methods: { - - // http://docs.jquery.com/Plugins/Validation/Methods/required - required: function(value, element, param) { - // check if dependency is met - if ( !this.depend(param, element) ) { - return "dependency-mismatch"; - } - if ( element.nodeName.toLowerCase() === "select" ) { - // could be an array for select-multiple or a string, both are fine this way - var val = $(element).val(); - return val && val.length > 0; - } - if ( this.checkable(element) ) { - return this.getLength(value, element) > 0; - } - return $.trim(value).length > 0; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/remote - remote: function(value, element, param) { - if ( this.optional(element) ) { - return "dependency-mismatch"; - } - - var previous = this.previousValue(element); - if (!this.settings.messages[element.name] ) { - this.settings.messages[element.name] = {}; - } - previous.originalMessage = this.settings.messages[element.name].remote; - this.settings.messages[element.name].remote = previous.message; - - param = typeof param === "string" && {url:param} || param; - - if ( this.pending[element.name] ) { - return "pending"; - } - if ( previous.old === value ) { - return previous.valid; - } - - previous.old = value; - var validator = this; - this.startRequest(element); - var data = {}; - data[element.name] = value; - $.ajax($.extend(true, { - url: param, - mode: "abort", - port: "validate" + element.name, - dataType: "json", - data: data, - success: function(response) { - validator.settings.messages[element.name].remote = previous.originalMessage; - var valid = response === true || response === "true"; - if ( valid ) { - var submitted = validator.formSubmitted; - validator.prepareElement(element); - validator.formSubmitted = submitted; - validator.successList.push(element); - delete validator.invalid[element.name]; - validator.showErrors(); - } else { - var errors = {}; - var message = response || validator.defaultMessage( element, "remote" ); - errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message; - validator.invalid[element.name] = true; - validator.showErrors(errors); - } - previous.valid = valid; - validator.stopRequest(element, valid); - } - }, param)); - return "pending"; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/minlength - minlength: function(value, element, param) { - var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); - return this.optional(element) || length >= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/maxlength - maxlength: function(value, element, param) { - var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); - return this.optional(element) || length <= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/rangelength - rangelength: function(value, element, param) { - var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element); - return this.optional(element) || ( length >= param[0] && length <= param[1] ); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/min - min: function( value, element, param ) { - return this.optional(element) || value >= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/max - max: function( value, element, param ) { - return this.optional(element) || value <= param; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/range - range: function( value, element, param ) { - return this.optional(element) || ( value >= param[0] && value <= param[1] ); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/email - email: function(value, element) { - // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ - return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/url - url: function(value, element) { - // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ - return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/date - date: function(value, element) { - return this.optional(element) || !/Invalid|NaN/.test(new Date(value)); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/dateISO - dateISO: function(value, element) { - return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/number - number: function(value, element) { - return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/digits - digits: function(value, element) { - return this.optional(element) || /^\d+$/.test(value); - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/creditcard - // based on http://en.wikipedia.org/wiki/Luhn - creditcard: function(value, element) { - if ( this.optional(element) ) { - return "dependency-mismatch"; - } - // accept only spaces, digits and dashes - if (/[^0-9 \-]+/.test(value)) { - return false; - } - var nCheck = 0, - nDigit = 0, - bEven = false; - - value = value.replace(/\D/g, ""); - - for (var n = value.length - 1; n >= 0; n--) { - var cDigit = value.charAt(n); - nDigit = parseInt(cDigit, 10); - if (bEven) { - if ((nDigit *= 2) > 9) { - nDigit -= 9; - } - } - nCheck += nDigit; - bEven = !bEven; - } - - return (nCheck % 10) === 0; - }, - - // http://docs.jquery.com/Plugins/Validation/Methods/equalTo - equalTo: function(value, element, param) { - // bind to the blur event of the target in order to revalidate whenever the target field is updated - // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead - var target = $(param); - if (this.settings.onfocusout) { - target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { - $(element).valid(); - }); - } - return value === target.val(); - } - - } - -}); - -// deprecated, use $.validator.format instead -$.format = $.validator.format; - -}(jQuery)); - -// ajax mode: abort -// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); -// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() -(function($) { - var pendingRequests = {}; - // Use a prefilter if available (1.5+) - if ( $.ajaxPrefilter ) { - $.ajaxPrefilter(function(settings, _, xhr) { - var port = settings.port; - if (settings.mode === "abort") { - if ( pendingRequests[port] ) { - pendingRequests[port].abort(); - } - pendingRequests[port] = xhr; - } - }); - } else { - // Proxy ajax - var ajax = $.ajax; - $.ajax = function(settings) { - var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, - port = ( "port" in settings ? settings : $.ajaxSettings ).port; - if (mode === "abort") { - if ( pendingRequests[port] ) { - pendingRequests[port].abort(); - } - return (pendingRequests[port] = ajax.apply(this, arguments)); - } - return ajax.apply(this, arguments); - }; - } -}(jQuery)); - -// provides cross-browser focusin and focusout events -// IE has native support, in other browsers, use event caputuring (neither bubbles) - -// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation -// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target -(function($) { - // only implement if not provided by jQuery core (since 1.4) - // TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs - if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) { - $.each({ - focus: 'focusin', - blur: 'focusout' - }, function( original, fix ){ - $.event.special[fix] = { - setup:function() { - this.addEventListener( original, handler, true ); - }, - teardown:function() { - this.removeEventListener( original, handler, true ); - }, - handler: function(e) { - var args = arguments; - args[0] = $.event.fix(e); - args[0].type = fix; - return $.event.handle.apply(this, args); - } - }; - function handler(e) { - e = $.event.fix(e); - e.type = fix; - return $.event.handle.call(this, e); - } - }); - } - $.extend($.fn, { - validateDelegate: function(delegate, type, handler) { - return this.bind(type, function(event) { - var target = $(event.target); - if (target.is(delegate)) { - return handler.apply(target, arguments); - } - }); - } - }); -}(jQuery)); diff --git a/NzbDrone.Web/Scripts2/jquery.validate.unobtrusive.js b/NzbDrone.Web/Scripts2/jquery.validate.unobtrusive.js deleted file mode 100644 index e2a410fca..000000000 --- a/NzbDrone.Web/Scripts2/jquery.validate.unobtrusive.js +++ /dev/null @@ -1,365 +0,0 @@ -/*! -** Unobtrusive validation support library for jQuery and jQuery Validate -** Copyright (C) Microsoft Corporation. All rights reserved. -*/ - -/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ -/*global document: false, jQuery: false */ - -(function ($) { - var $jQval = $.validator, - adapters, - data_validation = "unobtrusiveValidation"; - - function setValidationValues(options, ruleName, value) { - options.rules[ruleName] = value; - if (options.message) { - options.messages[ruleName] = options.message; - } - } - - function splitAndTrim(value) { - return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g); - } - - function escapeAttributeValue(value) { - // As mentioned on http://api.jquery.com/category/selectors/ - return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1"); - } - - function getModelPrefix(fieldName) { - return fieldName.substr(0, fieldName.lastIndexOf(".") + 1); - } - - function appendModelPrefix(value, prefix) { - if (value.indexOf("*.") === 0) { - value = value.replace("*.", prefix); - } - return value; - } - - function onError(error, inputElement) { // 'this' is the form element - var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"), - replace = $.parseJSON(container.attr("data-valmsg-replace")) !== false; - - container.removeClass("field-validation-valid").addClass("field-validation-error"); - error.data("unobtrusiveContainer", container); - - if (replace) { - container.empty(); - error.removeClass("input-validation-error").appendTo(container); - } - else { - error.hide(); - } - } - - function onErrors(event, validator) { // 'this' is the form element - var container = $(this).find("[data-valmsg-summary=true]"), - list = container.find("ul"); - - if (list && list.length && validator.errorList.length) { - list.empty(); - container.addClass("validation-summary-errors").removeClass("validation-summary-valid"); - - $.each(validator.errorList, function () { - $("
      • ").html(this.message).appendTo(list); - }); - } - } - - function onSuccess(error) { // 'this' is the form element - var container = error.data("unobtrusiveContainer"), - replace = $.parseJSON(container.attr("data-valmsg-replace")); - - if (container) { - container.addClass("field-validation-valid").removeClass("field-validation-error"); - error.removeData("unobtrusiveContainer"); - - if (replace) { - container.empty(); - } - } - } - - function onReset(event) { // 'this' is the form element - var $form = $(this); - $form.data("validator").resetForm(); - $form.find(".validation-summary-errors") - .addClass("validation-summary-valid") - .removeClass("validation-summary-errors"); - $form.find(".field-validation-error") - .addClass("field-validation-valid") - .removeClass("field-validation-error") - .removeData("unobtrusiveContainer") - .find(">*") // If we were using valmsg-replace, get the underlying error - .removeData("unobtrusiveContainer"); - } - - function validationInfo(form) { - var $form = $(form), - result = $form.data(data_validation), - onResetProxy = $.proxy(onReset, form); - - if (!result) { - result = { - options: { // options structure passed to jQuery Validate's validate() method - errorClass: "input-validation-error", - errorElement: "span", - errorPlacement: $.proxy(onError, form), - invalidHandler: $.proxy(onErrors, form), - messages: {}, - rules: {}, - success: $.proxy(onSuccess, form) - }, - attachValidation: function () { - $form - .unbind("reset." + data_validation, onResetProxy) - .bind("reset." + data_validation, onResetProxy) - .validate(this.options); - }, - validate: function () { // a validation function that is called by unobtrusive Ajax - $form.validate(); - return $form.valid(); - } - }; - $form.data(data_validation, result); - } - - return result; - } - - $jQval.unobtrusive = { - adapters: [], - - parseElement: function (element, skipAttach) { - /// - /// Parses a single HTML element for unobtrusive validation attributes. - /// - /// The HTML element to be parsed. - /// [Optional] true to skip attaching the - /// validation to the form. If parsing just this single element, you should specify true. - /// If parsing several elements, you should specify false, and manually attach the validation - /// to the form when you are finished. The default is false. - var $element = $(element), - form = $element.parents("form")[0], - valInfo, rules, messages; - - if (!form) { // Cannot do client-side validation without a form - return; - } - - valInfo = validationInfo(form); - valInfo.options.rules[element.name] = rules = {}; - valInfo.options.messages[element.name] = messages = {}; - - $.each(this.adapters, function () { - var prefix = "data-val-" + this.name, - message = $element.attr(prefix), - paramValues = {}; - - if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy) - prefix += "-"; - - $.each(this.params, function () { - paramValues[this] = $element.attr(prefix + this); - }); - - this.adapt({ - element: element, - form: form, - message: message, - params: paramValues, - rules: rules, - messages: messages - }); - } - }); - - $.extend(rules, { "__dummy__": true }); - - if (!skipAttach) { - valInfo.attachValidation(); - } - }, - - parse: function (selector) { - /// - /// Parses all the HTML elements in the specified selector. It looks for input elements decorated - /// with the [data-val=true] attribute value and enables validation according to the data-val-* - /// attribute values. - /// - /// Any valid jQuery selector. - var $forms = $(selector) - .parents("form") - .andSelf() - .add($(selector).find("form")) - .filter("form"); - - $(selector).find(":input[data-val=true]").each(function () { - $jQval.unobtrusive.parseElement(this, true); - }); - - $forms.each(function () { - var info = validationInfo(this); - if (info) { - info.attachValidation(); - } - }); - } - }; - - adapters = $jQval.unobtrusive.adapters; - - adapters.add = function (adapterName, params, fn) { - /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation. - /// The name of the adapter to be added. This matches the name used - /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). - /// [Optional] An array of parameter names (strings) that will - /// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and - /// mmmm is the parameter name). - /// The function to call, which adapts the values from the HTML - /// attributes into jQuery Validate rules and/or messages. - /// - if (!fn) { // Called with no params, just a function - fn = params; - params = []; - } - this.push({ name: adapterName, params: params, adapt: fn }); - return this; - }; - - adapters.addBool = function (adapterName, ruleName) { - /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where - /// the jQuery Validate validation rule has no parameter values. - /// The name of the adapter to be added. This matches the name used - /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). - /// [Optional] The name of the jQuery Validate rule. If not provided, the value - /// of adapterName will be used instead. - /// - return this.add(adapterName, function (options) { - setValidationValues(options, ruleName || adapterName, true); - }); - }; - - adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) { - /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where - /// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and - /// one for min-and-max). The HTML parameters are expected to be named -min and -max. - /// The name of the adapter to be added. This matches the name used - /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name). - /// The name of the jQuery Validate rule to be used when you only - /// have a minimum value. - /// The name of the jQuery Validate rule to be used when you only - /// have a maximum value. - /// The name of the jQuery Validate rule to be used when you - /// have both a minimum and maximum value. - /// [Optional] The name of the HTML attribute that - /// contains the minimum value. The default is "min". - /// [Optional] The name of the HTML attribute that - /// contains the maximum value. The default is "max". - /// - return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) { - var min = options.params.min, - max = options.params.max; - - if (min && max) { - setValidationValues(options, minMaxRuleName, [min, max]); - } - else if (min) { - setValidationValues(options, minRuleName, min); - } - else if (max) { - setValidationValues(options, maxRuleName, max); - } - }); - }; - - adapters.addSingleVal = function (adapterName, attribute, ruleName) { - /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where - /// the jQuery Validate validation rule has a single value. - /// The name of the adapter to be added. This matches the name used - /// in the data-val-nnnn HTML attribute(where nnnn is the adapter name). - /// [Optional] The name of the HTML attribute that contains the value. - /// The default is "val". - /// [Optional] The name of the jQuery Validate rule. If not provided, the value - /// of adapterName will be used instead. - /// - return this.add(adapterName, [attribute || "val"], function (options) { - setValidationValues(options, ruleName || adapterName, options.params[attribute]); - }); - }; - - $jQval.addMethod("__dummy__", function (value, element, params) { - return true; - }); - - $jQval.addMethod("regex", function (value, element, params) { - var match; - if (this.optional(element)) { - return true; - } - - match = new RegExp(params).exec(value); - return (match && (match.index === 0) && (match[0].length === value.length)); - }); - - $jQval.addMethod("nonalphamin", function (value, element, nonalphamin) { - var match; - if (nonalphamin) { - match = value.match(/\W/g); - match = match && match.length >= nonalphamin; - } - return match; - }); - - adapters.addSingleVal("accept", "exts").addSingleVal("regex", "pattern"); - adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"); - adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range"); - adapters.add("equalto", ["other"], function (options) { - var prefix = getModelPrefix(options.element.name), - other = options.params.other, - fullOtherName = appendModelPrefix(other, prefix), - element = $(options.form).find(":input[name='" + escapeAttributeValue(fullOtherName) + "']")[0]; - - setValidationValues(options, "equalTo", element); - }); - adapters.add("required", function (options) { - // jQuery Validate equates "required" with "mandatory" for checkbox elements - if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") { - setValidationValues(options, "required", true); - } - }); - adapters.add("remote", ["url", "type", "additionalfields"], function (options) { - var value = { - url: options.params.url, - type: options.params.type || "GET", - data: {} - }, - prefix = getModelPrefix(options.element.name); - - $.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) { - var paramName = appendModelPrefix(fieldName, prefix); - value.data[paramName] = function () { - return $(options.form).find(":input[name='" + escapeAttributeValue(paramName) + "']").val(); - }; - }); - - setValidationValues(options, "remote", value); - }); - adapters.add("password", ["min", "nonalphamin", "regex"], function (options) { - if (options.params.min) { - setValidationValues(options, "minlength", options.params.min); - } - if (options.params.nonalphamin) { - setValidationValues(options, "nonalphamin", options.params.nonalphamin); - } - if (options.params.regex) { - setValidationValues(options, "regex", options.params.regex); - } - }); - - $(function () { - $jQval.unobtrusive.parse(document); - }); -} (jQuery)); \ No newline at end of file diff --git a/NzbDrone.Web/Scripts2/modernizr-2.6.2.js b/NzbDrone.Web/Scripts2/modernizr-2.6.2.js deleted file mode 100644 index 56a00220b..000000000 --- a/NzbDrone.Web/Scripts2/modernizr-2.6.2.js +++ /dev/null @@ -1,1393 +0,0 @@ -/*! - * Modernizr v2.6.2 - * www.modernizr.com - * - * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton - * Available under the BSD and MIT licenses: www.modernizr.com/license/ - */ - -/* - * Modernizr tests which native CSS3 and HTML5 features are available in - * the current UA and makes the results available to you in two ways: - * as properties on a global Modernizr object, and as classes on the - * element. This information allows you to progressively enhance - * your pages with a granular level of control over the experience. - * - * Modernizr has an optional (not included) conditional resource loader - * called Modernizr.load(), based on Yepnope.js (yepnopejs.com). - * To get a build that includes Modernizr.load(), as well as choosing - * which tests to include, go to www.modernizr.com/download/ - * - * Authors Faruk Ates, Paul Irish, Alex Sexton - * Contributors Ryan Seddon, Ben Alman - */ - -window.Modernizr = (function( window, document, undefined ) { - - var version = '2.6.2', - - Modernizr = {}, - - /*>>cssclasses*/ - // option for enabling the HTML classes to be added - enableClasses = true, - /*>>cssclasses*/ - - docElement = document.documentElement, - - /** - * Create our "modernizr" element that we do most feature tests on. - */ - mod = 'modernizr', - modElem = document.createElement(mod), - mStyle = modElem.style, - - /** - * Create the input element for various Web Forms feature tests. - */ - inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ , - - /*>>smile*/ - smile = ':)', - /*>>smile*/ - - toString = {}.toString, - - // TODO :: make the prefixes more granular - /*>>prefixes*/ - // List of property values to set for css tests. See ticket #21 - prefixes = ' -webkit- -moz- -o- -ms- '.split(' '), - /*>>prefixes*/ - - /*>>domprefixes*/ - // Following spec is to expose vendor-specific style properties as: - // elem.style.WebkitBorderRadius - // and the following would be incorrect: - // elem.style.webkitBorderRadius - - // Webkit ghosts their properties in lowercase but Opera & Moz do not. - // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+ - // erik.eae.net/archives/2008/03/10/21.48.10/ - - // More here: github.com/Modernizr/Modernizr/issues/issue/21 - omPrefixes = 'Webkit Moz O ms', - - cssomPrefixes = omPrefixes.split(' '), - - domPrefixes = omPrefixes.toLowerCase().split(' '), - /*>>domprefixes*/ - - /*>>ns*/ - ns = {'svg': 'http://www.w3.org/2000/svg'}, - /*>>ns*/ - - tests = {}, - inputs = {}, - attrs = {}, - - classes = [], - - slice = classes.slice, - - featureName, // used in testing loop - - - /*>>teststyles*/ - // Inject element with style element and some CSS rules - injectElementWithStyles = function( rule, callback, nodes, testnames ) { - - var style, ret, node, docOverflow, - div = document.createElement('div'), - // After page load injecting a fake body doesn't work so check if body exists - body = document.body, - // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it. - fakeBody = body || document.createElement('body'); - - if ( parseInt(nodes, 10) ) { - // In order not to give false positives we create a node for each test - // This also allows the method to scale for unspecified uses - while ( nodes-- ) { - node = document.createElement('div'); - node.id = testnames ? testnames[nodes] : mod + (nodes + 1); - div.appendChild(node); - } - } - - // '].join(''); - div.id = mod; - // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody. - // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270 - (body ? div : fakeBody).innerHTML += style; - fakeBody.appendChild(div); - if ( !body ) { - //avoid crashing IE8, if background image is used - fakeBody.style.background = ''; - //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible - fakeBody.style.overflow = 'hidden'; - docOverflow = docElement.style.overflow; - docElement.style.overflow = 'hidden'; - docElement.appendChild(fakeBody); - } - - ret = callback(div, rule); - // If this is done after page load we don't want to remove the body so check if body exists - if ( !body ) { - fakeBody.parentNode.removeChild(fakeBody); - docElement.style.overflow = docOverflow; - } else { - div.parentNode.removeChild(div); - } - - return !!ret; - - }, - /*>>teststyles*/ - - /*>>mq*/ - // adapted from matchMedia polyfill - // by Scott Jehl and Paul Irish - // gist.github.com/786768 - testMediaQuery = function( mq ) { - - var matchMedia = window.matchMedia || window.msMatchMedia; - if ( matchMedia ) { - return matchMedia(mq).matches; - } - - var bool; - - injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) { - bool = (window.getComputedStyle ? - getComputedStyle(node, null) : - node.currentStyle)['position'] == 'absolute'; - }); - - return bool; - - }, - /*>>mq*/ - - - /*>>hasevent*/ - // - // isEventSupported determines if a given element supports the given event - // kangax.github.com/iseventsupported/ - // - // The following results are known incorrects: - // Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative - // Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333 - // ... - isEventSupported = (function() { - - var TAGNAMES = { - 'select': 'input', 'change': 'input', - 'submit': 'form', 'reset': 'form', - 'error': 'img', 'load': 'img', 'abort': 'img' - }; - - function isEventSupported( eventName, element ) { - - element = element || document.createElement(TAGNAMES[eventName] || 'div'); - eventName = 'on' + eventName; - - // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those - var isSupported = eventName in element; - - if ( !isSupported ) { - // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element - if ( !element.setAttribute ) { - element = document.createElement('div'); - } - if ( element.setAttribute && element.removeAttribute ) { - element.setAttribute(eventName, ''); - isSupported = is(element[eventName], 'function'); - - // If property was created, "remove it" (by setting value to `undefined`) - if ( !is(element[eventName], 'undefined') ) { - element[eventName] = undefined; - } - element.removeAttribute(eventName); - } - } - - element = null; - return isSupported; - } - return isEventSupported; - })(), - /*>>hasevent*/ - - // TODO :: Add flag for hasownprop ? didn't last time - - // hasOwnProperty shim by kangax needed for Safari 2.0 support - _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; - - if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { - hasOwnProp = function (object, property) { - return _hasOwnProperty.call(object, property); - }; - } - else { - hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */ - return ((property in object) && is(object.constructor.prototype[property], 'undefined')); - }; - } - - // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js - // es5.github.com/#x15.3.4.5 - - if (!Function.prototype.bind) { - Function.prototype.bind = function bind(that) { - - var target = this; - - if (typeof target != "function") { - throw new TypeError(); - } - - var args = slice.call(arguments, 1), - bound = function () { - - if (this instanceof bound) { - - var F = function(){}; - F.prototype = target.prototype; - var self = new F(); - - var result = target.apply( - self, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return self; - - } else { - - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - - } - - }; - - return bound; - }; - } - - /** - * setCss applies given styles to the Modernizr DOM node. - */ - function setCss( str ) { - mStyle.cssText = str; - } - - /** - * setCssAll extrapolates all vendor-specific css strings. - */ - function setCssAll( str1, str2 ) { - return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); - } - - /** - * is returns a boolean for if typeof obj is exactly type. - */ - function is( obj, type ) { - return typeof obj === type; - } - - /** - * contains returns a boolean for if substr is found within str. - */ - function contains( str, substr ) { - return !!~('' + str).indexOf(substr); - } - - /*>>testprop*/ - - // testProps is a generic CSS / DOM property test. - - // In testing support for a given CSS property, it's legit to test: - // `elem.style[styleName] !== undefined` - // If the property is supported it will return an empty string, - // if unsupported it will return undefined. - - // We'll take advantage of this quick test and skip setting a style - // on our modernizr element, but instead just testing undefined vs - // empty string. - - // Because the testing of the CSS property names (with "-", as - // opposed to the camelCase DOM properties) is non-portable and - // non-standard but works in WebKit and IE (but not Gecko or Opera), - // we explicitly reject properties with dashes so that authors - // developing in WebKit or IE first don't end up with - // browser-specific content by accident. - - function testProps( props, prefixed ) { - for ( var i in props ) { - var prop = props[i]; - if ( !contains(prop, "-") && mStyle[prop] !== undefined ) { - return prefixed == 'pfx' ? prop : true; - } - } - return false; - } - /*>>testprop*/ - - // TODO :: add testDOMProps - /** - * testDOMProps is a generic DOM property test; if a browser supports - * a certain property, it won't return undefined for it. - */ - function testDOMProps( props, obj, elem ) { - for ( var i in props ) { - var item = obj[props[i]]; - if ( item !== undefined) { - - // return the property name as a string - if (elem === false) return props[i]; - - // let's bind a function - if (is(item, 'function')){ - // default to autobind unless override - return item.bind(elem || obj); - } - - // return the unbound function or obj or value - return item; - } - } - return false; - } - - /*>>testallprops*/ - /** - * testPropsAll tests a list of DOM properties we want to check against. - * We specify literally ALL possible (known and/or likely) properties on - * the element including the non-vendor prefixed one, for forward- - * compatibility. - */ - function testPropsAll( prop, prefixed, elem ) { - - var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), - props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); - - // did they call .prefixed('boxSizing') or are we just testing a prop? - if(is(prefixed, "string") || is(prefixed, "undefined")) { - return testProps(props, prefixed); - - // otherwise, they called .prefixed('requestAnimationFrame', window[, elem]) - } else { - props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); - return testDOMProps(props, prefixed, elem); - } - } - /*>>testallprops*/ - - - /** - * Tests - * ----- - */ - - // The *new* flexbox - // dev.w3.org/csswg/css3-flexbox - - tests['flexbox'] = function() { - return testPropsAll('flexWrap'); - }; - - // The *old* flexbox - // www.w3.org/TR/2009/WD-css3-flexbox-20090723/ - - tests['flexboxlegacy'] = function() { - return testPropsAll('boxDirection'); - }; - - // On the S60 and BB Storm, getContext exists, but always returns undefined - // so we actually have to call getContext() to verify - // github.com/Modernizr/Modernizr/issues/issue/97/ - - tests['canvas'] = function() { - var elem = document.createElement('canvas'); - return !!(elem.getContext && elem.getContext('2d')); - }; - - tests['canvastext'] = function() { - return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function')); - }; - - // webk.it/70117 is tracking a legit WebGL feature detect proposal - - // We do a soft detect which may false positive in order to avoid - // an expensive context creation: bugzil.la/732441 - - tests['webgl'] = function() { - return !!window.WebGLRenderingContext; - }; - - /* - * The Modernizr.touch test only indicates if the browser supports - * touch events, which does not necessarily reflect a touchscreen - * device, as evidenced by tablets running Windows 7 or, alas, - * the Palm Pre / WebOS (touch) phones. - * - * Additionally, Chrome (desktop) used to lie about its support on this, - * but that has since been rectified: crbug.com/36415 - * - * We also test for Firefox 4 Multitouch Support. - * - * For more info, see: modernizr.github.com/Modernizr/touch.html - */ - - tests['touch'] = function() { - var bool; - - if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { - bool = true; - } else { - injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) { - bool = node.offsetTop === 9; - }); - } - - return bool; - }; - - - // geolocation is often considered a trivial feature detect... - // Turns out, it's quite tricky to get right: - // - // Using !!navigator.geolocation does two things we don't want. It: - // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513 - // 2. Disables page caching in WebKit: webk.it/43956 - // - // Meanwhile, in Firefox < 8, an about:config setting could expose - // a false positive that would throw an exception: bugzil.la/688158 - - tests['geolocation'] = function() { - return 'geolocation' in navigator; - }; - - - tests['postmessage'] = function() { - return !!window.postMessage; - }; - - - // Chrome incognito mode used to throw an exception when using openDatabase - // It doesn't anymore. - tests['websqldatabase'] = function() { - return !!window.openDatabase; - }; - - // Vendors had inconsistent prefixing with the experimental Indexed DB: - // - Webkit's implementation is accessible through webkitIndexedDB - // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB - // For speed, we don't test the legacy (and beta-only) indexedDB - tests['indexedDB'] = function() { - return !!testPropsAll("indexedDB", window); - }; - - // documentMode logic from YUI to filter out IE8 Compat Mode - // which false positives. - tests['hashchange'] = function() { - return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7); - }; - - // Per 1.6: - // This used to be Modernizr.historymanagement but the longer - // name has been deprecated in favor of a shorter and property-matching one. - // The old API is still available in 1.6, but as of 2.0 will throw a warning, - // and in the first release thereafter disappear entirely. - tests['history'] = function() { - return !!(window.history && history.pushState); - }; - - tests['draganddrop'] = function() { - var div = document.createElement('div'); - return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div); - }; - - // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10 - // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17. - // FF10 still uses prefixes, so check for it until then. - // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/ - tests['websockets'] = function() { - return 'WebSocket' in window || 'MozWebSocket' in window; - }; - - - // css-tricks.com/rgba-browser-support/ - tests['rgba'] = function() { - // Set an rgba() color and check the returned value - - setCss('background-color:rgba(150,255,150,.5)'); - - return contains(mStyle.backgroundColor, 'rgba'); - }; - - tests['hsla'] = function() { - // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally, - // except IE9 who retains it as hsla - - setCss('background-color:hsla(120,40%,100%,.5)'); - - return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla'); - }; - - tests['multiplebgs'] = function() { - // Setting multiple images AND a color on the background shorthand property - // and then querying the style.background property value for the number of - // occurrences of "url(" is a reliable method for detecting ACTUAL support for this! - - setCss('background:url(https://),url(https://),red url(https://)'); - - // If the UA supports multiple backgrounds, there should be three occurrences - // of the string "url(" in the return value for elemStyle.background - - return (/(url\s*\(.*?){3}/).test(mStyle.background); - }; - - - - // this will false positive in Opera Mini - // github.com/Modernizr/Modernizr/issues/396 - - tests['backgroundsize'] = function() { - return testPropsAll('backgroundSize'); - }; - - tests['borderimage'] = function() { - return testPropsAll('borderImage'); - }; - - - // Super comprehensive table about all the unique implementations of - // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance - - tests['borderradius'] = function() { - return testPropsAll('borderRadius'); - }; - - // WebOS unfortunately false positives on this test. - tests['boxshadow'] = function() { - return testPropsAll('boxShadow'); - }; - - // FF3.0 will false positive on this test - tests['textshadow'] = function() { - return document.createElement('div').style.textShadow === ''; - }; - - - tests['opacity'] = function() { - // Browsers that actually have CSS Opacity implemented have done so - // according to spec, which means their return values are within the - // range of [0.0,1.0] - including the leading zero. - - setCssAll('opacity:.55'); - - // The non-literal . in this regex is intentional: - // German Chrome returns this value as 0,55 - // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632 - return (/^0.55$/).test(mStyle.opacity); - }; - - - // Note, Android < 4 will pass this test, but can only animate - // a single property at a time - // daneden.me/2011/12/putting-up-with-androids-bullshit/ - tests['cssanimations'] = function() { - return testPropsAll('animationName'); - }; - - - tests['csscolumns'] = function() { - return testPropsAll('columnCount'); - }; - - - tests['cssgradients'] = function() { - /** - * For CSS Gradients syntax, please see: - * webkit.org/blog/175/introducing-css-gradients/ - * developer.mozilla.org/en/CSS/-moz-linear-gradient - * developer.mozilla.org/en/CSS/-moz-radial-gradient - * dev.w3.org/csswg/css3-images/#gradients- - */ - - var str1 = 'background-image:', - str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', - str3 = 'linear-gradient(left top,#9f9, white);'; - - setCss( - // legacy webkit syntax (FIXME: remove when syntax not in use anymore) - (str1 + '-webkit- '.split(' ').join(str2 + str1) + - // standard syntax // trailing 'background-image:' - prefixes.join(str3 + str1)).slice(0, -str1.length) - ); - - return contains(mStyle.backgroundImage, 'gradient'); - }; - - - tests['cssreflections'] = function() { - return testPropsAll('boxReflect'); - }; - - - tests['csstransforms'] = function() { - return !!testPropsAll('transform'); - }; - - - tests['csstransforms3d'] = function() { - - var ret = !!testPropsAll('perspective'); - - // Webkit's 3D transforms are passed off to the browser's own graphics renderer. - // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in - // some conditions. As a result, Webkit typically recognizes the syntax but - // will sometimes throw a false positive, thus we must do a more thorough check: - if ( ret && 'webkitPerspective' in docElement.style ) { - - // Webkit allows this media query to succeed only if the feature is enabled. - // `@media (transform-3d),(-webkit-transform-3d){ ... }` - injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) { - ret = node.offsetLeft === 9 && node.offsetHeight === 3; - }); - } - return ret; - }; - - - tests['csstransitions'] = function() { - return testPropsAll('transition'); - }; - - - /*>>fontface*/ - // @font-face detection routine by Diego Perini - // javascript.nwbox.com/CSSSupport/ - - // false positives: - // WebOS github.com/Modernizr/Modernizr/issues/342 - // WP7 github.com/Modernizr/Modernizr/issues/538 - tests['fontface'] = function() { - var bool; - - injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) { - var style = document.getElementById('smodernizr'), - sheet = style.sheet || style.styleSheet, - cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : ''; - - bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0; - }); - - return bool; - }; - /*>>fontface*/ - - // CSS generated content detection - tests['generatedcontent'] = function() { - var bool; - - injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) { - bool = node.offsetHeight >= 3; - }); - - return bool; - }; - - - - // These tests evaluate support of the video/audio elements, as well as - // testing what types of content they support. - // - // We're using the Boolean constructor here, so that we can extend the value - // e.g. Modernizr.video // true - // Modernizr.video.ogg // 'probably' - // - // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845 - // thx to NielsLeenheer and zcorpan - - // Note: in some older browsers, "no" was a return value instead of empty string. - // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2 - // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5 - - tests['video'] = function() { - var elem = document.createElement('video'), - bool = false; - - // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224 - try { - if ( bool = !!elem.canPlayType ) { - bool = new Boolean(bool); - bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,''); - - // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546 - bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,''); - - bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,''); - } - - } catch(e) { } - - return bool; - }; - - tests['audio'] = function() { - var elem = document.createElement('audio'), - bool = false; - - try { - if ( bool = !!elem.canPlayType ) { - bool = new Boolean(bool); - bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,''); - bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,''); - - // Mimetypes accepted: - // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements - // bit.ly/iphoneoscodecs - bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,''); - bool.m4a = ( elem.canPlayType('audio/x-m4a;') || - elem.canPlayType('audio/aac;')) .replace(/^no$/,''); - } - } catch(e) { } - - return bool; - }; - - - // In FF4, if disabled, window.localStorage should === null. - - // Normally, we could not test that directly and need to do a - // `('localStorage' in window) && ` test first because otherwise Firefox will - // throw bugzil.la/365772 if cookies are disabled - - // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem - // will throw the exception: - // QUOTA_EXCEEDED_ERRROR DOM Exception 22. - // Peculiarly, getItem and removeItem calls do not throw. - - // Because we are forced to try/catch this, we'll go aggressive. - - // Just FWIW: IE8 Compat mode supports these features completely: - // www.quirksmode.org/dom/html5.html - // But IE8 doesn't support either with local files - - tests['localstorage'] = function() { - try { - localStorage.setItem(mod, mod); - localStorage.removeItem(mod); - return true; - } catch(e) { - return false; - } - }; - - tests['sessionstorage'] = function() { - try { - sessionStorage.setItem(mod, mod); - sessionStorage.removeItem(mod); - return true; - } catch(e) { - return false; - } - }; - - - tests['webworkers'] = function() { - return !!window.Worker; - }; - - - tests['applicationcache'] = function() { - return !!window.applicationCache; - }; - - - // Thanks to Erik Dahlstrom - tests['svg'] = function() { - return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect; - }; - - // specifically for SVG inline in HTML, not within XHTML - // test page: paulirish.com/demo/inline-svg - tests['inlinesvg'] = function() { - var div = document.createElement('div'); - div.innerHTML = ''; - return (div.firstChild && div.firstChild.namespaceURI) == ns.svg; - }; - - // SVG SMIL animation - tests['smil'] = function() { - return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate'))); - }; - - // This test is only for clip paths in SVG proper, not clip paths on HTML content - // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg - - // However read the comments to dig into applying SVG clippaths to HTML content here: - // github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491 - tests['svgclippaths'] = function() { - return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath'))); - }; - - /*>>webforms*/ - // input features and input types go directly onto the ret object, bypassing the tests loop. - // Hold this guy to execute in a moment. - function webforms() { - /*>>input*/ - // Run through HTML5's new input attributes to see if the UA understands any. - // We're using f which is the element created early on - // Mike Taylr has created a comprehensive resource for testing these attributes - // when applied to all input types: - // miketaylr.com/code/input-type-attr.html - // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary - - // Only input placeholder is tested while textarea's placeholder is not. - // Currently Safari 4 and Opera 11 have support only for the input placeholder - // Both tests are available in feature-detects/forms-placeholder.js - Modernizr['input'] = (function( props ) { - for ( var i = 0, len = props.length; i < len; i++ ) { - attrs[ props[i] ] = !!(props[i] in inputElem); - } - if (attrs.list){ - // safari false positive's on datalist: webk.it/74252 - // see also github.com/Modernizr/Modernizr/issues/146 - attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement); - } - return attrs; - })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ')); - /*>>input*/ - - /*>>inputtypes*/ - // Run through HTML5's new input types to see if the UA understands any. - // This is put behind the tests runloop because it doesn't return a - // true/false like all the other tests; instead, it returns an object - // containing each input type with its corresponding true/false value - - // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/ - Modernizr['inputtypes'] = (function(props) { - - for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) { - - inputElem.setAttribute('type', inputElemType = props[i]); - bool = inputElem.type !== 'text'; - - // We first check to see if the type we give it sticks.. - // If the type does, we feed it a textual value, which shouldn't be valid. - // If the value doesn't stick, we know there's input sanitization which infers a custom UI - if ( bool ) { - - inputElem.value = smile; - inputElem.style.cssText = 'position:absolute;visibility:hidden;'; - - if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { - - docElement.appendChild(inputElem); - defaultView = document.defaultView; - - // Safari 2-4 allows the smiley as a value, despite making a slider - bool = defaultView.getComputedStyle && - defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && - // Mobile android web browser has false positive, so must - // check the height to see if the widget is actually there. - (inputElem.offsetHeight !== 0); - - docElement.removeChild(inputElem); - - } else if ( /^(search|tel)$/.test(inputElemType) ){ - // Spec doesn't define any special parsing or detectable UI - // behaviors so we pass these through as true - - // Interestingly, opera fails the earlier test, so it doesn't - // even make it here. - - } else if ( /^(url|email)$/.test(inputElemType) ) { - // Real url and email support comes with prebaked validation. - bool = inputElem.checkValidity && inputElem.checkValidity() === false; - - } else { - // If the upgraded input compontent rejects the :) text, we got a winner - bool = inputElem.value != smile; - } - } - - inputs[ props[i] ] = !!bool; - } - return inputs; - })('search tel url email datetime date month week time datetime-local number range color'.split(' ')); - /*>>inputtypes*/ - } - /*>>webforms*/ - - - // End of test definitions - // ----------------------- - - - - // Run through all tests and detect their support in the current UA. - // todo: hypothetically we could be doing an array of tests and use a basic loop here. - for ( var feature in tests ) { - if ( hasOwnProp(tests, feature) ) { - // run the test, throw the return value into the Modernizr, - // then based on that boolean, define an appropriate className - // and push it into an array of classes we'll join later. - featureName = feature.toLowerCase(); - Modernizr[featureName] = tests[feature](); - - classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); - } - } - - /*>>webforms*/ - // input tests need to run. - Modernizr.input || webforms(); - /*>>webforms*/ - - - /** - * addTest allows the user to define their own feature tests - * the result will be added onto the Modernizr object, - * as well as an appropriate className set on the html element - * - * @param feature - String naming the feature - * @param test - Function returning true if feature is supported, false if not - */ - Modernizr.addTest = function ( feature, test ) { - if ( typeof feature == 'object' ) { - for ( var key in feature ) { - if ( hasOwnProp( feature, key ) ) { - Modernizr.addTest( key, feature[ key ] ); - } - } - } else { - - feature = feature.toLowerCase(); - - if ( Modernizr[feature] !== undefined ) { - // we're going to quit if you're trying to overwrite an existing test - // if we were to allow it, we'd do this: - // var re = new RegExp("\\b(no-)?" + feature + "\\b"); - // docElement.className = docElement.className.replace( re, '' ); - // but, no rly, stuff 'em. - return Modernizr; - } - - test = typeof test == 'function' ? test() : test; - - if (typeof enableClasses !== "undefined" && enableClasses) { - docElement.className += ' ' + (test ? '' : 'no-') + feature; - } - Modernizr[feature] = test; - - } - - return Modernizr; // allow chaining. - }; - - - // Reset modElem.cssText to nothing to reduce memory footprint. - setCss(''); - modElem = inputElem = null; - - /*>>shiv*/ - /*! HTML5 Shiv v3.6.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */ - ;(function(window, document) { - /*jshint evil:true */ - /** Preset options */ - var options = window.html5 || {}; - - /** Used to skip problem elements */ - var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; - - /** Not all elements can be cloned in IE **/ - var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; - - /** Detect whether the browser supports default html5 styles */ - var supportsHtml5Styles; - - /** Name of the expando, to work with multiple documents or to re-shiv one document */ - var expando = '_html5shiv'; - - /** The id for the the documents expando */ - var expanID = 0; - - /** Cached data for each document */ - var expandoData = {}; - - /** Detect whether the browser supports unknown elements */ - var supportsUnknownElements; - - (function() { - try { - var a = document.createElement('a'); - a.innerHTML = ''; - //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles - supportsHtml5Styles = ('hidden' in a); - - supportsUnknownElements = a.childNodes.length == 1 || (function() { - // assign a false positive if unable to shiv - (document.createElement)('a'); - var frag = document.createDocumentFragment(); - return ( - typeof frag.cloneNode == 'undefined' || - typeof frag.createDocumentFragment == 'undefined' || - typeof frag.createElement == 'undefined' - ); - }()); - } catch(e) { - supportsHtml5Styles = true; - supportsUnknownElements = true; - } - - }()); - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a style sheet with the given CSS text and adds it to the document. - * @private - * @param {Document} ownerDocument The document. - * @param {String} cssText The CSS text. - * @returns {StyleSheet} The style element. - */ - function addStyleSheet(ownerDocument, cssText) { - var p = ownerDocument.createElement('p'), - parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; - - p.innerHTML = 'x'; - return parent.insertBefore(p.lastChild, parent.firstChild); - } - - /** - * Returns the value of `html5.elements` as an array. - * @private - * @returns {Array} An array of shived element node names. - */ - function getElements() { - var elements = html5.elements; - return typeof elements == 'string' ? elements.split(' ') : elements; - } - - /** - * Returns the data associated to the given document - * @private - * @param {Document} ownerDocument The document. - * @returns {Object} An object of data. - */ - function getExpandoData(ownerDocument) { - var data = expandoData[ownerDocument[expando]]; - if (!data) { - data = {}; - expanID++; - ownerDocument[expando] = expanID; - expandoData[expanID] = data; - } - return data; - } - - /** - * returns a shived element for the given nodeName and document - * @memberOf html5 - * @param {String} nodeName name of the element - * @param {Document} ownerDocument The context document. - * @returns {Object} The shived element. - */ - function createElement(nodeName, ownerDocument, data){ - if (!ownerDocument) { - ownerDocument = document; - } - if(supportsUnknownElements){ - return ownerDocument.createElement(nodeName); - } - if (!data) { - data = getExpandoData(ownerDocument); - } - var node; - - if (data.cache[nodeName]) { - node = data.cache[nodeName].cloneNode(); - } else if (saveClones.test(nodeName)) { - node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); - } else { - node = data.createElem(nodeName); - } - - // Avoid adding some elements to fragments in IE < 9 because - // * Attributes like `name` or `type` cannot be set/changed once an element - // is inserted into a document/fragment - // * Link elements with `src` attributes that are inaccessible, as with - // a 403 response, will cause the tab/window to crash - // * Script elements appended to fragments will execute when their `src` - // or `text` property is set - return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node; - } - - /** - * returns a shived DocumentFragment for the given document - * @memberOf html5 - * @param {Document} ownerDocument The context document. - * @returns {Object} The shived DocumentFragment. - */ - function createDocumentFragment(ownerDocument, data){ - if (!ownerDocument) { - ownerDocument = document; - } - if(supportsUnknownElements){ - return ownerDocument.createDocumentFragment(); - } - data = data || getExpandoData(ownerDocument); - var clone = data.frag.cloneNode(), - i = 0, - elems = getElements(), - l = elems.length; - for(;i>shiv*/ - - // Assign private properties to the return object with prefix - Modernizr._version = version; - - // expose these for the plugin API. Look in the source for how to join() them against your input - /*>>prefixes*/ - Modernizr._prefixes = prefixes; - /*>>prefixes*/ - /*>>domprefixes*/ - Modernizr._domPrefixes = domPrefixes; - Modernizr._cssomPrefixes = cssomPrefixes; - /*>>domprefixes*/ - - /*>>mq*/ - // Modernizr.mq tests a given media query, live against the current state of the window - // A few important notes: - // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false - // * A max-width or orientation query will be evaluated against the current state, which may change later. - // * You must specify values. Eg. If you are testing support for the min-width media query use: - // Modernizr.mq('(min-width:0)') - // usage: - // Modernizr.mq('only screen and (max-width:768)') - Modernizr.mq = testMediaQuery; - /*>>mq*/ - - /*>>hasevent*/ - // Modernizr.hasEvent() detects support for a given event, with an optional element to test on - // Modernizr.hasEvent('gesturestart', elem) - Modernizr.hasEvent = isEventSupported; - /*>>hasevent*/ - - /*>>testprop*/ - // Modernizr.testProp() investigates whether a given style property is recognized - // Note that the property names must be provided in the camelCase variant. - // Modernizr.testProp('pointerEvents') - Modernizr.testProp = function(prop){ - return testProps([prop]); - }; - /*>>testprop*/ - - /*>>testallprops*/ - // Modernizr.testAllProps() investigates whether a given style property, - // or any of its vendor-prefixed variants, is recognized - // Note that the property names must be provided in the camelCase variant. - // Modernizr.testAllProps('boxSizing') - Modernizr.testAllProps = testPropsAll; - /*>>testallprops*/ - - - /*>>teststyles*/ - // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards - // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... }) - Modernizr.testStyles = injectElementWithStyles; - /*>>teststyles*/ - - - /*>>prefixed*/ - // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input - // Modernizr.prefixed('boxSizing') // 'MozBoxSizing' - - // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style. - // Return values will also be the camelCase variant, if you need to translate that to hypenated style use: - // - // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); - - // If you're trying to ascertain which transition end event to bind to, you might do something like... - // - // var transEndEventNames = { - // 'WebkitTransition' : 'webkitTransitionEnd', - // 'MozTransition' : 'transitionend', - // 'OTransition' : 'oTransitionEnd', - // 'msTransition' : 'MSTransitionEnd', - // 'transition' : 'transitionend' - // }, - // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ]; - - Modernizr.prefixed = function(prop, obj, elem){ - if(!obj) { - return testPropsAll(prop, 'pfx'); - } else { - // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame' - return testPropsAll(prop, obj, elem); - } - }; - /*>>prefixed*/ - - - /*>>cssclasses*/ - // Remove "no-js" class from element, if it exists: - docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') + - - // Add the new classes to the element. - (enableClasses ? ' js ' + classes.join(' ') : ''); - /*>>cssclasses*/ - - return Modernizr; - -})(this, this.document); diff --git a/NzbDrone.Web/Views/Shared/_Bootstrap.cshtml b/NzbDrone.Web/Views/Shared/_Bootstrap.cshtml index 674fe2a15..9f48c4d2d 100644 --- a/NzbDrone.Web/Views/Shared/_Bootstrap.cshtml +++ b/NzbDrone.Web/Views/Shared/_Bootstrap.cshtml @@ -1,6 +1,7 @@ @using Cassette.Scripts @using Cassette.Stylesheets @using NzbDrone.Web +@using NzbDrone.Web.Backbone.NzbDrone @using NzbDrone.Web.Helpers @{ Bundles.Reference(CassetteBundleConfiguration.BASE_STYLE); diff --git a/NzbDrone.Web/Views/V2/Index.cshtml b/NzbDrone.Web/Views/V2/Index.cshtml new file mode 100644 index 000000000..77c543cf4 --- /dev/null +++ b/NzbDrone.Web/Views/V2/Index.cshtml @@ -0,0 +1,70 @@ +@{ + Layout = null; +} + +@using Cassette.Scripts +@using Cassette.Stylesheets +@using NzbDrone.Web +@using NzbDrone.Web.Backbone.NzbDrone +@using NzbDrone.Web.Helpers +@{ + Bundles.Reference(CassetteBundleConfiguration.BASE_STYLE); + Bundles.Reference(CassetteBundleConfiguration.NZBDRONE); +} + + + + + @ViewBag.Title - NzbDrone + + + + + + + + @Bundles.RenderStylesheets() + + +
        + + +
        +
        + +
        +
        +
        +
        +
        +
        + +
        + @Bundles.RenderScripts() + + + diff --git a/NzbDrone.Web/AddSeries/Views/addSeries.css b/NzbDrone.Web/_backboneApp/AddSeries/addSeries.css similarity index 100% rename from NzbDrone.Web/AddSeries/Views/addSeries.css rename to NzbDrone.Web/_backboneApp/AddSeries/addSeries.css diff --git a/NzbDrone.Web/_backboneApp/AddSeries/addSeriesTemplate.html b/NzbDrone.Web/_backboneApp/AddSeries/addSeriesTemplate.html new file mode 100644 index 000000000..b3acf6c2a --- /dev/null +++ b/NzbDrone.Web/_backboneApp/AddSeries/addSeriesTemplate.html @@ -0,0 +1,15 @@ + +
        +
        + +
        +
        Import existing.
        +
        Manage root folders
        +
        diff --git a/NzbDrone.Web/AddSeries/Views/addSeriesView.js b/NzbDrone.Web/_backboneApp/AddSeries/addSeriesView.js similarity index 98% rename from NzbDrone.Web/AddSeries/Views/addSeriesView.js rename to NzbDrone.Web/_backboneApp/AddSeries/addSeriesView.js index e8e851b60..6413cf273 100644 --- a/NzbDrone.Web/AddSeries/Views/addSeriesView.js +++ b/NzbDrone.Web/_backboneApp/AddSeries/addSeriesView.js @@ -1,5 +1,5 @@ NzbDrone.AddSeriesView = Backbone.Marionette.ItemView.extend({ - template: "#add-series-tmpl", + template: "AddSeries/addSeriesTemplate", initialise: function () { }, diff --git a/NzbDrone.Web/_backboneApp/CassetteConfiguration.cs b/NzbDrone.Web/_backboneApp/CassetteConfiguration.cs new file mode 100644 index 000000000..b51a9da7d --- /dev/null +++ b/NzbDrone.Web/_backboneApp/CassetteConfiguration.cs @@ -0,0 +1,47 @@ +using System.Linq; +using Cassette; +using Cassette.Scripts; +using Cassette.Stylesheets; + +namespace NzbDrone.Web.Backbone.NzbDrone +{ + public class CassetteBundleConfiguration : IConfiguration + { + public const string BASE_STYLE = "BASE_STYLE"; + public const string BACKBONE = "BACKBONE"; + public const string NZBDRONE = "NZBDRONE"; + internal const string FONTS = "FONTS"; + + private const string APP_PATH = "_backboneApp"; + + public void Configure(BundleCollection bundles) + { + bundles.AddUrlWithAlias("//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,600,300'", FONTS); + + //bundles.AddPerSubDirectory("Backbone.NzbDrone"); + + bundles.Add(BASE_STYLE, new[]{ + APP_PATH + "\\Content\\Bootstrap\\bootstrap.less", + APP_PATH + "\\Content\\base.css", + APP_PATH + "\\Content\\menu.css", + APP_PATH + "\\AddSeries\\addSeries.css" + }, + bundle => bundle.AddReference("/" + FONTS)); + + bundles.Add(BACKBONE, new[]{ + APP_PATH + "\\JsLibraries\\jquery-1.8.2.js", + APP_PATH + "\\JsLibraries\\bootstrap.js", + APP_PATH + "\\JsLibraries\\underscore.js", + APP_PATH + "\\JsLibraries\\backbone.js", + APP_PATH + "\\JsLibraries\\backbone.marionette.js", + APP_PATH + "\\JsLibraries\\backbone.marionette.extend.js", + + }); + + bundles.Add(NZBDRONE, new[]{ + APP_PATH + "\\app.js", + APP_PATH + "\\AddSeries\\addSeriesView.js"}, + bundle => bundle.AddReference("/" + BACKBONE)); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Web/Content2/Bootstrap/accordion.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/accordion.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/accordion.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/accordion.less diff --git a/NzbDrone.Web/Content2/Bootstrap/alerts.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/alerts.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/alerts.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/alerts.less diff --git a/NzbDrone.Web/Content2/Bootstrap/bootstrap.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/bootstrap.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/bootstrap.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/bootstrap.less diff --git a/NzbDrone.Web/Content2/Bootstrap/breadcrumbs.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/breadcrumbs.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/breadcrumbs.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/breadcrumbs.less diff --git a/NzbDrone.Web/Content2/Bootstrap/bundle.txt b/NzbDrone.Web/_backboneApp/Content/Bootstrap/bundle.txt similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/bundle.txt rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/bundle.txt diff --git a/NzbDrone.Web/Content2/Bootstrap/button-groups.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/button-groups.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/button-groups.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/button-groups.less diff --git a/NzbDrone.Web/Content2/Bootstrap/buttons.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/buttons.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/buttons.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/buttons.less diff --git a/NzbDrone.Web/Content2/Bootstrap/carousel.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/carousel.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/carousel.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/carousel.less diff --git a/NzbDrone.Web/Content2/Bootstrap/close.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/close.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/close.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/close.less diff --git a/NzbDrone.Web/Content2/Bootstrap/code.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/code.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/code.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/code.less diff --git a/NzbDrone.Web/Content2/Bootstrap/component-animations.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/component-animations.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/component-animations.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/component-animations.less diff --git a/NzbDrone.Web/Content2/Bootstrap/dropdowns.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/dropdowns.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/dropdowns.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/dropdowns.less diff --git a/NzbDrone.Web/Content2/Bootstrap/font-awesome-ie7.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/font-awesome-ie7.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/font-awesome-ie7.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/font-awesome-ie7.less diff --git a/NzbDrone.Web/Content2/Bootstrap/font-awesome.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/font-awesome.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/font-awesome.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/font-awesome.less diff --git a/NzbDrone.Web/Content2/Bootstrap/forms.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/forms.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/forms.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/forms.less diff --git a/NzbDrone.Web/Content2/Bootstrap/grid.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/grid.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/grid.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/grid.less diff --git a/NzbDrone.Web/Content2/Bootstrap/hero-unit.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/hero-unit.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/hero-unit.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/hero-unit.less diff --git a/NzbDrone.Web/Content2/Bootstrap/labels-badges.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/labels-badges.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/labels-badges.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/labels-badges.less diff --git a/NzbDrone.Web/Content2/Bootstrap/layouts.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/layouts.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/layouts.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/layouts.less diff --git a/NzbDrone.Web/Content2/Bootstrap/media.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/media.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/media.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/media.less diff --git a/NzbDrone.Web/Content2/Bootstrap/mixins.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/mixins.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/mixins.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/mixins.less diff --git a/NzbDrone.Web/Content2/Bootstrap/modals.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/modals.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/modals.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/modals.less diff --git a/NzbDrone.Web/Content2/Bootstrap/navbar.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/navbar.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/navbar.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/navbar.less diff --git a/NzbDrone.Web/Content2/Bootstrap/navs.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/navs.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/navs.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/navs.less diff --git a/NzbDrone.Web/Content2/Bootstrap/pager.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/pager.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/pager.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/pager.less diff --git a/NzbDrone.Web/Content2/Bootstrap/pagination.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/pagination.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/pagination.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/pagination.less diff --git a/NzbDrone.Web/Content2/Bootstrap/popovers.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/popovers.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/popovers.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/popovers.less diff --git a/NzbDrone.Web/Content2/Bootstrap/progress-bars.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/progress-bars.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/progress-bars.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/progress-bars.less diff --git a/NzbDrone.Web/Content2/Bootstrap/reset.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/reset.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/reset.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/reset.less diff --git a/NzbDrone.Web/Content2/Bootstrap/responsive-1200px-min.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive-1200px-min.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/responsive-1200px-min.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive-1200px-min.less diff --git a/NzbDrone.Web/Content2/Bootstrap/responsive-767px-max.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive-767px-max.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/responsive-767px-max.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive-767px-max.less diff --git a/NzbDrone.Web/Content2/Bootstrap/responsive-768px-979px.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive-768px-979px.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/responsive-768px-979px.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive-768px-979px.less diff --git a/NzbDrone.Web/Content2/Bootstrap/responsive-navbar.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive-navbar.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/responsive-navbar.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive-navbar.less diff --git a/NzbDrone.Web/Content2/Bootstrap/responsive-utilities.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive-utilities.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/responsive-utilities.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive-utilities.less diff --git a/NzbDrone.Web/Content2/Bootstrap/responsive.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/responsive.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/responsive.less diff --git a/NzbDrone.Web/Content2/Bootstrap/scaffolding.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/scaffolding.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/scaffolding.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/scaffolding.less diff --git a/NzbDrone.Web/Content2/Bootstrap/sprites.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/sprites.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/sprites.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/sprites.less diff --git a/NzbDrone.Web/Content2/Bootstrap/tables.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/tables.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/tables.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/tables.less diff --git a/NzbDrone.Web/Content2/Bootstrap/thumbnails.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/thumbnails.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/thumbnails.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/thumbnails.less diff --git a/NzbDrone.Web/Content2/Bootstrap/tooltip.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/tooltip.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/tooltip.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/tooltip.less diff --git a/NzbDrone.Web/Content2/Bootstrap/type.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/type.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/type.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/type.less diff --git a/NzbDrone.Web/Content2/Bootstrap/utilities.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/utilities.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/utilities.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/utilities.less diff --git a/NzbDrone.Web/Content2/Bootstrap/variables.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/variables.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/variables.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/variables.less diff --git a/NzbDrone.Web/Content2/Bootstrap/wells.less b/NzbDrone.Web/_backboneApp/Content/Bootstrap/wells.less similarity index 100% rename from NzbDrone.Web/Content2/Bootstrap/wells.less rename to NzbDrone.Web/_backboneApp/Content/Bootstrap/wells.less diff --git a/NzbDrone.Web/Content2/Images/Indexers/FileSharingTalk.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/FileSharingTalk.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/FileSharingTalk.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/FileSharingTalk.png diff --git a/NzbDrone.Web/Content2/Images/Indexers/Newznab.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/Newznab.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/Newznab.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/Newznab.png diff --git a/NzbDrone.Web/Content2/Images/Indexers/Newznab_Nzbs.org.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/Newznab_Nzbs.org.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/Newznab_Nzbs.org.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/Newznab_Nzbs.org.png diff --git a/NzbDrone.Web/Content2/Images/Indexers/Newznab_dognzb.cr.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/Newznab_dognzb.cr.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/Newznab_dognzb.cr.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/Newznab_dognzb.cr.png diff --git a/NzbDrone.Web/Content2/Images/Indexers/Newznab_nzb.su.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/Newznab_nzb.su.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/Newznab_nzb.su.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/Newznab_nzb.su.png diff --git a/NzbDrone.Web/Content2/Images/Indexers/NzbClub.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/NzbClub.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/NzbClub.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/NzbClub.png diff --git a/NzbDrone.Web/Content2/Images/Indexers/NzbIndex.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/NzbIndex.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/NzbIndex.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/NzbIndex.png diff --git a/NzbDrone.Web/Content2/Images/Indexers/NzbsRus.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/NzbsRus.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/NzbsRus.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/NzbsRus.png diff --git a/NzbDrone.Web/Content2/Images/Indexers/Unknown.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/Unknown.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/Unknown.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/Unknown.png diff --git a/NzbDrone.Web/Content2/Images/Indexers/WomblesIndex.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/WomblesIndex.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/WomblesIndex.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/WomblesIndex.png diff --git a/NzbDrone.Web/Content2/Images/Indexers/nzbx.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/nzbx.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/nzbx.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/nzbx.png diff --git a/NzbDrone.Web/Content2/Images/Indexers/omgwtfnzbs.png b/NzbDrone.Web/_backboneApp/Content/Images/Indexers/omgwtfnzbs.png similarity index 100% rename from NzbDrone.Web/Content2/Images/Indexers/omgwtfnzbs.png rename to NzbDrone.Web/_backboneApp/Content/Images/Indexers/omgwtfnzbs.png diff --git a/NzbDrone.Web/Content2/Images/ajax-loader.gif b/NzbDrone.Web/_backboneApp/Content/Images/ajax-loader.gif similarity index 100% rename from NzbDrone.Web/Content2/Images/ajax-loader.gif rename to NzbDrone.Web/_backboneApp/Content/Images/ajax-loader.gif diff --git a/NzbDrone.Web/Content2/Images/apple-touch-icon-114.png b/NzbDrone.Web/_backboneApp/Content/Images/apple-touch-icon-114.png similarity index 100% rename from NzbDrone.Web/Content2/Images/apple-touch-icon-114.png rename to NzbDrone.Web/_backboneApp/Content/Images/apple-touch-icon-114.png diff --git a/NzbDrone.Web/Content2/Images/apple-touch-icon-144.png b/NzbDrone.Web/_backboneApp/Content/Images/apple-touch-icon-144.png similarity index 100% rename from NzbDrone.Web/Content2/Images/apple-touch-icon-144.png rename to NzbDrone.Web/_backboneApp/Content/Images/apple-touch-icon-144.png diff --git a/NzbDrone.Web/Content2/Images/azure.gif b/NzbDrone.Web/_backboneApp/Content/Images/azure.gif similarity index 100% rename from NzbDrone.Web/Content2/Images/azure.gif rename to NzbDrone.Web/_backboneApp/Content/Images/azure.gif diff --git a/NzbDrone.Web/Content2/Images/background.jpg b/NzbDrone.Web/_backboneApp/Content/Images/background.jpg similarity index 100% rename from NzbDrone.Web/Content2/Images/background.jpg rename to NzbDrone.Web/_backboneApp/Content/Images/background.jpg diff --git a/NzbDrone.Web/Content2/Images/gritter.png b/NzbDrone.Web/_backboneApp/Content/Images/gritter.png similarity index 100% rename from NzbDrone.Web/Content2/Images/gritter.png rename to NzbDrone.Web/_backboneApp/Content/Images/gritter.png diff --git a/NzbDrone.Web/Content2/Images/icon_source.url b/NzbDrone.Web/_backboneApp/Content/Images/icon_source.url similarity index 100% rename from NzbDrone.Web/Content2/Images/icon_source.url rename to NzbDrone.Web/_backboneApp/Content/Images/icon_source.url diff --git a/NzbDrone.Web/Content2/Images/icons.png b/NzbDrone.Web/_backboneApp/Content/Images/icons.png similarity index 100% rename from NzbDrone.Web/Content2/Images/icons.png rename to NzbDrone.Web/_backboneApp/Content/Images/icons.png diff --git a/NzbDrone.Web/Content2/Images/logo.png b/NzbDrone.Web/_backboneApp/Content/Images/logo.png similarity index 100% rename from NzbDrone.Web/Content2/Images/logo.png rename to NzbDrone.Web/_backboneApp/Content/Images/logo.png diff --git a/NzbDrone.Web/Content2/Images/logo_small.png b/NzbDrone.Web/_backboneApp/Content/Images/logo_small.png similarity index 100% rename from NzbDrone.Web/Content2/Images/logo_small.png rename to NzbDrone.Web/_backboneApp/Content/Images/logo_small.png diff --git a/NzbDrone.Web/Content2/Images/spinner.gif b/NzbDrone.Web/_backboneApp/Content/Images/spinner.gif similarity index 100% rename from NzbDrone.Web/Content2/Images/spinner.gif rename to NzbDrone.Web/_backboneApp/Content/Images/spinner.gif diff --git a/NzbDrone.Web/Content2/Images/thetvdb.png b/NzbDrone.Web/_backboneApp/Content/Images/thetvdb.png similarity index 100% rename from NzbDrone.Web/Content2/Images/thetvdb.png rename to NzbDrone.Web/_backboneApp/Content/Images/thetvdb.png diff --git a/NzbDrone.Web/Content2/Intelisense/bootstrap-responsive.css b/NzbDrone.Web/_backboneApp/Content/Intelisense/bootstrap-responsive.css similarity index 100% rename from NzbDrone.Web/Content2/Intelisense/bootstrap-responsive.css rename to NzbDrone.Web/_backboneApp/Content/Intelisense/bootstrap-responsive.css diff --git a/NzbDrone.Web/Content2/Intelisense/bootstrap.css b/NzbDrone.Web/_backboneApp/Content/Intelisense/bootstrap.css similarity index 99% rename from NzbDrone.Web/Content2/Intelisense/bootstrap.css rename to NzbDrone.Web/_backboneApp/Content/Intelisense/bootstrap.css index 9fa6f766f..4eb0c56d6 100644 --- a/NzbDrone.Web/Content2/Intelisense/bootstrap.css +++ b/NzbDrone.Web/_backboneApp/Content/Intelisense/bootstrap.css @@ -67,7 +67,7 @@ sub { } img { - width: auto\9; + width: auto; height: auto; max-width: 100%; vertical-align: middle; diff --git a/NzbDrone.Web/Content2/Menu.css b/NzbDrone.Web/_backboneApp/Content/Menu.css similarity index 100% rename from NzbDrone.Web/Content2/Menu.css rename to NzbDrone.Web/_backboneApp/Content/Menu.css diff --git a/NzbDrone.Web/Content2/base.css b/NzbDrone.Web/_backboneApp/Content/base.css similarity index 97% rename from NzbDrone.Web/Content2/base.css rename to NzbDrone.Web/_backboneApp/Content/base.css index df301e023..701918fa5 100644 --- a/NzbDrone.Web/Content2/base.css +++ b/NzbDrone.Web/_backboneApp/Content/base.css @@ -32,6 +32,7 @@ body { } #main-region { + margin-top: 20px; min-height: 600px; } diff --git a/NzbDrone.Web/Content2/font/fontawesome-webfont.eot b/NzbDrone.Web/_backboneApp/Content/font/fontawesome-webfont.eot similarity index 100% rename from NzbDrone.Web/Content2/font/fontawesome-webfont.eot rename to NzbDrone.Web/_backboneApp/Content/font/fontawesome-webfont.eot diff --git a/NzbDrone.Web/Content2/font/fontawesome-webfont.svg b/NzbDrone.Web/_backboneApp/Content/font/fontawesome-webfont.svg similarity index 100% rename from NzbDrone.Web/Content2/font/fontawesome-webfont.svg rename to NzbDrone.Web/_backboneApp/Content/font/fontawesome-webfont.svg diff --git a/NzbDrone.Web/Content2/font/fontawesome-webfont.ttf b/NzbDrone.Web/_backboneApp/Content/font/fontawesome-webfont.ttf similarity index 100% rename from NzbDrone.Web/Content2/font/fontawesome-webfont.ttf rename to NzbDrone.Web/_backboneApp/Content/font/fontawesome-webfont.ttf diff --git a/NzbDrone.Web/Content2/font/fontawesome-webfont.woff b/NzbDrone.Web/_backboneApp/Content/font/fontawesome-webfont.woff similarity index 100% rename from NzbDrone.Web/Content2/font/fontawesome-webfont.woff rename to NzbDrone.Web/_backboneApp/Content/font/fontawesome-webfont.woff diff --git a/NzbDrone.Web/JsLibraries/backbone.js b/NzbDrone.Web/_backboneApp/JsLibraries/backbone.js similarity index 100% rename from NzbDrone.Web/JsLibraries/backbone.js rename to NzbDrone.Web/_backboneApp/JsLibraries/backbone.js diff --git a/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.extend.js b/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.extend.js new file mode 100644 index 000000000..2e8c9323c --- /dev/null +++ b/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.extend.js @@ -0,0 +1,20 @@ +_.extend(Marionette.TemplateCache.prototype, { + + loadTemplate: function (templateId) { + + var template = "
        TEMPLATE [" + templateId + "] NOT FOUND
        "; + + jQuery.ajax({ + url: 'Backbone.NzbDrone//' + templateId + '.html', + async: false + + }).done(function (data) { + template = data; + + }).fail(function (data) { + console.log("couldn't load template " + this.templateId + " Error: " + data.statusText); + }); + + return template; + } +}); \ No newline at end of file diff --git a/NzbDrone.Web/JsLibraries/backbone.marionette.js b/NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.js similarity index 100% rename from NzbDrone.Web/JsLibraries/backbone.marionette.js rename to NzbDrone.Web/_backboneApp/JsLibraries/backbone.marionette.js diff --git a/NzbDrone.Web/Scripts2/bootstrap.js b/NzbDrone.Web/_backboneApp/JsLibraries/bootstrap.js similarity index 100% rename from NzbDrone.Web/Scripts2/bootstrap.js rename to NzbDrone.Web/_backboneApp/JsLibraries/bootstrap.js diff --git a/NzbDrone.Web/JsLibraries/jquery-1.8.2.intellisense.js b/NzbDrone.Web/_backboneApp/JsLibraries/jquery-1.8.2.intellisense.js similarity index 100% rename from NzbDrone.Web/JsLibraries/jquery-1.8.2.intellisense.js rename to NzbDrone.Web/_backboneApp/JsLibraries/jquery-1.8.2.intellisense.js diff --git a/NzbDrone.Web/JsLibraries/jquery-1.8.2.js b/NzbDrone.Web/_backboneApp/JsLibraries/jquery-1.8.2.js similarity index 100% rename from NzbDrone.Web/JsLibraries/jquery-1.8.2.js rename to NzbDrone.Web/_backboneApp/JsLibraries/jquery-1.8.2.js diff --git a/NzbDrone.Web/JsLibraries/jquery-ui-1.9.0.js b/NzbDrone.Web/_backboneApp/JsLibraries/jquery-ui-1.9.0.js similarity index 100% rename from NzbDrone.Web/JsLibraries/jquery-ui-1.9.0.js rename to NzbDrone.Web/_backboneApp/JsLibraries/jquery-ui-1.9.0.js diff --git a/NzbDrone.Web/JsLibraries/underscore.js b/NzbDrone.Web/_backboneApp/JsLibraries/underscore.js similarity index 100% rename from NzbDrone.Web/JsLibraries/underscore.js rename to NzbDrone.Web/_backboneApp/JsLibraries/underscore.js diff --git a/NzbDrone.Web/_backboneApp/app.js b/NzbDrone.Web/_backboneApp/app.js new file mode 100644 index 000000000..9bceadcee --- /dev/null +++ b/NzbDrone.Web/_backboneApp/app.js @@ -0,0 +1,59 @@ +NzbDrone = new Backbone.Marionette.Application(); + +NzbDrone.Constants = { + + +}; + +NzbDrone.Events = { + DisplayInMainRegion: "DisplayInMainRegion", +}; + + +NzbDrone.Routes = { + Series: { + Add: 'series/add', + + }, +}; + + +NzbDrone.Controller = Backbone.Marionette.Controller.extend({ + + addSeries: function () { + NzbDrone.mainRegion.show(new NzbDrone.AddSeriesView()); + }, + + + notFound: function () { + alert('route not found'); + }, +}); + + +NzbDrone.MyRouter = Backbone.Marionette.AppRouter.extend({ + + controller: new NzbDrone.Controller(), + // "someMethod" must exist at controller.someMethod + appRoutes: { + "series/add": "addSeries", + ":whatever": "notFound" + + } + +}); + +NzbDrone.addInitializer(function (options) { + + console.log("starting application"); + + + NzbDrone.addRegions({ + mainRegion: "#main-region", + }); + + NzbDrone.Router = new NzbDrone.MyRouter(); + Backbone.history.start(); + + +}); \ No newline at end of file diff --git a/NzbDrone.Web/app.js b/NzbDrone.Web/app.js deleted file mode 100644 index be98448c3..000000000 --- a/NzbDrone.Web/app.js +++ /dev/null @@ -1,78 +0,0 @@ -NzbDrone = new Backbone.Marionette.Application(); - -NzbDrone.Constants = { - - -}; - -NzbDrone.Events = { - DisplayInMainRegion: "DisplayInMainRegion", -}; - - -NzbDrone.Routes = { - Series: { - Add: 'series/add', - AddNew: 'series/addnew', - AddExisting: 'series/addExisting', - AddExistingSingle: 'series/addExisting/single', - AddExistingMultiple: 'series/addExisting/multiple', - }, -}; - - -NzbDrone.Controller = Backbone.Marionette.Controller.extend({ - - AddSeries: function () { - NzbDrone.mainRegion.show(new NzbDrone.AddSeriesView()); - }, - - AddNewSeries: function () { - NzbDrone.mainRegion.show(new NzbDrone.AddNewSeriesView()); - }, - - AddExistingSeries: function () { - NzbDrone.mainRegion.show(new NzbDrone.AddExistingSeriesView()); - }, - - AddExistingSeriesSingle: function () { - NzbDrone.mainRegion.show(new NzbDrone.AddExistingSeriesSingleView()); - }, - - AddExistingSeriesMultiple: function () { - NzbDrone.mainRegion.show(new NzbDrone.AddExistingSeriesMultipleView()); - }, - - -}); - - -NzbDrone.MyRouter = Backbone.Marionette.AppRouter.extend({ - - controller: new NzbDrone.Controller(), - // "someMethod" must exist at controller.someMethod - appRoutes: { - "":"AddSeries", - "series/add": "AddSeries", - "series/addnew": "AddNewSeries", - "series/addExisting": "AddExistingSeries", - "series/addExisting/single": "AddExistingSeriesSingle", - "series/addExisting/multiple": "AddExistingSeriesMultiple", - } - -}); - -NzbDrone.addInitializer(function (options) { - - console.log("starting application"); - - - NzbDrone.addRegions({ - mainRegion: "#main-region", - }); - - NzbDrone.Router = new NzbDrone.MyRouter(); - Backbone.history.start(); - - -}); \ No newline at end of file diff --git a/NzbDrone.sln.DotSettings b/NzbDrone.sln.DotSettings new file mode 100644 index 000000000..9f25055a6 --- /dev/null +++ b/NzbDrone.sln.DotSettings @@ -0,0 +1,3 @@ + + BOTH_SIDES + OUTLINE \ No newline at end of file