web_admin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +32 -0
- data/Gemfile.lock +335 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +22 -0
- data/app/assets/images/web_admin/.keep +0 -0
- data/app/assets/images/web_admin/avatar.jpg +0 -0
- data/app/assets/images/web_admin/first_icon.png +0 -0
- data/app/assets/images/web_admin/render-1-thumb.jpg +0 -0
- data/app/assets/images/web_admin/render-1.jpg +0 -0
- data/app/assets/images/web_admin/render-2-thumb.jpg +0 -0
- data/app/assets/images/web_admin/render-2.jpg +0 -0
- data/app/assets/images/web_admin/render-3-thumb.jpg +0 -0
- data/app/assets/images/web_admin/render-3.jpg +0 -0
- data/app/assets/images/web_admin/render-4-thumb.jpg +0 -0
- data/app/assets/images/web_admin/render-4.jpg +0 -0
- data/app/assets/images/web_admin/responsive.png +0 -0
- data/app/assets/javascripts/web_admin/app.data.js +336 -0
- data/app/assets/javascripts/web_admin/app.js +172 -0
- data/app/assets/javascripts/web_admin/app.plugin.js +220 -0
- data/app/assets/javascripts/web_admin/application.js +20 -0
- data/app/assets/javascripts/web_admin/bootstrap-filestyle.min.js +1 -0
- data/app/assets/javascripts/web_admin/bootstrap.js +1951 -0
- data/app/assets/javascripts/web_admin/charts/easypiechart/jquery.easy-pie-chart.js +184 -0
- data/app/assets/javascripts/web_admin/charts/sparkline/jquery.sparkline.min.js +5 -0
- data/app/assets/javascripts/web_admin/combodate/combodate.js +453 -0
- data/app/assets/javascripts/web_admin/combodate/moment.min.js +6 -0
- data/app/assets/javascripts/web_admin/data/datagrid.json +1900 -0
- data/app/assets/javascripts/web_admin/data/datatable.json +401 -0
- data/app/assets/javascripts/web_admin/datatables/jquery.dataTables.min.js +155 -0
- data/app/assets/javascripts/web_admin/datepicker/bootstrap-datepicker.js +474 -0
- data/app/assets/javascripts/web_admin/datepicker.js +3 -0
- data/app/assets/javascripts/web_admin/fuelux/fuelux.js +1645 -0
- data/app/assets/javascripts/web_admin/fullcalendar/fullcalendar.min.js +7 -0
- data/app/assets/javascripts/web_admin/grid/gallery.js +14 -0
- data/app/assets/javascripts/web_admin/grid/jquery.grid-a-licious.min.js +15 -0
- data/app/assets/javascripts/web_admin/grid/masonry.pkgd.min.js +9 -0
- data/app/assets/javascripts/web_admin/ie/excanvas.js +924 -0
- data/app/assets/javascripts/web_admin/ie/html5.js +9 -0
- data/app/assets/javascripts/web_admin/ie/respond.min.js +6 -0
- data/app/assets/javascripts/web_admin/jquery-ui-1.10.3.custom.min.js +6 -0
- data/app/assets/javascripts/web_admin/jquery.datetimepicker.js +1851 -0
- data/app/assets/javascripts/web_admin/jquery.ui.touch-punch.min.js +11 -0
- data/app/assets/javascripts/web_admin/parsley/parsley.min.js +35 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/default_thumb.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/loader.gif +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/sprite.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_next.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_prev.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_x.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/default/sprite_y.png +0 -0
- data/app/assets/javascripts/web_admin/prettyphoto/jquery.prettyPhoto.js +7 -0
- data/app/assets/javascripts/web_admin/prettyphoto/prettyPhoto.css +170 -0
- data/app/assets/javascripts/web_admin/select2/select2.css +652 -0
- data/app/assets/javascripts/web_admin/select2/select2.min.js +22 -0
- data/app/assets/javascripts/web_admin/slider/bootstrap-slider.js +388 -0
- data/app/assets/javascripts/web_admin/underscore-min.js +7 -0
- data/app/assets/javascripts/web_admin/underscore-min.map +1 -0
- data/app/assets/javascripts/web_admin/upload_image.js +39 -0
- data/app/assets/stylesheets/web_admin/application.css +15 -0
- data/app/assets/stylesheets/web_admin/bootstrap.css +5784 -0
- data/app/assets/stylesheets/web_admin/font-awesome.min.css +4 -0
- data/app/assets/stylesheets/web_admin/font.css +18 -0
- data/app/assets/stylesheets/web_admin/fonts/FontAwesome.otf +0 -0
- data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.svg +414 -0
- data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/stylesheets/web_admin/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.svg +229 -0
- data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/stylesheets/web_admin/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/stylesheets/web_admin/fonts/opensans/opensans-bold-webfont.woff +0 -0
- data/app/assets/stylesheets/web_admin/fonts/opensans/opensans-light-webfont.woff +0 -0
- data/app/assets/stylesheets/web_admin/fonts/opensans/opensans-webfont.woff +0 -0
- data/app/assets/stylesheets/web_admin/landing.css +272 -0
- data/app/assets/stylesheets/web_admin/plugin.css +1132 -0
- data/app/assets/stylesheets/web_admin/style.css +613 -0
- data/app/assets/stylesheets/web_admin/style2.css +21 -0
- data/app/controllers/web_admin/albums_controller.rb +8 -0
- data/app/controllers/web_admin/application_controller.rb +10 -0
- data/app/controllers/web_admin/crud_controller.rb +61 -0
- data/app/controllers/web_admin/events_controller.rb +9 -0
- data/app/controllers/web_admin/images_controller.rb +8 -0
- data/app/controllers/web_admin/institutionals_controller.rb +8 -0
- data/app/controllers/web_admin/main_controller.rb +7 -0
- data/app/controllers/web_admin/posts_controller.rb +19 -0
- data/app/controllers/web_admin/users_controller.rb +15 -0
- data/app/controllers/web_admin/videos_controller.rb +8 -0
- data/app/enumerations/web_admin/permission_type.rb +5 -0
- data/app/enumerations/web_admin/user_type.rb +6 -0
- data/app/helpers/web_admin/application_helper.rb +20 -0
- data/app/models/ability.rb +14 -0
- data/app/models/ckeditor/asset.rb +7 -0
- data/app/models/ckeditor/attachment_file.rb +7 -0
- data/app/models/ckeditor/picture.rb +7 -0
- data/app/models/web_admin/album.rb +13 -0
- data/app/models/web_admin/event.rb +20 -0
- data/app/models/web_admin/image.rb +10 -0
- data/app/models/web_admin/institutional.rb +11 -0
- data/app/models/web_admin/permission.rb +9 -0
- data/app/models/web_admin/post.rb +14 -0
- data/app/models/web_admin/user.rb +25 -0
- data/app/models/web_admin/video.rb +17 -0
- data/app/uploaders/ckeditor_attachment_file_uploader.rb +36 -0
- data/app/uploaders/ckeditor_picture_uploader.rb +47 -0
- data/app/uploaders/web_admin/image_post_uploader.rb +55 -0
- data/app/uploaders/web_admin/image_uploader.rb +52 -0
- data/app/views/devise/confirmations/new.html.erb +12 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +16 -0
- data/app/views/devise/passwords/new.html.erb +12 -0
- data/app/views/devise/registrations/edit.html.erb +29 -0
- data/app/views/devise/registrations/new.html.erb +18 -0
- data/app/views/devise/sessions/new.html.erb +16 -0
- data/app/views/devise/shared/_links.html.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/app/views/layouts/web_admin/devise.html.erb +42 -0
- data/app/views/shared/403.html +57 -0
- data/app/views/shared/_header.html.erb +16 -0
- data/app/views/shared/_navbar.html.erb +23 -0
- data/app/views/shared/_notice.html.erb +12 -0
- data/app/views/web_admin/albums/_form.html.erb +23 -0
- data/app/views/web_admin/albums/edit.html.erb +4 -0
- data/app/views/web_admin/albums/index.html.erb +39 -0
- data/app/views/web_admin/albums/new.html.erb +4 -0
- data/app/views/web_admin/albums/show.html.erb +4 -0
- data/app/views/web_admin/events/_form.html.erb +37 -0
- data/app/views/web_admin/events/edit.html.erb +4 -0
- data/app/views/web_admin/events/index.html.erb +39 -0
- data/app/views/web_admin/events/new.html.erb +4 -0
- data/app/views/web_admin/images/_form.html.erb +23 -0
- data/app/views/web_admin/images/_images.html.erb +10 -0
- data/app/views/web_admin/images/create.js.erb +2 -0
- data/app/views/web_admin/images/update.js.erb +2 -0
- data/app/views/web_admin/institutionals/_form.html.erb +22 -0
- data/app/views/web_admin/institutionals/edit.html.erb +4 -0
- data/app/views/web_admin/institutionals/index.html.erb +35 -0
- data/app/views/web_admin/institutionals/new.html.erb +4 -0
- data/app/views/web_admin/layouts/application.html.erb +77 -0
- data/app/views/web_admin/main/index.html.erb +1 -0
- data/app/views/web_admin/posts/_form.html.erb +27 -0
- data/app/views/web_admin/posts/edit.html.erb +4 -0
- data/app/views/web_admin/posts/index.html.erb +37 -0
- data/app/views/web_admin/posts/new.html.erb +4 -0
- data/app/views/web_admin/users/_form.html.erb +49 -0
- data/app/views/web_admin/users/edit.html.erb +4 -0
- data/app/views/web_admin/users/index.html.erb +35 -0
- data/app/views/web_admin/users/new.html.erb +4 -0
- data/app/views/web_admin/videos/_form.html.erb +22 -0
- data/app/views/web_admin/videos/edit.html.erb +4 -0
- data/app/views/web_admin/videos/index.html.erb +37 -0
- data/app/views/web_admin/videos/new.html.erb +4 -0
- data/bin/rails +12 -0
- data/config/initializers/ckeditor.rb +39 -0
- data/config/initializers/devise.rb +261 -0
- data/config/initializers/enumerate_it.rb +1 -0
- data/config/initializers/simple_form.rb +145 -0
- data/config/initializers/simple_form_bootstrap.rb +46 -0
- data/config/locales/buttons.yml +3 -0
- data/config/locales/controllers.yml +9 -0
- data/config/locales/devise.en.yml +62 -0
- data/config/locales/devise.pt.yml +62 -0
- data/config/locales/models.yml +54 -0
- data/config/locales/rails.yml +219 -0
- data/config/locales/responders.yml +10 -0
- data/config/locales/simple_form.en.yml +26 -0
- data/config/routes.rb +13 -0
- data/db/migrate/20141023223026_devise_create_admin_web_users.rb +42 -0
- data/db/migrate/20141023223656_create_admin_web_posts.rb +15 -0
- data/db/migrate/20141026181117_create_ckeditor_assets.rb +26 -0
- data/db/migrate/20141028020102_create_admin_web_institutionals.rb +10 -0
- data/db/migrate/20141028135201_create_admin_web_videos.rb +10 -0
- data/db/migrate/20141114020551_create_admin_web_albums.rb +12 -0
- data/db/migrate/20141117183405_create_admin_web_images.rb +11 -0
- data/db/migrate/20141130203155_add_user_type_to_users.rb +5 -0
- data/db/migrate/20141224221959_create_admin_web_events.rb +18 -0
- data/db/migrate/20150130140502_create_admin_web_permissions.rb +13 -0
- data/db/migrate/20150510191213_rename_tables.rb +12 -0
- data/lib/application_responder.rb +12 -0
- data/lib/tasks/web_admin_tasks.rake +4 -0
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/lib/web_admin/engine.rb +15 -0
- data/lib/web_admin/version.rb +3 -0
- data/lib/web_admin.rb +18 -0
- data/spec/factories/admin_web_users.rb +24 -0
- data/spec/features/admin_web/albums_spec.rb +74 -0
- data/spec/features/admin_web/event_spec.rb +85 -0
- data/spec/features/admin_web/institutionals_spec.rb +47 -0
- data/spec/features/admin_web/login_spec.rb +18 -0
- data/spec/features/admin_web/permissions_spec.rb +40 -0
- data/spec/features/admin_web/posts_spec.rb +55 -0
- data/spec/features/admin_web/users_spec.rb +73 -0
- data/spec/features/admin_web/videos_spec.rb +51 -0
- data/spec/fixtures/p3-single.jpg +0 -0
- data/spec/models/admin_web/album_spec.rb +20 -0
- data/spec/models/admin_web/event_spec.rb +42 -0
- data/spec/models/admin_web/image_spec.rb +14 -0
- data/spec/models/admin_web/institutional_spec.rb +19 -0
- data/spec/models/admin_web/permission_spec.rb +14 -0
- data/spec/models/admin_web/post_spec.rb +25 -0
- data/spec/models/admin_web/user_spec.rb +18 -0
- data/spec/models/admin_web/video_spec.rb +26 -0
- data/spec/rails_helper.rb +52 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/support/capybara.rb +53 -0
- data/spec/support/database_cleaner.rb +25 -0
- data/spec/support/devise.rb +5 -0
- data/spec/support/factory_girl.rb +4 -0
- data/spec/support/helpers.rb +82 -0
- data/spec/support/shared_connection.rb +10 -0
- data/spec/test_app/README.rdoc +28 -0
- data/spec/test_app/Rakefile +6 -0
- data/spec/test_app/app/assets/images/.keep +0 -0
- data/spec/test_app/app/assets/javascripts/application.js +13 -0
- data/spec/test_app/app/assets/stylesheets/application.css +15 -0
- data/spec/test_app/app/controllers/application_controller.rb +5 -0
- data/spec/test_app/app/controllers/concerns/.keep +0 -0
- data/spec/test_app/app/helpers/application_helper.rb +2 -0
- data/spec/test_app/app/mailers/.keep +0 -0
- data/spec/test_app/app/models/.keep +0 -0
- data/spec/test_app/app/models/concerns/.keep +0 -0
- data/spec/test_app/app/views/layouts/application.html.erb +14 -0
- data/spec/test_app/bin/bundle +3 -0
- data/spec/test_app/bin/rails +4 -0
- data/spec/test_app/bin/rake +4 -0
- data/spec/test_app/config/application.rb +29 -0
- data/spec/test_app/config/boot.rb +5 -0
- data/spec/test_app/config/database.yml +85 -0
- data/spec/test_app/config/environment.rb +5 -0
- data/spec/test_app/config/environments/development.rb +37 -0
- data/spec/test_app/config/environments/production.rb +78 -0
- data/spec/test_app/config/environments/test.rb +39 -0
- data/spec/test_app/config/initializers/assets.rb +8 -0
- data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/test_app/config/initializers/cookies_serializer.rb +3 -0
- data/spec/test_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/test_app/config/initializers/inflections.rb +16 -0
- data/spec/test_app/config/initializers/mime_types.rb +4 -0
- data/spec/test_app/config/initializers/session_store.rb +3 -0
- data/spec/test_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/test_app/config/locales/en.yml +23 -0
- data/spec/test_app/config/routes.rb +4 -0
- data/spec/test_app/config/secrets.yml +22 -0
- data/spec/test_app/config.ru +4 -0
- data/spec/test_app/db/schema.rb +121 -0
- data/spec/test_app/lib/assets/.keep +0 -0
- data/spec/test_app/log/.keep +0 -0
- data/spec/test_app/public/404.html +67 -0
- data/spec/test_app/public/422.html +67 -0
- data/spec/test_app/public/500.html +66 -0
- data/spec/test_app/public/favicon.ico +0 -0
- data/spec/test_app/spec/factories/admin_web_albums.rb +7 -0
- data/spec/test_app/spec/factories/admin_web_users.rb +24 -0
- data/spec/test_app/spec/factories/permissions.rb +36 -0
- data/web_admin.gemspec +38 -0
- data/wercker.yml +16 -0
- metadata +530 -0
@@ -0,0 +1,453 @@
|
|
1
|
+
/**
|
2
|
+
* Combodate - 1.0.4
|
3
|
+
* Dropdown date and time picker.
|
4
|
+
* Converts text input into dropdowns to pick day, month, year, hour, minute and second.
|
5
|
+
* Uses momentjs as datetime library http://momentjs.com.
|
6
|
+
* For i18n include corresponding file from https://github.com/timrwood/moment/tree/master/lang
|
7
|
+
*
|
8
|
+
* Confusion at noon and midnight - see http://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight
|
9
|
+
* In combodate:
|
10
|
+
* 12:00 pm --> 12:00 (24-h format, midday)
|
11
|
+
* 12:00 am --> 00:00 (24-h format, midnight, start of day)
|
12
|
+
*
|
13
|
+
* Differs from momentjs parse rules:
|
14
|
+
* 00:00 pm, 12:00 pm --> 12:00 (24-h format, day not change)
|
15
|
+
* 00:00 am, 12:00 am --> 00:00 (24-h format, day not change)
|
16
|
+
*
|
17
|
+
*
|
18
|
+
* Author: Vitaliy Potapov
|
19
|
+
* Project page: http://github.com/vitalets/combodate
|
20
|
+
* Copyright (c) 2012 Vitaliy Potapov. Released under MIT License.
|
21
|
+
**/
|
22
|
+
(function ($) {
|
23
|
+
|
24
|
+
var Combodate = function (element, options) {
|
25
|
+
this.$element = $(element);
|
26
|
+
if(!this.$element.is('input')) {
|
27
|
+
$.error('Combodate should be applied to INPUT element');
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
this.options = $.extend({}, $.fn.combodate.defaults, options, this.$element.data());
|
31
|
+
this.init();
|
32
|
+
};
|
33
|
+
|
34
|
+
Combodate.prototype = {
|
35
|
+
constructor: Combodate,
|
36
|
+
init: function () {
|
37
|
+
this.map = {
|
38
|
+
//key regexp moment.method
|
39
|
+
day: ['D', 'date'],
|
40
|
+
month: ['M', 'month'],
|
41
|
+
year: ['Y', 'year'],
|
42
|
+
hour: ['[Hh]', 'hours'],
|
43
|
+
minute: ['m', 'minutes'],
|
44
|
+
second: ['s', 'seconds'],
|
45
|
+
ampm: ['[Aa]', '']
|
46
|
+
};
|
47
|
+
|
48
|
+
this.$widget = $('<span class="combodate"></span>').html(this.getTemplate());
|
49
|
+
|
50
|
+
this.initCombos();
|
51
|
+
|
52
|
+
//update original input on change
|
53
|
+
this.$widget.on('change', 'select', $.proxy(function(){
|
54
|
+
this.$element.val(this.getValue());
|
55
|
+
}, this));
|
56
|
+
|
57
|
+
this.$widget.find('select').css('width', 'auto');
|
58
|
+
|
59
|
+
//hide original input and insert widget
|
60
|
+
this.$element.hide().after(this.$widget);
|
61
|
+
|
62
|
+
//set initial value
|
63
|
+
this.setValue(this.$element.val() || this.options.value);
|
64
|
+
},
|
65
|
+
|
66
|
+
/*
|
67
|
+
Replace tokens in template with <select> elements
|
68
|
+
*/
|
69
|
+
getTemplate: function() {
|
70
|
+
var tpl = this.options.template;
|
71
|
+
|
72
|
+
//first pass
|
73
|
+
$.each(this.map, function(k, v) {
|
74
|
+
v = v[0];
|
75
|
+
var r = new RegExp(v+'+'),
|
76
|
+
token = v.length > 1 ? v.substring(1, 2) : v;
|
77
|
+
|
78
|
+
tpl = tpl.replace(r, '{'+token+'}');
|
79
|
+
});
|
80
|
+
|
81
|
+
//replace spaces with
|
82
|
+
tpl = tpl.replace(/ /g, ' ');
|
83
|
+
|
84
|
+
//second pass
|
85
|
+
$.each(this.map, function(k, v) {
|
86
|
+
v = v[0];
|
87
|
+
var token = v.length > 1 ? v.substring(1, 2) : v;
|
88
|
+
|
89
|
+
tpl = tpl.replace('{'+token+'}', '<select class="'+k+'"></select>');
|
90
|
+
});
|
91
|
+
|
92
|
+
return tpl;
|
93
|
+
},
|
94
|
+
|
95
|
+
/*
|
96
|
+
Initialize combos that presents in template
|
97
|
+
*/
|
98
|
+
initCombos: function() {
|
99
|
+
var that = this;
|
100
|
+
$.each(this.map, function(k, v) {
|
101
|
+
var $c = that.$widget.find('.'+k), f, items;
|
102
|
+
if($c.length) {
|
103
|
+
that['$'+k] = $c; //set properties like this.$day, this.$month etc.
|
104
|
+
f = 'fill' + k.charAt(0).toUpperCase() + k.slice(1); //define method name to fill items, e.g `fillDays`
|
105
|
+
items = that[f]();
|
106
|
+
that['$'+k].html(that.renderItems(items));
|
107
|
+
}
|
108
|
+
});
|
109
|
+
},
|
110
|
+
|
111
|
+
/*
|
112
|
+
Initialize items of combos. Handles `firstItem` option
|
113
|
+
*/
|
114
|
+
initItems: function(key) {
|
115
|
+
var values = [],
|
116
|
+
relTime;
|
117
|
+
|
118
|
+
if(this.options.firstItem === 'name') {
|
119
|
+
//need both to support moment ver < 2 and >= 2
|
120
|
+
relTime = moment.relativeTime || moment.langData()._relativeTime;
|
121
|
+
var header = typeof relTime[key] === 'function' ? relTime[key](1, true, key, false) : relTime[key];
|
122
|
+
//take last entry (see momentjs lang files structure)
|
123
|
+
header = header.split(' ').reverse()[0];
|
124
|
+
values.push(['', header]);
|
125
|
+
} else if(this.options.firstItem === 'empty') {
|
126
|
+
values.push(['', '']);
|
127
|
+
}
|
128
|
+
return values;
|
129
|
+
},
|
130
|
+
|
131
|
+
/*
|
132
|
+
render items to string of <option> tags
|
133
|
+
*/
|
134
|
+
renderItems: function(items) {
|
135
|
+
var str = [];
|
136
|
+
for(var i=0; i<items.length; i++) {
|
137
|
+
str.push('<option value="'+items[i][0]+'">'+items[i][1]+'</option>');
|
138
|
+
}
|
139
|
+
return str.join("\n");
|
140
|
+
},
|
141
|
+
|
142
|
+
/*
|
143
|
+
fill day
|
144
|
+
*/
|
145
|
+
fillDay: function() {
|
146
|
+
var items = this.initItems('d'), name, i,
|
147
|
+
twoDigit = this.options.template.indexOf('DD') !== -1;
|
148
|
+
|
149
|
+
for(i=1; i<=31; i++) {
|
150
|
+
name = twoDigit ? this.leadZero(i) : i;
|
151
|
+
items.push([i, name]);
|
152
|
+
}
|
153
|
+
return items;
|
154
|
+
},
|
155
|
+
|
156
|
+
/*
|
157
|
+
fill month
|
158
|
+
*/
|
159
|
+
fillMonth: function() {
|
160
|
+
var items = this.initItems('M'), name, i,
|
161
|
+
longNames = this.options.template.indexOf('MMMM') !== -1,
|
162
|
+
shortNames = this.options.template.indexOf('MMM') !== -1,
|
163
|
+
twoDigit = this.options.template.indexOf('MM') !== -1;
|
164
|
+
|
165
|
+
for(i=0; i<=11; i++) {
|
166
|
+
if(longNames) {
|
167
|
+
//see https://github.com/timrwood/momentjs.com/pull/36
|
168
|
+
name = moment().date(1).month(i).format('MMMM');
|
169
|
+
} else if(shortNames) {
|
170
|
+
name = moment().date(1).month(i).format('MMM');
|
171
|
+
} else if(twoDigit) {
|
172
|
+
name = this.leadZero(i+1);
|
173
|
+
} else {
|
174
|
+
name = i+1;
|
175
|
+
}
|
176
|
+
items.push([i, name]);
|
177
|
+
}
|
178
|
+
return items;
|
179
|
+
},
|
180
|
+
|
181
|
+
/*
|
182
|
+
fill year
|
183
|
+
*/
|
184
|
+
fillYear: function() {
|
185
|
+
var items = [], name, i,
|
186
|
+
longNames = this.options.template.indexOf('YYYY') !== -1;
|
187
|
+
|
188
|
+
for(i=this.options.maxYear; i>=this.options.minYear; i--) {
|
189
|
+
name = longNames ? i : (i+'').substring(2);
|
190
|
+
items[this.options.yearDescending ? 'push' : 'unshift']([i, name]);
|
191
|
+
}
|
192
|
+
|
193
|
+
items = this.initItems('y').concat(items);
|
194
|
+
|
195
|
+
return items;
|
196
|
+
},
|
197
|
+
|
198
|
+
/*
|
199
|
+
fill hour
|
200
|
+
*/
|
201
|
+
fillHour: function() {
|
202
|
+
var items = this.initItems('h'), name, i,
|
203
|
+
h12 = this.options.template.indexOf('h') !== -1,
|
204
|
+
h24 = this.options.template.indexOf('H') !== -1,
|
205
|
+
twoDigit = this.options.template.toLowerCase().indexOf('hh') !== -1,
|
206
|
+
min = h12 ? 1 : 0,
|
207
|
+
max = h12 ? 12 : 23;
|
208
|
+
|
209
|
+
for(i=min; i<=max; i++) {
|
210
|
+
name = twoDigit ? this.leadZero(i) : i;
|
211
|
+
items.push([i, name]);
|
212
|
+
}
|
213
|
+
return items;
|
214
|
+
},
|
215
|
+
|
216
|
+
/*
|
217
|
+
fill minute
|
218
|
+
*/
|
219
|
+
fillMinute: function() {
|
220
|
+
var items = this.initItems('m'), name, i,
|
221
|
+
twoDigit = this.options.template.indexOf('mm') !== -1;
|
222
|
+
|
223
|
+
for(i=0; i<=59; i+= this.options.minuteStep) {
|
224
|
+
name = twoDigit ? this.leadZero(i) : i;
|
225
|
+
items.push([i, name]);
|
226
|
+
}
|
227
|
+
return items;
|
228
|
+
},
|
229
|
+
|
230
|
+
/*
|
231
|
+
fill second
|
232
|
+
*/
|
233
|
+
fillSecond: function() {
|
234
|
+
var items = this.initItems('s'), name, i,
|
235
|
+
twoDigit = this.options.template.indexOf('ss') !== -1;
|
236
|
+
|
237
|
+
for(i=0; i<=59; i+= this.options.secondStep) {
|
238
|
+
name = twoDigit ? this.leadZero(i) : i;
|
239
|
+
items.push([i, name]);
|
240
|
+
}
|
241
|
+
return items;
|
242
|
+
},
|
243
|
+
|
244
|
+
/*
|
245
|
+
fill ampm
|
246
|
+
*/
|
247
|
+
fillAmpm: function() {
|
248
|
+
var ampmL = this.options.template.indexOf('a') !== -1,
|
249
|
+
ampmU = this.options.template.indexOf('A') !== -1,
|
250
|
+
items = [
|
251
|
+
['am', ampmL ? 'am' : 'AM'],
|
252
|
+
['pm', ampmL ? 'pm' : 'PM']
|
253
|
+
];
|
254
|
+
return items;
|
255
|
+
},
|
256
|
+
|
257
|
+
/*
|
258
|
+
Returns current date value from combos.
|
259
|
+
If format not specified - `options.format` used.
|
260
|
+
If format = `null` - Moment object returned.
|
261
|
+
*/
|
262
|
+
getValue: function(format) {
|
263
|
+
var dt, values = {},
|
264
|
+
that = this,
|
265
|
+
notSelected = false;
|
266
|
+
|
267
|
+
//getting selected values
|
268
|
+
$.each(this.map, function(k, v) {
|
269
|
+
if(k === 'ampm') {
|
270
|
+
return;
|
271
|
+
}
|
272
|
+
var def = k === 'day' ? 1 : 0;
|
273
|
+
|
274
|
+
values[k] = that['$'+k] ? parseInt(that['$'+k].val(), 10) : def;
|
275
|
+
|
276
|
+
if(isNaN(values[k])) {
|
277
|
+
notSelected = true;
|
278
|
+
return false;
|
279
|
+
}
|
280
|
+
});
|
281
|
+
|
282
|
+
//if at least one visible combo not selected - return empty string
|
283
|
+
if(notSelected) {
|
284
|
+
return '';
|
285
|
+
}
|
286
|
+
|
287
|
+
//convert hours 12h --> 24h
|
288
|
+
if(this.$ampm) {
|
289
|
+
//12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day)
|
290
|
+
if(values.hour === 12) {
|
291
|
+
values.hour = this.$ampm.val() === 'am' ? 0 : 12;
|
292
|
+
} else {
|
293
|
+
values.hour = this.$ampm.val() === 'am' ? values.hour : values.hour+12;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
dt = moment([values.year, values.month, values.day, values.hour, values.minute, values.second]);
|
298
|
+
|
299
|
+
//highlight invalid date
|
300
|
+
this.highlight(dt);
|
301
|
+
|
302
|
+
format = format === undefined ? this.options.format : format;
|
303
|
+
if(format === null) {
|
304
|
+
return dt.isValid() ? dt : null;
|
305
|
+
} else {
|
306
|
+
return dt.isValid() ? dt.format(format) : '';
|
307
|
+
}
|
308
|
+
},
|
309
|
+
|
310
|
+
setValue: function(value) {
|
311
|
+
if(!value) {
|
312
|
+
return;
|
313
|
+
}
|
314
|
+
|
315
|
+
var dt = typeof value === 'string' ? moment(value, this.options.format) : moment(value),
|
316
|
+
that = this,
|
317
|
+
values = {};
|
318
|
+
|
319
|
+
//function to find nearest value in select options
|
320
|
+
function getNearest($select, value) {
|
321
|
+
var delta = {};
|
322
|
+
$select.children('option').each(function(i, opt){
|
323
|
+
var optValue = $(opt).attr('value'),
|
324
|
+
distance;
|
325
|
+
|
326
|
+
if(optValue === '') return;
|
327
|
+
distance = Math.abs(optValue - value);
|
328
|
+
if(typeof delta.distance === 'undefined' || distance < delta.distance) {
|
329
|
+
delta = {value: optValue, distance: distance};
|
330
|
+
}
|
331
|
+
});
|
332
|
+
return delta.value;
|
333
|
+
}
|
334
|
+
|
335
|
+
if(dt.isValid()) {
|
336
|
+
//read values from date object
|
337
|
+
$.each(this.map, function(k, v) {
|
338
|
+
if(k === 'ampm') {
|
339
|
+
return;
|
340
|
+
}
|
341
|
+
values[k] = dt[v[1]]();
|
342
|
+
});
|
343
|
+
|
344
|
+
if(this.$ampm) {
|
345
|
+
//12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day)
|
346
|
+
if(values.hour >= 12) {
|
347
|
+
values.ampm = 'pm';
|
348
|
+
if(values.hour > 12) {
|
349
|
+
values.hour -= 12;
|
350
|
+
}
|
351
|
+
} else {
|
352
|
+
values.ampm = 'am';
|
353
|
+
if(values.hour === 0) {
|
354
|
+
values.hour = 12;
|
355
|
+
}
|
356
|
+
}
|
357
|
+
}
|
358
|
+
|
359
|
+
$.each(values, function(k, v) {
|
360
|
+
//call val() for each existing combo, e.g. this.$hour.val()
|
361
|
+
if(that['$'+k]) {
|
362
|
+
|
363
|
+
if(k === 'minute' && that.options.minuteStep > 1 && that.options.roundTime) {
|
364
|
+
v = getNearest(that['$'+k], v);
|
365
|
+
}
|
366
|
+
|
367
|
+
if(k === 'second' && that.options.secondStep > 1 && that.options.roundTime) {
|
368
|
+
v = getNearest(that['$'+k], v);
|
369
|
+
}
|
370
|
+
|
371
|
+
that['$'+k].val(v);
|
372
|
+
}
|
373
|
+
});
|
374
|
+
|
375
|
+
this.$element.val(dt.format(this.options.format));
|
376
|
+
}
|
377
|
+
},
|
378
|
+
|
379
|
+
/*
|
380
|
+
highlight combos if date is invalid
|
381
|
+
*/
|
382
|
+
highlight: function(dt) {
|
383
|
+
if(!dt.isValid()) {
|
384
|
+
if(this.options.errorClass) {
|
385
|
+
this.$widget.addClass(this.options.errorClass);
|
386
|
+
} else {
|
387
|
+
//store original border color
|
388
|
+
if(!this.borderColor) {
|
389
|
+
this.borderColor = this.$widget.find('select').css('border-color');
|
390
|
+
}
|
391
|
+
this.$widget.find('select').css('border-color', 'red');
|
392
|
+
}
|
393
|
+
} else {
|
394
|
+
if(this.options.errorClass) {
|
395
|
+
this.$widget.removeClass(this.options.errorClass);
|
396
|
+
} else {
|
397
|
+
this.$widget.find('select').css('border-color', this.borderColor);
|
398
|
+
}
|
399
|
+
}
|
400
|
+
},
|
401
|
+
|
402
|
+
leadZero: function(v) {
|
403
|
+
return v <= 9 ? '0' + v : v;
|
404
|
+
},
|
405
|
+
|
406
|
+
destroy: function() {
|
407
|
+
this.$widget.remove();
|
408
|
+
this.$element.removeData('combodate').show();
|
409
|
+
}
|
410
|
+
|
411
|
+
//todo: clear method
|
412
|
+
};
|
413
|
+
|
414
|
+
$.fn.combodate = function ( option ) {
|
415
|
+
var d, args = Array.apply(null, arguments);
|
416
|
+
args.shift();
|
417
|
+
|
418
|
+
//getValue returns date as string / object (not jQuery object)
|
419
|
+
if(option === 'getValue' && this.length && (d = this.eq(0).data('combodate'))) {
|
420
|
+
return d.getValue.apply(d, args);
|
421
|
+
}
|
422
|
+
|
423
|
+
return this.each(function () {
|
424
|
+
var $this = $(this),
|
425
|
+
data = $this.data('combodate'),
|
426
|
+
options = typeof option == 'object' && option;
|
427
|
+
if (!data) {
|
428
|
+
$this.data('combodate', (data = new Combodate(this, options)));
|
429
|
+
}
|
430
|
+
if (typeof option == 'string' && typeof data[option] == 'function') {
|
431
|
+
data[option].apply(data, args);
|
432
|
+
}
|
433
|
+
});
|
434
|
+
};
|
435
|
+
|
436
|
+
$.fn.combodate.defaults = {
|
437
|
+
//in this format value stored in original input
|
438
|
+
format: 'DD-MM-YYYY HH:mm',
|
439
|
+
//in this format items in dropdowns are displayed
|
440
|
+
template: 'D / MMM / YYYY H : mm',
|
441
|
+
//initial value, can be `new Date()`
|
442
|
+
value: null,
|
443
|
+
minYear: 1970,
|
444
|
+
maxYear: 2015,
|
445
|
+
yearDescending: true,
|
446
|
+
minuteStep: 5,
|
447
|
+
secondStep: 1,
|
448
|
+
firstItem: 'empty', //'name', 'empty', 'none'
|
449
|
+
errorClass: null,
|
450
|
+
roundTime: true //whether to round minutes and seconds if step > 1
|
451
|
+
};
|
452
|
+
|
453
|
+
}(window.jQuery));
|
@@ -0,0 +1,6 @@
|
|
1
|
+
// moment.js
|
2
|
+
// version : 2.0.0
|
3
|
+
// author : Tim Wood
|
4
|
+
// license : MIT
|
5
|
+
// momentjs.com
|
6
|
+
(function(e){function O(e,t){return function(n){return j(e.call(this,n),t)}}function M(e){return function(t){return this.lang().ordinal(e.call(this,t))}}function _(){}function D(e){H(this,e)}function P(e){var t=this._data={},n=e.years||e.year||e.y||0,r=e.months||e.month||e.M||0,i=e.weeks||e.week||e.w||0,s=e.days||e.day||e.d||0,o=e.hours||e.hour||e.h||0,u=e.minutes||e.minute||e.m||0,a=e.seconds||e.second||e.s||0,f=e.milliseconds||e.millisecond||e.ms||0;this._milliseconds=f+a*1e3+u*6e4+o*36e5,this._days=s+i*7,this._months=r+n*12,t.milliseconds=f%1e3,a+=B(f/1e3),t.seconds=a%60,u+=B(a/60),t.minutes=u%60,o+=B(u/60),t.hours=o%24,s+=B(o/24),s+=i*7,t.days=s%30,r+=B(s/30),t.months=r%12,n+=B(r/12),t.years=n}function H(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function B(e){return e<0?Math.ceil(e):Math.floor(e)}function j(e,t){var n=e+"";while(n.length<t)n="0"+n;return n}function F(e,t,n){var r=t._milliseconds,i=t._days,s=t._months,o;r&&e._d.setTime(+e+r*n),i&&e.date(e.date()+i*n),s&&(o=e.date(),e.date(1).month(e.month()+s*n).date(Math.min(o,e.daysInMonth())))}function I(e){return Object.prototype.toString.call(e)==="[object Array]"}function q(e,t){var n=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),i=0,s;for(s=0;s<n;s++)~~e[s]!==~~t[s]&&i++;return i+r}function R(e,t){return t.abbr=e,s[e]||(s[e]=new _),s[e].set(t),s[e]}function U(e){return e?(!s[e]&&o&&require("./lang/"+e),s[e]):t.fn._lang}function z(e){return e.match(/\[.*\]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function W(e){var t=e.match(a),n,r;for(n=0,r=t.length;n<r;n++)A[t[n]]?t[n]=A[t[n]]:t[n]=z(t[n]);return function(i){var s="";for(n=0;n<r;n++)s+=typeof t[n].call=="function"?t[n].call(i,e):t[n];return s}}function X(e,t){function r(t){return e.lang().longDateFormat(t)||t}var n=5;while(n--&&f.test(t))t=t.replace(f,r);return C[t]||(C[t]=W(t)),C[t](e)}function V(e){switch(e){case"DDDD":return p;case"YYYY":return d;case"YYYYY":return v;case"S":case"SS":case"SSS":case"DDD":return h;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return m;case"X":return b;case"Z":case"ZZ":return g;case"T":return y;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return c;default:return new RegExp(e.replace("\\",""))}}function $(e,t,n){var r,i,s=n._a;switch(e){case"M":case"MM":s[1]=t==null?0:~~t-1;break;case"MMM":case"MMMM":r=U(n._l).monthsParse(t),r!=null?s[1]=r:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":t!=null&&(s[2]=~~t);break;case"YY":s[0]=~~t+(~~t>68?1900:2e3);break;case"YYYY":case"YYYYY":s[0]=~~t;break;case"a":case"A":n._isPm=(t+"").toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":s[3]=~~t;break;case"m":case"mm":s[4]=~~t;break;case"s":case"ss":s[5]=~~t;break;case"S":case"SS":case"SSS":s[6]=~~(("0."+t)*1e3);break;case"X":n._d=new Date(parseFloat(t)*1e3);break;case"Z":case"ZZ":n._useUTC=!0,r=(t+"").match(x),r&&r[1]&&(n._tzh=~~r[1]),r&&r[2]&&(n._tzm=~~r[2]),r&&r[0]==="+"&&(n._tzh=-n._tzh,n._tzm=-n._tzm)}t==null&&(n._isValid=!1)}function J(e){var t,n,r=[];if(e._d)return;for(t=0;t<7;t++)e._a[t]=r[t]=e._a[t]==null?t===2?1:0:e._a[t];r[3]+=e._tzh||0,r[4]+=e._tzm||0,n=new Date(0),e._useUTC?(n.setUTCFullYear(r[0],r[1],r[2]),n.setUTCHours(r[3],r[4],r[5],r[6])):(n.setFullYear(r[0],r[1],r[2]),n.setHours(r[3],r[4],r[5],r[6])),e._d=n}function K(e){var t=e._f.match(a),n=e._i,r,i;e._a=[];for(r=0;r<t.length;r++)i=(V(t[r]).exec(n)||[])[0],i&&(n=n.slice(n.indexOf(i)+i.length)),A[t[r]]&&$(t[r],i,e);e._isPm&&e._a[3]<12&&(e._a[3]+=12),e._isPm===!1&&e._a[3]===12&&(e._a[3]=0),J(e)}function Q(e){var t,n,r,i=99,s,o,u;while(e._f.length){t=H({},e),t._f=e._f.pop(),K(t),n=new D(t);if(n.isValid()){r=n;break}u=q(t._a,n.toArray()),u<i&&(i=u,r=n)}H(e,r)}function G(e){var t,n=e._i;if(w.exec(n)){e._f="YYYY-MM-DDT";for(t=0;t<4;t++)if(S[t][1].exec(n)){e._f+=S[t][0];break}g.exec(n)&&(e._f+=" Z"),K(e)}else e._d=new Date(n)}function Y(t){var n=t._i,r=u.exec(n);n===e?t._d=new Date:r?t._d=new Date(+r[1]):typeof n=="string"?G(t):I(n)?(t._a=n.slice(0),J(t)):t._d=n instanceof Date?new Date(+n):new Date(n)}function Z(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}function et(e,t,n){var i=r(Math.abs(e)/1e3),s=r(i/60),o=r(s/60),u=r(o/24),a=r(u/365),f=i<45&&["s",i]||s===1&&["m"]||s<45&&["mm",s]||o===1&&["h"]||o<22&&["hh",o]||u===1&&["d"]||u<=25&&["dd",u]||u<=45&&["M"]||u<345&&["MM",r(u/30)]||a===1&&["y"]||["yy",a];return f[2]=t,f[3]=e>0,f[4]=n,Z.apply({},f)}function tt(e,n,r){var i=r-n,s=r-e.day();return s>i&&(s-=7),s<i-7&&(s+=7),Math.ceil(t(e).add("d",s).dayOfYear()/7)}function nt(e){var n=e._i,r=e._f;return n===null||n===""?null:(typeof n=="string"&&(e._i=n=U().preparse(n)),t.isMoment(n)?(e=H({},n),e._d=new Date(+n._d)):r?I(r)?Q(e):K(e):Y(e),new D(e))}function rt(e,n){t.fn[e]=t.fn[e+"s"]=function(e){var t=this._isUTC?"UTC":"";return e!=null?(this._d["set"+t+n](e),this):this._d["get"+t+n]()}}function it(e){t.duration.fn[e]=function(){return this._data[e]}}function st(e,n){t.duration.fn["as"+e]=function(){return+this/n}}var t,n="2.0.0",r=Math.round,i,s={},o=typeof module!="undefined"&&module.exports,u=/^\/?Date\((\-?\d+)/i,a=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,f=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,l=/([0-9a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)/gi,c=/\d\d?/,h=/\d{1,3}/,p=/\d{3}/,d=/\d{1,4}/,v=/[+\-]?\d{1,6}/,m=/[0-9]*[a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF]+\s*?[\u0600-\u06FF]+/i,g=/Z|[\+\-]\d\d:?\d\d/i,y=/T/i,b=/[\+\-]?\d+(\.\d{1,3})?/,w=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,E="YYYY-MM-DDTHH:mm:ssZ",S=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],x=/([\+\-]|\d\d)/gi,T="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),N={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},C={},k="DDD w W M D d".split(" "),L="M D H h m s w W".split(" "),A={M:function(){return this.month()+1},MMM:function(e){return this.lang().monthsShort(this,e)},MMMM:function(e){return this.lang().months(this,e)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(e){return this.lang().weekdaysMin(this,e)},ddd:function(e){return this.lang().weekdaysShort(this,e)},dddd:function(e){return this.lang().weekdays(this,e)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return j(this.year()%100,2)},YYYY:function(){return j(this.year(),4)},YYYYY:function(){return j(this.year(),5)},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return j(~~(this.milliseconds()/10),2)},SSS:function(){return j(this.milliseconds(),3)},Z:function(){var e=-this.zone(),t="+";return e<0&&(e=-e,t="-"),t+j(~~(e/60),2)+":"+j(~~e%60,2)},ZZ:function(){var e=-this.zone(),t="+";return e<0&&(e=-e,t="-"),t+j(~~(10*e/6),4)},X:function(){return this.unix()}};while(k.length)i=k.pop(),A[i+"o"]=M(A[i]);while(L.length)i=L.pop(),A[i+i]=O(A[i],2);A.DDDD=O(A.DDD,3),_.prototype={set:function(e){var t,n;for(n in e)t=e[n],typeof t=="function"?this[n]=t:this["_"+n]=t},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(e){return this._months[e.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(e){return this._monthsShort[e.month()]},monthsParse:function(e){var n,r,i,s;this._monthsParse||(this._monthsParse=[]);for(n=0;n<12;n++){this._monthsParse[n]||(r=t([2e3,n]),i="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[n]=new RegExp(i.replace(".",""),"i"));if(this._monthsParse[n].test(e))return n}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(e){return this._weekdays[e.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(e){return this._weekdaysShort[e.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(e){return this._weekdaysMin[e.day()]},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(e){var t=this._longDateFormat[e];return!t&&this._longDateFormat[e.toUpperCase()]&&(t=this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e]=t),t},meridiem:function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},calendar:function(e,t){var n=this._calendar[e];return typeof n=="function"?n.apply(t):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(e,t,n,r){var i=this._relativeTime[n];return typeof i=="function"?i(e,t,n,r):i.replace(/%d/i,e)},pastFuture:function(e,t){var n=this._relativeTime[e>0?"future":"past"];return typeof n=="function"?n(t):n.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace("%d",e)},_ordinal:"%d",preparse:function(e){return e},postformat:function(e){return e},week:function(e){return tt(e,this._week.dow,this._week.doy)},_week:{dow:0,doy:6}},t=function(e,t,n){return nt({_i:e,_f:t,_l:n,_isUTC:!1})},t.utc=function(e,t,n){return nt({_useUTC:!0,_isUTC:!0,_l:n,_i:e,_f:t})},t.unix=function(e){return t(e*1e3)},t.duration=function(e,n){var r=t.isDuration(e),i=typeof e=="number",s=r?e._data:i?{}:e,o;return i&&(n?s[n]=e:s.milliseconds=e),o=new P(s),r&&e.hasOwnProperty("_lang")&&(o._lang=e._lang),o},t.version=n,t.defaultFormat=E,t.lang=function(e,n){var r;if(!e)return t.fn._lang._abbr;n?R(e,n):s[e]||U(e),t.duration.fn._lang=t.fn._lang=U(e)},t.langData=function(e){return e&&e._lang&&e._lang._abbr&&(e=e._lang._abbr),U(e)},t.isMoment=function(e){return e instanceof D},t.isDuration=function(e){return e instanceof P},t.fn=D.prototype={clone:function(){return t(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._d},toJSON:function(){return t.utc(this).format("YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return this._isValid==null&&(this._a?this._isValid=!q(this._a,(this._isUTC?t.utc(this._a):t(this._a)).toArray()):this._isValid=!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(e){var n=X(this,e||t.defaultFormat);return this.lang().postformat(n)},add:function(e,n){var r;return typeof e=="string"?r=t.duration(+n,e):r=t.duration(e,n),F(this,r,1),this},subtract:function(e,n){var r;return typeof e=="string"?r=t.duration(+n,e):r=t.duration(e,n),F(this,r,-1),this},diff:function(e,n,r){var i=this._isUTC?t(e).utc():t(e).local(),s=(this.zone()-i.zone())*6e4,o,u;return n&&(n=n.replace(/s$/,"")),n==="year"||n==="month"?(o=(this.daysInMonth()+i.daysInMonth())*432e5,u=(this.year()-i.year())*12+(this.month()-i.month()),u+=(this-t(this).startOf("month")-(i-t(i).startOf("month")))/o,n==="year"&&(u/=12)):(o=this-i-s,u=n==="second"?o/1e3:n==="minute"?o/6e4:n==="hour"?o/36e5:n==="day"?o/864e5:n==="week"?o/6048e5:o),r?u:B(u)},from:function(e,n){return t.duration(this.diff(e)).lang(this.lang()._abbr).humanize(!n)},fromNow:function(e){return this.from(t(),e)},calendar:function(){var e=this.diff(t().startOf("day"),"days",!0),n=e<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse";return this.format(this.lang().calendar(n,this))},isLeapYear:function(){var e=this.year();return e%4===0&&e%100!==0||e%400===0},isDST:function(){return this.zone()<t([this.year()]).zone()||this.zone()<t([this.year(),5]).zone()},day:function(e){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return e==null?t:this.add({d:e-t})},startOf:function(e){e=e.replace(/s$/,"");switch(e){case"year":this.month(0);case"month":this.date(1);case"week":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return e==="week"&&this.day(0),this},endOf:function(e){return this.startOf(e).add(e.replace(/s?$/,"s"),1).subtract("ms",1)},isAfter:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)>+t(e).startOf(n)},isBefore:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)<+t(e).startOf(n)},isSame:function(e,n){return n=typeof n!="undefined"?n:"millisecond",+this.clone().startOf(n)===+t(e).startOf(n)},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return t.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(e){var n=r((t(this).startOf("day")-t(this).startOf("year"))/864e5)+1;return e==null?n:this.add("d",e-n)},isoWeek:function(e){var t=tt(this,1,4);return e==null?t:this.add("d",(e-t)*7)},week:function(e){var t=this.lang().week(this);return e==null?t:this.add("d",(e-t)*7)},lang:function(t){return t===e?this._lang:(this._lang=U(t),this)}};for(i=0;i<T.length;i++)rt(T[i].toLowerCase().replace(/s$/,""),T[i]);rt("year","FullYear"),t.fn.days=t.fn.day,t.fn.weeks=t.fn.week,t.fn.isoWeeks=t.fn.isoWeek,t.duration.fn=P.prototype={weeks:function(){return B(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months*2592e6},humanize:function(e){var t=+this,n=et(t,!e,this.lang());return e&&(n=this.lang().pastFuture(t,n)),this.lang().postformat(n)},lang:t.fn.lang};for(i in N)N.hasOwnProperty(i)&&(st(i,N[i]),it(i.toLowerCase()));st("Weeks",6048e5),t.lang("en",{ordinal:function(e){var t=e%10,n=~~(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}}),o&&(module.exports=t),typeof ender=="undefined"&&(this.moment=t),typeof define=="function"&&define.amd&&define("moment",[],function(){return t})}).call(this);
|