ses-proxy 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/public/bootstrap/css/bootstrap-responsive.css +1092 -0
- data/app/public/bootstrap/css/bootstrap-responsive.min.css +9 -0
- data/app/public/bootstrap/css/bootstrap.css +6039 -0
- data/app/public/bootstrap/css/bootstrap.min.css +9 -0
- data/app/public/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/app/public/bootstrap/img/glyphicons-halflings.png +0 -0
- data/app/public/bootstrap/js/bootstrap.js +2159 -0
- data/app/public/bootstrap/js/bootstrap.min.js +6 -0
- data/app/public/css/application.css +16 -0
- data/app/public/datepicker/css/datepicker.css +7 -0
- data/app/public/datepicker/js/bootstrap-datepicker.js +454 -0
- data/app/public/datepicker/less/datepicker.less +119 -0
- data/app/public/highcharts/adapters/mootools-adapter.js +13 -0
- data/app/public/highcharts/adapters/mootools-adapter.src.js +327 -0
- data/app/public/highcharts/adapters/prototype-adapter.js +16 -0
- data/app/public/highcharts/adapters/prototype-adapter.src.js +385 -0
- data/app/public/highcharts/highcharts-more.js +35 -0
- data/app/public/highcharts/highcharts.js +246 -0
- data/app/public/highcharts/highcharts.src.js +15111 -0
- data/app/public/highcharts/modules/canvas-tools.js +133 -0
- data/app/public/highcharts/modules/canvas-tools.src.js +3113 -0
- data/app/public/highcharts/modules/data.js +11 -0
- data/app/public/highcharts/modules/data.src.js +277 -0
- data/app/public/highcharts/modules/exporting.js +23 -0
- data/app/public/highcharts/modules/exporting.src.js +736 -0
- data/app/public/highcharts/themes/dark-blue.js +263 -0
- data/app/public/highcharts/themes/dark-green.js +263 -0
- data/app/public/highcharts/themes/gray.js +262 -0
- data/app/public/highcharts/themes/grid.js +95 -0
- data/app/public/highcharts/themes/skies.js +89 -0
- data/app/public/images/loader.gif +0 -0
- data/app/public/js/application.js +81 -0
- data/app/views/_chart.haml +2 -0
- data/app/views/_search_form.haml +23 -0
- data/app/views/bounces.haml +23 -0
- data/app/views/kaminari/_first_page.html.erb +3 -0
- data/app/views/kaminari/_gap.html.erb +3 -0
- data/app/views/kaminari/_last_page.html.erb +3 -0
- data/app/views/kaminari/_next_page.html.erb +3 -0
- data/app/views/kaminari/_page.html.erb +3 -0
- data/app/views/kaminari/_paginator.html.erb +17 -0
- data/app/views/kaminari/_prev_page.html.erb +3 -0
- data/app/views/layout.haml +25 -0
- data/app/views/mails.haml +26 -0
- data/app/web_panel.rb +149 -0
- data/bin/ses_proxy +20 -0
- data/lib/ses_proxy/conf.rb +9 -0
- data/lib/ses_proxy/main_command.rb +154 -0
- data/lib/ses_proxy/models/bounce.rb +14 -0
- data/lib/ses_proxy/models/complaint.rb +13 -0
- data/lib/ses_proxy/models/email.rb +15 -0
- data/lib/ses_proxy/smtp_server.rb +122 -0
- data/lib/ses_proxy/sns_endpoint.rb +199 -0
- data/ses_proxy.rb +10 -0
- data/template/mongoid.yml +12 -0
- data/template/ses-proxy.yml +19 -0
- metadata +294 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap.js by @fat & @mdo
|
3
|
+
* Copyright 2012 Twitter, Inc.
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0.txt
|
5
|
+
*/
|
6
|
+
!function($){"use strict";$(function(){$.support.transition=function(){var transitionEnd=function(){var name,el=document.createElement("bootstrap"),transEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(name in transEndEventNames)if(void 0!==el.style[name])return transEndEventNames[name]}();return transitionEnd&&{end:transitionEnd}}()})}(window.jQuery),!function($){"use strict";var dismiss='[data-dismiss="alert"]',Alert=function(el){$(el).on("click",dismiss,this.close)};Alert.prototype.close=function(e){function removeElement(){$parent.trigger("closed").remove()}var $parent,$this=$(this),selector=$this.attr("data-target");selector||(selector=$this.attr("href"),selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,"")),$parent=$(selector),e&&e.preventDefault(),$parent.length||($parent=$this.hasClass("alert")?$this:$this.parent()),$parent.trigger(e=$.Event("close")),e.isDefaultPrevented()||($parent.removeClass("in"),$.support.transition&&$parent.hasClass("fade")?$parent.on($.support.transition.end,removeElement):removeElement())};var old=$.fn.alert;$.fn.alert=function(option){return this.each(function(){var $this=$(this),data=$this.data("alert");data||$this.data("alert",data=new Alert(this)),"string"==typeof option&&data[option].call($this)})},$.fn.alert.Constructor=Alert,$.fn.alert.noConflict=function(){return $.fn.alert=old,this},$(document).on("click.alert.data-api",dismiss,Alert.prototype.close)}(window.jQuery),!function($){"use strict";var Button=function(element,options){this.$element=$(element),this.options=$.extend({},$.fn.button.defaults,options)};Button.prototype.setState=function(state){var d="disabled",$el=this.$element,data=$el.data(),val=$el.is("input")?"val":"html";state+="Text",data.resetText||$el.data("resetText",$el[val]()),$el[val](data[state]||this.options[state]),setTimeout(function(){"loadingText"==state?$el.addClass(d).attr(d,d):$el.removeClass(d).removeAttr(d)},0)},Button.prototype.toggle=function(){var $parent=this.$element.closest('[data-toggle="buttons-radio"]');$parent&&$parent.find(".active").removeClass("active"),this.$element.toggleClass("active")};var old=$.fn.button;$.fn.button=function(option){return this.each(function(){var $this=$(this),data=$this.data("button"),options="object"==typeof option&&option;data||$this.data("button",data=new Button(this,options)),"toggle"==option?data.toggle():option&&data.setState(option)})},$.fn.button.defaults={loadingText:"loading..."},$.fn.button.Constructor=Button,$.fn.button.noConflict=function(){return $.fn.button=old,this},$(document).on("click.button.data-api","[data-toggle^=button]",function(e){var $btn=$(e.target);$btn.hasClass("btn")||($btn=$btn.closest(".btn")),$btn.button("toggle")})}(window.jQuery),!function($){"use strict";var Carousel=function(element,options){this.$element=$(element),this.options=options,"hover"==this.options.pause&&this.$element.on("mouseenter",$.proxy(this.pause,this)).on("mouseleave",$.proxy(this.cycle,this))};Carousel.prototype={cycle:function(e){return e||(this.paused=!1),this.options.interval&&!this.paused&&(this.interval=setInterval($.proxy(this.next,this),this.options.interval)),this},to:function(pos){var $active=this.$element.find(".item.active"),children=$active.parent().children(),activePos=children.index($active),that=this;if(!(pos>children.length-1||0>pos))return this.sliding?this.$element.one("slid",function(){that.to(pos)}):activePos==pos?this.pause().cycle():this.slide(pos>activePos?"next":"prev",$(children[pos]))},pause:function(e){return e||(this.paused=!0),this.$element.find(".next, .prev").length&&$.support.transition.end&&(this.$element.trigger($.support.transition.end),this.cycle()),clearInterval(this.interval),this.interval=null,this},next:function(){return this.sliding?void 0:this.slide("next")},prev:function(){return this.sliding?void 0:this.slide("prev")},slide:function(type,next){var e,$active=this.$element.find(".item.active"),$next=next||$active[type](),isCycling=this.interval,direction="next"==type?"left":"right",fallback="next"==type?"first":"last",that=this;if(this.sliding=!0,isCycling&&this.pause(),$next=$next.length?$next:this.$element.find(".item")[fallback](),e=$.Event("slide",{relatedTarget:$next[0]}),!$next.hasClass("active")){if($.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(e),e.isDefaultPrevented())return;$next.addClass(type),$next[0].offsetWidth,$active.addClass(direction),$next.addClass(direction),this.$element.one($.support.transition.end,function(){$next.removeClass([type,direction].join(" ")).addClass("active"),$active.removeClass(["active",direction].join(" ")),that.sliding=!1,setTimeout(function(){that.$element.trigger("slid")},0)})}else{if(this.$element.trigger(e),e.isDefaultPrevented())return;$active.removeClass("active"),$next.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return isCycling&&this.cycle(),this}}};var old=$.fn.carousel;$.fn.carousel=function(option){return this.each(function(){var $this=$(this),data=$this.data("carousel"),options=$.extend({},$.fn.carousel.defaults,"object"==typeof option&&option),action="string"==typeof option?option:options.slide;data||$this.data("carousel",data=new Carousel(this,options)),"number"==typeof option?data.to(option):action?data[action]():options.interval&&data.cycle()})},$.fn.carousel.defaults={interval:5e3,pause:"hover"},$.fn.carousel.Constructor=Carousel,$.fn.carousel.noConflict=function(){return $.fn.carousel=old,this},$(document).on("click.carousel.data-api","[data-slide]",function(e){var href,$this=$(this),$target=$($this.attr("data-target")||(href=$this.attr("href"))&&href.replace(/.*(?=#[^\s]+$)/,"")),options=$.extend({},$target.data(),$this.data());$target.carousel(options),e.preventDefault()})}(window.jQuery),!function($){"use strict";var Collapse=function(element,options){this.$element=$(element),this.options=$.extend({},$.fn.collapse.defaults,options),this.options.parent&&(this.$parent=$(this.options.parent)),this.options.toggle&&this.toggle()};Collapse.prototype={constructor:Collapse,dimension:function(){var hasWidth=this.$element.hasClass("width");return hasWidth?"width":"height"},show:function(){var dimension,scroll,actives,hasData;if(!this.transitioning){if(dimension=this.dimension(),scroll=$.camelCase(["scroll",dimension].join("-")),actives=this.$parent&&this.$parent.find("> .accordion-group > .in"),actives&&actives.length){if(hasData=actives.data("collapse"),hasData&&hasData.transitioning)return;actives.collapse("hide"),hasData||actives.data("collapse",null)}this.$element[dimension](0),this.transition("addClass",$.Event("show"),"shown"),$.support.transition&&this.$element[dimension](this.$element[0][scroll])}},hide:function(){var dimension;this.transitioning||(dimension=this.dimension(),this.reset(this.$element[dimension]()),this.transition("removeClass",$.Event("hide"),"hidden"),this.$element[dimension](0))},reset:function(size){var dimension=this.dimension();return this.$element.removeClass("collapse")[dimension](size||"auto")[0].offsetWidth,this.$element[null!==size?"addClass":"removeClass"]("collapse"),this},transition:function(method,startEvent,completeEvent){var that=this,complete=function(){"show"==startEvent.type&&that.reset(),that.transitioning=0,that.$element.trigger(completeEvent)};this.$element.trigger(startEvent),startEvent.isDefaultPrevented()||(this.transitioning=1,this.$element[method]("in"),$.support.transition&&this.$element.hasClass("collapse")?this.$element.one($.support.transition.end,complete):complete())},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var old=$.fn.collapse;$.fn.collapse=function(option){return this.each(function(){var $this=$(this),data=$this.data("collapse"),options="object"==typeof option&&option;data||$this.data("collapse",data=new Collapse(this,options)),"string"==typeof option&&data[option]()})},$.fn.collapse.defaults={toggle:!0},$.fn.collapse.Constructor=Collapse,$.fn.collapse.noConflict=function(){return $.fn.collapse=old,this},$(document).on("click.collapse.data-api","[data-toggle=collapse]",function(e){var href,$this=$(this),target=$this.attr("data-target")||e.preventDefault()||(href=$this.attr("href"))&&href.replace(/.*(?=#[^\s]+$)/,""),option=$(target).data("collapse")?"toggle":$this.data();$this[$(target).hasClass("in")?"addClass":"removeClass"]("collapsed"),$(target).collapse(option)})}(window.jQuery),!function($){"use strict";function clearMenus(){$(toggle).each(function(){getParent($(this)).removeClass("open")})}function getParent($this){var $parent,selector=$this.attr("data-target");return selector||(selector=$this.attr("href"),selector=selector&&/#/.test(selector)&&selector.replace(/.*(?=#[^\s]*$)/,"")),$parent=$(selector),$parent.length||($parent=$this.parent()),$parent}var toggle="[data-toggle=dropdown]",Dropdown=function(element){var $el=$(element).on("click.dropdown.data-api",this.toggle);$("html").on("click.dropdown.data-api",function(){$el.parent().removeClass("open")})};Dropdown.prototype={constructor:Dropdown,toggle:function(){var $parent,isActive,$this=$(this);if(!$this.is(".disabled, :disabled"))return $parent=getParent($this),isActive=$parent.hasClass("open"),clearMenus(),isActive||$parent.toggleClass("open"),$this.focus(),!1},keydown:function(e){var $this,$items,$parent,isActive,index;if(/(38|40|27)/.test(e.keyCode)&&($this=$(this),e.preventDefault(),e.stopPropagation(),!$this.is(".disabled, :disabled"))){if($parent=getParent($this),isActive=$parent.hasClass("open"),!isActive||isActive&&27==e.keyCode)return $this.click();$items=$("[role=menu] li:not(.divider):visible a",$parent),$items.length&&(index=$items.index($items.filter(":focus")),38==e.keyCode&&index>0&&index--,40==e.keyCode&&$items.length-1>index&&index++,~index||(index=0),$items.eq(index).focus())}}};var old=$.fn.dropdown;$.fn.dropdown=function(option){return this.each(function(){var $this=$(this),data=$this.data("dropdown");data||$this.data("dropdown",data=new Dropdown(this)),"string"==typeof option&&data[option].call($this)})},$.fn.dropdown.Constructor=Dropdown,$.fn.dropdown.noConflict=function(){return $.fn.dropdown=old,this},$(document).on("click.dropdown.data-api touchstart.dropdown.data-api",clearMenus).on("click.dropdown touchstart.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("touchstart.dropdown.data-api",".dropdown-menu",function(e){e.stopPropagation()}).on("click.dropdown.data-api touchstart.dropdown.data-api",toggle,Dropdown.prototype.toggle).on("keydown.dropdown.data-api touchstart.dropdown.data-api",toggle+", [role=menu]",Dropdown.prototype.keydown)}(window.jQuery),!function($){"use strict";var Modal=function(element,options){this.options=options,this.$element=$(element).delegate('[data-dismiss="modal"]',"click.dismiss.modal",$.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};Modal.prototype={constructor:Modal,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var that=this,e=$.Event("show");this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.backdrop(function(){var transition=$.support.transition&&that.$element.hasClass("fade");that.$element.parent().length||that.$element.appendTo(document.body),that.$element.show(),transition&&that.$element[0].offsetWidth,that.$element.addClass("in").attr("aria-hidden",!1),that.enforceFocus(),transition?that.$element.one($.support.transition.end,function(){that.$element.focus().trigger("shown")}):that.$element.focus().trigger("shown")}))},hide:function(e){e&&e.preventDefault(),e=$.Event("hide"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),$(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),$.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())},enforceFocus:function(){var that=this;$(document).on("focusin.modal",function(e){that.$element[0]===e.target||that.$element.has(e.target).length||that.$element.focus()})},escape:function(){var that=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(e){27==e.which&&that.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var that=this,timeout=setTimeout(function(){that.$element.off($.support.transition.end),that.hideModal()},500);this.$element.one($.support.transition.end,function(){clearTimeout(timeout),that.hideModal()})},hideModal:function(){this.$element.hide().trigger("hidden"),this.backdrop()},removeBackdrop:function(){this.$backdrop.remove(),this.$backdrop=null},backdrop:function(callback){var animate=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var doAnimate=$.support.transition&&animate;this.$backdrop=$('<div class="modal-backdrop '+animate+'" />').appendTo(document.body),this.$backdrop.click("static"==this.options.backdrop?$.proxy(this.$element[0].focus,this.$element[0]):$.proxy(this.hide,this)),doAnimate&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),doAnimate?this.$backdrop.one($.support.transition.end,callback):callback()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),$.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one($.support.transition.end,$.proxy(this.removeBackdrop,this)):this.removeBackdrop()):callback&&callback()}};var old=$.fn.modal;$.fn.modal=function(option){return this.each(function(){var $this=$(this),data=$this.data("modal"),options=$.extend({},$.fn.modal.defaults,$this.data(),"object"==typeof option&&option);data||$this.data("modal",data=new Modal(this,options)),"string"==typeof option?data[option]():options.show&&data.show()})},$.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},$.fn.modal.Constructor=Modal,$.fn.modal.noConflict=function(){return $.fn.modal=old,this},$(document).on("click.modal.data-api",'[data-toggle="modal"]',function(e){var $this=$(this),href=$this.attr("href"),$target=$($this.attr("data-target")||href&&href.replace(/.*(?=#[^\s]+$)/,"")),option=$target.data("modal")?"toggle":$.extend({remote:!/#/.test(href)&&href},$target.data(),$this.data());e.preventDefault(),$target.modal(option).one("hide",function(){$this.focus()})})}(window.jQuery),!function($){"use strict";var Tooltip=function(element,options){this.init("tooltip",element,options)};Tooltip.prototype={constructor:Tooltip,init:function(type,element,options){var eventIn,eventOut;this.type=type,this.$element=$(element),this.options=this.getOptions(options),this.enabled=!0,"click"==this.options.trigger?this.$element.on("click."+this.type,this.options.selector,$.proxy(this.toggle,this)):"manual"!=this.options.trigger&&(eventIn="hover"==this.options.trigger?"mouseenter":"focus",eventOut="hover"==this.options.trigger?"mouseleave":"blur",this.$element.on(eventIn+"."+this.type,this.options.selector,$.proxy(this.enter,this)),this.$element.on(eventOut+"."+this.type,this.options.selector,$.proxy(this.leave,this))),this.options.selector?this._options=$.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(options){return options=$.extend({},$.fn[this.type].defaults,options,this.$element.data()),options.delay&&"number"==typeof options.delay&&(options.delay={show:options.delay,hide:options.delay}),options},enter:function(e){var self=$(e.currentTarget)[this.type](this._options).data(this.type);return self.options.delay&&self.options.delay.show?(clearTimeout(this.timeout),self.hoverState="in",this.timeout=setTimeout(function(){"in"==self.hoverState&&self.show()},self.options.delay.show),void 0):self.show()},leave:function(e){var self=$(e.currentTarget)[this.type](this._options).data(this.type);return this.timeout&&clearTimeout(this.timeout),self.options.delay&&self.options.delay.hide?(self.hoverState="out",this.timeout=setTimeout(function(){"out"==self.hoverState&&self.hide()},self.options.delay.hide),void 0):self.hide()},show:function(){var $tip,inside,pos,actualWidth,actualHeight,placement,tp;if(this.hasContent()&&this.enabled){switch($tip=this.tip(),this.setContent(),this.options.animation&&$tip.addClass("fade"),placement="function"==typeof this.options.placement?this.options.placement.call(this,$tip[0],this.$element[0]):this.options.placement,inside=/in/.test(placement),$tip.detach().css({top:0,left:0,display:"block"}).insertAfter(this.$element),pos=this.getPosition(inside),actualWidth=$tip[0].offsetWidth,actualHeight=$tip[0].offsetHeight,inside?placement.split(" ")[1]:placement){case"bottom":tp={top:pos.top+pos.height,left:pos.left+pos.width/2-actualWidth/2};break;case"top":tp={top:pos.top-actualHeight,left:pos.left+pos.width/2-actualWidth/2};break;case"left":tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left-actualWidth};break;case"right":tp={top:pos.top+pos.height/2-actualHeight/2,left:pos.left+pos.width}}$tip.offset(tp).addClass(placement).addClass("in")}},setContent:function(){var $tip=this.tip(),title=this.getTitle();$tip.find(".tooltip-inner")[this.options.html?"html":"text"](title),$tip.removeClass("fade in top bottom left right")},hide:function(){function removeWithAnimation(){var timeout=setTimeout(function(){$tip.off($.support.transition.end).detach()},500);$tip.one($.support.transition.end,function(){clearTimeout(timeout),$tip.detach()})}var $tip=this.tip();return $tip.removeClass("in"),$.support.transition&&this.$tip.hasClass("fade")?removeWithAnimation():$tip.detach(),this},fixTitle:function(){var $e=this.$element;($e.attr("title")||"string"!=typeof $e.attr("data-original-title"))&&$e.attr("data-original-title",$e.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(inside){return $.extend({},inside?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var title,$e=this.$element,o=this.options;return title=$e.attr("data-original-title")||("function"==typeof o.title?o.title.call($e[0]):o.title)},tip:function(){return this.$tip=this.$tip||$(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(e){var self=$(e.currentTarget)[this.type](this._options).data(this.type);self[self.tip().hasClass("in")?"hide":"show"]()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var old=$.fn.tooltip;$.fn.tooltip=function(option){return this.each(function(){var $this=$(this),data=$this.data("tooltip"),options="object"==typeof option&&option;data||$this.data("tooltip",data=new Tooltip(this,options)),"string"==typeof option&&data[option]()})},$.fn.tooltip.Constructor=Tooltip,$.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0,html:!1},$.fn.tooltip.noConflict=function(){return $.fn.tooltip=old,this}}(window.jQuery),!function($){"use strict";var Popover=function(element,options){this.init("popover",element,options)};Popover.prototype=$.extend({},$.fn.tooltip.Constructor.prototype,{constructor:Popover,setContent:function(){var $tip=this.tip(),title=this.getTitle(),content=this.getContent();$tip.find(".popover-title")[this.options.html?"html":"text"](title),$tip.find(".popover-content")[this.options.html?"html":"text"](content),$tip.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var content,$e=this.$element,o=this.options;return content=$e.attr("data-content")||("function"==typeof o.content?o.content.call($e[0]):o.content)},tip:function(){return this.$tip||(this.$tip=$(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var old=$.fn.popover;$.fn.popover=function(option){return this.each(function(){var $this=$(this),data=$this.data("popover"),options="object"==typeof option&&option;data||$this.data("popover",data=new Popover(this,options)),"string"==typeof option&&data[option]()})},$.fn.popover.Constructor=Popover,$.fn.popover.defaults=$.extend({},$.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'}),$.fn.popover.noConflict=function(){return $.fn.popover=old,this}}(window.jQuery),!function($){"use strict";function ScrollSpy(element,options){var href,process=$.proxy(this.process,this),$element=$(element).is("body")?$(window):$(element);this.options=$.extend({},$.fn.scrollspy.defaults,options),this.$scrollElement=$element.on("scroll.scroll-spy.data-api",process),this.selector=(this.options.target||(href=$(element).attr("href"))&&href.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=$("body"),this.refresh(),this.process()}ScrollSpy.prototype={constructor:ScrollSpy,refresh:function(){var $targets,self=this;this.offsets=$([]),this.targets=$([]),$targets=this.$body.find(this.selector).map(function(){var $el=$(this),href=$el.data("target")||$el.attr("href"),$href=/^#\w/.test(href)&&$(href);return $href&&$href.length&&[[$href.position().top+self.$scrollElement.scrollTop(),href]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){self.offsets.push(this[0]),self.targets.push(this[1])})},process:function(){var i,scrollTop=this.$scrollElement.scrollTop()+this.options.offset,scrollHeight=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,maxScroll=scrollHeight-this.$scrollElement.height(),offsets=this.offsets,targets=this.targets,activeTarget=this.activeTarget;if(scrollTop>=maxScroll)return activeTarget!=(i=targets.last()[0])&&this.activate(i);for(i=offsets.length;i--;)activeTarget!=targets[i]&&scrollTop>=offsets[i]&&(!offsets[i+1]||offsets[i+1]>=scrollTop)&&this.activate(targets[i])},activate:function(target){var active,selector;this.activeTarget=target,$(this.selector).parent(".active").removeClass("active"),selector=this.selector+'[data-target="'+target+'"],'+this.selector+'[href="'+target+'"]',active=$(selector).parent("li").addClass("active"),active.parent(".dropdown-menu").length&&(active=active.closest("li.dropdown").addClass("active")),active.trigger("activate")}};var old=$.fn.scrollspy;$.fn.scrollspy=function(option){return this.each(function(){var $this=$(this),data=$this.data("scrollspy"),options="object"==typeof option&&option;data||$this.data("scrollspy",data=new ScrollSpy(this,options)),"string"==typeof option&&data[option]()})},$.fn.scrollspy.Constructor=ScrollSpy,$.fn.scrollspy.defaults={offset:10},$.fn.scrollspy.noConflict=function(){return $.fn.scrollspy=old,this},$(window).on("load",function(){$('[data-spy="scroll"]').each(function(){var $spy=$(this);$spy.scrollspy($spy.data())})})}(window.jQuery),!function($){"use strict";var Tab=function(element){this.element=$(element)};Tab.prototype={constructor:Tab,show:function(){var previous,$target,e,$this=this.element,$ul=$this.closest("ul:not(.dropdown-menu)"),selector=$this.attr("data-target");selector||(selector=$this.attr("href"),selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,"")),$this.parent("li").hasClass("active")||(previous=$ul.find(".active:last a")[0],e=$.Event("show",{relatedTarget:previous}),$this.trigger(e),e.isDefaultPrevented()||($target=$(selector),this.activate($this.parent("li"),$ul),this.activate($target,$target.parent(),function(){$this.trigger({type:"shown",relatedTarget:previous})})))},activate:function(element,container,callback){function next(){$active.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),element.addClass("active"),transition?(element[0].offsetWidth,element.addClass("in")):element.removeClass("fade"),element.parent(".dropdown-menu")&&element.closest("li.dropdown").addClass("active"),callback&&callback()}var $active=container.find("> .active"),transition=callback&&$.support.transition&&$active.hasClass("fade");transition?$active.one($.support.transition.end,next):next(),$active.removeClass("in")}};var old=$.fn.tab;$.fn.tab=function(option){return this.each(function(){var $this=$(this),data=$this.data("tab");data||$this.data("tab",data=new Tab(this)),"string"==typeof option&&data[option]()})},$.fn.tab.Constructor=Tab,$.fn.tab.noConflict=function(){return $.fn.tab=old,this},$(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(e){e.preventDefault(),$(this).tab("show")})}(window.jQuery),!function($){"use strict";var Typeahead=function(element,options){this.$element=$(element),this.options=$.extend({},$.fn.typeahead.defaults,options),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=$(this.options.menu),this.shown=!1,this.listen()};Typeahead.prototype={constructor:Typeahead,select:function(){var val=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(val)).change(),this.hide()},updater:function(item){return item},show:function(){var pos=$.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:pos.top+pos.height,left:pos.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(){var items;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(items=$.isFunction(this.source)?this.source(this.query,$.proxy(this.process,this)):this.source,items?this.process(items):this)},process:function(items){var that=this;return items=$.grep(items,function(item){return that.matcher(item)}),items=this.sorter(items),items.length?this.render(items.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(item){return~item.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(items){for(var item,beginswith=[],caseSensitive=[],caseInsensitive=[];item=items.shift();)item.toLowerCase().indexOf(this.query.toLowerCase())?~item.indexOf(this.query)?caseSensitive.push(item):caseInsensitive.push(item):beginswith.push(item);return beginswith.concat(caseSensitive,caseInsensitive)},highlighter:function(item){var query=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return item.replace(RegExp("("+query+")","ig"),function($1,match){return"<strong>"+match+"</strong>"})},render:function(items){var that=this;return items=$(items).map(function(i,item){return i=$(that.options.item).attr("data-value",item),i.find("a").html(that.highlighter(item)),i[0]}),items.first().addClass("active"),this.$menu.html(items),this},next:function(){var active=this.$menu.find(".active").removeClass("active"),next=active.next();next.length||(next=$(this.$menu.find("li")[0])),next.addClass("active")},prev:function(){var active=this.$menu.find(".active").removeClass("active"),prev=active.prev();prev.length||(prev=this.$menu.find("li").last()),prev.addClass("active")},listen:function(){this.$element.on("blur",$.proxy(this.blur,this)).on("keypress",$.proxy(this.keypress,this)).on("keyup",$.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",$.proxy(this.keydown,this)),this.$menu.on("click",$.proxy(this.click,this)).on("mouseenter","li",$.proxy(this.mouseenter,this))},eventSupported:function(eventName){var isSupported=eventName in this.$element;return isSupported||(this.$element.setAttribute(eventName,"return;"),isSupported="function"==typeof this.$element[eventName]),isSupported},move:function(e){if(this.shown){switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),this.prev();break;case 40:e.preventDefault(),this.next()}e.stopPropagation()}},keydown:function(e){this.suppressKeyPressRepeat=~$.inArray(e.keyCode,[40,38,9,13,27]),this.move(e)},keypress:function(e){this.suppressKeyPressRepeat||this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation(),e.preventDefault()},blur:function(){var that=this;setTimeout(function(){that.hide()},150)},click:function(e){e.stopPropagation(),e.preventDefault(),this.select()},mouseenter:function(e){this.$menu.find(".active").removeClass("active"),$(e.currentTarget).addClass("active")}};var old=$.fn.typeahead;$.fn.typeahead=function(option){return this.each(function(){var $this=$(this),data=$this.data("typeahead"),options="object"==typeof option&&option;data||$this.data("typeahead",data=new Typeahead(this,options)),"string"==typeof option&&data[option]()})},$.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},$.fn.typeahead.Constructor=Typeahead,$.fn.typeahead.noConflict=function(){return $.fn.typeahead=old,this},$(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(e){var $this=$(this);$this.data("typeahead")||(e.preventDefault(),$this.typeahead($this.data()))})}(window.jQuery),!function($){"use strict";var Affix=function(element,options){this.options=$.extend({},$.fn.affix.defaults,options),this.$window=$(window).on("scroll.affix.data-api",$.proxy(this.checkPosition,this)).on("click.affix.data-api",$.proxy(function(){setTimeout($.proxy(this.checkPosition,this),1)},this)),this.$element=$(element),this.checkPosition()};Affix.prototype.checkPosition=function(){if(this.$element.is(":visible")){var affix,scrollHeight=$(document).height(),scrollTop=this.$window.scrollTop(),position=this.$element.offset(),offset=this.options.offset,offsetBottom=offset.bottom,offsetTop=offset.top,reset="affix affix-top affix-bottom";"object"!=typeof offset&&(offsetBottom=offsetTop=offset),"function"==typeof offsetTop&&(offsetTop=offset.top()),"function"==typeof offsetBottom&&(offsetBottom=offset.bottom()),affix=null!=this.unpin&&scrollTop+this.unpin<=position.top?!1:null!=offsetBottom&&position.top+this.$element.height()>=scrollHeight-offsetBottom?"bottom":null!=offsetTop&&offsetTop>=scrollTop?"top":!1,this.affixed!==affix&&(this.affixed=affix,this.unpin="bottom"==affix?position.top-scrollTop:null,this.$element.removeClass(reset).addClass("affix"+(affix?"-"+affix:"")))}};var old=$.fn.affix;$.fn.affix=function(option){return this.each(function(){var $this=$(this),data=$this.data("affix"),options="object"==typeof option&&option;data||$this.data("affix",data=new Affix(this,options)),"string"==typeof option&&data[option]()})},$.fn.affix.Constructor=Affix,$.fn.affix.defaults={offset:0},$.fn.affix.noConflict=function(){return $.fn.affix=old,this},$(window).on("load",function(){$('[data-spy="affix"]').each(function(){var $spy=$(this),data=$spy.data();data.offset=data.offset||{},data.offsetBottom&&(data.offset.bottom=data.offsetBottom),data.offsetTop&&(data.offset.top=data.offsetTop),$spy.affix(data)})})}(window.jQuery);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.input-append label{
|
2
|
+
position: relative;
|
3
|
+
top: 5px;
|
4
|
+
margin-right: 5px;
|
5
|
+
}
|
6
|
+
.form-actions{
|
7
|
+
padding: 9px 10px 10px;
|
8
|
+
text-align: right;
|
9
|
+
}
|
10
|
+
.loader-div{
|
11
|
+
background: url(/images/loader.gif) no-repeat;
|
12
|
+
position: relative;
|
13
|
+
margin: 0 auto;
|
14
|
+
width: 50px;
|
15
|
+
height: 50px;
|
16
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
Datepicker for Bootstrap
|
3
|
+
Copyright 2012 Stefan Petre
|
4
|
+
Licensed under the Apache License v2.0
|
5
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
*/
|
7
|
+
.datepicker { top: 0; left: 0; padding: 4px; margin-top: 1px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; /*.dow { border-top: 1px solid #ddd !important; }*/ } .datepicker:before { content: ''; display: inline-block; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 7px solid #ccc; border-bottom-color: rgba(0, 0, 0, 0.2); position: absolute; top: -7px; left: 6px; } .datepicker:after { content: ''; display: inline-block; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #ffffff; position: absolute; top: -6px; left: 7px; } .datepicker > div { display: none; } .datepicker table { width: 100%; margin: 0; } .datepicker td, .datepicker th { text-align: center; width: 20px; height: 20px; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .datepicker td.day:hover { background: #eeeeee; cursor: pointer; } .datepicker td.old, .datepicker td.new { color: #999999; } .datepicker td.active, .datepicker td.active:hover { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(top, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datepicker td.active:hover, .datepicker td.active:hover:hover, .datepicker td.active:active, .datepicker td.active:hover:active, .datepicker td.active.active, .datepicker td.active:hover.active, .datepicker td.active.disabled, .datepicker td.active:hover.disabled, .datepicker td.active[disabled], .datepicker td.active:hover[disabled] { background-color: #0044cc; } .datepicker td.active:active, .datepicker td.active:hover:active, .datepicker td.active.active, .datepicker td.active:hover.active { background-color: #003399 \9; } .datepicker td span { display: block; width: 47px; height: 54px; line-height: 54px; float: left; margin: 2px; cursor: pointer; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } .datepicker td span:hover { background: #eeeeee; } .datepicker td span.active { background-color: #006dcc; background-image: -moz-linear-gradient(top, #0088cc, #0044cc); background-image: -ms-linear-gradient(top, #0088cc, #0044cc); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); background-image: -o-linear-gradient(top, #0088cc, #0044cc); background-image: linear-gradient(top, #0088cc, #0044cc); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); border-color: #0044cc #0044cc #002a80; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); color: #fff; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); } .datepicker td span.active:hover, .datepicker td span.active:active, .datepicker td span.active.active, .datepicker td span.active.disabled, .datepicker td span.active[disabled] { background-color: #0044cc; } .datepicker td span.active:active, .datepicker td span.active.active { background-color: #003399 \9; } .datepicker td span.old { color: #999999; } .datepicker th.switch { width: 145px; } .datepicker th.next, .datepicker th.prev { font-size: 19.5px; } .datepicker thead tr:first-child th { cursor: pointer; } .datepicker thead tr:first-child th:hover { background: #eeeeee; } .input-append.date .add-on i, .input-prepend.date .add-on i { display: block; cursor: pointer; width: 16px; height: 16px; }
|
@@ -0,0 +1,454 @@
|
|
1
|
+
/* =========================================================
|
2
|
+
* bootstrap-datepicker.js
|
3
|
+
* http://www.eyecon.ro/bootstrap-datepicker
|
4
|
+
* =========================================================
|
5
|
+
* Copyright 2012 Stefan Petre
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
* ========================================================= */
|
19
|
+
|
20
|
+
!function( $ ) {
|
21
|
+
|
22
|
+
// Picker object
|
23
|
+
|
24
|
+
var Datepicker = function(element, options){
|
25
|
+
this.element = $(element);
|
26
|
+
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
|
27
|
+
this.picker = $(DPGlobal.template)
|
28
|
+
.appendTo('body')
|
29
|
+
.on({
|
30
|
+
click: $.proxy(this.click, this),
|
31
|
+
mousedown: $.proxy(this.mousedown, this)
|
32
|
+
});
|
33
|
+
this.isInput = this.element.is('input');
|
34
|
+
this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
|
35
|
+
|
36
|
+
if (this.isInput) {
|
37
|
+
this.element.on({
|
38
|
+
focus: $.proxy(this.show, this),
|
39
|
+
blur: $.proxy(this.hide, this),
|
40
|
+
keyup: $.proxy(this.update, this)
|
41
|
+
});
|
42
|
+
} else {
|
43
|
+
if (this.component){
|
44
|
+
this.component.on('click', $.proxy(this.show, this));
|
45
|
+
} else {
|
46
|
+
this.element.on('click', $.proxy(this.show, this));
|
47
|
+
}
|
48
|
+
}
|
49
|
+
this.minViewMode = options.minViewMode||this.element.data('date-minviewmode')||0;
|
50
|
+
if (typeof this.minViewMode === 'string') {
|
51
|
+
switch (this.minViewMode) {
|
52
|
+
case 'months':
|
53
|
+
this.minViewMode = 1;
|
54
|
+
break;
|
55
|
+
case 'years':
|
56
|
+
this.minViewMode = 2;
|
57
|
+
break;
|
58
|
+
default:
|
59
|
+
this.minViewMode = 0;
|
60
|
+
break;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
this.viewMode = options.viewMode||this.element.data('date-viewmode')||0;
|
64
|
+
if (typeof this.viewMode === 'string') {
|
65
|
+
switch (this.viewMode) {
|
66
|
+
case 'months':
|
67
|
+
this.viewMode = 1;
|
68
|
+
break;
|
69
|
+
case 'years':
|
70
|
+
this.viewMode = 2;
|
71
|
+
break;
|
72
|
+
default:
|
73
|
+
this.viewMode = 0;
|
74
|
+
break;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
this.startViewMode = this.viewMode;
|
78
|
+
this.weekStart = options.weekStart||this.element.data('date-weekstart')||0;
|
79
|
+
this.weekEnd = this.weekStart === 0 ? 6 : this.weekStart - 1;
|
80
|
+
this.fillDow();
|
81
|
+
this.fillMonths();
|
82
|
+
this.update();
|
83
|
+
this.showMode();
|
84
|
+
};
|
85
|
+
|
86
|
+
Datepicker.prototype = {
|
87
|
+
constructor: Datepicker,
|
88
|
+
|
89
|
+
show: function(e) {
|
90
|
+
this.picker.show();
|
91
|
+
this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
|
92
|
+
this.place();
|
93
|
+
$(window).on('resize', $.proxy(this.place, this));
|
94
|
+
if (e ) {
|
95
|
+
e.stopPropagation();
|
96
|
+
e.preventDefault();
|
97
|
+
}
|
98
|
+
if (!this.isInput) {
|
99
|
+
$(document).on('mousedown', $.proxy(this.hide, this));
|
100
|
+
}
|
101
|
+
this.element.trigger({
|
102
|
+
type: 'show',
|
103
|
+
date: this.date
|
104
|
+
});
|
105
|
+
},
|
106
|
+
|
107
|
+
hide: function(){
|
108
|
+
this.picker.hide();
|
109
|
+
$(window).off('resize', this.place);
|
110
|
+
this.viewMode = this.startViewMode;
|
111
|
+
this.showMode();
|
112
|
+
if (!this.isInput) {
|
113
|
+
$(document).off('mousedown', this.hide);
|
114
|
+
}
|
115
|
+
this.set();
|
116
|
+
this.element.trigger({
|
117
|
+
type: 'hide',
|
118
|
+
date: this.date
|
119
|
+
});
|
120
|
+
},
|
121
|
+
|
122
|
+
set: function() {
|
123
|
+
var formated = DPGlobal.formatDate(this.date, this.format);
|
124
|
+
if (!this.isInput) {
|
125
|
+
if (this.component){
|
126
|
+
this.element.find('input').prop('value', formated);
|
127
|
+
}
|
128
|
+
this.element.data('date', formated);
|
129
|
+
} else {
|
130
|
+
this.element.prop('value', formated);
|
131
|
+
}
|
132
|
+
},
|
133
|
+
|
134
|
+
setValue: function(newDate) {
|
135
|
+
if (typeof newDate === 'string') {
|
136
|
+
this.date = DPGlobal.parseDate(newDate, this.format);
|
137
|
+
} else {
|
138
|
+
this.date = new Date(newDate);
|
139
|
+
}
|
140
|
+
this.set();
|
141
|
+
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
|
142
|
+
this.fill();
|
143
|
+
},
|
144
|
+
|
145
|
+
place: function(){
|
146
|
+
var offset = this.component ? this.component.offset() : this.element.offset();
|
147
|
+
this.picker.css({
|
148
|
+
top: offset.top + this.height,
|
149
|
+
left: offset.left
|
150
|
+
});
|
151
|
+
},
|
152
|
+
|
153
|
+
update: function(newDate){
|
154
|
+
this.date = DPGlobal.parseDate(
|
155
|
+
typeof newDate === 'string' ? newDate : (this.isInput ? this.element.prop('value') : this.element.data('date')),
|
156
|
+
this.format
|
157
|
+
);
|
158
|
+
this.viewDate = new Date(this.date.getFullYear(), this.date.getMonth(), 1, 0, 0, 0, 0);
|
159
|
+
this.fill();
|
160
|
+
},
|
161
|
+
|
162
|
+
fillDow: function(){
|
163
|
+
var dowCnt = this.weekStart;
|
164
|
+
var html = '<tr>';
|
165
|
+
while (dowCnt < this.weekStart + 7) {
|
166
|
+
html += '<th class="dow">'+DPGlobal.dates.daysMin[(dowCnt++)%7]+'</th>';
|
167
|
+
}
|
168
|
+
html += '</tr>';
|
169
|
+
this.picker.find('.datepicker-days thead').append(html);
|
170
|
+
},
|
171
|
+
|
172
|
+
fillMonths: function(){
|
173
|
+
var html = '';
|
174
|
+
var i = 0
|
175
|
+
while (i < 12) {
|
176
|
+
html += '<span class="month">'+DPGlobal.dates.monthsShort[i++]+'</span>';
|
177
|
+
}
|
178
|
+
this.picker.find('.datepicker-months td').append(html);
|
179
|
+
},
|
180
|
+
|
181
|
+
fill: function() {
|
182
|
+
var d = new Date(this.viewDate),
|
183
|
+
year = d.getFullYear(),
|
184
|
+
month = d.getMonth(),
|
185
|
+
currentDate = this.date.valueOf();
|
186
|
+
this.picker.find('.datepicker-days th:eq(1)')
|
187
|
+
.text(DPGlobal.dates.months[month]+' '+year);
|
188
|
+
var prevMonth = new Date(year, month-1, 28,0,0,0,0),
|
189
|
+
day = DPGlobal.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());
|
190
|
+
prevMonth.setDate(day);
|
191
|
+
prevMonth.setDate(day - (prevMonth.getDay() - this.weekStart + 7)%7);
|
192
|
+
var nextMonth = new Date(prevMonth);
|
193
|
+
nextMonth.setDate(nextMonth.getDate() + 42);
|
194
|
+
nextMonth = nextMonth.valueOf();
|
195
|
+
html = [];
|
196
|
+
var clsName;
|
197
|
+
while(prevMonth.valueOf() < nextMonth) {
|
198
|
+
if (prevMonth.getDay() === this.weekStart) {
|
199
|
+
html.push('<tr>');
|
200
|
+
}
|
201
|
+
clsName = '';
|
202
|
+
if (prevMonth.getMonth() < month) {
|
203
|
+
clsName += ' old';
|
204
|
+
} else if (prevMonth.getMonth() > month) {
|
205
|
+
clsName += ' new';
|
206
|
+
}
|
207
|
+
if (prevMonth.valueOf() === currentDate) {
|
208
|
+
clsName += ' active';
|
209
|
+
}
|
210
|
+
html.push('<td class="day'+clsName+'">'+prevMonth.getDate() + '</td>');
|
211
|
+
if (prevMonth.getDay() === this.weekEnd) {
|
212
|
+
html.push('</tr>');
|
213
|
+
}
|
214
|
+
prevMonth.setDate(prevMonth.getDate()+1);
|
215
|
+
}
|
216
|
+
this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
|
217
|
+
var currentYear = this.date.getFullYear();
|
218
|
+
|
219
|
+
var months = this.picker.find('.datepicker-months')
|
220
|
+
.find('th:eq(1)')
|
221
|
+
.text(year)
|
222
|
+
.end()
|
223
|
+
.find('span').removeClass('active');
|
224
|
+
if (currentYear === year) {
|
225
|
+
months.eq(this.date.getMonth()).addClass('active');
|
226
|
+
}
|
227
|
+
|
228
|
+
html = '';
|
229
|
+
year = parseInt(year/10, 10) * 10;
|
230
|
+
var yearCont = this.picker.find('.datepicker-years')
|
231
|
+
.find('th:eq(1)')
|
232
|
+
.text(year + '-' + (year + 9))
|
233
|
+
.end()
|
234
|
+
.find('td');
|
235
|
+
year -= 1;
|
236
|
+
for (var i = -1; i < 11; i++) {
|
237
|
+
html += '<span class="year'+(i === -1 || i === 10 ? ' old' : '')+(currentYear === year ? ' active' : '')+'">'+year+'</span>';
|
238
|
+
year += 1;
|
239
|
+
}
|
240
|
+
yearCont.html(html);
|
241
|
+
},
|
242
|
+
|
243
|
+
click: function(e) {
|
244
|
+
e.stopPropagation();
|
245
|
+
e.preventDefault();
|
246
|
+
var target = $(e.target).closest('span, td, th');
|
247
|
+
if (target.length === 1) {
|
248
|
+
switch(target[0].nodeName.toLowerCase()) {
|
249
|
+
case 'th':
|
250
|
+
switch(target[0].className) {
|
251
|
+
case 'switch':
|
252
|
+
this.showMode(1);
|
253
|
+
break;
|
254
|
+
case 'prev':
|
255
|
+
case 'next':
|
256
|
+
this.viewDate['set'+DPGlobal.modes[this.viewMode].navFnc].call(
|
257
|
+
this.viewDate,
|
258
|
+
this.viewDate['get'+DPGlobal.modes[this.viewMode].navFnc].call(this.viewDate) +
|
259
|
+
DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1)
|
260
|
+
);
|
261
|
+
this.fill();
|
262
|
+
this.set();
|
263
|
+
break;
|
264
|
+
}
|
265
|
+
break;
|
266
|
+
case 'span':
|
267
|
+
if (target.is('.month')) {
|
268
|
+
var month = target.parent().find('span').index(target);
|
269
|
+
this.viewDate.setMonth(month);
|
270
|
+
} else {
|
271
|
+
var year = parseInt(target.text(), 10)||0;
|
272
|
+
this.viewDate.setFullYear(year);
|
273
|
+
}
|
274
|
+
if (this.viewMode !== 0) {
|
275
|
+
this.date = new Date(this.viewDate);
|
276
|
+
this.element.trigger({
|
277
|
+
type: 'changeDate',
|
278
|
+
date: this.date,
|
279
|
+
viewMode: DPGlobal.modes[this.viewMode].clsName
|
280
|
+
});
|
281
|
+
}
|
282
|
+
this.showMode(-1);
|
283
|
+
this.fill();
|
284
|
+
this.set();
|
285
|
+
break;
|
286
|
+
case 'td':
|
287
|
+
if (target.is('.day')){
|
288
|
+
var day = parseInt(target.text(), 10)||1;
|
289
|
+
var month = this.viewDate.getMonth();
|
290
|
+
if (target.is('.old')) {
|
291
|
+
month -= 1;
|
292
|
+
} else if (target.is('.new')) {
|
293
|
+
month += 1;
|
294
|
+
}
|
295
|
+
var year = this.viewDate.getFullYear();
|
296
|
+
this.date = new Date(year, month, day,0,0,0,0);
|
297
|
+
this.viewDate = new Date(year, month, Math.min(28, day),0,0,0,0);
|
298
|
+
this.fill();
|
299
|
+
this.set();
|
300
|
+
this.element.trigger({
|
301
|
+
type: 'changeDate',
|
302
|
+
date: this.date,
|
303
|
+
viewMode: DPGlobal.modes[this.viewMode].clsName
|
304
|
+
});
|
305
|
+
}
|
306
|
+
break;
|
307
|
+
}
|
308
|
+
}
|
309
|
+
},
|
310
|
+
|
311
|
+
mousedown: function(e){
|
312
|
+
e.stopPropagation();
|
313
|
+
e.preventDefault();
|
314
|
+
},
|
315
|
+
|
316
|
+
showMode: function(dir) {
|
317
|
+
if (dir) {
|
318
|
+
this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir));
|
319
|
+
}
|
320
|
+
this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
|
321
|
+
}
|
322
|
+
};
|
323
|
+
|
324
|
+
$.fn.datepicker = function ( option, val ) {
|
325
|
+
return this.each(function () {
|
326
|
+
var $this = $(this),
|
327
|
+
data = $this.data('datepicker'),
|
328
|
+
options = typeof option === 'object' && option;
|
329
|
+
if (!data) {
|
330
|
+
$this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
|
331
|
+
}
|
332
|
+
if (typeof option === 'string') data[option](val);
|
333
|
+
});
|
334
|
+
};
|
335
|
+
|
336
|
+
$.fn.datepicker.defaults = {
|
337
|
+
};
|
338
|
+
$.fn.datepicker.Constructor = Datepicker;
|
339
|
+
|
340
|
+
var DPGlobal = {
|
341
|
+
modes: [
|
342
|
+
{
|
343
|
+
clsName: 'days',
|
344
|
+
navFnc: 'Month',
|
345
|
+
navStep: 1
|
346
|
+
},
|
347
|
+
{
|
348
|
+
clsName: 'months',
|
349
|
+
navFnc: 'FullYear',
|
350
|
+
navStep: 1
|
351
|
+
},
|
352
|
+
{
|
353
|
+
clsName: 'years',
|
354
|
+
navFnc: 'FullYear',
|
355
|
+
navStep: 10
|
356
|
+
}],
|
357
|
+
dates:{
|
358
|
+
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
|
359
|
+
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
360
|
+
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
|
361
|
+
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
362
|
+
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
363
|
+
},
|
364
|
+
isLeapYear: function (year) {
|
365
|
+
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))
|
366
|
+
},
|
367
|
+
getDaysInMonth: function (year, month) {
|
368
|
+
return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
|
369
|
+
},
|
370
|
+
parseFormat: function(format){
|
371
|
+
var separator = format.match(/[.\/\-\s].*?/),
|
372
|
+
parts = format.split(/\W+/);
|
373
|
+
if (!separator || !parts || parts.length === 0){
|
374
|
+
throw new Error("Invalid date format.");
|
375
|
+
}
|
376
|
+
return {separator: separator, parts: parts};
|
377
|
+
},
|
378
|
+
parseDate: function(date, format) {
|
379
|
+
var parts = date.split(format.separator),
|
380
|
+
date = new Date(),
|
381
|
+
val;
|
382
|
+
date.setHours(0);
|
383
|
+
date.setMinutes(0);
|
384
|
+
date.setSeconds(0);
|
385
|
+
date.setMilliseconds(0);
|
386
|
+
if (parts.length === format.parts.length) {
|
387
|
+
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
|
388
|
+
val = parseInt(parts[i], 10)||1;
|
389
|
+
switch(format.parts[i]) {
|
390
|
+
case 'dd':
|
391
|
+
case 'd':
|
392
|
+
date.setDate(val);
|
393
|
+
break;
|
394
|
+
case 'mm':
|
395
|
+
case 'm':
|
396
|
+
date.setMonth(val - 1);
|
397
|
+
break;
|
398
|
+
case 'yy':
|
399
|
+
date.setFullYear(2000 + val);
|
400
|
+
break;
|
401
|
+
case 'yyyy':
|
402
|
+
date.setFullYear(val);
|
403
|
+
break;
|
404
|
+
}
|
405
|
+
}
|
406
|
+
}
|
407
|
+
return date;
|
408
|
+
},
|
409
|
+
formatDate: function(date, format){
|
410
|
+
var val = {
|
411
|
+
d: date.getDate(),
|
412
|
+
m: date.getMonth() + 1,
|
413
|
+
yy: date.getFullYear().toString().substring(2),
|
414
|
+
yyyy: date.getFullYear()
|
415
|
+
};
|
416
|
+
val.dd = (val.d < 10 ? '0' : '') + val.d;
|
417
|
+
val.mm = (val.m < 10 ? '0' : '') + val.m;
|
418
|
+
var date = [];
|
419
|
+
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
|
420
|
+
date.push(val[format.parts[i]]);
|
421
|
+
}
|
422
|
+
return date.join(format.separator);
|
423
|
+
},
|
424
|
+
headTemplate: '<thead>'+
|
425
|
+
'<tr>'+
|
426
|
+
'<th class="prev">‹</th>'+
|
427
|
+
'<th colspan="5" class="switch"></th>'+
|
428
|
+
'<th class="next">›</th>'+
|
429
|
+
'</tr>'+
|
430
|
+
'</thead>',
|
431
|
+
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'
|
432
|
+
};
|
433
|
+
DPGlobal.template = '<div class="datepicker dropdown-menu">'+
|
434
|
+
'<div class="datepicker-days">'+
|
435
|
+
'<table class=" table-condensed">'+
|
436
|
+
DPGlobal.headTemplate+
|
437
|
+
'<tbody></tbody>'+
|
438
|
+
'</table>'+
|
439
|
+
'</div>'+
|
440
|
+
'<div class="datepicker-months">'+
|
441
|
+
'<table class="table-condensed">'+
|
442
|
+
DPGlobal.headTemplate+
|
443
|
+
DPGlobal.contTemplate+
|
444
|
+
'</table>'+
|
445
|
+
'</div>'+
|
446
|
+
'<div class="datepicker-years">'+
|
447
|
+
'<table class="table-condensed">'+
|
448
|
+
DPGlobal.headTemplate+
|
449
|
+
DPGlobal.contTemplate+
|
450
|
+
'</table>'+
|
451
|
+
'</div>'+
|
452
|
+
'</div>';
|
453
|
+
|
454
|
+
}( window.jQuery )
|