rails_marketplace 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -20
- data/README.rdoc +2 -2
- data/Rakefile +37 -37
- data/app/assets/javascripts/rails_marketplace/application.js +46 -46
- data/app/assets/javascripts/rails_marketplace/catalog.coffee +3 -3
- data/app/assets/javascripts/rails_marketplace/flash.js +6 -6
- data/app/assets/javascripts/rails_marketplace/footermanifest.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/autocomplete/countries.js +266 -266
- data/app/assets/javascripts/rails_marketplace/js/autocomplete/jquery.autocomplete.js +986 -986
- data/app/assets/javascripts/rails_marketplace/js/bootstrap.min.js +6 -6
- data/app/assets/javascripts/rails_marketplace/js/calendar/fullcalendar.min.js +8 -8
- data/app/assets/javascripts/rails_marketplace/js/chartjs/chart.min.js +13 -13
- data/app/assets/javascripts/rails_marketplace/js/colorpicker/bootstrap-colorpicker.min.js +1087 -1087
- data/app/assets/javascripts/rails_marketplace/js/colorpicker/docs.js +17 -17
- data/app/assets/javascripts/rails_marketplace/js/cropping/cropper.min.js +9 -9
- data/app/assets/javascripts/rails_marketplace/js/cropping/main.js +321 -321
- data/app/assets/javascripts/rails_marketplace/js/cropping/main2.js +160 -160
- data/app/assets/javascripts/rails_marketplace/js/custom.js +379 -379
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.bootstrap.min.css +1 -1
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.bootstrap.min.js +6 -6
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.html5.min.js +22 -22
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.print.min.js +4 -4
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.bootstrap.js +8 -8
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.buttons.min.js +36 -36
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.fixedHeader.min.js +17 -17
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.keyTable.min.js +18 -18
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.responsive.min.js +25 -25
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.scroller.min.js +26 -26
- data/app/assets/javascripts/rails_marketplace/js/datatables/fixedHeader.bootstrap.min.css +1 -1
- data/app/assets/javascripts/rails_marketplace/js/datatables/jquery.dataTables.min.css +333 -333
- data/app/assets/javascripts/rails_marketplace/js/datatables/jquery.dataTables.min.js +166 -166
- data/app/assets/javascripts/rails_marketplace/js/datatables/json/scroller-demo.json +2501 -2501
- data/app/assets/javascripts/rails_marketplace/js/datatables/jszip.min.js +14 -14
- data/app/assets/javascripts/rails_marketplace/js/datatables/pdfmake.min.js +21 -21
- data/app/assets/javascripts/rails_marketplace/js/datatables/responsive.bootstrap.min.css +1 -1
- data/app/assets/javascripts/rails_marketplace/js/datatables/responsive.bootstrap.min.js +7 -7
- data/app/assets/javascripts/rails_marketplace/js/datatables/scroller.bootstrap.min.css +1 -1
- data/app/assets/javascripts/rails_marketplace/js/dropzone/dropzone.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/easypie/jquery.easypiechart.min.js +9 -9
- data/app/assets/javascripts/rails_marketplace/js/echart/echarts-all.js +35 -35
- data/app/assets/javascripts/rails_marketplace/js/echart/green.js +212 -212
- data/app/assets/javascripts/rails_marketplace/js/editor/bootstrap-wysiwyg.js +200 -200
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-apollo.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-basic.js +3 -3
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-clj.js +18 -18
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-css.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-dart.js +3 -3
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-erlang.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-go.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-hs.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-lisp.js +3 -3
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-llvm.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-lua.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-matlab.js +6 -6
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-ml.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-mumps.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-n.js +4 -4
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-pascal.js +3 -3
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-proto.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-r.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-rd.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-scala.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-sql.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-tcl.js +3 -3
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-tex.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-vb.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-vhdl.js +3 -3
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-wiki.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-xq.js +3 -3
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-yaml.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/prettify.js +30 -30
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/run_prettify.js +34 -34
- data/app/assets/javascripts/rails_marketplace/js/editor/external/jquery.hotkeys.js +99 -99
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.orderBars.js +200 -200
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.pie.js +820 -820
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.resize.js +57 -57
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.stack.js +188 -188
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.tooltip.min.js +11 -11
- data/app/assets/javascripts/rails_marketplace/js/gauge/gauge.min.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/gauge/gauge_demo.js +21 -21
- data/app/assets/javascripts/rails_marketplace/js/icheck/icheck.min.js +11 -11
- data/app/assets/javascripts/rails_marketplace/js/input_mask/jquery.inputmask.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/jquery.min.js +5 -5
- data/app/assets/javascripts/rails_marketplace/js/maps/gdp-data.js +184 -184
- data/app/assets/javascripts/rails_marketplace/js/maps/jquery-jvectormap-2.0.3.min.js +2 -2
- data/app/assets/javascripts/rails_marketplace/js/moment/moment.min.js +6 -6
- data/app/assets/javascripts/rails_marketplace/js/moris/example.js +127 -127
- data/app/assets/javascripts/rails_marketplace/js/moris/morris.min.js +7 -7
- data/app/assets/javascripts/rails_marketplace/js/moris/raphael-min.js +11 -11
- data/app/assets/javascripts/rails_marketplace/js/notify/pnotify.buttons.js +132 -132
- data/app/assets/javascripts/rails_marketplace/js/notify/pnotify.nonblock.js +151 -151
- data/app/assets/javascripts/rails_marketplace/js/nprogress.js +476 -476
- data/app/assets/javascripts/rails_marketplace/js/pace/pace.min.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/parsley/parsley.min.js +8 -8
- data/app/assets/javascripts/rails_marketplace/js/progressbar/bootstrap-progressbar.min.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/select/select2.full.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/sidebar/classie.js +80 -80
- data/app/assets/javascripts/rails_marketplace/js/sidebar/component.css +569 -569
- data/app/assets/javascripts/rails_marketplace/js/sidebar/modernizr.custom.js +3 -3
- data/app/assets/javascripts/rails_marketplace/js/sidebar/sidebarEffects.js +62 -62
- data/app/assets/javascripts/rails_marketplace/js/skycons/skycons.min.js +1 -1
- data/app/assets/javascripts/rails_marketplace/js/sparkline/jquery.sparkline.min.js +4 -4
- data/app/assets/javascripts/rails_marketplace/js/textarea/autosize.min.js +5 -5
- data/app/assets/javascripts/rails_marketplace/less/custom.css +6355 -6355
- data/app/assets/javascripts/rails_marketplace/marketplace.js +17 -17
- data/app/assets/javascripts/rails_marketplace/welcome.coffee +3 -3
- data/app/assets/stylesheets/rails_marketplace/application.scss +30 -30
- data/app/assets/stylesheets/rails_marketplace/catalog.scss +131 -131
- data/app/assets/stylesheets/rails_marketplace/css/animate.min.css +11 -11
- data/app/assets/stylesheets/rails_marketplace/css/bootstrap.min.css +5 -5
- data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.css +1116 -1116
- data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.min.css +4 -4
- data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.print.css +208 -208
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/bootstrap-colorpicker.min.css +8 -8
- data/app/assets/stylesheets/rails_marketplace/css/custom.css +5347 -5347
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_page.css +103 -103
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_table.css +258 -258
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_table_jui.css +500 -500
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/jquery.dataTables.css +221 -221
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/jquery.dataTables_themeroller.css +244 -244
- data/app/assets/stylesheets/rails_marketplace/css/datatables/tools/css/dataTables.tableTools.css +336 -336
- data/app/assets/stylesheets/rails_marketplace/css/editor/index.css +42 -42
- data/app/assets/stylesheets/rails_marketplace/css/floatexamples.css +21 -21
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/_all.css +529 -529
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/aero.css +52 -52
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/blue.css +52 -52
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/flat.css +52 -52
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/green.css +52 -52
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/grey.css +52 -52
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/orange.css +52 -52
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/pink.css +52 -52
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/purple.css +52 -52
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/red.css +52 -52
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/yellow.css +52 -52
- data/app/assets/stylesheets/rails_marketplace/css/ion.rangeSlider.css +146 -146
- data/app/assets/stylesheets/rails_marketplace/css/ion.rangeSlider.skinFlat.css +106 -106
- data/app/assets/stylesheets/rails_marketplace/css/maps/jquery-jvectormap-2.0.3.css +135 -135
- data/app/assets/stylesheets/rails_marketplace/css/normalize.css +421 -421
- data/app/assets/stylesheets/rails_marketplace/css/nprogress.css +74 -74
- data/app/assets/stylesheets/rails_marketplace/css/progressbar/bootstrap-progressbar-3.3.0.css +161 -161
- data/app/assets/stylesheets/rails_marketplace/css/select/select2.min.css +403 -403
- data/app/assets/stylesheets/rails_marketplace/fonts/css/font-awesome.css +2086 -2086
- data/app/assets/stylesheets/rails_marketplace/fonts/css/font-awesome.min.css +4 -4
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/FontAwesome.otf +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.svg +654 -654
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.woff2 +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.svg +287 -287
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/animated.less +34 -34
- data/app/assets/stylesheets/rails_marketplace/fonts/less/bordered-pulled.less +25 -25
- data/app/assets/stylesheets/rails_marketplace/fonts/less/core.less +12 -12
- data/app/assets/stylesheets/rails_marketplace/fonts/less/fixed-width.less +6 -6
- data/app/assets/stylesheets/rails_marketplace/fonts/less/font-awesome.less +17 -17
- data/app/assets/stylesheets/rails_marketplace/fonts/less/icons.less +697 -697
- data/app/assets/stylesheets/rails_marketplace/fonts/less/larger.less +13 -13
- data/app/assets/stylesheets/rails_marketplace/fonts/less/list.less +19 -19
- data/app/assets/stylesheets/rails_marketplace/fonts/less/mixins.less +26 -26
- data/app/assets/stylesheets/rails_marketplace/fonts/less/path.less +15 -15
- data/app/assets/stylesheets/rails_marketplace/fonts/less/rotated-flipped.less +20 -20
- data/app/assets/stylesheets/rails_marketplace/fonts/less/spinning.less +29 -29
- data/app/assets/stylesheets/rails_marketplace/fonts/less/stacked.less +20 -20
- data/app/assets/stylesheets/rails_marketplace/fonts/less/variables.less +708 -708
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_animated.scss +34 -34
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_bordered-pulled.scss +25 -25
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_core.scss +12 -12
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_fixed-width.scss +6 -6
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_icons.scss +697 -697
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_larger.scss +13 -13
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_list.scss +19 -19
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_mixins.scss +26 -26
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_path.scss +15 -15
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_rotated-flipped.scss +20 -20
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_spinning.scss +29 -29
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_stacked.scss +20 -20
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_variables.scss +708 -708
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/font-awesome.scss +17 -17
- data/app/assets/stylesheets/rails_marketplace/images/loading.gif +0 -0
- data/app/assets/stylesheets/rails_marketplace/marketplace.scss +19 -19
- data/app/assets/stylesheets/rails_marketplace/pace.css +76 -76
- data/app/assets/stylesheets/rails_marketplace/welcome.scss +3 -3
- data/app/assets/stylesheets/scaffold.css +56 -56
- data/app/controllers/rails_marketplace/admin_controller.rb +150 -150
- data/app/controllers/rails_marketplace/application_controller.rb +4 -4
- data/app/controllers/rails_marketplace/catalog_controller.rb +171 -171
- data/app/controllers/rails_marketplace/seller_controller.rb +180 -180
- data/app/helpers/rails_marketplace/admin_helper.rb +16 -16
- data/app/helpers/rails_marketplace/application_helper.rb +4 -4
- data/app/helpers/rails_marketplace/catalog_helper.rb +4 -4
- data/app/helpers/rails_marketplace/plainpage_helper.rb +4 -4
- data/app/helpers/rails_marketplace/seller_helper.rb +15 -15
- data/app/models/rails_marketplace/admin.rb +9 -9
- data/app/models/rails_marketplace/admin_setting.rb +13 -13
- data/app/models/rails_marketplace/cart.rb +48 -48
- data/app/models/rails_marketplace/cart_product.rb +6 -6
- data/app/models/rails_marketplace/category.rb +21 -21
- data/app/models/rails_marketplace/category_product.rb +5 -5
- data/app/models/rails_marketplace/customer.rb +5 -5
- data/app/models/rails_marketplace/order.rb +21 -21
- data/app/models/rails_marketplace/order_product.rb +6 -6
- data/app/models/rails_marketplace/product.rb +33 -33
- data/app/models/rails_marketplace/seller.rb +12 -12
- data/app/models/rails_marketplace/seller_setting.rb +5 -5
- data/app/views/layouts/rails_marketplace/application.html.erb +37 -37
- data/app/views/layouts/rails_marketplace/seller_central.html.erb +58 -58
- data/app/views/layouts/rails_marketplace/super_admin.html.erb +58 -58
- data/app/views/rails_marketplace/admin/add_category.html.erb +63 -63
- data/app/views/rails_marketplace/admin/categories.html.erb +50 -50
- data/app/views/rails_marketplace/admin/category_products.html.erb +54 -54
- data/app/views/rails_marketplace/admin/dashboard.html.erb +49 -49
- data/app/views/rails_marketplace/admin/edit_category.html.erb +63 -63
- data/app/views/rails_marketplace/admin/login_form.html.erb +19 -19
- data/app/views/rails_marketplace/admin/products.html.erb +54 -54
- data/app/views/rails_marketplace/admin/seller_products.html.erb +54 -54
- data/app/views/rails_marketplace/admin/sellers.html.erb +48 -48
- data/app/views/rails_marketplace/admin/settings_form.html.erb +38 -38
- data/app/views/rails_marketplace/admin/signup_form.html.erb +24 -24
- data/app/views/rails_marketplace/catalog/cart.html.erb +80 -80
- data/app/views/rails_marketplace/catalog/category_products.html.erb +52 -52
- data/app/views/rails_marketplace/catalog/checkout.html.erb +207 -207
- data/app/views/rails_marketplace/catalog/checkout_success.html.erb +14 -14
- data/app/views/rails_marketplace/catalog/index.html.erb +0 -0
- data/app/views/rails_marketplace/catalog/product_detail.html.erb +87 -87
- data/app/views/rails_marketplace/partials/_admin_sidenav.html.erb +80 -80
- data/app/views/rails_marketplace/partials/_admin_topnav.html.erb +111 -111
- data/app/views/rails_marketplace/partials/_footer.html.erb +19 -19
- data/app/views/rails_marketplace/partials/_menu.html.erb +41 -41
- data/app/views/rails_marketplace/partials/_sidenav.html.erb +77 -77
- data/app/views/rails_marketplace/partials/_topnav.html.erb +105 -105
- data/app/views/rails_marketplace/seller/add_bulk_products.html.erb +0 -0
- data/app/views/rails_marketplace/seller/add_product.html.erb +66 -66
- data/app/views/rails_marketplace/seller/dashboard.html.erb +50 -50
- data/app/views/rails_marketplace/seller/edit_product.html.erb +68 -68
- data/app/views/rails_marketplace/seller/login_form.html.erb +36 -36
- data/app/views/rails_marketplace/seller/order_details.html.erb +69 -69
- data/app/views/rails_marketplace/seller/orders.html.erb +68 -68
- data/app/views/rails_marketplace/seller/products.html.erb +55 -55
- data/app/views/rails_marketplace/seller/settings_general.html.erb +64 -64
- data/app/views/rails_marketplace/seller/settings_payment.html.erb +34 -34
- data/app/views/rails_marketplace/seller/settings_shipping.html.erb +34 -34
- data/app/views/rails_marketplace/seller/settings_tax.html.erb +34 -34
- data/app/views/rails_marketplace/seller/signup_form.html.erb +27 -27
- data/app/views/rails_marketplace/seller/step_two.html.erb +16 -16
- data/app/views/rails_marketplace/shared/_admin_error_messages.html.erb +11 -11
- data/app/views/rails_marketplace/shared/_product_error_messages.html.erb +11 -11
- data/app/views/rails_marketplace/shared/_seller_error_messages.html.erb +11 -11
- data/config/routes.rb +58 -58
- data/db/migrate/20161013194852_create_sellers.rb +13 -13
- data/db/migrate/20161013195006_create_customers.rb +13 -13
- data/db/migrate/20161013195758_create_orders.rb +8 -8
- data/db/migrate/20161014013032_create_category_products.rb +10 -10
- data/db/migrate/20161014013058_create_order_products.rb +13 -13
- data/db/migrate/20161017185755_create_admins.rb +12 -12
- data/db/migrate/20161017232347_create_products.rb +14 -14
- data/db/migrate/20161019012043_add_reference_product_seller.rb +5 -5
- data/db/migrate/20161019013502_change_data_type_images_files.rb +6 -6
- data/db/migrate/20161019022020_add_reference_order_customers.rb +5 -5
- data/db/migrate/20161109191644_create_categories.rb +15 -15
- data/db/migrate/20161110021043_create_friendly_id_slugs.rb +15 -15
- data/db/migrate/20161110021131_add_slug_to_category.rb +6 -6
- data/db/migrate/20161110024118_add_slug_to_product.rb +6 -6
- data/db/migrate/20161111001446_create_carts.rb +8 -8
- data/db/migrate/20161111004451_create_cart_products.rb +12 -12
- data/db/migrate/20161115013956_add_currency_format_to_price.rb +6 -6
- data/db/migrate/20161115015227_monetize_product.rb +5 -5
- data/db/migrate/20161115032905_add_stripe_key_to_admin.rb +6 -6
- data/db/migrate/20161124015608_add_order_fields.rb +16 -16
- data/db/migrate/20161207193917_add_seller_to_orders.rb +6 -6
- data/db/migrate/20161208012601_add_price_to_cart_products.rb +6 -6
- data/db/migrate/20161208013402_add_money_to_cart_products.rb +6 -6
- data/db/migrate/20170217183953_create_seller_settings.rb +29 -29
- data/db/migrate/20170218003202_create_admin_settings.rb +24 -24
- data/db/migrate/20170224230449_create_stripe_managed_accounts.rb +9 -9
- data/db/migrate/20170224233736_add_stripe_to_admin_settings.rb +9 -9
- data/db/migrate/20170224235259_add_id_to_settings.rb +6 -6
- data/db/migrate/20170225002939_delete_stripe_accounts.rb +8 -8
- data/db/migrate/20170225003252_add_stripe_account_id_to_seller_settings.rb +5 -5
- data/lib/rails_marketplace.rb +4 -4
- data/lib/rails_marketplace/engine.rb +9 -9
- data/lib/rails_marketplace/version.rb +3 -3
- data/lib/tasks/rails_marketplace_tasks.rake +4 -4
- data/spec/controllers/rails_marketplace/catalog_controller_spec.rb +75 -75
- data/spec/dummy/README.rdoc +28 -28
- data/spec/dummy/Rakefile +6 -6
- data/spec/dummy/app/assets/javascripts/application.js +13 -13
- data/spec/dummy/app/assets/stylesheets/application.css +15 -15
- data/spec/dummy/app/controllers/application_controller.rb +5 -5
- data/spec/dummy/app/helpers/application_helper.rb +2 -2
- data/spec/dummy/app/views/layouts/application.html.erb +14 -14
- data/spec/dummy/bin/bundle +3 -3
- data/spec/dummy/bin/rails +4 -4
- data/spec/dummy/bin/rake +4 -4
- data/spec/dummy/bin/setup +29 -29
- data/spec/dummy/config.ru +4 -4
- data/spec/dummy/config/application.rb +32 -32
- data/spec/dummy/config/boot.rb +5 -5
- data/spec/dummy/config/database.yml +25 -25
- data/spec/dummy/config/environment.rb +5 -5
- data/spec/dummy/config/environments/development.rb +41 -41
- data/spec/dummy/config/environments/production.rb +79 -79
- data/spec/dummy/config/environments/test.rb +42 -42
- data/spec/dummy/config/initializers/assets.rb +11 -11
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -3
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -4
- data/spec/dummy/config/initializers/inflections.rb +16 -16
- data/spec/dummy/config/initializers/mime_types.rb +4 -4
- data/spec/dummy/config/initializers/session_store.rb +3 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/spec/dummy/config/locales/en.yml +23 -23
- data/spec/dummy/config/routes.rb +4 -4
- data/spec/dummy/config/secrets.yml +22 -22
- data/spec/dummy/db/schema.rb +194 -194
- data/spec/dummy/log/development.log +889 -889
- data/spec/dummy/log/test.log +1229 -1229
- data/spec/dummy/public/404.html +67 -67
- data/spec/dummy/public/422.html +67 -67
- data/spec/dummy/public/500.html +66 -66
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/helpers/rails_marketplace/catalog_helper_spec.rb +17 -17
- data/spec/routing/rails_marketplace/catalog_routing_spec.rb +44 -44
- data/spec/spec_helper.rb +44 -44
- data/spec/views/rails_marketplace/catalog/edit.html.erb_spec.rb +15 -15
- data/spec/views/rails_marketplace/catalog/index.html.erb_spec.rb +15 -15
- data/spec/views/rails_marketplace/catalog/new.html.erb_spec.rb +15 -15
- data/spec/views/rails_marketplace/catalog/show.html.erb_spec.rb +12 -12
- metadata +37 -38
@@ -1,151 +1,151 @@
|
|
1
|
-
// Nonblock
|
2
|
-
// Uses AMD or browser globals for jQuery.
|
3
|
-
(function (factory) {
|
4
|
-
if (typeof define === 'function' && define.amd) {
|
5
|
-
// AMD. Register as a module.
|
6
|
-
define('pnotify.nonblock', ['jquery', 'pnotify'], factory);
|
7
|
-
} else {
|
8
|
-
// Browser globals
|
9
|
-
factory(jQuery, PNotify);
|
10
|
-
}
|
11
|
-
}(function($, PNotify){
|
12
|
-
// Some useful regexes.
|
13
|
-
var re_on = /^on/,
|
14
|
-
re_mouse_events = /^(dbl)?click$|^mouse(move|down|up|over|out|enter|leave)$|^contextmenu$/,
|
15
|
-
re_ui_events = /^(focus|blur|select|change|reset)$|^key(press|down|up)$/,
|
16
|
-
re_html_events = /^(scroll|resize|(un)?load|abort|error)$/;
|
17
|
-
// Fire a DOM event.
|
18
|
-
var dom_event = function(e, orig_e){
|
19
|
-
var event_object;
|
20
|
-
e = e.toLowerCase();
|
21
|
-
if (document.createEvent && this.dispatchEvent) {
|
22
|
-
// FireFox, Opera, Safari, Chrome
|
23
|
-
e = e.replace(re_on, '');
|
24
|
-
if (e.match(re_mouse_events)) {
|
25
|
-
// This allows the click event to fire on the notice. There is
|
26
|
-
// probably a much better way to do it.
|
27
|
-
$(this).offset();
|
28
|
-
event_object = document.createEvent("MouseEvents");
|
29
|
-
event_object.initMouseEvent(
|
30
|
-
e, orig_e.bubbles, orig_e.cancelable, orig_e.view, orig_e.detail,
|
31
|
-
orig_e.screenX, orig_e.screenY, orig_e.clientX, orig_e.clientY,
|
32
|
-
orig_e.ctrlKey, orig_e.altKey, orig_e.shiftKey, orig_e.metaKey, orig_e.button, orig_e.relatedTarget
|
33
|
-
);
|
34
|
-
} else if (e.match(re_ui_events)) {
|
35
|
-
event_object = document.createEvent("UIEvents");
|
36
|
-
event_object.initUIEvent(e, orig_e.bubbles, orig_e.cancelable, orig_e.view, orig_e.detail);
|
37
|
-
} else if (e.match(re_html_events)) {
|
38
|
-
event_object = document.createEvent("HTMLEvents");
|
39
|
-
event_object.initEvent(e, orig_e.bubbles, orig_e.cancelable);
|
40
|
-
}
|
41
|
-
if (!event_object) return;
|
42
|
-
this.dispatchEvent(event_object);
|
43
|
-
} else {
|
44
|
-
// Internet Explorer
|
45
|
-
if (!e.match(re_on)) e = "on"+e;
|
46
|
-
event_object = document.createEventObject(orig_e);
|
47
|
-
this.fireEvent(e, event_object);
|
48
|
-
}
|
49
|
-
};
|
50
|
-
|
51
|
-
|
52
|
-
// This keeps track of the last element the mouse was over, so
|
53
|
-
// mouseleave, mouseenter, etc can be called.
|
54
|
-
var nonblock_last_elem;
|
55
|
-
// This is used to pass events through the notice if it is non-blocking.
|
56
|
-
var nonblock_pass = function(notice, e, e_name){
|
57
|
-
notice.elem.css("display", "none");
|
58
|
-
var element_below = document.elementFromPoint(e.clientX, e.clientY);
|
59
|
-
notice.elem.css("display", "block");
|
60
|
-
var jelement_below = $(element_below);
|
61
|
-
var cursor_style = jelement_below.css("cursor");
|
62
|
-
notice.elem.css("cursor", cursor_style !== "auto" ? cursor_style : "default");
|
63
|
-
// If the element changed, call mouseenter, mouseleave, etc.
|
64
|
-
if (!nonblock_last_elem || nonblock_last_elem.get(0) != element_below) {
|
65
|
-
if (nonblock_last_elem) {
|
66
|
-
dom_event.call(nonblock_last_elem.get(0), "mouseleave", e.originalEvent);
|
67
|
-
dom_event.call(nonblock_last_elem.get(0), "mouseout", e.originalEvent);
|
68
|
-
}
|
69
|
-
dom_event.call(element_below, "mouseenter", e.originalEvent);
|
70
|
-
dom_event.call(element_below, "mouseover", e.originalEvent);
|
71
|
-
}
|
72
|
-
dom_event.call(element_below, e_name, e.originalEvent);
|
73
|
-
// Remember the latest element the mouse was over.
|
74
|
-
nonblock_last_elem = jelement_below;
|
75
|
-
};
|
76
|
-
|
77
|
-
|
78
|
-
PNotify.prototype.options.nonblock = {
|
79
|
-
// Create a non-blocking notice. It lets the user click elements underneath it.
|
80
|
-
nonblock: false,
|
81
|
-
// The opacity of the notice (if it's non-blocking) when the mouse is over it.
|
82
|
-
nonblock_opacity: .2
|
83
|
-
};
|
84
|
-
PNotify.prototype.modules.nonblock = {
|
85
|
-
// This lets us update the options available in the closures.
|
86
|
-
myOptions: null,
|
87
|
-
|
88
|
-
init: function(notice, options){
|
89
|
-
var that = this;
|
90
|
-
this.myOptions = options;
|
91
|
-
notice.elem.on({
|
92
|
-
"mouseenter": function(e){
|
93
|
-
if (that.myOptions.nonblock) e.stopPropagation();
|
94
|
-
if (that.myOptions.nonblock) {
|
95
|
-
// If it's non-blocking, animate to the other opacity.
|
96
|
-
notice.elem.stop().animate({"opacity": that.myOptions.nonblock_opacity}, "fast");
|
97
|
-
}
|
98
|
-
},
|
99
|
-
"mouseleave": function(e){
|
100
|
-
if (that.myOptions.nonblock) e.stopPropagation();
|
101
|
-
nonblock_last_elem = null;
|
102
|
-
notice.elem.css("cursor", "auto");
|
103
|
-
// Animate back to the normal opacity.
|
104
|
-
if (that.myOptions.nonblock && notice.animating !== "out")
|
105
|
-
notice.elem.stop().animate({"opacity": notice.options.opacity}, "fast");
|
106
|
-
},
|
107
|
-
"mouseover": function(e){
|
108
|
-
if (that.myOptions.nonblock) e.stopPropagation();
|
109
|
-
},
|
110
|
-
"mouseout": function(e){
|
111
|
-
if (that.myOptions.nonblock) e.stopPropagation();
|
112
|
-
},
|
113
|
-
"mousemove": function(e){
|
114
|
-
if (that.myOptions.nonblock) {
|
115
|
-
e.stopPropagation();
|
116
|
-
nonblock_pass(notice, e, "onmousemove");
|
117
|
-
}
|
118
|
-
},
|
119
|
-
"mousedown": function(e){
|
120
|
-
if (that.myOptions.nonblock) {
|
121
|
-
e.stopPropagation();
|
122
|
-
e.preventDefault();
|
123
|
-
nonblock_pass(notice, e, "onmousedown");
|
124
|
-
}
|
125
|
-
},
|
126
|
-
"mouseup": function(e){
|
127
|
-
if (that.myOptions.nonblock) {
|
128
|
-
e.stopPropagation();
|
129
|
-
e.preventDefault();
|
130
|
-
nonblock_pass(notice, e, "onmouseup");
|
131
|
-
}
|
132
|
-
},
|
133
|
-
"click": function(e){
|
134
|
-
if (that.myOptions.nonblock) {
|
135
|
-
e.stopPropagation();
|
136
|
-
nonblock_pass(notice, e, "onclick");
|
137
|
-
}
|
138
|
-
},
|
139
|
-
"dblclick": function(e){
|
140
|
-
if (that.myOptions.nonblock) {
|
141
|
-
e.stopPropagation();
|
142
|
-
nonblock_pass(notice, e, "ondblclick");
|
143
|
-
}
|
144
|
-
}
|
145
|
-
});
|
146
|
-
},
|
147
|
-
update: function(notice, options){
|
148
|
-
this.myOptions = options;
|
149
|
-
}
|
150
|
-
};
|
151
|
-
}));
|
1
|
+
// Nonblock
|
2
|
+
// Uses AMD or browser globals for jQuery.
|
3
|
+
(function (factory) {
|
4
|
+
if (typeof define === 'function' && define.amd) {
|
5
|
+
// AMD. Register as a module.
|
6
|
+
define('pnotify.nonblock', ['jquery', 'pnotify'], factory);
|
7
|
+
} else {
|
8
|
+
// Browser globals
|
9
|
+
factory(jQuery, PNotify);
|
10
|
+
}
|
11
|
+
}(function($, PNotify){
|
12
|
+
// Some useful regexes.
|
13
|
+
var re_on = /^on/,
|
14
|
+
re_mouse_events = /^(dbl)?click$|^mouse(move|down|up|over|out|enter|leave)$|^contextmenu$/,
|
15
|
+
re_ui_events = /^(focus|blur|select|change|reset)$|^key(press|down|up)$/,
|
16
|
+
re_html_events = /^(scroll|resize|(un)?load|abort|error)$/;
|
17
|
+
// Fire a DOM event.
|
18
|
+
var dom_event = function(e, orig_e){
|
19
|
+
var event_object;
|
20
|
+
e = e.toLowerCase();
|
21
|
+
if (document.createEvent && this.dispatchEvent) {
|
22
|
+
// FireFox, Opera, Safari, Chrome
|
23
|
+
e = e.replace(re_on, '');
|
24
|
+
if (e.match(re_mouse_events)) {
|
25
|
+
// This allows the click event to fire on the notice. There is
|
26
|
+
// probably a much better way to do it.
|
27
|
+
$(this).offset();
|
28
|
+
event_object = document.createEvent("MouseEvents");
|
29
|
+
event_object.initMouseEvent(
|
30
|
+
e, orig_e.bubbles, orig_e.cancelable, orig_e.view, orig_e.detail,
|
31
|
+
orig_e.screenX, orig_e.screenY, orig_e.clientX, orig_e.clientY,
|
32
|
+
orig_e.ctrlKey, orig_e.altKey, orig_e.shiftKey, orig_e.metaKey, orig_e.button, orig_e.relatedTarget
|
33
|
+
);
|
34
|
+
} else if (e.match(re_ui_events)) {
|
35
|
+
event_object = document.createEvent("UIEvents");
|
36
|
+
event_object.initUIEvent(e, orig_e.bubbles, orig_e.cancelable, orig_e.view, orig_e.detail);
|
37
|
+
} else if (e.match(re_html_events)) {
|
38
|
+
event_object = document.createEvent("HTMLEvents");
|
39
|
+
event_object.initEvent(e, orig_e.bubbles, orig_e.cancelable);
|
40
|
+
}
|
41
|
+
if (!event_object) return;
|
42
|
+
this.dispatchEvent(event_object);
|
43
|
+
} else {
|
44
|
+
// Internet Explorer
|
45
|
+
if (!e.match(re_on)) e = "on"+e;
|
46
|
+
event_object = document.createEventObject(orig_e);
|
47
|
+
this.fireEvent(e, event_object);
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
|
52
|
+
// This keeps track of the last element the mouse was over, so
|
53
|
+
// mouseleave, mouseenter, etc can be called.
|
54
|
+
var nonblock_last_elem;
|
55
|
+
// This is used to pass events through the notice if it is non-blocking.
|
56
|
+
var nonblock_pass = function(notice, e, e_name){
|
57
|
+
notice.elem.css("display", "none");
|
58
|
+
var element_below = document.elementFromPoint(e.clientX, e.clientY);
|
59
|
+
notice.elem.css("display", "block");
|
60
|
+
var jelement_below = $(element_below);
|
61
|
+
var cursor_style = jelement_below.css("cursor");
|
62
|
+
notice.elem.css("cursor", cursor_style !== "auto" ? cursor_style : "default");
|
63
|
+
// If the element changed, call mouseenter, mouseleave, etc.
|
64
|
+
if (!nonblock_last_elem || nonblock_last_elem.get(0) != element_below) {
|
65
|
+
if (nonblock_last_elem) {
|
66
|
+
dom_event.call(nonblock_last_elem.get(0), "mouseleave", e.originalEvent);
|
67
|
+
dom_event.call(nonblock_last_elem.get(0), "mouseout", e.originalEvent);
|
68
|
+
}
|
69
|
+
dom_event.call(element_below, "mouseenter", e.originalEvent);
|
70
|
+
dom_event.call(element_below, "mouseover", e.originalEvent);
|
71
|
+
}
|
72
|
+
dom_event.call(element_below, e_name, e.originalEvent);
|
73
|
+
// Remember the latest element the mouse was over.
|
74
|
+
nonblock_last_elem = jelement_below;
|
75
|
+
};
|
76
|
+
|
77
|
+
|
78
|
+
PNotify.prototype.options.nonblock = {
|
79
|
+
// Create a non-blocking notice. It lets the user click elements underneath it.
|
80
|
+
nonblock: false,
|
81
|
+
// The opacity of the notice (if it's non-blocking) when the mouse is over it.
|
82
|
+
nonblock_opacity: .2
|
83
|
+
};
|
84
|
+
PNotify.prototype.modules.nonblock = {
|
85
|
+
// This lets us update the options available in the closures.
|
86
|
+
myOptions: null,
|
87
|
+
|
88
|
+
init: function(notice, options){
|
89
|
+
var that = this;
|
90
|
+
this.myOptions = options;
|
91
|
+
notice.elem.on({
|
92
|
+
"mouseenter": function(e){
|
93
|
+
if (that.myOptions.nonblock) e.stopPropagation();
|
94
|
+
if (that.myOptions.nonblock) {
|
95
|
+
// If it's non-blocking, animate to the other opacity.
|
96
|
+
notice.elem.stop().animate({"opacity": that.myOptions.nonblock_opacity}, "fast");
|
97
|
+
}
|
98
|
+
},
|
99
|
+
"mouseleave": function(e){
|
100
|
+
if (that.myOptions.nonblock) e.stopPropagation();
|
101
|
+
nonblock_last_elem = null;
|
102
|
+
notice.elem.css("cursor", "auto");
|
103
|
+
// Animate back to the normal opacity.
|
104
|
+
if (that.myOptions.nonblock && notice.animating !== "out")
|
105
|
+
notice.elem.stop().animate({"opacity": notice.options.opacity}, "fast");
|
106
|
+
},
|
107
|
+
"mouseover": function(e){
|
108
|
+
if (that.myOptions.nonblock) e.stopPropagation();
|
109
|
+
},
|
110
|
+
"mouseout": function(e){
|
111
|
+
if (that.myOptions.nonblock) e.stopPropagation();
|
112
|
+
},
|
113
|
+
"mousemove": function(e){
|
114
|
+
if (that.myOptions.nonblock) {
|
115
|
+
e.stopPropagation();
|
116
|
+
nonblock_pass(notice, e, "onmousemove");
|
117
|
+
}
|
118
|
+
},
|
119
|
+
"mousedown": function(e){
|
120
|
+
if (that.myOptions.nonblock) {
|
121
|
+
e.stopPropagation();
|
122
|
+
e.preventDefault();
|
123
|
+
nonblock_pass(notice, e, "onmousedown");
|
124
|
+
}
|
125
|
+
},
|
126
|
+
"mouseup": function(e){
|
127
|
+
if (that.myOptions.nonblock) {
|
128
|
+
e.stopPropagation();
|
129
|
+
e.preventDefault();
|
130
|
+
nonblock_pass(notice, e, "onmouseup");
|
131
|
+
}
|
132
|
+
},
|
133
|
+
"click": function(e){
|
134
|
+
if (that.myOptions.nonblock) {
|
135
|
+
e.stopPropagation();
|
136
|
+
nonblock_pass(notice, e, "onclick");
|
137
|
+
}
|
138
|
+
},
|
139
|
+
"dblclick": function(e){
|
140
|
+
if (that.myOptions.nonblock) {
|
141
|
+
e.stopPropagation();
|
142
|
+
nonblock_pass(notice, e, "ondblclick");
|
143
|
+
}
|
144
|
+
}
|
145
|
+
});
|
146
|
+
},
|
147
|
+
update: function(notice, options){
|
148
|
+
this.myOptions = options;
|
149
|
+
}
|
150
|
+
};
|
151
|
+
}));
|
@@ -1,476 +1,476 @@
|
|
1
|
-
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
|
2
|
-
* @license MIT */
|
3
|
-
|
4
|
-
;(function(root, factory) {
|
5
|
-
|
6
|
-
if (typeof define === 'function' && define.amd) {
|
7
|
-
define(factory);
|
8
|
-
} else if (typeof exports === 'object') {
|
9
|
-
module.exports = factory();
|
10
|
-
} else {
|
11
|
-
root.NProgress = factory();
|
12
|
-
}
|
13
|
-
|
14
|
-
})(this, function() {
|
15
|
-
var NProgress = {};
|
16
|
-
|
17
|
-
NProgress.version = '0.1.6';
|
18
|
-
|
19
|
-
var Settings = NProgress.settings = {
|
20
|
-
minimum: 0.08,
|
21
|
-
easing: 'ease',
|
22
|
-
positionUsing: '',
|
23
|
-
speed: 200,
|
24
|
-
trickle: true,
|
25
|
-
trickleRate: 0.02,
|
26
|
-
trickleSpeed: 800,
|
27
|
-
showSpinner: true,
|
28
|
-
barSelector: '[role="bar"]',
|
29
|
-
spinnerSelector: '[role="spinner"]',
|
30
|
-
parent: 'body',
|
31
|
-
template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
|
32
|
-
};
|
33
|
-
|
34
|
-
/**
|
35
|
-
* Updates configuration.
|
36
|
-
*
|
37
|
-
* NProgress.configure({
|
38
|
-
* minimum: 0.1
|
39
|
-
* });
|
40
|
-
*/
|
41
|
-
NProgress.configure = function(options) {
|
42
|
-
var key, value;
|
43
|
-
for (key in options) {
|
44
|
-
value = options[key];
|
45
|
-
if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
|
46
|
-
}
|
47
|
-
|
48
|
-
return this;
|
49
|
-
};
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Last number.
|
53
|
-
*/
|
54
|
-
|
55
|
-
NProgress.status = null;
|
56
|
-
|
57
|
-
/**
|
58
|
-
* Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
|
59
|
-
*
|
60
|
-
* NProgress.set(0.4);
|
61
|
-
* NProgress.set(1.0);
|
62
|
-
*/
|
63
|
-
|
64
|
-
NProgress.set = function(n) {
|
65
|
-
var started = NProgress.isStarted();
|
66
|
-
|
67
|
-
n = clamp(n, Settings.minimum, 1);
|
68
|
-
NProgress.status = (n === 1 ? null : n);
|
69
|
-
|
70
|
-
var progress = NProgress.render(!started),
|
71
|
-
bar = progress.querySelector(Settings.barSelector),
|
72
|
-
speed = Settings.speed,
|
73
|
-
ease = Settings.easing;
|
74
|
-
|
75
|
-
progress.offsetWidth; /* Repaint */
|
76
|
-
|
77
|
-
queue(function(next) {
|
78
|
-
// Set positionUsing if it hasn't already been set
|
79
|
-
if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
|
80
|
-
|
81
|
-
// Add transition
|
82
|
-
css(bar, barPositionCSS(n, speed, ease));
|
83
|
-
|
84
|
-
if (n === 1) {
|
85
|
-
// Fade out
|
86
|
-
css(progress, {
|
87
|
-
transition: 'none',
|
88
|
-
opacity: 1
|
89
|
-
});
|
90
|
-
progress.offsetWidth; /* Repaint */
|
91
|
-
|
92
|
-
setTimeout(function() {
|
93
|
-
css(progress, {
|
94
|
-
transition: 'all ' + speed + 'ms linear',
|
95
|
-
opacity: 0
|
96
|
-
});
|
97
|
-
setTimeout(function() {
|
98
|
-
NProgress.remove();
|
99
|
-
next();
|
100
|
-
}, speed);
|
101
|
-
}, speed);
|
102
|
-
} else {
|
103
|
-
setTimeout(next, speed);
|
104
|
-
}
|
105
|
-
});
|
106
|
-
|
107
|
-
return this;
|
108
|
-
};
|
109
|
-
|
110
|
-
NProgress.isStarted = function() {
|
111
|
-
return typeof NProgress.status === 'number';
|
112
|
-
};
|
113
|
-
|
114
|
-
/**
|
115
|
-
* Shows the progress bar.
|
116
|
-
* This is the same as setting the status to 0%, except that it doesn't go backwards.
|
117
|
-
*
|
118
|
-
* NProgress.start();
|
119
|
-
*
|
120
|
-
*/
|
121
|
-
NProgress.start = function() {
|
122
|
-
if (!NProgress.status) NProgress.set(0);
|
123
|
-
|
124
|
-
var work = function() {
|
125
|
-
setTimeout(function() {
|
126
|
-
if (!NProgress.status) return;
|
127
|
-
NProgress.trickle();
|
128
|
-
work();
|
129
|
-
}, Settings.trickleSpeed);
|
130
|
-
};
|
131
|
-
|
132
|
-
if (Settings.trickle) work();
|
133
|
-
|
134
|
-
return this;
|
135
|
-
};
|
136
|
-
|
137
|
-
/**
|
138
|
-
* Hides the progress bar.
|
139
|
-
* This is the *sort of* the same as setting the status to 100%, with the
|
140
|
-
* difference being `done()` makes some placebo effect of some realistic motion.
|
141
|
-
*
|
142
|
-
* NProgress.done();
|
143
|
-
*
|
144
|
-
* If `true` is passed, it will show the progress bar even if its hidden.
|
145
|
-
*
|
146
|
-
* NProgress.done(true);
|
147
|
-
*/
|
148
|
-
|
149
|
-
NProgress.done = function(force) {
|
150
|
-
if (!force && !NProgress.status) return this;
|
151
|
-
|
152
|
-
return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
|
153
|
-
};
|
154
|
-
|
155
|
-
/**
|
156
|
-
* Increments by a random amount.
|
157
|
-
*/
|
158
|
-
|
159
|
-
NProgress.inc = function(amount) {
|
160
|
-
var n = NProgress.status;
|
161
|
-
|
162
|
-
if (!n) {
|
163
|
-
return NProgress.start();
|
164
|
-
} else {
|
165
|
-
if (typeof amount !== 'number') {
|
166
|
-
amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
|
167
|
-
}
|
168
|
-
|
169
|
-
n = clamp(n + amount, 0, 0.994);
|
170
|
-
return NProgress.set(n);
|
171
|
-
}
|
172
|
-
};
|
173
|
-
|
174
|
-
NProgress.trickle = function() {
|
175
|
-
return NProgress.inc(Math.random() * Settings.trickleRate);
|
176
|
-
};
|
177
|
-
|
178
|
-
/**
|
179
|
-
* Waits for all supplied jQuery promises and
|
180
|
-
* increases the progress as the promises resolve.
|
181
|
-
*
|
182
|
-
* @param $promise jQUery Promise
|
183
|
-
*/
|
184
|
-
(function() {
|
185
|
-
var initial = 0, current = 0;
|
186
|
-
|
187
|
-
NProgress.promise = function($promise) {
|
188
|
-
if (!$promise || $promise.state() == "resolved") {
|
189
|
-
return this;
|
190
|
-
}
|
191
|
-
|
192
|
-
if (current == 0) {
|
193
|
-
NProgress.start();
|
194
|
-
}
|
195
|
-
|
196
|
-
initial++;
|
197
|
-
current++;
|
198
|
-
|
199
|
-
$promise.always(function() {
|
200
|
-
current--;
|
201
|
-
if (current == 0) {
|
202
|
-
initial = 0;
|
203
|
-
NProgress.done();
|
204
|
-
} else {
|
205
|
-
NProgress.set((initial - current) / initial);
|
206
|
-
}
|
207
|
-
});
|
208
|
-
|
209
|
-
return this;
|
210
|
-
};
|
211
|
-
|
212
|
-
})();
|
213
|
-
|
214
|
-
/**
|
215
|
-
* (Internal) renders the progress bar markup based on the `template`
|
216
|
-
* setting.
|
217
|
-
*/
|
218
|
-
|
219
|
-
NProgress.render = function(fromStart) {
|
220
|
-
if (NProgress.isRendered()) return document.getElementById('nprogress');
|
221
|
-
|
222
|
-
addClass(document.documentElement, 'nprogress-busy');
|
223
|
-
|
224
|
-
var progress = document.createElement('div');
|
225
|
-
progress.id = 'nprogress';
|
226
|
-
progress.innerHTML = Settings.template;
|
227
|
-
|
228
|
-
var bar = progress.querySelector(Settings.barSelector),
|
229
|
-
perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
|
230
|
-
parent = document.querySelector(Settings.parent),
|
231
|
-
spinner;
|
232
|
-
|
233
|
-
css(bar, {
|
234
|
-
transition: 'all 0 linear',
|
235
|
-
transform: 'translate3d(' + perc + '%,0,0)'
|
236
|
-
});
|
237
|
-
|
238
|
-
if (!Settings.showSpinner) {
|
239
|
-
spinner = progress.querySelector(Settings.spinnerSelector);
|
240
|
-
spinner && removeElement(spinner);
|
241
|
-
}
|
242
|
-
|
243
|
-
if (parent != document.body) {
|
244
|
-
addClass(parent, 'nprogress-custom-parent');
|
245
|
-
}
|
246
|
-
|
247
|
-
parent.appendChild(progress);
|
248
|
-
return progress;
|
249
|
-
};
|
250
|
-
|
251
|
-
/**
|
252
|
-
* Removes the element. Opposite of render().
|
253
|
-
*/
|
254
|
-
|
255
|
-
NProgress.remove = function() {
|
256
|
-
removeClass(document.documentElement, 'nprogress-busy');
|
257
|
-
removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent')
|
258
|
-
var progress = document.getElementById('nprogress');
|
259
|
-
progress && removeElement(progress);
|
260
|
-
};
|
261
|
-
|
262
|
-
/**
|
263
|
-
* Checks if the progress bar is rendered.
|
264
|
-
*/
|
265
|
-
|
266
|
-
NProgress.isRendered = function() {
|
267
|
-
return !!document.getElementById('nprogress');
|
268
|
-
};
|
269
|
-
|
270
|
-
/**
|
271
|
-
* Determine which positioning CSS rule to use.
|
272
|
-
*/
|
273
|
-
|
274
|
-
NProgress.getPositioningCSS = function() {
|
275
|
-
// Sniff on document.body.style
|
276
|
-
var bodyStyle = document.body.style;
|
277
|
-
|
278
|
-
// Sniff prefixes
|
279
|
-
var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
|
280
|
-
('MozTransform' in bodyStyle) ? 'Moz' :
|
281
|
-
('msTransform' in bodyStyle) ? 'ms' :
|
282
|
-
('OTransform' in bodyStyle) ? 'O' : '';
|
283
|
-
|
284
|
-
if (vendorPrefix + 'Perspective' in bodyStyle) {
|
285
|
-
// Modern browsers with 3D support, e.g. Webkit, IE10
|
286
|
-
return 'translate3d';
|
287
|
-
} else if (vendorPrefix + 'Transform' in bodyStyle) {
|
288
|
-
// Browsers without 3D support, e.g. IE9
|
289
|
-
return 'translate';
|
290
|
-
} else {
|
291
|
-
// Browsers without translate() support, e.g. IE7-8
|
292
|
-
return 'margin';
|
293
|
-
}
|
294
|
-
};
|
295
|
-
|
296
|
-
/**
|
297
|
-
* Helpers
|
298
|
-
*/
|
299
|
-
|
300
|
-
function clamp(n, min, max) {
|
301
|
-
if (n < min) return min;
|
302
|
-
if (n > max) return max;
|
303
|
-
return n;
|
304
|
-
}
|
305
|
-
|
306
|
-
/**
|
307
|
-
* (Internal) converts a percentage (`0..1`) to a bar translateX
|
308
|
-
* percentage (`-100%..0%`).
|
309
|
-
*/
|
310
|
-
|
311
|
-
function toBarPerc(n) {
|
312
|
-
return (-1 + n) * 100;
|
313
|
-
}
|
314
|
-
|
315
|
-
|
316
|
-
/**
|
317
|
-
* (Internal) returns the correct CSS for changing the bar's
|
318
|
-
* position given an n percentage, and speed and ease from Settings
|
319
|
-
*/
|
320
|
-
|
321
|
-
function barPositionCSS(n, speed, ease) {
|
322
|
-
var barCSS;
|
323
|
-
|
324
|
-
if (Settings.positionUsing === 'translate3d') {
|
325
|
-
barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
|
326
|
-
} else if (Settings.positionUsing === 'translate') {
|
327
|
-
barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
|
328
|
-
} else {
|
329
|
-
barCSS = { 'margin-left': toBarPerc(n)+'%' };
|
330
|
-
}
|
331
|
-
|
332
|
-
barCSS.transition = 'all '+speed+'ms '+ease;
|
333
|
-
|
334
|
-
return barCSS;
|
335
|
-
}
|
336
|
-
|
337
|
-
/**
|
338
|
-
* (Internal) Queues a function to be executed.
|
339
|
-
*/
|
340
|
-
|
341
|
-
var queue = (function() {
|
342
|
-
var pending = [];
|
343
|
-
|
344
|
-
function next() {
|
345
|
-
var fn = pending.shift();
|
346
|
-
if (fn) {
|
347
|
-
fn(next);
|
348
|
-
}
|
349
|
-
}
|
350
|
-
|
351
|
-
return function(fn) {
|
352
|
-
pending.push(fn);
|
353
|
-
if (pending.length == 1) next();
|
354
|
-
};
|
355
|
-
})();
|
356
|
-
|
357
|
-
/**
|
358
|
-
* (Internal) Applies css properties to an element, similar to the jQuery
|
359
|
-
* css method.
|
360
|
-
*
|
361
|
-
* While this helper does assist with vendor prefixed property names, it
|
362
|
-
* does not perform any manipulation of values prior to setting styles.
|
363
|
-
*/
|
364
|
-
|
365
|
-
var css = (function() {
|
366
|
-
var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
|
367
|
-
cssProps = {};
|
368
|
-
|
369
|
-
function camelCase(string) {
|
370
|
-
return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
|
371
|
-
return letter.toUpperCase();
|
372
|
-
});
|
373
|
-
}
|
374
|
-
|
375
|
-
function getVendorProp(name) {
|
376
|
-
var style = document.body.style;
|
377
|
-
if (name in style) return name;
|
378
|
-
|
379
|
-
var i = cssPrefixes.length,
|
380
|
-
capName = name.charAt(0).toUpperCase() + name.slice(1),
|
381
|
-
vendorName;
|
382
|
-
while (i--) {
|
383
|
-
vendorName = cssPrefixes[i] + capName;
|
384
|
-
if (vendorName in style) return vendorName;
|
385
|
-
}
|
386
|
-
|
387
|
-
return name;
|
388
|
-
}
|
389
|
-
|
390
|
-
function getStyleProp(name) {
|
391
|
-
name = camelCase(name);
|
392
|
-
return cssProps[name] || (cssProps[name] = getVendorProp(name));
|
393
|
-
}
|
394
|
-
|
395
|
-
function applyCss(element, prop, value) {
|
396
|
-
prop = getStyleProp(prop);
|
397
|
-
element.style[prop] = value;
|
398
|
-
}
|
399
|
-
|
400
|
-
return function(element, properties) {
|
401
|
-
var args = arguments,
|
402
|
-
prop,
|
403
|
-
value;
|
404
|
-
|
405
|
-
if (args.length == 2) {
|
406
|
-
for (prop in properties) {
|
407
|
-
value = properties[prop];
|
408
|
-
if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
|
409
|
-
}
|
410
|
-
} else {
|
411
|
-
applyCss(element, args[1], args[2]);
|
412
|
-
}
|
413
|
-
}
|
414
|
-
})();
|
415
|
-
|
416
|
-
/**
|
417
|
-
* (Internal) Determines if an element or space separated list of class names contains a class name.
|
418
|
-
*/
|
419
|
-
|
420
|
-
function hasClass(element, name) {
|
421
|
-
var list = typeof element == 'string' ? element : classList(element);
|
422
|
-
return list.indexOf(' ' + name + ' ') >= 0;
|
423
|
-
}
|
424
|
-
|
425
|
-
/**
|
426
|
-
* (Internal) Adds a class to an element.
|
427
|
-
*/
|
428
|
-
|
429
|
-
function addClass(element, name) {
|
430
|
-
var oldList = classList(element),
|
431
|
-
newList = oldList + name;
|
432
|
-
|
433
|
-
if (hasClass(oldList, name)) return;
|
434
|
-
|
435
|
-
// Trim the opening space.
|
436
|
-
element.className = newList.substring(1);
|
437
|
-
}
|
438
|
-
|
439
|
-
/**
|
440
|
-
* (Internal) Removes a class from an element.
|
441
|
-
*/
|
442
|
-
|
443
|
-
function removeClass(element, name) {
|
444
|
-
var oldList = classList(element),
|
445
|
-
newList;
|
446
|
-
|
447
|
-
if (!hasClass(element, name)) return;
|
448
|
-
|
449
|
-
// Replace the class name.
|
450
|
-
newList = oldList.replace(' ' + name + ' ', ' ');
|
451
|
-
|
452
|
-
// Trim the opening and closing spaces.
|
453
|
-
element.className = newList.substring(1, newList.length - 1);
|
454
|
-
}
|
455
|
-
|
456
|
-
/**
|
457
|
-
* (Internal) Gets a space separated list of the class names on the element.
|
458
|
-
* The list is wrapped with a single space on each end to facilitate finding
|
459
|
-
* matches within the list.
|
460
|
-
*/
|
461
|
-
|
462
|
-
function classList(element) {
|
463
|
-
return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
|
464
|
-
}
|
465
|
-
|
466
|
-
/**
|
467
|
-
* (Internal) Removes an element from the DOM.
|
468
|
-
*/
|
469
|
-
|
470
|
-
function removeElement(element) {
|
471
|
-
element && element.parentNode && element.parentNode.removeChild(element);
|
472
|
-
}
|
473
|
-
|
474
|
-
return NProgress;
|
475
|
-
});
|
476
|
-
|
1
|
+
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
|
2
|
+
* @license MIT */
|
3
|
+
|
4
|
+
;(function(root, factory) {
|
5
|
+
|
6
|
+
if (typeof define === 'function' && define.amd) {
|
7
|
+
define(factory);
|
8
|
+
} else if (typeof exports === 'object') {
|
9
|
+
module.exports = factory();
|
10
|
+
} else {
|
11
|
+
root.NProgress = factory();
|
12
|
+
}
|
13
|
+
|
14
|
+
})(this, function() {
|
15
|
+
var NProgress = {};
|
16
|
+
|
17
|
+
NProgress.version = '0.1.6';
|
18
|
+
|
19
|
+
var Settings = NProgress.settings = {
|
20
|
+
minimum: 0.08,
|
21
|
+
easing: 'ease',
|
22
|
+
positionUsing: '',
|
23
|
+
speed: 200,
|
24
|
+
trickle: true,
|
25
|
+
trickleRate: 0.02,
|
26
|
+
trickleSpeed: 800,
|
27
|
+
showSpinner: true,
|
28
|
+
barSelector: '[role="bar"]',
|
29
|
+
spinnerSelector: '[role="spinner"]',
|
30
|
+
parent: 'body',
|
31
|
+
template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
|
32
|
+
};
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Updates configuration.
|
36
|
+
*
|
37
|
+
* NProgress.configure({
|
38
|
+
* minimum: 0.1
|
39
|
+
* });
|
40
|
+
*/
|
41
|
+
NProgress.configure = function(options) {
|
42
|
+
var key, value;
|
43
|
+
for (key in options) {
|
44
|
+
value = options[key];
|
45
|
+
if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
|
46
|
+
}
|
47
|
+
|
48
|
+
return this;
|
49
|
+
};
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Last number.
|
53
|
+
*/
|
54
|
+
|
55
|
+
NProgress.status = null;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
|
59
|
+
*
|
60
|
+
* NProgress.set(0.4);
|
61
|
+
* NProgress.set(1.0);
|
62
|
+
*/
|
63
|
+
|
64
|
+
NProgress.set = function(n) {
|
65
|
+
var started = NProgress.isStarted();
|
66
|
+
|
67
|
+
n = clamp(n, Settings.minimum, 1);
|
68
|
+
NProgress.status = (n === 1 ? null : n);
|
69
|
+
|
70
|
+
var progress = NProgress.render(!started),
|
71
|
+
bar = progress.querySelector(Settings.barSelector),
|
72
|
+
speed = Settings.speed,
|
73
|
+
ease = Settings.easing;
|
74
|
+
|
75
|
+
progress.offsetWidth; /* Repaint */
|
76
|
+
|
77
|
+
queue(function(next) {
|
78
|
+
// Set positionUsing if it hasn't already been set
|
79
|
+
if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
|
80
|
+
|
81
|
+
// Add transition
|
82
|
+
css(bar, barPositionCSS(n, speed, ease));
|
83
|
+
|
84
|
+
if (n === 1) {
|
85
|
+
// Fade out
|
86
|
+
css(progress, {
|
87
|
+
transition: 'none',
|
88
|
+
opacity: 1
|
89
|
+
});
|
90
|
+
progress.offsetWidth; /* Repaint */
|
91
|
+
|
92
|
+
setTimeout(function() {
|
93
|
+
css(progress, {
|
94
|
+
transition: 'all ' + speed + 'ms linear',
|
95
|
+
opacity: 0
|
96
|
+
});
|
97
|
+
setTimeout(function() {
|
98
|
+
NProgress.remove();
|
99
|
+
next();
|
100
|
+
}, speed);
|
101
|
+
}, speed);
|
102
|
+
} else {
|
103
|
+
setTimeout(next, speed);
|
104
|
+
}
|
105
|
+
});
|
106
|
+
|
107
|
+
return this;
|
108
|
+
};
|
109
|
+
|
110
|
+
NProgress.isStarted = function() {
|
111
|
+
return typeof NProgress.status === 'number';
|
112
|
+
};
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Shows the progress bar.
|
116
|
+
* This is the same as setting the status to 0%, except that it doesn't go backwards.
|
117
|
+
*
|
118
|
+
* NProgress.start();
|
119
|
+
*
|
120
|
+
*/
|
121
|
+
NProgress.start = function() {
|
122
|
+
if (!NProgress.status) NProgress.set(0);
|
123
|
+
|
124
|
+
var work = function() {
|
125
|
+
setTimeout(function() {
|
126
|
+
if (!NProgress.status) return;
|
127
|
+
NProgress.trickle();
|
128
|
+
work();
|
129
|
+
}, Settings.trickleSpeed);
|
130
|
+
};
|
131
|
+
|
132
|
+
if (Settings.trickle) work();
|
133
|
+
|
134
|
+
return this;
|
135
|
+
};
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Hides the progress bar.
|
139
|
+
* This is the *sort of* the same as setting the status to 100%, with the
|
140
|
+
* difference being `done()` makes some placebo effect of some realistic motion.
|
141
|
+
*
|
142
|
+
* NProgress.done();
|
143
|
+
*
|
144
|
+
* If `true` is passed, it will show the progress bar even if its hidden.
|
145
|
+
*
|
146
|
+
* NProgress.done(true);
|
147
|
+
*/
|
148
|
+
|
149
|
+
NProgress.done = function(force) {
|
150
|
+
if (!force && !NProgress.status) return this;
|
151
|
+
|
152
|
+
return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
|
153
|
+
};
|
154
|
+
|
155
|
+
/**
|
156
|
+
* Increments by a random amount.
|
157
|
+
*/
|
158
|
+
|
159
|
+
NProgress.inc = function(amount) {
|
160
|
+
var n = NProgress.status;
|
161
|
+
|
162
|
+
if (!n) {
|
163
|
+
return NProgress.start();
|
164
|
+
} else {
|
165
|
+
if (typeof amount !== 'number') {
|
166
|
+
amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
|
167
|
+
}
|
168
|
+
|
169
|
+
n = clamp(n + amount, 0, 0.994);
|
170
|
+
return NProgress.set(n);
|
171
|
+
}
|
172
|
+
};
|
173
|
+
|
174
|
+
NProgress.trickle = function() {
|
175
|
+
return NProgress.inc(Math.random() * Settings.trickleRate);
|
176
|
+
};
|
177
|
+
|
178
|
+
/**
|
179
|
+
* Waits for all supplied jQuery promises and
|
180
|
+
* increases the progress as the promises resolve.
|
181
|
+
*
|
182
|
+
* @param $promise jQUery Promise
|
183
|
+
*/
|
184
|
+
(function() {
|
185
|
+
var initial = 0, current = 0;
|
186
|
+
|
187
|
+
NProgress.promise = function($promise) {
|
188
|
+
if (!$promise || $promise.state() == "resolved") {
|
189
|
+
return this;
|
190
|
+
}
|
191
|
+
|
192
|
+
if (current == 0) {
|
193
|
+
NProgress.start();
|
194
|
+
}
|
195
|
+
|
196
|
+
initial++;
|
197
|
+
current++;
|
198
|
+
|
199
|
+
$promise.always(function() {
|
200
|
+
current--;
|
201
|
+
if (current == 0) {
|
202
|
+
initial = 0;
|
203
|
+
NProgress.done();
|
204
|
+
} else {
|
205
|
+
NProgress.set((initial - current) / initial);
|
206
|
+
}
|
207
|
+
});
|
208
|
+
|
209
|
+
return this;
|
210
|
+
};
|
211
|
+
|
212
|
+
})();
|
213
|
+
|
214
|
+
/**
|
215
|
+
* (Internal) renders the progress bar markup based on the `template`
|
216
|
+
* setting.
|
217
|
+
*/
|
218
|
+
|
219
|
+
NProgress.render = function(fromStart) {
|
220
|
+
if (NProgress.isRendered()) return document.getElementById('nprogress');
|
221
|
+
|
222
|
+
addClass(document.documentElement, 'nprogress-busy');
|
223
|
+
|
224
|
+
var progress = document.createElement('div');
|
225
|
+
progress.id = 'nprogress';
|
226
|
+
progress.innerHTML = Settings.template;
|
227
|
+
|
228
|
+
var bar = progress.querySelector(Settings.barSelector),
|
229
|
+
perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
|
230
|
+
parent = document.querySelector(Settings.parent),
|
231
|
+
spinner;
|
232
|
+
|
233
|
+
css(bar, {
|
234
|
+
transition: 'all 0 linear',
|
235
|
+
transform: 'translate3d(' + perc + '%,0,0)'
|
236
|
+
});
|
237
|
+
|
238
|
+
if (!Settings.showSpinner) {
|
239
|
+
spinner = progress.querySelector(Settings.spinnerSelector);
|
240
|
+
spinner && removeElement(spinner);
|
241
|
+
}
|
242
|
+
|
243
|
+
if (parent != document.body) {
|
244
|
+
addClass(parent, 'nprogress-custom-parent');
|
245
|
+
}
|
246
|
+
|
247
|
+
parent.appendChild(progress);
|
248
|
+
return progress;
|
249
|
+
};
|
250
|
+
|
251
|
+
/**
|
252
|
+
* Removes the element. Opposite of render().
|
253
|
+
*/
|
254
|
+
|
255
|
+
NProgress.remove = function() {
|
256
|
+
removeClass(document.documentElement, 'nprogress-busy');
|
257
|
+
removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent')
|
258
|
+
var progress = document.getElementById('nprogress');
|
259
|
+
progress && removeElement(progress);
|
260
|
+
};
|
261
|
+
|
262
|
+
/**
|
263
|
+
* Checks if the progress bar is rendered.
|
264
|
+
*/
|
265
|
+
|
266
|
+
NProgress.isRendered = function() {
|
267
|
+
return !!document.getElementById('nprogress');
|
268
|
+
};
|
269
|
+
|
270
|
+
/**
|
271
|
+
* Determine which positioning CSS rule to use.
|
272
|
+
*/
|
273
|
+
|
274
|
+
NProgress.getPositioningCSS = function() {
|
275
|
+
// Sniff on document.body.style
|
276
|
+
var bodyStyle = document.body.style;
|
277
|
+
|
278
|
+
// Sniff prefixes
|
279
|
+
var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
|
280
|
+
('MozTransform' in bodyStyle) ? 'Moz' :
|
281
|
+
('msTransform' in bodyStyle) ? 'ms' :
|
282
|
+
('OTransform' in bodyStyle) ? 'O' : '';
|
283
|
+
|
284
|
+
if (vendorPrefix + 'Perspective' in bodyStyle) {
|
285
|
+
// Modern browsers with 3D support, e.g. Webkit, IE10
|
286
|
+
return 'translate3d';
|
287
|
+
} else if (vendorPrefix + 'Transform' in bodyStyle) {
|
288
|
+
// Browsers without 3D support, e.g. IE9
|
289
|
+
return 'translate';
|
290
|
+
} else {
|
291
|
+
// Browsers without translate() support, e.g. IE7-8
|
292
|
+
return 'margin';
|
293
|
+
}
|
294
|
+
};
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Helpers
|
298
|
+
*/
|
299
|
+
|
300
|
+
function clamp(n, min, max) {
|
301
|
+
if (n < min) return min;
|
302
|
+
if (n > max) return max;
|
303
|
+
return n;
|
304
|
+
}
|
305
|
+
|
306
|
+
/**
|
307
|
+
* (Internal) converts a percentage (`0..1`) to a bar translateX
|
308
|
+
* percentage (`-100%..0%`).
|
309
|
+
*/
|
310
|
+
|
311
|
+
function toBarPerc(n) {
|
312
|
+
return (-1 + n) * 100;
|
313
|
+
}
|
314
|
+
|
315
|
+
|
316
|
+
/**
|
317
|
+
* (Internal) returns the correct CSS for changing the bar's
|
318
|
+
* position given an n percentage, and speed and ease from Settings
|
319
|
+
*/
|
320
|
+
|
321
|
+
function barPositionCSS(n, speed, ease) {
|
322
|
+
var barCSS;
|
323
|
+
|
324
|
+
if (Settings.positionUsing === 'translate3d') {
|
325
|
+
barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
|
326
|
+
} else if (Settings.positionUsing === 'translate') {
|
327
|
+
barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
|
328
|
+
} else {
|
329
|
+
barCSS = { 'margin-left': toBarPerc(n)+'%' };
|
330
|
+
}
|
331
|
+
|
332
|
+
barCSS.transition = 'all '+speed+'ms '+ease;
|
333
|
+
|
334
|
+
return barCSS;
|
335
|
+
}
|
336
|
+
|
337
|
+
/**
|
338
|
+
* (Internal) Queues a function to be executed.
|
339
|
+
*/
|
340
|
+
|
341
|
+
var queue = (function() {
|
342
|
+
var pending = [];
|
343
|
+
|
344
|
+
function next() {
|
345
|
+
var fn = pending.shift();
|
346
|
+
if (fn) {
|
347
|
+
fn(next);
|
348
|
+
}
|
349
|
+
}
|
350
|
+
|
351
|
+
return function(fn) {
|
352
|
+
pending.push(fn);
|
353
|
+
if (pending.length == 1) next();
|
354
|
+
};
|
355
|
+
})();
|
356
|
+
|
357
|
+
/**
|
358
|
+
* (Internal) Applies css properties to an element, similar to the jQuery
|
359
|
+
* css method.
|
360
|
+
*
|
361
|
+
* While this helper does assist with vendor prefixed property names, it
|
362
|
+
* does not perform any manipulation of values prior to setting styles.
|
363
|
+
*/
|
364
|
+
|
365
|
+
var css = (function() {
|
366
|
+
var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
|
367
|
+
cssProps = {};
|
368
|
+
|
369
|
+
function camelCase(string) {
|
370
|
+
return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
|
371
|
+
return letter.toUpperCase();
|
372
|
+
});
|
373
|
+
}
|
374
|
+
|
375
|
+
function getVendorProp(name) {
|
376
|
+
var style = document.body.style;
|
377
|
+
if (name in style) return name;
|
378
|
+
|
379
|
+
var i = cssPrefixes.length,
|
380
|
+
capName = name.charAt(0).toUpperCase() + name.slice(1),
|
381
|
+
vendorName;
|
382
|
+
while (i--) {
|
383
|
+
vendorName = cssPrefixes[i] + capName;
|
384
|
+
if (vendorName in style) return vendorName;
|
385
|
+
}
|
386
|
+
|
387
|
+
return name;
|
388
|
+
}
|
389
|
+
|
390
|
+
function getStyleProp(name) {
|
391
|
+
name = camelCase(name);
|
392
|
+
return cssProps[name] || (cssProps[name] = getVendorProp(name));
|
393
|
+
}
|
394
|
+
|
395
|
+
function applyCss(element, prop, value) {
|
396
|
+
prop = getStyleProp(prop);
|
397
|
+
element.style[prop] = value;
|
398
|
+
}
|
399
|
+
|
400
|
+
return function(element, properties) {
|
401
|
+
var args = arguments,
|
402
|
+
prop,
|
403
|
+
value;
|
404
|
+
|
405
|
+
if (args.length == 2) {
|
406
|
+
for (prop in properties) {
|
407
|
+
value = properties[prop];
|
408
|
+
if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
|
409
|
+
}
|
410
|
+
} else {
|
411
|
+
applyCss(element, args[1], args[2]);
|
412
|
+
}
|
413
|
+
}
|
414
|
+
})();
|
415
|
+
|
416
|
+
/**
|
417
|
+
* (Internal) Determines if an element or space separated list of class names contains a class name.
|
418
|
+
*/
|
419
|
+
|
420
|
+
function hasClass(element, name) {
|
421
|
+
var list = typeof element == 'string' ? element : classList(element);
|
422
|
+
return list.indexOf(' ' + name + ' ') >= 0;
|
423
|
+
}
|
424
|
+
|
425
|
+
/**
|
426
|
+
* (Internal) Adds a class to an element.
|
427
|
+
*/
|
428
|
+
|
429
|
+
function addClass(element, name) {
|
430
|
+
var oldList = classList(element),
|
431
|
+
newList = oldList + name;
|
432
|
+
|
433
|
+
if (hasClass(oldList, name)) return;
|
434
|
+
|
435
|
+
// Trim the opening space.
|
436
|
+
element.className = newList.substring(1);
|
437
|
+
}
|
438
|
+
|
439
|
+
/**
|
440
|
+
* (Internal) Removes a class from an element.
|
441
|
+
*/
|
442
|
+
|
443
|
+
function removeClass(element, name) {
|
444
|
+
var oldList = classList(element),
|
445
|
+
newList;
|
446
|
+
|
447
|
+
if (!hasClass(element, name)) return;
|
448
|
+
|
449
|
+
// Replace the class name.
|
450
|
+
newList = oldList.replace(' ' + name + ' ', ' ');
|
451
|
+
|
452
|
+
// Trim the opening and closing spaces.
|
453
|
+
element.className = newList.substring(1, newList.length - 1);
|
454
|
+
}
|
455
|
+
|
456
|
+
/**
|
457
|
+
* (Internal) Gets a space separated list of the class names on the element.
|
458
|
+
* The list is wrapped with a single space on each end to facilitate finding
|
459
|
+
* matches within the list.
|
460
|
+
*/
|
461
|
+
|
462
|
+
function classList(element) {
|
463
|
+
return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
|
464
|
+
}
|
465
|
+
|
466
|
+
/**
|
467
|
+
* (Internal) Removes an element from the DOM.
|
468
|
+
*/
|
469
|
+
|
470
|
+
function removeElement(element) {
|
471
|
+
element && element.parentNode && element.parentNode.removeChild(element);
|
472
|
+
}
|
473
|
+
|
474
|
+
return NProgress;
|
475
|
+
});
|
476
|
+
|