diff --git a/.gitignore b/.gitignore index 9a99910..a5c1d90 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ # Ignore all logfiles and tempfiles. /log/*.log -/tmp \ No newline at end of file +/tmp +.DS_Store diff --git a/Gemfile b/Gemfile index 86b30dd..f391b19 100644 --- a/Gemfile +++ b/Gemfile @@ -36,12 +36,13 @@ gem 'activeadmin', github: 'gregbell/active_admin' gem 'bluecloth' gem 'activeadmin_pagedown' +gem 'devise' + # URL Validation gem "validate_url" # Better Errors group :development do - gem 'sqlite3' gem "better_errors" gem "binding_of_caller" end diff --git a/Gemfile.lock b/Gemfile.lock index d68a090..be17295 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -49,6 +49,7 @@ GEM activesupport (>= 3.0.0) arel (4.0.2) bcrypt (3.1.7) + bcrypt (3.1.7-x86-mingw32) better_errors (1.1.0) coderay (>= 1.0.0) erubis (>= 2.6.6) @@ -111,6 +112,7 @@ GEM multi_json (1.9.3) orm_adapter (0.5.0) pg (0.17.1) + pg (0.17.1-x86-mingw32) polyamorous (1.0.0) activerecord (>= 3.0) polyglot (0.3.4) @@ -164,7 +166,6 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) - sqlite3 (1.3.9) thor (0.19.1) thread_safe (0.3.3) tilt (1.4.1) @@ -184,6 +185,7 @@ GEM PLATFORMS ruby + x86-mingw32 DEPENDENCIES activeadmin! @@ -193,6 +195,7 @@ DEPENDENCIES bluecloth bootstrap-sass (~> 3.0.3.0) coffee-rails (~> 4.0.0) + devise jbuilder (~> 1.2) jquery-rails jquery-turbolinks @@ -201,7 +204,6 @@ DEPENDENCIES rails_12factor sass-rails (~> 4.0.0) sdoc - sqlite3 turbolinks uglifier (>= 1.3.0) validate_url diff --git a/app/admin/course.rb b/app/admin/course.rb index 8a3b6f6..89e8353 100644 --- a/app/admin/course.rb +++ b/app/admin/course.rb @@ -32,7 +32,7 @@ def permitted_params (i.instructors.map { |e| e.name }).join(', ') end column :semester - default_actions + actions end show do diff --git a/app/admin/event.rb b/app/admin/event.rb index 1162216..3873a2b 100644 --- a/app/admin/event.rb +++ b/app/admin/event.rb @@ -14,8 +14,13 @@ def permitted_params f.input :date f.input :start_time f.input :end_time + f.input :sponsor, :as => :select + f.input :mentors, :as => :check_boxes f.input :semester, :as => :select end + f.inputs "Description   (use markdown)" do + f.input :markdown_content, :label => "Description", :as => :pagedown_text + end f.actions end @@ -25,18 +30,27 @@ def permitted_params column :date column :start_time column :end_time - column :semester - default_actions - end + column :sponsor + column :mentors do |m| + (m.mentors.map { |e| e.name }).join(', ') + end + column :semester + actions + end - show do - attributes_table do - row :name - row :location - row :date - row :start_time - row :end_time - row :semester - end + show do + attributes_table do + row :name + row :location + row :date + row :start_time + row :end_time + row :sponsor + row :mentors do |m| + (m.mentors.map { |e| e.name }).join(', ') + end + row :markdown_content + row :semester end end +end diff --git a/app/admin/faq.rb b/app/admin/faq.rb index d654467..f16931d 100644 --- a/app/admin/faq.rb +++ b/app/admin/faq.rb @@ -24,7 +24,7 @@ def permitted_params column :semesters do |s| (s.semesters.map { |e| ([e.season, e.year.year]).join(' ') }).join(', ') end - default_actions + actions end show do diff --git a/app/admin/instructor.rb b/app/admin/instructor.rb index 030c700..a8438e1 100644 --- a/app/admin/instructor.rb +++ b/app/admin/instructor.rb @@ -22,7 +22,7 @@ def permitted_params column :courses do |c| (c.courses.map { |e| e.title }).join(' , ') end - default_actions + actions end show do diff --git a/app/admin/map.rb b/app/admin/map.rb index 963b087..64263dc 100644 --- a/app/admin/map.rb +++ b/app/admin/map.rb @@ -20,7 +20,7 @@ def permitted_params column :name column :image_url column :semester - default_actions + actions end show do diff --git a/app/admin/medium.rb b/app/admin/medium.rb index a87dd70..b11ab1f 100644 --- a/app/admin/medium.rb +++ b/app/admin/medium.rb @@ -24,14 +24,16 @@ def permitted_params column :semester column :link_url column :media_type - default_actions + actions end show do attributes_table do - row :name + row :title row :image_url row :semester + row :link_url + row :media_type end end end diff --git a/app/admin/mentor.rb b/app/admin/mentor.rb index 7a8d349..3c48b94 100644 --- a/app/admin/mentor.rb +++ b/app/admin/mentor.rb @@ -29,7 +29,7 @@ def permitted_params column :semesters do |s| (s.semesters.map { |e| ([e.season, e.year.year]).join(' ') }).join(', ') end - default_actions + actions end show do diff --git a/app/admin/organizer.rb b/app/admin/organizer.rb index 76e80ad..151d904 100644 --- a/app/admin/organizer.rb +++ b/app/admin/organizer.rb @@ -24,7 +24,7 @@ def permitted_params column :semesters do |s| (s.semesters.map { |e| ([e.season, e.year.year]).join(' ') }).join(', ') end - default_actions + actions end show do diff --git a/app/admin/partner.rb b/app/admin/partner.rb index 822a11a..ff24a0b 100644 --- a/app/admin/partner.rb +++ b/app/admin/partner.rb @@ -34,7 +34,7 @@ def permitted_params column :semesters do |s| (s.semesters.map { |e| ([e.season, e.year.year]).join(' ') }).join(' , ') end - default_actions + actions end show do diff --git a/app/admin/prize.rb b/app/admin/prize.rb index 18f6fd5..990cc52 100644 --- a/app/admin/prize.rb +++ b/app/admin/prize.rb @@ -13,6 +13,7 @@ def permitted_params f.input :sponsor, :as => :select f.input :partners, :as => :check_boxes, :collection => Partner.all.where(:partnership_type => "Non-Profit Partner") f.input :semester, :as => :select + f.input :api end f.inputs "Description   (use markdown)" do f.input :markdown_content, :label => "Description", :as => :pagedown_text @@ -24,11 +25,12 @@ def permitted_params column :title column :markdown_content column :sponsor + column :api column :partners do |p| (p.partners.map { |e| e.name }).join(' , ') end column :semester - default_actions + actions end show do @@ -36,6 +38,7 @@ def permitted_params row :title row :markdown_content row :sponsor + row :api row :partners do |p| (p.partners.map { |e| e.name }).join(' , ') end diff --git a/app/admin/sponsor.rb b/app/admin/sponsor.rb index f238708..d053832 100644 --- a/app/admin/sponsor.rb +++ b/app/admin/sponsor.rb @@ -12,6 +12,7 @@ def permitted_params f.input :name f.input :image_url, :hint => "Use 'company-name'.png and make sure the image file is in the public/sponsors folder" f.input :link_url + f.input :tier, :as => :select, :collection => ["small", "medium", "large"] f.input :semesters, :as => :check_boxes end f.actions @@ -21,10 +22,11 @@ def permitted_params column :name column :image_url column :link_url + column :tier column :semesters do |s| (s.semesters.map { |e| ([e.season, e.year.year]).join(' ') }).join(', ') end - default_actions + actions end show do @@ -32,6 +34,7 @@ def permitted_params row :name row :image_url row :link_url + row :tier row :semesters do |s| (s.semesters.map { |e| ([e.season, e.year.year]).join(' ') }).join(', ') end diff --git a/app/admin/winnner.rb b/app/admin/winnner.rb index 2394107..c4e4761 100644 --- a/app/admin/winnner.rb +++ b/app/admin/winnner.rb @@ -25,7 +25,7 @@ def permitted_params column :link_url column :prize_type column :semester - default_actions + actions end show do diff --git a/app/assets/images/fall2014/badge.svg b/app/assets/images/fall2014/badge.svg new file mode 100644 index 0000000..329d0f8 --- /dev/null +++ b/app/assets/images/fall2014/badge.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/images/fall2014/jean-grey.svg b/app/assets/images/fall2014/jean-grey.svg new file mode 100644 index 0000000..43b12c6 --- /dev/null +++ b/app/assets/images/fall2014/jean-grey.svg @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/images/fall2014/profx.svg b/app/assets/images/fall2014/profx.svg new file mode 100644 index 0000000..cb506ad --- /dev/null +++ b/app/assets/images/fall2014/profx.svg @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/images/fall2014/storm.svg b/app/assets/images/fall2014/storm.svg new file mode 100644 index 0000000..d9c458d --- /dev/null +++ b/app/assets/images/fall2014/storm.svg @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/images/fall2014/wolverine.svg b/app/assets/images/fall2014/wolverine.svg new file mode 100644 index 0000000..688bf49 --- /dev/null +++ b/app/assets/images/fall2014/wolverine.svg @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/images/fall2015/babykitty.svg b/app/assets/images/fall2015/babykitty.svg new file mode 100644 index 0000000..b367260 --- /dev/null +++ b/app/assets/images/fall2015/babykitty.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/images/fall2015/badge.svg b/app/assets/images/fall2015/badge.svg new file mode 100644 index 0000000..16a851d --- /dev/null +++ b/app/assets/images/fall2015/badge.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/javascripts/active_admin.js.coffee b/app/assets/javascripts/active_admin.js.coffee index 1000954..1585c18 100644 --- a/app/assets/javascripts/active_admin.js.coffee +++ b/app/assets/javascripts/active_admin.js.coffee @@ -1 +1,3 @@ -#= require ./active_admin_custom \ No newline at end of file +//= require active_admin/base +//= require active_admin_pagedown/base +//= require active_admin_custom diff --git a/app/assets/javascripts/angular-application.js b/app/assets/javascripts/angular-application.js index 1d3cdfc..1d1de7f 100644 --- a/app/assets/javascripts/angular-application.js +++ b/app/assets/javascripts/angular-application.js @@ -1,3 +1 @@ - -//= require ./angular/application-files - +//= require ./angular/application-files \ No newline at end of file diff --git a/app/assets/javascripts/angular-application.js.coffee b/app/assets/javascripts/angular-application.js.coffee new file mode 100644 index 0000000..c128399 --- /dev/null +++ b/app/assets/javascripts/angular-application.js.coffee @@ -0,0 +1,3 @@ +#= jquery +#= require ./angular/application-files + diff --git a/app/assets/javascripts/angular/angular-ui-bootstrap.js b/app/assets/javascripts/angular/angular-ui-bootstrap.js index fa6a861..bcca1cd 100644 --- a/app/assets/javascripts/angular/angular-ui-bootstrap.js +++ b/app/assets/javascripts/angular/angular-ui-bootstrap.js @@ -5,6 +5,4112 @@ * Version: 0.11.0 - 2014-05-01 * License: MIT */ -angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.transition","ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.bindHtml","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.position","ui.bootstrap.datepicker","ui.bootstrap.dropdown","ui.bootstrap.modal","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]),angular.module("ui.bootstrap.tpls",["template/accordion/accordion-group.html","template/accordion/accordion.html","template/alert/alert.html","template/carousel/carousel.html","template/carousel/slide.html","template/datepicker/datepicker.html","template/datepicker/day.html","template/datepicker/month.html","template/datepicker/popup.html","template/datepicker/year.html","template/modal/backdrop.html","template/modal/window.html","template/pagination/pager.html","template/pagination/pagination.html","template/tooltip/tooltip-html-unsafe-popup.html","template/tooltip/tooltip-popup.html","template/popover/popover.html","template/progressbar/bar.html","template/progressbar/progress.html","template/progressbar/progressbar.html","template/rating/rating.html","template/tabs/tab.html","template/tabs/tabset.html","template/timepicker/timepicker.html","template/typeahead/typeahead-match.html","template/typeahead/typeahead-popup.html"]),angular.module("ui.bootstrap.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(a,b,c){function d(a){for(var b in a)if(void 0!==f.style[b])return a[b]}var e=function(d,f,g){g=g||{};var h=a.defer(),i=e[g.animation?"animationEndEventName":"transitionEndEventName"],j=function(){c.$apply(function(){d.unbind(i,j),h.resolve(d)})};return i&&d.bind(i,j),b(function(){angular.isString(f)?d.addClass(f):angular.isFunction(f)?f(d):angular.isObject(f)&&d.css(f),i||h.resolve(d)}),h.promise.cancel=function(){i&&d.unbind(i,j),h.reject("Transition cancelled")},h.promise},f=document.createElement("trans"),g={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},h={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};return e.transitionEndEventName=d(g),e.animationEndEventName=d(h),e}]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(a){return{link:function(b,c,d){function e(b){function d(){j===e&&(j=void 0)}var e=a(c,b);return j&&j.cancel(),j=e,e.then(d,d),e}function f(){k?(k=!1,g()):(c.removeClass("collapse").addClass("collapsing"),e({height:c[0].scrollHeight+"px"}).then(g))}function g(){c.removeClass("collapsing"),c.addClass("collapse in"),c.css({height:"auto"})}function h(){if(k)k=!1,i(),c.css({height:0});else{c.css({height:c[0].scrollHeight+"px"});{c[0].offsetWidth}c.removeClass("collapse in").addClass("collapsing"),e({height:0}).then(i)}}function i(){c.removeClass("collapsing"),c.addClass("collapse")}var j,k=!0;b.$watch(d.collapse,function(a){a?h():f()})}}}]),angular.module("ui.bootstrap.accordion",["ui.bootstrap.collapse"]).constant("accordionConfig",{closeOthers:!0}).controller("AccordionController",["$scope","$attrs","accordionConfig",function(a,b,c){this.groups=[],this.closeOthers=function(d){var e=angular.isDefined(b.closeOthers)?a.$eval(b.closeOthers):c.closeOthers;e&&angular.forEach(this.groups,function(a){a!==d&&(a.isOpen=!1)})},this.addGroup=function(a){var b=this;this.groups.push(a),a.$on("$destroy",function(){b.removeGroup(a)})},this.removeGroup=function(a){var b=this.groups.indexOf(a);-1!==b&&this.groups.splice(b,1)}}]).directive("accordion",function(){return{restrict:"EA",controller:"AccordionController",transclude:!0,replace:!1,templateUrl:"template/accordion/accordion.html"}}).directive("accordionGroup",function(){return{require:"^accordion",restrict:"EA",transclude:!0,replace:!0,templateUrl:"template/accordion/accordion-group.html",scope:{heading:"@",isOpen:"=?",isDisabled:"=?"},controller:function(){this.setHeading=function(a){this.heading=a}},link:function(a,b,c,d){d.addGroup(a),a.$watch("isOpen",function(b){b&&d.closeOthers(a)}),a.toggleOpen=function(){a.isDisabled||(a.isOpen=!a.isOpen)}}}}).directive("accordionHeading",function(){return{restrict:"EA",transclude:!0,template:"",replace:!0,require:"^accordionGroup",link:function(a,b,c,d,e){d.setHeading(e(a,function(){}))}}}).directive("accordionTransclude",function(){return{require:"^accordionGroup",link:function(a,b,c,d){a.$watch(function(){return d[c.accordionTransclude]},function(a){a&&(b.html(""),b.append(a))})}}}),angular.module("ui.bootstrap.alert",[]).controller("AlertController",["$scope","$attrs",function(a,b){a.closeable="close"in b}]).directive("alert",function(){return{restrict:"EA",controller:"AlertController",templateUrl:"template/alert/alert.html",transclude:!0,replace:!0,scope:{type:"@",close:"&"}}}),angular.module("ui.bootstrap.bindHtml",[]).directive("bindHtmlUnsafe",function(){return function(a,b,c){b.addClass("ng-binding").data("$binding",c.bindHtmlUnsafe),a.$watch(c.bindHtmlUnsafe,function(a){b.html(a||"")})}}),angular.module("ui.bootstrap.buttons",[]).constant("buttonConfig",{activeClass:"active",toggleEvent:"click"}).controller("ButtonsController",["buttonConfig",function(a){this.activeClass=a.activeClass||"active",this.toggleEvent=a.toggleEvent||"click"}]).directive("btnRadio",function(){return{require:["btnRadio","ngModel"],controller:"ButtonsController",link:function(a,b,c,d){var e=d[0],f=d[1];f.$render=function(){b.toggleClass(e.activeClass,angular.equals(f.$modelValue,a.$eval(c.btnRadio)))},b.bind(e.toggleEvent,function(){var d=b.hasClass(e.activeClass);(!d||angular.isDefined(c.uncheckable))&&a.$apply(function(){f.$setViewValue(d?null:a.$eval(c.btnRadio)),f.$render()})})}}}).directive("btnCheckbox",function(){return{require:["btnCheckbox","ngModel"],controller:"ButtonsController",link:function(a,b,c,d){function e(){return g(c.btnCheckboxTrue,!0)}function f(){return g(c.btnCheckboxFalse,!1)}function g(b,c){var d=a.$eval(b);return angular.isDefined(d)?d:c}var h=d[0],i=d[1];i.$render=function(){b.toggleClass(h.activeClass,angular.equals(i.$modelValue,e()))},b.bind(h.toggleEvent,function(){a.$apply(function(){i.$setViewValue(b.hasClass(h.activeClass)?f():e()),i.$render()})})}}}),angular.module("ui.bootstrap.carousel",["ui.bootstrap.transition"]).controller("CarouselController",["$scope","$timeout","$transition",function(a,b,c){function d(){e();var c=+a.interval;!isNaN(c)&&c>=0&&(g=b(f,c))}function e(){g&&(b.cancel(g),g=null)}function f(){h?(a.next(),d()):a.pause()}var g,h,i=this,j=i.slides=a.slides=[],k=-1;i.currentSlide=null;var l=!1;i.select=a.select=function(e,f){function g(){if(!l){if(i.currentSlide&&angular.isString(f)&&!a.noTransition&&e.$element){e.$element.addClass(f);{e.$element[0].offsetWidth}angular.forEach(j,function(a){angular.extend(a,{direction:"",entering:!1,leaving:!1,active:!1})}),angular.extend(e,{direction:f,active:!0,entering:!0}),angular.extend(i.currentSlide||{},{direction:f,leaving:!0}),a.$currentTransition=c(e.$element,{}),function(b,c){a.$currentTransition.then(function(){h(b,c)},function(){h(b,c)})}(e,i.currentSlide)}else h(e,i.currentSlide);i.currentSlide=e,k=m,d()}}function h(b,c){angular.extend(b,{direction:"",active:!0,leaving:!1,entering:!1}),angular.extend(c||{},{direction:"",active:!1,leaving:!1,entering:!1}),a.$currentTransition=null}var m=j.indexOf(e);void 0===f&&(f=m>k?"next":"prev"),e&&e!==i.currentSlide&&(a.$currentTransition?(a.$currentTransition.cancel(),b(g)):g())},a.$on("$destroy",function(){l=!0}),i.indexOfSlide=function(a){return j.indexOf(a)},a.next=function(){var b=(k+1)%j.length;return a.$currentTransition?void 0:i.select(j[b],"next")},a.prev=function(){var b=0>k-1?j.length-1:k-1;return a.$currentTransition?void 0:i.select(j[b],"prev")},a.isActive=function(a){return i.currentSlide===a},a.$watch("interval",d),a.$on("$destroy",e),a.play=function(){h||(h=!0,d())},a.pause=function(){a.noPause||(h=!1,e())},i.addSlide=function(b,c){b.$element=c,j.push(b),1===j.length||b.active?(i.select(j[j.length-1]),1==j.length&&a.play()):b.active=!1},i.removeSlide=function(a){var b=j.indexOf(a);j.splice(b,1),j.length>0&&a.active?i.select(b>=j.length?j[b-1]:j[b]):k>b&&k--}}]).directive("carousel",[function(){return{restrict:"EA",transclude:!0,replace:!0,controller:"CarouselController",require:"carousel",templateUrl:"template/carousel/carousel.html",scope:{interval:"=",noTransition:"=",noPause:"="}}}]).directive("slide",function(){return{require:"^carousel",restrict:"EA",transclude:!0,replace:!0,templateUrl:"template/carousel/slide.html",scope:{active:"=?"},link:function(a,b,c,d){d.addSlide(a,b),a.$on("$destroy",function(){d.removeSlide(a)}),a.$watch("active",function(b){b&&d.select(a)})}}}),angular.module("ui.bootstrap.dateparser",[]).service("dateParser",["$locale","orderByFilter",function(a,b){function c(a,b,c){return 1===b&&c>28?29===c&&(a%4===0&&a%100!==0||a%400===0):3===b||5===b||8===b||10===b?31>c:!0}this.parsers={};var d={yyyy:{regex:"\\d{4}",apply:function(a){this.year=+a}},yy:{regex:"\\d{2}",apply:function(a){this.year=+a+2e3}},y:{regex:"\\d{1,4}",apply:function(a){this.year=+a}},MMMM:{regex:a.DATETIME_FORMATS.MONTH.join("|"),apply:function(b){this.month=a.DATETIME_FORMATS.MONTH.indexOf(b)}},MMM:{regex:a.DATETIME_FORMATS.SHORTMONTH.join("|"),apply:function(b){this.month=a.DATETIME_FORMATS.SHORTMONTH.indexOf(b)}},MM:{regex:"0[1-9]|1[0-2]",apply:function(a){this.month=a-1}},M:{regex:"[1-9]|1[0-2]",apply:function(a){this.month=a-1}},dd:{regex:"[0-2][0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a}},d:{regex:"[1-2]?[0-9]{1}|3[0-1]{1}",apply:function(a){this.date=+a}},EEEE:{regex:a.DATETIME_FORMATS.DAY.join("|")},EEE:{regex:a.DATETIME_FORMATS.SHORTDAY.join("|")}};this.createParser=function(a){var c=[],e=a.split("");return angular.forEach(d,function(b,d){var f=a.indexOf(d);if(f>-1){a=a.split(""),e[f]="("+b.regex+")",a[f]="$";for(var g=f+1,h=f+d.length;h>g;g++)e[g]="",a[g]="$";a=a.join(""),c.push({index:f,apply:b.apply})}}),{regex:new RegExp("^"+e.join("")+"$"),map:b(c,"index")}},this.parse=function(b,d){if(!angular.isString(b))return b;d=a.DATETIME_FORMATS[d]||d,this.parsers[d]||(this.parsers[d]=this.createParser(d));var e=this.parsers[d],f=e.regex,g=e.map,h=b.match(f);if(h&&h.length){for(var i,j={year:1900,month:0,date:1,hours:0},k=1,l=h.length;l>k;k++){var m=g[k-1];m.apply&&m.apply.call(j,h[k])}return c(j.year,j.month,j.date)&&(i=new Date(j.year,j.month,j.date,j.hours)),i}}}]),angular.module("ui.bootstrap.position",[]).factory("$position",["$document","$window",function(a,b){function c(a,c){return a.currentStyle?a.currentStyle[c]:b.getComputedStyle?b.getComputedStyle(a)[c]:a.style[c]}function d(a){return"static"===(c(a,"position")||"static")}var e=function(b){for(var c=a[0],e=b.offsetParent||c;e&&e!==c&&d(e);)e=e.offsetParent;return e||c};return{position:function(b){var c=this.offset(b),d={top:0,left:0},f=e(b[0]);f!=a[0]&&(d=this.offset(angular.element(f)),d.top+=f.clientTop-f.scrollTop,d.left+=f.clientLeft-f.scrollLeft);var g=b[0].getBoundingClientRect();return{width:g.width||b.prop("offsetWidth"),height:g.height||b.prop("offsetHeight"),top:c.top-d.top,left:c.left-d.left}},offset:function(c){var d=c[0].getBoundingClientRect();return{width:d.width||c.prop("offsetWidth"),height:d.height||c.prop("offsetHeight"),top:d.top+(b.pageYOffset||a[0].documentElement.scrollTop),left:d.left+(b.pageXOffset||a[0].documentElement.scrollLeft)}},positionElements:function(a,b,c,d){var e,f,g,h,i=c.split("-"),j=i[0],k=i[1]||"center";e=d?this.offset(a):this.position(a),f=b.prop("offsetWidth"),g=b.prop("offsetHeight");var l={center:function(){return e.left+e.width/2-f/2},left:function(){return e.left},right:function(){return e.left+e.width}},m={center:function(){return e.top+e.height/2-g/2},top:function(){return e.top},bottom:function(){return e.top+e.height}};switch(j){case"right":h={top:m[k](),left:l[j]()};break;case"left":h={top:m[k](),left:e.left-f};break;case"bottom":h={top:m[j](),left:l[k]()};break;default:h={top:e.top-g,left:l[k]()}}return h}}}]),angular.module("ui.bootstrap.datepicker",["ui.bootstrap.dateparser","ui.bootstrap.position"]).constant("datepickerConfig",{formatDay:"dd",formatMonth:"MMMM",formatYear:"yyyy",formatDayHeader:"EEE",formatDayTitle:"MMMM yyyy",formatMonthTitle:"yyyy",datepickerMode:"day",minMode:"day",maxMode:"year",showWeeks:!0,startingDay:0,yearRange:20,minDate:null,maxDate:null}).controller("DatepickerController",["$scope","$attrs","$parse","$interpolate","$timeout","$log","dateFilter","datepickerConfig",function(a,b,c,d,e,f,g,h){var i=this,j={$setViewValue:angular.noop};this.modes=["day","month","year"],angular.forEach(["formatDay","formatMonth","formatYear","formatDayHeader","formatDayTitle","formatMonthTitle","minMode","maxMode","showWeeks","startingDay","yearRange"],function(c,e){i[c]=angular.isDefined(b[c])?8>e?d(b[c])(a.$parent):a.$parent.$eval(b[c]):h[c]}),angular.forEach(["minDate","maxDate"],function(d){b[d]?a.$parent.$watch(c(b[d]),function(a){i[d]=a?new Date(a):null,i.refreshView()}):i[d]=h[d]?new Date(h[d]):null}),a.datepickerMode=a.datepickerMode||h.datepickerMode,a.uniqueId="datepicker-"+a.$id+"-"+Math.floor(1e4*Math.random()),this.activeDate=angular.isDefined(b.initDate)?a.$parent.$eval(b.initDate):new Date,a.isActive=function(b){return 0===i.compare(b.date,i.activeDate)?(a.activeDateId=b.uid,!0):!1},this.init=function(a){j=a,j.$render=function(){i.render()}},this.render=function(){if(j.$modelValue){var a=new Date(j.$modelValue),b=!isNaN(a);b?this.activeDate=a:f.error('Datepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.'),j.$setValidity("date",b)}this.refreshView()},this.refreshView=function(){if(this.element){this._refreshView();var a=j.$modelValue?new Date(j.$modelValue):null;j.$setValidity("date-disabled",!a||this.element&&!this.isDisabled(a))}},this.createDateObject=function(a,b){var c=j.$modelValue?new Date(j.$modelValue):null;return{date:a,label:g(a,b),selected:c&&0===this.compare(a,c),disabled:this.isDisabled(a),current:0===this.compare(a,new Date)}},this.isDisabled=function(c){return this.minDate&&this.compare(c,this.minDate)<0||this.maxDate&&this.compare(c,this.maxDate)>0||b.dateDisabled&&a.dateDisabled({date:c,mode:a.datepickerMode})},this.split=function(a,b){for(var c=[];a.length>0;)c.push(a.splice(0,b));return c},a.select=function(b){if(a.datepickerMode===i.minMode){var c=j.$modelValue?new Date(j.$modelValue):new Date(0,0,0,0,0,0,0);c.setFullYear(b.getFullYear(),b.getMonth(),b.getDate()),j.$setViewValue(c),j.$render()}else i.activeDate=b,a.datepickerMode=i.modes[i.modes.indexOf(a.datepickerMode)-1]},a.move=function(a){var b=i.activeDate.getFullYear()+a*(i.step.years||0),c=i.activeDate.getMonth()+a*(i.step.months||0);i.activeDate.setFullYear(b,c,1),i.refreshView()},a.toggleMode=function(b){b=b||1,a.datepickerMode===i.maxMode&&1===b||a.datepickerMode===i.minMode&&-1===b||(a.datepickerMode=i.modes[i.modes.indexOf(a.datepickerMode)+b])},a.keys={13:"enter",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down"};var k=function(){e(function(){i.element[0].focus()},0,!1)};a.$on("datepicker.focus",k),a.keydown=function(b){var c=a.keys[b.which];if(c&&!b.shiftKey&&!b.altKey)if(b.preventDefault(),b.stopPropagation(),"enter"===c||"space"===c){if(i.isDisabled(i.activeDate))return;a.select(i.activeDate),k()}else!b.ctrlKey||"up"!==c&&"down"!==c?(i.handleKeyDown(c,b),i.refreshView()):(a.toggleMode("up"===c?1:-1),k())}}]).directive("datepicker",function(){return{restrict:"EA",replace:!0,templateUrl:"template/datepicker/datepicker.html",scope:{datepickerMode:"=?",dateDisabled:"&"},require:["datepicker","?^ngModel"],controller:"DatepickerController",link:function(a,b,c,d){var e=d[0],f=d[1];f&&e.init(f)}}}).directive("daypicker",["dateFilter",function(a){return{restrict:"EA",replace:!0,templateUrl:"template/datepicker/day.html",require:"^datepicker",link:function(b,c,d,e){function f(a,b){return 1!==b||a%4!==0||a%100===0&&a%400!==0?i[b]:29}function g(a,b){var c=new Array(b),d=new Date(a),e=0;for(d.setHours(12);b>e;)c[e++]=new Date(d),d.setDate(d.getDate()+1);return c}function h(a){var b=new Date(a);b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1}b.showWeeks=e.showWeeks,e.step={months:1},e.element=c;var i=[31,28,31,30,31,30,31,31,30,31,30,31];e._refreshView=function(){var c=e.activeDate.getFullYear(),d=e.activeDate.getMonth(),f=new Date(c,d,1),i=e.startingDay-f.getDay(),j=i>0?7-i:-i,k=new Date(f);j>0&&k.setDate(-j+1);for(var l=g(k,42),m=0;42>m;m++)l[m]=angular.extend(e.createDateObject(l[m],e.formatDay),{secondary:l[m].getMonth()!==d,uid:b.uniqueId+"-"+m});b.labels=new Array(7);for(var n=0;7>n;n++)b.labels[n]={abbr:a(l[n].date,e.formatDayHeader),full:a(l[n].date,"EEEE")};if(b.title=a(e.activeDate,e.formatDayTitle),b.rows=e.split(l,7),b.showWeeks){b.weekNumbers=[];for(var o=h(b.rows[0][0].date),p=b.rows.length;b.weekNumbers.push(o++)f;f++)c[f]=angular.extend(e.createDateObject(new Date(d,f,1),e.formatMonth),{uid:b.uniqueId+"-"+f});b.title=a(e.activeDate,e.formatMonthTitle),b.rows=e.split(c,3)},e.compare=function(a,b){return new Date(a.getFullYear(),a.getMonth())-new Date(b.getFullYear(),b.getMonth())},e.handleKeyDown=function(a){var b=e.activeDate.getMonth();if("left"===a)b-=1;else if("up"===a)b-=3;else if("right"===a)b+=1;else if("down"===a)b+=3;else if("pageup"===a||"pagedown"===a){var c=e.activeDate.getFullYear()+("pageup"===a?-1:1);e.activeDate.setFullYear(c)}else"home"===a?b=0:"end"===a&&(b=11);e.activeDate.setMonth(b)},e.refreshView()}}}]).directive("yearpicker",["dateFilter",function(){return{restrict:"EA",replace:!0,templateUrl:"template/datepicker/year.html",require:"^datepicker",link:function(a,b,c,d){function e(a){return parseInt((a-1)/f,10)*f+1}var f=d.yearRange;d.step={years:f},d.element=b,d._refreshView=function(){for(var b=new Array(f),c=0,g=e(d.activeDate.getFullYear());f>c;c++)b[c]=angular.extend(d.createDateObject(new Date(g+c,0,1),d.formatYear),{uid:a.uniqueId+"-"+c});a.title=[b[0].label,b[f-1].label].join(" - "),a.rows=d.split(b,5)},d.compare=function(a,b){return a.getFullYear()-b.getFullYear()},d.handleKeyDown=function(a){var b=d.activeDate.getFullYear();"left"===a?b-=1:"up"===a?b-=5:"right"===a?b+=1:"down"===a?b+=5:"pageup"===a||"pagedown"===a?b+=("pageup"===a?-1:1)*d.step.years:"home"===a?b=e(d.activeDate.getFullYear()):"end"===a&&(b=e(d.activeDate.getFullYear())+f-1),d.activeDate.setFullYear(b)},d.refreshView()}}}]).constant("datepickerPopupConfig",{datepickerPopup:"yyyy-MM-dd",currentText:"Today",clearText:"Clear",closeText:"Done",closeOnDateSelection:!0,appendToBody:!1,showButtonBar:!0}).directive("datepickerPopup",["$compile","$parse","$document","$position","dateFilter","dateParser","datepickerPopupConfig",function(a,b,c,d,e,f,g){return{restrict:"EA",require:"ngModel",scope:{isOpen:"=?",currentText:"@",clearText:"@",closeText:"@",dateDisabled:"&"},link:function(h,i,j,k){function l(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function m(a){if(a){if(angular.isDate(a)&&!isNaN(a))return k.$setValidity("date",!0),a;if(angular.isString(a)){var b=f.parse(a,n)||new Date(a);return isNaN(b)?void k.$setValidity("date",!1):(k.$setValidity("date",!0),b)}return void k.$setValidity("date",!1)}return k.$setValidity("date",!0),null}var n,o=angular.isDefined(j.closeOnDateSelection)?h.$parent.$eval(j.closeOnDateSelection):g.closeOnDateSelection,p=angular.isDefined(j.datepickerAppendToBody)?h.$parent.$eval(j.datepickerAppendToBody):g.appendToBody;h.showButtonBar=angular.isDefined(j.showButtonBar)?h.$parent.$eval(j.showButtonBar):g.showButtonBar,h.getText=function(a){return h[a+"Text"]||g[a+"Text"]},j.$observe("datepickerPopup",function(a){n=a||g.datepickerPopup,k.$render()});var q=angular.element("
");q.attr({"ng-model":"date","ng-change":"dateSelection()"});var r=angular.element(q.children()[0]);j.datepickerOptions&&angular.forEach(h.$parent.$eval(j.datepickerOptions),function(a,b){r.attr(l(b),a)}),angular.forEach(["minDate","maxDate"],function(a){j[a]&&(h.$parent.$watch(b(j[a]),function(b){h[a]=b}),r.attr(l(a),a))}),j.dateDisabled&&r.attr("date-disabled","dateDisabled({ date: date, mode: mode })"),k.$parsers.unshift(m),h.dateSelection=function(a){angular.isDefined(a)&&(h.date=a),k.$setViewValue(h.date),k.$render(),o&&(h.isOpen=!1,i[0].focus())},i.bind("input change keyup",function(){h.$apply(function(){h.date=k.$modelValue})}),k.$render=function(){var a=k.$viewValue?e(k.$viewValue,n):"";i.val(a),h.date=m(k.$modelValue)};var s=function(a){h.isOpen&&a.target!==i[0]&&h.$apply(function(){h.isOpen=!1})},t=function(a){h.keydown(a)};i.bind("keydown",t),h.keydown=function(a){27===a.which?(a.preventDefault(),a.stopPropagation(),h.close()):40!==a.which||h.isOpen||(h.isOpen=!0)},h.$watch("isOpen",function(a){a?(h.$broadcast("datepicker.focus"),h.position=p?d.offset(i):d.position(i),h.position.top=h.position.top+i.prop("offsetHeight"),c.bind("click",s)):c.unbind("click",s)}),h.select=function(a){if("today"===a){var b=new Date;angular.isDate(k.$modelValue)?(a=new Date(k.$modelValue),a.setFullYear(b.getFullYear(),b.getMonth(),b.getDate())):a=new Date(b.setHours(0,0,0,0))}h.dateSelection(a)},h.close=function(){h.isOpen=!1,i[0].focus()};var u=a(q)(h);p?c.find("body").append(u):i.after(u),h.$on("$destroy",function(){u.remove(),i.unbind("keydown",t),c.unbind("click",s)})}}}]).directive("datepickerPopupWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/datepicker/popup.html",link:function(a,b){b.bind("click",function(a){a.preventDefault(),a.stopPropagation()})}}}),angular.module("ui.bootstrap.dropdown",[]).constant("dropdownConfig",{openClass:"open"}).service("dropdownService",["$document",function(a){var b=null;this.open=function(e){b||(a.bind("click",c),a.bind("keydown",d)),b&&b!==e&&(b.isOpen=!1),b=e},this.close=function(e){b===e&&(b=null,a.unbind("click",c),a.unbind("keydown",d))};var c=function(a){a&&a.isDefaultPrevented()||b.$apply(function(){b.isOpen=!1})},d=function(a){27===a.which&&(b.focusToggleElement(),c())}}]).controller("DropdownController",["$scope","$attrs","$parse","dropdownConfig","dropdownService","$animate",function(a,b,c,d,e,f){var g,h=this,i=a.$new(),j=d.openClass,k=angular.noop,l=b.onToggle?c(b.onToggle):angular.noop;this.init=function(d){h.$element=d,b.isOpen&&(g=c(b.isOpen),k=g.assign,a.$watch(g,function(a){i.isOpen=!!a}))},this.toggle=function(a){return i.isOpen=arguments.length?!!a:!i.isOpen},this.isOpen=function(){return i.isOpen},i.focusToggleElement=function(){h.toggleElement&&h.toggleElement[0].focus()},i.$watch("isOpen",function(b,c){f[b?"addClass":"removeClass"](h.$element,j),b?(i.focusToggleElement(),e.open(i)):e.close(i),k(a,b),angular.isDefined(b)&&b!==c&&l(a,{open:!!b})}),a.$on("$locationChangeSuccess",function(){i.isOpen=!1}),a.$on("$destroy",function(){i.$destroy()})}]).directive("dropdown",function(){return{restrict:"CA",controller:"DropdownController",link:function(a,b,c,d){d.init(b)}}}).directive("dropdownToggle",function(){return{restrict:"CA",require:"?^dropdown",link:function(a,b,c,d){if(d){d.toggleElement=b;var e=function(e){e.preventDefault(),b.hasClass("disabled")||c.disabled||a.$apply(function(){d.toggle()})};b.bind("click",e),b.attr({"aria-haspopup":!0,"aria-expanded":!1}),a.$watch(d.isOpen,function(a){b.attr("aria-expanded",!!a)}),a.$on("$destroy",function(){b.unbind("click",e)})}}}}),angular.module("ui.bootstrap.modal",["ui.bootstrap.transition"]).factory("$$stackedMap",function(){return{createNew:function(){var a=[];return{add:function(b,c){a.push({key:b,value:c})},get:function(b){for(var c=0;c0),i()})}function i(){if(k&&-1==g()){var a=l;j(k,l,150,function(){a.$destroy(),a=null}),k=void 0,l=void 0}}function j(c,d,e,f){function g(){g.done||(g.done=!0,c.remove(),f&&f())}d.animate=!1;var h=a.transitionEndEventName;if(h){var i=b(g,e);c.bind(h,function(){b.cancel(i),g(),d.$apply()})}else b(g,0)}var k,l,m="modal-open",n=f.createNew(),o={};return e.$watch(g,function(a){l&&(l.index=a)}),c.bind("keydown",function(a){var b;27===a.which&&(b=n.top(),b&&b.value.keyboard&&(a.preventDefault(),e.$apply(function(){o.dismiss(b.key,"escape key press")})))}),o.open=function(a,b){n.add(a,{deferred:b.deferred,modalScope:b.scope,backdrop:b.backdrop,keyboard:b.keyboard});var f=c.find("body").eq(0),h=g();h>=0&&!k&&(l=e.$new(!0),l.index=h,k=d("
")(l),f.append(k));var i=angular.element("
");i.attr({"template-url":b.windowTemplateUrl,"window-class":b.windowClass,size:b.size,index:n.length()-1,animate:"animate"}).html(b.content);var j=d(i)(b.scope);n.top().value.modalDomEl=j,f.append(j),f.addClass(m)},o.close=function(a,b){var c=n.get(a).value;c&&(c.deferred.resolve(b),h(a))},o.dismiss=function(a,b){var c=n.get(a).value;c&&(c.deferred.reject(b),h(a))},o.dismissAll=function(a){for(var b=this.getTop();b;)this.dismiss(b.key,a),b=this.getTop()},o.getTop=function(){return n.top()},o}]).provider("$modal",function(){var a={options:{backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$http","$templateCache","$controller","$modalStack",function(b,c,d,e,f,g,h){function i(a){return a.template?d.when(a.template):e.get(a.templateUrl,{cache:f}).then(function(a){return a.data})}function j(a){var c=[];return angular.forEach(a,function(a){(angular.isFunction(a)||angular.isArray(a))&&c.push(d.when(b.invoke(a)))}),c}var k={};return k.open=function(b){var e=d.defer(),f=d.defer(),k={result:e.promise,opened:f.promise,close:function(a){h.close(k,a)},dismiss:function(a){h.dismiss(k,a)}};if(b=angular.extend({},a.options,b),b.resolve=b.resolve||{},!b.template&&!b.templateUrl)throw new Error("One of template or templateUrl options is required.");var l=d.all([i(b)].concat(j(b.resolve)));return l.then(function(a){var d=(b.scope||c).$new();d.$close=k.close,d.$dismiss=k.dismiss;var f,i={},j=1;b.controller&&(i.$scope=d,i.$modalInstance=k,angular.forEach(b.resolve,function(b,c){i[c]=a[j++]}),f=g(b.controller,i)),h.open(k,{scope:d,deferred:e,content:a[0],backdrop:b.backdrop,keyboard:b.keyboard,windowClass:b.windowClass,windowTemplateUrl:b.windowTemplateUrl,size:b.size})},function(a){e.reject(a)}),l.then(function(){f.resolve(!0)},function(){f.reject(!1)}),k},k}]};return a}),angular.module("ui.bootstrap.pagination",[]).controller("PaginationController",["$scope","$attrs","$parse",function(a,b,c){var d=this,e={$setViewValue:angular.noop},f=b.numPages?c(b.numPages).assign:angular.noop;this.init=function(f,g){e=f,this.config=g,e.$render=function(){d.render()},b.itemsPerPage?a.$parent.$watch(c(b.itemsPerPage),function(b){d.itemsPerPage=parseInt(b,10),a.totalPages=d.calculateTotalPages()}):this.itemsPerPage=g.itemsPerPage},this.calculateTotalPages=function(){var b=this.itemsPerPage<1?1:Math.ceil(a.totalItems/this.itemsPerPage);return Math.max(b||0,1)},this.render=function(){a.page=parseInt(e.$viewValue,10)||1},a.selectPage=function(b){a.page!==b&&b>0&&b<=a.totalPages&&(e.$setViewValue(b),e.$render())},a.getText=function(b){return a[b+"Text"]||d.config[b+"Text"]},a.noPrevious=function(){return 1===a.page},a.noNext=function(){return a.page===a.totalPages},a.$watch("totalItems",function(){a.totalPages=d.calculateTotalPages()}),a.$watch("totalPages",function(b){f(a.$parent,b),a.page>b?a.selectPage(b):e.$render()})}]).constant("paginationConfig",{itemsPerPage:10,boundaryLinks:!1,directionLinks:!0,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last",rotate:!0}).directive("pagination",["$parse","paginationConfig",function(a,b){return{restrict:"EA",scope:{totalItems:"=",firstText:"@",previousText:"@",nextText:"@",lastText:"@"},require:["pagination","?ngModel"],controller:"PaginationController",templateUrl:"template/pagination/pagination.html",replace:!0,link:function(c,d,e,f){function g(a,b,c){return{number:a,text:b,active:c}}function h(a,b){var c=[],d=1,e=b,f=angular.isDefined(k)&&b>k;f&&(l?(d=Math.max(a-Math.floor(k/2),1),e=d+k-1,e>b&&(e=b,d=e-k+1)):(d=(Math.ceil(a/k)-1)*k+1,e=Math.min(d+k-1,b)));for(var h=d;e>=h;h++){var i=g(h,h,h===a);c.push(i)}if(f&&!l){if(d>1){var j=g(d-1,"...",!1);c.unshift(j)}if(b>e){var m=g(e+1,"...",!1);c.push(m)}}return c}var i=f[0],j=f[1];if(j){var k=angular.isDefined(e.maxSize)?c.$parent.$eval(e.maxSize):b.maxSize,l=angular.isDefined(e.rotate)?c.$parent.$eval(e.rotate):b.rotate;c.boundaryLinks=angular.isDefined(e.boundaryLinks)?c.$parent.$eval(e.boundaryLinks):b.boundaryLinks,c.directionLinks=angular.isDefined(e.directionLinks)?c.$parent.$eval(e.directionLinks):b.directionLinks,i.init(j,b),e.maxSize&&c.$parent.$watch(a(e.maxSize),function(a){k=parseInt(a,10),i.render()});var m=i.render;i.render=function(){m(),c.page>0&&c.page<=c.totalPages&&(c.pages=h(c.page,c.totalPages))}}}}}]).constant("pagerConfig",{itemsPerPage:10,previousText:"« Previous",nextText:"Next »",align:!0}).directive("pager",["pagerConfig",function(a){return{restrict:"EA",scope:{totalItems:"=",previousText:"@",nextText:"@"},require:["pager","?ngModel"],controller:"PaginationController",templateUrl:"template/pagination/pager.html",replace:!0,link:function(b,c,d,e){var f=e[0],g=e[1];g&&(b.align=angular.isDefined(d.align)?b.$parent.$eval(d.align):a.align,f.init(g,a))}}}]),angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).provider("$tooltip",function(){function a(a){var b=/[A-Z]/g,c="-"; -return a.replace(b,function(a,b){return(b?c:"")+a.toLowerCase()})}var b={placement:"top",animation:!0,popupDelay:0},c={mouseenter:"mouseleave",click:"click",focus:"blur"},d={};this.options=function(a){angular.extend(d,a)},this.setTriggers=function(a){angular.extend(c,a)},this.$get=["$window","$compile","$timeout","$parse","$document","$position","$interpolate",function(e,f,g,h,i,j,k){return function(e,l,m){function n(a){var b=a||o.trigger||m,d=c[b]||b;return{show:b,hide:d}}var o=angular.extend({},b,d),p=a(e),q=k.startSymbol(),r=k.endSymbol(),s="
';return{restrict:"EA",scope:!0,compile:function(){var a=f(s);return function(b,c,d){function f(){b.tt_isOpen?m():k()}function k(){(!y||b.$eval(d[l+"Enable"]))&&(b.tt_popupDelay?v||(v=g(p,b.tt_popupDelay,!1),v.then(function(a){a()})):p()())}function m(){b.$apply(function(){q()})}function p(){return v=null,u&&(g.cancel(u),u=null),b.tt_content?(r(),t.css({top:0,left:0,display:"block"}),w?i.find("body").append(t):c.after(t),z(),b.tt_isOpen=!0,b.$digest(),z):angular.noop}function q(){b.tt_isOpen=!1,g.cancel(v),v=null,b.tt_animation?u||(u=g(s,500)):s()}function r(){t&&s(),t=a(b,function(){}),b.$digest()}function s(){u=null,t&&(t.remove(),t=null)}var t,u,v,w=angular.isDefined(o.appendToBody)?o.appendToBody:!1,x=n(void 0),y=angular.isDefined(d[l+"Enable"]),z=function(){var a=j.positionElements(c,t,b.tt_placement,w);a.top+="px",a.left+="px",t.css(a)};b.tt_isOpen=!1,d.$observe(e,function(a){b.tt_content=a,!a&&b.tt_isOpen&&q()}),d.$observe(l+"Title",function(a){b.tt_title=a}),d.$observe(l+"Placement",function(a){b.tt_placement=angular.isDefined(a)?a:o.placement}),d.$observe(l+"PopupDelay",function(a){var c=parseInt(a,10);b.tt_popupDelay=isNaN(c)?o.popupDelay:c});var A=function(){c.unbind(x.show,k),c.unbind(x.hide,m)};d.$observe(l+"Trigger",function(a){A(),x=n(a),x.show===x.hide?c.bind(x.show,f):(c.bind(x.show,k),c.bind(x.hide,m))});var B=b.$eval(d[l+"Animation"]);b.tt_animation=angular.isDefined(B)?!!B:o.animation,d.$observe(l+"AppendToBody",function(a){w=angular.isDefined(a)?h(a)(b):w}),w&&b.$on("$locationChangeSuccess",function(){b.tt_isOpen&&q()}),b.$on("$destroy",function(){g.cancel(u),g.cancel(v),A(),s()})}}}}}]}).directive("tooltipPopup",function(){return{restrict:"EA",replace:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-popup.html"}}).directive("tooltip",["$tooltip",function(a){return a("tooltip","tooltip","mouseenter")}]).directive("tooltipHtmlUnsafePopup",function(){return{restrict:"EA",replace:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-html-unsafe-popup.html"}}).directive("tooltipHtmlUnsafe",["$tooltip",function(a){return a("tooltipHtmlUnsafe","tooltip","mouseenter")}]),angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("popoverPopup",function(){return{restrict:"EA",replace:!0,scope:{title:"@",content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/popover/popover.html"}}).directive("popover",["$tooltip",function(a){return a("popover","popover","click")}]),angular.module("ui.bootstrap.progressbar",[]).constant("progressConfig",{animate:!0,max:100}).controller("ProgressController",["$scope","$attrs","progressConfig",function(a,b,c){var d=this,e=angular.isDefined(b.animate)?a.$parent.$eval(b.animate):c.animate;this.bars=[],a.max=angular.isDefined(b.max)?a.$parent.$eval(b.max):c.max,this.addBar=function(b,c){e||c.css({transition:"none"}),this.bars.push(b),b.$watch("value",function(c){b.percent=+(100*c/a.max).toFixed(2)}),b.$on("$destroy",function(){c=null,d.removeBar(b)})},this.removeBar=function(a){this.bars.splice(this.bars.indexOf(a),1)}}]).directive("progress",function(){return{restrict:"EA",replace:!0,transclude:!0,controller:"ProgressController",require:"progress",scope:{},templateUrl:"template/progressbar/progress.html"}}).directive("bar",function(){return{restrict:"EA",replace:!0,transclude:!0,require:"^progress",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/bar.html",link:function(a,b,c,d){d.addBar(a,b)}}}).directive("progressbar",function(){return{restrict:"EA",replace:!0,transclude:!0,controller:"ProgressController",scope:{value:"=",type:"@"},templateUrl:"template/progressbar/progressbar.html",link:function(a,b,c,d){d.addBar(a,angular.element(b.children()[0]))}}}),angular.module("ui.bootstrap.rating",[]).constant("ratingConfig",{max:5,stateOn:null,stateOff:null}).controller("RatingController",["$scope","$attrs","ratingConfig",function(a,b,c){var d={$setViewValue:angular.noop};this.init=function(e){d=e,d.$render=this.render,this.stateOn=angular.isDefined(b.stateOn)?a.$parent.$eval(b.stateOn):c.stateOn,this.stateOff=angular.isDefined(b.stateOff)?a.$parent.$eval(b.stateOff):c.stateOff;var f=angular.isDefined(b.ratingStates)?a.$parent.$eval(b.ratingStates):new Array(angular.isDefined(b.max)?a.$parent.$eval(b.max):c.max);a.range=this.buildTemplateObjects(f)},this.buildTemplateObjects=function(a){for(var b=0,c=a.length;c>b;b++)a[b]=angular.extend({index:b},{stateOn:this.stateOn,stateOff:this.stateOff},a[b]);return a},a.rate=function(b){!a.readonly&&b>=0&&b<=a.range.length&&(d.$setViewValue(b),d.$render())},a.enter=function(b){a.readonly||(a.value=b),a.onHover({value:b})},a.reset=function(){a.value=d.$viewValue,a.onLeave()},a.onKeydown=function(b){/(37|38|39|40)/.test(b.which)&&(b.preventDefault(),b.stopPropagation(),a.rate(a.value+(38===b.which||39===b.which?1:-1)))},this.render=function(){a.value=d.$viewValue}}]).directive("rating",function(){return{restrict:"EA",require:["rating","ngModel"],scope:{readonly:"=?",onHover:"&",onLeave:"&"},controller:"RatingController",templateUrl:"template/rating/rating.html",replace:!0,link:function(a,b,c,d){var e=d[0],f=d[1];f&&e.init(f)}}}),angular.module("ui.bootstrap.tabs",[]).controller("TabsetController",["$scope",function(a){var b=this,c=b.tabs=a.tabs=[];b.select=function(a){angular.forEach(c,function(b){b.active&&b!==a&&(b.active=!1,b.onDeselect())}),a.active=!0,a.onSelect()},b.addTab=function(a){c.push(a),1===c.length?a.active=!0:a.active&&b.select(a)},b.removeTab=function(a){var d=c.indexOf(a);if(a.active&&c.length>1){var e=d==c.length-1?d-1:d+1;b.select(c[e])}c.splice(d,1)}}]).directive("tabset",function(){return{restrict:"EA",transclude:!0,replace:!0,scope:{type:"@"},controller:"TabsetController",templateUrl:"template/tabs/tabset.html",link:function(a,b,c){a.vertical=angular.isDefined(c.vertical)?a.$parent.$eval(c.vertical):!1,a.justified=angular.isDefined(c.justified)?a.$parent.$eval(c.justified):!1}}}).directive("tab",["$parse",function(a){return{require:"^tabset",restrict:"EA",replace:!0,templateUrl:"template/tabs/tab.html",transclude:!0,scope:{active:"=?",heading:"@",onSelect:"&select",onDeselect:"&deselect"},controller:function(){},compile:function(b,c,d){return function(b,c,e,f){b.$watch("active",function(a){a&&f.select(b)}),b.disabled=!1,e.disabled&&b.$parent.$watch(a(e.disabled),function(a){b.disabled=!!a}),b.select=function(){b.disabled||(b.active=!0)},f.addTab(b),b.$on("$destroy",function(){f.removeTab(b)}),b.$transcludeFn=d}}}}]).directive("tabHeadingTransclude",[function(){return{restrict:"A",require:"^tab",link:function(a,b){a.$watch("headingElement",function(a){a&&(b.html(""),b.append(a))})}}}]).directive("tabContentTransclude",function(){function a(a){return a.tagName&&(a.hasAttribute("tab-heading")||a.hasAttribute("data-tab-heading")||"tab-heading"===a.tagName.toLowerCase()||"data-tab-heading"===a.tagName.toLowerCase())}return{restrict:"A",require:"^tabset",link:function(b,c,d){var e=b.$eval(d.tabContentTransclude);e.$transcludeFn(e.$parent,function(b){angular.forEach(b,function(b){a(b)?e.headingElement=b:c.append(b)})})}}}),angular.module("ui.bootstrap.timepicker",[]).constant("timepickerConfig",{hourStep:1,minuteStep:1,showMeridian:!0,meridians:null,readonlyInput:!1,mousewheel:!0}).controller("TimepickerController",["$scope","$attrs","$parse","$log","$locale","timepickerConfig",function(a,b,c,d,e,f){function g(){var b=parseInt(a.hours,10),c=a.showMeridian?b>0&&13>b:b>=0&&24>b;return c?(a.showMeridian&&(12===b&&(b=0),a.meridian===p[1]&&(b+=12)),b):void 0}function h(){var b=parseInt(a.minutes,10);return b>=0&&60>b?b:void 0}function i(a){return angular.isDefined(a)&&a.toString().length<2?"0"+a:a}function j(a){k(),o.$setViewValue(new Date(n)),l(a)}function k(){o.$setValidity("time",!0),a.invalidHours=!1,a.invalidMinutes=!1}function l(b){var c=n.getHours(),d=n.getMinutes();a.showMeridian&&(c=0===c||12===c?12:c%12),a.hours="h"===b?c:i(c),a.minutes="m"===b?d:i(d),a.meridian=n.getHours()<12?p[0]:p[1]}function m(a){var b=new Date(n.getTime()+6e4*a);n.setHours(b.getHours(),b.getMinutes()),j()}var n=new Date,o={$setViewValue:angular.noop},p=angular.isDefined(b.meridians)?a.$parent.$eval(b.meridians):f.meridians||e.DATETIME_FORMATS.AMPMS;this.init=function(c,d){o=c,o.$render=this.render;var e=d.eq(0),g=d.eq(1),h=angular.isDefined(b.mousewheel)?a.$parent.$eval(b.mousewheel):f.mousewheel;h&&this.setupMousewheelEvents(e,g),a.readonlyInput=angular.isDefined(b.readonlyInput)?a.$parent.$eval(b.readonlyInput):f.readonlyInput,this.setupInputEvents(e,g)};var q=f.hourStep;b.hourStep&&a.$parent.$watch(c(b.hourStep),function(a){q=parseInt(a,10)});var r=f.minuteStep;b.minuteStep&&a.$parent.$watch(c(b.minuteStep),function(a){r=parseInt(a,10)}),a.showMeridian=f.showMeridian,b.showMeridian&&a.$parent.$watch(c(b.showMeridian),function(b){if(a.showMeridian=!!b,o.$error.time){var c=g(),d=h();angular.isDefined(c)&&angular.isDefined(d)&&(n.setHours(c),j())}else l()}),this.setupMousewheelEvents=function(b,c){var d=function(a){a.originalEvent&&(a=a.originalEvent);var b=a.wheelDelta?a.wheelDelta:-a.deltaY;return a.detail||b>0};b.bind("mousewheel wheel",function(b){a.$apply(d(b)?a.incrementHours():a.decrementHours()),b.preventDefault()}),c.bind("mousewheel wheel",function(b){a.$apply(d(b)?a.incrementMinutes():a.decrementMinutes()),b.preventDefault()})},this.setupInputEvents=function(b,c){if(a.readonlyInput)return a.updateHours=angular.noop,void(a.updateMinutes=angular.noop);var d=function(b,c){o.$setViewValue(null),o.$setValidity("time",!1),angular.isDefined(b)&&(a.invalidHours=b),angular.isDefined(c)&&(a.invalidMinutes=c)};a.updateHours=function(){var a=g();angular.isDefined(a)?(n.setHours(a),j("h")):d(!0)},b.bind("blur",function(){!a.invalidHours&&a.hours<10&&a.$apply(function(){a.hours=i(a.hours)})}),a.updateMinutes=function(){var a=h();angular.isDefined(a)?(n.setMinutes(a),j("m")):d(void 0,!0)},c.bind("blur",function(){!a.invalidMinutes&&a.minutes<10&&a.$apply(function(){a.minutes=i(a.minutes)})})},this.render=function(){var a=o.$modelValue?new Date(o.$modelValue):null;isNaN(a)?(o.$setValidity("time",!1),d.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.')):(a&&(n=a),k(),l())},a.incrementHours=function(){m(60*q)},a.decrementHours=function(){m(60*-q)},a.incrementMinutes=function(){m(r)},a.decrementMinutes=function(){m(-r)},a.toggleMeridian=function(){m(720*(n.getHours()<12?1:-1))}}]).directive("timepicker",function(){return{restrict:"EA",require:["timepicker","?^ngModel"],controller:"TimepickerController",replace:!0,scope:{},templateUrl:"template/timepicker/timepicker.html",link:function(a,b,c,d){var e=d[0],f=d[1];f&&e.init(f,b.find("input"))}}}),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.position","ui.bootstrap.bindHtml"]).factory("typeaheadParser",["$parse",function(a){var b=/^\s*(.*?)(?:\s+as\s+(.*?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+(.*)$/;return{parse:function(c){var d=c.match(b);if(!d)throw new Error('Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_" but got "'+c+'".');return{itemName:d[3],source:a(d[4]),viewMapper:a(d[2]||d[1]),modelMapper:a(d[1])}}}}]).directive("typeahead",["$compile","$parse","$q","$timeout","$document","$position","typeaheadParser",function(a,b,c,d,e,f,g){var h=[9,13,27,38,40];return{require:"ngModel",link:function(i,j,k,l){var m,n=i.$eval(k.typeaheadMinLength)||1,o=i.$eval(k.typeaheadWaitMs)||0,p=i.$eval(k.typeaheadEditable)!==!1,q=b(k.typeaheadLoading).assign||angular.noop,r=b(k.typeaheadOnSelect),s=k.typeaheadInputFormatter?b(k.typeaheadInputFormatter):void 0,t=k.typeaheadAppendToBody?i.$eval(k.typeaheadAppendToBody):!1,u=b(k.ngModel).assign,v=g.parse(k.typeahead),w=i.$new();i.$on("$destroy",function(){w.$destroy()});var x="typeahead-"+w.$id+"-"+Math.floor(1e4*Math.random());j.attr({"aria-autocomplete":"list","aria-expanded":!1,"aria-owns":x});var y=angular.element("
");y.attr({id:x,matches:"matches",active:"activeIdx",select:"select(activeIdx)",query:"query",position:"position"}),angular.isDefined(k.typeaheadTemplateUrl)&&y.attr("template-url",k.typeaheadTemplateUrl);var z=function(){w.matches=[],w.activeIdx=-1,j.attr("aria-expanded",!1)},A=function(a){return x+"-option-"+a};w.$watch("activeIdx",function(a){0>a?j.removeAttr("aria-activedescendant"):j.attr("aria-activedescendant",A(a))});var B=function(a){var b={$viewValue:a};q(i,!0),c.when(v.source(i,b)).then(function(c){var d=a===l.$viewValue;if(d&&m)if(c.length>0){w.activeIdx=0,w.matches.length=0;for(var e=0;e=n?o>0?(C&&d.cancel(C),C=d(function(){B(a)},o)):B(a):(q(i,!1),z()),p?a:a?void l.$setValidity("editable",!1):(l.$setValidity("editable",!0),a)}),l.$formatters.push(function(a){var b,c,d={};return s?(d.$model=a,s(i,d)):(d[v.itemName]=a,b=v.viewMapper(i,d),d[v.itemName]=void 0,c=v.viewMapper(i,d),b!==c?b:a)}),w.select=function(a){var b,c,e={};e[v.itemName]=c=w.matches[a].model,b=v.modelMapper(i,e),u(i,b),l.$setValidity("editable",!0),r(i,{$item:c,$model:b,$label:v.viewMapper(i,e)}),z(),d(function(){j[0].focus()},0,!1)},j.bind("keydown",function(a){0!==w.matches.length&&-1!==h.indexOf(a.which)&&(a.preventDefault(),40===a.which?(w.activeIdx=(w.activeIdx+1)%w.matches.length,w.$digest()):38===a.which?(w.activeIdx=(w.activeIdx?w.activeIdx:w.matches.length)-1,w.$digest()):13===a.which||9===a.which?w.$apply(function(){w.select(w.activeIdx)}):27===a.which&&(a.stopPropagation(),z(),w.$digest()))}),j.bind("blur",function(){m=!1});var D=function(a){j[0]!==a.target&&(z(),w.$digest())};e.bind("click",D),i.$on("$destroy",function(){e.unbind("click",D)});var E=a(y)(w);t?e.find("body").append(E):j.after(E)}}}]).directive("typeaheadPopup",function(){return{restrict:"EA",scope:{matches:"=",query:"=",active:"=",position:"=",select:"&"},replace:!0,templateUrl:"template/typeahead/typeahead-popup.html",link:function(a,b,c){a.templateUrl=c.templateUrl,a.isOpen=function(){return a.matches.length>0},a.isActive=function(b){return a.active==b},a.selectActive=function(b){a.active=b},a.selectMatch=function(b){a.select({activeIdx:b})}}}}).directive("typeaheadMatch",["$http","$templateCache","$compile","$parse",function(a,b,c,d){return{restrict:"EA",scope:{index:"=",match:"=",query:"="},link:function(e,f,g){var h=d(g.templateUrl)(e.$parent)||"template/typeahead/typeahead-match.html";a.get(h,{cache:b}).success(function(a){f.replaceWith(c(a.trim())(e))})}}}]).filter("typeaheadHighlight",function(){function a(a){return a.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(b,c){return c?(""+b).replace(new RegExp(a(c),"gi"),"$&"):b}}),angular.module("template/accordion/accordion-group.html",[]).run(["$templateCache",function(a){a.put("template/accordion/accordion-group.html",'
\n
\n

\n {{heading}}\n

\n
\n
\n
\n
\n
')}]),angular.module("template/accordion/accordion.html",[]).run(["$templateCache",function(a){a.put("template/accordion/accordion.html",'
')}]),angular.module("template/alert/alert.html",[]).run(["$templateCache",function(a){a.put("template/alert/alert.html",'\n')}]),angular.module("template/carousel/carousel.html",[]).run(["$templateCache",function(a){a.put("template/carousel/carousel.html",'\n')}]),angular.module("template/carousel/slide.html",[]).run(["$templateCache",function(a){a.put("template/carousel/slide.html","
\n")}]),angular.module("template/datepicker/datepicker.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/datepicker.html",'
\n \n \n \n
')}]),angular.module("template/datepicker/day.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/day.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
{{label.abbr}}
{{ weekNumbers[$index] }}\n \n
\n')}]),angular.module("template/datepicker/month.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/month.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n')}]),angular.module("template/datepicker/popup.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/popup.html",'\n')}]),angular.module("template/datepicker/year.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/year.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n')}]),angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function(a){a.put("template/modal/backdrop.html",'\n')}]),angular.module("template/modal/window.html",[]).run(["$templateCache",function(a){a.put("template/modal/window.html",'')}]),angular.module("template/pagination/pager.html",[]).run(["$templateCache",function(a){a.put("template/pagination/pager.html",'')}]),angular.module("template/pagination/pagination.html",[]).run(["$templateCache",function(a){a.put("template/pagination/pagination.html",'')}]),angular.module("template/tooltip/tooltip-html-unsafe-popup.html",[]).run(["$templateCache",function(a){a.put("template/tooltip/tooltip-html-unsafe-popup.html",'
\n
\n
\n
\n')}]),angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(a){a.put("template/tooltip/tooltip-popup.html",'
\n
\n
\n
\n')}]),angular.module("template/popover/popover.html",[]).run(["$templateCache",function(a){a.put("template/popover/popover.html",'
\n
\n\n
\n

\n
\n
\n
\n')}]),angular.module("template/progressbar/bar.html",[]).run(["$templateCache",function(a){a.put("template/progressbar/bar.html",'
')}]),angular.module("template/progressbar/progress.html",[]).run(["$templateCache",function(a){a.put("template/progressbar/progress.html",'
')}]),angular.module("template/progressbar/progressbar.html",[]).run(["$templateCache",function(a){a.put("template/progressbar/progressbar.html",'
\n
\n
')}]),angular.module("template/rating/rating.html",[]).run(["$templateCache",function(a){a.put("template/rating/rating.html",'\n \n ({{ $index < value ? \'*\' : \' \' }})\n \n')}]),angular.module("template/tabs/tab.html",[]).run(["$templateCache",function(a){a.put("template/tabs/tab.html",'
  • \n {{heading}}\n
  • \n')}]),angular.module("template/tabs/tabset-titles.html",[]).run(["$templateCache",function(a){a.put("template/tabs/tabset-titles.html","
      \n
    \n")}]),angular.module("template/tabs/tabset.html",[]).run(["$templateCache",function(a){a.put("template/tabs/tabset.html",'\n
    \n \n
    \n
    \n
    \n
    \n
    \n')}]),angular.module("template/timepicker/timepicker.html",[]).run(["$templateCache",function(a){a.put("template/timepicker/timepicker.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
     
    \n \n :\n \n
     
    \n')}]),angular.module("template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(a){a.put("template/typeahead/typeahead-match.html",'')}]),angular.module("template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(a){a.put("template/typeahead/typeahead-popup.html",'') -}]); \ No newline at end of file +angular.module("ui.bootstrap", ["ui.bootstrap.tpls", "ui.bootstrap.transition","ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.bindHtml","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.position","ui.bootstrap.datepicker","ui.bootstrap.dropdown","ui.bootstrap.modal","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]); +angular.module("ui.bootstrap.tpls", ["template/accordion/accordion-group.html","template/accordion/accordion.html","template/alert/alert.html","template/carousel/carousel.html","template/carousel/slide.html","template/datepicker/datepicker.html","template/datepicker/day.html","template/datepicker/month.html","template/datepicker/popup.html","template/datepicker/year.html","template/modal/backdrop.html","template/modal/window.html","template/pagination/pager.html","template/pagination/pagination.html","template/tooltip/tooltip-html-unsafe-popup.html","template/tooltip/tooltip-popup.html","template/popover/popover.html","template/progressbar/bar.html","template/progressbar/progress.html","template/progressbar/progressbar.html","template/rating/rating.html","template/tabs/tab.html","template/tabs/tabset.html","template/timepicker/timepicker.html","template/typeahead/typeahead-match.html","template/typeahead/typeahead-popup.html"]); +angular.module('ui.bootstrap.transition', []) + +/** + * $transition service provides a consistent interface to trigger CSS 3 transitions and to be informed when they complete. + * @param {DOMElement} element The DOMElement that will be animated. + * @param {string|object|function} trigger The thing that will cause the transition to start: + * - As a string, it represents the css class to be added to the element. + * - As an object, it represents a hash of style attributes to be applied to the element. + * - As a function, it represents a function to be called that will cause the transition to occur. + * @return {Promise} A promise that is resolved when the transition finishes. + */ +.factory('$transition', ['$q', '$timeout', '$rootScope', function($q, $timeout, $rootScope) { + + var $transition = function(element, trigger, options) { + options = options || {}; + var deferred = $q.defer(); + var endEventName = $transition[options.animation ? 'animationEndEventName' : 'transitionEndEventName']; + + var transitionEndHandler = function(event) { + $rootScope.$apply(function() { + element.unbind(endEventName, transitionEndHandler); + deferred.resolve(element); + }); + }; + + if (endEventName) { + element.bind(endEventName, transitionEndHandler); + } + + // Wrap in a timeout to allow the browser time to update the DOM before the transition is to occur + $timeout(function() { + if ( angular.isString(trigger) ) { + element.addClass(trigger); + } else if ( angular.isFunction(trigger) ) { + trigger(element); + } else if ( angular.isObject(trigger) ) { + element.css(trigger); + } + //If browser does not support transitions, instantly resolve + if ( !endEventName ) { + deferred.resolve(element); + } + }); + + // Add our custom cancel function to the promise that is returned + // We can call this if we are about to run a new transition, which we know will prevent this transition from ending, + // i.e. it will therefore never raise a transitionEnd event for that transition + deferred.promise.cancel = function() { + if ( endEventName ) { + element.unbind(endEventName, transitionEndHandler); + } + deferred.reject('Transition cancelled'); + }; + + return deferred.promise; + }; + + // Work out the name of the transitionEnd event + var transElement = document.createElement('trans'); + var transitionEndEventNames = { + 'WebkitTransition': 'webkitTransitionEnd', + 'MozTransition': 'transitionend', + 'OTransition': 'oTransitionEnd', + 'transition': 'transitionend' + }; + var animationEndEventNames = { + 'WebkitTransition': 'webkitAnimationEnd', + 'MozTransition': 'animationend', + 'OTransition': 'oAnimationEnd', + 'transition': 'animationend' + }; + function findEndEventName(endEventNames) { + for (var name in endEventNames){ + if (transElement.style[name] !== undefined) { + return endEventNames[name]; + } + } + } + $transition.transitionEndEventName = findEndEventName(transitionEndEventNames); + $transition.animationEndEventName = findEndEventName(animationEndEventNames); + return $transition; +}]); + +angular.module('ui.bootstrap.collapse', ['ui.bootstrap.transition']) + + .directive('collapse', ['$transition', function ($transition) { + + return { + link: function (scope, element, attrs) { + + var initialAnimSkip = true; + var currentTransition; + + function doTransition(change) { + var newTransition = $transition(element, change); + if (currentTransition) { + currentTransition.cancel(); + } + currentTransition = newTransition; + newTransition.then(newTransitionDone, newTransitionDone); + return newTransition; + + function newTransitionDone() { + // Make sure it's this transition, otherwise, leave it alone. + if (currentTransition === newTransition) { + currentTransition = undefined; + } + } + } + + function expand() { + if (initialAnimSkip) { + initialAnimSkip = false; + expandDone(); + } else { + element.removeClass('collapse').addClass('collapsing'); + doTransition({ height: element[0].scrollHeight + 'px' }).then(expandDone); + } + } + + function expandDone() { + element.removeClass('collapsing'); + element.addClass('collapse in'); + element.css({height: 'auto'}); + } + + function collapse() { + if (initialAnimSkip) { + initialAnimSkip = false; + collapseDone(); + element.css({height: 0}); + } else { + // CSS transitions don't work with height: auto, so we have to manually change the height to a specific value + element.css({ height: element[0].scrollHeight + 'px' }); + //trigger reflow so a browser realizes that height was updated from auto to a specific value + var x = element[0].offsetWidth; + + element.removeClass('collapse in').addClass('collapsing'); + + doTransition({ height: 0 }).then(collapseDone); + } + } + + function collapseDone() { + element.removeClass('collapsing'); + element.addClass('collapse'); + } + + scope.$watch(attrs.collapse, function (shouldCollapse) { + if (shouldCollapse) { + collapse(); + } else { + expand(); + } + }); + } + }; + }]); + +angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse']) + +.constant('accordionConfig', { + closeOthers: true +}) + +.controller('AccordionController', ['$scope', '$attrs', 'accordionConfig', function ($scope, $attrs, accordionConfig) { + + // This array keeps track of the accordion groups + this.groups = []; + + // Ensure that all the groups in this accordion are closed, unless close-others explicitly says not to + this.closeOthers = function(openGroup) { + var closeOthers = angular.isDefined($attrs.closeOthers) ? $scope.$eval($attrs.closeOthers) : accordionConfig.closeOthers; + if ( closeOthers ) { + angular.forEach(this.groups, function (group) { + if ( group !== openGroup ) { + group.isOpen = false; + } + }); + } + }; + + // This is called from the accordion-group directive to add itself to the accordion + this.addGroup = function(groupScope) { + var that = this; + this.groups.push(groupScope); + + groupScope.$on('$destroy', function (event) { + that.removeGroup(groupScope); + }); + }; + + // This is called from the accordion-group directive when to remove itself + this.removeGroup = function(group) { + var index = this.groups.indexOf(group); + if ( index !== -1 ) { + this.groups.splice(index, 1); + } + }; + +}]) + +// The accordion directive simply sets up the directive controller +// and adds an accordion CSS class to itself element. +.directive('accordion', function () { + return { + restrict:'EA', + controller:'AccordionController', + transclude: true, + replace: false, + templateUrl: 'template/accordion/accordion.html' + }; +}) + +// The accordion-group directive indicates a block of html that will expand and collapse in an accordion +.directive('accordionGroup', function() { + return { + require:'^accordion', // We need this directive to be inside an accordion + restrict:'EA', + transclude:true, // It transcludes the contents of the directive into the template + replace: true, // The element containing the directive will be replaced with the template + templateUrl:'template/accordion/accordion-group.html', + scope: { + heading: '@', // Interpolate the heading attribute onto this scope + isOpen: '=?', + isDisabled: '=?' + }, + controller: function() { + this.setHeading = function(element) { + this.heading = element; + }; + }, + link: function(scope, element, attrs, accordionCtrl) { + accordionCtrl.addGroup(scope); + + scope.$watch('isOpen', function(value) { + if ( value ) { + accordionCtrl.closeOthers(scope); + } + }); + + scope.toggleOpen = function() { + if ( !scope.isDisabled ) { + scope.isOpen = !scope.isOpen; + } + }; + } + }; +}) + +// Use accordion-heading below an accordion-group to provide a heading containing HTML +// +// Heading containing HTML - +// +.directive('accordionHeading', function() { + return { + restrict: 'EA', + transclude: true, // Grab the contents to be used as the heading + template: '', // In effect remove this element! + replace: true, + require: '^accordionGroup', + link: function(scope, element, attr, accordionGroupCtrl, transclude) { + // Pass the heading to the accordion-group controller + // so that it can be transcluded into the right place in the template + // [The second parameter to transclude causes the elements to be cloned so that they work in ng-repeat] + accordionGroupCtrl.setHeading(transclude(scope, function() {})); + } + }; +}) + +// Use in the accordion-group template to indicate where you want the heading to be transcluded +// You must provide the property on the accordion-group controller that will hold the transcluded element +//
    +// +// ... +//
    +.directive('accordionTransclude', function() { + return { + require: '^accordionGroup', + link: function(scope, element, attr, controller) { + scope.$watch(function() { return controller[attr.accordionTransclude]; }, function(heading) { + if ( heading ) { + element.html(''); + element.append(heading); + } + }); + } + }; +}); + +angular.module('ui.bootstrap.alert', []) + +.controller('AlertController', ['$scope', '$attrs', function ($scope, $attrs) { + $scope.closeable = 'close' in $attrs; +}]) + +.directive('alert', function () { + return { + restrict:'EA', + controller:'AlertController', + templateUrl:'template/alert/alert.html', + transclude:true, + replace:true, + scope: { + type: '@', + close: '&' + } + }; +}); + +angular.module('ui.bootstrap.bindHtml', []) + + .directive('bindHtmlUnsafe', function () { + return function (scope, element, attr) { + element.addClass('ng-binding').data('$binding', attr.bindHtmlUnsafe); + scope.$watch(attr.bindHtmlUnsafe, function bindHtmlUnsafeWatchAction(value) { + element.html(value || ''); + }); + }; + }); +angular.module('ui.bootstrap.buttons', []) + +.constant('buttonConfig', { + activeClass: 'active', + toggleEvent: 'click' +}) + +.controller('ButtonsController', ['buttonConfig', function(buttonConfig) { + this.activeClass = buttonConfig.activeClass || 'active'; + this.toggleEvent = buttonConfig.toggleEvent || 'click'; +}]) + +.directive('btnRadio', function () { + return { + require: ['btnRadio', 'ngModel'], + controller: 'ButtonsController', + link: function (scope, element, attrs, ctrls) { + var buttonsCtrl = ctrls[0], ngModelCtrl = ctrls[1]; + + //model -> UI + ngModelCtrl.$render = function () { + element.toggleClass(buttonsCtrl.activeClass, angular.equals(ngModelCtrl.$modelValue, scope.$eval(attrs.btnRadio))); + }; + + //ui->model + element.bind(buttonsCtrl.toggleEvent, function () { + var isActive = element.hasClass(buttonsCtrl.activeClass); + + if (!isActive || angular.isDefined(attrs.uncheckable)) { + scope.$apply(function () { + ngModelCtrl.$setViewValue(isActive ? null : scope.$eval(attrs.btnRadio)); + ngModelCtrl.$render(); + }); + } + }); + } + }; +}) + +.directive('btnCheckbox', function () { + return { + require: ['btnCheckbox', 'ngModel'], + controller: 'ButtonsController', + link: function (scope, element, attrs, ctrls) { + var buttonsCtrl = ctrls[0], ngModelCtrl = ctrls[1]; + + function getTrueValue() { + return getCheckboxValue(attrs.btnCheckboxTrue, true); + } + + function getFalseValue() { + return getCheckboxValue(attrs.btnCheckboxFalse, false); + } + + function getCheckboxValue(attributeValue, defaultValue) { + var val = scope.$eval(attributeValue); + return angular.isDefined(val) ? val : defaultValue; + } + + //model -> UI + ngModelCtrl.$render = function () { + element.toggleClass(buttonsCtrl.activeClass, angular.equals(ngModelCtrl.$modelValue, getTrueValue())); + }; + + //ui->model + element.bind(buttonsCtrl.toggleEvent, function () { + scope.$apply(function () { + ngModelCtrl.$setViewValue(element.hasClass(buttonsCtrl.activeClass) ? getFalseValue() : getTrueValue()); + ngModelCtrl.$render(); + }); + }); + } + }; +}); + +/** +* @ngdoc overview +* @name ui.bootstrap.carousel +* +* @description +* AngularJS version of an image carousel. +* +*/ +angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition']) +.controller('CarouselController', ['$scope', '$timeout', '$transition', function ($scope, $timeout, $transition) { + var self = this, + slides = self.slides = $scope.slides = [], + currentIndex = -1, + currentTimeout, isPlaying; + self.currentSlide = null; + + var destroyed = false; + /* direction: "prev" or "next" */ + self.select = $scope.select = function(nextSlide, direction) { + var nextIndex = slides.indexOf(nextSlide); + //Decide direction if it's not given + if (direction === undefined) { + direction = nextIndex > currentIndex ? 'next' : 'prev'; + } + if (nextSlide && nextSlide !== self.currentSlide) { + if ($scope.$currentTransition) { + $scope.$currentTransition.cancel(); + //Timeout so ng-class in template has time to fix classes for finished slide + $timeout(goNext); + } else { + goNext(); + } + } + function goNext() { + // Scope has been destroyed, stop here. + if (destroyed) { return; } + //If we have a slide to transition from and we have a transition type and we're allowed, go + if (self.currentSlide && angular.isString(direction) && !$scope.noTransition && nextSlide.$element) { + //We shouldn't do class manip in here, but it's the same weird thing bootstrap does. need to fix sometime + nextSlide.$element.addClass(direction); + var reflow = nextSlide.$element[0].offsetWidth; //force reflow + + //Set all other slides to stop doing their stuff for the new transition + angular.forEach(slides, function(slide) { + angular.extend(slide, {direction: '', entering: false, leaving: false, active: false}); + }); + angular.extend(nextSlide, {direction: direction, active: true, entering: true}); + angular.extend(self.currentSlide||{}, {direction: direction, leaving: true}); + + $scope.$currentTransition = $transition(nextSlide.$element, {}); + //We have to create new pointers inside a closure since next & current will change + (function(next,current) { + $scope.$currentTransition.then( + function(){ transitionDone(next, current); }, + function(){ transitionDone(next, current); } + ); + }(nextSlide, self.currentSlide)); + } else { + transitionDone(nextSlide, self.currentSlide); + } + self.currentSlide = nextSlide; + currentIndex = nextIndex; + //every time you change slides, reset the timer + restartTimer(); + } + function transitionDone(next, current) { + angular.extend(next, {direction: '', active: true, leaving: false, entering: false}); + angular.extend(current||{}, {direction: '', active: false, leaving: false, entering: false}); + $scope.$currentTransition = null; + } + }; + $scope.$on('$destroy', function () { + destroyed = true; + }); + + /* Allow outside people to call indexOf on slides array */ + self.indexOfSlide = function(slide) { + return slides.indexOf(slide); + }; + + $scope.next = function() { + var newIndex = (currentIndex + 1) % slides.length; + + //Prevent this user-triggered transition from occurring if there is already one in progress + if (!$scope.$currentTransition) { + return self.select(slides[newIndex], 'next'); + } + }; + + $scope.prev = function() { + var newIndex = currentIndex - 1 < 0 ? slides.length - 1 : currentIndex - 1; + + //Prevent this user-triggered transition from occurring if there is already one in progress + if (!$scope.$currentTransition) { + return self.select(slides[newIndex], 'prev'); + } + }; + + $scope.isActive = function(slide) { + return self.currentSlide === slide; + }; + + $scope.$watch('interval', restartTimer); + $scope.$on('$destroy', resetTimer); + + function restartTimer() { + resetTimer(); + var interval = +$scope.interval; + if (!isNaN(interval) && interval>=0) { + currentTimeout = $timeout(timerFn, interval); + } + } + + function resetTimer() { + if (currentTimeout) { + $timeout.cancel(currentTimeout); + currentTimeout = null; + } + } + + function timerFn() { + if (isPlaying) { + $scope.next(); + restartTimer(); + } else { + $scope.pause(); + } + } + + $scope.play = function() { + if (!isPlaying) { + isPlaying = true; + restartTimer(); + } + }; + $scope.pause = function() { + if (!$scope.noPause) { + isPlaying = false; + resetTimer(); + } + }; + + self.addSlide = function(slide, element) { + slide.$element = element; + slides.push(slide); + //if this is the first slide or the slide is set to active, select it + if(slides.length === 1 || slide.active) { + self.select(slides[slides.length-1]); + if (slides.length == 1) { + $scope.play(); + } + } else { + slide.active = false; + } + }; + + self.removeSlide = function(slide) { + //get the index of the slide inside the carousel + var index = slides.indexOf(slide); + slides.splice(index, 1); + if (slides.length > 0 && slide.active) { + if (index >= slides.length) { + self.select(slides[index-1]); + } else { + self.select(slides[index]); + } + } else if (currentIndex > index) { + currentIndex--; + } + }; + +}]) + +/** + * @ngdoc directive + * @name ui.bootstrap.carousel.directive:carousel + * @restrict EA + * + * @description + * Carousel is the outer container for a set of image 'slides' to showcase. + * + * @param {number=} interval The time, in milliseconds, that it will take the carousel to go to the next slide. + * @param {boolean=} noTransition Whether to disable transitions on the carousel. + * @param {boolean=} noPause Whether to disable pausing on the carousel (by default, the carousel interval pauses on hover). + * + * @example + + + + + + + + + + + + + + + .carousel-indicators { + top: auto; + bottom: 15px; + } + + + */ +.directive('carousel', [function() { + return { + restrict: 'EA', + transclude: true, + replace: true, + controller: 'CarouselController', + require: 'carousel', + templateUrl: 'template/carousel/carousel.html', + scope: { + interval: '=', + noTransition: '=', + noPause: '=' + } + }; +}]) + +/** + * @ngdoc directive + * @name ui.bootstrap.carousel.directive:slide + * @restrict EA + * + * @description + * Creates a slide inside a {@link ui.bootstrap.carousel.directive:carousel carousel}. Must be placed as a child of a carousel element. + * + * @param {boolean=} active Model binding, whether or not this slide is currently active. + * + * @example + + +
    + + + + + + + Interval, in milliseconds: +
    Enter a negative number to stop the interval. +
    +
    + +function CarouselDemoCtrl($scope) { + $scope.myInterval = 5000; +} + + + .carousel-indicators { + top: auto; + bottom: 15px; + } + +
    +*/ + +.directive('slide', function() { + return { + require: '^carousel', + restrict: 'EA', + transclude: true, + replace: true, + templateUrl: 'template/carousel/slide.html', + scope: { + active: '=?' + }, + link: function (scope, element, attrs, carouselCtrl) { + carouselCtrl.addSlide(scope, element); + //when the scope is destroyed then remove the slide from the current slides array + scope.$on('$destroy', function() { + carouselCtrl.removeSlide(scope); + }); + + scope.$watch('active', function(active) { + if (active) { + carouselCtrl.select(scope); + } + }); + } + }; +}); + +angular.module('ui.bootstrap.dateparser', []) + +.service('dateParser', ['$locale', 'orderByFilter', function($locale, orderByFilter) { + + this.parsers = {}; + + var formatCodeToRegex = { + 'yyyy': { + regex: '\\d{4}', + apply: function(value) { this.year = +value; } + }, + 'yy': { + regex: '\\d{2}', + apply: function(value) { this.year = +value + 2000; } + }, + 'y': { + regex: '\\d{1,4}', + apply: function(value) { this.year = +value; } + }, + 'MMMM': { + regex: $locale.DATETIME_FORMATS.MONTH.join('|'), + apply: function(value) { this.month = $locale.DATETIME_FORMATS.MONTH.indexOf(value); } + }, + 'MMM': { + regex: $locale.DATETIME_FORMATS.SHORTMONTH.join('|'), + apply: function(value) { this.month = $locale.DATETIME_FORMATS.SHORTMONTH.indexOf(value); } + }, + 'MM': { + regex: '0[1-9]|1[0-2]', + apply: function(value) { this.month = value - 1; } + }, + 'M': { + regex: '[1-9]|1[0-2]', + apply: function(value) { this.month = value - 1; } + }, + 'dd': { + regex: '[0-2][0-9]{1}|3[0-1]{1}', + apply: function(value) { this.date = +value; } + }, + 'd': { + regex: '[1-2]?[0-9]{1}|3[0-1]{1}', + apply: function(value) { this.date = +value; } + }, + 'EEEE': { + regex: $locale.DATETIME_FORMATS.DAY.join('|') + }, + 'EEE': { + regex: $locale.DATETIME_FORMATS.SHORTDAY.join('|') + } + }; + + this.createParser = function(format) { + var map = [], regex = format.split(''); + + angular.forEach(formatCodeToRegex, function(data, code) { + var index = format.indexOf(code); + + if (index > -1) { + format = format.split(''); + + regex[index] = '(' + data.regex + ')'; + format[index] = '$'; // Custom symbol to define consumed part of format + for (var i = index + 1, n = index + code.length; i < n; i++) { + regex[i] = ''; + format[i] = '$'; + } + format = format.join(''); + + map.push({ index: index, apply: data.apply }); + } + }); + + return { + regex: new RegExp('^' + regex.join('') + '$'), + map: orderByFilter(map, 'index') + }; + }; + + this.parse = function(input, format) { + if ( !angular.isString(input) ) { + return input; + } + + format = $locale.DATETIME_FORMATS[format] || format; + + if ( !this.parsers[format] ) { + this.parsers[format] = this.createParser(format); + } + + var parser = this.parsers[format], + regex = parser.regex, + map = parser.map, + results = input.match(regex); + + if ( results && results.length ) { + var fields = { year: 1900, month: 0, date: 1, hours: 0 }, dt; + + for( var i = 1, n = results.length; i < n; i++ ) { + var mapper = map[i-1]; + if ( mapper.apply ) { + mapper.apply.call(fields, results[i]); + } + } + + if ( isValid(fields.year, fields.month, fields.date) ) { + dt = new Date( fields.year, fields.month, fields.date, fields.hours); + } + + return dt; + } + }; + + // Check if date is valid for specific month (and year for February). + // Month: 0 = Jan, 1 = Feb, etc + function isValid(year, month, date) { + if ( month === 1 && date > 28) { + return date === 29 && ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0); + } + + if ( month === 3 || month === 5 || month === 8 || month === 10) { + return date < 31; + } + + return true; + } +}]); + +angular.module('ui.bootstrap.position', []) + +/** + * A set of utility methods that can be use to retrieve position of DOM elements. + * It is meant to be used where we need to absolute-position DOM elements in + * relation to other, existing elements (this is the case for tooltips, popovers, + * typeahead suggestions etc.). + */ + .factory('$position', ['$document', '$window', function ($document, $window) { + + function getStyle(el, cssprop) { + if (el.currentStyle) { //IE + return el.currentStyle[cssprop]; + } else if ($window.getComputedStyle) { + return $window.getComputedStyle(el)[cssprop]; + } + // finally try and get inline style + return el.style[cssprop]; + } + + /** + * Checks if a given element is statically positioned + * @param element - raw DOM element + */ + function isStaticPositioned(element) { + return (getStyle(element, 'position') || 'static' ) === 'static'; + } + + /** + * returns the closest, non-statically positioned parentOffset of a given element + * @param element + */ + var parentOffsetEl = function (element) { + var docDomEl = $document[0]; + var offsetParent = element.offsetParent || docDomEl; + while (offsetParent && offsetParent !== docDomEl && isStaticPositioned(offsetParent) ) { + offsetParent = offsetParent.offsetParent; + } + return offsetParent || docDomEl; + }; + + return { + /** + * Provides read-only equivalent of jQuery's position function: + * http://api.jquery.com/position/ + */ + position: function (element) { + var elBCR = this.offset(element); + var offsetParentBCR = { top: 0, left: 0 }; + var offsetParentEl = parentOffsetEl(element[0]); + if (offsetParentEl != $document[0]) { + offsetParentBCR = this.offset(angular.element(offsetParentEl)); + offsetParentBCR.top += offsetParentEl.clientTop - offsetParentEl.scrollTop; + offsetParentBCR.left += offsetParentEl.clientLeft - offsetParentEl.scrollLeft; + } + + var boundingClientRect = element[0].getBoundingClientRect(); + return { + width: boundingClientRect.width || element.prop('offsetWidth'), + height: boundingClientRect.height || element.prop('offsetHeight'), + top: elBCR.top - offsetParentBCR.top, + left: elBCR.left - offsetParentBCR.left + }; + }, + + /** + * Provides read-only equivalent of jQuery's offset function: + * http://api.jquery.com/offset/ + */ + offset: function (element) { + var boundingClientRect = element[0].getBoundingClientRect(); + return { + width: boundingClientRect.width || element.prop('offsetWidth'), + height: boundingClientRect.height || element.prop('offsetHeight'), + top: boundingClientRect.top + ($window.pageYOffset || $document[0].documentElement.scrollTop), + left: boundingClientRect.left + ($window.pageXOffset || $document[0].documentElement.scrollLeft) + }; + }, + + /** + * Provides coordinates for the targetEl in relation to hostEl + */ + positionElements: function (hostEl, targetEl, positionStr, appendToBody) { + + var positionStrParts = positionStr.split('-'); + var pos0 = positionStrParts[0], pos1 = positionStrParts[1] || 'center'; + + var hostElPos, + targetElWidth, + targetElHeight, + targetElPos; + + hostElPos = appendToBody ? this.offset(hostEl) : this.position(hostEl); + + targetElWidth = targetEl.prop('offsetWidth'); + targetElHeight = targetEl.prop('offsetHeight'); + + var shiftWidth = { + center: function () { + return hostElPos.left + hostElPos.width / 2 - targetElWidth / 2; + }, + left: function () { + return hostElPos.left; + }, + right: function () { + return hostElPos.left + hostElPos.width; + } + }; + + var shiftHeight = { + center: function () { + return hostElPos.top + hostElPos.height / 2 - targetElHeight / 2; + }, + top: function () { + return hostElPos.top; + }, + bottom: function () { + return hostElPos.top + hostElPos.height; + } + }; + + switch (pos0) { + case 'right': + targetElPos = { + top: shiftHeight[pos1](), + left: shiftWidth[pos0]() + }; + break; + case 'left': + targetElPos = { + top: shiftHeight[pos1](), + left: hostElPos.left - targetElWidth + }; + break; + case 'bottom': + targetElPos = { + top: shiftHeight[pos0](), + left: shiftWidth[pos1]() + }; + break; + default: + targetElPos = { + top: hostElPos.top - targetElHeight, + left: shiftWidth[pos1]() + }; + break; + } + + return targetElPos; + } + }; + }]); + +angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.position']) + +.constant('datepickerConfig', { + formatDay: 'dd', + formatMonth: 'MMMM', + formatYear: 'yyyy', + formatDayHeader: 'EEE', + formatDayTitle: 'MMMM yyyy', + formatMonthTitle: 'yyyy', + datepickerMode: 'day', + minMode: 'day', + maxMode: 'year', + showWeeks: true, + startingDay: 0, + yearRange: 20, + minDate: null, + maxDate: null +}) + +.controller('DatepickerController', ['$scope', '$attrs', '$parse', '$interpolate', '$timeout', '$log', 'dateFilter', 'datepickerConfig', function($scope, $attrs, $parse, $interpolate, $timeout, $log, dateFilter, datepickerConfig) { + var self = this, + ngModelCtrl = { $setViewValue: angular.noop }; // nullModelCtrl; + + // Modes chain + this.modes = ['day', 'month', 'year']; + + // Configuration attributes + angular.forEach(['formatDay', 'formatMonth', 'formatYear', 'formatDayHeader', 'formatDayTitle', 'formatMonthTitle', + 'minMode', 'maxMode', 'showWeeks', 'startingDay', 'yearRange'], function( key, index ) { + self[key] = angular.isDefined($attrs[key]) ? (index < 8 ? $interpolate($attrs[key])($scope.$parent) : $scope.$parent.$eval($attrs[key])) : datepickerConfig[key]; + }); + + // Watchable attributes + angular.forEach(['minDate', 'maxDate'], function( key ) { + if ( $attrs[key] ) { + $scope.$parent.$watch($parse($attrs[key]), function(value) { + self[key] = value ? new Date(value) : null; + self.refreshView(); + }); + } else { + self[key] = datepickerConfig[key] ? new Date(datepickerConfig[key]) : null; + } + }); + + $scope.datepickerMode = $scope.datepickerMode || datepickerConfig.datepickerMode; + $scope.uniqueId = 'datepicker-' + $scope.$id + '-' + Math.floor(Math.random() * 10000); + this.activeDate = angular.isDefined($attrs.initDate) ? $scope.$parent.$eval($attrs.initDate) : new Date(); + + $scope.isActive = function(dateObject) { + if (self.compare(dateObject.date, self.activeDate) === 0) { + $scope.activeDateId = dateObject.uid; + return true; + } + return false; + }; + + this.init = function( ngModelCtrl_ ) { + ngModelCtrl = ngModelCtrl_; + + ngModelCtrl.$render = function() { + self.render(); + }; + }; + + this.render = function() { + if ( ngModelCtrl.$modelValue ) { + var date = new Date( ngModelCtrl.$modelValue ), + isValid = !isNaN(date); + + if ( isValid ) { + this.activeDate = date; + } else { + $log.error('Datepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.'); + } + ngModelCtrl.$setValidity('date', isValid); + } + this.refreshView(); + }; + + this.refreshView = function() { + if ( this.element ) { + this._refreshView(); + + var date = ngModelCtrl.$modelValue ? new Date(ngModelCtrl.$modelValue) : null; + ngModelCtrl.$setValidity('date-disabled', !date || (this.element && !this.isDisabled(date))); + } + }; + + this.createDateObject = function(date, format) { + var model = ngModelCtrl.$modelValue ? new Date(ngModelCtrl.$modelValue) : null; + return { + date: date, + label: dateFilter(date, format), + selected: model && this.compare(date, model) === 0, + disabled: this.isDisabled(date), + current: this.compare(date, new Date()) === 0 + }; + }; + + this.isDisabled = function( date ) { + return ((this.minDate && this.compare(date, this.minDate) < 0) || (this.maxDate && this.compare(date, this.maxDate) > 0) || ($attrs.dateDisabled && $scope.dateDisabled({date: date, mode: $scope.datepickerMode}))); + }; + + // Split array into smaller arrays + this.split = function(arr, size) { + var arrays = []; + while (arr.length > 0) { + arrays.push(arr.splice(0, size)); + } + return arrays; + }; + + $scope.select = function( date ) { + if ( $scope.datepickerMode === self.minMode ) { + var dt = ngModelCtrl.$modelValue ? new Date( ngModelCtrl.$modelValue ) : new Date(0, 0, 0, 0, 0, 0, 0); + dt.setFullYear( date.getFullYear(), date.getMonth(), date.getDate() ); + ngModelCtrl.$setViewValue( dt ); + ngModelCtrl.$render(); + } else { + self.activeDate = date; + $scope.datepickerMode = self.modes[ self.modes.indexOf( $scope.datepickerMode ) - 1 ]; + } + }; + + $scope.move = function( direction ) { + var year = self.activeDate.getFullYear() + direction * (self.step.years || 0), + month = self.activeDate.getMonth() + direction * (self.step.months || 0); + self.activeDate.setFullYear(year, month, 1); + self.refreshView(); + }; + + $scope.toggleMode = function( direction ) { + direction = direction || 1; + + if (($scope.datepickerMode === self.maxMode && direction === 1) || ($scope.datepickerMode === self.minMode && direction === -1)) { + return; + } + + $scope.datepickerMode = self.modes[ self.modes.indexOf( $scope.datepickerMode ) + direction ]; + }; + + // Key event mapper + $scope.keys = { 13:'enter', 32:'space', 33:'pageup', 34:'pagedown', 35:'end', 36:'home', 37:'left', 38:'up', 39:'right', 40:'down' }; + + var focusElement = function() { + $timeout(function() { + self.element[0].focus(); + }, 0 , false); + }; + + // Listen for focus requests from popup directive + $scope.$on('datepicker.focus', focusElement); + + $scope.keydown = function( evt ) { + var key = $scope.keys[evt.which]; + + if ( !key || evt.shiftKey || evt.altKey ) { + return; + } + + evt.preventDefault(); + evt.stopPropagation(); + + if (key === 'enter' || key === 'space') { + if ( self.isDisabled(self.activeDate)) { + return; // do nothing + } + $scope.select(self.activeDate); + focusElement(); + } else if (evt.ctrlKey && (key === 'up' || key === 'down')) { + $scope.toggleMode(key === 'up' ? 1 : -1); + focusElement(); + } else { + self.handleKeyDown(key, evt); + self.refreshView(); + } + }; +}]) + +.directive( 'datepicker', function () { + return { + restrict: 'EA', + replace: true, + templateUrl: 'template/datepicker/datepicker.html', + scope: { + datepickerMode: '=?', + dateDisabled: '&' + }, + require: ['datepicker', '?^ngModel'], + controller: 'DatepickerController', + link: function(scope, element, attrs, ctrls) { + var datepickerCtrl = ctrls[0], ngModelCtrl = ctrls[1]; + + if ( ngModelCtrl ) { + datepickerCtrl.init( ngModelCtrl ); + } + } + }; +}) + +.directive('daypicker', ['dateFilter', function (dateFilter) { + return { + restrict: 'EA', + replace: true, + templateUrl: 'template/datepicker/day.html', + require: '^datepicker', + link: function(scope, element, attrs, ctrl) { + scope.showWeeks = ctrl.showWeeks; + + ctrl.step = { months: 1 }; + ctrl.element = element; + + var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + function getDaysInMonth( year, month ) { + return ((month === 1) && (year % 4 === 0) && ((year % 100 !== 0) || (year % 400 === 0))) ? 29 : DAYS_IN_MONTH[month]; + } + + function getDates(startDate, n) { + var dates = new Array(n), current = new Date(startDate), i = 0; + current.setHours(12); // Prevent repeated dates because of timezone bug + while ( i < n ) { + dates[i++] = new Date(current); + current.setDate( current.getDate() + 1 ); + } + return dates; + } + + ctrl._refreshView = function() { + var year = ctrl.activeDate.getFullYear(), + month = ctrl.activeDate.getMonth(), + firstDayOfMonth = new Date(year, month, 1), + difference = ctrl.startingDay - firstDayOfMonth.getDay(), + numDisplayedFromPreviousMonth = (difference > 0) ? 7 - difference : - difference, + firstDate = new Date(firstDayOfMonth); + + if ( numDisplayedFromPreviousMonth > 0 ) { + firstDate.setDate( - numDisplayedFromPreviousMonth + 1 ); + } + + // 42 is the number of days on a six-month calendar + var days = getDates(firstDate, 42); + for (var i = 0; i < 42; i ++) { + days[i] = angular.extend(ctrl.createDateObject(days[i], ctrl.formatDay), { + secondary: days[i].getMonth() !== month, + uid: scope.uniqueId + '-' + i + }); + } + + scope.labels = new Array(7); + for (var j = 0; j < 7; j++) { + scope.labels[j] = { + abbr: dateFilter(days[j].date, ctrl.formatDayHeader), + full: dateFilter(days[j].date, 'EEEE') + }; + } + + scope.title = dateFilter(ctrl.activeDate, ctrl.formatDayTitle); + scope.rows = ctrl.split(days, 7); + + if ( scope.showWeeks ) { + scope.weekNumbers = []; + var weekNumber = getISO8601WeekNumber( scope.rows[0][0].date ), + numWeeks = scope.rows.length; + while( scope.weekNumbers.push(weekNumber++) < numWeeks ) {} + } + }; + + ctrl.compare = function(date1, date2) { + return (new Date( date1.getFullYear(), date1.getMonth(), date1.getDate() ) - new Date( date2.getFullYear(), date2.getMonth(), date2.getDate() ) ); + }; + + function getISO8601WeekNumber(date) { + var checkDate = new Date(date); + checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); // Thursday + var time = checkDate.getTime(); + checkDate.setMonth(0); // Compare with Jan 1 + checkDate.setDate(1); + return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; + } + + ctrl.handleKeyDown = function( key, evt ) { + var date = ctrl.activeDate.getDate(); + + if (key === 'left') { + date = date - 1; // up + } else if (key === 'up') { + date = date - 7; // down + } else if (key === 'right') { + date = date + 1; // down + } else if (key === 'down') { + date = date + 7; + } else if (key === 'pageup' || key === 'pagedown') { + var month = ctrl.activeDate.getMonth() + (key === 'pageup' ? - 1 : 1); + ctrl.activeDate.setMonth(month, 1); + date = Math.min(getDaysInMonth(ctrl.activeDate.getFullYear(), ctrl.activeDate.getMonth()), date); + } else if (key === 'home') { + date = 1; + } else if (key === 'end') { + date = getDaysInMonth(ctrl.activeDate.getFullYear(), ctrl.activeDate.getMonth()); + } + ctrl.activeDate.setDate(date); + }; + + ctrl.refreshView(); + } + }; +}]) + +.directive('monthpicker', ['dateFilter', function (dateFilter) { + return { + restrict: 'EA', + replace: true, + templateUrl: 'template/datepicker/month.html', + require: '^datepicker', + link: function(scope, element, attrs, ctrl) { + ctrl.step = { years: 1 }; + ctrl.element = element; + + ctrl._refreshView = function() { + var months = new Array(12), + year = ctrl.activeDate.getFullYear(); + + for ( var i = 0; i < 12; i++ ) { + months[i] = angular.extend(ctrl.createDateObject(new Date(year, i, 1), ctrl.formatMonth), { + uid: scope.uniqueId + '-' + i + }); + } + + scope.title = dateFilter(ctrl.activeDate, ctrl.formatMonthTitle); + scope.rows = ctrl.split(months, 3); + }; + + ctrl.compare = function(date1, date2) { + return new Date( date1.getFullYear(), date1.getMonth() ) - new Date( date2.getFullYear(), date2.getMonth() ); + }; + + ctrl.handleKeyDown = function( key, evt ) { + var date = ctrl.activeDate.getMonth(); + + if (key === 'left') { + date = date - 1; // up + } else if (key === 'up') { + date = date - 3; // down + } else if (key === 'right') { + date = date + 1; // down + } else if (key === 'down') { + date = date + 3; + } else if (key === 'pageup' || key === 'pagedown') { + var year = ctrl.activeDate.getFullYear() + (key === 'pageup' ? - 1 : 1); + ctrl.activeDate.setFullYear(year); + } else if (key === 'home') { + date = 0; + } else if (key === 'end') { + date = 11; + } + ctrl.activeDate.setMonth(date); + }; + + ctrl.refreshView(); + } + }; +}]) + +.directive('yearpicker', ['dateFilter', function (dateFilter) { + return { + restrict: 'EA', + replace: true, + templateUrl: 'template/datepicker/year.html', + require: '^datepicker', + link: function(scope, element, attrs, ctrl) { + var range = ctrl.yearRange; + + ctrl.step = { years: range }; + ctrl.element = element; + + function getStartingYear( year ) { + return parseInt((year - 1) / range, 10) * range + 1; + } + + ctrl._refreshView = function() { + var years = new Array(range); + + for ( var i = 0, start = getStartingYear(ctrl.activeDate.getFullYear()); i < range; i++ ) { + years[i] = angular.extend(ctrl.createDateObject(new Date(start + i, 0, 1), ctrl.formatYear), { + uid: scope.uniqueId + '-' + i + }); + } + + scope.title = [years[0].label, years[range - 1].label].join(' - '); + scope.rows = ctrl.split(years, 5); + }; + + ctrl.compare = function(date1, date2) { + return date1.getFullYear() - date2.getFullYear(); + }; + + ctrl.handleKeyDown = function( key, evt ) { + var date = ctrl.activeDate.getFullYear(); + + if (key === 'left') { + date = date - 1; // up + } else if (key === 'up') { + date = date - 5; // down + } else if (key === 'right') { + date = date + 1; // down + } else if (key === 'down') { + date = date + 5; + } else if (key === 'pageup' || key === 'pagedown') { + date += (key === 'pageup' ? - 1 : 1) * ctrl.step.years; + } else if (key === 'home') { + date = getStartingYear( ctrl.activeDate.getFullYear() ); + } else if (key === 'end') { + date = getStartingYear( ctrl.activeDate.getFullYear() ) + range - 1; + } + ctrl.activeDate.setFullYear(date); + }; + + ctrl.refreshView(); + } + }; +}]) + +.constant('datepickerPopupConfig', { + datepickerPopup: 'yyyy-MM-dd', + currentText: 'Today', + clearText: 'Clear', + closeText: 'Done', + closeOnDateSelection: true, + appendToBody: false, + showButtonBar: true +}) + +.directive('datepickerPopup', ['$compile', '$parse', '$document', '$position', 'dateFilter', 'dateParser', 'datepickerPopupConfig', +function ($compile, $parse, $document, $position, dateFilter, dateParser, datepickerPopupConfig) { + return { + restrict: 'EA', + require: 'ngModel', + scope: { + isOpen: '=?', + currentText: '@', + clearText: '@', + closeText: '@', + dateDisabled: '&' + }, + link: function(scope, element, attrs, ngModel) { + var dateFormat, + closeOnDateSelection = angular.isDefined(attrs.closeOnDateSelection) ? scope.$parent.$eval(attrs.closeOnDateSelection) : datepickerPopupConfig.closeOnDateSelection, + appendToBody = angular.isDefined(attrs.datepickerAppendToBody) ? scope.$parent.$eval(attrs.datepickerAppendToBody) : datepickerPopupConfig.appendToBody; + + scope.showButtonBar = angular.isDefined(attrs.showButtonBar) ? scope.$parent.$eval(attrs.showButtonBar) : datepickerPopupConfig.showButtonBar; + + scope.getText = function( key ) { + return scope[key + 'Text'] || datepickerPopupConfig[key + 'Text']; + }; + + attrs.$observe('datepickerPopup', function(value) { + dateFormat = value || datepickerPopupConfig.datepickerPopup; + ngModel.$render(); + }); + + // popup element used to display calendar + var popupEl = angular.element('
    '); + popupEl.attr({ + 'ng-model': 'date', + 'ng-change': 'dateSelection()' + }); + + function cameltoDash( string ){ + return string.replace(/([A-Z])/g, function($1) { return '-' + $1.toLowerCase(); }); + } + + // datepicker element + var datepickerEl = angular.element(popupEl.children()[0]); + if ( attrs.datepickerOptions ) { + angular.forEach(scope.$parent.$eval(attrs.datepickerOptions), function( value, option ) { + datepickerEl.attr( cameltoDash(option), value ); + }); + } + + angular.forEach(['minDate', 'maxDate'], function( key ) { + if ( attrs[key] ) { + scope.$parent.$watch($parse(attrs[key]), function(value){ + scope[key] = value; + }); + datepickerEl.attr(cameltoDash(key), key); + } + }); + if (attrs.dateDisabled) { + datepickerEl.attr('date-disabled', 'dateDisabled({ date: date, mode: mode })'); + } + + function parseDate(viewValue) { + if (!viewValue) { + ngModel.$setValidity('date', true); + return null; + } else if (angular.isDate(viewValue) && !isNaN(viewValue)) { + ngModel.$setValidity('date', true); + return viewValue; + } else if (angular.isString(viewValue)) { + var date = dateParser.parse(viewValue, dateFormat) || new Date(viewValue); + if (isNaN(date)) { + ngModel.$setValidity('date', false); + return undefined; + } else { + ngModel.$setValidity('date', true); + return date; + } + } else { + ngModel.$setValidity('date', false); + return undefined; + } + } + ngModel.$parsers.unshift(parseDate); + + // Inner change + scope.dateSelection = function(dt) { + if (angular.isDefined(dt)) { + scope.date = dt; + } + ngModel.$setViewValue(scope.date); + ngModel.$render(); + + if ( closeOnDateSelection ) { + scope.isOpen = false; + element[0].focus(); + } + }; + + element.bind('input change keyup', function() { + scope.$apply(function() { + scope.date = ngModel.$modelValue; + }); + }); + + // Outter change + ngModel.$render = function() { + var date = ngModel.$viewValue ? dateFilter(ngModel.$viewValue, dateFormat) : ''; + element.val(date); + scope.date = parseDate( ngModel.$modelValue ); + }; + + var documentClickBind = function(event) { + if (scope.isOpen && event.target !== element[0]) { + scope.$apply(function() { + scope.isOpen = false; + }); + } + }; + + var keydown = function(evt, noApply) { + scope.keydown(evt); + }; + element.bind('keydown', keydown); + + scope.keydown = function(evt) { + if (evt.which === 27) { + evt.preventDefault(); + evt.stopPropagation(); + scope.close(); + } else if (evt.which === 40 && !scope.isOpen) { + scope.isOpen = true; + } + }; + + scope.$watch('isOpen', function(value) { + if (value) { + scope.$broadcast('datepicker.focus'); + scope.position = appendToBody ? $position.offset(element) : $position.position(element); + scope.position.top = scope.position.top + element.prop('offsetHeight'); + + $document.bind('click', documentClickBind); + } else { + $document.unbind('click', documentClickBind); + } + }); + + scope.select = function( date ) { + if (date === 'today') { + var today = new Date(); + if (angular.isDate(ngModel.$modelValue)) { + date = new Date(ngModel.$modelValue); + date.setFullYear(today.getFullYear(), today.getMonth(), today.getDate()); + } else { + date = new Date(today.setHours(0, 0, 0, 0)); + } + } + scope.dateSelection( date ); + }; + + scope.close = function() { + scope.isOpen = false; + element[0].focus(); + }; + + var $popup = $compile(popupEl)(scope); + if ( appendToBody ) { + $document.find('body').append($popup); + } else { + element.after($popup); + } + + scope.$on('$destroy', function() { + $popup.remove(); + element.unbind('keydown', keydown); + $document.unbind('click', documentClickBind); + }); + } + }; +}]) + +.directive('datepickerPopupWrap', function() { + return { + restrict:'EA', + replace: true, + transclude: true, + templateUrl: 'template/datepicker/popup.html', + link:function (scope, element, attrs) { + element.bind('click', function(event) { + event.preventDefault(); + event.stopPropagation(); + }); + } + }; +}); + +angular.module('ui.bootstrap.dropdown', []) + +.constant('dropdownConfig', { + openClass: 'open' +}) + +.service('dropdownService', ['$document', function($document) { + var openScope = null; + + this.open = function( dropdownScope ) { + if ( !openScope ) { + $document.bind('click', closeDropdown); + $document.bind('keydown', escapeKeyBind); + } + + if ( openScope && openScope !== dropdownScope ) { + openScope.isOpen = false; + } + + openScope = dropdownScope; + }; + + this.close = function( dropdownScope ) { + if ( openScope === dropdownScope ) { + openScope = null; + $document.unbind('click', closeDropdown); + $document.unbind('keydown', escapeKeyBind); + } + }; + + var closeDropdown = function( evt ) { + if (evt && evt.isDefaultPrevented()) { + return; + } + + openScope.$apply(function() { + openScope.isOpen = false; + }); + }; + + var escapeKeyBind = function( evt ) { + if ( evt.which === 27 ) { + openScope.focusToggleElement(); + closeDropdown(); + } + }; +}]) + +.controller('DropdownController', ['$scope', '$attrs', '$parse', 'dropdownConfig', 'dropdownService', '$animate', function($scope, $attrs, $parse, dropdownConfig, dropdownService, $animate) { + var self = this, + scope = $scope.$new(), // create a child scope so we are not polluting original one + openClass = dropdownConfig.openClass, + getIsOpen, + setIsOpen = angular.noop, + toggleInvoker = $attrs.onToggle ? $parse($attrs.onToggle) : angular.noop; + + this.init = function( element ) { + self.$element = element; + + if ( $attrs.isOpen ) { + getIsOpen = $parse($attrs.isOpen); + setIsOpen = getIsOpen.assign; + + $scope.$watch(getIsOpen, function(value) { + scope.isOpen = !!value; + }); + } + }; + + this.toggle = function( open ) { + return scope.isOpen = arguments.length ? !!open : !scope.isOpen; + }; + + // Allow other directives to watch status + this.isOpen = function() { + return scope.isOpen; + }; + + scope.focusToggleElement = function() { + if ( self.toggleElement ) { + self.toggleElement[0].focus(); + } + }; + + scope.$watch('isOpen', function( isOpen, wasOpen ) { + $animate[isOpen ? 'addClass' : 'removeClass'](self.$element, openClass); + + if ( isOpen ) { + scope.focusToggleElement(); + dropdownService.open( scope ); + } else { + dropdownService.close( scope ); + } + + setIsOpen($scope, isOpen); + if (angular.isDefined(isOpen) && isOpen !== wasOpen) { + toggleInvoker($scope, { open: !!isOpen }); + } + }); + + $scope.$on('$locationChangeSuccess', function() { + scope.isOpen = false; + }); + + $scope.$on('$destroy', function() { + scope.$destroy(); + }); +}]) + +.directive('dropdown', function() { + return { + restrict: 'CA', + controller: 'DropdownController', + link: function(scope, element, attrs, dropdownCtrl) { + dropdownCtrl.init( element ); + } + }; +}) + +.directive('dropdownToggle', function() { + return { + restrict: 'CA', + require: '?^dropdown', + link: function(scope, element, attrs, dropdownCtrl) { + if ( !dropdownCtrl ) { + return; + } + + dropdownCtrl.toggleElement = element; + + var toggleDropdown = function(event) { + event.preventDefault(); + + if ( !element.hasClass('disabled') && !attrs.disabled ) { + scope.$apply(function() { + dropdownCtrl.toggle(); + }); + } + }; + + element.bind('click', toggleDropdown); + + // WAI-ARIA + element.attr({ 'aria-haspopup': true, 'aria-expanded': false }); + scope.$watch(dropdownCtrl.isOpen, function( isOpen ) { + element.attr('aria-expanded', !!isOpen); + }); + + scope.$on('$destroy', function() { + element.unbind('click', toggleDropdown); + }); + } + }; +}); + +angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition']) + +/** + * A helper, internal data structure that acts as a map but also allows getting / removing + * elements in the LIFO order + */ + .factory('$$stackedMap', function () { + return { + createNew: function () { + var stack = []; + + return { + add: function (key, value) { + stack.push({ + key: key, + value: value + }); + }, + get: function (key) { + for (var i = 0; i < stack.length; i++) { + if (key == stack[i].key) { + return stack[i]; + } + } + }, + keys: function() { + var keys = []; + for (var i = 0; i < stack.length; i++) { + keys.push(stack[i].key); + } + return keys; + }, + top: function () { + return stack[stack.length - 1]; + }, + remove: function (key) { + var idx = -1; + for (var i = 0; i < stack.length; i++) { + if (key == stack[i].key) { + idx = i; + break; + } + } + return stack.splice(idx, 1)[0]; + }, + removeTop: function () { + return stack.splice(stack.length - 1, 1)[0]; + }, + length: function () { + return stack.length; + } + }; + } + }; + }) + +/** + * A helper directive for the $modal service. It creates a backdrop element. + */ + .directive('modalBackdrop', ['$timeout', function ($timeout) { + return { + restrict: 'EA', + replace: true, + templateUrl: 'template/modal/backdrop.html', + link: function (scope) { + + scope.animate = false; + + //trigger CSS transitions + $timeout(function () { + scope.animate = true; + }); + } + }; + }]) + + .directive('modalWindow', ['$modalStack', '$timeout', function ($modalStack, $timeout) { + return { + restrict: 'EA', + scope: { + index: '@', + animate: '=' + }, + replace: true, + transclude: true, + templateUrl: function(tElement, tAttrs) { + return tAttrs.templateUrl || 'template/modal/window.html'; + }, + link: function (scope, element, attrs) { + element.addClass(attrs.windowClass || ''); + scope.size = attrs.size; + + $timeout(function () { + // trigger CSS transitions + scope.animate = true; + // focus a freshly-opened modal + element[0].focus(); + }); + + scope.close = function (evt) { + var modal = $modalStack.getTop(); + if (modal && modal.value.backdrop && modal.value.backdrop != 'static' && (evt.target === evt.currentTarget)) { + evt.preventDefault(); + evt.stopPropagation(); + $modalStack.dismiss(modal.key, 'backdrop click'); + } + }; + } + }; + }]) + + .factory('$modalStack', ['$transition', '$timeout', '$document', '$compile', '$rootScope', '$$stackedMap', + function ($transition, $timeout, $document, $compile, $rootScope, $$stackedMap) { + + var OPENED_MODAL_CLASS = 'modal-open'; + + var backdropDomEl, backdropScope; + var openedWindows = $$stackedMap.createNew(); + var $modalStack = {}; + + function backdropIndex() { + var topBackdropIndex = -1; + var opened = openedWindows.keys(); + for (var i = 0; i < opened.length; i++) { + if (openedWindows.get(opened[i]).value.backdrop) { + topBackdropIndex = i; + } + } + return topBackdropIndex; + } + + $rootScope.$watch(backdropIndex, function(newBackdropIndex){ + if (backdropScope) { + backdropScope.index = newBackdropIndex; + } + }); + + function removeModalWindow(modalInstance) { + + var body = $document.find('body').eq(0); + var modalWindow = openedWindows.get(modalInstance).value; + + //clean up the stack + openedWindows.remove(modalInstance); + + //remove window DOM element + removeAfterAnimate(modalWindow.modalDomEl, modalWindow.modalScope, 300, function() { + modalWindow.modalScope.$destroy(); + body.toggleClass(OPENED_MODAL_CLASS, openedWindows.length() > 0); + checkRemoveBackdrop(); + }); + } + + function checkRemoveBackdrop() { + //remove backdrop if no longer needed + if (backdropDomEl && backdropIndex() == -1) { + var backdropScopeRef = backdropScope; + removeAfterAnimate(backdropDomEl, backdropScope, 150, function () { + backdropScopeRef.$destroy(); + backdropScopeRef = null; + }); + backdropDomEl = undefined; + backdropScope = undefined; + } + } + + function removeAfterAnimate(domEl, scope, emulateTime, done) { + // Closing animation + scope.animate = false; + + var transitionEndEventName = $transition.transitionEndEventName; + if (transitionEndEventName) { + // transition out + var timeout = $timeout(afterAnimating, emulateTime); + + domEl.bind(transitionEndEventName, function () { + $timeout.cancel(timeout); + afterAnimating(); + scope.$apply(); + }); + } else { + // Ensure this call is async + $timeout(afterAnimating, 0); + } + + function afterAnimating() { + if (afterAnimating.done) { + return; + } + afterAnimating.done = true; + + domEl.remove(); + if (done) { + done(); + } + } + } + + $document.bind('keydown', function (evt) { + var modal; + + if (evt.which === 27) { + modal = openedWindows.top(); + if (modal && modal.value.keyboard) { + evt.preventDefault(); + $rootScope.$apply(function () { + $modalStack.dismiss(modal.key, 'escape key press'); + }); + } + } + }); + + $modalStack.open = function (modalInstance, modal) { + + openedWindows.add(modalInstance, { + deferred: modal.deferred, + modalScope: modal.scope, + backdrop: modal.backdrop, + keyboard: modal.keyboard + }); + + var body = $document.find('body').eq(0), + currBackdropIndex = backdropIndex(); + + if (currBackdropIndex >= 0 && !backdropDomEl) { + backdropScope = $rootScope.$new(true); + backdropScope.index = currBackdropIndex; + backdropDomEl = $compile('
    ')(backdropScope); + body.append(backdropDomEl); + } + + var angularDomEl = angular.element('
    '); + angularDomEl.attr({ + 'template-url': modal.windowTemplateUrl, + 'window-class': modal.windowClass, + 'size': modal.size, + 'index': openedWindows.length() - 1, + 'animate': 'animate' + }).html(modal.content); + + var modalDomEl = $compile(angularDomEl)(modal.scope); + openedWindows.top().value.modalDomEl = modalDomEl; + body.append(modalDomEl); + body.addClass(OPENED_MODAL_CLASS); + }; + + $modalStack.close = function (modalInstance, result) { + var modalWindow = openedWindows.get(modalInstance).value; + if (modalWindow) { + modalWindow.deferred.resolve(result); + removeModalWindow(modalInstance); + } + }; + + $modalStack.dismiss = function (modalInstance, reason) { + var modalWindow = openedWindows.get(modalInstance).value; + if (modalWindow) { + modalWindow.deferred.reject(reason); + removeModalWindow(modalInstance); + } + }; + + $modalStack.dismissAll = function (reason) { + var topModal = this.getTop(); + while (topModal) { + this.dismiss(topModal.key, reason); + topModal = this.getTop(); + } + }; + + $modalStack.getTop = function () { + return openedWindows.top(); + }; + + return $modalStack; + }]) + + .provider('$modal', function () { + + var $modalProvider = { + options: { + backdrop: true, //can be also false or 'static' + keyboard: true + }, + $get: ['$injector', '$rootScope', '$q', '$http', '$templateCache', '$controller', '$modalStack', + function ($injector, $rootScope, $q, $http, $templateCache, $controller, $modalStack) { + + var $modal = {}; + + function getTemplatePromise(options) { + return options.template ? $q.when(options.template) : + $http.get(options.templateUrl, {cache: $templateCache}).then(function (result) { + return result.data; + }); + } + + function getResolvePromises(resolves) { + var promisesArr = []; + angular.forEach(resolves, function (value, key) { + if (angular.isFunction(value) || angular.isArray(value)) { + promisesArr.push($q.when($injector.invoke(value))); + } + }); + return promisesArr; + } + + $modal.open = function (modalOptions) { + + var modalResultDeferred = $q.defer(); + var modalOpenedDeferred = $q.defer(); + + //prepare an instance of a modal to be injected into controllers and returned to a caller + var modalInstance = { + result: modalResultDeferred.promise, + opened: modalOpenedDeferred.promise, + close: function (result) { + $modalStack.close(modalInstance, result); + }, + dismiss: function (reason) { + $modalStack.dismiss(modalInstance, reason); + } + }; + + //merge and clean up options + modalOptions = angular.extend({}, $modalProvider.options, modalOptions); + modalOptions.resolve = modalOptions.resolve || {}; + + //verify options + if (!modalOptions.template && !modalOptions.templateUrl) { + throw new Error('One of template or templateUrl options is required.'); + } + + var templateAndResolvePromise = + $q.all([getTemplatePromise(modalOptions)].concat(getResolvePromises(modalOptions.resolve))); + + + templateAndResolvePromise.then(function resolveSuccess(tplAndVars) { + + var modalScope = (modalOptions.scope || $rootScope).$new(); + modalScope.$close = modalInstance.close; + modalScope.$dismiss = modalInstance.dismiss; + + var ctrlInstance, ctrlLocals = {}; + var resolveIter = 1; + + //controllers + if (modalOptions.controller) { + ctrlLocals.$scope = modalScope; + ctrlLocals.$modalInstance = modalInstance; + angular.forEach(modalOptions.resolve, function (value, key) { + ctrlLocals[key] = tplAndVars[resolveIter++]; + }); + + ctrlInstance = $controller(modalOptions.controller, ctrlLocals); + } + + $modalStack.open(modalInstance, { + scope: modalScope, + deferred: modalResultDeferred, + content: tplAndVars[0], + backdrop: modalOptions.backdrop, + keyboard: modalOptions.keyboard, + windowClass: modalOptions.windowClass, + windowTemplateUrl: modalOptions.windowTemplateUrl, + size: modalOptions.size + }); + + }, function resolveError(reason) { + modalResultDeferred.reject(reason); + }); + + templateAndResolvePromise.then(function () { + modalOpenedDeferred.resolve(true); + }, function () { + modalOpenedDeferred.reject(false); + }); + + return modalInstance; + }; + + return $modal; + }] + }; + + return $modalProvider; + }); + +angular.module('ui.bootstrap.pagination', []) + +.controller('PaginationController', ['$scope', '$attrs', '$parse', function ($scope, $attrs, $parse) { + var self = this, + ngModelCtrl = { $setViewValue: angular.noop }, // nullModelCtrl + setNumPages = $attrs.numPages ? $parse($attrs.numPages).assign : angular.noop; + + this.init = function(ngModelCtrl_, config) { + ngModelCtrl = ngModelCtrl_; + this.config = config; + + ngModelCtrl.$render = function() { + self.render(); + }; + + if ($attrs.itemsPerPage) { + $scope.$parent.$watch($parse($attrs.itemsPerPage), function(value) { + self.itemsPerPage = parseInt(value, 10); + $scope.totalPages = self.calculateTotalPages(); + }); + } else { + this.itemsPerPage = config.itemsPerPage; + } + }; + + this.calculateTotalPages = function() { + var totalPages = this.itemsPerPage < 1 ? 1 : Math.ceil($scope.totalItems / this.itemsPerPage); + return Math.max(totalPages || 0, 1); + }; + + this.render = function() { + $scope.page = parseInt(ngModelCtrl.$viewValue, 10) || 1; + }; + + $scope.selectPage = function(page) { + if ( $scope.page !== page && page > 0 && page <= $scope.totalPages) { + ngModelCtrl.$setViewValue(page); + ngModelCtrl.$render(); + } + }; + + $scope.getText = function( key ) { + return $scope[key + 'Text'] || self.config[key + 'Text']; + }; + $scope.noPrevious = function() { + return $scope.page === 1; + }; + $scope.noNext = function() { + return $scope.page === $scope.totalPages; + }; + + $scope.$watch('totalItems', function() { + $scope.totalPages = self.calculateTotalPages(); + }); + + $scope.$watch('totalPages', function(value) { + setNumPages($scope.$parent, value); // Readonly variable + + if ( $scope.page > value ) { + $scope.selectPage(value); + } else { + ngModelCtrl.$render(); + } + }); +}]) + +.constant('paginationConfig', { + itemsPerPage: 10, + boundaryLinks: false, + directionLinks: true, + firstText: 'First', + previousText: 'Previous', + nextText: 'Next', + lastText: 'Last', + rotate: true +}) + +.directive('pagination', ['$parse', 'paginationConfig', function($parse, paginationConfig) { + return { + restrict: 'EA', + scope: { + totalItems: '=', + firstText: '@', + previousText: '@', + nextText: '@', + lastText: '@' + }, + require: ['pagination', '?ngModel'], + controller: 'PaginationController', + templateUrl: 'template/pagination/pagination.html', + replace: true, + link: function(scope, element, attrs, ctrls) { + var paginationCtrl = ctrls[0], ngModelCtrl = ctrls[1]; + + if (!ngModelCtrl) { + return; // do nothing if no ng-model + } + + // Setup configuration parameters + var maxSize = angular.isDefined(attrs.maxSize) ? scope.$parent.$eval(attrs.maxSize) : paginationConfig.maxSize, + rotate = angular.isDefined(attrs.rotate) ? scope.$parent.$eval(attrs.rotate) : paginationConfig.rotate; + scope.boundaryLinks = angular.isDefined(attrs.boundaryLinks) ? scope.$parent.$eval(attrs.boundaryLinks) : paginationConfig.boundaryLinks; + scope.directionLinks = angular.isDefined(attrs.directionLinks) ? scope.$parent.$eval(attrs.directionLinks) : paginationConfig.directionLinks; + + paginationCtrl.init(ngModelCtrl, paginationConfig); + + if (attrs.maxSize) { + scope.$parent.$watch($parse(attrs.maxSize), function(value) { + maxSize = parseInt(value, 10); + paginationCtrl.render(); + }); + } + + // Create page object used in template + function makePage(number, text, isActive) { + return { + number: number, + text: text, + active: isActive + }; + } + + function getPages(currentPage, totalPages) { + var pages = []; + + // Default page limits + var startPage = 1, endPage = totalPages; + var isMaxSized = ( angular.isDefined(maxSize) && maxSize < totalPages ); + + // recompute if maxSize + if ( isMaxSized ) { + if ( rotate ) { + // Current page is displayed in the middle of the visible ones + startPage = Math.max(currentPage - Math.floor(maxSize/2), 1); + endPage = startPage + maxSize - 1; + + // Adjust if limit is exceeded + if (endPage > totalPages) { + endPage = totalPages; + startPage = endPage - maxSize + 1; + } + } else { + // Visible pages are paginated with maxSize + startPage = ((Math.ceil(currentPage / maxSize) - 1) * maxSize) + 1; + + // Adjust last page if limit is exceeded + endPage = Math.min(startPage + maxSize - 1, totalPages); + } + } + + // Add page number links + for (var number = startPage; number <= endPage; number++) { + var page = makePage(number, number, number === currentPage); + pages.push(page); + } + + // Add links to move between page sets + if ( isMaxSized && ! rotate ) { + if ( startPage > 1 ) { + var previousPageSet = makePage(startPage - 1, '...', false); + pages.unshift(previousPageSet); + } + + if ( endPage < totalPages ) { + var nextPageSet = makePage(endPage + 1, '...', false); + pages.push(nextPageSet); + } + } + + return pages; + } + + var originalRender = paginationCtrl.render; + paginationCtrl.render = function() { + originalRender(); + if (scope.page > 0 && scope.page <= scope.totalPages) { + scope.pages = getPages(scope.page, scope.totalPages); + } + }; + } + }; +}]) + +.constant('pagerConfig', { + itemsPerPage: 10, + previousText: '« Previous', + nextText: 'Next »', + align: true +}) + +.directive('pager', ['pagerConfig', function(pagerConfig) { + return { + restrict: 'EA', + scope: { + totalItems: '=', + previousText: '@', + nextText: '@' + }, + require: ['pager', '?ngModel'], + controller: 'PaginationController', + templateUrl: 'template/pagination/pager.html', + replace: true, + link: function(scope, element, attrs, ctrls) { + var paginationCtrl = ctrls[0], ngModelCtrl = ctrls[1]; + + if (!ngModelCtrl) { + return; // do nothing if no ng-model + } + + scope.align = angular.isDefined(attrs.align) ? scope.$parent.$eval(attrs.align) : pagerConfig.align; + paginationCtrl.init(ngModelCtrl, pagerConfig); + } + }; +}]); + +/** + * The following features are still outstanding: animation as a + * function, placement as a function, inside, support for more triggers than + * just mouse enter/leave, html tooltips, and selector delegation. + */ +angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap.bindHtml' ] ) + +/** + * The $tooltip service creates tooltip- and popover-like directives as well as + * houses global options for them. + */ +.provider( '$tooltip', function () { + // The default options tooltip and popover. + var defaultOptions = { + placement: 'top', + animation: true, + popupDelay: 0 + }; + + // Default hide triggers for each show trigger + var triggerMap = { + 'mouseenter': 'mouseleave', + 'click': 'click', + 'focus': 'blur' + }; + + // The options specified to the provider globally. + var globalOptions = {}; + + /** + * `options({})` allows global configuration of all tooltips in the + * application. + * + * var app = angular.module( 'App', ['ui.bootstrap.tooltip'], function( $tooltipProvider ) { + * // place tooltips left instead of top by default + * $tooltipProvider.options( { placement: 'left' } ); + * }); + */ + this.options = function( value ) { + angular.extend( globalOptions, value ); + }; + + /** + * This allows you to extend the set of trigger mappings available. E.g.: + * + * $tooltipProvider.setTriggers( 'openTrigger': 'closeTrigger' ); + */ + this.setTriggers = function setTriggers ( triggers ) { + angular.extend( triggerMap, triggers ); + }; + + /** + * This is a helper function for translating camel-case to snake-case. + */ + function snake_case(name){ + var regexp = /[A-Z]/g; + var separator = '-'; + return name.replace(regexp, function(letter, pos) { + return (pos ? separator : '') + letter.toLowerCase(); + }); + } + + /** + * Returns the actual instance of the $tooltip service. + * TODO support multiple triggers + */ + this.$get = [ '$window', '$compile', '$timeout', '$parse', '$document', '$position', '$interpolate', function ( $window, $compile, $timeout, $parse, $document, $position, $interpolate ) { + return function $tooltip ( type, prefix, defaultTriggerShow ) { + var options = angular.extend( {}, defaultOptions, globalOptions ); + + /** + * Returns an object of show and hide triggers. + * + * If a trigger is supplied, + * it is used to show the tooltip; otherwise, it will use the `trigger` + * option passed to the `$tooltipProvider.options` method; else it will + * default to the trigger supplied to this directive factory. + * + * The hide trigger is based on the show trigger. If the `trigger` option + * was passed to the `$tooltipProvider.options` method, it will use the + * mapped trigger from `triggerMap` or the passed trigger if the map is + * undefined; otherwise, it uses the `triggerMap` value of the show + * trigger; else it will just use the show trigger. + */ + function getTriggers ( trigger ) { + var show = trigger || options.trigger || defaultTriggerShow; + var hide = triggerMap[show] || show; + return { + show: show, + hide: hide + }; + } + + var directiveName = snake_case( type ); + + var startSym = $interpolate.startSymbol(); + var endSym = $interpolate.endSymbol(); + var template = + '
    '+ + '
    '; + + return { + restrict: 'EA', + scope: true, + compile: function (tElem, tAttrs) { + var tooltipLinker = $compile( template ); + + return function link ( scope, element, attrs ) { + var tooltip; + var transitionTimeout; + var popupTimeout; + var appendToBody = angular.isDefined( options.appendToBody ) ? options.appendToBody : false; + var triggers = getTriggers( undefined ); + var hasEnableExp = angular.isDefined(attrs[prefix+'Enable']); + + var positionTooltip = function () { + + var ttPosition = $position.positionElements(element, tooltip, scope.tt_placement, appendToBody); + ttPosition.top += 'px'; + ttPosition.left += 'px'; + + // Now set the calculated positioning. + tooltip.css( ttPosition ); + }; + + // By default, the tooltip is not open. + // TODO add ability to start tooltip opened + scope.tt_isOpen = false; + + function toggleTooltipBind () { + if ( ! scope.tt_isOpen ) { + showTooltipBind(); + } else { + hideTooltipBind(); + } + } + + // Show the tooltip with delay if specified, otherwise show it immediately + function showTooltipBind() { + if(hasEnableExp && !scope.$eval(attrs[prefix+'Enable'])) { + return; + } + if ( scope.tt_popupDelay ) { + // Do nothing if the tooltip was already scheduled to pop-up. + // This happens if show is triggered multiple times before any hide is triggered. + if (!popupTimeout) { + popupTimeout = $timeout( show, scope.tt_popupDelay, false ); + popupTimeout.then(function(reposition){reposition();}); + } + } else { + show()(); + } + } + + function hideTooltipBind () { + scope.$apply(function () { + hide(); + }); + } + + // Show the tooltip popup element. + function show() { + + popupTimeout = null; + + // If there is a pending remove transition, we must cancel it, lest the + // tooltip be mysteriously removed. + if ( transitionTimeout ) { + $timeout.cancel( transitionTimeout ); + transitionTimeout = null; + } + + // Don't show empty tooltips. + if ( ! scope.tt_content ) { + return angular.noop; + } + + createTooltip(); + + // Set the initial positioning. + tooltip.css({ top: 0, left: 0, display: 'block' }); + + // Now we add it to the DOM because need some info about it. But it's not + // visible yet anyway. + if ( appendToBody ) { + $document.find( 'body' ).append( tooltip ); + } else { + element.after( tooltip ); + } + + positionTooltip(); + + // And show the tooltip. + scope.tt_isOpen = true; + scope.$digest(); // digest required as $apply is not called + + // Return positioning function as promise callback for correct + // positioning after draw. + return positionTooltip; + } + + // Hide the tooltip popup element. + function hide() { + // First things first: we don't show it anymore. + scope.tt_isOpen = false; + + //if tooltip is going to be shown after delay, we must cancel this + $timeout.cancel( popupTimeout ); + popupTimeout = null; + + // And now we remove it from the DOM. However, if we have animation, we + // need to wait for it to expire beforehand. + // FIXME: this is a placeholder for a port of the transitions library. + if ( scope.tt_animation ) { + if (!transitionTimeout) { + transitionTimeout = $timeout(removeTooltip, 500); + } + } else { + removeTooltip(); + } + } + + function createTooltip() { + // There can only be one tooltip element per directive shown at once. + if (tooltip) { + removeTooltip(); + } + tooltip = tooltipLinker(scope, function () {}); + + // Get contents rendered into the tooltip + scope.$digest(); + } + + function removeTooltip() { + transitionTimeout = null; + if (tooltip) { + tooltip.remove(); + tooltip = null; + } + } + + /** + * Observe the relevant attributes. + */ + attrs.$observe( type, function ( val ) { + scope.tt_content = val; + + if (!val && scope.tt_isOpen ) { + hide(); + } + }); + + attrs.$observe( prefix+'Title', function ( val ) { + scope.tt_title = val; + }); + + attrs.$observe( prefix+'Placement', function ( val ) { + scope.tt_placement = angular.isDefined( val ) ? val : options.placement; + }); + + attrs.$observe( prefix+'PopupDelay', function ( val ) { + var delay = parseInt( val, 10 ); + scope.tt_popupDelay = ! isNaN(delay) ? delay : options.popupDelay; + }); + + var unregisterTriggers = function () { + element.unbind(triggers.show, showTooltipBind); + element.unbind(triggers.hide, hideTooltipBind); + }; + + attrs.$observe( prefix+'Trigger', function ( val ) { + unregisterTriggers(); + + triggers = getTriggers( val ); + + if ( triggers.show === triggers.hide ) { + element.bind( triggers.show, toggleTooltipBind ); + } else { + element.bind( triggers.show, showTooltipBind ); + element.bind( triggers.hide, hideTooltipBind ); + } + }); + + var animation = scope.$eval(attrs[prefix + 'Animation']); + scope.tt_animation = angular.isDefined(animation) ? !!animation : options.animation; + + attrs.$observe( prefix+'AppendToBody', function ( val ) { + appendToBody = angular.isDefined( val ) ? $parse( val )( scope ) : appendToBody; + }); + + // if a tooltip is attached to we need to remove it on + // location change as its parent scope will probably not be destroyed + // by the change. + if ( appendToBody ) { + scope.$on('$locationChangeSuccess', function closeTooltipOnLocationChangeSuccess () { + if ( scope.tt_isOpen ) { + hide(); + } + }); + } + + // Make sure tooltip is destroyed and removed. + scope.$on('$destroy', function onDestroyTooltip() { + $timeout.cancel( transitionTimeout ); + $timeout.cancel( popupTimeout ); + unregisterTriggers(); + removeTooltip(); + }); + }; + } + }; + }; + }]; +}) + +.directive( 'tooltipPopup', function () { + return { + restrict: 'EA', + replace: true, + scope: { content: '@', placement: '@', animation: '&', isOpen: '&' }, + templateUrl: 'template/tooltip/tooltip-popup.html' + }; +}) + +.directive( 'tooltip', [ '$tooltip', function ( $tooltip ) { + return $tooltip( 'tooltip', 'tooltip', 'mouseenter' ); +}]) + +.directive( 'tooltipHtmlUnsafePopup', function () { + return { + restrict: 'EA', + replace: true, + scope: { content: '@', placement: '@', animation: '&', isOpen: '&' }, + templateUrl: 'template/tooltip/tooltip-html-unsafe-popup.html' + }; +}) + +.directive( 'tooltipHtmlUnsafe', [ '$tooltip', function ( $tooltip ) { + return $tooltip( 'tooltipHtmlUnsafe', 'tooltip', 'mouseenter' ); +}]); + +/** + * The following features are still outstanding: popup delay, animation as a + * function, placement as a function, inside, support for more triggers than + * just mouse enter/leave, html popovers, and selector delegatation. + */ +angular.module( 'ui.bootstrap.popover', [ 'ui.bootstrap.tooltip' ] ) + +.directive( 'popoverPopup', function () { + return { + restrict: 'EA', + replace: true, + scope: { title: '@', content: '@', placement: '@', animation: '&', isOpen: '&' }, + templateUrl: 'template/popover/popover.html' + }; +}) + +.directive( 'popover', [ '$tooltip', function ( $tooltip ) { + return $tooltip( 'popover', 'popover', 'click' ); +}]); + +angular.module('ui.bootstrap.progressbar', []) + +.constant('progressConfig', { + animate: true, + max: 100 +}) + +.controller('ProgressController', ['$scope', '$attrs', 'progressConfig', function($scope, $attrs, progressConfig) { + var self = this, + animate = angular.isDefined($attrs.animate) ? $scope.$parent.$eval($attrs.animate) : progressConfig.animate; + + this.bars = []; + $scope.max = angular.isDefined($attrs.max) ? $scope.$parent.$eval($attrs.max) : progressConfig.max; + + this.addBar = function(bar, element) { + if ( !animate ) { + element.css({'transition': 'none'}); + } + + this.bars.push(bar); + + bar.$watch('value', function( value ) { + bar.percent = +(100 * value / $scope.max).toFixed(2); + }); + + bar.$on('$destroy', function() { + element = null; + self.removeBar(bar); + }); + }; + + this.removeBar = function(bar) { + this.bars.splice(this.bars.indexOf(bar), 1); + }; +}]) + +.directive('progress', function() { + return { + restrict: 'EA', + replace: true, + transclude: true, + controller: 'ProgressController', + require: 'progress', + scope: {}, + templateUrl: 'template/progressbar/progress.html' + }; +}) + +.directive('bar', function() { + return { + restrict: 'EA', + replace: true, + transclude: true, + require: '^progress', + scope: { + value: '=', + type: '@' + }, + templateUrl: 'template/progressbar/bar.html', + link: function(scope, element, attrs, progressCtrl) { + progressCtrl.addBar(scope, element); + } + }; +}) + +.directive('progressbar', function() { + return { + restrict: 'EA', + replace: true, + transclude: true, + controller: 'ProgressController', + scope: { + value: '=', + type: '@' + }, + templateUrl: 'template/progressbar/progressbar.html', + link: function(scope, element, attrs, progressCtrl) { + progressCtrl.addBar(scope, angular.element(element.children()[0])); + } + }; +}); +angular.module('ui.bootstrap.rating', []) + +.constant('ratingConfig', { + max: 5, + stateOn: null, + stateOff: null +}) + +.controller('RatingController', ['$scope', '$attrs', 'ratingConfig', function($scope, $attrs, ratingConfig) { + var ngModelCtrl = { $setViewValue: angular.noop }; + + this.init = function(ngModelCtrl_) { + ngModelCtrl = ngModelCtrl_; + ngModelCtrl.$render = this.render; + + this.stateOn = angular.isDefined($attrs.stateOn) ? $scope.$parent.$eval($attrs.stateOn) : ratingConfig.stateOn; + this.stateOff = angular.isDefined($attrs.stateOff) ? $scope.$parent.$eval($attrs.stateOff) : ratingConfig.stateOff; + + var ratingStates = angular.isDefined($attrs.ratingStates) ? $scope.$parent.$eval($attrs.ratingStates) : + new Array( angular.isDefined($attrs.max) ? $scope.$parent.$eval($attrs.max) : ratingConfig.max ); + $scope.range = this.buildTemplateObjects(ratingStates); + }; + + this.buildTemplateObjects = function(states) { + for (var i = 0, n = states.length; i < n; i++) { + states[i] = angular.extend({ index: i }, { stateOn: this.stateOn, stateOff: this.stateOff }, states[i]); + } + return states; + }; + + $scope.rate = function(value) { + if ( !$scope.readonly && value >= 0 && value <= $scope.range.length ) { + ngModelCtrl.$setViewValue(value); + ngModelCtrl.$render(); + } + }; + + $scope.enter = function(value) { + if ( !$scope.readonly ) { + $scope.value = value; + } + $scope.onHover({value: value}); + }; + + $scope.reset = function() { + $scope.value = ngModelCtrl.$viewValue; + $scope.onLeave(); + }; + + $scope.onKeydown = function(evt) { + if (/(37|38|39|40)/.test(evt.which)) { + evt.preventDefault(); + evt.stopPropagation(); + $scope.rate( $scope.value + (evt.which === 38 || evt.which === 39 ? 1 : -1) ); + } + }; + + this.render = function() { + $scope.value = ngModelCtrl.$viewValue; + }; +}]) + +.directive('rating', function() { + return { + restrict: 'EA', + require: ['rating', 'ngModel'], + scope: { + readonly: '=?', + onHover: '&', + onLeave: '&' + }, + controller: 'RatingController', + templateUrl: 'template/rating/rating.html', + replace: true, + link: function(scope, element, attrs, ctrls) { + var ratingCtrl = ctrls[0], ngModelCtrl = ctrls[1]; + + if ( ngModelCtrl ) { + ratingCtrl.init( ngModelCtrl ); + } + } + }; +}); + +/** + * @ngdoc overview + * @name ui.bootstrap.tabs + * + * @description + * AngularJS version of the tabs directive. + */ + +angular.module('ui.bootstrap.tabs', []) + +.controller('TabsetController', ['$scope', function TabsetCtrl($scope) { + var ctrl = this, + tabs = ctrl.tabs = $scope.tabs = []; + + ctrl.select = function(selectedTab) { + angular.forEach(tabs, function(tab) { + if (tab.active && tab !== selectedTab) { + tab.active = false; + tab.onDeselect(); + } + }); + selectedTab.active = true; + selectedTab.onSelect(); + }; + + ctrl.addTab = function addTab(tab) { + tabs.push(tab); + // we can't run the select function on the first tab + // since that would select it twice + if (tabs.length === 1) { + tab.active = true; + } else if (tab.active) { + ctrl.select(tab); + } + }; + + ctrl.removeTab = function removeTab(tab) { + var index = tabs.indexOf(tab); + //Select a new tab if the tab to be removed is selected + if (tab.active && tabs.length > 1) { + //If this is the last tab, select the previous tab. else, the next tab. + var newActiveIndex = index == tabs.length - 1 ? index - 1 : index + 1; + ctrl.select(tabs[newActiveIndex]); + } + tabs.splice(index, 1); + }; +}]) + +/** + * @ngdoc directive + * @name ui.bootstrap.tabs.directive:tabset + * @restrict EA + * + * @description + * Tabset is the outer container for the tabs directive + * + * @param {boolean=} vertical Whether or not to use vertical styling for the tabs. + * @param {boolean=} justified Whether or not to use justified styling for the tabs. + * + * @example + + + + First Content! + Second Content! + +
    + + First Vertical Content! + Second Vertical Content! + + + First Justified Content! + Second Justified Content! + +
    +
    + */ +.directive('tabset', function() { + return { + restrict: 'EA', + transclude: true, + replace: true, + scope: { + type: '@' + }, + controller: 'TabsetController', + templateUrl: 'template/tabs/tabset.html', + link: function(scope, element, attrs) { + scope.vertical = angular.isDefined(attrs.vertical) ? scope.$parent.$eval(attrs.vertical) : false; + scope.justified = angular.isDefined(attrs.justified) ? scope.$parent.$eval(attrs.justified) : false; + } + }; +}) + +/** + * @ngdoc directive + * @name ui.bootstrap.tabs.directive:tab + * @restrict EA + * + * @param {string=} heading The visible heading, or title, of the tab. Set HTML headings with {@link ui.bootstrap.tabs.directive:tabHeading tabHeading}. + * @param {string=} select An expression to evaluate when the tab is selected. + * @param {boolean=} active A binding, telling whether or not this tab is selected. + * @param {boolean=} disabled A binding, telling whether or not this tab is disabled. + * + * @description + * Creates a tab with a heading and content. Must be placed within a {@link ui.bootstrap.tabs.directive:tabset tabset}. + * + * @example + + +
    + + +
    + + First Tab + + Alert me! + Second Tab, with alert callback and html heading! + + + {{item.content}} + + +
    +
    + + function TabsDemoCtrl($scope) { + $scope.items = [ + { title:"Dynamic Title 1", content:"Dynamic Item 0" }, + { title:"Dynamic Title 2", content:"Dynamic Item 1", disabled: true } + ]; + + $scope.alertMe = function() { + setTimeout(function() { + alert("You've selected the alert tab!"); + }); + }; + }; + +
    + */ + +/** + * @ngdoc directive + * @name ui.bootstrap.tabs.directive:tabHeading + * @restrict EA + * + * @description + * Creates an HTML heading for a {@link ui.bootstrap.tabs.directive:tab tab}. Must be placed as a child of a tab element. + * + * @example + + + + + HTML in my titles?! + And some content, too! + + + Icon heading?!? + That's right. + + + + + */ +.directive('tab', ['$parse', function($parse) { + return { + require: '^tabset', + restrict: 'EA', + replace: true, + templateUrl: 'template/tabs/tab.html', + transclude: true, + scope: { + active: '=?', + heading: '@', + onSelect: '&select', //This callback is called in contentHeadingTransclude + //once it inserts the tab's content into the dom + onDeselect: '&deselect' + }, + controller: function() { + //Empty controller so other directives can require being 'under' a tab + }, + compile: function(elm, attrs, transclude) { + return function postLink(scope, elm, attrs, tabsetCtrl) { + scope.$watch('active', function(active) { + if (active) { + tabsetCtrl.select(scope); + } + }); + + scope.disabled = false; + if ( attrs.disabled ) { + scope.$parent.$watch($parse(attrs.disabled), function(value) { + scope.disabled = !! value; + }); + } + + scope.select = function() { + if ( !scope.disabled ) { + scope.active = true; + } + }; + + tabsetCtrl.addTab(scope); + scope.$on('$destroy', function() { + tabsetCtrl.removeTab(scope); + }); + + //We need to transclude later, once the content container is ready. + //when this link happens, we're inside a tab heading. + scope.$transcludeFn = transclude; + }; + } + }; +}]) + +.directive('tabHeadingTransclude', [function() { + return { + restrict: 'A', + require: '^tab', + link: function(scope, elm, attrs, tabCtrl) { + scope.$watch('headingElement', function updateHeadingElement(heading) { + if (heading) { + elm.html(''); + elm.append(heading); + } + }); + } + }; +}]) + +.directive('tabContentTransclude', function() { + return { + restrict: 'A', + require: '^tabset', + link: function(scope, elm, attrs) { + var tab = scope.$eval(attrs.tabContentTransclude); + + //Now our tab is ready to be transcluded: both the tab heading area + //and the tab content area are loaded. Transclude 'em both. + tab.$transcludeFn(tab.$parent, function(contents) { + angular.forEach(contents, function(node) { + if (isTabHeading(node)) { + //Let tabHeadingTransclude know. + tab.headingElement = node; + } else { + elm.append(node); + } + }); + }); + } + }; + function isTabHeading(node) { + return node.tagName && ( + node.hasAttribute('tab-heading') || + node.hasAttribute('data-tab-heading') || + node.tagName.toLowerCase() === 'tab-heading' || + node.tagName.toLowerCase() === 'data-tab-heading' + ); + } +}) + +; + +angular.module('ui.bootstrap.timepicker', []) + +.constant('timepickerConfig', { + hourStep: 1, + minuteStep: 1, + showMeridian: true, + meridians: null, + readonlyInput: false, + mousewheel: true +}) + +.controller('TimepickerController', ['$scope', '$attrs', '$parse', '$log', '$locale', 'timepickerConfig', function($scope, $attrs, $parse, $log, $locale, timepickerConfig) { + var selected = new Date(), + ngModelCtrl = { $setViewValue: angular.noop }, // nullModelCtrl + meridians = angular.isDefined($attrs.meridians) ? $scope.$parent.$eval($attrs.meridians) : timepickerConfig.meridians || $locale.DATETIME_FORMATS.AMPMS; + + this.init = function( ngModelCtrl_, inputs ) { + ngModelCtrl = ngModelCtrl_; + ngModelCtrl.$render = this.render; + + var hoursInputEl = inputs.eq(0), + minutesInputEl = inputs.eq(1); + + var mousewheel = angular.isDefined($attrs.mousewheel) ? $scope.$parent.$eval($attrs.mousewheel) : timepickerConfig.mousewheel; + if ( mousewheel ) { + this.setupMousewheelEvents( hoursInputEl, minutesInputEl ); + } + + $scope.readonlyInput = angular.isDefined($attrs.readonlyInput) ? $scope.$parent.$eval($attrs.readonlyInput) : timepickerConfig.readonlyInput; + this.setupInputEvents( hoursInputEl, minutesInputEl ); + }; + + var hourStep = timepickerConfig.hourStep; + if ($attrs.hourStep) { + $scope.$parent.$watch($parse($attrs.hourStep), function(value) { + hourStep = parseInt(value, 10); + }); + } + + var minuteStep = timepickerConfig.minuteStep; + if ($attrs.minuteStep) { + $scope.$parent.$watch($parse($attrs.minuteStep), function(value) { + minuteStep = parseInt(value, 10); + }); + } + + // 12H / 24H mode + $scope.showMeridian = timepickerConfig.showMeridian; + if ($attrs.showMeridian) { + $scope.$parent.$watch($parse($attrs.showMeridian), function(value) { + $scope.showMeridian = !!value; + + if ( ngModelCtrl.$error.time ) { + // Evaluate from template + var hours = getHoursFromTemplate(), minutes = getMinutesFromTemplate(); + if (angular.isDefined( hours ) && angular.isDefined( minutes )) { + selected.setHours( hours ); + refresh(); + } + } else { + updateTemplate(); + } + }); + } + + // Get $scope.hours in 24H mode if valid + function getHoursFromTemplate ( ) { + var hours = parseInt( $scope.hours, 10 ); + var valid = ( $scope.showMeridian ) ? (hours > 0 && hours < 13) : (hours >= 0 && hours < 24); + if ( !valid ) { + return undefined; + } + + if ( $scope.showMeridian ) { + if ( hours === 12 ) { + hours = 0; + } + if ( $scope.meridian === meridians[1] ) { + hours = hours + 12; + } + } + return hours; + } + + function getMinutesFromTemplate() { + var minutes = parseInt($scope.minutes, 10); + return ( minutes >= 0 && minutes < 60 ) ? minutes : undefined; + } + + function pad( value ) { + return ( angular.isDefined(value) && value.toString().length < 2 ) ? '0' + value : value; + } + + // Respond on mousewheel spin + this.setupMousewheelEvents = function( hoursInputEl, minutesInputEl ) { + var isScrollingUp = function(e) { + if (e.originalEvent) { + e = e.originalEvent; + } + //pick correct delta variable depending on event + var delta = (e.wheelDelta) ? e.wheelDelta : -e.deltaY; + return (e.detail || delta > 0); + }; + + hoursInputEl.bind('mousewheel wheel', function(e) { + $scope.$apply( (isScrollingUp(e)) ? $scope.incrementHours() : $scope.decrementHours() ); + e.preventDefault(); + }); + + minutesInputEl.bind('mousewheel wheel', function(e) { + $scope.$apply( (isScrollingUp(e)) ? $scope.incrementMinutes() : $scope.decrementMinutes() ); + e.preventDefault(); + }); + + }; + + this.setupInputEvents = function( hoursInputEl, minutesInputEl ) { + if ( $scope.readonlyInput ) { + $scope.updateHours = angular.noop; + $scope.updateMinutes = angular.noop; + return; + } + + var invalidate = function(invalidHours, invalidMinutes) { + ngModelCtrl.$setViewValue( null ); + ngModelCtrl.$setValidity('time', false); + if (angular.isDefined(invalidHours)) { + $scope.invalidHours = invalidHours; + } + if (angular.isDefined(invalidMinutes)) { + $scope.invalidMinutes = invalidMinutes; + } + }; + + $scope.updateHours = function() { + var hours = getHoursFromTemplate(); + + if ( angular.isDefined(hours) ) { + selected.setHours( hours ); + refresh( 'h' ); + } else { + invalidate(true); + } + }; + + hoursInputEl.bind('blur', function(e) { + if ( !$scope.invalidHours && $scope.hours < 10) { + $scope.$apply( function() { + $scope.hours = pad( $scope.hours ); + }); + } + }); + + $scope.updateMinutes = function() { + var minutes = getMinutesFromTemplate(); + + if ( angular.isDefined(minutes) ) { + selected.setMinutes( minutes ); + refresh( 'm' ); + } else { + invalidate(undefined, true); + } + }; + + minutesInputEl.bind('blur', function(e) { + if ( !$scope.invalidMinutes && $scope.minutes < 10 ) { + $scope.$apply( function() { + $scope.minutes = pad( $scope.minutes ); + }); + } + }); + + }; + + this.render = function() { + var date = ngModelCtrl.$modelValue ? new Date( ngModelCtrl.$modelValue ) : null; + + if ( isNaN(date) ) { + ngModelCtrl.$setValidity('time', false); + $log.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.'); + } else { + if ( date ) { + selected = date; + } + makeValid(); + updateTemplate(); + } + }; + + // Call internally when we know that model is valid. + function refresh( keyboardChange ) { + makeValid(); + ngModelCtrl.$setViewValue( new Date(selected) ); + updateTemplate( keyboardChange ); + } + + function makeValid() { + ngModelCtrl.$setValidity('time', true); + $scope.invalidHours = false; + $scope.invalidMinutes = false; + } + + function updateTemplate( keyboardChange ) { + var hours = selected.getHours(), minutes = selected.getMinutes(); + + if ( $scope.showMeridian ) { + hours = ( hours === 0 || hours === 12 ) ? 12 : hours % 12; // Convert 24 to 12 hour system + } + + $scope.hours = keyboardChange === 'h' ? hours : pad(hours); + $scope.minutes = keyboardChange === 'm' ? minutes : pad(minutes); + $scope.meridian = selected.getHours() < 12 ? meridians[0] : meridians[1]; + } + + function addMinutes( minutes ) { + var dt = new Date( selected.getTime() + minutes * 60000 ); + selected.setHours( dt.getHours(), dt.getMinutes() ); + refresh(); + } + + $scope.incrementHours = function() { + addMinutes( hourStep * 60 ); + }; + $scope.decrementHours = function() { + addMinutes( - hourStep * 60 ); + }; + $scope.incrementMinutes = function() { + addMinutes( minuteStep ); + }; + $scope.decrementMinutes = function() { + addMinutes( - minuteStep ); + }; + $scope.toggleMeridian = function() { + addMinutes( 12 * 60 * (( selected.getHours() < 12 ) ? 1 : -1) ); + }; +}]) + +.directive('timepicker', function () { + return { + restrict: 'EA', + require: ['timepicker', '?^ngModel'], + controller:'TimepickerController', + replace: true, + scope: {}, + templateUrl: 'template/timepicker/timepicker.html', + link: function(scope, element, attrs, ctrls) { + var timepickerCtrl = ctrls[0], ngModelCtrl = ctrls[1]; + + if ( ngModelCtrl ) { + timepickerCtrl.init( ngModelCtrl, element.find('input') ); + } + } + }; +}); + +angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap.bindHtml']) + +/** + * A helper service that can parse typeahead's syntax (string provided by users) + * Extracted to a separate service for ease of unit testing + */ + .factory('typeaheadParser', ['$parse', function ($parse) { + + // 00000111000000000000022200000000000000003333333333333330000000000044000 + var TYPEAHEAD_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+(.*)$/; + + return { + parse:function (input) { + + var match = input.match(TYPEAHEAD_REGEXP); + if (!match) { + throw new Error( + 'Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_"' + + ' but got "' + input + '".'); + } + + return { + itemName:match[3], + source:$parse(match[4]), + viewMapper:$parse(match[2] || match[1]), + modelMapper:$parse(match[1]) + }; + } + }; +}]) + + .directive('typeahead', ['$compile', '$parse', '$q', '$timeout', '$document', '$position', 'typeaheadParser', + function ($compile, $parse, $q, $timeout, $document, $position, typeaheadParser) { + + var HOT_KEYS = [9, 13, 27, 38, 40]; + + return { + require:'ngModel', + link:function (originalScope, element, attrs, modelCtrl) { + + //SUPPORTED ATTRIBUTES (OPTIONS) + + //minimal no of characters that needs to be entered before typeahead kicks-in + var minSearch = originalScope.$eval(attrs.typeaheadMinLength) || 1; + + //minimal wait time after last character typed before typehead kicks-in + var waitTime = originalScope.$eval(attrs.typeaheadWaitMs) || 0; + + //should it restrict model values to the ones selected from the popup only? + var isEditable = originalScope.$eval(attrs.typeaheadEditable) !== false; + + //binding to a variable that indicates if matches are being retrieved asynchronously + var isLoadingSetter = $parse(attrs.typeaheadLoading).assign || angular.noop; + + //a callback executed when a match is selected + var onSelectCallback = $parse(attrs.typeaheadOnSelect); + + var inputFormatter = attrs.typeaheadInputFormatter ? $parse(attrs.typeaheadInputFormatter) : undefined; + + var appendToBody = attrs.typeaheadAppendToBody ? originalScope.$eval(attrs.typeaheadAppendToBody) : false; + + //INTERNAL VARIABLES + + //model setter executed upon match selection + var $setModelValue = $parse(attrs.ngModel).assign; + + //expressions used by typeahead + var parserResult = typeaheadParser.parse(attrs.typeahead); + + var hasFocus; + + //create a child scope for the typeahead directive so we are not polluting original scope + //with typeahead-specific data (matches, query etc.) + var scope = originalScope.$new(); + originalScope.$on('$destroy', function(){ + scope.$destroy(); + }); + + // WAI-ARIA + var popupId = 'typeahead-' + scope.$id + '-' + Math.floor(Math.random() * 10000); + element.attr({ + 'aria-autocomplete': 'list', + 'aria-expanded': false, + 'aria-owns': popupId + }); + + //pop-up element used to display matches + var popUpEl = angular.element('
    '); + popUpEl.attr({ + id: popupId, + matches: 'matches', + active: 'activeIdx', + select: 'select(activeIdx)', + query: 'query', + position: 'position' + }); + //custom item template + if (angular.isDefined(attrs.typeaheadTemplateUrl)) { + popUpEl.attr('template-url', attrs.typeaheadTemplateUrl); + } + + var resetMatches = function() { + scope.matches = []; + scope.activeIdx = -1; + element.attr('aria-expanded', false); + }; + + var getMatchId = function(index) { + return popupId + '-option-' + index; + }; + + // Indicate that the specified match is the active (pre-selected) item in the list owned by this typeahead. + // This attribute is added or removed automatically when the `activeIdx` changes. + scope.$watch('activeIdx', function(index) { + if (index < 0) { + element.removeAttr('aria-activedescendant'); + } else { + element.attr('aria-activedescendant', getMatchId(index)); + } + }); + + var getMatchesAsync = function(inputValue) { + + var locals = {$viewValue: inputValue}; + isLoadingSetter(originalScope, true); + $q.when(parserResult.source(originalScope, locals)).then(function(matches) { + + //it might happen that several async queries were in progress if a user were typing fast + //but we are interested only in responses that correspond to the current view value + var onCurrentRequest = (inputValue === modelCtrl.$viewValue); + if (onCurrentRequest && hasFocus) { + if (matches.length > 0) { + + scope.activeIdx = 0; + scope.matches.length = 0; + + //transform labels + for(var i=0; i= minSearch) { + if (waitTime > 0) { + if (timeoutPromise) { + $timeout.cancel(timeoutPromise);//cancel previous timeout + } + timeoutPromise = $timeout(function () { + getMatchesAsync(inputValue); + }, waitTime); + } else { + getMatchesAsync(inputValue); + } + } else { + isLoadingSetter(originalScope, false); + resetMatches(); + } + + if (isEditable) { + return inputValue; + } else { + if (!inputValue) { + // Reset in case user had typed something previously. + modelCtrl.$setValidity('editable', true); + return inputValue; + } else { + modelCtrl.$setValidity('editable', false); + return undefined; + } + } + }); + + modelCtrl.$formatters.push(function (modelValue) { + + var candidateViewValue, emptyViewValue; + var locals = {}; + + if (inputFormatter) { + + locals['$model'] = modelValue; + return inputFormatter(originalScope, locals); + + } else { + + //it might happen that we don't have enough info to properly render input value + //we need to check for this situation and simply return model value if we can't apply custom formatting + locals[parserResult.itemName] = modelValue; + candidateViewValue = parserResult.viewMapper(originalScope, locals); + locals[parserResult.itemName] = undefined; + emptyViewValue = parserResult.viewMapper(originalScope, locals); + + return candidateViewValue!== emptyViewValue ? candidateViewValue : modelValue; + } + }); + + scope.select = function (activeIdx) { + //called from within the $digest() cycle + var locals = {}; + var model, item; + + locals[parserResult.itemName] = item = scope.matches[activeIdx].model; + model = parserResult.modelMapper(originalScope, locals); + $setModelValue(originalScope, model); + modelCtrl.$setValidity('editable', true); + + onSelectCallback(originalScope, { + $item: item, + $model: model, + $label: parserResult.viewMapper(originalScope, locals) + }); + + resetMatches(); + + //return focus to the input element if a match was selected via a mouse click event + // use timeout to avoid $rootScope:inprog error + $timeout(function() { element[0].focus(); }, 0, false); + }; + + //bind keyboard events: arrows up(38) / down(40), enter(13) and tab(9), esc(27) + element.bind('keydown', function (evt) { + + //typeahead is open and an "interesting" key was pressed + if (scope.matches.length === 0 || HOT_KEYS.indexOf(evt.which) === -1) { + return; + } + + evt.preventDefault(); + + if (evt.which === 40) { + scope.activeIdx = (scope.activeIdx + 1) % scope.matches.length; + scope.$digest(); + + } else if (evt.which === 38) { + scope.activeIdx = (scope.activeIdx ? scope.activeIdx : scope.matches.length) - 1; + scope.$digest(); + + } else if (evt.which === 13 || evt.which === 9) { + scope.$apply(function () { + scope.select(scope.activeIdx); + }); + + } else if (evt.which === 27) { + evt.stopPropagation(); + + resetMatches(); + scope.$digest(); + } + }); + + element.bind('blur', function (evt) { + hasFocus = false; + }); + + // Keep reference to click handler to unbind it. + var dismissClickHandler = function (evt) { + if (element[0] !== evt.target) { + resetMatches(); + scope.$digest(); + } + }; + + $document.bind('click', dismissClickHandler); + + originalScope.$on('$destroy', function(){ + $document.unbind('click', dismissClickHandler); + }); + + var $popup = $compile(popUpEl)(scope); + if ( appendToBody ) { + $document.find('body').append($popup); + } else { + element.after($popup); + } + } + }; + +}]) + + .directive('typeaheadPopup', function () { + return { + restrict:'EA', + scope:{ + matches:'=', + query:'=', + active:'=', + position:'=', + select:'&' + }, + replace:true, + templateUrl:'template/typeahead/typeahead-popup.html', + link:function (scope, element, attrs) { + + scope.templateUrl = attrs.templateUrl; + + scope.isOpen = function () { + return scope.matches.length > 0; + }; + + scope.isActive = function (matchIdx) { + return scope.active == matchIdx; + }; + + scope.selectActive = function (matchIdx) { + scope.active = matchIdx; + }; + + scope.selectMatch = function (activeIdx) { + scope.select({activeIdx:activeIdx}); + }; + } + }; + }) + + .directive('typeaheadMatch', ['$http', '$templateCache', '$compile', '$parse', function ($http, $templateCache, $compile, $parse) { + return { + restrict:'EA', + scope:{ + index:'=', + match:'=', + query:'=' + }, + link:function (scope, element, attrs) { + var tplUrl = $parse(attrs.templateUrl)(scope.$parent) || 'template/typeahead/typeahead-match.html'; + $http.get(tplUrl, {cache: $templateCache}).success(function(tplContent){ + element.replaceWith($compile(tplContent.trim())(scope)); + }); + } + }; + }]) + + .filter('typeaheadHighlight', function() { + + function escapeRegexp(queryToEscape) { + return queryToEscape.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1'); + } + + return function(matchItem, query) { + return query ? ('' + matchItem).replace(new RegExp(escapeRegexp(query), 'gi'), '$&') : matchItem; + }; + }); + +angular.module("template/accordion/accordion-group.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/accordion/accordion-group.html", + "
    \n" + + "
    \n" + + "

    \n" + + " {{heading}}\n" + + "

    \n" + + "
    \n" + + "
    \n" + + "
    \n" + + "
    \n" + + "
    "); +}]); + +angular.module("template/accordion/accordion.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/accordion/accordion.html", + "
    "); +}]); + +angular.module("template/alert/alert.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/alert/alert.html", + "
    \n" + + " \n" + + "
    \n" + + "
    \n" + + ""); +}]); + +angular.module("template/carousel/carousel.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/carousel/carousel.html", + "
    \n" + + "
      1\">\n" + + "
    1. \n" + + "
    \n" + + "
    \n" + + " 1\">\n" + + " 1\">\n" + + "
    \n" + + ""); +}]); + +angular.module("template/carousel/slide.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/carousel/slide.html", + "
    \n" + + ""); +}]); + +angular.module("template/datepicker/datepicker.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/datepicker/datepicker.html", + "
    \n" + + " \n" + + " \n" + + " \n" + + "
    "); +}]); + +angular.module("template/datepicker/day.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/datepicker/day.html", + "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
    {{label.abbr}}
    {{ weekNumbers[$index] }}\n" + + " \n" + + "
    \n" + + ""); +}]); + +angular.module("template/datepicker/month.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/datepicker/month.html", + "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
    \n" + + " \n" + + "
    \n" + + ""); +}]); + +angular.module("template/datepicker/popup.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/datepicker/popup.html", + "
      \n" + + "
    • \n" + + "
    • \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
    • \n" + + "
    \n" + + ""); +}]); + +angular.module("template/datepicker/year.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/datepicker/year.html", + "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
    \n" + + " \n" + + "
    \n" + + ""); +}]); + +angular.module("template/modal/backdrop.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/modal/backdrop.html", + "
    \n" + + ""); +}]); + +angular.module("template/modal/window.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/modal/window.html", + "
    \n" + + "
    \n" + + "
    "); +}]); + +angular.module("template/pagination/pager.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/pagination/pager.html", + ""); +}]); + +angular.module("template/pagination/pagination.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/pagination/pagination.html", + ""); +}]); + +angular.module("template/tooltip/tooltip-html-unsafe-popup.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/tooltip/tooltip-html-unsafe-popup.html", + "
    \n" + + "
    \n" + + "
    \n" + + "
    \n" + + ""); +}]); + +angular.module("template/tooltip/tooltip-popup.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/tooltip/tooltip-popup.html", + "
    \n" + + "
    \n" + + "
    \n" + + "
    \n" + + ""); +}]); + +angular.module("template/popover/popover.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/popover/popover.html", + "
    \n" + + "
    \n" + + "\n" + + "
    \n" + + "

    \n" + + "
    \n" + + "
    \n" + + "
    \n" + + ""); +}]); + +angular.module("template/progressbar/bar.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/progressbar/bar.html", + "
    "); +}]); + +angular.module("template/progressbar/progress.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/progressbar/progress.html", + "
    "); +}]); + +angular.module("template/progressbar/progressbar.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/progressbar/progressbar.html", + "
    \n" + + "
    \n" + + "
    "); +}]); + +angular.module("template/rating/rating.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/rating/rating.html", + "\n" + + " \n" + + " ({{ $index < value ? '*' : ' ' }})\n" + + " \n" + + ""); +}]); + +angular.module("template/tabs/tab.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/tabs/tab.html", + "
  • \n" + + " {{heading}}\n" + + "
  • \n" + + ""); +}]); + +angular.module("template/tabs/tabset-titles.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/tabs/tabset-titles.html", + "
      \n" + + "
    \n" + + ""); +}]); + +angular.module("template/tabs/tabset.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/tabs/tabset.html", + "\n" + + "
    \n" + + "
      \n" + + "
      \n" + + "
      \n" + + "
      \n" + + "
      \n" + + "
      \n" + + ""); +}]); + +angular.module("template/timepicker/timepicker.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/timepicker/timepicker.html", + "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
       
      \n" + + " \n" + + " :\n" + + " \n" + + "
       
      \n" + + ""); +}]); + +angular.module("template/typeahead/typeahead-match.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/typeahead/typeahead-match.html", + ""); +}]); + +angular.module("template/typeahead/typeahead-popup.html", []).run(["$templateCache", function($templateCache) { + $templateCache.put("template/typeahead/typeahead-popup.html", + "
        \n" + + "
      • \n" + + "
        \n" + + "
      • \n" + + "
      "); +}]); diff --git a/app/assets/javascripts/angular/app.js b/app/assets/javascripts/angular/app.js index 8e5efe9..a4e0f5c 100644 --- a/app/assets/javascripts/angular/app.js +++ b/app/assets/javascripts/angular/app.js @@ -4,3 +4,10 @@ angular 'ui.select2', 'ui.bootstrap' ]); + +angular + .module('hackDukeMentorApp', [ + 'ngResource', + 'ui.select2', + 'ui.bootstrap' + ]); diff --git a/app/assets/javascripts/angular/application-files.js b/app/assets/javascripts/angular/application-files.js index b424e93..ff552ad 100644 --- a/app/assets/javascripts/angular/application-files.js +++ b/app/assets/javascripts/angular/application-files.js @@ -5,5 +5,8 @@ //= require ./select2 //= require ./angular-ui-select/select2 //= require ./app -//= require ./teamApplyCtrl //= require ./formService +//= require ./mentorFormService +//= require ./teamApplyCtrl +//= require ./mentorApplyCtrl + diff --git a/app/assets/javascripts/angular/formService.js b/app/assets/javascripts/angular/formService.js index 691df18..1c3091d 100644 --- a/app/assets/javascripts/angular/formService.js +++ b/app/assets/javascripts/angular/formService.js @@ -8,25 +8,26 @@ * Service in the applyHackdukeApp. */ angular.module('hackDukeApp') - .service('formService', function formService($resource) { - this.saveData = function(data) { - var request; - return request = $.ajax({ - url: 'https://script.google.com/macros/s/AKfycbzv8wqHChb6PluQWH8Yh3tJBllZHLorLoc3I4d13YSBGUwDhJ4/exec', - type: 'post', - data: data - }); - }; + .service('formService', ['$resource', + function formService($resource) { + this.saveData = function(data) { + var request; + return request = $.ajax({ + url: 'https://script.google.com/macros/s/AKfycbzv8wqHChb6PluQWH8Yh3tJBllZHLorLoc3I4d13YSBGUwDhJ4/exec', + type: 'post', + data: data + }); + }; - var formsResource = $resource('https://script.google.com/macros/s/AKfycbzv3xZ1czD1VW3cYALGOPOyDIGQFP8Jvs2nYnWDOeDIVvEtk8w/exec'); + var formsResource = $resource('https://script.google.com/macros/s/AKfycbzv3xZ1czD1VW3cYALGOPOyDIGQFP8Jvs2nYnWDOeDIVvEtk8w/exec'); - this.saveParticipantData = function(data) { - var request; - return request = $.ajax({ - url: 'https://script.google.com/macros/s/AKfycbzv3xZ1czD1VW3cYALGOPOyDIGQFP8Jvs2nYnWDOeDIVvEtk8w/exec', - type: 'post', - data: data - }); - }; - return this; - }); + this.saveParticipantData = function(data) { + var request; + return request = $.ajax({ + url: 'https://script.google.com/macros/s/AKfycbzv3xZ1czD1VW3cYALGOPOyDIGQFP8Jvs2nYnWDOeDIVvEtk8w/exec', + type: 'post', + data: data + }); + }; + return this; + }]); diff --git a/app/assets/javascripts/angular/mentorApplyCtrl.js b/app/assets/javascripts/angular/mentorApplyCtrl.js new file mode 100644 index 0000000..67708fa --- /dev/null +++ b/app/assets/javascripts/angular/mentorApplyCtrl.js @@ -0,0 +1,129 @@ +'use strict'; + +/** + * @ngdoc function + * @name applyHackdukeApp.controller:MainCtrl + * @description + * # MainCtrl + * Controller of the applyHackdukeApp + */ +angular.module('hackDukeMentorApp') + .controller('mentorApplyCtrl', ['$scope', '$location', '$modal', '$anchorScroll', 'formService', + function ($scope, $location, $modal, $anchorScroll, formService) { + $scope.tracks = [ + 'Education', + 'Energy', + 'Inequality', + 'Health' + ]; + $scope.showError = false; + $scope.signup = {}; + $scope.signup.classification = 'Participant'; + $scope.applyFormObject = {}; + $scope.applyForm = {}; + + $scope.goToTop = function() { + $location.hash('top'); + $anchorScroll(); + }; + + $scope.noCheckedBox = function() { + return !$scope.tracks.some(function(track) { + return $scope.applyForm[track]; + }); + } + + + $scope.revertError = function() { + $scope.showError = false; + }; + + $scope.submitMentor = function() { + console.log($scope.applyForm); + } + + $scope.submit = function() { + if ($scope.applyFormObject.hackDukeMentorForm.$invalid) { + $scope.showError = true; + $scope.goToTop(); + } else { + $scope.trackAnswers = {}; + $scope.tracks.forEach(function(track) { + if ($scope.applyForm[track] == true) { + $scope.trackAnswers[track] = 'Yes'; + } else { + $scope.trackAnswers[track] = 'No'; + } + }); + var help = 'No'; + if ($scope.applyForm.help == true) { + help = 'Yes' + } + $scope.data = { + Name: $scope.applyForm.name, + Email: $scope.applyForm.email, + Company: $scope.applyForm.company, + Health: $scope.trackAnswers.Health, + 'Energy & Environment' : $scope.trackAnswers.Energy, + Inequality : $scope.trackAnswers.Inequality, + Education : $scope.trackAnswers.Education, + 'Shirt Size': $scope.applyForm.tshirt, + Phone : $scope.applyForm.phone, + 'Help Novices?' : help, + 'Tech Focus' : $scope.applyForm.techfocus + }; + + var callerScope = $scope; + + + $modal.open({ + template: '

      {{modalInfo.info}}

      ', + size: 'lg', + controller: ['$scope', '$modalInstance', function($scope, $modalInstance) { + $scope.modalInfo = {}; + $scope.modalInfo.info = 'Saving your information'; + var modalscope = $scope; + $.when(formService.saveData(callerScope.data)).then(function() { + modalscope.modalInfo.info = 'Success!'; + $('#savingOrganizer').click(); + setTimeout(function() { + $modalInstance.close(); + }, 100); + callerScope.tracks.forEach(function(track) { + callerScope.applyForm[track] = false; + }); + callerScope.showError = false; + callerScope.applyForm.name = ''; + callerScope.applyForm.email= ''; + callerScope.applyForm.company = ''; + callerScope.applyForm.phone = ''; + callerScope.applyForm.tshirt = ''; + callerScope.applyForm.help = false; + callerScope.applyForm.techfocus = ''; + callerScope.data = {}; + }, function() { + modalscope.modalInfo.info = 'Unfortunately there has been an error :('; + $('#savingOrganizer').click(); + callerScope.tracks.forEach(function(track) { + callerScope.applyForm[track] = false; + }); + + callerScope.applyForm.name = ''; + callerScope.applyForm.email= ''; + callerScope.applyForm.company = ''; + callerScope.applyForm.phone = ''; + callerScope.applyForm.tshirt = ''; + callerScope.applyForm.help = false; + callerScope.applyForm.techfocus = ''; + callerScope.data = {}; + callerScope.showError = false; + setTimeout(function() { + $modalInstance.close(); + }, 100); + }); + }] + }); + } + + }; + }]); diff --git a/app/assets/javascripts/angular/mentorFormService.js b/app/assets/javascripts/angular/mentorFormService.js new file mode 100644 index 0000000..a3dd8c2 --- /dev/null +++ b/app/assets/javascripts/angular/mentorFormService.js @@ -0,0 +1,22 @@ +'use strict'; + +/** + * @ngdoc service + * @name applyHackdukeApp.formService + * @description + * # formService + * Service in the applyHackdukeApp. + */ +angular.module('hackDukeMentorApp') + .service('formService', ['$resource', + function formService($resource) { + this.saveData = function(data) { + var request; + return request = $.ajax({ + url: 'https://script.google.com/macros/s/AKfycbybhPs_sdiEvJBCJ5eLDMFbMLSSaoD0mhKK5X1cB7CpRED2GrM/exec', + type: 'post', + data: data + }); + }; + return this; + }]); diff --git a/app/assets/javascripts/angular/teamApplyCtrl.js b/app/assets/javascripts/angular/teamApplyCtrl.js index af5142d..ceab9b8 100644 --- a/app/assets/javascripts/angular/teamApplyCtrl.js +++ b/app/assets/javascripts/angular/teamApplyCtrl.js @@ -8,7 +8,8 @@ * Controller of the applyHackdukeApp */ angular.module('hackDukeApp') - .controller('teamApplyCtrl', function ($scope, $location, $anchorScroll, $modal, formService) { + .controller('teamApplyCtrl', ['$scope', '$location', '$modal', '$anchorScroll', 'formService', + function ($scope, $location, $modal, $anchorScroll, formService) { $scope.applyForm = { }; $scope.participateForm = {}; @@ -41,26 +42,40 @@ angular.module('hackDukeApp') $scope.showError = true; $scope.goToTop(); } else { - var modalInstance = createModal(); - var data = { + // var modalInstance = createModal(); + $scope.participantData = { Name: $scope.participateForm.name, Email: $scope.participateForm.email }; - $.when(formService.saveParticipantData(data)).then(function() { - modalInstance.dismiss(); - $scope.participateForm.name = ''; - $scope.participateForm.email = ''; + var callerScope = $scope; + + $modal.open({ + template: '

      {{modalInfo.info}}

      ', + size: 'lg', + controller: ['$scope', '$modalInstance', function($scope, $modalInstance) { + $scope.modalInfo = {}; + $scope.modalInfo.info = 'Saving your information'; + var modalscope = $scope; + $.when(formService.saveParticipantData(callerScope.participantData)).then(function() { + modalscope.modalInfo.info = 'Success!'; + $('#savingParticipant').click(); + setTimeout(function() { + $modalInstance.close(); + }, 100); + callerScope.participateForm.name = ''; + callerScope.participateForm.email = ''; + }, function() { + modalscope.modalInfo.info = 'There seems to be a problem. Please try again later!'; + $('#savingParticipant').click(); + setTimeout(function() { + $modalInstance.close(); + }, 1800); + }); + }] }); } }; - function createModal() { - return $modal.open({ - template: '

      Saving your information...

      ', - size: 'lg' - }); - } - $scope.revertError = function() { $scope.showError = false; @@ -71,7 +86,6 @@ angular.module('hackDukeApp') $scope.showError = true; $scope.goToTop(); } else { - var modalInstance = createModal(); $scope.divisions.forEach(function(division) { if ($scope.applyForm[division] === true) { $scope.applyForm[division] = 'Yes'; @@ -79,7 +93,7 @@ angular.module('hackDukeApp') $scope.applyForm[division] = 'No'; } }); - var data = { + $scope.data = { Name: $scope.applyForm.name, netId: $scope.applyForm.netId, Email: $scope.applyForm.email, @@ -94,21 +108,46 @@ angular.module('hackDukeApp') Applications: $scope.applyForm.applications, Ideas: $scope.applyForm.ideas }; - $.when(formService.saveData(data)).then(function() { - modalInstance.dismiss(); - $scope.divisions.forEach(function(division) { - $scope.applyForm[division] === true; - }); - $scope.applyForm.name = ''; - $scope.applyForm.netId = ''; - $scope.applyForm.email = ''; - $scope.applyForm.graduationYear = ''; - $scope.applyForm.phoneNumber = ''; - $scope.applyForm.projects = ''; - $scope.applyForm.experience = ''; - $scope.applyForm.ideas = ''; + + var callerScope = $scope; + + + $modal.open({ + template: '

      {{modalInfo.info}}

      ', + size: 'lg', + controller: ['$scope', '$modalInstance', function($scope, $modalInstance) { + $scope.modalInfo = {}; + $scope.modalInfo.info = 'Saving your information'; + var modalscope = $scope; + $.when(formService.saveData(callerScope.data)).then(function() { + modalscope.modalInfo.info = 'Success!'; + $('#savingOrganizer').click(); + setTimeout(function() { + $modalInstance.close(); + }, 100); + callerScope.divisions.forEach(function(division) { + callerScope.applyForm[division] = false; + }); + + callerScope.applyForm.name = ''; + callerScope.applyForm.netId = ''; + callerScope.applyForm.email = ''; + callerScope.applyForm.graduationYear = ''; + callerScope.applyForm.phoneNumber = ''; + callerScope.applyForm.projects = ''; + callerScope.applyForm.experience = ''; + callerScope.applyForm.ideas = ''; + callerScope.data = {}; + }, function() { + modalscope.modalInfo.info = 'There seems to be a problem. Please try again later!'; + $('#savingOrganizer').click(); + setTimeout(function() { + $modalInstance.close(); + }, 1800); + }); + }] }); } }; - }); + }]); diff --git a/app/assets/javascripts/fall2014.js b/app/assets/javascripts/fall2014.js new file mode 100644 index 0000000..953d86e --- /dev/null +++ b/app/assets/javascripts/fall2014.js @@ -0,0 +1,21 @@ +//= require jquery +//= require jquery.turbolinks +//= require jquery_ujs +//= require bootstrap +//= require turbolinks +//= require angular-application + +$(function() { + $('.scroll').click(function() { + if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { + var target = $(this.hash); + target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); + if (target.length) { + $('html,body').animate({ + scrollTop: target.offset().top + }, 500); + return false; + } + } + }); +}); \ No newline at end of file diff --git a/app/assets/javascripts/fall2015.js b/app/assets/javascripts/fall2015.js new file mode 100644 index 0000000..776f234 --- /dev/null +++ b/app/assets/javascripts/fall2015.js @@ -0,0 +1,21 @@ +//= require jquery +//= require jquery.turbolinks +//= require jquery_ujs +//= require bootstrap +//= require turbolinks +//= require angular-application + +$(function() { + $('.scroll').click(function() { + if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { + var target = $(this.hash); + target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); + if (target.length) { + $('html,body').animate({ + scrollTop: target.offset().top + }, 500); + return false; + } + } + }); +}); diff --git a/app/assets/stylesheets/fall2014.css.scss b/app/assets/stylesheets/fall2014.css.scss new file mode 100644 index 0000000..2ef4d35 --- /dev/null +++ b/app/assets/stylesheets/fall2014.css.scss @@ -0,0 +1,14 @@ +@import "bootstrap"; +@import "fall2014/colors"; +@import "fall2014/mixins"; +@import "fall2014/global"; +@import "fall2014/nav"; +@import "fall2014/home"; +@import "fall2014/about"; +@import "fall2014/faqs"; +@import "fall2014/sponsors"; +@import "fall2014/partners"; +@import "fall2014/organizers"; +@import "fall2014/maps"; +@import "fall2014/media"; +@import "fall2014/events"; \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/about.css.scss b/app/assets/stylesheets/fall2014/about.css.scss new file mode 100644 index 0000000..fa1ebc1 --- /dev/null +++ b/app/assets/stylesheets/fall2014/about.css.scss @@ -0,0 +1,121 @@ +#storm { + img { + display: block; + width: 400px; + margin: auto; + margin-top: 50px; + } +} + +@media (max-width: 320px) { + #storm { + img { + width: 300px; + margin: 0; + } + } +} + +#about { + padding-bottom: 20px; + h3 { + padding-top: 20px; + padding-bottom: 30px; + } + #signup-container { + padding: 0 40px; + } + .row { + img { + width: 100%; + } + } +} + +.image { + padding: 10px 15px 15px 15px; +} + +.mission-unit { + padding: 10px 0; + height: 100%; + .mission { + height: 100%; + } +} + +.number { + font-size: 165px; + color: $yellow; + text-shadow: + 3px 3px 0 $black, + 1px 1px 0 $black; + font-weight: 900; + display: inline-block; + height: 100%; +} + +.blurb-wrapper { + padding-right: 30px; + position: relative; + height: 235px; + .blurb { + @include vertical-align; + color: $black; + .blurb-header { + color: $blue; + font-weight: 900; + font-size: 25px; + text-transform: uppercase; + text-shadow: + 1px 1px 0 $yellow, + 1px 1px 0 $yellow; + } + .blurb-body { + margin-top: 10px; + display: inline-block; + } + } +} + +#social-media { + text-align: center; + margin-top: 40px; +} + +.social-media { + display: inline-block; + margin: 0 20px; + height: 64px; + width: 64px; +} + +#facebook { + background: url(../facebook.png) 0 0 no-repeat; + &:hover { + opacity: 0.7; + } +} + +#twitter { + background: url(../twitter.png) 0 0 no-repeat; + &:hover { + opacity: 0.7; + } +} + +.team-image { + border-radius: 50%; + width: 150px; + height: 150px; + margin: auto; + display: block; +} + +.team-member { + margin-bottom: 40px; +} + +.team { + margin: 40px 0; +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/colors.css.scss b/app/assets/stylesheets/fall2014/colors.css.scss new file mode 100644 index 0000000..bcee6c3 --- /dev/null +++ b/app/assets/stylesheets/fall2014/colors.css.scss @@ -0,0 +1,5 @@ +$charcoal: #424142; +$black: #201f24; +$yellow: #ffcd34; +$blue: #262e68; +$background: #2a3139; \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/courses.css.scss b/app/assets/stylesheets/fall2014/courses.css.scss new file mode 100644 index 0000000..0cae8cc --- /dev/null +++ b/app/assets/stylesheets/fall2014/courses.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the courses controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/fall2014/events.css.scss b/app/assets/stylesheets/fall2014/events.css.scss new file mode 100644 index 0000000..22dba1a --- /dev/null +++ b/app/assets/stylesheets/fall2014/events.css.scss @@ -0,0 +1,5 @@ +.schedule { + margin-top: 10px; + width: 100%; + height: 1050px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/faqs.css.scss b/app/assets/stylesheets/fall2014/faqs.css.scss new file mode 100644 index 0000000..21ae869 --- /dev/null +++ b/app/assets/stylesheets/fall2014/faqs.css.scss @@ -0,0 +1,22 @@ +#jean-grey { + text-align: right; + img { + width: 400px; + margin-right: 40px; + margin-top: 50px; + } +} + +#faq { + padding-bottom: 0; +} + +@media (max-width: 320px) { + #jean-grey { + text-align: center; + img { + width: 300px; + margin: 0; + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/global.css.scss b/app/assets/stylesheets/fall2014/global.css.scss new file mode 100644 index 0000000..8ceef08 --- /dev/null +++ b/app/assets/stylesheets/fall2014/global.css.scss @@ -0,0 +1,248 @@ +html, body { + height: 100%; + font-family: "Raleway"; + color: white; + background-color: $background; +} +.container-small { + margin-left: auto; + margin-right: auto; + width: 60%; +} +.frame-light { + padding: 100px 0; + position: relative; + background-color: $background; +} +.frame-dark { + padding: 100px 0; + position: relative; + background-color: darken($background, 5%); +} +.content { + margin-top: 20px; + padding-bottom: 20px; + background-color: white; +} +a { + color: $blue; + font-weight: 700; + &:hover { + font-weight: 700; + color: lighten($blue, 20%); + text-decoration: none; + } +} +p { + font-family: "Raleway"; + padding: 10px 20px; + color: $black; + font-size: 14px; +} +label { + font-family: "Raleway"; + padding: 10px 20px; + color: $black; + font-size: 14px; +} +form { + margin-top: 20px; +} +h1 { + font-family: "Raleway"; + padding: 20px; + color: $yellow; + text-shadow: 3px 3px 0 $black, 1px 1px 0 $black; + background-color: $blue; + font-weight: 900; + font-size: 35px; + text-transform: uppercase; + text-align: center; + vertical-align: middle; +} +h2 { + font-family: "Raleway"; + padding: 20px; + color: $black; + font-weight: 100; + font-size: 25px; + text-align: center; + vertical-align: middle; +} +h3 { + font-family: "Raleway"; + font-weight: 700; + font-size: 20px; + padding: 0 20px; + color: $black; +} +li { + color: $black; +} +.cta { + display: inline-block; + margin: auto; + background-color: $yellow; + padding: 10px 15px; + font-weight: 500; + color: $black; + &:hover { + background-color: lighten($yellow, 10%); + color: lighten($black, 10%); + text-decoration: none; + } +} +.cta-wrapper { + background-color: $blue; + margin-top: 40px; + .btn-wrapper { + width: 560px; + position: relative; + margin: auto; + padding-bottom: 40px; + } + .cta-lead { + font-weight: 900; + font-size: 32px; + color: $yellow; + text-shadow: 1px 1px 0 $black, 1px 1px 0 $black; + text-transform: uppercase; + padding-top: 30px; + } +} +.or { + z-index: 1; + display: inline; + position: absolute; + left: 250px; + top: -7px; + background-color: $black; + color: $yellow; + height: 60px; + width: 60px; + padding-top: 20px; + border-radius: 50%; +} +.cta-2 { + font-weight: 500; + font-size: 16px; + width: 250px; + background-color: $yellow; + padding: 10px 20px; + margin: 0 15px; + color: $black; + border-radius: 0; + position: relative; + &:hover { + background-color: lighten($yellow, 10%); + color: lighten($black, 10%); + text-decoration: none; + } + &:before { + content: ' '; + position: absolute; + width: 30px; + height: 0; + left: -31px; + top: -1px; + border-width: 22px 10px; + border-style: solid; + border-color: $yellow $yellow $yellow transparent; + } + &:after { + content: ' '; + position: absolute; + width: 30px; + height: 0; + right: -31px; + top: -1px; + border-width: 22px 10px; + border-style: solid; + border-color: $yellow transparent $yellow $yellow; + } +} +.image-center { + margin-left: auto; + margin-right: auto; + display: block; +} +.banner-header { + background-color: $yellow; + color: $blue; + position: relative; + font-size: 18px; + font-weight: 500; + display: inline-block; + &:before { + content: ' '; + position: absolute; + width: 30px; + height: 0; + left: -30px; + top: 4px; + border-width: 27px 10px; + border-style: solid; + border-color: darken($yellow, 10%) darken($yellow, 10%) darken($yellow, 10%) transparent; + } + &:after { + content: ' '; + position: absolute; + width: 30px; + height: 0; + right: -30px; + top: 4px; + border-width: 27px 10px; + border-style: solid; + border-color: darken($yellow, 10%) transparent darken($yellow, 10%) darken($yellow, 10%); + } +} +@media (max-width: 768px) { + h1 { + font-size: 30px; + } + .or { + display: block; + position: static; + margin: 20px auto; + } + .cta-2 { + float: none !important; + display: block; + margin: auto; + &:before { + top: -5px; + border-color: darken($yellow, 10%) darken($yellow, 10%) darken($yellow, 10%) transparent; + } + &:after { + top: -5px; + border-color: darken($yellow, 10%) transparent darken($yellow, 10%) darken($yellow, 10%); + } + } + .btn-wrapper { + width: 100% !important; + } +} +.profile-img { + display: block; + margin: auto; + padding: 10px; + border-radius: 50%; + width: 150px; + height: 150px; +} +.img-hover { + &:hover { + opacity: 0.7; + } +} +.icon { + font-size: 50px; +} +.icon-fa { + font-size: 35px; +} +.fa { + margin-top: 25px; + margin-bottom: 10px; + +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/home.css.scss b/app/assets/stylesheets/fall2014/home.css.scss new file mode 100644 index 0000000..19facf5 --- /dev/null +++ b/app/assets/stylesheets/fall2014/home.css.scss @@ -0,0 +1,170 @@ +#home { + height: 100%; +} + +#signup-container { + text-align: center; + position: relative; +} + +#home-badge { + img { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + display: block; + margin: auto; + width: 175px; + } +} + +#profx { + img { + display: none; + position: absolute; + bottom: 0; + margin: 20px 40px; + width: 150px; + } +} + +#wolverine { + img { + margin: 0 auto; + display: block; + width: 300px; + } +} + +#kenan { + padding-bottom: 0; +} + +#register { + p { + display: none; + padding: 0; + margin: 20px 0 0 0; + } + h3 { + font-weight: 900; + font-size: 16px; + text-transform: uppercase; + margin: 10px 0; + color: $yellow; + } + position: absolute; + bottom: 0; + right: 0; + left: 0; + margin: 40px; +} + +.arrow-down { + display: none; + width: 0; + height: 0; + border-left: 20px solid transparent; + border-right: 20px solid transparent; + border-top: 20px solid white; +} + +.cta-3 { + text-align: center; + font-weight: 500; + font-size: 14px; + width: 110px; + background-color: $blue; + padding: 8px 10px; + color: $yellow; + position: relative; + border-radius: 0; + display: inline-block; + margin: 10px auto; + &:hover { + background-color: lighten($blue, 10%); + color: lighten($yellow, 10%); + text-decoration: none; + } +} + +/* Small devices (tablets, 768px and up) */ +@media (min-width: 768px) and (min-height: 768px) { + #home-badge { + img { + width: 300px; + } + } + #register { + .cta-3 { + margin: 10px; + } + } +} + +/* Medium devices (desktops, 992px and up) */ +@media (min-width: 992px) and (min-height: 768px) { + #profx { + img { + display: block; + width: 250px; + } + } + #register { + p { + text-align: center; + display: block; + } + h3 { + color: $charcoal; + } + .cta-3 { + margin: 5px; + } + #signup-container { + padding: 10px 20px 20px 20px; + } + background-color: white; + width: 200px; + border-radius: 10px; + bottom: 350px; + .btn { + margin-top: 10px; + } + .arrow-down { + display: block; + position: absolute; + left: 130px; + } + } + #home-badge { + img { + width: 400px; + } + } +} + +/* Large devices (large desktops, 1200px and up) */ +@media (min-width: 1200px) and (min-height: 768px) { + #profx { + img { + display: block; + width: 300px; + } + } + #register { + bottom: 400px; + width: 300px; + h3 { + color: $charcoal; + } + .cta-3 { + margin: 5px; + } + .arrow-down { + left: 180px; + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/maps.css.scss b/app/assets/stylesheets/fall2014/maps.css.scss new file mode 100644 index 0000000..813ad12 --- /dev/null +++ b/app/assets/stylesheets/fall2014/maps.css.scss @@ -0,0 +1,4 @@ +.map { + margin-top: 10px; + width: 100%; +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/media.css.scss b/app/assets/stylesheets/fall2014/media.css.scss new file mode 100644 index 0000000..1abc414 --- /dev/null +++ b/app/assets/stylesheets/fall2014/media.css.scss @@ -0,0 +1,3 @@ +.gallery { + margin-bottom: 20px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/mentors.css.scss b/app/assets/stylesheets/fall2014/mentors.css.scss new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/fall2014/mixins.css.scss b/app/assets/stylesheets/fall2014/mixins.css.scss new file mode 100644 index 0000000..f7131a4 --- /dev/null +++ b/app/assets/stylesheets/fall2014/mixins.css.scss @@ -0,0 +1,7 @@ +@mixin vertical-align { + position: relative; + top: 50%; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + transform: translateY(-50%); +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/nav.css.scss b/app/assets/stylesheets/fall2014/nav.css.scss new file mode 100644 index 0000000..d630cc3 --- /dev/null +++ b/app/assets/stylesheets/fall2014/nav.css.scss @@ -0,0 +1,80 @@ +nav { + background-color: $black !important; + border-color: transparent !important; + #logo { + padding-right: 25px; + padding-left: 25px; + } + .navbar-header { + position: relative; + button { + position: absolute; + right: 0; + top: 0; + bottom: 0; + margin: 20px; + &:hover, &:focus { + background-color: lighten($black, 10%) !important; + } + } + } + #nav { + ul { + li { + height: 100%; + padding: 25px; + a { + text-transform: uppercase; + font-weight: 300; + font-size: 18px; + line-height: 1.5em; + padding: 0; + color: $yellow; + } + } + } + } +} + +#logo { + img { + height: 50px; + } +} + +@media (max-width: 1250px) { + .navbar-header { + float: none; + } + .navbar-collapse.collapse { + display: none !important; + } + + .navbar-collapse { + border-top: 1px solid #e7e7e7; + } + + .navbar-nav > li { + float: none; + } + .navbar-toggle { + display: inline; + } +} + +.open { + a { + background-color: transparent !important; + } +} + +.dropdown-menu { + background-color: $black; + li { + padding: 15px !important; + a { + text-transform: capitalize !important; + font-size: 16px !important; + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/organizers.css.scss b/app/assets/stylesheets/fall2014/organizers.css.scss new file mode 100644 index 0000000..146c12e --- /dev/null +++ b/app/assets/stylesheets/fall2014/organizers.css.scss @@ -0,0 +1,15 @@ +.team-image { + border-radius: 50%; + width: 150px; + height: 150px; + margin: auto; + display: block; +} + +.team-member { + margin-bottom: 40px; +} + +.team { + margin: 40px 0; +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/partners.css.scss b/app/assets/stylesheets/fall2014/partners.css.scss new file mode 100644 index 0000000..88f6c35 --- /dev/null +++ b/app/assets/stylesheets/fall2014/partners.css.scss @@ -0,0 +1,8 @@ +#partners { + text-align: center; +} + +.partner-img { + width: 250px; + padding: 30px; +} diff --git a/app/assets/stylesheets/fall2014/prizes.css.scss b/app/assets/stylesheets/fall2014/prizes.css.scss new file mode 100644 index 0000000..d5d022c --- /dev/null +++ b/app/assets/stylesheets/fall2014/prizes.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the prizes controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/fall2014/sponsors.css.scss b/app/assets/stylesheets/fall2014/sponsors.css.scss new file mode 100644 index 0000000..2de9263 --- /dev/null +++ b/app/assets/stylesheets/fall2014/sponsors.css.scss @@ -0,0 +1,16 @@ +#sponsors { + padding-bottom: 80px; + width: 100%; +} +.sponsor-img-small { + width: 150px; + padding: 20px; +} +.sponsor-img-large { + width: 350px; + padding: 20px; +} +.sponsor-img-medium { + width: 250px; + padding: 20px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2014/winners.css.scss b/app/assets/stylesheets/fall2014/winners.css.scss new file mode 100644 index 0000000..b717e73 --- /dev/null +++ b/app/assets/stylesheets/fall2014/winners.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the winners controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/fall2015.css.scss b/app/assets/stylesheets/fall2015.css.scss new file mode 100644 index 0000000..03bd9f0 --- /dev/null +++ b/app/assets/stylesheets/fall2015.css.scss @@ -0,0 +1,14 @@ +@import "bootstrap"; +@import "fall2015/colors"; +@import "fall2015/mixins"; +@import "fall2015/global"; +@import "fall2015/nav"; +@import "fall2015/home"; +@import "fall2015/about"; +@import "fall2015/faqs"; +@import "fall2015/sponsors"; +@import "fall2015/partners"; +@import "fall2015/organizers"; +@import "fall2015/maps"; +@import "fall2015/media"; +@import "fall2015/events"; \ No newline at end of file diff --git a/app/assets/stylesheets/fall2015/.home.css.scss.swp b/app/assets/stylesheets/fall2015/.home.css.scss.swp new file mode 100644 index 0000000..22e277f Binary files /dev/null and b/app/assets/stylesheets/fall2015/.home.css.scss.swp differ diff --git a/app/assets/stylesheets/fall2015/about.css.scss b/app/assets/stylesheets/fall2015/about.css.scss new file mode 100644 index 0000000..4ce6320 --- /dev/null +++ b/app/assets/stylesheets/fall2015/about.css.scss @@ -0,0 +1,120 @@ +#storm { + img { + display: block; + width: 400px; + margin: auto; + margin-top: 50px; + } +} + +@media (max-width: 320px) { + #storm { + img { + width: 300px; + margin: 0; + } + } +} + +#about { + h3 { + padding-top: 20px; + padding-bottom: 30px; + } + #signup-container { + padding: 0 40px; + } + .row { + img { + width: 100%; + } + } +} + +.image { + padding: 10px 15px 15px 15px; +} + +.mission-unit { + padding: 10px 0; + height: 100%; + .mission { + height: 100%; + } +} + +.number { + font-size: 165px; + color: $yellow; + text-shadow: + 3px 3px 0 $black, + 1px 1px 0 $black; + font-weight: 900; + display: inline-block; + height: 100%; +} + +.blurb-wrapper { + padding-right: 30px; + position: relative; + height: 235px; + .blurb { + @include vertical-align; + color: $black; + .blurb-header { + color: $blue; + font-weight: 900; + font-size: 25px; + text-transform: uppercase; + text-shadow: + 1px 1px 0 $yellow, + 1px 1px 0 $yellow; + } + .blurb-body { + margin-top: 10px; + display: inline-block; + } + } +} + +#social-media { + text-align: center; + margin-top: 40px; +} + +.social-media { + display: inline-block; + margin: 0 20px; + height: 64px; + width: 64px; +} + +#facebook { + background: url(../facebook.png) 0 0 no-repeat; + &:hover { + opacity: 0.7; + } +} + +#twitter { + background: url(../twitter.png) 0 0 no-repeat; + &:hover { + opacity: 0.7; + } +} + +.team-image { + border-radius: 50%; + width: 150px; + height: 150px; + margin: auto; + display: block; +} + +.team-member { + margin-bottom: 40px; +} + +.team { + margin: 40px 0; +} diff --git a/app/assets/stylesheets/fall2015/colors.css.scss b/app/assets/stylesheets/fall2015/colors.css.scss new file mode 100644 index 0000000..bcee6c3 --- /dev/null +++ b/app/assets/stylesheets/fall2015/colors.css.scss @@ -0,0 +1,5 @@ +$charcoal: #424142; +$black: #201f24; +$yellow: #ffcd34; +$blue: #262e68; +$background: #2a3139; \ No newline at end of file diff --git a/app/assets/stylesheets/fall2015/courses.css.scss b/app/assets/stylesheets/fall2015/courses.css.scss new file mode 100644 index 0000000..0cae8cc --- /dev/null +++ b/app/assets/stylesheets/fall2015/courses.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the courses controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/fall2015/events.css.scss b/app/assets/stylesheets/fall2015/events.css.scss new file mode 100644 index 0000000..22dba1a --- /dev/null +++ b/app/assets/stylesheets/fall2015/events.css.scss @@ -0,0 +1,5 @@ +.schedule { + margin-top: 10px; + width: 100%; + height: 1050px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2015/faqs.css.scss b/app/assets/stylesheets/fall2015/faqs.css.scss new file mode 100644 index 0000000..5965723 --- /dev/null +++ b/app/assets/stylesheets/fall2015/faqs.css.scss @@ -0,0 +1,18 @@ +#jean-grey { + text-align: center; + img { + width: 400px; + margin-right: 40px; + margin-top: 50px; + } +} + +@media (max-width: 320px) { + #jean-grey { + text-align: center; + img { + width: 300px; + margin: 0; + } + } +} diff --git a/app/assets/stylesheets/fall2015/global.css.scss b/app/assets/stylesheets/fall2015/global.css.scss new file mode 100644 index 0000000..ac73b4a --- /dev/null +++ b/app/assets/stylesheets/fall2015/global.css.scss @@ -0,0 +1,248 @@ +html, body { + height: 100%; + font-family: "Raleway"; + color: white; + background-color: $background; +} +.container-small { + margin-left: auto; + margin-right: auto; + width: 60%; +} +.frame-light { + padding: 50px 0; + position: relative; + background-color: $background; +} +.frame-dark { + padding: 100px 0; + position: relative; + background-color: darken($background, 5%); +} +.content { + margin-top: 20px; + padding-bottom: 20px; + background-color: white; +} +a { + color: $blue; + font-weight: 700; + &:hover { + font-weight: 700; + color: lighten($blue, 20%); + text-decoration: none; + } +} +p { + font-family: "Raleway"; + padding: 10px 20px; + color: $black; + font-size: 14px; +} +label { + font-family: "Raleway"; + padding: 10px 20px; + color: $black; + font-size: 14px; +} +form { + margin-top: 20px; +} +h1 { + font-family: "Raleway"; + padding: 20px; + color: $yellow; + text-shadow: 3px 3px 0 $black, 1px 1px 0 $black; + background-color: $blue; + font-weight: 900; + font-size: 35px; + text-transform: uppercase; + text-align: center; + vertical-align: middle; +} +h2 { + font-family: "Raleway"; + padding: 20px; + color: $black; + font-weight: 100; + font-size: 25px; + text-align: center; + vertical-align: middle; +} +h3 { + font-family: "Raleway"; + font-weight: 700; + font-size: 20px; + padding: 0 20px; + color: $black; +} +li { + color: $black; +} +.cta { + display: inline-block; + margin: auto; + background-color: $yellow; + padding: 10px 15px; + font-weight: 500; + color: $black; + &:hover { + background-color: lighten($yellow, 10%); + color: lighten($black, 10%); + text-decoration: none; + } +} +.cta-wrapper { + background-color: $blue; + margin-top: 40px; + .btn-wrapper { + width: 560px; + position: relative; + margin: auto; + padding-bottom: 40px; + } + .cta-lead { + font-weight: 900; + font-size: 32px; + color: $yellow; + text-shadow: 1px 1px 0 $black, 1px 1px 0 $black; + text-transform: uppercase; + padding-top: 30px; + } +} +.or { + z-index: 1; + display: inline; + position: absolute; + left: 250px; + top: -7px; + background-color: $black; + color: $yellow; + height: 60px; + width: 60px; + padding-top: 20px; + border-radius: 50%; +} +.cta-2 { + font-weight: 500; + font-size: 16px; + width: 250px; + background-color: $yellow; + padding: 10px 20px; + margin: 0 15px; + color: $black; + border-radius: 0; + position: relative; + &:hover { + background-color: lighten($yellow, 10%); + color: lighten($black, 10%); + text-decoration: none; + } + &:before { + content: ' '; + position: absolute; + width: 30px; + height: 0; + left: -31px; + top: -1px; + border-width: 22px 10px; + border-style: solid; + border-color: $yellow $yellow $yellow transparent; + } + &:after { + content: ' '; + position: absolute; + width: 30px; + height: 0; + right: -31px; + top: -1px; + border-width: 22px 10px; + border-style: solid; + border-color: $yellow transparent $yellow $yellow; + } +} +.image-center { + margin-left: auto; + margin-right: auto; + display: block; +} +.banner-header { + background-color: $yellow; + color: $blue; + position: relative; + font-size: 18px; + font-weight: 500; + display: inline-block; + &:before { + content: ' '; + position: absolute; + width: 30px; + height: 0; + left: -30px; + top: 4px; + border-width: 27px 10px; + border-style: solid; + border-color: darken($yellow, 10%) darken($yellow, 10%) darken($yellow, 10%) transparent; + } + &:after { + content: ' '; + position: absolute; + width: 30px; + height: 0; + right: -30px; + top: 4px; + border-width: 27px 10px; + border-style: solid; + border-color: darken($yellow, 10%) transparent darken($yellow, 10%) darken($yellow, 10%); + } +} +@media (max-width: 768px) { + h1 { + font-size: 30px; + } + .or { + display: block; + position: static; + margin: 20px auto; + } + .cta-2 { + float: none !important; + display: block; + margin: auto; + &:before { + top: -5px; + border-color: darken($yellow, 10%) darken($yellow, 10%) darken($yellow, 10%) transparent; + } + &:after { + top: -5px; + border-color: darken($yellow, 10%) transparent darken($yellow, 10%) darken($yellow, 10%); + } + } + .btn-wrapper { + width: 100% !important; + } +} +.profile-img { + display: block; + margin: auto; + padding: 10px; + border-radius: 50%; + width: 150px; + height: 150px; +} +.img-hover { + &:hover { + opacity: 0.7; + } +} +.icon { + font-size: 50px; +} +.icon-fa { + font-size: 35px; +} +.fa { + margin-top: 25px; + margin-bottom: 10px; + +} diff --git a/app/assets/stylesheets/fall2015/home.css.scss b/app/assets/stylesheets/fall2015/home.css.scss new file mode 100644 index 0000000..0f2f85a --- /dev/null +++ b/app/assets/stylesheets/fall2015/home.css.scss @@ -0,0 +1,354 @@ +#home { + height: 100%; +} + +#mlh-trust-badge { + display: none; +} + +#signup-container { + text-align: center; + position: relative; +} + +#home-badge { + img { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + display: block; + margin: auto; + width: 175px; + } +} + +/* MailChimp Form Embed Code - Slim - 08/17/2011 */ +#mc_embed_signup { + + form { + display:block; + position:relative; + text-align:center; + padding:10px 0 10px 3% + } + h2 { + font-weight:bold; + padding:0; + margin:15px 0; + font-size:1.4em; + } + input { + + border:1px solid #999; + -webkit-appearance:none; + } + input[type=checkbox] { + -webkit-appearance:checkbox; + } + input[type=radio] { + -webkit-appearance:radio;; + } + input:focus { + border-color:#333; + } + .button { + clear:both; + background-color: #aaa; + border: 0 none; + border-radius: 4px; + color: #FFFFFF; + cursor: pointer; + display: inline-block; + font-size:15px; + font-weight: bold; + height: 32px; + line-height: 32px; + margin: 0 5px 10px 0; + padding:0; + text-align: center; + text-decoration: none; + vertical-align: top; + white-space: nowrap; + width: auto; + } + .button:hover { + background-color:#777; + } + .small-meta { + font-size: 11px; + } + .nowrap { + white-space:nowrap; + } + .clear { + clear:none; + display:inline; + } + label { + position: relative; + left: -1.5%; + display:block; + font-size:15px; + padding-bottom:10px; + font-weight:bold; + color: $yellow + } + input.email { + position: relative; + left: 19%; + display:block; + padding:8px 0; + margin:0 4% 10px 0; + text-indent:5px; + width:58%; + min-width:130px; + } + input.button { + position: relative; + left: 31.5%; + display:block; + width:35%; + margin:0 0 10px 0; + min-width:90px; + } + div#mce-responses { + float:left; + top:-1.4em; + padding:0em .5em 0em .5em; + overflow:hidden; + width:90%; + margin: 0 5%; + clear: both; + } + div.response { + margin:1em 0; + padding:1em .5em .5em 0; + font-weight:bold; + float:left; + top:-1.5em; + z-index:1; + width:80%; + } + #mce-error-response { + display:none; + } + #mce-success-response { + color:#529214; + display:none; + } + label.error { + display:block; + float:none; + width:auto; + margin-left:1.05em; + text-align:left; + padding:.5em 0; + } +} + +#baby-kitty { + img { + display: none; + position: absolute; + bottom: 0; + margin: 20px 40px; + width: 150px; + } +} + +#wolverine { + img { + margin: 0 auto; + display: block; + width: 300px; + } +} + +#kenan { + padding-bottom: 0; +} + +#finalregister { + p { + display: none; + padding: 0; + margin: 20px 0 0 0; + } + h3 { + font-weight: 900; + font-size: 16px; + text-transform: uppercase; + margin: 10px 0; + color: $yellow; + } + h4 { + font-weight: 900; + font-size: 16px; + margin: 10px 0; + color: $yellow; + } + position: absolute; + bottom: 0; + right: 0; + left: 0; + margin: 40px; +} + +.arrow-down { + display: none; + width: 0; + height: 0; + border-left: 20px solid transparent; + border-right: 20px solid transparent; + border-top: 20px solid white; +} + +.cta-3 { + text-align: center; + font-weight: 500; + font-size: 14px; + width: 110px; + background-color: $blue; + padding: 8px 10px; + color: $yellow; + position: relative; + border-radius: 0; + display: inline-block; + margin: 10px auto; + &:hover { + background-color: lighten($blue, 10%); + color: lighten($yellow, 10%); + text-decoration: none; + } +} + +/* Small devices (tablets, 768px and up) */ +@media (min-width: 768px) and (min-height: 768px) { + #mlh-trust-badge { + display: none; + } + + #home-badge { + img { + width: 300px; + } + } + #register { + .cta-3 { + margin: 10px; + } + } +} + +/* Medium devices (desktops, 992px and up) */ +@media (min-width: 992px) and (min-height: 768px) { + #mlh-trust-badge { + display: none; + } + + #baby-kitty { + img { + display: block; + width: 250px; + } + } + #register { + background-color: charcoal; + width: 200px; + border-radius: 10px; + bottom: 350px; + + p { + text-align: center; + display: block; + } + h3 { + color: $charcoal; + } + .cta-3 { + margin: 5px; + } + #signup-container { + padding: 10px 20px; + } + .btn { + margin-top: 10px; + } + .arrow-down { + display: block; + position: absolute; + left: 130px; + } + } + #home-badge { + img { + width: 400px; + } + } +} + +/* Large devices (large desktops, 1200px and up) */ +@media (min-width: 1200px) and (min-height: 768px) { + + #mlh-trust-badge { + position:fixed; + top:0; + right:50px; + max-width:100px; + width:10%; + min-width: 60px; + display:block; + z-index:10000; + } + + #baby-kitty { + img { + display: block; + width: 300px; + } + } + #signup-container { + text-align: center; + position: relative; + } + #finalregister { + p { + display: none; + padding: 0; + margin: 20px 0 0 0; + } + h3 { + font-weight: 900; + font-size: 25px; + text-transform: uppercase; + margin: 10px; + color: $yellow; + } + position: absolute; + bottom: 0; + right: 0; + left: 0; + margin: 40px; + } + + .cta-3 { + text-align: center; + font-weight: 500; + font-size: 20px; + width: 110px; + background-color: $blue; + padding: 8px 10px; + color: $yellow; + position: relative; + border-radius: 0; + display: inline-block; + margin: 10px auto; + &:hover { + background-color: lighten($blue, 10%); + color: lighten($yellow, 10%); + text-decoration: none; + } + } +} diff --git a/app/assets/stylesheets/fall2015/maps.css.scss b/app/assets/stylesheets/fall2015/maps.css.scss new file mode 100644 index 0000000..813ad12 --- /dev/null +++ b/app/assets/stylesheets/fall2015/maps.css.scss @@ -0,0 +1,4 @@ +.map { + margin-top: 10px; + width: 100%; +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2015/media.css.scss b/app/assets/stylesheets/fall2015/media.css.scss new file mode 100644 index 0000000..1abc414 --- /dev/null +++ b/app/assets/stylesheets/fall2015/media.css.scss @@ -0,0 +1,3 @@ +.gallery { + margin-bottom: 20px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2015/mentors.css.scss b/app/assets/stylesheets/fall2015/mentors.css.scss new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/fall2015/mixins.css.scss b/app/assets/stylesheets/fall2015/mixins.css.scss new file mode 100644 index 0000000..f7131a4 --- /dev/null +++ b/app/assets/stylesheets/fall2015/mixins.css.scss @@ -0,0 +1,7 @@ +@mixin vertical-align { + position: relative; + top: 50%; + -webkit-transform: translateY(-50%); + -ms-transform: translateY(-50%); + transform: translateY(-50%); +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2015/nav.css.scss b/app/assets/stylesheets/fall2015/nav.css.scss new file mode 100644 index 0000000..d630cc3 --- /dev/null +++ b/app/assets/stylesheets/fall2015/nav.css.scss @@ -0,0 +1,80 @@ +nav { + background-color: $black !important; + border-color: transparent !important; + #logo { + padding-right: 25px; + padding-left: 25px; + } + .navbar-header { + position: relative; + button { + position: absolute; + right: 0; + top: 0; + bottom: 0; + margin: 20px; + &:hover, &:focus { + background-color: lighten($black, 10%) !important; + } + } + } + #nav { + ul { + li { + height: 100%; + padding: 25px; + a { + text-transform: uppercase; + font-weight: 300; + font-size: 18px; + line-height: 1.5em; + padding: 0; + color: $yellow; + } + } + } + } +} + +#logo { + img { + height: 50px; + } +} + +@media (max-width: 1250px) { + .navbar-header { + float: none; + } + .navbar-collapse.collapse { + display: none !important; + } + + .navbar-collapse { + border-top: 1px solid #e7e7e7; + } + + .navbar-nav > li { + float: none; + } + .navbar-toggle { + display: inline; + } +} + +.open { + a { + background-color: transparent !important; + } +} + +.dropdown-menu { + background-color: $black; + li { + padding: 15px !important; + a { + text-transform: capitalize !important; + font-size: 16px !important; + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2015/organizers.css.scss b/app/assets/stylesheets/fall2015/organizers.css.scss new file mode 100644 index 0000000..146c12e --- /dev/null +++ b/app/assets/stylesheets/fall2015/organizers.css.scss @@ -0,0 +1,15 @@ +.team-image { + border-radius: 50%; + width: 150px; + height: 150px; + margin: auto; + display: block; +} + +.team-member { + margin-bottom: 40px; +} + +.team { + margin: 40px 0; +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2015/partners.css.scss b/app/assets/stylesheets/fall2015/partners.css.scss new file mode 100644 index 0000000..88f6c35 --- /dev/null +++ b/app/assets/stylesheets/fall2015/partners.css.scss @@ -0,0 +1,8 @@ +#partners { + text-align: center; +} + +.partner-img { + width: 250px; + padding: 30px; +} diff --git a/app/assets/stylesheets/fall2015/prizes.css.scss b/app/assets/stylesheets/fall2015/prizes.css.scss new file mode 100644 index 0000000..d5d022c --- /dev/null +++ b/app/assets/stylesheets/fall2015/prizes.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the prizes controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/fall2015/sponsors.css.scss b/app/assets/stylesheets/fall2015/sponsors.css.scss new file mode 100644 index 0000000..2de9263 --- /dev/null +++ b/app/assets/stylesheets/fall2015/sponsors.css.scss @@ -0,0 +1,16 @@ +#sponsors { + padding-bottom: 80px; + width: 100%; +} +.sponsor-img-small { + width: 150px; + padding: 20px; +} +.sponsor-img-large { + width: 350px; + padding: 20px; +} +.sponsor-img-medium { + width: 250px; + padding: 20px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/fall2015/winners.css.scss b/app/assets/stylesheets/fall2015/winners.css.scss new file mode 100644 index 0000000..b717e73 --- /dev/null +++ b/app/assets/stylesheets/fall2015/winners.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the winners controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/spring2014.css.scss b/app/assets/stylesheets/spring2014.css.scss index bf83529..8fbc8ba 100644 --- a/app/assets/stylesheets/spring2014.css.scss +++ b/app/assets/stylesheets/spring2014.css.scss @@ -9,4 +9,6 @@ @import "spring2014/sponsors"; @import "spring2014/partners"; @import "spring2014/organizers"; -@import "spring2014/maps"; \ No newline at end of file +@import "spring2014/maps"; +@import "spring2014/media"; +@import "spring2014/events"; \ No newline at end of file diff --git a/app/assets/stylesheets/spring2014/events.css.scss b/app/assets/stylesheets/spring2014/events.css.scss index 04d79bd..22dba1a 100644 --- a/app/assets/stylesheets/spring2014/events.css.scss +++ b/app/assets/stylesheets/spring2014/events.css.scss @@ -1,3 +1,5 @@ -// Place all the styles related to the events controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ +.schedule { + margin-top: 10px; + width: 100%; + height: 1050px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/spring2014/global.css.scss b/app/assets/stylesheets/spring2014/global.css.scss index 7d619ff..aa52e7a 100644 --- a/app/assets/stylesheets/spring2014/global.css.scss +++ b/app/assets/stylesheets/spring2014/global.css.scss @@ -23,6 +23,16 @@ html, body { background-color: white; } +a { + color: $blue; + font-weight: 700; + &:hover { + font-weight: 700; + color: lighten($blue, 20%); + text-decoration: none; + } +} + p { font-family: "Raleway"; padding: 10px 20px; @@ -180,7 +190,7 @@ li { position: relative; font-size: 18px; font-weight: 500; - margin: 30px 90px; + display: inline-block; &:before { content: ' '; position: absolute; diff --git a/app/assets/stylesheets/spring2014/media.css.scss b/app/assets/stylesheets/spring2014/media.css.scss index 55ea7c4..1abc414 100644 --- a/app/assets/stylesheets/spring2014/media.css.scss +++ b/app/assets/stylesheets/spring2014/media.css.scss @@ -1,3 +1,3 @@ -// Place all the styles related to the media controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ +.gallery { + margin-bottom: 20px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/spring2014/partners.css.scss b/app/assets/stylesheets/spring2014/partners.css.scss index 11f8f47..88f6c35 100644 --- a/app/assets/stylesheets/spring2014/partners.css.scss +++ b/app/assets/stylesheets/spring2014/partners.css.scss @@ -1,3 +1,7 @@ +#partners { + text-align: center; +} + .partner-img { width: 250px; padding: 30px; diff --git a/app/assets/stylesheets/spring2014/sponsors.css.scss b/app/assets/stylesheets/spring2014/sponsors.css.scss index 17f194e..ab14bc6 100644 --- a/app/assets/stylesheets/spring2014/sponsors.css.scss +++ b/app/assets/stylesheets/spring2014/sponsors.css.scss @@ -1,5 +1,4 @@ #sponsors { - text-align: center; padding-bottom: 80px; width: 100%; } diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d83690e..ba8e490 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,14 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + def match_semester(matchable_array, season, year) + matched_model = Array.new + matchable_array.each do |model| + if model.match?(season, year) + matched_model << model + end + end + return matched_model + end end diff --git a/app/controllers/fall2014/courses_controller.rb b/app/controllers/fall2014/courses_controller.rb new file mode 100644 index 0000000..5f36e80 --- /dev/null +++ b/app/controllers/fall2014/courses_controller.rb @@ -0,0 +1,7 @@ +class Fall2014::CoursesController < ApplicationController + layout 'fall2014' + + def index + @courses = Course.joins(:semester).where(semesters: {season: "Fall", year: Date.new(2014)}) + end +end diff --git a/app/controllers/fall2014/events_controller.rb b/app/controllers/fall2014/events_controller.rb new file mode 100644 index 0000000..715bbee --- /dev/null +++ b/app/controllers/fall2014/events_controller.rb @@ -0,0 +1,10 @@ +class Fall2014::EventsController < ApplicationController + layout 'fall2014' + + def index + end + + def tech_talks + @events = Event.joins(:semester).where(semesters: {season: "Fall", year: Date.new(2014)}).order(:date).order(:start_time) + end +end diff --git a/app/controllers/fall2014/maps_controller.rb b/app/controllers/fall2014/maps_controller.rb new file mode 100644 index 0000000..7803a8c --- /dev/null +++ b/app/controllers/fall2014/maps_controller.rb @@ -0,0 +1,7 @@ +class Fall2014::MapsController < ApplicationController + layout 'fall2014' + + def index + @maps = Map.all + end +end diff --git a/app/controllers/fall2014/media_controller.rb b/app/controllers/fall2014/media_controller.rb new file mode 100644 index 0000000..b7c48a1 --- /dev/null +++ b/app/controllers/fall2014/media_controller.rb @@ -0,0 +1,10 @@ +class Fall2014::MediaController < ApplicationController + layout 'fall2014' + + def index + @media = Medium.all + @articles = Medium.where(:media_type => "Article") + @galleries = Medium.where(:media_type => "Gallery") + @videos = Medium.where(:media_type => "Video") + end +end diff --git a/app/controllers/fall2014/mentors_controller.rb b/app/controllers/fall2014/mentors_controller.rb new file mode 100644 index 0000000..5348576 --- /dev/null +++ b/app/controllers/fall2014/mentors_controller.rb @@ -0,0 +1,14 @@ +class Fall2014::MentorsController < ApplicationController + layout 'fall2014' + + def our_mentors + @mentors = Mentor.all + end + + def our_experts + @experts = Mentor.all + end + + def guidelines + end +end diff --git a/app/controllers/fall2014/organizers_controller.rb b/app/controllers/fall2014/organizers_controller.rb new file mode 100644 index 0000000..b0439d1 --- /dev/null +++ b/app/controllers/fall2014/organizers_controller.rb @@ -0,0 +1,7 @@ +class Fall2014::OrganizersController < ApplicationController + layout 'fall2014' + + def index + @organizers = Organizer.all + end +end \ No newline at end of file diff --git a/app/controllers/fall2014/partners_controller.rb b/app/controllers/fall2014/partners_controller.rb new file mode 100644 index 0000000..a5b512d --- /dev/null +++ b/app/controllers/fall2014/partners_controller.rb @@ -0,0 +1,7 @@ +class Fall2014::PartnersController < ApplicationController + layout 'fall2014' + + def index + @partners = Partner.joins(:semesters).where({season: "Fall", year: Date.new(2014)}) + end +end diff --git a/app/controllers/fall2014/prizes_controller.rb b/app/controllers/fall2014/prizes_controller.rb new file mode 100644 index 0000000..4ce2bfc --- /dev/null +++ b/app/controllers/fall2014/prizes_controller.rb @@ -0,0 +1,7 @@ +class Fall2014::PrizesController < ApplicationController + layout 'fall2014' + + def index + @prizes = Prize.joins(:semester).where(semesters: {season: "Fall", year: Date.new(2014)}) + end +end diff --git a/app/controllers/fall2014/sponsors_controller.rb b/app/controllers/fall2014/sponsors_controller.rb new file mode 100644 index 0000000..2aed71e --- /dev/null +++ b/app/controllers/fall2014/sponsors_controller.rb @@ -0,0 +1,6 @@ +class Fall2014::SponsorsController < ApplicationController + layout 'fall2014' + + def index + end +end diff --git a/app/controllers/fall2014/static_controller.rb b/app/controllers/fall2014/static_controller.rb new file mode 100644 index 0000000..9808495 --- /dev/null +++ b/app/controllers/fall2014/static_controller.rb @@ -0,0 +1,24 @@ +class Fall2014::StaticController < ApplicationController + layout 'fall2014' + + def index + @faqs = Faq.joins(:semesters).where(semesters: {season: "Fall", year: Date.new(2014)}) + @large_sponsors = Sponsor.joins(:semesters).where(semesters: {season: "Fall", year: Date.new(2014)}, tier: "large") + @medium_sponsors = Sponsor.joins(:semesters).where(semesters: {season: "Fall", year: Date.new(2014)}, tier: "medium") + @small_sponsors = Sponsor.joins(:semesters).where(semesters: {season: "Fall", year: Date.new(2014)}, tier: "small") + @mentors = Mentor.joins(:semesters).where(semesters: {season: "Fall", year: Date.new(2014)}).order(:sponsor_id).order(:partner_id) + render 'home' + end + + def gist + render 'gist' + end + + def fun + render 'fun' + end + + def speakers + render 'speakers' + end +end diff --git a/app/controllers/fall2014/widgets_controller.rb b/app/controllers/fall2014/widgets_controller.rb new file mode 100644 index 0000000..503b1d0 --- /dev/null +++ b/app/controllers/fall2014/widgets_controller.rb @@ -0,0 +1,7 @@ +class Fall2014::WidgetsController < ApplicationController + layout 'fall2014' + + def apply_team + render 'apply_team' + end +end \ No newline at end of file diff --git a/app/controllers/fall2014/winners_controller.rb b/app/controllers/fall2014/winners_controller.rb new file mode 100644 index 0000000..37e5867 --- /dev/null +++ b/app/controllers/fall2014/winners_controller.rb @@ -0,0 +1,9 @@ +class Fall2014::WinnersController < ApplicationController + layout 'fall2014' + + def index + @winners = Winner.all + @main_winners = Winner.where(:prize_type => "Main Prize") + @sponsor_winners = Winner.where(:prize_type => "Sponsor Prize") + end +end diff --git a/app/controllers/fall2015/courses_controller.rb b/app/controllers/fall2015/courses_controller.rb new file mode 100644 index 0000000..ad8f246 --- /dev/null +++ b/app/controllers/fall2015/courses_controller.rb @@ -0,0 +1,7 @@ +class Fall2015::CoursesController < ApplicationController + layout 'fall2015' + + def index + @courses = Course.joins(:semester).where(semesters: {season: "Fall", year: Date.new(2015)}) + end +end diff --git a/app/controllers/fall2015/events_controller.rb b/app/controllers/fall2015/events_controller.rb new file mode 100644 index 0000000..1cbb3c2 --- /dev/null +++ b/app/controllers/fall2015/events_controller.rb @@ -0,0 +1,10 @@ +class Fall2015::EventsController < ApplicationController + layout 'fall2015' + + def index + end + + def tech_talks + @events = Event.joins(:semester).where(semesters: {season: "Fall", year: Date.new(2015)}).order(:date).order(:start_time) + end +end diff --git a/app/controllers/fall2015/maps_controller.rb b/app/controllers/fall2015/maps_controller.rb new file mode 100644 index 0000000..7bcf5c3 --- /dev/null +++ b/app/controllers/fall2015/maps_controller.rb @@ -0,0 +1,7 @@ +class Fall2015::MapsController < ApplicationController + layout 'fall2015' + + def index + @maps = Map.all + end +end diff --git a/app/controllers/fall2015/media_controller.rb b/app/controllers/fall2015/media_controller.rb new file mode 100644 index 0000000..d86fb39 --- /dev/null +++ b/app/controllers/fall2015/media_controller.rb @@ -0,0 +1,10 @@ +class Fall2015::MediaController < ApplicationController + layout 'fall2015' + + def index + @media = Medium.all + @articles = Medium.where(:media_type => "Article") + @galleries = Medium.where(:media_type => "Gallery") + @videos = Medium.where(:media_type => "Video") + end +end diff --git a/app/controllers/fall2015/mentors_controller.rb b/app/controllers/fall2015/mentors_controller.rb new file mode 100644 index 0000000..6aa17bf --- /dev/null +++ b/app/controllers/fall2015/mentors_controller.rb @@ -0,0 +1,14 @@ +class Fall2015::MentorsController < ApplicationController + layout 'fall2015' + + def our_mentors + @mentors = Mentor.all + end + + def our_experts + @experts = Mentor.all + end + + def guidelines + end +end diff --git a/app/controllers/fall2015/organizers_controller.rb b/app/controllers/fall2015/organizers_controller.rb new file mode 100644 index 0000000..9c80e0e --- /dev/null +++ b/app/controllers/fall2015/organizers_controller.rb @@ -0,0 +1,7 @@ +class Fall2015::OrganizersController < ApplicationController + layout 'fall2015' + + def index + @organizers = Organizer.all + end +end \ No newline at end of file diff --git a/app/controllers/fall2015/partners_controller.rb b/app/controllers/fall2015/partners_controller.rb new file mode 100644 index 0000000..1fa5820 --- /dev/null +++ b/app/controllers/fall2015/partners_controller.rb @@ -0,0 +1,7 @@ +class Fall2015::PartnersController < ApplicationController + layout 'fall2015' + + def index + @partners = Partner.joins(:semesters).where({season: "Fall", year: Date.new(2015)}) + end +end diff --git a/app/controllers/fall2015/prizes_controller.rb b/app/controllers/fall2015/prizes_controller.rb new file mode 100644 index 0000000..e82b669 --- /dev/null +++ b/app/controllers/fall2015/prizes_controller.rb @@ -0,0 +1,7 @@ +class Fall2015::PrizesController < ApplicationController + layout 'fall2015' + + def index + @prizes = Prize.joins(:semester).where(semesters: {season: "Fall", year: Date.new(2015)}) + end +end diff --git a/app/controllers/fall2015/sponsors_controller.rb b/app/controllers/fall2015/sponsors_controller.rb new file mode 100644 index 0000000..926bd42 --- /dev/null +++ b/app/controllers/fall2015/sponsors_controller.rb @@ -0,0 +1,6 @@ +class Fall2015::SponsorsController < ApplicationController + layout 'fall2015' + + def index + end +end diff --git a/app/controllers/fall2015/static_controller.rb b/app/controllers/fall2015/static_controller.rb new file mode 100644 index 0000000..615a98d --- /dev/null +++ b/app/controllers/fall2015/static_controller.rb @@ -0,0 +1,24 @@ +class Fall2015::StaticController < ApplicationController + layout 'fall2015' + + def index + @faqs = Faq.joins(:semesters).where(semesters: {season: "Fall", year: Date.new(2015)}) + @large_sponsors = Sponsor.joins(:semesters).where(semesters: {season: "Fall", year: Date.new(2015)}, tier: "large") + @medium_sponsors = Sponsor.joins(:semesters).where(semesters: {season: "Fall", year: Date.new(2015)}, tier: "medium") + @small_sponsors = Sponsor.joins(:semesters).where(semesters: {season: "Fall", year: Date.new(2015)}, tier: "small") + @mentors = Mentor.joins(:semesters).where(semesters: {season: "Fall", year: Date.new(2015)}).order(:sponsor_id).order(:partner_id) + render 'home' + end + + def gist + render 'gist' + end + + def fun + render 'fun' + end + + def speakers + render 'speakers' + end +end diff --git a/app/controllers/fall2015/widgets_controller.rb b/app/controllers/fall2015/widgets_controller.rb new file mode 100644 index 0000000..2ffb2a0 --- /dev/null +++ b/app/controllers/fall2015/widgets_controller.rb @@ -0,0 +1,7 @@ +class Fall2015::WidgetsController < ApplicationController + layout 'fall2015' + + def apply_team + render 'apply_team' + end +end \ No newline at end of file diff --git a/app/controllers/fall2015/winners_controller.rb b/app/controllers/fall2015/winners_controller.rb new file mode 100644 index 0000000..3e46594 --- /dev/null +++ b/app/controllers/fall2015/winners_controller.rb @@ -0,0 +1,9 @@ +class Fall2015::WinnersController < ApplicationController + layout 'fall2015' + + def index + @winners = Winner.all + @main_winners = Winner.where(:prize_type => "Main Prize") + @sponsor_winners = Winner.where(:prize_type => "Sponsor Prize") + end +end diff --git a/app/controllers/spring2014/events_controller.rb b/app/controllers/spring2014/events_controller.rb index 1907340..919e0b9 100644 --- a/app/controllers/spring2014/events_controller.rb +++ b/app/controllers/spring2014/events_controller.rb @@ -1,5 +1,9 @@ class Spring2014::EventsController < ApplicationController layout 'spring2014' + + def index + @events = Event.all + end def brainstorm @events = Event.all diff --git a/app/controllers/spring2014/media_controller.rb b/app/controllers/spring2014/media_controller.rb index 7c7b016..10a86f4 100644 --- a/app/controllers/spring2014/media_controller.rb +++ b/app/controllers/spring2014/media_controller.rb @@ -1,3 +1,10 @@ class Spring2014::MediaController < InheritedResources::Base layout 'spring2014' + + def index + @media = Medium.all + @articles = Medium.where(:media_type => "Article") + @galleries = Medium.where(:media_type => "Gallery") + @videos = Medium.where(:media_type => "Video") + end end diff --git a/app/controllers/spring2014/mentors_controller.rb b/app/controllers/spring2014/mentors_controller.rb index 7cd2f98..85e7933 100644 --- a/app/controllers/spring2014/mentors_controller.rb +++ b/app/controllers/spring2014/mentors_controller.rb @@ -8,4 +8,7 @@ def our_mentors def our_experts @experts = Mentor.all end + + def guidelines + end end diff --git a/app/controllers/spring2014/widgets_controller.rb b/app/controllers/spring2014/widgets_controller.rb index d050791..3c28b03 100644 --- a/app/controllers/spring2014/widgets_controller.rb +++ b/app/controllers/spring2014/widgets_controller.rb @@ -4,4 +4,8 @@ class Spring2014::WidgetsController < ApplicationController def apply_team render 'apply_team' end + + def mentor_info + render 'mentor_info' + end end \ No newline at end of file diff --git a/app/controllers/spring2014/winners_controller.rb b/app/controllers/spring2014/winners_controller.rb index 3c47aee..33a59b9 100644 --- a/app/controllers/spring2014/winners_controller.rb +++ b/app/controllers/spring2014/winners_controller.rb @@ -1,3 +1,9 @@ class Spring2014::WinnersController < ApplicationController layout 'spring2014' + + def index + @winners = Winner.all + @main_winners = Winner.where(:prize_type => "Main Prize") + @sponsor_winners = Winner.where(:prize_type => "Sponsor Prize") + end end diff --git a/app/models/concerns/matchable.rb b/app/models/concerns/matchable.rb index c5b5a3a..aa35704 100644 --- a/app/models/concerns/matchable.rb +++ b/app/models/concerns/matchable.rb @@ -8,4 +8,13 @@ def match?(season, year) end return false end + + def match_one?(season, year) + semester = self.semester + if semester != nil && semester.season == season && semester.year.strftime("%Y") == year.to_s + return true + end + return false + end + end \ No newline at end of file diff --git a/app/models/course.rb b/app/models/course.rb index 921786c..8d1e8cd 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -1,4 +1,6 @@ class Course < ActiveRecord::Base + # concerns + include Matchable # relations belongs_to :semester diff --git a/app/models/event.rb b/app/models/event.rb index 0872a20..fff4a06 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,7 +1,12 @@ class Event < ActiveRecord::Base + # concerns + include Matchable + include Markdownable # relations belongs_to :semester + has_and_belongs_to_many :mentors + belongs_to :sponsor #validations validates :name, presence: true diff --git a/app/models/mentor.rb b/app/models/mentor.rb index 4d56c8b..f7e96b1 100644 --- a/app/models/mentor.rb +++ b/app/models/mentor.rb @@ -8,8 +8,8 @@ class Mentor < ActiveRecord::Base has_and_belongs_to_many :semesters belongs_to :partner belongs_to :sponsor + has_and_belongs_to_many :events #validations validates :name, presence: true - validates :image_url, presence: true end diff --git a/app/views/fall2014/courses/index.html.erb b/app/views/fall2014/courses/index.html.erb new file mode 100644 index 0000000..c706aee --- /dev/null +++ b/app/views/fall2014/courses/index.html.erb @@ -0,0 +1,38 @@ +
      +
      +

      Crash Courses

      +
      + <% @courses.each do |c| %> +
      +
      + +
      +
      + <% if c.instructors.count == 2 %> +

      Instructors

      + <% c.instructors.each do |i| %> +
      + +

      <%= i.name %>

      +
      + <% end %> + <% end %> + <% if c.instructors.count == 1 %> +

      Instructor

      + <% c.instructors.each do |i| %> +
      + +

      <%= i.name %>

      +
      + <% end %> + <% end %> +
      + <% if c.date != nil %> +

      <%= c.date.strftime("%A, %B %d") %> | <%= c.start_time.strftime("%l:%M %p") %> to <%= c.end_time.strftime("%l:%M %p") %> | <%= c.location %>

      + <% end %> + Register +
      + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/events/index.html.erb b/app/views/fall2014/events/index.html.erb new file mode 100644 index 0000000..82d83a5 --- /dev/null +++ b/app/views/fall2014/events/index.html.erb @@ -0,0 +1,6 @@ +
      +
      +

      Schedule

      + +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/events/tech_talks.html.erb b/app/views/fall2014/events/tech_talks.html.erb new file mode 100644 index 0000000..e73b7b3 --- /dev/null +++ b/app/views/fall2014/events/tech_talks.html.erb @@ -0,0 +1,77 @@ +
      +
      +

      Tech Talks

      +
      + <% @events.each do |c| %> +
      +
      + +
      +
      + <% if c.mentors.count == 3 %> +

      Speakers

      + <% c.mentors.each do |i| %> + <% if i.image_url == "" %> +
      + +

      <%= i.name %>

      +
      + <% else %> +
      + +

      <%= i.name %>

      +
      + <% end %> + <% end %> + <% end %> + + <% if c.mentors.count == 2 %> +

      Speakers

      + <% c.mentors.each do |i| %> + <% if i.image_url == "" %> +
      + +

      <%= i.name %>

      +
      + <% else %> +
      + +

      <%= i.name %>

      +
      + <% end %> + <% end %> + <% end %> + <% if c.mentors.count == 1 %> +

      Speaker

      + <% c.mentors.each do |i| %> + <% if i.image_url == "" %> +
      + +

      <%= i.name %>

      +
      + <% else %> +
      + +

      <%= i.name %>

      +
      + <% end %> + <% end %> + <% end %> + <% if c.sponsor != nil %> +
      + +
      + <% end %> +
      + <% if c.date != nil %> +

      <%= c.date.strftime("%A, %B %d") %> | <%= c.start_time.strftime("%l:%M %p") %> to <%= c.end_time.strftime("%l:%M %p") %> | <%= c.location %>

      + <% end %> + <% if c.html_content != "" %> +

      Learn More

      +
      <%= c.html_content.html_safe %>
      + <% end %> +
      + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/faqs/_faq.html.erb b/app/views/fall2014/faqs/_faq.html.erb new file mode 100644 index 0000000..b66288d --- /dev/null +++ b/app/views/fall2014/faqs/_faq.html.erb @@ -0,0 +1,2 @@ +

      <%= faq.question %>

      +<%= faq.html_content.html_safe %> \ No newline at end of file diff --git a/app/views/fall2014/maps/index.html.erb b/app/views/fall2014/maps/index.html.erb new file mode 100644 index 0000000..3ebf31e --- /dev/null +++ b/app/views/fall2014/maps/index.html.erb @@ -0,0 +1,10 @@ +
      +
      + <% @maps.each do |m| %> + <% if m.semester.season == "Spring" && m.semester.year.year == 2014 %> +

      <%= m.name %>

      + + <% end %> + <% end %> +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/media/index.html.erb b/app/views/fall2014/media/index.html.erb new file mode 100644 index 0000000..ed89669 --- /dev/null +++ b/app/views/fall2014/media/index.html.erb @@ -0,0 +1,41 @@ +
      +
      +

      Media Coverage

      +
      +
      + +
      + <% @articles.each do |a| %> + <% if a.semester.season == "Spring" && a.semester.year.year == 2014 %> + + <% end %> + <% end %> +
      +
      +
      + +
      + <% @galleries.each do |g| %> + <% if g.semester.season == "Spring" && g.semester.year.year == 2014 %> + + <% end %> + <% end %> +
      +
      +
      + +
      + <% @videos.each do |v| %> + <% if v.semester.season == "Spring" && v.semester.year.year == 2014 %> +
      + <%= v.iframe_html.html_safe %> +
      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/mentors/_mentor.html.erb b/app/views/fall2014/mentors/_mentor.html.erb new file mode 100644 index 0000000..3b81584 --- /dev/null +++ b/app/views/fall2014/mentors/_mentor.html.erb @@ -0,0 +1,28 @@ +
      + <% if Partner.exists?(mentor.partner) %> + <% if mentor.image_url == "" + %> + + <% else %> + + <% end %> +

      <%= mentor.name %>

      + + <% elsif Sponsor.exists?(mentor.sponsor) %> + <% if mentor.image_url == "" %> + + <% else %> + + <% end %> +

      <%= mentor.name %>

      + + <% else %> + <% if mentor.image_url == "" %> + + <% else %> + + <% end %> +

      <%= mentor.name %>

      + <% end %> + +
      \ No newline at end of file diff --git a/app/views/fall2014/mentors/guidelines.html.erb b/app/views/fall2014/mentors/guidelines.html.erb new file mode 100644 index 0000000..e0e0727 --- /dev/null +++ b/app/views/fall2014/mentors/guidelines.html.erb @@ -0,0 +1,65 @@ +
      +
      +

      Mentorship Guidelines

      +
      +
      + +
      +
        +
      1. Take time to think about the problems that your specific track faces with the distribution, analysis and visualization of information.
      2. +
      3. Check out our blog, the challenges that the community of Durham have worked together to create and the datasets available!
      4. +
      5. Get excited!
      6. +
      +
      + +
      +

      Location, Parking & Schedule?

      +

      + Arrive at 10:30am on Saturday to help your recruiter set up the table. 11:00am is when lunch starts and students will be walking around and getting to know you. This will go on for an hour until we will start ushering people to walk over to Griffith Auditorium for the opening ceremony. If you are not a software engineering mentor associated with a company, I would suggest you go to the Code for Durham table. +
      +
      + The exact location, where to park and detailed Google maps directions can all be found here. The schedule can be found here. +

      +

      How do I best engage with the participants?

      +

      + Join the HackDuke 2014 Participants Facebook Page! Typically, day of, hackers will be posting on the Facebook group or Tweeting to find the mentors who will be able to help them out if they can't immediately find you in person, so check back! Most of the hacking will be taking place in either the atrium of CIEMAS or Schiciano Auditorium. +
      +
      + Don't be afraid to approach the participants, and don't stay at your company table 24/7. We strongly encourage you to walk around, talk to the hackers, ask them questions and help them out with their hacks. We will be encouraging them to come and interact with you, but remember, it takes two to tango (and create some awesome hacks!). + +

      +

      Novices?

      +

      + We do have a track specifically for novices, and a space (Schiciano Auditorium) specifically for them as well. If you've marked that you want to help out novices, please make it a point to visit Schiciano Auditorium every once in a while. You are free to help them with their hacks to your best judgement. This means if a group is having trouble with their dev environment, or having trouble setting up your API and this is their first time at a hackathon or this is their first exposure to computer science, it is not against the rules to give them a little boost. +

      +

      Opening Ceremony API Flash talks and Tech talks?

      +

      + The lineup for the opening ceremony API flash talks is here, under the Opening Ceremony tab. All companies have a maximum of 3 minutes to demo. Please format your presentation to that time constraint. If we run over time, this will negatively impact our schedule for tech talks. +
      +
      + Those mentors who are giving a tech talk should be checking here to find out where and when they are talking. +

      +

      Judging & Prizes?

      +

      + We hope all of you will be able to make it back on Sunday for the expo and judging. The judging for our hackathon will be a little bit different. We will be deciding a winner and one runner up for each track during the expo. There will not be a special judging portion to decide the final winners during the closing ceremony. We will be using ChallengePost to do our hack submissions. +
      +
      + The expo will be split into 2 sections. Poverty & Inequality and Education will be the first segment. Health & Wellness and Energy & Environment will be the second. For companies who have API prizes, we will give you a list of all hacks related to your prize track, but we also expect you to help us judge the Grand Prize winners and the Novice winner after you've done that. We will be giving the rest of the mentors table numbers a few at a time to check out and indicators of whether these hacks are also novice hacks. +
      +
      + Judge the hacks based off of: +

        +
      • Problem +
        + Understanding of the community the hack is aimed at, Understanding of the problem attempting to be solved, Extent to which the problem is solved or mediated
      • +
      • Technical +
        + Technical ingenuity and ambition, Project difficulty
      • +
      • Viability +
        + Ability for the hack to be utilized in the real world, Long term usefulness of the hack
      • +
      +

      +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/mentors/our_experts.html.erb b/app/views/fall2014/mentors/our_experts.html.erb new file mode 100644 index 0000000..cbcad60 --- /dev/null +++ b/app/views/fall2014/mentors/our_experts.html.erb @@ -0,0 +1,18 @@ +
      +
      +

      Meet Our Non-Profit Experts

      +
      + <% @experts.each do |e| %> + <% if Partner.exists?(e.partner) %> +
      + +

      <%= e.name %>

      +

      Track: <%= e.partner.track %>

      +

      Focus: <%= e.partner.focus %>

      + +
      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/mentors/our_mentors.html.erb b/app/views/fall2014/mentors/our_mentors.html.erb new file mode 100644 index 0000000..ed91b1c --- /dev/null +++ b/app/views/fall2014/mentors/our_mentors.html.erb @@ -0,0 +1,16 @@ +
      +
      +

      Meet Our Tech Mentors

      +
      + <% @mentors.each do |m| %> + <% if Sponsor.exists?(m.sponsor) %> +
      + +

      <%= m.name %>

      + +
      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/organizers/index.html.erb b/app/views/fall2014/organizers/index.html.erb new file mode 100644 index 0000000..19c119f --- /dev/null +++ b/app/views/fall2014/organizers/index.html.erb @@ -0,0 +1,28 @@ +
      +
      +

      Meet Our Team

      +
      + <% @organizers.each do |o| %> + <% if o.admin == false && o.match?("Fall", 2014) %> +
      + +

      <%= o.name %>

      +
      + <% end %> + <% end %> +
      +
      +
      +

      Thanks To Our Faculty

      +
      + <% @organizers.each do |o| %> + <% if o.admin == true && o.match?("Fall", 2014)%> +
      + +

      <%= o.name %>

      +
      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/partners/_partner.html.erb b/app/views/fall2014/partners/_partner.html.erb new file mode 100644 index 0000000..45c4d54 --- /dev/null +++ b/app/views/fall2014/partners/_partner.html.erb @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/app/views/fall2014/prizes/index.html.erb b/app/views/fall2014/prizes/index.html.erb new file mode 100644 index 0000000..65b4566 --- /dev/null +++ b/app/views/fall2014/prizes/index.html.erb @@ -0,0 +1,57 @@ +
      +
      +

      Prizes

      +
      +
      + +
      +

      There will be one grand prize winning hack for each track.
      The team that best addresses the issues of that respective track will be awarded $750 to a track-related non-profit of their choice.

      + <% @prizes.each do |p| %> + <% if p.api == false %> +
      +

      <%= p.title %>

      +
      <%= p.html_content.html_safe %>
      + <% if p.sponsor != nil %> +

      Sponsored by

      + + <% end %> +
      + <% end %> + <% end %> +
      + +
      +
      + +
      +

      There will be a prize for those who are new to programming or attending a hackathon for the first time. The team or individual that creates the best hack that addresses any of the tracks of impact above and meet the requirements for being a novice will be awarded $250 to donate to a non-profit of their choice.

      +
      +
      +
      + +
      + <% @prizes.each do |p| %> + <% if p.api == true %> +
      + + + +

      <%= p.title %>

      +
      <%= p.html_content.html_safe %>
      +
      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/sponsors/_sponsor.html.erb b/app/views/fall2014/sponsors/_sponsor.html.erb new file mode 100644 index 0000000..7dba00c --- /dev/null +++ b/app/views/fall2014/sponsors/_sponsor.html.erb @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/app/views/fall2014/static/_about.html.erb b/app/views/fall2014/static/_about.html.erb new file mode 100644 index 0000000..8523006 --- /dev/null +++ b/app/views/fall2014/static/_about.html.erb @@ -0,0 +1,73 @@ +
      +
      + +
      +
      +
      +
      + 1. +
      +
      +
      +
      + Collaboration, not competition +
      +
      + HackDuke is not just about building meaningful projects. It's also an open forum to discuss, share and bring to life ideas that aim to make a positive impact on social issues. Look forward to working with experts from non-profits and coding alongside mentors from tech companies! +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      + 2. +
      +
      +
      +
      + Exploring the intersection between technology and social good +
      +
      + HackDuke welcomes anyone who has passion. If you don’t know how to code, fret not! We are open to people of all majors who are interested in how technology can be used to promote social change. +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      + 3. +
      +
      +
      +
      Giving back
      +
      + HackDuke encourages students to venture beyond the classroom. Learn how your skills can be used to make a difference other people’s lives. +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      + + +
      + \ No newline at end of file diff --git a/app/views/fall2014/static/_api_credits.html.erb b/app/views/fall2014/static/_api_credits.html.erb new file mode 100644 index 0000000..1bfe443 --- /dev/null +++ b/app/views/fall2014/static/_api_credits.html.erb @@ -0,0 +1,39 @@ +
      +
      + +

      SendGrid API

      + +

      Citrix/ShareFile API

      +

      API Accounts (one per team)

      + +

      Twilio API

      +

      $25 Credit (use HACKDUKE)

      + +

      Duke University APIs

      + +

      Socrata API

      + +

      IBM Bluemix Platform

      + +

      Versal API

      +
      +
      + +

      Amazon AWS Credits

      +

      $100 Credit

      + + +

      Microsoft Azure Web API & Microsoft BizSpark

      + +
      + +
      + +
      + +
      + +
      +

      eBay APIs

      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/static/_datasets.html.erb b/app/views/fall2014/static/_datasets.html.erb new file mode 100644 index 0000000..9ea6408 --- /dev/null +++ b/app/views/fall2014/static/_datasets.html.erb @@ -0,0 +1,26 @@ +
      + + +
      +

      + Much thanks to Socrata and Code For Durham for organizing and providing the open data portal! +

      +
      +
      +
      + +

      Poverty & Inequality

      +
      +
      + +

      Education

      +
      +
      + +

      Health & Wellness

      +
      +
      + +

      Energy & Environment

      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/static/_eco.html.erb b/app/views/fall2014/static/_eco.html.erb new file mode 100644 index 0000000..4c64002 --- /dev/null +++ b/app/views/fall2014/static/_eco.html.erb @@ -0,0 +1,11 @@ +
      + +

      + Much thanks to Red Ventures for sponsoring this initative! +
      +
      + In order to be more enviromentally friendly, HackDuke is no longer buying bottled water. Instead, we're providing HackKitty water bottles and 8 water coolers in an effort to save plastic! +

      + + +
      \ No newline at end of file diff --git a/app/views/fall2014/static/_ladies.html.erb b/app/views/fall2014/static/_ladies.html.erb new file mode 100644 index 0000000..443efaf --- /dev/null +++ b/app/views/fall2014/static/_ladies.html.erb @@ -0,0 +1,22 @@ +
      + +
      + +

      + Much thanks to Microsoft for sponsoring this event! +
      +
      + Meet all the local Duke/UNC and NCState lady hacker participants and some lady mentors before the fun begins! +
      +
      + Have awesome one on one conversations with some of the best, brightest and most passionate female hackers as well as some of the most successful female software engineers and designers in the tech industry over dinner. +

      + RSVP +
      +
      + +

      + Go to Twinnies to get to know others from the Ladies Storm Hackathons community as well as the female mentors that are at the event! +

      + RSVP +
      \ No newline at end of file diff --git a/app/views/fall2014/static/_massages.html.erb b/app/views/fall2014/static/_massages.html.erb new file mode 100644 index 0000000..83e5d53 --- /dev/null +++ b/app/views/fall2014/static/_massages.html.erb @@ -0,0 +1,4 @@ +
      + +

      Much thanks to our sponsors SendGrid for providing us with massage therapists to relieve and tension and stress at the event!

      +
      \ No newline at end of file diff --git a/app/views/fall2014/static/_nav.html.erb b/app/views/fall2014/static/_nav.html.erb new file mode 100644 index 0000000..4e8e7db --- /dev/null +++ b/app/views/fall2014/static/_nav.html.erb @@ -0,0 +1,71 @@ + \ No newline at end of file diff --git a/app/views/fall2014/static/_nerf.html.erb b/app/views/fall2014/static/_nerf.html.erb new file mode 100644 index 0000000..8b57c23 --- /dev/null +++ b/app/views/fall2014/static/_nerf.html.erb @@ -0,0 +1,11 @@ +
      + + +

      + Much thanks to eBay and Milo for sponsoring this event! +
      +
      + As always, we're hosting Nerf Gun Wars downstairs in CIEMAS basement from 10:00PM to 11:00PM. We'll be providing guns and ammo, but feel free to come equipped with your own arsenal! +

      + +
      \ No newline at end of file diff --git a/app/views/fall2014/static/fun.html.erb b/app/views/fall2014/static/fun.html.erb new file mode 100644 index 0000000..7595d9f --- /dev/null +++ b/app/views/fall2014/static/fun.html.erb @@ -0,0 +1,36 @@ +
      +
      +

      Datasets

      + <%= render "datasets" %> +
      +
      +
      +
      +

      APIs & Credits

      + <%= render "api_credits" %> +
      +
      +
      +
      +

      Eco-Friendliness

      + <%= render "eco" %> +
      +
      +
      +
      +

      Massages

      + <%= render "massages" %> +
      +
      +
      +
      +

      Ladies Night

      + <%= render "ladies" %> +
      +
      +
      +
      +

      Nerf Gun Wars

      + <%= render "nerf" %> +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/static/gist.html.erb b/app/views/fall2014/static/gist.html.erb new file mode 100644 index 0000000..ef861ee --- /dev/null +++ b/app/views/fall2014/static/gist.html.erb @@ -0,0 +1,32 @@ +
      +
      +

      The Gist

      +

      HackDuke is all about coding for social good. We emphasize collaboration, not competition and this reflects in the structure of our event. This is what you should expect from HackDuke on Saturday!

      +
      +

      Every participant must partake in at least two brainstorming/ideation sessions with non-profits.

      +

      We can not stress how crucial this part is to our event. The brainstorming phase takes place from 1:30PM to 4:00PM right after opening ceremony. Each non-profit has 30 minute sessions to describe their mission as well as go into further detail about the challenges that they are facing. This discussion will be led by the non-profit experts and mediated software engineering mentors.

      +

      The challenges, as well as the times of when these sessions are going can be found here. Regardless of whether you will be working on your own idea, you should still attend the brainstorming sessions. We believe that interaction with real experts from non-profits adds an amazing educational value to our social good hackathon.

      +

      To top it off, hacking will not start until the brainstorming sessions are over. Additionally, you will not be able to get a HackDuke t-shirt (or most of any swag for that matter) if you do not attend at least 2 brainstorming sessions. (Yes, it's that important. ;D)

      +
      +
      +
      +

      Use Saturday lunch as an opportunity to meet new people.

      +

      We're having Noodles & Co for lunch! As you're munching on yummy noodles, reach out to people that you've never met before, whether it be a non-profit expert, software engineering mentor or a fellow student from another university.

      +
      +
      +

      Don't be afraid to grab a mentor or an expert and discuss your idea with them!

      +

      Our mentors and experts are here to help! Whether it be a general question about a social issue or a challenge, or frustration over getting a line of code to work, you can always count on our mentors and experts for assistance!

      +
      +
      +
      +
      +

      Tech Talks will be during dinner!

      +

      Think of it like dinner and a movie! We have some awesome mentors from Google, Palantir and the Resolution Project ready to talk about how they've used technology to improve the world.

      +
      +
      +

      Almost all prizes will be donations to charity.

      +

      HackDuke wants to help out the community as much as possible and therefore, we've made the decisions that the prizes will be donations to a charity of the winning team's choice.

      +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/static/home.html.erb b/app/views/fall2014/static/home.html.erb new file mode 100644 index 0000000..cba6534 --- /dev/null +++ b/app/views/fall2014/static/home.html.erb @@ -0,0 +1,123 @@ +
      +
      + <%= image_tag "fall2014/badge.svg" %> +
      +
      + <%= image_tag "fall2014/profx.svg" %> +
      + +
      +
      +
      +

      In collaboration with

      +
      +
      + +
      +
      + +
      +
      + +
      +
      + +
      +
      + +
      +
      +
      +
      + <%= image_tag "fall2014/wolverine.svg" %> +
      +
      +
      +
      +

      HackDuke is about

      + <%= render "about" %> +
      + <%= image_tag "fall2014/storm.svg" %> +
      +
      +
      +
      +
      +

      FAQ

      +
      + <% @faqs.in_groups(3, false) do |fg| %> +
      + <% fg.each do |f| %> + <%= render f %> + <% end %> +
      + <% end %> +
      +
      +
      + <%= image_tag "fall2014/jean-grey.svg" %> +
      +
      +
      +
      +

      Mentors

      +
      + <% @mentors.each do |m| %> + <%= render m %> + <% end %> +
      +
      +

      This sounds awesome! I want to

      + +
      +
      +
      +
      +
      +

      Sponsors

      +
      + <% @large_sponsors.each do |s| %> + <%= render s %> + <% end %> +
      +
      + <% @medium_sponsors.each do |s| %> + <%= render s %> + <% end %> +
      +
      + <% @small_sponsors.each do |s| %> + <%= render s %> + <% end %> +
      +
      +

      This sounds awesome! I want to

      + +
      +
      +
      +
      +
      +

      Partners

      +
      + <% Partner.all.each do |p| %> + <% if p.partnership_type == "University Partner" %> + <%= render p %> + <% end %> + <% end %> +
      +
      +
      diff --git a/app/views/fall2014/static/speakers.html.erb b/app/views/fall2014/static/speakers.html.erb new file mode 100644 index 0000000..7fced55 --- /dev/null +++ b/app/views/fall2014/static/speakers.html.erb @@ -0,0 +1,33 @@ +
      +
      +

      Opening Ceremony Speakers

      +
      +
      + + +

      Bill Bell

      +

      + Bill Bell is the current mayor of Durham, North Carolina. Mr. Bell holds a Bachelor of Science and Master's degree in Electrical Engineering from Howard University and New York University, respectively. Formerly a senior engineer for IBM, Bell was first elected to the Durham County Board of Commissioners in 1972, where he served until 1994, and again from 1996 to 2000. Bell is currently Executive Vice President and Chief Operating Officer of UDI Community Development Corp., a non-profit organization. +

      +
      +
      +
      +
      + + +

      Jesse Lipson

      +

      + Jesse is the VP & GM of Data Sharing for Citrix, which acquired ShareFile in 2011. ShareFile is a file-transfer service built for business users who need secure, reliable and easy tools for sharing data. Jesse launched ShareFile in 2005 and bootstrapped the company from zero to four million users in six years; today Citrix ShareFile has 13 million users in 100 countries. As a founding partner of HUB Raleigh, he's particularly interested in helping the Research Triangle area become a top-five region for entrepreneurship and innovation in the U.S. He holds a degree in philosophy from Duke University. +

      +
      +
      + + +

      Kyle Bradbury

      +

      + Kyle brings experience in machine learning and statistical modeling to energy problems. He completed his Ph.D. at Duke University, with research focused on modeling the reliability and cost trade-offs of energy storage systems for integrating wind and solar power into the grid. Kyle holds a M.S. in Electrical Engineering from Duke University where he specialized in statistical signal processing and machine learning, and a B.S. in Electrical Engineering from Tufts University. He has worked for ISO New England, MIT Lincoln Laboratories, and Dominion. +

      +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/static/travel.html.erb b/app/views/fall2014/static/travel.html.erb new file mode 100644 index 0000000..fa9367b --- /dev/null +++ b/app/views/fall2014/static/travel.html.erb @@ -0,0 +1,231 @@ +
      +
      +

      Travel

      +
      +
      +

      Some of you may be asking: "How the flippity do I get to HackDuke?"
      Here's the page that will answer all your questions!

      +
      +
      +

      Where is the hackathon taking place?

      +

      + The Fitzpatrick Center for Interdisciplinary Engineering, Medicine and Applied Sciences (FCIEMAS) +
      101 Science Drive +
      Durham, NC 27708 +

      +
      +
      +
      +
      + +
      +
      +

      Saturday Parking Instructions & FAQ

      +

      + Because there is a football game against Virginia Tech on Saturday, Duke will go into checkpoint mode at 9:00AM. Participants, mentors and sponsors will also not be allowed to park in PG4/Bryan Center, where guests usually park on non-football game days. +

      +

      How do I get onto campus?

      +

      + You must get onto campus via the intersection of Erwin Road and Research Drive. + Here are directions to where you need to go in order to get as close to CIEMAS as possible. +

      +

      Where do I park?

      +

      + All vehicles must park in the R1 Lot, on the intersection of Hillsbourough Road and Carolina Avenue. This lot is behind the Harris Teeter. +

      +

      How do I get to the venue from the lot?

      +

      + Since this location is quite a distance from FCIEMAS, we will be providing a shuttle from the parking lot to FCIEMAS in the morning, that will follow these directions to get to FCIEMAS. +

      +

      How do I get back to the lot from the venue?

      +

      + For anyone who needs to get back to the lot during the event, they can order an Uber. We will only be providing shuttles in the morning. +
      +
      + You may head out at 9 p.m. or stay hacking until the wee hours of the morning, but whenever you need to head home from HackDuke, Uber's got you covered. With fares 38% lower than a taxi on average, there's no cheaper way to get around the Triangle - and if you sign up now using code HackDuke, your first ride will be FREE (up to $20)! +

      +

      What do I do if I have passengers and/or swag to drop off?

      +

      + If you are bus driver and have any items or people to drop off for the event, you must enter Duke via Erwin Road & Research Drive. +

      +

      + Then, make your way towards Telecom Drive. This will bring you at the back of FCIEMAS. We will have a volunteer assist you when you get to the dropoff point. +

      +

      + Finally, you should make your way to the parking area. The directions are here. +

      +
      +
      +

      Sunday Parking Instructions & FAQ

      +

      + Because the football game would have ended by Sunday (thank god), visitors are now allowed to park in the PG4/Bryan Center lot. You may also now enter campus on the intersection of Science Drive and Towerview Road. +

      +

      So where do I park?

      +

      + Participants, mentors and sponsors can park their cars in the PG4/Bryan Center lot. There is a parking fee of $5. Cash only. +

      +

      How do I get to the venue from the lot?

      +

      + Walking to FCIEMAS from the PG4/Bryan Center lot is easy. Here are the directions. +

      +

      What if I'm still parked in the R1 lot from yesterday?

      +

      + We are only providing shuttles for Saturday morning transportation. Therefore, you can take an Uber to get to the lot whenever you wish on Sunday. +

      +
      +
      +
      +
      + +
      +
      +

      Duke Students

      +

      Walk to FCIEMAS if you're living on West Campus. Take the C1 if you're living on East Campus, C2 if you're living on Central Campus and head to the Engineering Quad.

      +
      +
      +

      UNC Students

      +

      Take the Roberson Scholar Express bus to Duke. The bus fare and details can be found here and the bus schedule can be found here.

      +
      +
      +

      NC State Students

      +

      Find a carpool or split an Uber/Lyft with participants from your school to drive to Duke. Directions can be found here.

      +
      +
      +
      +
      + +
      +
      +

      + + + Here are the universities that we are sending buses to and the times that they will be picking you up. You do not have a seat on the bus if you have not registered and confirmed your application for HackDuke. Speak with one of the student bus coordinators to double check on your status. And lastly, please be respectful of the bus, the driver and the student coordinator. The student bus coordinator reserves all rights to withhold your seat on the bus. +

      +
      +
      +
      +

      Joint Bus for FSU & Georgia Tech

      +

      Head Bus Coordinator: Diva Hurtado

      +

      Departure at 12:00 AM, Saturday Morning

      +

      + Florida State University +
      + Strozier Library +
      + 116 Honors Way +
      + Tallahassee, FL 32306 +

      +

      Head Bus Coordinator: Pavleen Thukral

      +

      Departure at 5:00 AM, Saturday Morning

      +

      + Georgia Institute of Technology +
      + Clough Undergraduate Learning Commons +
      + 266 4th St NW +
      + Atlanta, GA 30313 +

      +
      +
      +

      Joint Bus for UIUC & Purdue

      +

      Head Bus Coordinator: Lily Sellers

      +

      Departure at 10:00 PM, Friday Night

      +

      + University of Illinois at Urbana-Champaign +
      + Siebel Center +
      + 201 N Goodwin Ave +
      + Urbana, IL 61801 +

      +

      Head Bus Coordinator: Kirby Kohlmorgen

      +

      Departure at 12:00 AM, Saturday Morning

      +

      + Purdue University +
      + Lawson Hall of Computer Science +
      + 305 N University St +
      + West Lafayette, IN 47907 +

      +
      +
      +

      Joint Bus for Waterloo & McMaster

      +

      Head Bus Coordinator: Keri Warr

      +

      Departure at 9:00 PM, Friday Night

      +

      + University of Waterloo +
      + Ring Rd +
      + Waterloo, ON N2L 3G1 +

      +

      Head Bus Coordinator: Jimmy Wang

      +

      Departure at 10:30 PM, Friday Night

      +

      + McMaster University +
      + 1309 Main St +
      + W Hamilton, ON L8S 1C5 +

      +
      +
      +
      +
      +

      Bus for VTech

      +

      Head Bus Coordinator: Brandon Potts

      +

      Departure at 7:30 AM, Saturday Morning

      +

      + Virginia Tech +
      + Newman Library +
      + 560 Drillfield Dr +
      + Blacksburg, VA 24061 +

      +
      +
      +

      Bus for UMD

      +

      Head Bus Coordinator: Ibrahim Hashme

      +

      Departure at 6:00 AM, Saturday Morning

      +

      + University of Maryland at College Park +
      + Computer Science Instructional Center +
      + 4146 Paint Branch Drive +
      + College Park, MD 20740 +

      +
      +
      +
      +
      +
      + +
      +
      +

      Unfortunately, because our venue has a limit of 500 participants and we have a limited amount of funding, we can't get all 1200+ of our registrants to come to HackDuke. +

      Registrants who go to schools that do not have a bus provided for them and are out of state will be selected to participate in HackDuke. +

      These participants, who will most likely be traveling by plane, will be eligible for a reimbursement of up to $200. +
      They will be notified by email by October 19th about their status and will have until October 26th to confirm their spot and whether they need travel reimbursement. +

      If you did not get an email regarding confirmation of participation, you can opt to be put on the waitlist, so that when we find out that we have room for more participants, we will be selecting from the waitlist. +

      +
      +
      +

      If you have gotten an email about participating at HackDuke, welcome! The next steps should be broken down to you in the email, but to reiterate, you need to:

      +
        +
      1. Confirm that you are coming to HackDuke and you need travel reimbursement by October 26th.
      2. +
      3. Fill out the W9 form and upload it to your personalized registration link by November 22nd. This is absolutely crucial for your travel reimbursement.
      4. +
      5. Buy your tickets and upload it to your personalized registration link by November 22nd. This is also absolutely crucial for your travel reimbursement.
      6. +
      7. If you are an international student and do not have a social security number, we need a copy of your passport, visa and letter from the university stating your are in good standing by November 22nd.
      8. +
      +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/widgets/apply_team.html b/app/views/fall2014/widgets/apply_team.html new file mode 100644 index 0000000..0628d09 --- /dev/null +++ b/app/views/fall2014/widgets/apply_team.html @@ -0,0 +1,139 @@ +
      +
      +

      HackDuke New Members Application

      +

      Interested in getting involved with HackDuke?

      +
      +
      +
      + +
      + +
      +
      +
      + +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +

      If you've been to hackathons previously, where have you been and what did you build? Include links to these projects if possible.

      +
      +
      +
      + +
      + +

      Tell us about projects and experiences (in and out of Duke) that you are proud of.

      +
      +
      +
      + +
      + + + + + + +
      +
      +
      + +
      + +

      If you have any ideas on improving hackDuke as an organization or on how we can create a better hackathon experience, we'd love to hear them!

      +
      +
      +
      + +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/widgets/mentor_info.html b/app/views/fall2014/widgets/mentor_info.html new file mode 100644 index 0000000..158ac6e --- /dev/null +++ b/app/views/fall2014/widgets/mentor_info.html @@ -0,0 +1,98 @@ +
      +
      +

      HackDuke Mentors Form

      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + + + + + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +

      E.g. Web Development / iOS Development / Hardware

      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2014/winners/index.html.erb b/app/views/fall2014/winners/index.html.erb new file mode 100644 index 0000000..c686435 --- /dev/null +++ b/app/views/fall2014/winners/index.html.erb @@ -0,0 +1,29 @@ +
      +
      +

      Winners

      +
      +
      + +
      + <% @main_winners.each do |m| %> + <% if m.semester.season == "Spring" && m.semester.year.year == 2014 %> +

      <%= m.prize_description %>

      + <%= m.project %> +

      <%= m.team_members %>

      + <% end %> + <% end %> +
      +
      +
      + +
      + <% @sponsor_winners.each do |s| %> + <% if s.semester.season == "Spring" && s.semester.year.year == 2014 %> +

      <%= s.prize_description %>

      + <%= s.project %> +

      <%= s.team_members %>

      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/courses/index.html.erb b/app/views/fall2015/courses/index.html.erb new file mode 100644 index 0000000..0c36c37 --- /dev/null +++ b/app/views/fall2015/courses/index.html.erb @@ -0,0 +1,42 @@ +
      +
      +

      Crash Courses

      + <% if @courses == nil %> +
      + <% @courses.each do |c| %> +
      +
      + +
      +
      + <% if c.instructors.count == 2 %> +

      Instructors

      + <% c.instructors.each do |i| %> +
      + +

      <%= i.name %>

      +
      + <% end %> + <% end %> + <% if c.instructors.count == 1 %> +

      Instructor

      + <% c.instructors.each do |i| %> +
      + +

      <%= i.name %>

      +
      + <% end %> + <% end %> +
      + <% if c.date != nil %> +

      <%= c.date.strftime("%A, %B %d") %> | <%= c.start_time.strftime("%l:%M %p") %> to <%= c.end_time.strftime("%l:%M %p") %> | <%= c.location %>

      + <% end %> + Register +
      + <% end %> +
      + <% else %> +

      Check back later for crash courses!

      + <% end %> +
      +
      diff --git a/app/views/fall2015/events/index.html.erb b/app/views/fall2015/events/index.html.erb new file mode 100644 index 0000000..82d83a5 --- /dev/null +++ b/app/views/fall2015/events/index.html.erb @@ -0,0 +1,6 @@ +
      +
      +

      Schedule

      + +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/events/tech_talks.html.erb b/app/views/fall2015/events/tech_talks.html.erb new file mode 100644 index 0000000..8c2dd92 --- /dev/null +++ b/app/views/fall2015/events/tech_talks.html.erb @@ -0,0 +1,79 @@ +
      +
      +

      Tech Talks

      + <% if @events == nil %> +
      + <% @events.each do |c| %> +
      +
      + +
      +
      + <% if c.mentors.count == 3 %> +

      Speakers

      + <% c.mentors.each do |i| %> + <% if i.image_url == "" %> +
      + +

      <%= i.name %>

      +
      + <% else %> +
      + +

      <%= i.name %>

      +
      + <% end %> + <% end %> + <% end %> + + <% if c.mentors.count == 2 %> +

      Speakers

      + <% c.mentors.each do |i| %> + <% if i.image_url == "" %> +
      + +

      <%= i.name %>

      +
      + <% else %> +
      + +

      <%= i.name %>

      +
      + <% end %> + <% end %> + <% end %> + <% if c.mentors.count == 1 %> +

      Speaker

      + <% c.mentors.each do |i| %> + <% if i.image_url == "" %> +
      + +

      <%= i.name %>

      +
      + <% else %> +
      + +

      <%= i.name %>

      +
      + <% end %> + <% end %> + <% end %> + <% if c.sponsor != nil %> +
      + +
      + <% end %> +
      + <% if c.date != nil %> +

      <%= c.date.strftime("%A, %B %d") %> | <%= c.start_time.strftime("%l:%M %p") %> to <%= c.end_time.strftime("%l:%M %p") %> | <%= c.location %>

      + <% end %> + <% if c.html_content != "" %> +

      Learn More

      +
      <%= c.html_content.html_safe %>
      + <% end %> +
      + <% end %> +
      + <% end %> +
      +
      diff --git a/app/views/fall2015/faqs/_faq.html.erb b/app/views/fall2015/faqs/_faq.html.erb new file mode 100644 index 0000000..b66288d --- /dev/null +++ b/app/views/fall2015/faqs/_faq.html.erb @@ -0,0 +1,2 @@ +

      <%= faq.question %>

      +<%= faq.html_content.html_safe %> \ No newline at end of file diff --git a/app/views/fall2015/maps/index.html.erb b/app/views/fall2015/maps/index.html.erb new file mode 100644 index 0000000..3ebf31e --- /dev/null +++ b/app/views/fall2015/maps/index.html.erb @@ -0,0 +1,10 @@ +
      +
      + <% @maps.each do |m| %> + <% if m.semester.season == "Spring" && m.semester.year.year == 2014 %> +

      <%= m.name %>

      + + <% end %> + <% end %> +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/media/index.html.erb b/app/views/fall2015/media/index.html.erb new file mode 100644 index 0000000..ed89669 --- /dev/null +++ b/app/views/fall2015/media/index.html.erb @@ -0,0 +1,41 @@ +
      +
      +

      Media Coverage

      +
      +
      + +
      + <% @articles.each do |a| %> + <% if a.semester.season == "Spring" && a.semester.year.year == 2014 %> + + <% end %> + <% end %> +
      +
      +
      + +
      + <% @galleries.each do |g| %> + <% if g.semester.season == "Spring" && g.semester.year.year == 2014 %> + + <% end %> + <% end %> +
      +
      +
      + +
      + <% @videos.each do |v| %> + <% if v.semester.season == "Spring" && v.semester.year.year == 2014 %> +
      + <%= v.iframe_html.html_safe %> +
      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/mentors/_mentor.html.erb b/app/views/fall2015/mentors/_mentor.html.erb new file mode 100644 index 0000000..3b81584 --- /dev/null +++ b/app/views/fall2015/mentors/_mentor.html.erb @@ -0,0 +1,28 @@ +
      + <% if Partner.exists?(mentor.partner) %> + <% if mentor.image_url == "" + %> + + <% else %> + + <% end %> +

      <%= mentor.name %>

      + + <% elsif Sponsor.exists?(mentor.sponsor) %> + <% if mentor.image_url == "" %> + + <% else %> + + <% end %> +

      <%= mentor.name %>

      + + <% else %> + <% if mentor.image_url == "" %> + + <% else %> + + <% end %> +

      <%= mentor.name %>

      + <% end %> + +
      \ No newline at end of file diff --git a/app/views/fall2015/mentors/guidelines.html.erb b/app/views/fall2015/mentors/guidelines.html.erb new file mode 100644 index 0000000..b9c991c --- /dev/null +++ b/app/views/fall2015/mentors/guidelines.html.erb @@ -0,0 +1,65 @@ +
      +
      +

      Mentorship Guidelines

      +
      +
      + +
      +
        +
      1. Take time to think about the problems that your specific track faces with the distribution, analysis and visualization of information.
      2. +
      3. Check out our blog, the challenges that the community of Durham have worked together to create and the datasets available!
      4. +
      5. Get excited!
      6. +
      +
      + +
      +

      Location, Parking & Schedule?

      +

      + Arrive at 10:30am on Saturday to help your recruiter set up the table. 11:00am is when lunch starts and students will be walking around and getting to know you. This will go on for an hour until we will start ushering people to walk over to Griffith Auditorium for the opening ceremony. If you are not a software engineering mentor associated with a company, I would suggest you go to the Code for Durham table. +
      +
      + The exact location, where to park and detailed Google maps directions can all be found here. The schedule can be found here. +

      +

      How do I best engage with the participants?

      +

      + Join the HackDuke 2015 Participants Facebook Page! Typically, day of, hackers will be posting on the Facebook group or Tweeting to find the mentors who will be able to help them out if they can't immediately find you in person, so check back! Most of the hacking will be taking place in either the atrium of CIEMAS or Schiciano Auditorium. +
      +
      + Don't be afraid to approach the participants, and don't stay at your company table 24/7. We strongly encourage you to walk around, talk to the hackers, ask them questions and help them out with their hacks. We will be encouraging them to come and interact with you, but remember, it takes two to tango (and create some awesome hacks!). + +

      +

      Novices?

      +

      + We do have a track specifically for novices, and a space (Schiciano Auditorium) specifically for them as well. If you've marked that you want to help out novices, please make it a point to visit Schiciano Auditorium every once in a while. You are free to help them with their hacks to your best judgement. This means if a group is having trouble with their dev environment, or having trouble setting up your API and this is their first time at a hackathon or this is their first exposure to computer science, it is not against the rules to give them a little boost. +

      +

      Opening Ceremony API Flash talks and Tech talks?

      +

      + The lineup for the opening ceremony API flash talks is here, under the Opening Ceremony tab. All companies have a maximum of 3 minutes to demo. Please format your presentation to that time constraint. If we run over time, this will negatively impact our schedule for tech talks. +
      +
      + Those mentors who are giving a tech talk should be checking here to find out where and when they are talking. +

      +

      Judging & Prizes?

      +

      + We hope all of you will be able to make it back on Sunday for the expo and judging. The judging for our hackathon will be a little bit different. We will be deciding a winner and one runner up for each track during the expo. There will not be a special judging portion to decide the final winners during the closing ceremony. We will be using ChallengePost to do our hack submissions. +
      +
      + The expo will be split into 2 sections. Poverty & Inequality and Education will be the first segment. Health & Wellness and Energy & Environment will be the second. For companies who have API prizes, we will give you a list of all hacks related to your prize track, but we also expect you to help us judge the Grand Prize winners and the Novice winner after you've done that. We will be giving the rest of the mentors table numbers a few at a time to check out and indicators of whether these hacks are also novice hacks. +
      +
      + Judge the hacks based off of: +

        +
      • Problem +
        + Understanding of the community the hack is aimed at, Understanding of the problem attempting to be solved, Extent to which the problem is solved or mediated
      • +
      • Technical +
        + Technical ingenuity and ambition, Project difficulty
      • +
      • Viability +
        + Ability for the hack to be utilized in the real world, Long term usefulness of the hack
      • +
      +

      +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/mentors/our_experts.html.erb b/app/views/fall2015/mentors/our_experts.html.erb new file mode 100644 index 0000000..cbcad60 --- /dev/null +++ b/app/views/fall2015/mentors/our_experts.html.erb @@ -0,0 +1,18 @@ +
      +
      +

      Meet Our Non-Profit Experts

      +
      + <% @experts.each do |e| %> + <% if Partner.exists?(e.partner) %> +
      + +

      <%= e.name %>

      +

      Track: <%= e.partner.track %>

      +

      Focus: <%= e.partner.focus %>

      + +
      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/mentors/our_mentors.html.erb b/app/views/fall2015/mentors/our_mentors.html.erb new file mode 100644 index 0000000..ed91b1c --- /dev/null +++ b/app/views/fall2015/mentors/our_mentors.html.erb @@ -0,0 +1,16 @@ +
      +
      +

      Meet Our Tech Mentors

      +
      + <% @mentors.each do |m| %> + <% if Sponsor.exists?(m.sponsor) %> +
      + +

      <%= m.name %>

      + +
      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/organizers/index.html.erb b/app/views/fall2015/organizers/index.html.erb new file mode 100644 index 0000000..19c119f --- /dev/null +++ b/app/views/fall2015/organizers/index.html.erb @@ -0,0 +1,28 @@ +
      +
      +

      Meet Our Team

      +
      + <% @organizers.each do |o| %> + <% if o.admin == false && o.match?("Fall", 2014) %> +
      + +

      <%= o.name %>

      +
      + <% end %> + <% end %> +
      +
      +
      +

      Thanks To Our Faculty

      +
      + <% @organizers.each do |o| %> + <% if o.admin == true && o.match?("Fall", 2014)%> +
      + +

      <%= o.name %>

      +
      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/partners/_partner.html.erb b/app/views/fall2015/partners/_partner.html.erb new file mode 100644 index 0000000..45c4d54 --- /dev/null +++ b/app/views/fall2015/partners/_partner.html.erb @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/app/views/fall2015/prizes/index.html.erb b/app/views/fall2015/prizes/index.html.erb new file mode 100644 index 0000000..a6a1c4a --- /dev/null +++ b/app/views/fall2015/prizes/index.html.erb @@ -0,0 +1,47 @@ +
      +
      +

      Prizes

      +
      +
      + +
      +

      There will be one grand prize winning hack for each track.
      The team that best addresses the issues of that respective track will be awarded $750 to a track-related non-profit of their choice.

      + <% @prizes.each do |p| %> + <% if p.api == false %> +
      +

      <%= p.title %>

      +
      <%= p.html_content.html_safe %>
      + <% if p.sponsor != nil %> +

      Sponsored by

      + + <% end %> +
      + <% end %> + <% end %> +
      +
      +
      + +
      +

      There will be a prize for those who are new to programming or attending a hackathon for the first time. The team or individual that creates the best hack that addresses any of the tracks of impact above and meet the requirements for being a novice will be awarded $250 to donate to a non-profit of their choice.

      +
      + <% if @prizes == nil %> +
      +
      + +
      + <% @prizes.each do |p| %> + <% if p.api == true %> +
      + + + +

      <%= p.title %>

      +
      <%= p.html_content.html_safe %>
      +
      + <% end %> + <% end %> +
      + <% end %> +
      +
      diff --git a/app/views/fall2015/sponsors/_sponsor.html.erb b/app/views/fall2015/sponsors/_sponsor.html.erb new file mode 100644 index 0000000..7dba00c --- /dev/null +++ b/app/views/fall2015/sponsors/_sponsor.html.erb @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/app/views/fall2015/static/_about.html.erb b/app/views/fall2015/static/_about.html.erb new file mode 100644 index 0000000..ae54e06 --- /dev/null +++ b/app/views/fall2015/static/_about.html.erb @@ -0,0 +1,73 @@ +
      +
      + +
      +
      +
      +
      + 1. +
      +
      +
      +
      + Collaboration, not competition +
      +
      + HackDuke is not just about building meaningful projects. It's also an open forum to discuss, share and bring to life ideas that aim to make a positive impact on social issues. Look forward to working with experts from non-profits and coding alongside mentors from tech companies! +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      + 2. +
      +
      +
      +
      + Exploring the intersection between technology and social good +
      +
      + HackDuke welcomes anyone who has passion. If you don’t know how to code, fret not! We are open to people of all majors who are interested in how technology can be used to promote social change. +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      + 3. +
      +
      +
      +
      Giving back
      +
      + HackDuke encourages students to venture beyond the classroom. Learn how your skills can be used to make a difference other people’s lives. +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      + + +
      + diff --git a/app/views/fall2015/static/_api_credits.html.erb b/app/views/fall2015/static/_api_credits.html.erb new file mode 100644 index 0000000..5439049 --- /dev/null +++ b/app/views/fall2015/static/_api_credits.html.erb @@ -0,0 +1,39 @@ +
      +
      + +

      SendGrid API

      + +

      Citrix/ShareFile API

      +

      API Accounts (one per team)

      + +

      Twilio API

      +

      $25 Credit (use HACKDUKE)

      + +

      Duke University APIs

      + +

      Socrata API

      + +

      IBM Bluemix Platform

      + +

      Versal API

      +
      +
      + +

      Amazon AWS Credits

      +

      $100 Credit

      + + +

      Microsoft Azure Web API & Microsoft BizSpark

      + +
      + +
      + +
      + +
      + +
      +

      eBay APIs

      +
      +
      diff --git a/app/views/fall2015/static/_datasets.html.erb b/app/views/fall2015/static/_datasets.html.erb new file mode 100644 index 0000000..9ea6408 --- /dev/null +++ b/app/views/fall2015/static/_datasets.html.erb @@ -0,0 +1,26 @@ +
      + + +
      +

      + Much thanks to Socrata and Code For Durham for organizing and providing the open data portal! +

      +
      +
      +
      + +

      Poverty & Inequality

      +
      +
      + +

      Education

      +
      +
      + +

      Health & Wellness

      +
      +
      + +

      Energy & Environment

      +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/static/_eco.html.erb b/app/views/fall2015/static/_eco.html.erb new file mode 100644 index 0000000..4c64002 --- /dev/null +++ b/app/views/fall2015/static/_eco.html.erb @@ -0,0 +1,11 @@ +
      + +

      + Much thanks to Red Ventures for sponsoring this initative! +
      +
      + In order to be more enviromentally friendly, HackDuke is no longer buying bottled water. Instead, we're providing HackKitty water bottles and 8 water coolers in an effort to save plastic! +

      + + +
      \ No newline at end of file diff --git a/app/views/fall2015/static/_ladies.html.erb b/app/views/fall2015/static/_ladies.html.erb new file mode 100644 index 0000000..443efaf --- /dev/null +++ b/app/views/fall2015/static/_ladies.html.erb @@ -0,0 +1,22 @@ +
      + +
      + +

      + Much thanks to Microsoft for sponsoring this event! +
      +
      + Meet all the local Duke/UNC and NCState lady hacker participants and some lady mentors before the fun begins! +
      +
      + Have awesome one on one conversations with some of the best, brightest and most passionate female hackers as well as some of the most successful female software engineers and designers in the tech industry over dinner. +

      + RSVP +
      +
      + +

      + Go to Twinnies to get to know others from the Ladies Storm Hackathons community as well as the female mentors that are at the event! +

      + RSVP +
      \ No newline at end of file diff --git a/app/views/fall2015/static/_massages.html.erb b/app/views/fall2015/static/_massages.html.erb new file mode 100644 index 0000000..83e5d53 --- /dev/null +++ b/app/views/fall2015/static/_massages.html.erb @@ -0,0 +1,4 @@ +
      + +

      Much thanks to our sponsors SendGrid for providing us with massage therapists to relieve and tension and stress at the event!

      +
      \ No newline at end of file diff --git a/app/views/fall2015/static/_nav.html.erb b/app/views/fall2015/static/_nav.html.erb new file mode 100644 index 0000000..451a369 --- /dev/null +++ b/app/views/fall2015/static/_nav.html.erb @@ -0,0 +1,71 @@ + diff --git a/app/views/fall2015/static/_nerf.html.erb b/app/views/fall2015/static/_nerf.html.erb new file mode 100644 index 0000000..8b57c23 --- /dev/null +++ b/app/views/fall2015/static/_nerf.html.erb @@ -0,0 +1,11 @@ +
      + + +

      + Much thanks to eBay and Milo for sponsoring this event! +
      +
      + As always, we're hosting Nerf Gun Wars downstairs in CIEMAS basement from 10:00PM to 11:00PM. We'll be providing guns and ammo, but feel free to come equipped with your own arsenal! +

      + +
      \ No newline at end of file diff --git a/app/views/fall2015/static/fun.html.erb b/app/views/fall2015/static/fun.html.erb new file mode 100644 index 0000000..7595d9f --- /dev/null +++ b/app/views/fall2015/static/fun.html.erb @@ -0,0 +1,36 @@ +
      +
      +

      Datasets

      + <%= render "datasets" %> +
      +
      +
      +
      +

      APIs & Credits

      + <%= render "api_credits" %> +
      +
      +
      +
      +

      Eco-Friendliness

      + <%= render "eco" %> +
      +
      +
      +
      +

      Massages

      + <%= render "massages" %> +
      +
      +
      +
      +

      Ladies Night

      + <%= render "ladies" %> +
      +
      +
      +
      +

      Nerf Gun Wars

      + <%= render "nerf" %> +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/static/gist.html.erb b/app/views/fall2015/static/gist.html.erb new file mode 100644 index 0000000..ef861ee --- /dev/null +++ b/app/views/fall2015/static/gist.html.erb @@ -0,0 +1,32 @@ +
      +
      +

      The Gist

      +

      HackDuke is all about coding for social good. We emphasize collaboration, not competition and this reflects in the structure of our event. This is what you should expect from HackDuke on Saturday!

      +
      +

      Every participant must partake in at least two brainstorming/ideation sessions with non-profits.

      +

      We can not stress how crucial this part is to our event. The brainstorming phase takes place from 1:30PM to 4:00PM right after opening ceremony. Each non-profit has 30 minute sessions to describe their mission as well as go into further detail about the challenges that they are facing. This discussion will be led by the non-profit experts and mediated software engineering mentors.

      +

      The challenges, as well as the times of when these sessions are going can be found here. Regardless of whether you will be working on your own idea, you should still attend the brainstorming sessions. We believe that interaction with real experts from non-profits adds an amazing educational value to our social good hackathon.

      +

      To top it off, hacking will not start until the brainstorming sessions are over. Additionally, you will not be able to get a HackDuke t-shirt (or most of any swag for that matter) if you do not attend at least 2 brainstorming sessions. (Yes, it's that important. ;D)

      +
      +
      +
      +

      Use Saturday lunch as an opportunity to meet new people.

      +

      We're having Noodles & Co for lunch! As you're munching on yummy noodles, reach out to people that you've never met before, whether it be a non-profit expert, software engineering mentor or a fellow student from another university.

      +
      +
      +

      Don't be afraid to grab a mentor or an expert and discuss your idea with them!

      +

      Our mentors and experts are here to help! Whether it be a general question about a social issue or a challenge, or frustration over getting a line of code to work, you can always count on our mentors and experts for assistance!

      +
      +
      +
      +
      +

      Tech Talks will be during dinner!

      +

      Think of it like dinner and a movie! We have some awesome mentors from Google, Palantir and the Resolution Project ready to talk about how they've used technology to improve the world.

      +
      +
      +

      Almost all prizes will be donations to charity.

      +

      HackDuke wants to help out the community as much as possible and therefore, we've made the decisions that the prizes will be donations to a charity of the winning team's choice.

      +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/static/home.html.erb b/app/views/fall2015/static/home.html.erb new file mode 100644 index 0000000..bd9e71d --- /dev/null +++ b/app/views/fall2015/static/home.html.erb @@ -0,0 +1,92 @@ +MLH Official - Fall 2015 +
      +
      + <%= image_tag "fall2015/badge.svg" %> +
      + +
      +
      +

      Hurry Up! Non-Duke Students Registration ends on Oct 14!

      + Register +
      +
      +
      + +
      +
      +

      HackDuke is about

      + <%= render "about" %> +
      +
      +
      +
      +

      FAQ

      +
      + <% @faqs.in_groups(3, false) do |fg| %> +
      + <% fg.each do |f| %> + <%= render f %> + <% end %> +
      + <% end %> +
      +
      +
      +<% if @mentors == nil %> +
      +
      +

      Mentors

      +
      + <% @mentors.each do |m| %> + <%= render m %> + <% end %> +
      +
      +

      This sounds awesome! I want to

      + +
      +
      +
      +<% end %> +<% if @large_sponsors != nil || @medium_sponsors != nil || @small_sponsors != nil %> +
      +
      +

      Sponsors

      +
      + <% @large_sponsors.each do |s| %> + <%= render s %> + <% end %> +
      +
      + <% @medium_sponsors.each do |s| %> + <%= render s %> + <% end %> +
      +
      + <% @small_sponsors.each do |s| %> + <%= render s %> + <% end %> +
      +
      +

      This sounds awesome! I want to

      + +
      +
      +
      +<% end %> +
      +
      +

      Partners

      +
      + <% Partner.all.each do |p| %> + <% if p.partnership_type == "University Partner" %> + <%= render p %> + <% end %> + <% end %> +
      +
      +
      diff --git a/app/views/fall2015/static/speakers.html.erb b/app/views/fall2015/static/speakers.html.erb new file mode 100644 index 0000000..7fced55 --- /dev/null +++ b/app/views/fall2015/static/speakers.html.erb @@ -0,0 +1,33 @@ +
      +
      +

      Opening Ceremony Speakers

      +
      +
      + + +

      Bill Bell

      +

      + Bill Bell is the current mayor of Durham, North Carolina. Mr. Bell holds a Bachelor of Science and Master's degree in Electrical Engineering from Howard University and New York University, respectively. Formerly a senior engineer for IBM, Bell was first elected to the Durham County Board of Commissioners in 1972, where he served until 1994, and again from 1996 to 2000. Bell is currently Executive Vice President and Chief Operating Officer of UDI Community Development Corp., a non-profit organization. +

      +
      +
      +
      +
      + + +

      Jesse Lipson

      +

      + Jesse is the VP & GM of Data Sharing for Citrix, which acquired ShareFile in 2011. ShareFile is a file-transfer service built for business users who need secure, reliable and easy tools for sharing data. Jesse launched ShareFile in 2005 and bootstrapped the company from zero to four million users in six years; today Citrix ShareFile has 13 million users in 100 countries. As a founding partner of HUB Raleigh, he's particularly interested in helping the Research Triangle area become a top-five region for entrepreneurship and innovation in the U.S. He holds a degree in philosophy from Duke University. +

      +
      +
      + + +

      Kyle Bradbury

      +

      + Kyle brings experience in machine learning and statistical modeling to energy problems. He completed his Ph.D. at Duke University, with research focused on modeling the reliability and cost trade-offs of energy storage systems for integrating wind and solar power into the grid. Kyle holds a M.S. in Electrical Engineering from Duke University where he specialized in statistical signal processing and machine learning, and a B.S. in Electrical Engineering from Tufts University. He has worked for ISO New England, MIT Lincoln Laboratories, and Dominion. +

      +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/static/travel.html.erb b/app/views/fall2015/static/travel.html.erb new file mode 100644 index 0000000..ad28775 --- /dev/null +++ b/app/views/fall2015/static/travel.html.erb @@ -0,0 +1,200 @@ +
      +
      +

      Travel

      +
      +
      +

      Some of you may be asking: "How the flippity do I get to HackDuke?"
      Here's the page that will answer all your questions!

      +
      +
      +

      Where is the hackathon taking place?

      +

      + The Fitzpatrick Center for Interdisciplinary Engineering, Medicine and Applied Sciences (FCIEMAS) +
      101 Science Drive +
      Durham, NC 27708 +

      +
      +
      +
      +
      + +
      +
      +

      So where do I park?

      +

      + Participants, mentors and sponsors can park their cars in the PG4/Bryan Center lot. There is a parking fee of $5. Cash only. +

      +

      How do I get to the venue from the lot?

      +

      + Walking to FCIEMAS from the PG4/Bryan Center lot is easy. Here are the directions. +

      +

      What do I do if I have passengers and/or swag to drop off?

      +

      + If you are bus driver and have any items or people to drop off for the event, you must enter Duke via Erwin Road & Research Drive. +

      +

      + Then, make your way towards Telecom Drive. This will bring you at the back of FCIEMAS. We will have a volunteer assist you when you get to the dropoff point. +

      +

      + Finally, you should make your way to the parking area. The directions are here. +

      +
      +
      +
      +
      + +
      +
      +

      Duke Students

      +

      Walk to FCIEMAS if you're living on West Campus. Take the C3 if you're living on East Campus, C4 if you're living on Central Campus and head to the Engineering Quad.

      +
      +
      +

      UNC Students

      +

      Take the Roberson Scholar Express bus to Duke. The bus fare and details can be found here and the bus schedule can be found here.

      +
      +
      +

      NC State Students

      +

      Find a carpool or split an Uber/Lyft with participants from your school to drive to Duke. Directions can be found here.

      +
      +
      +
      +
      + +
      +
      +

      + We will be providing a bus for certain schools that have over 40 registrations. If you would like a bus to be provided to your school you must make sure your school has a point person to coordinate the bus. Then, you should contact hackers@hackduke.org so that HackKitty or one of our organizers can help you get your school to HackDuke. + + +

      +
      + +
      +
      +
      + +
      +
      +

      Registrants who go to schools that do not have a bus provided for them and are out of state will be selected to participate in HackDuke.

      +

      These participants, who will most likely be traveling by plane, will be eligible for a reimbursement of up to $200. + +

      + +

      + Note: We will only be providing this reimbursement to students who are accepted and do not have a bus provided for them. +

      +
      +
      +

      If you have gotten an email about your acceptance to HackDuke 2015, welcome! The next steps should be broken down to you in the email, but to reiterate, you need to:

      +
        +
      1. Confirm that you are coming to HackDuke and you need travel reimbursement by October 19th.
      2. +
      3. Fill out the W9 form and upload it to your personalized registration link by October 28th. This is absolutely crucial for your travel reimbursement.
      4. +
      5. Buy your tickets and upload it to your personalized registration link by October 28th. This is also absolutely crucial for your travel reimbursement.
      6. +
      7. If you are an international student and do not have a social security number, we need a copy of your passport, visa and letter from the university stating your are in good standing by October 28th.
      8. +
      +
      +
      +
      +
      diff --git a/app/views/fall2015/widgets/apply_team.html b/app/views/fall2015/widgets/apply_team.html new file mode 100644 index 0000000..0628d09 --- /dev/null +++ b/app/views/fall2015/widgets/apply_team.html @@ -0,0 +1,139 @@ +
      +
      +

      HackDuke New Members Application

      +

      Interested in getting involved with HackDuke?

      +
      +
      +
      + +
      + +
      +
      +
      + +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +

      If you've been to hackathons previously, where have you been and what did you build? Include links to these projects if possible.

      +
      +
      +
      + +
      + +

      Tell us about projects and experiences (in and out of Duke) that you are proud of.

      +
      +
      +
      + +
      + + + + + + +
      +
      +
      + +
      + +

      If you have any ideas on improving hackDuke as an organization or on how we can create a better hackathon experience, we'd love to hear them!

      +
      +
      +
      + +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/widgets/mentor_info.html b/app/views/fall2015/widgets/mentor_info.html new file mode 100644 index 0000000..839d1c4 --- /dev/null +++ b/app/views/fall2015/widgets/mentor_info.html @@ -0,0 +1,98 @@ +
      +
      +

      HackDuke Mentors Form

      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + + + + + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +

      E.g. Web Development / iOS Development / Hardware

      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/fall2015/winners/index.html.erb b/app/views/fall2015/winners/index.html.erb new file mode 100644 index 0000000..c686435 --- /dev/null +++ b/app/views/fall2015/winners/index.html.erb @@ -0,0 +1,29 @@ +
      +
      +

      Winners

      +
      +
      + +
      + <% @main_winners.each do |m| %> + <% if m.semester.season == "Spring" && m.semester.year.year == 2014 %> +

      <%= m.prize_description %>

      + <%= m.project %> +

      <%= m.team_members %>

      + <% end %> + <% end %> +
      +
      +
      + +
      + <% @sponsor_winners.each do |s| %> + <% if s.semester.season == "Spring" && s.semester.year.year == 2014 %> +

      <%= s.prize_description %>

      + <%= s.project %> +

      <%= s.team_members %>

      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/layouts/fall2014.html.erb b/app/views/layouts/fall2014.html.erb new file mode 100644 index 0000000..ea4bdd5 --- /dev/null +++ b/app/views/layouts/fall2014.html.erb @@ -0,0 +1,17 @@ + + + + HackDuke: Code For Good + <%= stylesheet_link_tag "fall2014", media: "all", "data-turbolinks-track" => true %> + <%= javascript_include_tag "fall2014", "data-turbolinks-track" => true %> + <%= csrf_meta_tags %> + + + + + + + <%= render 'fall2014/static/nav' %> + <%= yield %> + + diff --git a/app/views/layouts/fall2015.html.erb b/app/views/layouts/fall2015.html.erb new file mode 100644 index 0000000..bd0f7d3 --- /dev/null +++ b/app/views/layouts/fall2015.html.erb @@ -0,0 +1,17 @@ + + + + HackDuke: Code For Good + <%= stylesheet_link_tag "fall2015", media: "all", "data-turbolinks-track" => true %> + <%= javascript_include_tag "fall2015", "data-turbolinks-track" => true %> + <%= csrf_meta_tags %> + + + + + + + <%= render 'fall2015/static/nav' %> + <%= yield %> + + diff --git a/app/views/spring2014/courses/index.html.erb b/app/views/spring2014/courses/index.html.erb index 630a6e2..6de4ad3 100644 --- a/app/views/spring2014/courses/index.html.erb +++ b/app/views/spring2014/courses/index.html.erb @@ -1,11 +1,13 @@

      Crash Courses

      - <% @courses.each do |c| %> - <% if c.semester.season == "Spring" && c.semester.year.year == 2014 %>
      + <% @courses.each do |c| %> + <% if c.semester.season == "Spring" && c.semester.year.year == 2014 %>
      - +
      + +

      Instructors

      <% if c.instructors.count == 2 %> @@ -25,12 +27,10 @@ <% end %> <% end %>
      -

      <%= c.date.strftime("%A, %B %d") %>

      -

      <%= c.start_time.strftime("%l:%M %p") %> to <%= c.end_time.strftime("%l:%M %p") %>

      -

      <%= c.location %>

      +

      <%= c.date.strftime("%A, %B %d") %> | <%= c.start_time.strftime("%l:%M %p") %> to <%= c.end_time.strftime("%l:%M %p") %> | <%= c.location %>

      + <% end %> + <% end %>
      - <% end %> - <% end %>
      \ No newline at end of file diff --git a/app/views/spring2014/events/brainstorm.html.erb b/app/views/spring2014/events/brainstorm.html.erb index e69de29..51827c4 100644 --- a/app/views/spring2014/events/brainstorm.html.erb +++ b/app/views/spring2014/events/brainstorm.html.erb @@ -0,0 +1,143 @@ +
      +
      +

      Brainstorm Sessions

      +

      To find out what kinds of challenges these non-profits experts will be presenting doing their brainstorming sessions during HackDuke click here.

      +
      +
      + +
      +
      +

      Michael Faber

      + +

      Location: Gross 104

      +

      Track: Education

      +

      Focus: Higher Education, The Future of Education

      +
      +
      +

      Bryan Gilmer

      + +

      Location: Gross 105

      +

      Track: Inequality

      +

      Focus: Homelessness & Poverty

      +
      +
      +

      Jonathan Young

      + +

      Location: Gross 103

      +

      Track: Inequality

      +

      Focus: Personal Finance for the Underprivileged

      +
      +
      +
      +
      + +
      +
      +

      Travis Starkey

      + +

      Location: Gross 104

      +

      Track: Education

      +

      Focus: Access to Education

      +
      +
      +

      Justin Straight

      + +

      Location: Gross 105

      +

      Track: Inequality

      +

      Focus: Community Development

      +
      +
      +

      Ryan Fehrman

      + +

      Location: Gross 103

      +

      Track: Inequality

      +

      Focus: Familes Facing Homelessness

      +
      +
      +
      +
      + +
      +
      +

      Gary Glass

      + +

      Location: Gross 104

      +

      Track: Health & Wellness

      +

      Focus: Mental Health, Bullying

      +
      +
      +

      Bryan Gilmer

      + +

      Location: Gross 105

      +

      Track: Inequality

      +

      Focus: Homelessness & Poverty

      +
      +
      +

      Jonathan Young

      + +

      Location: Gross 103

      +

      Track: Inequality

      +

      Focus: Personal Finance for the Underprivileged

      +
      +
      +
      +
      + +
      +
      +

      Lauren Gardner

      + +

      Location: Gross 104

      +

      Track: Education

      +

      Focus: Access to Education

      +
      +
      +

      Nana Asante

      + +

      Location: Gross 105

      +

      Track: Inequality

      +

      Focus: Domestic Violence

      +
      +
      + data-target="#ryan" class="profile-img">

      Ryan Fehrman

      + +

      Location: Gross 103

      +

      Track: Inequality

      +

      Focus: Familes Facing Homelessness

      +
      +
      +
      +
      + +
      +
      +

      Gary Glass

      + +

      Location: Gross 104

      +

      Track: Health & Wellness

      +

      Focus: Mental Health, Bullying

      +
      +
      +

      Chaya Rao

      + +

      Location: Gross 105

      +

      Track: Education

      +

      Focus: Access to Education Abroad

      +
      +
      +

      Christine Miller

      + +

      Location: Gross 105

      +

      Track: Health & Wellness

      +

      Focus: Environmental Protection & Awareness

      +
      +
      +

      Charles Robinson

      + +

      Location: Gross 107

      +

      Track: Education

      +

      Focus: Access to Education

      +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/spring2014/events/index.html.erb b/app/views/spring2014/events/index.html.erb index e69de29..2ec53d2 100644 --- a/app/views/spring2014/events/index.html.erb +++ b/app/views/spring2014/events/index.html.erb @@ -0,0 +1,6 @@ +
      +
      +

      Schedule

      + +
      +
      \ No newline at end of file diff --git a/app/views/spring2014/faqs/_faq.html.erb b/app/views/spring2014/faqs/_faq.html.erb index be663a6..b66288d 100644 --- a/app/views/spring2014/faqs/_faq.html.erb +++ b/app/views/spring2014/faqs/_faq.html.erb @@ -1,4 +1,2 @@ -
      -

      <%= faq.question %>

      -
      <%= faq.html_content.html_safe %>
      -
      \ No newline at end of file +

      <%= faq.question %>

      +<%= faq.html_content.html_safe %> \ No newline at end of file diff --git a/app/views/spring2014/maps/index.html.erb b/app/views/spring2014/maps/index.html.erb index aece978..3ebf31e 100644 --- a/app/views/spring2014/maps/index.html.erb +++ b/app/views/spring2014/maps/index.html.erb @@ -1,10 +1,10 @@
      -
      - <% @maps.each do |m| %> - <% if m.semester.season == "Spring" && m.semester.year.year == 2014 %> -

      <%= m.name %>

      - - <% end %> - <% end %> -
      +
      + <% @maps.each do |m| %> + <% if m.semester.season == "Spring" && m.semester.year.year == 2014 %> +

      <%= m.name %>

      + + <% end %> + <% end %> +
      \ No newline at end of file diff --git a/app/views/spring2014/media/index.html.erb b/app/views/spring2014/media/index.html.erb index e69de29..ed89669 100644 --- a/app/views/spring2014/media/index.html.erb +++ b/app/views/spring2014/media/index.html.erb @@ -0,0 +1,41 @@ +
      +
      +

      Media Coverage

      +
      +
      + +
      + <% @articles.each do |a| %> + <% if a.semester.season == "Spring" && a.semester.year.year == 2014 %> + + <% end %> + <% end %> +
      +
      +
      + +
      + <% @galleries.each do |g| %> + <% if g.semester.season == "Spring" && g.semester.year.year == 2014 %> + + <% end %> + <% end %> +
      +
      +
      + +
      + <% @videos.each do |v| %> + <% if v.semester.season == "Spring" && v.semester.year.year == 2014 %> +
      + <%= v.iframe_html.html_safe %> +
      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/app/views/spring2014/mentors/guidelines.html.erb b/app/views/spring2014/mentors/guidelines.html.erb new file mode 100644 index 0000000..f3701e8 --- /dev/null +++ b/app/views/spring2014/mentors/guidelines.html.erb @@ -0,0 +1,44 @@ +
      +
      +

      Mentorship Guidelines

      +
      +
      +
      + +
      +

      Leading Up To HackDuke

      +
        +
      1. Take time to think about the problems that your organization faces with the distribution, analysis and visualization of information.
      2. +
      3. With the assistance of our software developer mentors, we will work with you to craft open-ended prompts for our participants.
      4. +
      5. We will also help you prepare an engaging presentation about your organization and prompts.
      6. +
      +

      Day Of HackDuke

      +
        +
      1. Check in as mentor at 11AM Saturday, March 29th and engage in conversation with our participants over lunch.
      2. +
      3. Take some time to introduce yourselves and your organization during the opening ceremony.
      4. +
      5. After the opening ceremony, partake in brainstorming and community building activities with the participants. We hope you can leverage the expertise you have in your area to help give more information about the issues at hand to give constructive feedback on the solutions
      6. +
      7. Judge the hacks remotely or on site on Sunday afternoon.
      8. +
      9. Have an amazing time interacting with developers and designers who truely care about improving their community.
      10. +
      +
      +
      +
      + +
      +

      Leading Up To HackDuke

      +
        +
      1. Take a look at the spreadsheet of prompts that we are compiling and help us refine and develop them.
      2. +
      3. If you're a developer who has had experience developing for techonology for social good, we would love to have you prepare a presentation on your experiences!
      4. +
      +

      Day of HackDuke

      +
        +
      1. Check in as a mentor at 11AM Saturday, March 29th and engage in conversation with our participants over lunch.
      2. +
      3. Take some time to introduce yourselves and your organization during the opening ceremony.
      4. +
      5. After the opening ceremony, partake in brainstorming and community building activities with the participants. We hope you can leverage the expertise you have technology to help advise our participants in what is technically feasible.
      6. +
      7. Judge the hacks during our Expo event on Sunday afternoon.
      8. +
      9. Have an amazing time interacting with developers and designers who truely care about improving their community.
      10. +
      +
      +
      +
      +
      \ No newline at end of file diff --git a/app/views/spring2014/mentors/our_experts.html.erb b/app/views/spring2014/mentors/our_experts.html.erb index 46771ed..6c7303f 100644 --- a/app/views/spring2014/mentors/our_experts.html.erb +++ b/app/views/spring2014/mentors/our_experts.html.erb @@ -5,17 +5,14 @@ <% @experts.each do |e| %> <% if Partner.exists?(e.partner) %>
      - "> - -

      <%= e.name %>

      -
      + +

      <%= e.name %>

      Track: <%= e.partner.track %>

      Focus: <%= e.partner.focus %>

      -
      "> - <%= e.html_content.html_safe %> -
      -

      " class="text-center banner-header">Challenges

      +
      +

      " class="banner-header">Challenges

      +
      ">

      About <%= e.partner.name %>

      <%= e.partner.about %>

      diff --git a/app/views/spring2014/mentors/our_mentors.html.erb b/app/views/spring2014/mentors/our_mentors.html.erb index 8f2e546..ed91b1c 100644 --- a/app/views/spring2014/mentors/our_mentors.html.erb +++ b/app/views/spring2014/mentors/our_mentors.html.erb @@ -5,14 +5,9 @@ <% @mentors.each do |m| %> <% if Sponsor.exists?(m.sponsor) %>
      - "> - -

      <%= m.name %>

      -
      + +

      <%= m.name %>

      -
      "> - <%= m.html_content.html_safe %> -
      <% end %> <% end %> diff --git a/app/views/spring2014/prizes/index.html.erb b/app/views/spring2014/prizes/index.html.erb index 2ef49dd..16edc08 100644 --- a/app/views/spring2014/prizes/index.html.erb +++ b/app/views/spring2014/prizes/index.html.erb @@ -2,12 +2,15 @@

      Prizes

      - +
      + +
      <% @prizes.each do |p| %> <% if p.sponsor == nil %>

      <%= p.title %>

      <%= p.html_content.html_safe %>
      +

      Who can I donate to?

      <% p.partners.each do |pp| %> <% end %> @@ -16,43 +19,28 @@ <% end %>
      -
      -

      - All grand prizes recieve support from Indiegogo, where teams will be able to take their projects to the next level. -

      - -

      - They will be offering the following benefits to winning teams: -

      -
        -
      • 25% discount on campaign fee OR $150 Indiegogo contribution to campaign
      • -
      • Training sessions for finalists who are interested in an Indiegogo campaign
      • -
      • Personal review sessions of campaign draft with Indiegogo staff
      • -
      -
      -
      -

      - Many thanks to Infusion for the sponsorship of the grand prizes! -

      - -
      -
      -
      - +
      +

      + Many thanks to Infusion for the sponsorship of the grand prizes! +

      +
      -
      - - <% @prizes.each do |p| %> - <% if p.sponsor != nil %> -
      - - - -

      <%= p.title %>

      -
      <%= p.html_content.html_safe %>
      -
      - <% end %> - <% end %> +
      +
      +
      + +
      + <% @prizes.each do |p| %> + <% if p.sponsor != nil %> +
      + + + +

      <%= p.title %>

      +
      <%= p.html_content.html_safe %>
      + <% end %> + <% end %>
      +
      \ No newline at end of file diff --git a/app/views/spring2014/static/_nav.html.erb b/app/views/spring2014/static/_nav.html.erb index 4fc5896..2b2256f 100644 --- a/app/views/spring2014/static/_nav.html.erb +++ b/app/views/spring2014/static/_nav.html.erb @@ -13,14 +13,13 @@
      -
      +

      Mentors

      <% Partner.all.each do |p| %> @@ -68,12 +72,14 @@
      -
      +

      Sponsors

      <% Sponsor.all.each do |s| %> + <% if s.match?("Spring", 2014) %> <%= render s %> <% end %> + <% end %>

      This sounds awesome! I want to

      @@ -84,7 +90,7 @@
      -
      +

      Partners

      <% Partner.all.each do |p| %> diff --git a/app/views/spring2014/widgets/apply_team.html b/app/views/spring2014/widgets/apply_team.html index 5bf4dc9..0628d09 100644 --- a/app/views/spring2014/widgets/apply_team.html +++ b/app/views/spring2014/widgets/apply_team.html @@ -9,8 +9,8 @@

      Interested in getting involved with HackDuke?

      diff --git a/app/views/spring2014/winners/index.html.erb b/app/views/spring2014/winners/index.html.erb index e69de29..c686435 100644 --- a/app/views/spring2014/winners/index.html.erb +++ b/app/views/spring2014/winners/index.html.erb @@ -0,0 +1,29 @@ +
      +
      +

      Winners

      +
      +
      + +
      + <% @main_winners.each do |m| %> + <% if m.semester.season == "Spring" && m.semester.year.year == 2014 %> +

      <%= m.prize_description %>

      + <%= m.project %> +

      <%= m.team_members %>

      + <% end %> + <% end %> +
      +
      +
      + +
      + <% @sponsor_winners.each do |s| %> + <% if s.semester.season == "Spring" && s.semester.year.year == 2014 %> +

      <%= s.prize_description %>

      + <%= s.project %> +

      <%= s.team_members %>

      + <% end %> + <% end %> +
      +
      +
      \ No newline at end of file diff --git a/config/database.yml b/config/database.yml index 51a4dd4..008cad9 100644 --- a/config/database.yml +++ b/config/database.yml @@ -4,8 +4,8 @@ # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' development: - adapter: sqlite3 - database: db/development.sqlite3 + adapter: postgresql + database: hackduke_development pool: 5 timeout: 5000 @@ -19,7 +19,7 @@ test: timeout: 5000 production: - adapter: sqlite3 - database: db/production.sqlite3 + adapter: postgresql + database: hackduke_development pool: 5 - timeout: 5000 + timeout: 5000 \ No newline at end of file diff --git a/config/initializers/active_admin.rb b/config/initializers/active_admin.rb index 4dfd71d..60e7614 100644 --- a/config/initializers/active_admin.rb +++ b/config/initializers/active_admin.rb @@ -118,10 +118,10 @@ # This allows your users to comment on any resource registered with Active Admin. # # You can completely disable comments: - config.allow_comments = false + # config.comments = true # # You can disable the menu item for the comments index page: - config.show_comments_in_menu = false + # config.show_comments_in_menu = true # # You can change the name under which comments are registered: # config.comments_registration_name = 'AdminComment' @@ -168,7 +168,7 @@ # config.register_stylesheet 'my_print_stylesheet.css', :media => :print # # To load a javascript file: - # config.register_javascript 'my_javascript.js' + # config.register_javascript 'active_admin.js' # == CSV options diff --git a/config/routes.rb b/config/routes.rb index 40117fd..44149a5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,41 +2,62 @@ devise_for :admin_users, ActiveAdmin::Devise.config ActiveAdmin.routes(self) - constraints subdomain: 'www' do - get '/', to: 'spring2014/static#index' - get '/gist', to: 'spring2014/static#gist' - get '/apply-team', to: 'spring2014/widgets#apply_team' - get '/our-mentors', to: 'spring2014/mentors#our_mentors' - get '/our-experts', to: 'spring2014/mentors#our_experts' - get '/brainstorm', to: 'spring2014/events#brainstorm' - get '/tech-talks', to: 'spring2014/events#tech_talks' + module DomainConstraint + def self.matches? request + !request.subdomain.present? || request.subdomain == 'www' + end + end - namespace :spring2014 do - resources :mentors, only: [:index] - resources :events, only: [:index] - resources :media, only: [:index] - resources :winners, only: [:index] - resources :maps, only: [:index] - resources :courses, only: [:index] - resources :prizes, only: [:index] - resources :faqs, only: [:index] - resources :partners, only: [:index] - resources :sponsors, only: [:index] - resources :organizers, only: [:index] - end + constraints DomainConstraint do + get '/', to: 'fall2015/static#index' + get '/mentor-info', to: 'fall2015/widgets#mentor_info' + get '/get-involved', to: 'fall2015/widgets#apply_team' + get '/mentor-guidelines', to: 'fall2015/mentors#guidelines' + get '/sponsor-guidelines', to: 'fall2015/sponsors#guidelines' + get '/our-mentors', to: 'fall2015/mentors#our_mentors' + get '/our-experts', to: 'fall2015/mentors#our_experts' + get '/prizes', to: 'fall2015/prizes#index' + get '/travel', to: 'fall2015/static#travel' + get '/speakers', to: 'fall2015/static#speakers' + get '/fun', to: 'fall2015/static#fun' + get '/courses', to: 'fall2015/courses#index' + get '/tech-talks', to: 'fall2015/events#tech_talks' + get '/schedule', to: 'fall2015/events#index' + + resources :organizers, only: [:index], :controller => 'fall2015/organizers' + end + + constraints subdomain: 'fall2014' do + get '/', to: 'fall2014/static#index' + get '/mentor-info', to: 'fall2014/widgets#mentor_info' + get '/get-involved', to: 'fall2014/widgets#apply_team' + get '/mentor-guidelines', to: 'fall2014/mentors#guidelines' + get '/sponsor-guidelines', to: 'fall2014/sponsors#guidelines' + get '/our-mentors', to: 'fall2014/mentors#our_mentors' + get '/our-experts', to: 'fall2014/mentors#our_experts' + get '/prizes', to: 'fall2014/prizes#index' + get '/travel', to: 'fall2014/static#travel' + get '/speakers', to: 'fall2014/static#speakers' + get '/fun', to: 'fall2014/static#fun' + get '/courses', to: 'fall2014/courses#index' + get '/tech-talks', to: 'fall2014/events#tech_talks' + get '/schedule', to: 'fall2014/events#index' + + resources :organizers, only: [:index], :controller => 'fall2014/organizers' end constraints subdomain: 'spring2014' do namespace :spring2014, path: '/' do root to: 'static#index' - + get '/gist', to: 'static#gist' get '/apply-team', to: 'widgets#apply_team' - + get '/mentor-info', to: 'widgets#mentor_info' resources :mentors, only: [:index] get '/our-mentors', to: 'mentors#our_mentors' get '/our-experts', to: 'mentors#our_experts' + get '/mentor-guidelines', to: 'mentors#guidelines' resources :events, only: [:index] get '/brainstorm', to: 'events#brainstorm' @@ -47,7 +68,6 @@ resources :maps, only: [:index] resources :courses, only: [:index] resources :prizes, only: [:index] - resources :faqs, only: [:index] resources :partners, only: [:index] resources :sponsors, only: [:index] resources :organizers, only: [:index] diff --git a/db/migrate/20141022042541_create_events_mentors.rb b/db/migrate/20141022042541_create_events_mentors.rb new file mode 100644 index 0000000..1c4d704 --- /dev/null +++ b/db/migrate/20141022042541_create_events_mentors.rb @@ -0,0 +1,10 @@ +class CreateEventsMentors < ActiveRecord::Migration + def change + create_table :events_mentors do |t| + t.belongs_to :event + t.belongs_to :mentor + end + add_index :events_mentors, :event_id + add_index :events_mentors, :mentor_id + end +end diff --git a/db/migrate/20141024201210_add_api_to_prizes.rb b/db/migrate/20141024201210_add_api_to_prizes.rb new file mode 100644 index 0000000..57627f1 --- /dev/null +++ b/db/migrate/20141024201210_add_api_to_prizes.rb @@ -0,0 +1,5 @@ +class AddApiToPrizes < ActiveRecord::Migration + def change + add_column :prizes, :api, :boolean + end +end diff --git a/db/migrate/20141026193717_add_tiers_to_sponsors.rb b/db/migrate/20141026193717_add_tiers_to_sponsors.rb new file mode 100644 index 0000000..419d23d --- /dev/null +++ b/db/migrate/20141026193717_add_tiers_to_sponsors.rb @@ -0,0 +1,5 @@ +class AddTiersToSponsors < ActiveRecord::Migration + def change + add_column :sponsors, :tier, :string + end +end diff --git a/db/migrate/20141101021411_set_api_to_false_in_prizes.rb b/db/migrate/20141101021411_set_api_to_false_in_prizes.rb new file mode 100644 index 0000000..c777661 --- /dev/null +++ b/db/migrate/20141101021411_set_api_to_false_in_prizes.rb @@ -0,0 +1,9 @@ +class SetApiToFalseInPrizes < ActiveRecord::Migration + def change + Prize.all.each do |p| + if p.api == nil + p.update api: false + end + end + end +end diff --git a/db/migrate/20141103220638_set_api_to_default_false_in_prizes.rb b/db/migrate/20141103220638_set_api_to_default_false_in_prizes.rb new file mode 100644 index 0000000..8171823 --- /dev/null +++ b/db/migrate/20141103220638_set_api_to_default_false_in_prizes.rb @@ -0,0 +1,5 @@ +class SetApiToDefaultFalseInPrizes < ActiveRecord::Migration + def change + change_column :prizes, :api, :boolean, :default => false + end +end diff --git a/db/migrate/20141103221004_add_sponsor_to_events.rb b/db/migrate/20141103221004_add_sponsor_to_events.rb new file mode 100644 index 0000000..c5b9f41 --- /dev/null +++ b/db/migrate/20141103221004_add_sponsor_to_events.rb @@ -0,0 +1,6 @@ +class AddSponsorToEvents < ActiveRecord::Migration + def change + add_column :events, :sponsor_id, :integer + add_index :events, :sponsor_id + end +end diff --git a/db/migrate/20141103230357_add_markdown_attributes_to_events.rb b/db/migrate/20141103230357_add_markdown_attributes_to_events.rb new file mode 100644 index 0000000..9b0ae22 --- /dev/null +++ b/db/migrate/20141103230357_add_markdown_attributes_to_events.rb @@ -0,0 +1,9 @@ +class AddMarkdownAttributesToEvents < ActiveRecord::Migration + def change + add_column :events, :html_content, :text + add_column :events, :markdown_content, :text + Event.all.each do |e| + e.compile_content! + end + end +end diff --git a/db/migrate/20141107231144_add_tracks_to_mentors.rb b/db/migrate/20141107231144_add_tracks_to_mentors.rb new file mode 100644 index 0000000..3f6907f --- /dev/null +++ b/db/migrate/20141107231144_add_tracks_to_mentors.rb @@ -0,0 +1,8 @@ +class AddTracksToMentors < ActiveRecord::Migration + def change + add_column :mentors, :education, :boolean + add_column :mentors, :poverty, :boolean + add_column :mentors, :health, :boolean + add_column :mentors, :energy, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 2b5bfbd..52c96d3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,10 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140805085640) do +ActiveRecord::Schema.define(version: 20141107231144) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" create_table "active_admin_comments", force: true do |t| t.string "namespace" @@ -24,9 +27,9 @@ t.datetime "updated_at" end - add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id" - add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace" - add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id" + add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree + add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree + add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree create_table "admin_users", force: true do |t| t.string "email", default: "", null: false @@ -43,8 +46,8 @@ t.datetime "updated_at" end - add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true - add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true + add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true, using: :btree + add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree create_table "courses", force: true do |t| t.string "title" @@ -63,8 +66,8 @@ t.integer "instructor_id" end - add_index "courses_instructors", ["course_id"], name: "index_courses_instructors_on_course_id" - add_index "courses_instructors", ["instructor_id"], name: "index_courses_instructors_on_instructor_id" + add_index "courses_instructors", ["course_id"], name: "index_courses_instructors_on_course_id", using: :btree + add_index "courses_instructors", ["instructor_id"], name: "index_courses_instructors_on_instructor_id", using: :btree create_table "events", force: true do |t| t.string "name" @@ -76,10 +79,22 @@ t.datetime "created_at" t.datetime "updated_at" t.integer "partner_id" + t.integer "sponsor_id" + t.text "html_content" + t.text "markdown_content" + end + + add_index "events", ["partner_id"], name: "index_events_on_partner_id", using: :btree + add_index "events", ["semester_id"], name: "index_events_on_semester_id", using: :btree + add_index "events", ["sponsor_id"], name: "index_events_on_sponsor_id", using: :btree + + create_table "events_mentors", force: true do |t| + t.integer "event_id" + t.integer "mentor_id" end - add_index "events", ["partner_id"], name: "index_events_on_partner_id" - add_index "events", ["semester_id"], name: "index_events_on_semester_id" + add_index "events_mentors", ["event_id"], name: "index_events_mentors_on_event_id", using: :btree + add_index "events_mentors", ["mentor_id"], name: "index_events_mentors_on_mentor_id", using: :btree create_table "faqs", force: true do |t| t.string "question" @@ -94,8 +109,8 @@ t.integer "faq_id" end - add_index "faqs_semesters", ["faq_id"], name: "index_faqs_semesters_on_faq_id" - add_index "faqs_semesters", ["semester_id"], name: "index_faqs_semesters_on_semester_id" + add_index "faqs_semesters", ["faq_id"], name: "index_faqs_semesters_on_faq_id", using: :btree + add_index "faqs_semesters", ["semester_id"], name: "index_faqs_semesters_on_semester_id", using: :btree create_table "instructors", force: true do |t| t.string "name" @@ -113,7 +128,7 @@ t.datetime "updated_at" end - add_index "maps", ["semester_id"], name: "index_maps_on_semester_id" + add_index "maps", ["semester_id"], name: "index_maps_on_semester_id", using: :btree create_table "media", force: true do |t| t.string "title" @@ -123,7 +138,7 @@ t.integer "semester_id" end - add_index "media", ["semester_id"], name: "index_media_on_semester_id" + add_index "media", ["semester_id"], name: "index_media_on_semester_id", using: :btree create_table "mentors", force: true do |t| t.string "name" @@ -134,18 +149,22 @@ t.datetime "created_at" t.datetime "updated_at" t.text "html_content" + t.boolean "education" + t.boolean "poverty" + t.boolean "health" + t.boolean "energy" end - add_index "mentors", ["partner_id"], name: "index_mentors_on_partner_id" - add_index "mentors", ["sponsor_id"], name: "index_mentors_on_sponsor_id" + add_index "mentors", ["partner_id"], name: "index_mentors_on_partner_id", using: :btree + add_index "mentors", ["sponsor_id"], name: "index_mentors_on_sponsor_id", using: :btree create_table "mentors_semesters", force: true do |t| t.integer "mentor_id" t.integer "semester_id" end - add_index "mentors_semesters", ["mentor_id"], name: "index_mentors_semesters_on_mentor_id" - add_index "mentors_semesters", ["semester_id"], name: "index_mentors_semesters_on_semester_id" + add_index "mentors_semesters", ["mentor_id"], name: "index_mentors_semesters_on_mentor_id", using: :btree + add_index "mentors_semesters", ["semester_id"], name: "index_mentors_semesters_on_semester_id", using: :btree create_table "organizers", force: true do |t| t.string "name" @@ -160,8 +179,8 @@ t.integer "semester_id" end - add_index "organizers_semesters", ["organizer_id"], name: "index_organizers_semesters_on_organizer_id" - add_index "organizers_semesters", ["semester_id"], name: "index_organizers_semesters_on_semester_id" + add_index "organizers_semesters", ["organizer_id"], name: "index_organizers_semesters_on_organizer_id", using: :btree + add_index "organizers_semesters", ["semester_id"], name: "index_organizers_semesters_on_semester_id", using: :btree create_table "partners", force: true do |t| t.string "name" @@ -182,16 +201,16 @@ t.integer "prize_id" end - add_index "partners_prizes", ["partner_id"], name: "index_partners_prizes_on_partner_id" - add_index "partners_prizes", ["prize_id"], name: "index_partners_prizes_on_prize_id" + add_index "partners_prizes", ["partner_id"], name: "index_partners_prizes_on_partner_id", using: :btree + add_index "partners_prizes", ["prize_id"], name: "index_partners_prizes_on_prize_id", using: :btree create_table "partners_semesters", force: true do |t| t.integer "semester_id" t.integer "partner_id" end - add_index "partners_semesters", ["partner_id"], name: "index_partners_semesters_on_partner_id" - add_index "partners_semesters", ["semester_id"], name: "index_partners_semesters_on_semester_id" + add_index "partners_semesters", ["partner_id"], name: "index_partners_semesters_on_partner_id", using: :btree + add_index "partners_semesters", ["semester_id"], name: "index_partners_semesters_on_semester_id", using: :btree create_table "prizes", force: true do |t| t.string "title" @@ -201,10 +220,11 @@ t.datetime "created_at" t.datetime "updated_at" t.text "html_content" + t.boolean "api", default: false end - add_index "prizes", ["semester_id"], name: "index_prizes_on_semester_id" - add_index "prizes", ["sponsor_id"], name: "index_prizes_on_sponsor_id" + add_index "prizes", ["semester_id"], name: "index_prizes_on_semester_id", using: :btree + add_index "prizes", ["sponsor_id"], name: "index_prizes_on_sponsor_id", using: :btree create_table "semesters", force: true do |t| t.string "season" @@ -218,8 +238,8 @@ t.integer "sponsor_id" end - add_index "semesters_sponsors", ["semester_id"], name: "index_semesters_sponsors_on_semester_id" - add_index "semesters_sponsors", ["sponsor_id"], name: "index_semesters_sponsors_on_sponsor_id" + add_index "semesters_sponsors", ["semester_id"], name: "index_semesters_sponsors_on_semester_id", using: :btree + add_index "semesters_sponsors", ["sponsor_id"], name: "index_semesters_sponsors_on_sponsor_id", using: :btree create_table "sponsors", force: true do |t| t.string "name" @@ -227,6 +247,7 @@ t.string "link_url" t.datetime "created_at" t.datetime "updated_at" + t.string "tier" end create_table "winners", force: true do |t| @@ -238,6 +259,6 @@ t.string "prize_description" end - add_index "winners", ["semester_id"], name: "index_winners_on_semester_id" + add_index "winners", ["semester_id"], name: "index_winners_on_semester_id", using: :btree end diff --git a/main.go b/main.go new file mode 100644 index 0000000..e69de29 diff --git a/public/assets/active_admin-696ad98b5ec74a7a79462b8d5821974a.js b/public/assets/active_admin-696ad98b5ec74a7a79462b8d5821974a.js new file mode 100644 index 0000000..dedbfaf --- /dev/null +++ b/public/assets/active_admin-696ad98b5ec74a7a79462b8d5821974a.js @@ -0,0 +1,22995 @@ +/*! + * jQuery JavaScript Library v1.11.0 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2014-01-23T21:02Z + */ + + +(function( global, factory ) { + + if ( typeof module === "object" && typeof module.exports === "object" ) { + // For CommonJS and CommonJS-like environments where a proper window is present, + // execute the factory and get jQuery + // For environments that do not inherently posses a window with a document + // (such as Node.js), expose a jQuery-making factory as module.exports + // This accentuates the need for the creation of a real window + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Can't do this because several apps including ASP.NET trace +// the stack via arguments.caller.callee and Firefox dies if +// you try to trace through "use strict" call chains. (#13335) +// Support: Firefox 18+ +// + +var deletedIds = []; + +var slice = deletedIds.slice; + +var concat = deletedIds.concat; + +var push = deletedIds.push; + +var indexOf = deletedIds.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var trim = "".trim; + +var support = {}; + + + +var + version = "1.11.0", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // Start with an empty selector + selector: "", + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num != null ? + + // Return a 'clean' array + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : + + // Return just the object + slice.call( this ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + ret.context = this.context; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: deletedIds.sort, + splice: deletedIds.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var src, copyIsArray, copy, name, options, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + /* jshint eqeqeq: false */ + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + // parseFloat NaNs numeric-cast false positives (null|true|false|"") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + return obj - parseFloat( obj ) >= 0; + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + isPlainObject: function( obj ) { + var key; + + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !hasOwn.call(obj, "constructor") && + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Support: IE<9 + // Handle iteration over inherited properties before own properties. + if ( support.ownLast ) { + for ( key in obj ) { + return hasOwn.call( obj, key ); + } + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + for ( key in obj ) {} + + return key === undefined || hasOwn.call( obj, key ); + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call(obj) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && jQuery.trim( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var value, + i = 0, + length = obj.length, + isArray = isArraylike( obj ); + + if ( args ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } + } + + return obj; + }, + + // Use native String.trim function wherever possible + trim: trim && !trim.call("\uFEFF\xA0") ? + function( text ) { + return text == null ? + "" : + trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArraylike( Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( indexOf ) { + return indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + while ( j < len ) { + first[ i++ ] = second[ j++ ]; + } + + // Support: IE<9 + // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) + if ( len !== len ) { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, + i = 0, + length = elems.length, + isArray = isArraylike( elems ), + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var args, proxy, tmp; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: function() { + return +( new Date() ); + }, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +}); + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +function isArraylike( obj ) { + var length = obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v1.10.16 + * http://sizzlejs.com/ + * + * Copyright 2013 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2014-01-13 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + compile, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + -(new Date()), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // General-purpose constants + strundefined = typeof undefined, + MAX_NEGATIVE = 1 << 31, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf if we can't use a native one + indexOf = arr.indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", + + // Prefer arguments quoted, + // then not containing pseudos/brackets, + // then attribute selectors/non-parenthetical expressions, + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + rescape = /'|\\/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( documentIsHTML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document (jQuery #6963) + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // QSA path + if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + nid = old = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return !!fn( div ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( div.parentNode ) { + div.parentNode.removeChild( div ); + } + // release memory in IE + div = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = attrs.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + ( ~b.sourceIndex || MAX_NEGATIVE ) - + ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== strundefined && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, + doc = node ? node.ownerDocument || node : preferredDoc, + parent = doc.defaultView; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsHTML = !isXML( doc ); + + // Support: IE>8 + // If iframe document is assigned to "document" variable and if iframe has been reloaded, + // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 + // IE6-8 do not support the defaultView property so parent will be undefined + if ( parent && parent !== parent.top ) { + // IE11 does not have attachEvent, so all must suffer + if ( parent.addEventListener ) { + parent.addEventListener( "unload", function() { + setDocument(); + }, false ); + } else if ( parent.attachEvent ) { + parent.attachEvent( "onunload", function() { + setDocument(); + }); + } + } + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) + support.attributes = assert(function( div ) { + div.className = "i"; + return !div.getAttribute("className"); + }); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Check if getElementsByClassName can be trusted + support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { + div.innerHTML = "
      "; + + // Support: Safari<4 + // Catch class over-caching + div.firstChild.className = "i"; + // Support: Opera<10 + // Catch gEBCN failure to find non-leading classes + return div.getElementsByClassName("i").length === 2; + }); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert(function( div ) { + docElem.appendChild( div ).id = expando; + return !doc.getElementsByName || !doc.getElementsByName( expando ).length; + }); + + // ID find and filter + if ( support.getById ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && documentIsHTML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + // Support: IE6/7 + // getElementById is not reliable as a find shortcut + delete Expr.find["ID"]; + + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem, + tmp = [], + i = 0, + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See http://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ""; + + // Support: IE8, Opera 10-12 + // Nothing should be selected when empty strings follow ^= or $= or *= + if ( div.querySelectorAll("[t^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = doc.createElement("input"); + input.setAttribute( "type", "hidden" ); + div.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( div.querySelectorAll("[name=d]").length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { + + // Choose the first element that is related to our preferred document + if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { + return -1; + } + if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + return doc; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + if ( support.matchesSelector && documentIsHTML && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [elem] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + (val = elem.getAttributeNode(name)) && val.specified ? + val.value : + null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( (elem = results[i++]) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + while ( (node = elem[i++]) ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[5] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[3] && match[4] !== undefined ) { + match[2] = match[4]; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { return true; } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifier + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( (tokens = []) ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push({ + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + }); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push({ + value: matched, + type: type, + matches: match + }); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (oldCache = outerCache[ dir ]) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return (newCache[ 2 ] = oldCache[ 2 ]); + } else { + // Reuse newcache so results back-propagate to previous elements + outerCache[ dir ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), + len = elems.length; + + if ( outermost ) { + outermostContext = context !== document && context; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; +}; + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function select( selector, context, results, seed ) { + var i, tokens, token, type, find, + match = tokenize( selector ); + + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { + + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + } + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + } + + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + !documentIsHTML, + results, + rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +} + +// One-time assignments + +// Sort stability +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; + +// Support: Chrome<14 +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert(function( div1 ) { + // Should return 1, but returns 4 (following) + return div1.compareDocumentPosition( document.createElement("div") ) & 1; +}); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( div ) { + div.innerHTML = ""; + return div.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( div ) { + div.innerHTML = ""; + div.firstChild.setAttribute( "value", "" ); + return div.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert(function( div ) { + return div.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + null; + } + }); +} + +return Sizzle; + +})( window ); + + + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + + +var rneedsContext = jQuery.expr.match.needsContext; + +var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); + + + +var risSimple = /^.[^:#\[\.,]*$/; + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + /* jshint -W018 */ + return !!qualifier.call( elem, i, elem ) !== not; + }); + + } + + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + }); + + } + + if ( typeof qualifier === "string" ) { + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + qualifier = jQuery.filter( qualifier, elements ); + } + + return jQuery.grep( elements, function( elem ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; + }); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 && elem.nodeType === 1 ? + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + })); +}; + +jQuery.fn.extend({ + find: function( selector ) { + var i, + ret = [], + self = this, + len = self.length; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = this.selector ? this.selector + " " + selector : selector; + return ret; + }, + filter: function( selector ) { + return this.pushStack( winnow(this, selector || [], false) ); + }, + not: function( selector ) { + return this.pushStack( winnow(this, selector || [], true) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +}); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + init = jQuery.fn.init = function( selector, context ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return typeof rootjQuery.ready !== "undefined" ? + rootjQuery.ready( selector ) : + // Execute immediately if ready is not present + selector( jQuery ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.extend({ + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +jQuery.fn.extend({ + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { + // Always skip document fragments + if ( cur.nodeType < 11 && (pos ? + pos.index(cur) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector(cur, selectors)) ) { + + matched.push( cur ); + break; + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.unique( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + if ( this.length > 1 ) { + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + ret = jQuery.unique( ret ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + } + + return this.pushStack( ret ); + }; +}); +var rnotwhite = (/\S+/g); + + + +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // First callback to fire (used internally by add and fireWith) + firingStart, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); + }, + // Remove all callbacks from the list + empty: function() { + list = []; + firingLength = 0; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( list && ( !fired || stack ) ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); + return this; + }; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( values === progressValues ) { + deferred.notifyWith( contexts, values ); + + } else if ( !(--remaining) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); + + +// The deferred used on DOM ready +var readyList; + +jQuery.fn.ready = function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; +}; + +jQuery.extend({ + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); + } + } +}); + +/** + * Clean-up method for dom ready events + */ +function detach() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", completed, false ); + window.removeEventListener( "load", completed, false ); + + } else { + document.detachEvent( "onreadystatechange", completed ); + window.detachEvent( "onload", completed ); + } +} + +/** + * The ready event handler and self cleanup method + */ +function completed() { + // readyState === "complete" is good enough for us to call the dom ready in oldIE + if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { + detach(); + jQuery.ready(); + } +} + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", completed ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", completed ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // detach all dom ready events + detach(); + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); +}; + + +var strundefined = typeof undefined; + + + +// Support: IE<9 +// Iteration over object's inherited properties before its own +var i; +for ( i in jQuery( support ) ) { + break; +} +support.ownLast = i !== "0"; + +// Note: most support tests are defined in their respective modules. +// false until the test is run +support.inlineBlockNeedsLayout = false; + +jQuery(function() { + // We need to execute this one support test ASAP because we need to know + // if body.style.zoom needs to be set. + + var container, div, + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + // Setup + container = document.createElement( "div" ); + container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; + + div = document.createElement( "div" ); + body.appendChild( container ).appendChild( div ); + + if ( typeof div.style.zoom !== strundefined ) { + // Support: IE<8 + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + div.style.cssText = "border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1"; + + if ( (support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 )) ) { + // Prevent IE 6 from affecting layout for positioned elements #11048 + // Prevent IE from shrinking the body in IE 7 mode #12869 + // Support: IE<8 + body.style.zoom = 1; + } + } + + body.removeChild( container ); + + // Null elements to avoid leaks in IE + container = div = null; +}); + + + + +(function() { + var div = document.createElement( "div" ); + + // Execute the test only if not already executed in another module. + if (support.deleteExpando == null) { + // Support: IE<9 + support.deleteExpando = true; + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + } + + // Null elements to avoid leaks in IE. + div = null; +})(); + + +/** + * Determines whether an object can have data + */ +jQuery.acceptData = function( elem ) { + var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ], + nodeType = +elem.nodeType || 1; + + // Do not set data on non-element DOM nodes because it will not be cleared (#8335). + return nodeType !== 1 && nodeType !== 9 ? + false : + + // Nodes accept data unless otherwise specified; rejection can be conditional + !noData || noData !== true && elem.getAttribute("classid") === noData; +}; + + +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /([A-Z])/g; + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} + +function internalData( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var ret, thisCache, + internalKey = jQuery.expando, + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + // Avoid exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( typeof name === "string" ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; +} + +function internalRemoveData( elem, name, pvt ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } else { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = name.concat( jQuery.map( name, jQuery.camelCase ) ); + } + + i = name.length; + while ( i-- ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + /* jshint eqeqeq: false */ + } else if ( support.deleteExpando || cache != cache.window ) { + /* jshint eqeqeq: true */ + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } +} + +jQuery.extend({ + cache: {}, + + // The following elements (space-suffixed to avoid Object.prototype collisions) + // throw uncatchable exceptions if you attempt to set expando properties + noData: { + "applet ": true, + "embed ": true, + // ...but Flash objects (which have this classid) *can* handle expandos + "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data ) { + return internalData( elem, name, data ); + }, + + removeData: function( elem, name ) { + return internalRemoveData( elem, name ); + }, + + // For internal use only. + _data: function( elem, name, data ) { + return internalData( elem, name, data, true ); + }, + + _removeData: function( elem, name ) { + return internalRemoveData( elem, name, true ); + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var i, name, data, + elem = this[0], + attrs = elem && elem.attributes; + + // Special expections of .data basically thwart jQuery.access, + // so implement the relevant behavior ourselves + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + name = attrs[i].name; + + if ( name.indexOf("data-") === 0 ) { + name = jQuery.camelCase( name.slice(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + return arguments.length > 1 ? + + // Sets one value + this.each(function() { + jQuery.data( this, key, value ); + }) : + + // Gets one value + // Try to fetch any internally stored data first + elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + + +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery._removeData( elem, type + "queue" ); + jQuery._removeData( elem, key ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var isHidden = function( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); + }; + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + length = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < length; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; +}; +var rcheckableType = (/^(?:checkbox|radio)$/i); + + + +(function() { + var fragment = document.createDocumentFragment(), + div = document.createElement("div"), + input = document.createElement("input"); + + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = "
      a"; + + // IE strips leading whitespace when .innerHTML is used + support.leadingWhitespace = div.firstChild.nodeType === 3; + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + support.tbody = !div.getElementsByTagName( "tbody" ).length; + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + support.html5Clone = + document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav>"; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + input.type = "checkbox"; + input.checked = true; + fragment.appendChild( input ); + support.appendChecked = input.checked; + + // Make sure textarea (and checkbox) defaultValue is properly cloned + // Support: IE6-IE11+ + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; + + // #11217 - WebKit loses check when the name is after the checked attribute + fragment.appendChild( div ); + div.innerHTML = ""; + + // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 + // old WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Opera does not clone events (and typeof div.attachEvent === undefined). + // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() + support.noCloneEvent = true; + if ( div.attachEvent ) { + div.attachEvent( "onclick", function() { + support.noCloneEvent = false; + }); + + div.cloneNode( true ).click(); + } + + // Execute the test only if not already executed in another module. + if (support.deleteExpando == null) { + // Support: IE<9 + support.deleteExpando = true; + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + } + + // Null elements to avoid leaks in IE. + fragment = div = input = null; +})(); + + +(function() { + var i, eventName, + div = document.createElement( "div" ); + + // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) + for ( i in { submit: true, change: true, focusin: true }) { + eventName = "on" + i; + + if ( !(support[ i + "Bubbles" ] = eventName in window) ) { + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) + div.setAttribute( eventName, "t" ); + support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; + } + } + + // Null elements to avoid leaks in IE. + div = null; +})(); + + +var rformElems = /^(?:input|select|textarea)$/i, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + var tmp, events, t, handleObjIn, + special, eventHandle, handleObj, + handlers, type, namespaces, origType, + elemData = jQuery._data( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + var j, handleObj, tmp, + origCount, t, events, + special, handlers, type, + namespaces, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery._removeData( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + var handle, ontype, cur, + bubbleType, special, tmp, i, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(":") < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && jQuery.acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && + jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + try { + elem[ type ](); + } catch ( e ) { + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, ret, handleObj, matched, j, + handlerQueue = [], + args = slice.call( arguments ), + handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var sel, handleObj, matches, i, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { + + /* jshint eqeqeq: false */ + for ( ; cur != this; cur = cur.parentNode || this ) { + /* jshint eqeqeq: true */ + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Support: Chrome 23+, Safari? + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var body, eventDoc, doc, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return jQuery.nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Even when returnValue equals to undefined Firefox will still show alert + if ( event.result !== undefined ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === strundefined ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && ( + // Support: IE < 9 + src.returnValue === false || + // Support: Android < 4.0 + src.getPreventDefault && src.getPreventDefault() ) ? + returnTrue : + returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + if ( !e ) { + return; + } + + // If preventDefault exists, run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // Support: IE + // Otherwise set the returnValue property of the original event to false + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + if ( !e ) { + return; + } + // If stopPropagation exists, run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + + // Support: IE + // Set the cancelBubble property of the original event to true + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "submitBubbles" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "submitBubbles", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "changeBubbles", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this, + attaches = jQuery._data( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this, + attaches = jQuery._data( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + jQuery._removeData( doc, fix ); + } else { + jQuery._data( doc, fix, attaches ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var type, origFn; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +}); + + +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
      ", "
      " ], + area: [ 1, "", "" ], + param: [ 1, "", "" ], + thead: [ 1, "", "
      " ], + tr: [ 2, "", "
      " ], + col: [ 2, "", "
      " ], + td: [ 3, "", "
      " ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
      ", "
      " ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} + +// Used in buildFragment, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +// Support: IE<8 +// Manipulating tables requires a tbody +function manipulationTarget( elem, content ) { + return jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? + + elem.getElementsByTagName("tbody")[0] || + elem.appendChild( elem.ownerDocument.createElement("tbody") ) : + elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute("type"); + } + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); + } +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function fixCloneNodeIssues( src, dest ) { + var nodeName, e, data; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.defaultSelected = dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, node, clone, i, srcElements, + inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!support.noCloneEvent || !support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var j, elem, contains, + tmp, tag, tbody, wrap, + l = elems.length, + + // Ensure a safe fragment + safe = createSafeFragment( context ), + + nodes = [], + i = 0; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; + + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Manually add leading whitespace removed by IE + if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted from table fragments + if ( !support.tbody ) { + + // String was a , *may* have spurious + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare or + wrap[1] === "
      " && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var elem, type, id, data, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== strundefined ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + deletedIds.push( id ); + } + } + } + } + } +}); + +jQuery.fn.extend({ + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + append: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + remove: function( selector, keepData /* Internal Use Only */ ) { + var elem, + elems = selector ? jQuery.filter( selector, this ) : this, + i = 0; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map(function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var arg = arguments[ 0 ]; + + // Make the changes, replacing each context element with the new content + this.domManip( arguments, function( elem ) { + arg = this.parentNode; + + jQuery.cleanData( getAll( this ) ); + + if ( arg ) { + arg.replaceChild( elem, this ); + } + }); + + // Force removal if there was no new content (e.g., from empty arguments) + return arg && (arg.length || arg.nodeType) ? this : this.remove(); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, callback ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var first, node, hasScripts, + scripts, doc, fragment, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[0], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, self.html() ); + } + self.domManip( args, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( this[i], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return this; + } +}); + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + + +var iframe, + elemdisplay = {}; + +/** + * Retrieve the actual display of a element + * @param {String} name nodeName of the element + * @param {Object} doc Document object + */ +// Called only from within defaultDisplay +function actualDisplay( name, doc ) { + var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + + // getDefaultComputedStyle might be reliably used only on attached element + display = window.getDefaultComputedStyle ? + + // Use of this method is a temporary fix (more like optmization) until something better comes along, + // since it was removed from specification and supported only in FF + window.getDefaultComputedStyle( elem[ 0 ] ).display : jQuery.css( elem[ 0 ], "display" ); + + // We don't have any data stored on the element, + // so use "detach" method as fast way to get rid of the element + elem.detach(); + + return display; +} + +/** + * Try to determine the default display value of an element + * @param {String} nodeName + */ +function defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + + // Use the already-created iframe if possible + iframe = (iframe || jQuery( "