http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/bootstrap/bootstrap.min.js ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/bootstrap/bootstrap.min.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/bootstrap/bootstrap.min.js new file mode 100644 index 0000000..7c1561a --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/bootstrap/bootstrap.min.js @@ -0,0 +1,6 @@ +/*! + * Bootstrap v3.2.0 (http://getbootstrap.com) + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==type of b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.2.0",d.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(150):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b) ,this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.2.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),d[e](null==f[b]?this.options[b]:f[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("clic k.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b).on("keydown.bs.carousel",a.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.2.0",c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();brea k;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.to=function(b){var c=this,d=this.getItemIndex(this.$active=this.$element.find(".item.active"));return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.sli de("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=e[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:g});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(e)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].joi n(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(m)),f&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},c.DEFAULTS,d.data(), "object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(b=!b),e||d.data("bs.collapse",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};c.VERSION="3.2.0",c.DEFAULTS={toggle:!0},c.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},c.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var c=a.Event("show.bs.collapse");if(this.$element.trigger(c),!c.isDefaultPrevented()){var d=this.$parent&&this.$parent.find("> .panel > .in");if(d&&d.length){var e=d.data("bs.collapse");if(e&&e.transitioning)return;b.call(d,"hide"),e||d.data("bs.collapse",null)}var f=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[f](0),this.transitioning=1;var g=function(){this.$element.removeClass("collapsing").addClass("collapse in" )[f](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return g.call(this);var h=a.camelCase(["scroll",f].join("-"));this.$element.one("bsTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(350)[f](this.$element[0][h])}}},c.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var d=a.fn.collapse;a.fn.collapse=b,a.f n.collapse.Constructor=c,a.fn.collapse.noConflict=function(){return a.fn.collapse=d,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(c){var d,e=a(this),f=e.attr("data-target")||c.preventDefault()||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),g=a(f),h=g.data("bs.collapse"),i=h?"toggle":e.data(),j=e.attr("data-parent"),k=j&&a(j);h&&h.transitioning||(k&&k.find('[data-toggle="collapse"][data-parent="'+j+'"]').not(e).addClass("collapsed"),e[g.hasClass("in")?"addClass":"removeClass"]("collapsed")),b.call(g,i)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d: b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.2.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&e.find(f).trigge r("focus"),d.trigger("click");var h=" li:not(.divider):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f+', [role="menu"], [role="listbox"]',g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$elemen t=a(b),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.2.0",c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(c.$body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{ relatedTarget:b});d?c.$element.find(".modal-dialog").one("bsTransitionEnd",function(){c.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(300):c.$element.trigger("focus").trigger(e)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard ?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;if(this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(150):b()}else if(!this.isShown&&this.$b ackdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(150):f()}else b&&b()},c.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal "]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.2.0",c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{sel ector:"body",padding:0}},c.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}) ,b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=fu nction(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var c=a.contains(document.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!c)return;var d=this,e=this.tip(),f=this.getUID(this.type);this.setContent(),e.attr("id",f),this.$element.attr("aria-describedby",f),this.options.animation&&e.addClass("fade");var g="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,h=/\s?auto?\s?/i,i=h.test(g);i&&(g=g.replace(h,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(g).data("bs."+this.type,this),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var j=this.getPosition(),k=e[0].offsetWidth,l=e[0].offsetHeight;if(i){var m=g,n=this.$element.parent(),o=this.getPosition(n);g="bottom"==g&&j.top+j.height+l-o.scroll>o.height?"top":"top"==g&&j.top-o.scroll-l<0?"bottom":"right"==g&&j.right+k>o.width?"left":"left"==g&&j. left-k<o.left?"right":g,e.removeClass(m).addClass(g)}var p=this.getCalculatedOffset(g,j,k,l);this.applyPlacement(p,g);var q=function(){d.$element.trigger("shown.bs."+d.type),d.hoverState=null};a.support.transition&&this.$tip.hasClass("fade")?e.one("bsTransitionEnd",q).emulateTransitionEnd(150):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top=b.top+g,b.left=b.left+h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=k.left?2*k.left-e+i:2*k.top-f+j,m=k.left?"left":"top",n=k.left?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(l,d[0][n],m)},c.prototype.replaceArrow=function(a ,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach(),c.$element.trigger("hidden.bs."+c.type)}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.removeAttr("aria-describedby"),this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one("bsTransitionEnd",b).emulateTransitionEnd(150):b(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName;return a.ex tend({},"function"==typeof c.getBoundingClientRect?c.getBoundingClientRect():null,{scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop(),width:d?a(window).width():b.outerWidth(),height:d?a(window).height():b.outerHeight()},d?{top:0,left:0}:b.offset())},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.width&&(e.left=g.left+g.width-k)}return e},c.prototype. getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){clearTime out(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.2.0",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a= this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").empty()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},c.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c ).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.2.0",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.len gth&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var d=a.fn.scrollspy;a.fn.scr ollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.2.0",c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.closest("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},c.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find ("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),f.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(c){c.preventDefault(),b.call(a(this),"show")})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api ",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.2.0",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=a(document).height(),d=this.$target.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=b-h?"bottom":null!=g&&g>=d?"top":!1;if(t his.affixed!==i){null!=this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:b-this.$element.height()-h}))}}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},d.offsetBottom&&(d.offset.bottom=d.offsetBottom),d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.bower.json ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.bower.json b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.bower.json new file mode 100644 index 0000000..cfebce4 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.bower.json @@ -0,0 +1,15 @@ +{ + "name": "globalize", + "homepage": "https://github.com/jquery/globalize", + "version": "0.1.1", + "_release": "0.1.1", + "_resolution": { + "type": "version", + "tag": "v0.1.1", + "commit": "2cbbe9e30609735aab9dc29d8c53c5cd8f810149" + }, + "_source": "git://github.com/jquery/globalize.git", + "_target": "~0.1.1", + "_originalSource": "globalize", + "_direct": true +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.gitignore ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.gitignore b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.gitignore new file mode 100644 index 0000000..ee7a347 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.gitignore @@ -0,0 +1,9 @@ +.project +*~ +*.diff +*.patch +.DS_Store +generator/bin +generator/obj +node_modules +dist \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.npmignore ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.npmignore b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.npmignore new file mode 100644 index 0000000..dba9ccc --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/.npmignore @@ -0,0 +1 @@ +generator/ http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/LICENSE ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/LICENSE b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/LICENSE new file mode 100644 index 0000000..9c8b022 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/LICENSE @@ -0,0 +1,21 @@ +Copyright Software Freedom Conservancy, Inc. +http://jquery.org/license + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/README.md ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/README.md b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/README.md new file mode 100644 index 0000000..cfbbe61 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/README.md @@ -0,0 +1,865 @@ +# Globalize + +A JavaScript library for globalization and localization. Enables complex +culture-aware number and date parsing and formatting, including the raw +culture information for hundreds of different languages and countries, as well +as an extensible system for localization. + +<hr> +<ul> +<li><a href="#why">Why Globalization</a></li> +<li><a href="#what">What is a Culture?</a></li> +<li><a href="#addCultureInfo">Globalize.addCultureInfo</a></li> +<li><a href="#cultures">Globalize.cultures</a></li> +<li><a href="#culture">Globalize.culture</a></li> +<li><a href="#find">Globalize.findClosestCulture</a></li> +<li><a href="#format">Globalize.format</a></li> +<li><a href="#localize">Globalize.localize</a></li> +<li><a href="#parseInt">Globalize.parseInt</a></li> +<li><a href="#parseFloat">Globalize.parseFloat</a></li> +<li><a href="#parseDate">Globalize.parseDate</a></li> +<li><a href="#extend">Utilizing and Extending Cultures</a></li> +<li><a href="#defining">Defining Culture Information</a></li> +<li><a href="#numbers">Number Formatting</a></li> +<li><a href="#currency">Currency Formatting</a></li> +<li><a href="#dates">Date Formatting</a></li> +<li><a href="#generating">Generating Culture Files</a></li> +<li><a href="#building">Building Globalize</a></li> +</ul> + +<a name="why"></a> +<h2 id="why">Why Globalization?</h2> +<p> +Each language, and the countries that speak that language, have different +expectations when it comes to how numbers (including currency and percentages) +and dates should appear. Obviously, each language has different names for the +days of the week and the months of the year. But they also have different +expectations for the structure of dates, such as what order the day, month and +year are in. In number formatting, not only does the character used to +delineate number groupings and the decimal portion differ, but the placement of +those characters differ as well. +</p> +<p> +A user using an application should be able to read and write dates and numbers +in the format they are accustomed to. This library makes this possible, +providing an API to convert user-entered number and date strings - in their +own format - into actual numbers and dates, and conversely, to format numbers +and dates into that string format. +</p> + +<a name="what"></a> +<h2 id="what">What is a Culture?</h2> +<p> +Globalize defines roughly 350 cultures. Part of the reason for this large +number, besides there being a lot of cultures in the world, is because for +some languages, expectations differ among the countries that speak it. +English, for example, is an official language in dozens of countries. Despite +the language being English, the expected date formatting still greatly differs +between them. +</p> +<p> +So, it does not seem useful to define cultures by their language alone. Nor +is it useful to define a culture by its country alone, as many countries have +several official languages, spoken by sizable populations. Therefore, cultures +are defined as a combination of the language and the country speaking it. Each +culture is given a unique code that is a combination of an ISO 639 two-letter +lowercase culture code for the language, and a two-letter uppercase code for +the country or region. For example, "en-US" is the culture code for English in +the United States. +</p> +<p> +Yet, it is perhaps unreasonable to expect application developers to cater to +every possible language/country combination perfectly. It is important then to +define so-called "neutral" cultures based on each language. These cultures +define the most likely accepted set of rules by anyone speaking that language, +whatever the country. Neutral cultures are defined only by their language code. +For example, "es" is the neutral culture for Spanish. +</p> + +<a name="addCultureInfo"></a> +<h2 id="addCultureInfo">Globalize.addCultureInfo( cultureName, extendCultureName, info )</h2> +<p> +This method allows you to create a new culture based on an existing culture or +add to existing culture info. If the optional argument <pre>extendCultureName</pre> +is not supplied, it will extend the existing culture if it exists or create a new +culture based on the default culture if it doesn't exist. If cultureName is not +supplied, it will add the supplied info to the current culture. See .culture(). +</p> + + +<a name="cultures"></a> +<h2 id="cultures">Globalize.cultures</h2> +<p> +A mapping of culture codes to culture objects. For example, +Globalize.cultures.fr is an object representing the complete culture +definition for the neutral French culture. Note that the main globalize.js file +alone only includes a neutral English culture. To get additional cultures, you +must include one or more of the culture scripts that come with it. You +can see in the section <a href="#defining">Defining Culture Information</a> +below which fields are defined in each culture. +</p> + +<a name="culture"></a> +<h2 id="culture">Globalize.culture( selector )</h2> +<p> +An application that supports globalization and/or localization will need to +have a way to determine the user's preference. Attempting to automatically +determine the appropriate culture is useful, but it is good practice to always +offer the user a choice, by whatever means. +</p> +<p> +Whatever your mechanism, it is likely that you will have to correlate the +user's preferences with the list of cultures supported in the app. This +method allows you to select the best match given the culture scripts that you +have included and to set the Globalize culture to the culture which the user +prefers. +</p> +<p> +If you pass an array of names instead of a single name string, the first +culture for which there is a match (that culture's script has been referenced) +will be used. If none match, the search restarts using the corresponding +neutral cultures. For example, if the application has included only the neutral +"fr" culture, any of these would select it: +<pre> +Globalize.culture( "fr" ); +console.log( Globalize.culture().name ) // "fr" + +Globalize.culture( "fr-FR" ); +console.log( Globalize.culture().name ) // "fr-FR" + +Globalize.culture([ "es-MX", "fr-FR" ]); +console.log( Globalize.culture().name ) // "es-MX" +</pre> + +In any case, if no match is found, the neutral English culture "en" is selected +by default. + +If you don't pass a selector, .culture() will return the current Globalize +culture. +</p> +<p> +Each culture string may also follow the pattern defined in +<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4" +>RFC2616 sec 14.4</a>. That is, a culture name may include a "quality" value +that indicates an estimate of the user's preference for the language. + +<pre> +Globalize.culture( "fr;q=0.4, es;q=0.5, he" ); +</pre> +In this example, the neutral Hebrew culture "he" is given top priority (an +unspecified quality is equal to 1). If that language is not an exact match for +any of the cultures available in Globalize.cultures, then "es" is the next +highest priority with 0.5, etc. If none of these match, just like with the array +syntax, the search starts over and the same rules are applied to the +corresponding neutral language culture for each. If still none match, the +neutral English culture "en" is used. +</p> + +<a name="find"></a> +<h2 id="find">Globalize.findClosestCulture( selector )</h2> +<p> +Just like .culture( selector ), but it just returns the matching culture, if +any, without setting it to the current Globalize culture, returned by +.culture(). +</p> + +<a name="format"></a> +<h2 id="format">Globalize.format( value, format, culture )</h2> +<p> +Formats a date or number according to the given format string and the given +culture (or the current culture if not specified). See the sections +<a href="#numbers">Number Formatting</a> and +<a href="#dates">Date Formatting</a> below for details on the available +formats. +<pre> +// assuming a culture with number grouping of 3 digits, +// using "," separator and "." decimal symbol. +Globalize.format( 1234.567, "n" ); // "1,234.57" +Globalize.format( 1234.567, "n1" ); // "1,234.6" +Globalize.format( 1234.567, "n0" ); // "1,235" + +// assuming a culture with "/" as the date separator symbol +Globalize.format( new Date(1955,10,5), "yyyy/MM/dd" ); // "1955/11/05" +Globalize.format( new Date(1955,10,5), "dddd MMMM d, yyyy" ); // "Saturday November 5, 1955" +</pre> +</p> + +<a name="localize"></a> +<h2 id="localize">Globalize.localize( key, culture )</h2> +<p> +Gets or sets a localized value. This method allows you to extend the +information available to a particular culture, and to easily retrieve it +without worrying about finding the most appropriate culture. For example, to +define the word "translate" in French: +<pre> +Globalize.addCultureInfo( "fr", { + messages: { + "translate": "traduire" + } +}); +console.log( Globalize.localize( "translate", "fr" ) ); // "traduire" +</pre> +Note that localize() will find the closest match available per the same +semantics as the Globalize.findClosestCulture() method. If there is no +match, the translation given is for the neutral English culture "en" by +default. +</p> + + +<a name="parseInt"></a> +<h2 id="parseInt">Globalize.parseInt( value, radix, culture )</h2> +<p> +Parses a string representing a whole number in the given radix (10 by default), +taking into account any formatting rules followed by the given culture (or the +current culture, if not specified). + +If a percentage is passed into parseInt, the percent sign will be removed and the number parsed as is. +Example: 12.34% would be returned as 12. +<pre> +// assuming a culture where "," is the group separator +// and "." is the decimal separator +Globalize.parseInt( "1,234.56" ); // 1234 +// assuming a culture where "." is the group separator +// and "," is the decimal separator +Globalize.parseInt( "1.234,56" ); // 1234 +</pre> +</p> + +<a name="parseFloat"></a> +<h2 id="parseFloat">Globalize.parseFloat( value, radix, culture )</h2> +<p> +Parses a string representing a floating point number in the given radix (10 by +default), taking into account any formatting rules followed by the given +culture (or the current culture, if not specified). + +If a percentage is passed into parseFloat, the percent sign will be removed and the number parsed as is. +Example: 12.34% would be returned as 12.34 +<pre> +// assuming a culture where "," is the group separator +// and "." is the decimal separator +Globalize.parseFloat( "1,234.56" ); // 1234.56 +// assuming a culture where "." is the group separator +// and "," is the decimal separator +Globalize.parseFloat( "1.234,56" ); // 1234.56 +</pre> +</p> + +<a name="parseDate"></a> +<h2 id="parseDate">Globalize.parseDate( value, formats, culture )</h2> +<p> +Parses a string representing a date into a JavaScript Date object, taking into +account the given possible formats (or the given culture's set of default +formats if not given). As before, the current culture is used if one is not +specified. +<pre> +Globalize.culture( "en" ); +Globalize.parseDate( "1/2/2003" ); // Thu Jan 02 2003 +Globalize.culture( "fr" ); +Globalize.parseDate( "1/2/2003" ); // Sat Feb 01 2003 +</pre> +</p> + +<a name="extend"></a> +<h2 id="extend">Utilizing and Extending Cultures</h2> +<p> +The culture information included with each culture is mostly necessary for the +parsing and formatting methods, but not all of it. For example, the Native and +English names for each culture is given, as well as a boolean indicating +whether the language is right-to-left. This may be useful information for your +own purposes. You may also add to the culture information directly if so +desired. +</p> +<p> +As an example, in the U.S., the word "billion" means the number 1,000,000,000 +(9 zeros). But in other countries, that number is "1000 million" or a +"milliard", and a billion is 1,000,000,000,000 (12 zeros). If you needed to +provide functionality to your app or custom plugin that needed to know how many +zeros are in a "billion", you could extend the culture information as follows: +<pre> +// define additional culture information for a possibly existing culture +Globalize.addCultureInfo( "fr", { + numberFormat: { + billionZeroes: 12 + } +}); +</pre> +Using this mechanism, the "fr" culture will be created if it does not exist. +And if it does, the given values will be added to it. +</p> + +<a name="defining"></a> +<h2 id="defining">Defining Culture Information</h2> +<p> +Each culture is defined in its own script with the naming scheme +globalize.culture.<name>.js. You may include any number of these scripts, +making them available in the Globalize.cultures mapping. Including one of +these scripts does NOT automatically make it the current culture selected in the +Globalize.culture property. +</p> +<p> +The neutral English culture is defined directly in globalize.js, and set +both to the properties "en" and "default" of the Globalize.cultures mapping. +Extensive comments describe the purpose of each of the fields defined. +</p> +<p> +Looking at the source code of the scripts for each culture, you will notice +that each script uses Globalize.addCultureInfo() to have the "default" neutral +English culture "en", as a common basis, and defines only the properties that +differ from neutral English. +</p> +<p> +The neutral English culture is listed here along with the comments: +<pre> +Globalize.cultures[ "default" ] = { + // A unique name for the culture in the form + // <language code>-<country/region code> + name: "English", + // the name of the culture in the English language + englishName: "English", + // the name of the culture in its own language + nativeName: "English", + // whether the culture uses right-to-left text + isRTL: false, + // "language" is used for so-called "specific" cultures. + // For example, the culture "es-CL" means Spanish in Chili. + // It represents the Spanish-speaking culture as it is in Chili, + // which might have different formatting rules or even translations + // than Spanish in Spain. A "neutral" culture is one that is not + // specific to a region. For example, the culture "es" is the generic + // Spanish culture, which may be a more generalized version of the language + // that may or may not be what a specific culture expects. + // For a specific culture like "es-CL", the "language" field refers to the + // neutral, generic culture information for the language it is using. + // This is not always a simple matter of the string before the dash. + // For example, the "zh-Hans" culture is neutral (Simplified Chinese). + // And the "zh-SG" culture is Simplified Chinese in Singapore, whose + // language field is "zh-CHS", not "zh". + // This field should be used to navigate from a specific culture to its + // more general, neutral culture. If a culture is already as general as it + // can get, the language may refer to itself. + language: "en", + // "numberFormat" defines general number formatting rules, like the digits + // in each grouping, the group separator, and how negative numbers are + // displayed. + numberFormat: { + // [negativePattern] + // Note, numberFormat.pattern has no "positivePattern" unlike percent + // and currency, but is still defined as an array for consistency with + // them. + // negativePattern: one of "(n)|-n|- n|n-|n -" + pattern: [ "-n" ], + // number of decimal places normally shown + decimals: 2, + // string that separates number groups, as in 1,000,000 + ",": ",", + // string that separates a number from the fractional portion, + // as in 1.99 + ".": ".", + // array of numbers indicating the size of each number group. + groupSizes: [ 3 ], + // symbol used for positive numbers + "+": "+", + // symbol used for negative numbers + "-": "-", + percent: { + // [negativePattern, positivePattern] + // negativePattern: one of "-n %|-n%|-%n|%-n|%n-|n-%|n%-|-% n|n %-|% n-|% -n|n- %" + // positivePattern: one of "n %|n%|%n|% n" + pattern: [ "-n %", "n %" ], + // number of decimal places normally shown + decimals: 2, + // array of numbers indicating the size of each number group. + groupSizes: [ 3 ], + // string that separates number groups, as in 1,000,000 + ",": ",", + // string that separates a number from the fractional portion, as in 1.99 + ".": ".", + // symbol used to represent a percentage + symbol: "%" + }, + currency: { + // [negativePattern, positivePattern] + // negativePattern: one of "($n)|-$n|$-n|$n-|(n$)|-n$|n-$|n$-|-n $|-$ n|n $-|$ n-|$ -n|n- $|($ n)|(n $)" + // positivePattern: one of "$n|n$|$ n|n $" + pattern: [ "($n)", "$n" ], + // number of decimal places normally shown + decimals: 2, + // array of numbers indicating the size of each number group. + groupSizes: [ 3 ], + // string that separates number groups, as in 1,000,000 + ",": ",", + // string that separates a number from the fractional portion, as in 1.99 + ".": ".", + // symbol used to represent currency + symbol: "$" + } + }, + // "calendars" property defines all the possible calendars used by this + // culture. There should be at least one defined with name "standard" which + // is the default calendar used by the culture. + // A calendar contains information about how dates are formatted, + // information about the calendar's eras, a standard set of the date + // formats, translations for day and month names, and if the calendar is + // not based on the Gregorian calendar, conversion functions to and from + // the Gregorian calendar. + calendars: { + standard: { + // name that identifies the type of calendar this is + name: "Gregorian_USEnglish", + // separator of parts of a date (e.g. "/" in 11/05/1955) + "/": "/", + // separator of parts of a time (e.g. ":" in 05:44 PM) + ":": ":", + // the first day of the week (0 = Sunday, 1 = Monday, etc) + firstDay: 0, + days: { + // full day names + names: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], + // abbreviated day names + namesAbbr: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], + // shortest day names + namesShort: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ] + }, + months: [ + // full month names (13 months for lunar calendars -- 13th month should be "" if not lunar) + names: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", "" ], + // abbreviated month names + namesAbbr: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "" ] + ], + // AM and PM designators in one of these forms: + // The usual view, and the upper and lower case versions + // [standard,lowercase,uppercase] + // The culture does not use AM or PM (likely all standard date + // formats use 24 hour time) + // null + AM: [ "AM", "am", "AM" ], + PM: [ "PM", "pm", "PM" ], + eras: [ + // eras in reverse chronological order. + // name: the name of the era in this culture (e.g. A.D., C.E.) + // start: when the era starts in ticks, null if it is the + // earliest supported era. + // offset: offset in years from gregorian calendar + {"name":"A.D.","start":null,"offset":0} + ], + // when a two digit year is given, it will never be parsed as a + // four digit year greater than this year (in the appropriate era + // for the culture) + // Set it as a full year (e.g. 2029) or use an offset format + // starting from the current year: "+19" would correspond to 2029 + // if the current year is 2010. + twoDigitYearMax: 2029, + // set of predefined date and time patterns used by the culture. + // These represent the format someone in this culture would expect + // to see given the portions of the date that are shown. + patterns: { + // short date pattern + d: "M/d/yyyy", + // long date pattern + D: "dddd, MMMM dd, yyyy", + // short time pattern + t: "h:mm tt", + // long time pattern + T: "h:mm:ss tt", + // long date, short time pattern + f: "dddd, MMMM dd, yyyy h:mm tt", + // long date, long time pattern + F: "dddd, MMMM dd, yyyy h:mm:ss tt", + // month/day pattern + M: "MMMM dd", + // month/year pattern + Y: "yyyy MMMM", + // S is a sortable format that does not vary by culture + S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss" + } + // optional fields for each calendar: + /* + monthsGenitive: + Same as months but used when the day preceeds the month. + Omit if the culture has no genitive distinction in month names. + For an explanation of genitive months, see + http://blogs.msdn.com/michkap/archive/2004/12/25/332259.aspx + convert: + Allows for the support of non-gregorian based calendars. This + "convert" object defines two functions to convert a date to and + from a gregorian calendar date: + fromGregorian( date ) + Given the date as a parameter, return an array with + parts [ year, month, day ] corresponding to the + non-gregorian based year, month, and day for the + calendar. + toGregorian( year, month, day ) + Given the non-gregorian year, month, and day, return a + new Date() object set to the corresponding date in the + gregorian calendar. + */ + } + }, + // Map of messages used by .localize() + messages: {} +} +</pre> +</p> +<p> +Each culture can have several possible calendars. The calendar named "standard" +is the default calendar used by that culture. You may change the calendar in +use by setting the "calendar" field. Take a look at the calendars defined by +each culture by looking at the script or enumerating its calendars collection. +<pre> +// switch to a non-standard calendar +Globalize.culture().calendar = Globalize.culture().calendars.SomeOtherCalendar; +// back to the standard calendar +Globalize.culture().calendar = Globalize.culture().calendars.standard; +</pre> + +</p> + +<a name="numbers"></a> +<h2 id="numbers">Number Formatting</h2> +<p> +When formatting a number with format(), the main purpose is to convert the +number into a human readable string using the culture's standard grouping and +decimal rules. The rules between cultures can vary a lot. For example, in some +cultures, the grouping of numbers is done unevenly. In the "te-IN" culture +(Telugu in India), groups have 3 digits and then 2 digits. The number 1000000 +(one million) is written as "10,00,000". Some cultures do not group numbers at +all. +</p> +<p> +There are four main types of number formatting: +<ul> +<li><strong>n</strong> for number</li> +<li><strong>d</strong> for decimal digits</li> +<li><strong>p</strong> for percentage</li> +<li><strong>c</strong> for currency</li> +</ul> +Even within the same culture, the formatting rules can vary between these four +types of numbers. For example, the expected number of decimal places may differ +from the number format to the currency format. Each format token may also be +followed by a number. The number determines how many decimal places to display +for all the format types except decimal, for which it means the minimum number +of digits to display, zero padding it if necessary. Also note that the way +negative numbers are represented in each culture can vary, such as what the +negative sign is, and whether the negative sign appears before or after the +number. This is especially apparent with currency formatting, where many +cultures use parentheses instead of a negative sign. +<pre> +// just for example - will vary by culture +Globalize.format( 123.45, "n" ); // 123.45 +Globalize.format( 123.45, "n0" ); // 123 +Globalize.format( 123.45, "n1" ); // 123.5 + +Globalize.format( 123.45, "d" ); // 123 +Globalize.format( 12, "d3" ); // 012 + +Globalize.format( 123.45, "c" ); // $123.45 +Globalize.format( 123.45, "c0" ); // $123 +Globalize.format( 123.45, "c1" ); // $123.5 +Globalize.format( -123.45, "c" ); // ($123.45) + +Globalize.format( 0.12345, "p" ); // 12.35 % +Globalize.format( 0.12345, "p0" ); // 12 % +Globalize.format( 0.12345, "p4" ); // 12.3450 % +</pre> +Parsing with parseInt and parseFloat also accepts any of these formats. +</p> + +<a name="currency"></a> +<h2 id="currency">Currency Formatting</h2> +<p> +Globalize has a default currency symbol for each locale. This is used when +formatting a currency value such as +<pre> +Globalize.format( 1234.56, "c" ); // $1,234.56 +</pre> +You can change the currency symbol for a locale by modifying the culture's +<code>numberFormat.currency.symbol</code> property: +<pre> +Globalize.culture( "en-US" ).numberFormat.currency.symbol = '\u20ac'; // euro sign U+20AC +</pre> +If you need to switch between currency symbols, you could write a function +to do that, such as +<pre> +function setCurrency( currSym ) { + Globalize.culture().numberFormat.currency.symbol = currSym; +} +</pre> + +<a name="dates"></a> +<h2 id="dates">Date Formatting</h2> +<p> +Date formatting varies wildly by culture, not just in the spelling of month and +day names, and the date separator, but by the expected order of the various +date components, whether to use a 12 or 24 hour clock, and how months and days +are abbreviated. Many cultures even include "genitive" month names, which are +different from the typical names and are used only in certain cases. +</p> +<p> +Also, each culture has a set of "standard" or "typical" formats. For example, +in "en-US", when displaying a date in its fullest form, it looks like +"Saturday, November 05, 1955". Note the non-abbreviated day and month name, the +zero padded date, and four digit year. So, Globalize expects a certain set +of "standard" formatting strings for dates in the "patterns" property of the +"standard" calendar of each culture, that describe specific formats for the +culture. The third column shows example values in the neutral English culture +"en-US"; see the second table for the meaning tokens used in date formats. + +<pre> +// just for example - will vary by culture +Globalize.format( new Date(2012, 1, 20), 'd' ); // 2/20/2012 +Globalize.format( new Date(2012, 1, 20), 'D' ); // Monday, February 20, 2012 +</pre> +<p> + +</p> +<table> +<tr> + <th>Format</th> + <th>Meaning</th> + <th>"en-US"</th> +</tr> +<tr> + <td>f</td> + <td>Long Date, Short Time</td> + <td>dddd, MMMM dd, yyyy h:mm tt</td> +</tr> +<tr> + <td>F</td> + <td>Long Date, Long Time</td> + <td>dddd, MMMM dd, yyyy h:mm:ss tt</td> +</tr> +<tr> + <td>t</td> + <td>Short Time</td> + <td>h:mm tt</td> +</tr> +<tr> + <td>T</td> + <td>Long Time</td> + <td>h:mm:ss tt</td> +</tr> +<tr> + <td>d</td> + <td>Short Date</td> + <td>M/d/yyyy</td> +</tr> +<tr> + <td>D</td> + <td>Long Date</td> + <td>dddd, MMMM dd, yyyy</td> +</tr> +<tr> + <td>Y</td> + <td>Month/Year</td> + <td>MMMM, yyyy</td> +</tr> +<tr> + <td>M</td> + <td>Month/Day</td> + <td>MMMM dd</td> +</tr> +</table> +</p> +<p> +In addition to these standard formats, there is the "S" format. This is a +sortable format that is identical in every culture: +"<strong>yyyy'-'MM'-'dd'T'HH':'mm':'ss</strong>". +</p> +<p> +When more specific control is needed over the formatting, you may use any +format you wish by specifying the following custom tokens: +<table> +<tr> + <th>Token</th> + <th>Meaning</th> + <th>Example</th> +</tr> +<tr> + <td>d</td> + <td>Day of month (no leading zero)</td> + <td>5</td> +</tr> +<tr> + <td>dd</td> + <td>Day of month (leading zero)</td> + <td>05</td> +</tr> +<tr> + <td>ddd</td> + <td>Day name (abbreviated)</td> + <td>Sat</td> +</tr> +<tr> + <td>dddd</td> + <td>Day name (full)</td> + <td>Saturday</td> +</tr> +<tr> + <td>M</td> + <td>Month of year (no leading zero)</td> + <td>9</td> +</tr> +<tr> + <td>MM</td> + <td>Month of year (leading zero)</td> + <td>09</td> +</tr> +<tr> + <td>MMM</td> + <td>Month name (abbreviated)</td> + <td>Sep</td> +</tr> +<tr> + <td>MMMM</td> + <td>Month name (full)</td> + <td>September</td> +</tr> +<tr> + <td>yy</td> + <td>Year (two digits)</td> + <td>55</td> +</tr> +<tr> + <td>yyyy</td> + <td>Year (four digits)</td> + <td>1955</td> +</tr> +<tr> + <td>'literal'</td> + <td>Literal Text</td> + <td>'of the clock'</td> +</tr> +<tr> + <td>\'</td> + <td>Single Quote</td> + <td>'o'\''clock'</td><!-- o'clock --> +</tr> +<tr> + <td>m</td> + <td>Minutes (no leading zero)</td> + <td>9</td> +</tr> +<tr> + <td>mm</td> + <td>Minutes (leading zero)</td> + <td>09</td> +</tr> +<tr> + <td>h</td> + <td>Hours (12 hour time, no leading zero)</td> + <td>6</td> +</tr> +<tr> + <td>hh</td> + <td>Hours (12 hour time, leading zero)</td> + <td>06</td> +</tr> +<tr> + <td>H</td> + <td>Hours (24 hour time, no leading zero)</td> + <td>5 (5am) 15 (3pm)</td> +</tr> +<tr> + <td>HH</td> + <td>Hours (24 hour time, leading zero)</td> + <td>05 (5am) 15 (3pm)</td> +</tr> +<tr> + <td>s</td> + <td>Seconds (no leading zero)</td> + <td>9</td> +</tr> +<tr> + <td>ss</td> + <td>Seconds (leading zero)</td> + <td>09</td> +</tr> +<tr> + <td>f</td> + <td>Deciseconds</td> + <td>1</td> +</tr> +<tr> + <td>ff</td> + <td>Centiseconds</td> + <td>11</td> +</tr> +<tr> + <td>fff</td> + <td>Milliseconds</td> + <td>111</td> +</tr> +<tr> + <td>t</td> + <td>AM/PM indicator (first letter)</td> + <td>A or P</td> +</tr> +<tr> + <td>tt</td> + <td>AM/PM indicator (full)</td> + <td>AM or PM</td> +</tr> +<tr> + <td>z</td> + <td>Timezone offset (hours only, no leading zero)</td> + <td>-8</td> +</tr> +<tr> + <td>zz</td> + <td>Timezone offset (hours only, leading zero)</td> + <td>-08</td> +</tr> +<tr> + <td>zzz</td> + <td>Timezone offset (full hours/minutes)</td> + <td>-08:00</td> +</tr> +<tr> + <td>g or gg</td> + <td>Era name</td> + <td>A.D.</td> +</tr> +</table> +</p> + +<a name="generating"></a> +<h1 id="generating">Generating Culture Files</h1> + +The Globalize culture files are generated JavaScript containing metadata and +functions based on culture info in the Microsoft .Net Framework 4. + +<h2>Requirements</h2> + +<ul> + <li>Windows</li> + <li>Microsoft .Net Framework 4 (Full, not just Client Profile) <a href="http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=0a391abd-25c1-4fc0-919f-b21f31ab88b7">download dotNetFx40_Full_x86_x64.exe</a></li> +</ul> + +<h2>Building the generator</h2> + +1. Open a Windows Command Prompt ( Start -> Run... -> cmd ) +1. Change directory to root of Globalize project (where README.md file is located) +1. >"C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild" generator\generator.csproj + +<h2>Running the generator</h2> + +1. Open a Windows Command Prompt +1. Change directory to root of Globalize project (where README.md file is located) +1. >"generator\bin\Debug\generator.exe" + +<a name="building"></a> +<h1 id="building">Building Globalize</h1> + +Globalize is built using <a href="https://github.com/cowboy/grunt">grunt</a>, a +node-based build utility. First, make sure grunt is installed globally: + +<pre> +> npm install -g grunt +</pre> + +then you can lint and test by simply running grunt in the globalize folder + +<pre> +> cd globalize +> grunt +</pre> http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/browser.css ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/browser.css b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/browser.css new file mode 100644 index 0000000..3b8bc5b --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/browser.css @@ -0,0 +1,80 @@ +body { + font-family: Arial +} +a { + color: #6D929B; +} +input { + width: 100px; + margin: 5px; +} +.results { + border-collapse: collapse; +} +.results td { + border: 1px solid #C1DAD7; + padding: 2px 2px 2px 2px; + color: #6D929B; + font-size: x-small; + white-space: nowrap; + text-align: center; +} +.results th { + border: 1px solid #C1DAD7; + letter-spacing: 2px; + text-align: center; + padding: 6px 6px 6px 12px; + white-space: nowrap; +} +table { + width: 100%; +} +fieldset.info { + width: 45%; + float: left; +} +.info td { + font-size: x-small; +} + +.tab { + margin-top: 5px; + margin-right: 5px; + padding: 2px; + cursor: pointer; + background-color: #EEEEEE; +} + +.active { + border: 1px solid black; + float: left; +} + +.inactive { + float: left; +} + +.tab.active { + font-weight: bold; + border: 1px solid black; + float: left; +} + +div.inactive { + display: none; +} + +div.active { + clear: both; + min-width: 100%; +} + +.pane { + margin-top: 10px; + clear: both; +} + +#intro { + font-size: x-small; + margin-bottom: 10px; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/browser.js ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/browser.js b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/browser.js new file mode 100644 index 0000000..a639435 --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/browser.js @@ -0,0 +1,115 @@ +(function( $ ) { + +$(function() { + + // setup sample data + window.numbers = [ + 0, 1, 10, 100, 1000, 10000, 0.1, 0.12, 0.123, 0.1234, 0.12345, 1000.123, 10000.12345, + -1, -10, -100, -1000, -10000, -0.1, -0.12, -0.123, -0.1234, -0.12345, -1000.123, -10000.12345 + ]; + window.formats = [ + "n", "n1", "n3", "d", "d2", "d3", "p", "p1", "p3", "c", "c0" + ]; + window.dates = $.map([ + "Jan 1, 1970 1:34 PM", "Dec 31, 1970 1:34 PM", "Apr 1, 1999 1:34 PM", "Dec 31, 1999 1:34 PM", "Jan 1, 2000 1:34 PM", "Nov 5, 1955 1:34 PM" + ], function(d) { return d instanceof Date ? d : new Date(Date.parse(d)); } ); + + window.dateFormats = [ + "d", "D", "f", "F", "M", "S", "t", "T", "Y" + ]; + + // add template extensions to format numbers and dates declaratively + $.extend( $.tmplcmd, { + demoFormat: { + _default: [0,0], + prefix: "_.push(Globalize.format(numbers[$2],formats[$1]));" + }, + demoDateFormat: { + _default: [0,0], + prefix: "_.push(Globalize.format(dates[$2],typeof $1 === 'number' ? dateFormats[$1] : $1));" + } + }); + + // activate tabs + $(".tab").click(function() { + $(".active").removeClass("active").addClass("inactive"); + $("#" + this.id + "content").removeClass("inactive").addClass("active"); + $(this).removeClass("inactive").addClass("active"); + }); + + // fill cultures dropdown with the available cultures + $.each(sortByName(Globalize.cultures), function(i, culture) { + $("<option/>", { + value: culture.name, + text: culture.name + ": " + culture.englishName + " (" + culture.nativeName + ")" + }).appendTo("#cultures"); + }); + + // re-render templates after selecting a culture + $("#cultures").bind("change keyup", selectCulture) + // set default culture to Japanese in Japan + .val("ja-JP"); + + // re-render templates after selecting a calendar + var calendars = $("#calendars").bind("change keyup", function() { + Globalize.culture().calendar = Globalize.culture().calendars[calendars.val()] || Globalize.culture().calendars.standard; + render(); + }); + + $("#parseDate").change(function() { + $("#parseDateResult").text(Globalize.parseDate($(this).val()).toString()); + }); + $("#parseNumber").change(function() { + $("#parseNumberResult").text(Globalize.parseFloat($(this).val()).toString()); + }); + + function sortByName(map) { + // converts a dictionary into a sorted dictionary based on obj.name + var arr = []; + $.each(map, function(name, value) { + arr.push(value); + }); + arr.sort(function(a, b) { + return a.name < b.name ? -1 : 1; + }); + return arr; + } + + function selectCulture() { + // sets the current culture to the value specified in the cultures dropdown, + // populates the calendars dropdown with that cultures calendars, + // and renders the formatting templates. + Globalize.culture($("#cultures").val()); + + calendars.empty(); + $.each(sortByName(Globalize.culture().calendars), function(i, cal) { + $("<option/>", { value: cal.name, text: cal.name }).appendTo(calendars); + }); + calendars.val(Globalize.culture().calendar.name); + + render(); + } + + function render() { + $("#dateformat").empty(); + $("#dateformattmpl").render({}).appendTo("#dateformat"); + + $("#format").empty(); + $("#formattmpl").render({}).appendTo("#format"); + + $("#englishName").text(Globalize.culture().englishName); + $("#nativeName").text(Globalize.culture().nativeName); + $("#isRTL").text(Globalize.culture().isRTL ? "YES" : "no"); + + $("#infonumber").empty(); + $("#infonumbertmpl").render(Globalize.culture().numberFormat).appendTo("#infonumber"); + + $("#infodate").empty(); + $("#infodatetmpl").render(Globalize.culture().calendar).appendTo("#infodate"); + } + + // initial rendering + selectCulture(); +}); + +}( jQuery )); http://git-wip-us.apache.org/repos/asf/ambari/blob/39c85bb8/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/index.html ---------------------------------------------------------------------- diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/index.html b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/index.html new file mode 100644 index 0000000..c7af94d --- /dev/null +++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/libs/bower/globalize/examples/browser/index.html @@ -0,0 +1,265 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="UTF-8"> + <title>Globalization Demo</title> + <link type="text/css" rel="Stylesheet" href="browser.css"> + <script src="../../lib/globalize.js"></script> + <script src="../../lib/cultures/globalize.cultures.js"></script> + <script src="jquery-1.4.4.js"></script> + <script src="jquery.tmpl.js"></script> + <script src="browser.js"></script> + <script id="formattmpl" type="text/x-jquery-tmpl"> + <tr> + <th>Number</th> + {{each formats}} + <th>{{=}}</th> + {{/each}} + </tr> + {{each(i) numbers}} + <tr class="result"> + <td> + ${numbers[i]} + </td> + {{each(j) formats}} + <td> + {{demoFormat(i) j}} + </td> + {{/each}} + </tr> + {{/each}} + </script> + <script id="dateformattmpl" type="text/x-jquery-tmpl"> + <tr> + <th>Date</th> + {{each dateFormats}} + <th>{{=}}</th> + {{/each}} + </tr> + {{each(i) dates}} + <tr class="result"> + <td> + {{=}} + </td> + {{each(j) dateFormats}} + <td> + {{demoDateFormat(i) j}} + </td> + {{/each}} + </tr> + {{/each}} + </script> + <script id="infonumbertmpl" type="text/x-jquery-tmpl"> + <legend>Number Formatting</legend> + <table class="info"> + <tr> + <td>Pattern</td> + <td>${pattern}</td> + <td>Decimals</td> + <td>${decimals} (${$data['.']})</td> + </tr> + <tr> + <td>Grouping</td> + <td>${$data[',']}</td> + <td>Group Size</td> + <td>${groupSizes}</td> + </tr> + <tr> + <td>Positive</td> + <td>${$data['+']}</td> + <td>Negative</td> + <td>${$data['-']}</td> + </tr> + <tr> + <td colspan="4" align="center">Percent (symbol = ${percent.symbol})</td> + </tr> + <tr> + <td>Pattern</td> + <td>${percent.pattern}</td> + <td>Decimals</td> + <td>${percent.decimals} (${percent['.']})</td> + </tr> + <tr> + <td>Grouping</td> + <td>${percent[',']}</td> + <td>Group Size</td> + <td>${percent.groupSizes}</td> + </tr> + <tr> + <td colspan="4" align="center">Currency (symbol = ${currency.symbol})</td> + </tr> + <tr> + <td>Pattern</td> + <td>${currency.pattern}</td> + <td>Decimals</td> + <td>${currency.decimals} (${currency['.']})</td> + </tr> + <tr> + <td>Grouping</td> + <td>${currency[',']}</td> + <td>Group Size</td> + <td>${currency.groupSizes}</td> + </tr> + </table> + </script> + <script id="infodatetmpl" type="text/x-jquery-tmpl"> + <legend>Date Formatting</legend> + <table class="info"> + <tr> + <td>Name</td> + <td colspan="3">${name}</td> + </tr> + <tr> + <td>AM</td> + <td>${AM}</td> + <td>PM</td> + <td>${PM}</td> + </tr> + <tr> + <td>Eras</td> + <td colspan="3"> + <ol> + {{each eras}} + <li>${name} (year offset ${offset})</li> + {{/each}} + </ol> + </td> + </tr> + <tr> + <td>Days</td> + <td colspan="3"> + <ol> + {{each days.names}} + <li>{{=}}</li> + {{/each}} + </ol> + </td> + </tr> + <tr> + <td>Days (abbreviated)</td> + <td colspan="3"> + <ol> + {{each days.namesAbbr}} + <li>{{=}}</li> + {{/each}} + </ol> + </td> + </tr> + <tr> + <td>Days (shortest)</td> + <td colspan="3"> + <ol> + {{each days.namesShort}} + <li>{{=}}</li> + {{/each}} + </ol> + </td> + </tr> + <tr> + <td>Months</td> + <td colspan="3"> + <ol> + {{each months.names}} + <li>{{=}}</li> + {{/each}} + </ol> + </td> + </tr> + <tr> + <td>Months (abbreviated)</td> + <td colspan="3"> + <ol> + {{each months.namesAbbr}} + <li>{{=}}</li> + {{/each}} + </ol> + </td> + </tr> + {{if typeof monthsGenitive !== 'undefined'}} + <tr> + <td>Months (Genitive)</td> + <td>${monthsGenitive.names}</td> + <td>Months (Abbr. Gen.)</td> + <td>${monthsGenitive.namesAbbr}</td> + </tr> + {{/if}} + <tr> + <td align="center" colspan="4">Patterns</td> + </tr> + {{each(n,v) patterns}} + <tr> + <td>${n}</td> + <td colspan="3">{{=}}</td> + </tr> + {{/each}} + </table> + </script> +</head> + +<body> +<div id="intro"> +This is a demo of the Globalize library. You can follow the discussion and provide feedback on the planning page, here: +<br/><a href="http://wiki.jqueryui.com/Globalization">Globalization wiki page</a> +<br/> +And you can view the source from here or keep up to date with it on github, here: +<br/><a href="https://github.com/jquery/globalize/">Globalize on GitHub</a> +</div> + +<div> + Culture: + <select id="cultures"></select> +</div> +<div> + Calendar: + <select id="calendars"></select> +</div> + +<div class="pane"> + <span class="tab active" id="dates">Dates</span> + <span class="tab inactive" id="numbers">Numbers</span> + <span class="tab inactive" id="info">Info</span> + + <div id="datescontent" class="active"> + <table id="dateformat" class="results"> + </table> + <b>Parsing:</b> Type a date in one of the culture formats: + <input id="parseDate" type="text" /><span id="parseDateResult"></span> + </div> + + <div id="numberscontent" class="inactive"> + <table id="format" class="results"> + </table> + <b>Parsing:</b> Type a number using the culture group and decimal separators: + <input id="parseNumber" type="text" /><span id="parseNumberResult"></span> + </div> + + <div id="infocontent" class="inactive"> + <p> + Name (in English) "<span id="englishName"></span>"<br /> + Name (in Native Language) "<span id="nativeName"></span>".<br /> + Is RTL culture? <span id="isRTL"></span>. + </p> + <fieldset id="infonumber" class="info"> + </fieldset> + <fieldset id="infodate" class="info"> + </fieldset> + </div> + +</div> + +<div class="pane"> + +Interesting cultures to preview: +<ul> + <li>ja-JP: Has an optional calendar that has 4 different eras.</li> + <li>th-TH: Standard calendar has a year offset.</li> + <li>te-IN: Numbers have unequal groupings.</li> + <li>ar-SA: Standard calendar is UmAlQura, a non-gregorian based calendar that requires custom conversion logic. + It also supports the Hijri calendar, and a standard gregorian calendar translated into one of <i>4 languages</i>. + </li> +</ul> + +</div> + +</body> +</html>
