wordjelly-auth 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/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +35 -0
- data/app/assets/images/auth/activity.jpg +0 -0
- data/app/assets/images/auth/facebook.svg +1 -0
- data/app/assets/images/auth/google_oauth2.svg +1 -0
- data/app/assets/images/auth/js_pic3.jpg +0 -0
- data/app/assets/images/auth/profile.jpg +0 -0
- data/app/assets/javascripts/auth/admin_create_users.js +2 -0
- data/app/assets/javascripts/auth/application.js +20 -0
- data/app/assets/javascripts/auth/auth_dependencies.js +12 -0
- data/app/assets/javascripts/auth/auth_modals_and_navbar.js +218 -0
- data/app/assets/javascripts/auth/clients.js +2 -0
- data/app/assets/javascripts/auth/search.js +2 -0
- data/app/assets/javascripts/auth/shopping/discounts.js +2 -0
- data/app/assets/javascripts/auth/users/profiles.js +188 -0
- data/app/assets/stylesheets/auth/admin_create_users.css +4 -0
- data/app/assets/stylesheets/auth/application.scss +14 -0
- data/app/assets/stylesheets/auth/auth_default_css.scss +13 -0
- data/app/assets/stylesheets/auth/common-styles.scss +579 -0
- data/app/assets/stylesheets/auth/overrides.scss +26 -0
- data/app/assets/stylesheets/auth/search.css +4 -0
- data/app/assets/stylesheets/auth/shopping/discounts.css +4 -0
- data/app/assets/stylesheets/auth/users/profiles.scss +40 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/auth/admin_create_users_controller.rb +89 -0
- data/app/controllers/auth/application_controller.rb +97 -0
- data/app/controllers/auth/clients_controller.rb +105 -0
- data/app/controllers/auth/concerns/activity_controller_concern.rb +32 -0
- data/app/controllers/auth/concerns/devise_concern.rb +193 -0
- data/app/controllers/auth/concerns/omni_concern.rb +310 -0
- data/app/controllers/auth/concerns/otp_concern.rb +251 -0
- data/app/controllers/auth/concerns/shopping/cart_controller_concern.rb +105 -0
- data/app/controllers/auth/concerns/shopping/cart_item_controller_concern.rb +150 -0
- data/app/controllers/auth/concerns/shopping/discount_controller_concern.rb +97 -0
- data/app/controllers/auth/concerns/shopping/pay_u_money_controller_concern.rb +38 -0
- data/app/controllers/auth/concerns/shopping/payment_controller_concern.rb +101 -0
- data/app/controllers/auth/concerns/shopping/product_controller_concern.rb +68 -0
- data/app/controllers/auth/concerns/token_concern.rb +187 -0
- data/app/controllers/auth/confirmations_controller.rb +3 -0
- data/app/controllers/auth/mailgun_controller.rb +8 -0
- data/app/controllers/auth/omniauth_callbacks_controller.rb +6 -0
- data/app/controllers/auth/passwords_controller.rb +4 -0
- data/app/controllers/auth/profiles_controller.rb +156 -0
- data/app/controllers/auth/registrations_controller.rb +99 -0
- data/app/controllers/auth/search_controller.rb +61 -0
- data/app/controllers/auth/sessions_controller.rb +20 -0
- data/app/controllers/auth/shopping/cart_items_controller.rb +14 -0
- data/app/controllers/auth/shopping/carts_controller.rb +13 -0
- data/app/controllers/auth/shopping/discounts_controller.rb +19 -0
- data/app/controllers/auth/shopping/payments_controller.rb +13 -0
- data/app/controllers/auth/shopping/products_controller.rb +17 -0
- data/app/controllers/auth/shopping/shopping_controller.rb +86 -0
- data/app/controllers/auth/unlocks_controller.rb +3 -0
- data/app/controllers/auth/webhooks_controller.rb +3 -0
- data/app/helpers/auth/admin_create_users_helper.rb +2 -0
- data/app/helpers/auth/application_helper.rb +136 -0
- data/app/helpers/auth/clients_helper.rb +4 -0
- data/app/helpers/auth/resource_helper.rb +10 -0
- data/app/helpers/auth/search_helper.rb +2 -0
- data/app/helpers/auth/shopping/cart_items/cart_items_helper.rb +29 -0
- data/app/helpers/auth/shopping/carts/carts_helper.rb +25 -0
- data/app/helpers/auth/shopping/discounts/discounts_helper.rb +39 -0
- data/app/helpers/auth/shopping/payments/pay_u_money_helper.rb +56 -0
- data/app/helpers/auth/shopping/payments/payments_helper.rb +54 -0
- data/app/helpers/auth/shopping/products/products_helper.rb +52 -0
- data/app/helpers/auth/shopping/shopping_helper.rb +3 -0
- data/app/helpers/auth/users/profiles_helper.rb +12 -0
- data/app/jobs/otp_job.rb +92 -0
- data/app/mailers/application_mailer.rb +4 -0
- data/app/mailers/auth/notifier.rb +9 -0
- data/app/models/auth/admin_create_user.rb +3 -0
- data/app/models/auth/client.rb +52 -0
- data/app/models/auth/concerns/activity_concern.rb +112 -0
- data/app/models/auth/concerns/chief_model_concern.rb +73 -0
- data/app/models/auth/concerns/es_concern.rb +21 -0
- data/app/models/auth/concerns/notification_concern.rb +232 -0
- data/app/models/auth/concerns/notification_response_concern.rb +71 -0
- data/app/models/auth/concerns/owner_concern.rb +81 -0
- data/app/models/auth/concerns/shopping/cart_concern.rb +329 -0
- data/app/models/auth/concerns/shopping/cart_item_concern.rb +437 -0
- data/app/models/auth/concerns/shopping/discount_concern.rb +482 -0
- data/app/models/auth/concerns/shopping/discount_flow.txt +11 -0
- data/app/models/auth/concerns/shopping/pay_u_money_concern.rb +184 -0
- data/app/models/auth/concerns/shopping/payment_concern.rb +613 -0
- data/app/models/auth/concerns/shopping/product_concern.rb +102 -0
- data/app/models/auth/concerns/sms_otp_concern.rb +68 -0
- data/app/models/auth/concerns/user_concern.rb +788 -0
- data/app/models/auth/identity.rb +23 -0
- data/app/models/auth/shopping/cart.rb +3 -0
- data/app/models/auth/shopping/cart_item.rb +6 -0
- data/app/models/auth/shopping/cart_item_payment_result.rb +7 -0
- data/app/models/auth/shopping/discount.rb +4 -0
- data/app/models/auth/shopping/payment.rb +5 -0
- data/app/models/auth/shopping/product.rb +5 -0
- data/app/models/auth/user.rb +3 -0
- data/app/views/auth/admin_create_users/_admin_actions.html.erb +46 -0
- data/app/views/auth/admin_create_users/_form.html.erb +19 -0
- data/app/views/auth/admin_create_users/edit.html.erb +6 -0
- data/app/views/auth/admin_create_users/index.html.erb +25 -0
- data/app/views/auth/admin_create_users/new.html.erb +5 -0
- data/app/views/auth/admin_create_users/show.html.erb +8 -0
- data/app/views/auth/clients/_form.html.erb +41 -0
- data/app/views/auth/clients/edit.html.erb +6 -0
- data/app/views/auth/clients/index.html.erb +33 -0
- data/app/views/auth/clients/new.html.erb +5 -0
- data/app/views/auth/clients/show.html.erb +21 -0
- data/app/views/auth/confirmations/_enter_otp.html.erb +27 -0
- data/app/views/auth/confirmations/_get_otp_status.html.erb +25 -0
- data/app/views/auth/confirmations/_new_otp_input.js.erb +11 -0
- data/app/views/auth/confirmations/_resend_otp.js.erb +8 -0
- data/app/views/auth/confirmations/_resend_sms_otp.html.erb +18 -0
- data/app/views/auth/confirmations/_verify_otp.js.erb +64 -0
- data/app/views/auth/confirmations/create.js.erb +8 -0
- data/app/views/auth/confirmations/enter_otp.html.erb +7 -0
- data/app/views/auth/confirmations/get_otp_status.html.erb +3 -0
- data/app/views/auth/confirmations/new.html.erb +1 -0
- data/app/views/auth/confirmations/new.js.erb +16 -0
- data/app/views/auth/confirmations/otp_status_result.html.erb +20 -0
- data/app/views/auth/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/auth/mailer/password_change.html.erb +3 -0
- data/app/views/auth/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/auth/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/auth/modals/_ajax_error_modal.html.erb +3 -0
- data/app/views/auth/modals/_ajax_error_modal_content.html.erb +0 -0
- data/app/views/auth/modals/_edit_account_content.html.erb +68 -0
- data/app/views/auth/modals/_edit_account_success_content.html.erb +5 -0
- data/app/views/auth/modals/_error_notification.html.erb +8 -0
- data/app/views/auth/modals/_forgot_password_content.html.erb +18 -0
- data/app/views/auth/modals/_forgot_password_success_content.html.erb +8 -0
- data/app/views/auth/modals/_login_default_content.html.erb +3 -0
- data/app/views/auth/modals/_login_forms.html.erb +13 -0
- data/app/views/auth/modals/_login_navigation_options.html.erb +12 -0
- data/app/views/auth/modals/_new_otp_input.html.erb +28 -0
- data/app/views/auth/modals/_oauth_and_submit.html.erb +21 -0
- data/app/views/auth/modals/_recaptcha_tags.html.erb +4 -0
- data/app/views/auth/modals/_resend_confirmation_content.html.erb +17 -0
- data/app/views/auth/modals/_resend_confirmation_success_content.html.erb +8 -0
- data/app/views/auth/modals/_resend_otp.html.erb +23 -0
- data/app/views/auth/modals/_resource_errors.js.erb +24 -0
- data/app/views/auth/modals/_sign_in_inputs.html.erb +10 -0
- data/app/views/auth/modals/_sign_in_needed_modal.html.erb +3 -0
- data/app/views/auth/modals/_sign_in_success_content.html.erb +5 -0
- data/app/views/auth/modals/_sign_up_inputs.html.erb +9 -0
- data/app/views/auth/modals/_sign_up_success_content.html.erb +1 -0
- data/app/views/auth/modals/_sign_up_success_inactive_content.html.erb +2 -0
- data/app/views/auth/modals/_unlock_content.html.erb +17 -0
- data/app/views/auth/modals/_verify_otp.html.erb +1 -0
- data/app/views/auth/modals/base_modal/_base.html.erb +25 -0
- data/app/views/auth/modals/login.js.erb +120 -0
- data/app/views/auth/modals/unlock_success_content.html.erb +8 -0
- data/app/views/auth/notifier/_email.html.erb +3 -0
- data/app/views/auth/notifier/notification.html.erb +2 -0
- data/app/views/auth/notifier/notification.text.erb +1 -0
- data/app/views/auth/omniauth_callbacks/failure.html.erb +4 -0
- data/app/views/auth/passwords/create.js.erb +12 -0
- data/app/views/auth/passwords/edit.html.erb +25 -0
- data/app/views/auth/passwords/new.html.erb +16 -0
- data/app/views/auth/passwords/new.js.erb +19 -0
- data/app/views/auth/profiles/_proxy_resource.html.erb +5 -0
- data/app/views/auth/profiles/set_proxy_resource.js.erb +1 -0
- data/app/views/auth/profiles/show.html.erb +8 -0
- data/app/views/auth/registrations/create.js.erb +40 -0
- data/app/views/auth/registrations/edit.html.erb +2 -0
- data/app/views/auth/registrations/edit.js.erb +5 -0
- data/app/views/auth/registrations/new.html.erb +33 -0
- data/app/views/auth/registrations/update.js.erb +47 -0
- data/app/views/auth/search/_search_bar.html.erb +11 -0
- data/app/views/auth/search/_search_result.html.erb +7 -0
- data/app/views/auth/search/_search_results.html.erb +4 -0
- data/app/views/auth/search/authenticated_user_search.js.erb +45 -0
- data/app/views/auth/search/authenticated_user_search.json +7 -0
- data/app/views/auth/sessions/create.js.erb +5 -0
- data/app/views/auth/sessions/new.html.erb +4 -0
- data/app/views/auth/sessions/new.js.erb +20 -0
- data/app/views/auth/shared/_devise_error_messages.html.erb +9 -0
- data/app/views/auth/shared/_links.html.erb +25 -0
- data/app/views/auth/shared/_object_errors.html.erb +12 -0
- data/app/views/auth/shared/_proxy_resource.html.erb +18 -0
- data/app/views/auth/shopping/cart_items/_form.html.erb +34 -0
- data/app/views/auth/shopping/cart_items/_show_cart_items_collection.html.erb +31 -0
- data/app/views/auth/shopping/cart_items/create_multiple.html.erb +6 -0
- data/app/views/auth/shopping/cart_items/create_multiple.json.erb +9 -0
- data/app/views/auth/shopping/cart_items/edit.html.erb +6 -0
- data/app/views/auth/shopping/cart_items/index.html.erb +52 -0
- data/app/views/auth/shopping/cart_items/new.html.erb +5 -0
- data/app/views/auth/shopping/cart_items/show.html.erb +13 -0
- data/app/views/auth/shopping/carts/_form.html.erb +35 -0
- data/app/views/auth/shopping/carts/_payment_links.html.erb +27 -0
- data/app/views/auth/shopping/carts/_remove_cart_item.html.erb +11 -0
- data/app/views/auth/shopping/carts/_show_cart_balance_info.html.erb +35 -0
- data/app/views/auth/shopping/carts/edit.html.erb +6 -0
- data/app/views/auth/shopping/carts/index.html.erb +43 -0
- data/app/views/auth/shopping/carts/new.html.erb +5 -0
- data/app/views/auth/shopping/carts/show.html.erb +46 -0
- data/app/views/auth/shopping/discounts/_form.html.erb +18 -0
- data/app/views/auth/shopping/discounts/_form_for_create_multiple_cart_items.html.erb +17 -0
- data/app/views/auth/shopping/discounts/_show_pending_discount_request.html.erb +17 -0
- data/app/views/auth/shopping/discounts/destroy.html.erb +2 -0
- data/app/views/auth/shopping/discounts/edit.html.erb +29 -0
- data/app/views/auth/shopping/discounts/index.html.erb +40 -0
- data/app/views/auth/shopping/discounts/new.html.erb +1 -0
- data/app/views/auth/shopping/discounts/show.html.erb +18 -0
- data/app/views/auth/shopping/discounts/update.html.erb +2 -0
- data/app/views/auth/shopping/payments/_approve_payment.html.erb +7 -0
- data/app/views/auth/shopping/payments/_cash_card_cheque.html.erb +24 -0
- data/app/views/auth/shopping/payments/_create_discount_coupon.html.erb +5 -0
- data/app/views/auth/shopping/payments/_form.html.erb +19 -0
- data/app/views/auth/shopping/payments/_gateway.html.erb +21 -0
- data/app/views/auth/shopping/payments/_proceed_to_gateway_or_verify_payment.html.erb +18 -0
- data/app/views/auth/shopping/payments/_refresh_payment.html.erb +7 -0
- data/app/views/auth/shopping/payments/_refund.html.erb +10 -0
- data/app/views/auth/shopping/payments/_show_payment_receipt.html.erb +12 -0
- data/app/views/auth/shopping/payments/edit.html.erb +6 -0
- data/app/views/auth/shopping/payments/index.html.erb +43 -0
- data/app/views/auth/shopping/payments/new.html.erb +13 -0
- data/app/views/auth/shopping/payments/show.html.erb +36 -0
- data/app/views/auth/shopping/products/_form.html.erb +27 -0
- data/app/views/auth/shopping/products/edit.html.erb +6 -0
- data/app/views/auth/shopping/products/index.html.erb +48 -0
- data/app/views/auth/shopping/products/index.json.erb +7 -0
- data/app/views/auth/shopping/products/new.html.erb +5 -0
- data/app/views/auth/shopping/products/show.html.erb +12 -0
- data/app/views/auth/shopping/products/show.json.erb +1 -0
- data/app/views/auth/unlocks/create.js.erb +12 -0
- data/app/views/auth/unlocks/new.html.erb +14 -0
- data/app/views/auth/unlocks/new.js.erb +17 -0
- data/app/views/auth/users/_search_result.html.erb +8 -0
- data/app/views/auth/users/profiles/_user_data.html.erb +4 -0
- data/app/views/auth/users/profiles/show.html.erb +54 -0
- data/app/views/layouts/auth/_modals.html.erb +2 -0
- data/app/views/layouts/auth/application.html.erb +17 -0
- data/app/views/layouts/auth/navbar/_navbar.html.erb +49 -0
- data/app/views/layouts/auth/navbar/_personalization.html.erb +17 -0
- data/app/views/layouts/auth/navbar/_progress_spinner.html.erb +11 -0
- data/app/views/layouts/mailer.html.erb +5 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/config/initializers/active_model.rb +36 -0
- data/config/initializers/devise.rb +623 -0
- data/config/initializers/json.rb +10 -0
- data/config/initializers/omniauth.rb +447 -0
- data/config/initializers/redis.rb +2 -0
- data/config/initializers/redis.yml +14 -0
- data/config/locales/devise.en.yml +63 -0
- data/config/routes.rb +1 -0
- data/lib/assets/javascripts/data.js +126 -0
- data/lib/assets/javascripts/jquery.calendario.js +394 -0
- data/lib/assets/javascripts/jquery.tagcloud.js +92 -0
- data/lib/assets/javascripts/leanModal.js +236 -0
- data/lib/assets/javascripts/main.js +668 -0
- data/lib/assets/javascripts/modernizr.custom.63321.js +4 -0
- data/lib/assets/javascripts/payumoney.js +9 -0
- data/lib/assets/javascripts/search.js +36 -0
- data/lib/assets/javascripts/spinner.js +77 -0
- data/lib/assets/javascripts/trianglify.min.js +2 -0
- data/lib/assets/javascripts/you_need_to_sign_in.js.erb +478 -0
- data/lib/assets/stylesheets/calendar.css +111 -0
- data/lib/assets/stylesheets/calendar_modifications.scss +276 -0
- data/lib/auth.rb +32 -0
- data/lib/auth/custom_failure.rb +3 -0
- data/lib/auth/engine.rb +231 -0
- data/lib/auth/job_exception_handler.rb +7 -0
- data/lib/auth/mailgun.rb +28 -0
- data/lib/auth/notify.rb +8 -0
- data/lib/auth/omniauth/path.rb +104 -0
- data/lib/auth/partials.rb +12 -0
- data/lib/auth/rails/routes.rb +169 -0
- data/lib/auth/search/main.rb +97 -0
- data/lib/auth/sidekiq_up.rb +16 -0
- data/lib/auth/two_factor_otp.rb +202 -0
- data/lib/auth/url_shortener.rb +29 -0
- data/lib/auth/version.rb +3 -0
- data/lib/tasks/auth_tasks.rake +4 -0
- metadata +863 -0
@@ -0,0 +1,4 @@
|
|
1
|
+
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
|
2
|
+
* Build: http://modernizr.com/download/#-csstransitions-touch-shiv-cssclasses-prefixed-teststyles-testprop-testallprops-prefixes-domprefixes-load
|
3
|
+
*/
|
4
|
+
;window.Modernizr=function(a,b,c){function z(a){j.cssText=a}function A(a,b){return z(m.join(a+";")+(b||""))}function B(a,b){return typeof a===b}function C(a,b){return!!~(""+a).indexOf(b)}function D(a,b){for(var d in a){var e=a[d];if(!C(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function E(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:B(f,"function")?f.bind(d||b):f}return!1}function F(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return B(b,"string")||B(b,"undefined")?D(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),E(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},x={}.hasOwnProperty,y;!B(x,"undefined")&&!B(x.call,"undefined")?y=function(a,b){return x.call(a,b)}:y=function(a,b){return b in a&&B(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=u.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e}),q.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:w(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},q.csstransitions=function(){return F("transition")};for(var G in q)y(q,G)&&(v=G.toLowerCase(),e[v]=q[G](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)y(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},z(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.testProp=function(a){return D([a])},e.testAllProps=F,e.testStyles=w,e.prefixed=function(a,b,c){return b?F(a,b,c):F(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/***
|
2
|
+
payumoney form is autosubmitted on page load.
|
3
|
+
this happens in the show.html.erb action of the payment controller, where a hideen form with all the values prebuilt are already presented.
|
4
|
+
***/
|
5
|
+
/***
|
6
|
+
$(document).ready(function(){
|
7
|
+
$("#payumoney_form").submit();
|
8
|
+
});
|
9
|
+
***/
|
@@ -0,0 +1,36 @@
|
|
1
|
+
function navbar_search(query_string){
|
2
|
+
$.get(
|
3
|
+
{url : window.location.origin + "/search/authenticated_user_search",
|
4
|
+
data: {
|
5
|
+
query:
|
6
|
+
{query_string: query_string}
|
7
|
+
},
|
8
|
+
beforeSend: function(){
|
9
|
+
clear_search_results();
|
10
|
+
},
|
11
|
+
success : function( data ) {},
|
12
|
+
dataType : "script"
|
13
|
+
});
|
14
|
+
}
|
15
|
+
|
16
|
+
|
17
|
+
$(document).on('keyup', '#search',function(event){
|
18
|
+
console.log("the length is:");
|
19
|
+
console.log($(this).val().length);
|
20
|
+
if( $(this).val().length === 0 ){
|
21
|
+
clear_search_results()
|
22
|
+
}
|
23
|
+
else{
|
24
|
+
navbar_search($(this).val());
|
25
|
+
}
|
26
|
+
});
|
27
|
+
|
28
|
+
var clear_search_results = function(){
|
29
|
+
$("#navbar_search_results").html("");;
|
30
|
+
}
|
31
|
+
|
32
|
+
/***
|
33
|
+
when search is empty, clear the search results.
|
34
|
+
when new search key is pressed, clear the older search results.
|
35
|
+
when focus is not on the search bar, then clear the search results.
|
36
|
+
****/
|
@@ -0,0 +1,77 @@
|
|
1
|
+
$(document).bind("ajaxSend", function(){
|
2
|
+
$(".modal:visible").find(".error_notification").hide();
|
3
|
+
$("#progress_circle").show();
|
4
|
+
}).bind("ajaxStop", function(){
|
5
|
+
$("#progress_circle").hide();
|
6
|
+
}).bind("ajaxComplete",function(event,request,settings){
|
7
|
+
|
8
|
+
//$("body").append("<div id='dog'>dogged</div>");
|
9
|
+
}).bind("ajaxError",function(event,request,settings){
|
10
|
+
//console.log(event);
|
11
|
+
//console.log(request);
|
12
|
+
//console.log(settings);
|
13
|
+
$("#progress_circle").hide();
|
14
|
+
var request_url = settings.url;
|
15
|
+
var request_method = settings.type;
|
16
|
+
var status = request.status;
|
17
|
+
var error = request.responseText;
|
18
|
+
var readyState = request.readyState;
|
19
|
+
//console.log("url:" + request_url);
|
20
|
+
//console.log("method:" + request_method);
|
21
|
+
//console.log("status:" + status);
|
22
|
+
//console.log("error:" + error);
|
23
|
+
//console.log("readyState:" + readyState);
|
24
|
+
//console.log("request_url:" + request_url);
|
25
|
+
|
26
|
+
//this handles the request abort that occurs as a normal part of the
|
27
|
+
//remotipart request.
|
28
|
+
if(status == 0 && readyState == 0 && request.statusText == "cancelled"){
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
if(status == 200 || status == 201 || status == 302){
|
35
|
+
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
|
39
|
+
if(request_url.endsWith("sign_in") && request_method == "POST" && status == 401){
|
40
|
+
error_message = error;
|
41
|
+
mark_invalid_fields_on_sign_in_failure(error);
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
show_modal_error_message(error);
|
46
|
+
}).bind("beforeSend",function(){
|
47
|
+
//console.log("caught before send");
|
48
|
+
});
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
var toggle_ajax_error_modal = function(){
|
53
|
+
if($("#ajax_error_modal").is(":visible")){
|
54
|
+
|
55
|
+
}
|
56
|
+
else{
|
57
|
+
$("#ajax_error_modal").openModal();
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
var set_ajax_error_modal = function(){
|
62
|
+
//on clearing the
|
63
|
+
$("#ajax_error_modal").leanModal({
|
64
|
+
dismissible: true,
|
65
|
+
opacity: .5,
|
66
|
+
in_duration: 300,
|
67
|
+
out_duration: 200,
|
68
|
+
after_close: function(options){
|
69
|
+
|
70
|
+
}
|
71
|
+
});
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
$(document).ready(set_ajax_error_modal);
|
76
|
+
$(document).on('page:load', set_ajax_error_modal);
|
77
|
+
;
|
@@ -0,0 +1,2 @@
|
|
1
|
+
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.Trianglify=e()}}(function(){var e;return function r(e,n,t){function f(a,i){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!i&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var s=n[a]={exports:{}};e[a][0].call(s.exports,function(r){var n=e[a][1][r];return f(n?n:r)},s,s.exports,r,e,n,t)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<t.length;a++)f(t[a]);return f}({"./lib/trianglify.js":[function(e,r){function n(e){function r(e,r,n){return(e-r[0])*(n[1]-n[0])/(r[1]-r[0])+n[0]}function n(e){return{x:(e[0][0]+e[1][0]+e[2][0])/3,y:(e[0][1]+e[1][1]+e[2][1])/3}}function a(){if(e.palette instanceof Array)return e.palette[Math.floor(d()*e.palette.length)];var r=Object.keys(e.palette);return e.palette[r[Math.floor(d()*r.length)]]}function s(e,r){var n={};for(var t in e)n[t]=e[t];for(t in r){if(!e.hasOwnProperty(t))throw new Error(t+" is not a configuration option for Trianglify. Check your spelling?");n[t]=r[t]}return n}var d;if(e=s(c,e),d=f(e.seed),"random"===e.x_colors&&(e.x_colors=a()),"random"===e.y_colors&&(e.y_colors=a()),"match_x"===e.y_colors&&(e.y_colors=e.x_colors),!(e.width>0&&e.height>0))throw new Error("Width and height must be numbers greater than 0");if(e.cell_size<2)throw new Error("Cell size must be greater than 2.");var l;if(e.color_function)l=function(r,n){return o(e.color_function(r,n))};else{var b=o.scale(e.x_colors).mode(e.color_space),h=o.scale(e.y_colors).mode(e.color_space);l=function(r,n){return o.interpolate(b(r),h(n),.5,e.color_space)}}for(var g=e.width,p=e.height,m=Math.floor((g+4*e.cell_size)/e.cell_size),y=Math.floor((p+4*e.cell_size)/e.cell_size),v=(m*e.cell_size-g)/2,w=(y*e.cell_size-p)/2,x=e.cell_size*e.variance/2,_=function(e){return r(e,[-v,g+v],[0,1])},k=function(e){return r(e,[-w,p+w],[0,1])},j=e.points||i(g,p,v,w,e.cell_size,x,d),M=t.triangulate(j),q=[],C=function(e){return j[e]},N=0;N<M.length;N+=3){var U=[M[N],M[N+1],M[N+2]].map(C),A=n(U),P=l(_(A.x),k(A.y)).hex();q.push([P,U])}return u(q,e)}var t=e("delaunay-fast"),f=e("seedrandom"),o=e("chroma-js"),a=e("./colorbrewer"),i=e("./points"),u=e("./pattern"),c={width:600,height:400,cell_size:75,variance:.75,seed:null,x_colors:"random",y_colors:"match_x",palette:a,color_space:"lab",color_function:null,stroke_width:1.51,points:void 0};n.colorbrewer=a,n.defaults=c,r.exports=n},{"./colorbrewer":"/Users/qrohlf/Code/trianglify/lib/colorbrewer.js","./pattern":"/Users/qrohlf/Code/trianglify/lib/pattern.js","./points":"/Users/qrohlf/Code/trianglify/lib/points.js","chroma-js":"/Users/qrohlf/Code/trianglify/node_modules/chroma-js/chroma.js","delaunay-fast":"/Users/qrohlf/Code/trianglify/node_modules/delaunay-fast/delaunay.js",seedrandom:"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/index.js"}],"/Users/qrohlf/Code/trianglify/lib/colorbrewer.js":[function(e,r){r.exports={YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]}},{}],"/Users/qrohlf/Code/trianglify/lib/pattern.js":[function(e,r){(function(n){function t(r,t){function o(e){var n=f.createElementNS("http://www.w3.org/2000/svg","svg");return n.setAttribute("width",t.width),n.setAttribute("height",t.height),e&&e.includeNamespace&&n.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.forEach(function(e){var r=f.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d","M"+e[1].join("L")+"Z"),r.setAttribute("fill",e[0]),r.setAttribute("stroke",e[0]),r.setAttribute("stroke-width",t.stroke_width),n.appendChild(r)}),n}function a(o){var a;if("undefined"!=typeof n)try{e("canvas")}catch(i){throw Error("The optional node-canvas dependency is needed for Trianglify to render using canvas in node.")}return o||(o=f.createElement("canvas")),o.setAttribute("width",t.width),o.setAttribute("height",t.height),a=o.getContext("2d"),a.canvas.width=t.width,a.canvas.height=t.height,r.forEach(function(e){a.fillStyle=a.strokeStyle=e[0],a.lineWidth=t.stroke_width,a.beginPath(),a.moveTo.apply(a,e[1][0]),a.lineTo.apply(a,e[1][1]),a.lineTo.apply(a,e[1][2]),a.fill(),a.stroke()}),o}function i(){return a().toDataURL("image/png")}return{polys:r,opts:t,svg:o,canvas:a,png:i}}var f="undefined"!=typeof document?document:e("jsdom").jsdom("<html/>");r.exports=t}).call(this,e("_process"))},{_process:"/Users/qrohlf/Code/trianglify/node_modules/process/browser.js",canvas:"/Users/qrohlf/Code/trianglify/node_modules/browser-resolve/empty.js",jsdom:"/Users/qrohlf/Code/trianglify/node_modules/browser-resolve/empty.js"}],"/Users/qrohlf/Code/trianglify/lib/points.js":[function(e,r){function n(e,r,n,t,f,o,a){for(var i=e+n,u=r+t,c=.5*f,s=2*o,d=-o,l=[],b=-n;i>b;b+=f)for(var h=-t;u>h;h+=f){var g=b+c+(a()*s+d),p=h+c+(a()*s+d);l.push([Math.floor(g),Math.floor(p)])}return l}r.exports=n},{}],"/Users/qrohlf/Code/trianglify/node_modules/browser-resolve/empty.js":[function(){},{}],"/Users/qrohlf/Code/trianglify/node_modules/chroma-js/chroma.js":[function(r,n,t){(function(){var r,f,o,a,i,u,c,s,d,l,b,h,g,p,m,y,v,w,x,_,k,j,M,q,C,N,U,A,P,G,E,z,B,I,R,S,O,T,Y;l=function(e,n,t,f){return new r(e,n,t,f)},"undefined"!=typeof n&&null!==n&&null!=n.exports&&(n.exports=l),"function"==typeof e&&e.amd?e([],function(){return l}):(I="undefined"!=typeof t&&null!==t?t:this,I.chroma=l),l.color=function(e,n,t,f){return new r(e,n,t,f)},l.hsl=function(e,n,t,f){return new r(e,n,t,f,"hsl")},l.hsv=function(e,n,t,f){return new r(e,n,t,f,"hsv")},l.rgb=function(e,n,t,f){return new r(e,n,t,f,"rgb")},l.hex=function(e){return new r(e)},l.css=function(e){return new r(e)},l.lab=function(e,n,t){return new r(e,n,t,"lab")},l.lch=function(e,n,t){return new r(e,n,t,"lch")},l.hsi=function(e,n,t){return new r(e,n,t,"hsi")},l.gl=function(e,n,t,f){return new r(255*e,255*n,255*t,f,"gl")},l.interpolate=function(e,n,t,f){return null==e||null==n?"#000":("string"===R(e)&&(e=new r(e)),"string"===R(n)&&(n=new r(n)),e.interpolate(t,n,f))},l.mix=l.interpolate,l.contrast=function(e,n){var t,f;return"string"===R(e)&&(e=new r(e)),"string"===R(n)&&(n=new r(n)),t=e.luminance(),f=n.luminance(),t>f?(t+.05)/(f+.05):(f+.05)/(t+.05)},l.luminance=function(e){return l(e).luminance()},l._Color=r,r=function(){function e(){var e,r,n,t,f,o,a,i,u,c,s,d,l,h,g,p;for(f=this,n=[],c=0,s=arguments.length;s>c;c++)r=arguments[c],null!=r&&n.push(r);if(0===n.length)d=[255,0,255,1,"rgb"],a=d[0],i=d[1],u=d[2],e=d[3],t=d[4];else if("array"===R(n[0])){if(3===n[0].length)l=n[0],a=l[0],i=l[1],u=l[2],e=1;else{if(4!==n[0].length)throw"unknown input argument";h=n[0],a=h[0],i=h[1],u=h[2],e=h[3]}t=null!=(g=n[1])?g:"rgb"}else"string"===R(n[0])?(a=n[0],t="hex"):"object"===R(n[0])?(p=n[0]._rgb,a=p[0],i=p[1],u=p[2],e=p[3],t="rgb"):n.length>=3&&(a=n[0],i=n[1],u=n[2]);3===n.length?(t="rgb",e=1):4===n.length?"string"===R(n[3])?(t=n[3],e=1):"number"===R(n[3])&&(t="rgb",e=n[3]):5===n.length&&(e=n[3],t=n[4]),null==e&&(e=1),"rgb"===t?f._rgb=[a,i,u,e]:"gl"===t?f._rgb=[255*a,255*i,255*u,e]:"hsl"===t?(f._rgb=v(a,i,u),f._rgb[3]=e):"hsv"===t?(f._rgb=w(a,i,u),f._rgb[3]=e):"hex"===t?f._rgb=m(a):"lab"===t?(f._rgb=_(a,i,u),f._rgb[3]=e):"lch"===t?(f._rgb=M(a,i,u),f._rgb[3]=e):"hsi"===t&&(f._rgb=y(a,i,u),f._rgb[3]=e),o=b(f._rgb)}return e.prototype.rgb=function(){return this._rgb.slice(0,3)},e.prototype.rgba=function(){return this._rgb},e.prototype.hex=function(){return U(this._rgb)},e.prototype.toString=function(){return this.name()},e.prototype.hsl=function(){return P(this._rgb)},e.prototype.hsv=function(){return G(this._rgb)},e.prototype.lab=function(){return E(this._rgb)},e.prototype.lch=function(){return z(this._rgb)},e.prototype.hsi=function(){return A(this._rgb)},e.prototype.gl=function(){return[this._rgb[0]/255,this._rgb[1]/255,this._rgb[2]/255,this._rgb[3]]},e.prototype.luminance=function(r,n){var t,f,o,a;return null==n&&(n="rgb"),arguments.length?(0===r&&(this._rgb=[0,0,0,this._rgb[3]]),1===r&&(this._rgb=[255,255,255,this._rgb[3]]),t=C(this._rgb),f=1e-7,o=20,a=function(e,t){var i,u;return u=e.interpolate(.5,t,n),i=u.luminance(),Math.abs(r-i)<f||!o--?u:i>r?a(e,u):a(u,t)},this._rgb=(t>r?a(new e("black"),this):a(this,new e("white"))).rgba(),this):C(this._rgb)},e.prototype.name=function(){var e,r;e=this.hex();for(r in l.colors)if(e===l.colors[r])return r;return e},e.prototype.alpha=function(e){return arguments.length?(this._rgb[3]=e,this):this._rgb[3]},e.prototype.css=function(e){var r,n,t,f;return null==e&&(e="rgb"),n=this,t=n._rgb,3===e.length&&t[3]<1&&(e+="a"),"rgb"===e?e+"("+t.slice(0,3).map(Math.round).join(",")+")":"rgba"===e?e+"("+t.slice(0,3).map(Math.round).join(",")+","+t[3]+")":"hsl"===e||"hsla"===e?(r=n.hsl(),f=function(e){return Math.round(100*e)/100},r[0]=f(r[0]),r[1]=f(100*r[1])+"%",r[2]=f(100*r[2])+"%",4===e.length&&(r[3]=t[3]),e+"("+r.join(",")+")"):void 0},e.prototype.interpolate=function(r,n,t){var f,o,a,i,u,c,s,d,l,b,h,g,p,m;if(d=this,null==t&&(t="rgb"),"string"===R(n)&&(n=new e(n)),"hsl"===t||"hsv"===t||"lch"===t||"hsi"===t)"hsl"===t?(p=d.hsl(),m=n.hsl()):"hsv"===t?(p=d.hsv(),m=n.hsv()):"hsi"===t?(p=d.hsi(),m=n.hsi()):"lch"===t&&(p=d.lch(),m=n.lch()),"h"===t.substr(0,1)?(a=p[0],h=p[1],c=p[2],i=m[0],g=m[1],s=m[2]):(c=p[0],h=p[1],a=p[2],s=m[0],g=m[1],i=m[2]),isNaN(a)||isNaN(i)?isNaN(a)?isNaN(i)?o=Number.NaN:(o=i,1!==c&&0!==c||"hsv"===t||(b=g)):(o=a,1!==s&&0!==s||"hsv"===t||(b=h)):(f=i>a&&i-a>180?i-(a+360):a>i&&a-i>180?i+360-a:i-a,o=a+r*f),null==b&&(b=h+r*(g-h)),u=c+r*(s-c),l="h"===t.substr(0,1)?new e(o,b,u,t):new e(u,b,o,t);else if("rgb"===t)p=d._rgb,m=n._rgb,l=new e(p[0]+r*(m[0]-p[0]),p[1]+r*(m[1]-p[1]),p[2]+r*(m[2]-p[2]),t);else{if("lab"!==t)throw"color mode "+t+" is not supported";p=d.lab(),m=n.lab(),l=new e(p[0]+r*(m[0]-p[0]),p[1]+r*(m[1]-p[1]),p[2]+r*(m[2]-p[2]),t)}return l.alpha(d.alpha()+r*(n.alpha()-d.alpha())),l},e.prototype.premultiply=function(){var e,r;return r=this.rgb(),e=this.alpha(),l(r[0]*e,r[1]*e,r[2]*e,e)},e.prototype.darken=function(e){var r,n;return null==e&&(e=20),n=this,r=n.lch(),r[0]-=e,l.lch(r).alpha(n.alpha())},e.prototype.darker=function(e){return this.darken(e)},e.prototype.brighten=function(e){return null==e&&(e=20),this.darken(-e)},e.prototype.brighter=function(e){return this.brighten(e)},e.prototype.saturate=function(e){var r,n;return null==e&&(e=20),n=this,r=n.lch(),r[1]+=e,l.lch(r).alpha(n.alpha())},e.prototype.desaturate=function(e){return null==e&&(e=20),this.saturate(-e)},e}(),b=function(e){var r;for(r in e)3>r?(e[r]<0&&(e[r]=0),e[r]>255&&(e[r]=255)):3===r&&(e[r]<0&&(e[r]=0),e[r]>1&&(e[r]=1));return e},p=function(e){var r,n,t,f,o,a,i,u;if(e=e.toLowerCase(),null!=l.colors&&l.colors[e])return m(l.colors[e]);if(t=e.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(f=t.slice(1,4),n=o=0;2>=o;n=++o)f[n]=+f[n];f[3]=1}else if(t=e.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(f=t.slice(1,5),n=a=0;3>=a;n=++a)f[n]=+f[n];else if(t=e.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(f=t.slice(1,4),n=i=0;2>=i;n=++i)f[n]=Math.round(2.55*f[n]);f[3]=1}else if(t=e.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(f=t.slice(1,5),n=u=0;2>=u;n=++u)f[n]=Math.round(2.55*f[n]);f[3]=+f[3]}else(t=e.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?(r=t.slice(1,4),r[1]*=.01,r[2]*=.01,f=v(r),f[3]=1):(t=e.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&(r=t.slice(1,4),r[1]*=.01,r[2]*=.01,f=v(r),f[3]=+t[4]);return f},m=function(e){var r,n,t,f,o,a;if(e.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))return(4===e.length||7===e.length)&&(e=e.substr(1)),3===e.length&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),a=parseInt(e,16),f=a>>16,t=a>>8&255,n=255&a,[f,t,n,1];if(e.match(/^#?([A-Fa-f0-9]{8})$/))return 9===e.length&&(e=e.substr(1)),a=parseInt(e,16),f=a>>24&255,t=a>>16&255,n=a>>8&255,r=255&a,[f,t,n,r];if(o=p(e))return o;throw"unknown color: "+e},y=function(e,r,n){var t,f,i,u;return u=S(arguments),e=u[0],r=u[1],n=u[2],e/=360,1/3>e?(t=(1-r)/3,i=(1+r*g(a*e)/g(o-a*e))/3,f=1-(t+i)):2/3>e?(e-=1/3,i=(1-r)/3,f=(1+r*g(a*e)/g(o-a*e))/3,t=1-(i+f)):(e-=2/3,f=(1-r)/3,t=(1+r*g(a*e)/g(o-a*e))/3,i=1-(f+t)),i=q(n*i*3),f=q(n*f*3),t=q(n*t*3),[255*i,255*f,255*t]},v=function(){var e,r,n,t,f,o,a,i,u,c,s,d,l,b;if(l=S(arguments),t=l[0],i=l[1],o=l[2],0===i)a=n=e=255*o;else{for(s=[0,0,0],r=[0,0,0],c=.5>o?o*(1+i):o+i-o*i,u=2*o-c,t/=360,s[0]=t+1/3,s[1]=t,s[2]=t-1/3,f=d=0;2>=d;f=++d)s[f]<0&&(s[f]+=1),s[f]>1&&(s[f]-=1),r[f]=6*s[f]<1?u+6*(c-u)*s[f]:2*s[f]<1?c:3*s[f]<2?u+(c-u)*(2/3-s[f])*6:u;b=[Math.round(255*r[0]),Math.round(255*r[1]),Math.round(255*r[2])],a=b[0],n=b[1],e=b[2]}return[a,n,e]},w=function(){var e,r,n,t,f,o,a,i,u,c,s,d,l,b,h,g,p,m;if(d=S(arguments),t=d[0],u=d[1],s=d[2],s*=255,0===u)i=n=e=s;else switch(360===t&&(t=0),t>360&&(t-=360),0>t&&(t+=360),t/=60,f=Math.floor(t),r=t-f,o=s*(1-u),a=s*(1-u*r),c=s*(1-u*(1-r)),f){case 0:l=[s,c,o],i=l[0],n=l[1],e=l[2];break;case 1:b=[a,s,o],i=b[0],n=b[1],e=b[2];break;case 2:h=[o,s,c],i=h[0],n=h[1],e=h[2];break;case 3:g=[o,a,s],i=g[0],n=g[1],e=g[2];break;case 4:p=[c,o,s],i=p[0],n=p[1],e=p[2];break;case 5:m=[s,o,a],i=m[0],n=m[1],e=m[2]}return i=Math.round(i),n=Math.round(n),e=Math.round(e),[i,n,e]},f=18,i=.95047,u=1,c=1.08883,x=function(){var e,r,n,t,f,o;return o=S(arguments),f=o[0],e=o[1],r=o[2],n=Math.sqrt(e*e+r*r),t=Math.atan2(r,e)/Math.PI*180,[f,n,t]},_=function(e,r,n){var t,f,o,a,s,d,l;return void 0!==e&&3===e.length&&(d=e,e=d[0],r=d[1],n=d[2]),void 0!==e&&3===e.length&&(l=e,e=l[0],r=l[1],n=l[2]),a=(e+16)/116,o=a+r/500,s=a-n/200,o=k(o)*i,a=k(a)*u,s=k(s)*c,f=T(3.2404542*o-1.5371385*a-.4985314*s),t=T(-.969266*o+1.8760108*a+.041556*s),n=T(.0556434*o-.2040259*a+1.0572252*s),[q(f,0,255),q(t,0,255),q(n,0,255),1]},k=function(e){return e>.206893034?e*e*e:(e-4/29)/7.787037},T=function(e){return Math.round(255*(.00304>=e?12.92*e:1.055*Math.pow(e,1/2.4)-.055))},j=function(){var e,r,n,t;return t=S(arguments),n=t[0],e=t[1],r=t[2],r=r*Math.PI/180,[n,Math.cos(r)*e,Math.sin(r)*e]},M=function(e,r,n){var t,f,o,a,i,u,c;return u=j(e,r,n),t=u[0],f=u[1],o=u[2],c=_(t,f,o),i=c[0],a=c[1],o=c[2],[q(i,0,255),q(a,0,255),q(o,0,255)]},C=function(e,r,n){var t;return t=S(arguments),e=t[0],r=t[1],n=t[2],e=N(e),r=N(r),n=N(n),.2126*e+.7152*r+.0722*n},N=function(e){return e/=255,.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4)},U=function(){var e,r,n,t,f,o;return o=S(arguments),n=o[0],r=o[1],e=o[2],f=n<<16|r<<8|e,t="000000"+f.toString(16),"#"+t.substr(t.length-6)},A=function(){var e,r,n,t,f,o,a,i,u;return u=S(arguments),a=u[0],n=u[1],r=u[2],e=2*Math.PI,a/=255,n/=255,r/=255,o=Math.min(a,n,r),f=(a+n+r)/3,i=1-o/f,0===i?t=0:(t=(a-n+(a-r))/2,t/=Math.sqrt((a-n)*(a-n)+(a-r)*(n-r)),t=Math.acos(t),r>n&&(t=e-t),t/=e),[360*t,i,f]},P=function(e,r,n){var t,f,o,a,i,u;return void 0!==e&&e.length>=3&&(u=e,e=u[0],r=u[1],n=u[2]),e/=255,r/=255,n/=255,a=Math.min(e,r,n),o=Math.max(e,r,n),f=(o+a)/2,o===a?(i=0,t=Number.NaN):i=.5>f?(o-a)/(o+a):(o-a)/(2-o-a),e===o?t=(r-n)/(o-a):r===o?t=2+(n-e)/(o-a):n===o&&(t=4+(e-r)/(o-a)),t*=60,0>t&&(t+=360),[t,i,f]},G=function(){var e,r,n,t,f,o,a,i,u,c;return c=S(arguments),a=c[0],n=c[1],e=c[2],o=Math.min(a,n,e),f=Math.max(a,n,e),r=f-o,u=f/255,0===f?(t=Number.NaN,i=0):(i=r/f,a===f&&(t=(n-e)/r),n===f&&(t=2+(e-a)/r),e===f&&(t=4+(a-n)/r),t*=60,0>t&&(t+=360)),[t,i,u]},E=function(){var e,r,n,t,f,o,a;return a=S(arguments),n=a[0],r=a[1],e=a[2],n=B(n),r=B(r),e=B(e),t=O((.4124564*n+.3575761*r+.1804375*e)/i),f=O((.2126729*n+.7151522*r+.072175*e)/u),o=O((.0193339*n+.119192*r+.9503041*e)/c),[116*f-16,500*(t-f),200*(f-o)]},B=function(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},O=function(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29},z=function(){var e,r,n,t,f,o,a;return o=S(arguments),f=o[0],n=o[1],r=o[2],a=E(f,n,r),t=a[0],e=a[1],r=a[2],x(t,e,r)},l.scale=function(e,r){var n,t,f,o,a,i,u,c,s,d,b,h,g,p,m,y,v,w,x,_,k;return y="rgb",v=l("#ccc"),k=0,g=!1,h=[0,1],d=[],x=!1,_=[],m=0,p=1,b=!1,w=0,s={},i=function(e,r){var n,t,f,o,i,u,c;if(null==e&&(e=["#ddd","#222"]),null!=e&&"string"===R(e)&&null!=(null!=(i=l.brewer)?i[e]:void 0)&&(e=l.brewer[e]),"array"===R(e)){for(e=e.slice(0),n=f=0,u=e.length-1;u>=0?u>=f:f>=u;n=u>=0?++f:--f)t=e[n],"string"===R(t)&&(e[n]=l(t));if(null!=r)_=r;else for(_=[],n=o=0,c=e.length-1;c>=0?c>=o:o>=c;n=c>=0?++o:--o)_.push(n/(e.length-1))}return a(),d=e},u=function(e){return null==e&&(e=[]),h=e,m=e[0],p=e[e.length-1],a(),w=2===e.length?0:e.length-1},f=function(e){var r,n;if(null!=h){for(n=h.length-1,r=0;n>r&&e>=h[r];)r++;return r-1}return 0},c=function(e){return e},n=function(e){var r,n,t,o,a;return a=e,h.length>2&&(o=h.length-1,r=f(e),t=h[0]+(h[1]-h[0])*(0+.5*k),n=h[o-1]+(h[o]-h[o-1])*(1-.5*k),a=m+(h[r]+.5*(h[r+1]-h[r])-t)/(n-t)*(p-m)),a},o=function(e,r){var n,t,o,a,i,u,b,g,x;if(null==r&&(r=!1),isNaN(e))return v;if(r?b=e:h.length>2?(n=f(e),b=n/(w-1)):(b=o=m!==p?(e-m)/(p-m):0,b=o=(e-m)/(p-m),b=Math.min(1,Math.max(0,b))),r||(b=c(b)),i=Math.floor(1e4*b),s[i])t=s[i];else{if("array"===R(d))for(a=g=0,x=_.length-1;x>=0?x>=g:g>=x;a=x>=0?++g:--g){if(u=_[a],u>=b){t=d[a];break}if(b>=u&&a===_.length-1){t=d[a];break}if(b>u&&b<_[a+1]){b=(b-u)/(_[a+1]-u),t=l.interpolate(d[a],d[a+1],b,y);break}}else"function"===R(d)&&(t=d(b));s[i]=t}return t},a=function(){return s={}},i(e,r),t=function(e){var r;return r=o(e),x&&r[x]?r[x]():r},t.domain=function(e,r,n,f){var o;return null==n&&(n="e"),arguments.length?(null!=r&&(o=l.analyze(e,f),e=0===r?[o.min,o.max]:l.limits(o,n,r)),u(e),t):h},t.mode=function(e){return arguments.length?(y=e,a(),t):y},t.range=function(e,r){return i(e,r),t},t.out=function(e){return x=e,t},t.spread=function(e){return arguments.length?(k=e,t):k},t.correctLightness=function(e){return arguments.length?(b=e,a(),c=b?function(e){var r,n,t,f,a,i,u,c,s;for(r=o(0,!0).lab()[0],n=o(1,!0).lab()[0],u=r>n,t=o(e,!0).lab()[0],a=r+(n-r)*e,f=t-a,c=0,s=1,i=20;Math.abs(f)>.01&&i-->0;)!function(){return u&&(f*=-1),0>f?(c=e,e+=.5*(s-e)):(s=e,e+=.5*(c-e)),t=o(e,!0).lab()[0],f=t-a}();return e}:function(e){return e},t):b},t.colors=function(r){var n,f,o,a,i,u;if(null==r&&(r="hex"),e=[],f=[],h.length>2)for(n=o=1,u=h.length;u>=1?u>o:o>u;n=u>=1?++o:--o)f.push(.5*(h[n-1]+h[n]));else f=h;for(a=0,i=f.length;i>a;a++)n=f[a],e.push(t(n)[r]());return e},t},null==(Y=l.scales)&&(l.scales={}),l.scales.cool=function(){return l.scale([l.hsl(180,1,.9),l.hsl(250,.7,.4)])},l.scales.hot=function(){return l.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},l.analyze=function(e,r,n){var t,f,o,a,i,u,c;if(o={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0},null==n&&(n=function(){return!0}),t=function(e){null==e||isNaN(e)||(o.values.push(e),o.sum+=e,e<o.min&&(o.min=e),e>o.max&&(o.max=e),o.count+=1)},i=function(e,f){return n(e,f)?null!=r&&"function"===R(r)?t(r(e)):null!=r&&"string"===R(r)||"number"===R(r)?t(e[r]):t(e):void 0},"array"===R(e))for(u=0,c=e.length;c>u;u++)a=e[u],i(a);else for(f in e)a=e[f],i(a,f);return o.domain=[o.min,o.max],o.limits=function(e,r){return l.limits(o,e,r)},o},l.limits=function(e,r,n){var t,f,o,a,i,u,c,s,d,b,h,g,p,m,y,v,w,x,_,k,j,M,q,C,N,U,A,P,G,E,z,B,I,S,O,T,Y,L,F,D,V,X,W,$,Z,H,J,K,Q,er,rr,nr,tr,fr,or,ar;if(null==r&&(r="equal"),null==n&&(n=7),"array"===R(e)&&(e=l.analyze(e)),p=e.min,h=e.max,q=e.sum,U=e.values.sort(function(e,r){return e-r}),b=[],"c"===r.substr(0,1)&&(b.push(p),b.push(h)),"e"===r.substr(0,1)){for(b.push(p),c=A=1,Y=n-1;Y>=1?Y>=A:A>=Y;c=Y>=1?++A:--A)b.push(p+c/n*(h-p));b.push(h)}else if("l"===r.substr(0,1)){if(0>=p)throw"Logarithmic scales are only possible for values > 0";for(m=Math.LOG10E*Math.log(p),g=Math.LOG10E*Math.log(h),b.push(p),c=P=1,$=n-1;$>=1?$>=P:P>=$;c=$>=1?++P:--P)b.push(Math.pow(10,m+c/n*(g-m)));b.push(h)}else if("q"===r.substr(0,1)){for(b.push(p),c=G=1,Z=n-1;Z>=1?Z>=G:G>=Z;c=Z>=1?++G:--G)_=U.length*c/n,k=Math.floor(_),k===_?b.push(U[k]):(j=_-k,b.push(U[k]*j+U[k+1]*(1-j)));b.push(h)}else if("k"===r.substr(0,1)){for(v=U.length,t=new Array(v),i=new Array(n),M=!0,w=0,o=null,o=[],o.push(p),c=E=1,H=n-1;H>=1?H>=E:E>=H;c=H>=1?++E:--E)o.push(p+c/n*(h-p));for(o.push(h);M;){for(s=z=0,J=n-1;J>=0?J>=z:z>=J;s=J>=0?++z:--z)i[s]=0;for(c=B=0,K=v-1;K>=0?K>=B:B>=K;c=K>=0?++B:--B){for(N=U[c],y=Number.MAX_VALUE,s=I=0,Q=n-1;Q>=0?Q>=I:I>=Q;s=Q>=0?++I:--I)u=Math.abs(o[s]-N),y>u&&(y=u,f=s);i[f]++,t[c]=f}for(x=new Array(n),s=S=0,er=n-1;er>=0?er>=S:S>=er;s=er>=0?++S:--S)x[s]=null;for(c=O=0,rr=v-1;rr>=0?rr>=O:O>=rr;c=rr>=0?++O:--O)a=t[c],null===x[a]?x[a]=U[c]:x[a]+=U[c];for(s=T=0,L=n-1;L>=0?L>=T:T>=L;s=L>=0?++T:--T)x[s]*=1/i[s];for(M=!1,s=nr=0,F=n-1;F>=0?F>=nr:nr>=F;s=F>=0?++nr:--nr)if(x[s]!==o[c]){M=!0;break}o=x,w++,w>200&&(M=!1)}for(d={},s=tr=0,D=n-1;D>=0?D>=tr:tr>=D;s=D>=0?++tr:--tr)d[s]=[];for(c=fr=0,V=v-1;V>=0?V>=fr:fr>=V;c=V>=0?++fr:--fr)a=t[c],d[a].push(U[c]);for(C=[],s=or=0,X=n-1;X>=0?X>=or:or>=X;s=X>=0?++or:--or)C.push(d[s][0]),C.push(d[s][d[s].length-1]);for(C=C.sort(function(e,r){return e-r}),b.push(C[0]),c=ar=1,W=C.length-1;W>=ar;c=ar+=2)isNaN(C[c])||b.push(C[c])}return b},l.brewer=d={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},l.colors=h={indigo:"#4b0082",gold:"#ffd700",hotpink:"#ff69b4",firebrick:"#b22222",indianred:"#cd5c5c",yellow:"#ffff00",mistyrose:"#ffe4e1",darkolivegreen:"#556b2f",olive:"#808000",darkseagreen:"#8fbc8f",pink:"#ffc0cb",tomato:"#ff6347",lightcoral:"#f08080",orangered:"#ff4500",navajowhite:"#ffdead",lime:"#00ff00",palegreen:"#98fb98",darkslategrey:"#2f4f4f",greenyellow:"#adff2f",burlywood:"#deb887",seashell:"#fff5ee",mediumspringgreen:"#00fa9a",fuchsia:"#ff00ff",papayawhip:"#ffefd5",blanchedalmond:"#ffebcd",chartreuse:"#7fff00",dimgray:"#696969",black:"#000000",peachpuff:"#ffdab9",springgreen:"#00ff7f",aquamarine:"#7fffd4",white:"#ffffff",orange:"#ffa500",lightsalmon:"#ffa07a",darkslategray:"#2f4f4f",brown:"#a52a2a",ivory:"#fffff0",dodgerblue:"#1e90ff",peru:"#cd853f",lawngreen:"#7cfc00",chocolate:"#d2691e",crimson:"#dc143c",forestgreen:"#228b22",darkgrey:"#a9a9a9",lightseagreen:"#20b2aa",cyan:"#00ffff",mintcream:"#f5fffa",silver:"#c0c0c0",antiquewhite:"#faebd7",mediumorchid:"#ba55d3",skyblue:"#87ceeb",gray:"#808080",darkturquoise:"#00ced1",goldenrod:"#daa520",darkgreen:"#006400",floralwhite:"#fffaf0",darkviolet:"#9400d3",darkgray:"#a9a9a9",moccasin:"#ffe4b5",saddlebrown:"#8b4513",grey:"#808080",darkslateblue:"#483d8b",lightskyblue:"#87cefa",lightpink:"#ffb6c1",mediumvioletred:"#c71585",slategrey:"#708090",red:"#ff0000",deeppink:"#ff1493",limegreen:"#32cd32",darkmagenta:"#8b008b",palegoldenrod:"#eee8aa",plum:"#dda0dd",turquoise:"#40e0d0",lightgrey:"#d3d3d3",lightgoldenrodyellow:"#fafad2",darkgoldenrod:"#b8860b",lavender:"#e6e6fa",maroon:"#800000",yellowgreen:"#9acd32",sandybrown:"#f4a460",thistle:"#d8bfd8",violet:"#ee82ee",navy:"#000080",magenta:"#ff00ff",dimgrey:"#696969",tan:"#d2b48c",rosybrown:"#bc8f8f",olivedrab:"#6b8e23",blue:"#0000ff",lightblue:"#add8e6",ghostwhite:"#f8f8ff",honeydew:"#f0fff0",cornflowerblue:"#6495ed",slateblue:"#6a5acd",linen:"#faf0e6",darkblue:"#00008b",powderblue:"#b0e0e6",seagreen:"#2e8b57",darkkhaki:"#bdb76b",snow:"#fffafa",sienna:"#a0522d",mediumblue:"#0000cd",royalblue:"#4169e1",lightcyan:"#e0ffff",green:"#008000",mediumpurple:"#9370db",midnightblue:"#191970",cornsilk:"#fff8dc",paleturquoise:"#afeeee",bisque:"#ffe4c4",slategray:"#708090",darkcyan:"#008b8b",khaki:"#f0e68c",wheat:"#f5deb3",teal:"#008080",darkorchid:"#9932cc",deepskyblue:"#00bfff",salmon:"#fa8072",darkred:"#8b0000",steelblue:"#4682b4",palevioletred:"#db7093",lightslategray:"#778899",aliceblue:"#f0f8ff",lightslategrey:"#778899",lightgreen:"#90ee90",orchid:"#da70d6",gainsboro:"#dcdcdc",mediumseagreen:"#3cb371",lightgray:"#d3d3d3",mediumturquoise:"#48d1cc",lemonchiffon:"#fffacd",cadetblue:"#5f9ea0",lightyellow:"#ffffe0",lavenderblush:"#fff0f5",coral:"#ff7f50",purple:"#800080",aqua:"#00ffff",whitesmoke:"#f5f5f5",mediumslateblue:"#7b68ee",darkorange:"#ff8c00",mediumaquamarine:"#66cdaa",darksalmon:"#e9967a",beige:"#f5f5dc",blueviolet:"#8a2be2",azure:"#f0ffff",lightsteelblue:"#b0c4de",oldlace:"#fdf5e6"},R=function(){var e,r,n,t,f;for(e={},f="Boolean Number String Function Array Date RegExp Undefined Null".split(" "),n=0,t=f.length;t>n;n++)r=f[n],e["[object "+r+"]"]=r.toLowerCase();return function(r){var n;return n=Object.prototype.toString.call(r),e[n]||"object"}}(),q=function(e,r,n){return null==r&&(r=0),null==n&&(n=1),r>e&&(e=r),e>n&&(e=n),e},S=function(e){return e.length>=3?e:e[0]},a=2*Math.PI,o=Math.PI/3,g=Math.cos,s=function(e){var r,n,t,f,o,a,i,u,c,d,b;return e=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(l(f));return t}(),2===e.length?(c=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(f.lab());return t}(),o=c[0],a=c[1],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push(o[r]+e*(a[r]-o[r]));return t}(),l.lab.apply(l,n)}):3===e.length?(d=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(f.lab());return t}(),o=d[0],a=d[1],i=d[2],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push((1-e)*(1-e)*o[r]+2*(1-e)*e*a[r]+e*e*i[r]);return t}(),l.lab.apply(l,n)}):4===e.length?(b=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(f.lab());return t}(),o=b[0],a=b[1],i=b[2],u=b[3],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push((1-e)*(1-e)*(1-e)*o[r]+3*(1-e)*(1-e)*e*a[r]+3*(1-e)*e*e*i[r]+e*e*e*u[r]);return t
|
2
|
+
}(),l.lab.apply(l,n)}):5===e.length&&(n=s(e.slice(0,3)),t=s(e.slice(2,5)),r=function(e){return.5>e?n(2*e):t(2*(e-.5))}),r},l.interpolate.bezier=s}).call(this)},{}],"/Users/qrohlf/Code/trianglify/node_modules/delaunay-fast/delaunay.js":[function(e,r){var n;!function(){"use strict";function e(e){var r,n,t,f,o,a,i=Number.POSITIVE_INFINITY,u=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(r=e.length;r--;)e[r][0]<i&&(i=e[r][0]),e[r][0]>c&&(c=e[r][0]),e[r][1]<u&&(u=e[r][1]),e[r][1]>s&&(s=e[r][1]);return n=c-i,t=s-u,f=Math.max(n,t),o=i+.5*n,a=u+.5*t,[[o-20*f,a-f],[o,a+20*f],[o+20*f,a-f]]}function t(e,r,n,t){var f,a,i,u,c,s,d,l,b,h,g=e[r][0],p=e[r][1],m=e[n][0],y=e[n][1],v=e[t][0],w=e[t][1],x=Math.abs(p-y),_=Math.abs(y-w);if(o>x&&o>_)throw new Error("Eek! Coincident points!");return o>x?(u=-((v-m)/(w-y)),s=(m+v)/2,l=(y+w)/2,f=(m+g)/2,a=u*(f-s)+l):o>_?(i=-((m-g)/(y-p)),c=(g+m)/2,d=(p+y)/2,f=(v+m)/2,a=i*(f-c)+d):(i=-((m-g)/(y-p)),u=-((v-m)/(w-y)),c=(g+m)/2,s=(m+v)/2,d=(p+y)/2,l=(y+w)/2,f=(i*c-u*s+l-d)/(i-u),a=x>_?i*(f-c)+d:u*(f-s)+l),b=m-f,h=y-a,{i:r,j:n,k:t,x:f,y:a,r:b*b+h*h}}function f(e){var r,n,t,f,o,a;for(n=e.length;n;)for(f=e[--n],t=e[--n],r=n;r;)if(a=e[--r],o=e[--r],t===o&&f===a||t===a&&f===o){e.splice(n,2),e.splice(r,2);break}}var o=1/1048576;n={triangulate:function(r,n){var a,i,u,c,s,d,l,b,h,g,p,m,y=r.length;if(3>y)return[];if(r=r.slice(0),n)for(a=y;a--;)r[a]=r[a][n];for(u=new Array(y),a=y;a--;)u[a]=a;for(u.sort(function(e,n){return r[n][0]-r[e][0]}),c=e(r),r.push(c[0],c[1],c[2]),s=[t(r,y+0,y+1,y+2)],d=[],l=[],a=u.length;a--;l.length=0){for(m=u[a],i=s.length;i--;)b=r[m][0]-s[i].x,b>0&&b*b>s[i].r?(d.push(s[i]),s.splice(i,1)):(h=r[m][1]-s[i].y,b*b+h*h-s[i].r>o||(l.push(s[i].i,s[i].j,s[i].j,s[i].k,s[i].k,s[i].i),s.splice(i,1)));for(f(l),i=l.length;i;)p=l[--i],g=l[--i],s.push(t(r,g,p,m))}for(a=s.length;a--;)d.push(s[a]);for(s.length=0,a=d.length;a--;)d[a].i<y&&d[a].j<y&&d[a].k<y&&s.push(d[a].i,d[a].j,d[a].k);return s},contains:function(e,r){if(r[0]<e[0][0]&&r[0]<e[1][0]&&r[0]<e[2][0]||r[0]>e[0][0]&&r[0]>e[1][0]&&r[0]>e[2][0]||r[1]<e[0][1]&&r[1]<e[1][1]&&r[1]<e[2][1]||r[1]>e[0][1]&&r[1]>e[1][1]&&r[1]>e[2][1])return null;var n=e[1][0]-e[0][0],t=e[2][0]-e[0][0],f=e[1][1]-e[0][1],o=e[2][1]-e[0][1],a=n*o-t*f;if(0===a)return null;var i=(o*(r[0]-e[0][0])-t*(r[1]-e[0][1]))/a,u=(n*(r[1]-e[0][1])-f*(r[0]-e[0][0]))/a;return 0>i||0>u||i+u>1?null:[i,u]}},"undefined"!=typeof r&&(r.exports=n)}()},{}],"/Users/qrohlf/Code/trianglify/node_modules/process/browser.js":[function(e,r){function n(){if(!a){a=!0;for(var e,r=o.length;r;){e=o,o=[];for(var n=-1;++n<r;)e[n]();r=o.length}a=!1}}function t(){}var f=r.exports={},o=[],a=!1;f.nextTick=function(e){o.push(e),a||setTimeout(n,0)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=t,f.addListener=t,f.once=t,f.off=t,f.removeListener=t,f.removeAllListeners=t,f.emit=t,f.binding=function(){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/index.js":[function(e,r){var n=e("./lib/alea"),t=e("./lib/xor128"),f=e("./lib/xorwow"),o=e("./lib/xorshift7"),a=e("./lib/xor4096"),i=e("./lib/tychei"),u=e("./seedrandom");u.alea=n,u.xor128=t,u.xorwow=f,u.xorshift7=o,u.xor4096=a,u.tychei=i,r.exports=u},{"./lib/alea":"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/alea.js","./lib/tychei":"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/tychei.js","./lib/xor128":"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/xor128.js","./lib/xor4096":"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/xor4096.js","./lib/xorshift7":"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/xorshift7.js","./lib/xorwow":"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/xorwow.js","./seedrandom":"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/seedrandom.js"}],"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/alea.js":[function(r,n){!function(e,r,n){function t(e){var r=this,n=a();r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function f(e,r){return r.c=e.c,r.s0=e.s0,r.s1=e.s1,r.s2=e.s2,r}function o(e,r){var n=new t(e),o=r&&r.state,a=n.next;return a.int32=function(){return 4294967296*n.next()|0},a.double=function(){return a()+1.1102230246251565e-16*(2097152*a()|0)},a.quick=a,o&&("object"==typeof o&&f(o,n),a.state=function(){return f(n,{})}),a}function a(){var e=4022871197,r=function(r){r=r.toString();for(var n=0;n<r.length;n++){e+=r.charCodeAt(n);var t=.02519603282416938*e;e=t>>>0,t-=e,t*=e,e=t>>>0,t-=e,e+=4294967296*t}return 2.3283064365386963e-10*(e>>>0)};return r}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.alea=o}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/tychei.js":[function(r,n){!function(e,r,n){function t(e){var r=this,n="";r.next=function(){var e=r.b,n=r.c,t=r.d,f=r.a;return e=e<<25^e>>>7^n,n=n-t|0,t=t<<24^t>>>8^f,f=f-e|0,r.b=e=e<<20^e>>>12^n,r.c=n=n-t|0,r.d=t<<16^n>>>16^f,r.a=f-e|0},r.a=0,r.b=0,r.c=-1640531527,r.d=1367130551,e===Math.floor(e)?(r.a=e/4294967296|0,r.b=0|e):n+=e;for(var t=0;t<n.length+20;t++)r.b^=0|n.charCodeAt(t),r.next()}function f(e,r){return r.a=e.a,r.b=e.b,r.c=e.c,r.d=e.d,r}function o(e,r){var n=new t(e),o=r&&r.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},a.int32=n.next,a.quick=a,o&&("object"==typeof o&&f(o,n),a.state=function(){return f(n,{})}),a}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.tychei=o}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/xor128.js":[function(r,n){!function(e,r,n){function t(e){var r=this,n="";r.x=0,r.y=0,r.z=0,r.w=0,r.next=function(){var e=r.x^r.x<<11;return r.x=r.y,r.y=r.z,r.z=r.w,r.w^=r.w>>>19^e^e>>>8},e===(0|e)?r.x=e:n+=e;for(var t=0;t<n.length+64;t++)r.x^=0|n.charCodeAt(t),r.next()}function f(e,r){return r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r}function o(e,r){var n=new t(e),o=r&&r.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},a.int32=n.next,a.quick=a,o&&("object"==typeof o&&f(o,n),a.state=function(){return f(n,{})}),a}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xor128=o}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/xor4096.js":[function(r,n){!function(e,r,n){function t(e){function r(e,r){var n,t,f,o,a,i=[],u=128;for(r===(0|r)?(t=r,r=null):(r+="\x00",t=0,u=Math.max(u,r.length)),f=0,o=-32;u>o;++o)r&&(t^=r.charCodeAt((o+32)%r.length)),0===o&&(a=t),t^=t<<10,t^=t>>>15,t^=t<<4,t^=t>>>13,o>=0&&(a=a+1640531527|0,n=i[127&o]^=t+a,f=0==n?f+1:0);for(f>=128&&(i[127&(r&&r.length||0)]=-1),f=127,o=512;o>0;--o)t=i[f+34&127],n=i[f=f+1&127],t^=t<<13,n^=n<<17,t^=t>>>15,n^=n>>>12,i[f]=t^n;e.w=a,e.X=i,e.i=f}var n=this;n.next=function(){var e,r,t=n.w,f=n.X,o=n.i;return n.w=t=t+1640531527|0,r=f[o+34&127],e=f[o=o+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=f[o]=r^e,n.i=o,r+(t^t>>>16)|0},r(n,e)}function f(e,r){return r.i=e.i,r.w=e.w,r.X=e.X.slice(),r}function o(e,r){null==e&&(e=+new Date);var n=new t(e),o=r&&r.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},a.int32=n.next,a.quick=a,o&&(o.X&&f(o,n),a.state=function(){return f(n,{})}),a}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xor4096=o}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/xorshift7.js":[function(r,n){!function(e,r,n){function t(e){function r(e,r){var n,t,f=[];if(r===(0|r))t=f[0]=r;else for(r=""+r,n=0;n<r.length;++n)f[7&n]=f[7&n]<<15^r.charCodeAt(n)+f[n+1&7]<<13;for(;f.length<8;)f.push(0);for(n=0;8>n&&0===f[n];++n);for(t=8==n?f[7]=-1:f[n],e.x=f,e.i=0,n=256;n>0;--n)e.next()}var n=this;n.next=function(){var e,r,t=n.x,f=n.i;return e=t[f],e^=e>>>7,r=e^e<<24,e=t[f+1&7],r^=e^e>>>10,e=t[f+3&7],r^=e^e>>>3,e=t[f+4&7],r^=e^e<<7,e=t[f+7&7],e^=e<<13,r^=e^e<<9,t[f]=r,n.i=f+1&7,r},r(n,e)}function f(e,r){return r.x=e.x.slice(),r.i=e.i,r}function o(e,r){null==e&&(e=+new Date);var n=new t(e),o=r&&r.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},a.int32=n.next,a.quick=a,o&&(o.x&&f(o,n),a.state=function(){return f(n,{})}),a}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xorshift7=o}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/lib/xorwow.js":[function(r,n){!function(e,r,n){function t(e){var r=this,n="";r.next=function(){var e=r.x^r.x>>>2;return r.x=r.y,r.y=r.z,r.z=r.w,r.w=r.v,(r.d=r.d+362437|0)+(r.v=r.v^r.v<<4^(e^e<<1))|0},r.x=0,r.y=0,r.z=0,r.w=0,r.v=0,e===(0|e)?r.x=e:n+=e;for(var t=0;t<n.length+64;t++)r.x^=0|n.charCodeAt(t),t==n.length&&(r.d=r.x<<10^r.x>>>4),r.next()}function f(e,r){return r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r.v=e.v,r.d=e.d,r}function o(e,r){var n=new t(e),o=r&&r.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},a.int32=n.next,a.quick=a,o&&("object"==typeof o&&f(o,n),a.state=function(){return f(n,{})}),a}r&&r.exports?r.exports=o:n&&n.amd?n(function(){return o}):this.xorwow=o}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/qrohlf/Code/trianglify/node_modules/seedrandom/seedrandom.js":[function(r,n){!function(t,f){function o(e,r,n){var o=[];r=1==r?{entropy:!0}:r||{};var l=c(u(r.entropy?[e,d(t)]:null==e?s():e,3),o),b=new a(o),p=function(){for(var e=b.g(g),r=y,n=0;v>e;)e=(e+n)*h,r*=h,n=b.g(1);for(;e>=w;)e/=2,r/=2,n>>>=1;return(e+n)/r};return p.int32=function(){return 0|b.g(4)},p.quick=function(){return b.g(4)/4294967296},p.double=p,c(d(b.S),t),(r.pass||n||function(e,r,n,t){return t&&(t.S&&i(t,b),e.state=function(){return i(b,{})}),n?(f[m]=e,r):e})(p,l,"global"in r?r.global:this==f,r.state)}function a(e){var r,n=e.length,t=this,f=0,o=t.i=t.j=0,a=t.S=[];for(n||(e=[n++]);h>f;)a[f]=f++;for(f=0;h>f;f++)a[f]=a[o=x&o+e[f%n]+(r=a[f])],a[o]=r;(t.g=function(e){for(var r,n=0,f=t.i,o=t.j,a=t.S;e--;)r=a[f=x&f+1],n=n*h+a[x&(a[f]=a[o=x&o+r])+(a[o]=r)];return t.i=f,t.j=o,n})(h)}function i(e,r){return r.i=e.i,r.j=e.j,r.S=e.S.slice(),r}function u(e,r){var n,t=[],f=typeof e;if(r&&"object"==f)for(n in e)try{t.push(u(e[n],r-1))}catch(o){}return t.length?t:"string"==f?e:e+"\x00"}function c(e,r){for(var n,t=e+"",f=0;f<t.length;)r[x&f]=x&(n^=19*r[x&f])+t.charCodeAt(f++);return d(r)}function s(){try{if(l)return d(l.randomBytes(h));var e=new Uint8Array(h);return(b.crypto||b.msCrypto).getRandomValues(e),d(e)}catch(r){var n=b.navigator,f=n&&n.plugins;return[+new Date,b,f,b.screen,d(t)]}}function d(e){return String.fromCharCode.apply(0,e)}var l,b=this,h=256,g=6,p=52,m="random",y=f.pow(h,g),v=f.pow(2,p),w=2*v,x=h-1;if(f["seed"+m]=o,c(f.random(),t),"object"==typeof n&&n.exports){n.exports=o;try{l=r("crypto")}catch(_){}}else"function"==typeof e&&e.amd&&e(function(){return o})}([],Math)},{crypto:!1}]},{},["./lib/trianglify.js"])("./lib/trianglify.js")});
|
@@ -0,0 +1,478 @@
|
|
1
|
+
/***
|
2
|
+
the resource to which all the paths will refer.
|
3
|
+
will be the downcased pluralized form
|
4
|
+
eg: users or admins
|
5
|
+
***/
|
6
|
+
var resource = null;
|
7
|
+
|
8
|
+
|
9
|
+
/***
|
10
|
+
the resource singular form
|
11
|
+
eg: user
|
12
|
+
***/
|
13
|
+
var resource_singular = null;
|
14
|
+
|
15
|
+
|
16
|
+
/****
|
17
|
+
looks for a div with the id "sign_out", if its present, then returns true, otherwise false
|
18
|
+
*****/
|
19
|
+
function user_signed_in(){
|
20
|
+
return $("#sign_out").length > 0 ? true : false;
|
21
|
+
}
|
22
|
+
|
23
|
+
/*****
|
24
|
+
sends a get request to the particular controller.
|
25
|
+
|
26
|
+
******/
|
27
|
+
function load_forms(name){
|
28
|
+
if(name === "sign_in_sign_up"){
|
29
|
+
$.get(
|
30
|
+
{url : window.location.origin + "/"+ resource +"/sign_in",
|
31
|
+
success : function( data ) {},
|
32
|
+
dataType : "script"
|
33
|
+
});
|
34
|
+
}
|
35
|
+
else if(name === "forgot_password"){
|
36
|
+
$.get(
|
37
|
+
{url : window.location.origin + "/" + resource + "/password/new",
|
38
|
+
success : function(data){},
|
39
|
+
dataType : "script"});
|
40
|
+
}
|
41
|
+
|
42
|
+
else if(name === "resend_confirmation_email"){
|
43
|
+
$.get(
|
44
|
+
{url : window.location.origin + "/" + resource + "/confirmation/new",
|
45
|
+
success : function(data){},
|
46
|
+
dataType : "script"});
|
47
|
+
}
|
48
|
+
else if(name == "unlock_account"){
|
49
|
+
$.get(
|
50
|
+
{url : window.location.origin + "/" + resource + "/unlock/new",
|
51
|
+
success : function(data){},
|
52
|
+
dataType : "script"});
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
function open_sign_in_modal_if_closed(){
|
58
|
+
|
59
|
+
if($('#sign_in_needed_modal').is(':visible')){
|
60
|
+
|
61
|
+
}
|
62
|
+
else{
|
63
|
+
$("#sign_in_needed_modal").openModal({});
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
/****
|
68
|
+
callback used to target events that need to be protected by sign in.
|
69
|
+
****/
|
70
|
+
function sign_in_required(event){
|
71
|
+
if(user_signed_in()){
|
72
|
+
//console.log("user signed in");
|
73
|
+
return false;
|
74
|
+
}
|
75
|
+
else{
|
76
|
+
//console.log("user not signed in");
|
77
|
+
if(!!event){
|
78
|
+
//console.log("stopping propagation");
|
79
|
+
event.preventDefault();
|
80
|
+
event.stopPropagation();
|
81
|
+
event.stopImmediatePropagation();
|
82
|
+
}
|
83
|
+
load_forms("sign_in_sign_up");
|
84
|
+
return true;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
var set_sign_in_modal = function(){
|
89
|
+
//on clearing the
|
90
|
+
$("#sign_in_needed_modal").leanModal({
|
91
|
+
dismissible: true,
|
92
|
+
opacity: .5,
|
93
|
+
in_duration: 300,
|
94
|
+
out_duration: 200,
|
95
|
+
after_close: function(options){
|
96
|
+
|
97
|
+
}
|
98
|
+
});
|
99
|
+
|
100
|
+
}
|
101
|
+
|
102
|
+
//NAV OPTIONS.
|
103
|
+
|
104
|
+
/***
|
105
|
+
basically the following block handles making the ajax request and
|
106
|
+
then loading the form for
|
107
|
+
sign_up
|
108
|
+
sign_in
|
109
|
+
forgot_password
|
110
|
+
unlock_account
|
111
|
+
resend_confirmation_email.
|
112
|
+
basically they all make calls to load_forms, which does the ajax call
|
113
|
+
|
114
|
+
***/
|
115
|
+
$(document).on('click','#show_sign_up',function(event){
|
116
|
+
var current_screen = get_current_screen();
|
117
|
+
if(current_screen === "Forgot Password" || current_screen === "Resend Confirmation Email"){
|
118
|
+
load_forms("sign_in_sign_up");
|
119
|
+
}
|
120
|
+
else if(current_screen === "Sign In" || current_screen === "Sign Up"){
|
121
|
+
toggle_sign_in_sign_up();
|
122
|
+
}
|
123
|
+
});
|
124
|
+
|
125
|
+
$(document).on('click','#forgot_password',function(event){
|
126
|
+
load_forms("forgot_password");
|
127
|
+
});
|
128
|
+
|
129
|
+
$(document).on("click","#unlock_account",function(event){
|
130
|
+
load_forms("unlock_account");
|
131
|
+
})
|
132
|
+
|
133
|
+
$(document).on('click','#resend_confirmation_email',function(event){
|
134
|
+
load_forms("resend_confirmation_email");
|
135
|
+
});
|
136
|
+
|
137
|
+
/***
|
138
|
+
for the update form, where we give them an option to directly resend the unconfirmed email.
|
139
|
+
suppose that it could not be found then what happens.
|
140
|
+
***/
|
141
|
+
$(document).on('click','.resend_confirmation_email',function(event){
|
142
|
+
//this element should have the data-attribute called unconfirmed email already set on it., and ajax request has to be made POST, to the confirmations path, using that email, and the correct resource_param name.
|
143
|
+
var unconfirmed_email = $("#" + resource_singular + "_unconfirmed_email").attr("data-unconfirmed-email");
|
144
|
+
var param = resource_singular + "[email]";
|
145
|
+
var data_h = {};
|
146
|
+
data_h[param] = unconfirmed_email;
|
147
|
+
$.get(
|
148
|
+
{url : window.location.origin + "/"+ resource +"/confirmation",
|
149
|
+
data : data_h,
|
150
|
+
success : function( data ) {},
|
151
|
+
dataType : "script",
|
152
|
+
method : "POST"
|
153
|
+
}
|
154
|
+
);
|
155
|
+
});
|
156
|
+
|
157
|
+
/***
|
158
|
+
for the update form, the part where we give the option to directly resend the additional_login_param confirmation should be done in the daughter app,see dummy/app/assets/application.js
|
159
|
+
***/
|
160
|
+
|
161
|
+
/****
|
162
|
+
show or hide the oauth icons and
|
163
|
+
****/
|
164
|
+
var toggle_oauth = function(){
|
165
|
+
$('#oauth_icons').toggle();
|
166
|
+
$("#submit").toggleClass("l6 m6 s6 p-0-left p-0-right").toggleClass("l12 m12 s12 center");
|
167
|
+
$("#submit_icon").toggleClass("right");
|
168
|
+
}
|
169
|
+
|
170
|
+
var hide_oauth = function(){
|
171
|
+
$('#oauth_icons').hide();
|
172
|
+
$('#submit').removeClass("l6 m6 s6 p-0-left p-0-right").addClass("l12 m12 s12 center");
|
173
|
+
$('#submit_icon').removeClass('right');
|
174
|
+
}
|
175
|
+
|
176
|
+
var show_oauth = function(){
|
177
|
+
$('#oauth_icons').show();
|
178
|
+
$('#submit').addClass("l6 m6 s6 p-0-left p-0-right").removeClass("l12 m12 s12 center");
|
179
|
+
$('#submit_icon').addClass('right');
|
180
|
+
}
|
181
|
+
|
182
|
+
/***
|
183
|
+
This changes the text in the navigation options
|
184
|
+
below the form.
|
185
|
+
It will by default make the text "Dont have an Account...."
|
186
|
+
otherwise, it will make the text whatever is in new_text.
|
187
|
+
***/
|
188
|
+
var toggle_sign_up_text = function(new_text){
|
189
|
+
var sign_up_text = $("#show_sign_up").text();
|
190
|
+
if(new_text != null){
|
191
|
+
$("#show_sign_up").text(new_text);
|
192
|
+
return;
|
193
|
+
}
|
194
|
+
$("#show_sign_up").text(sign_up_text == "Don't have an Account? Sign Up For Free" ? "Already Have An Account? Sign In" : "Don't have an Account? Sign Up For Free");
|
195
|
+
}
|
196
|
+
|
197
|
+
/***
|
198
|
+
***/
|
199
|
+
var toggle_sign_in_sign_up = function(){
|
200
|
+
$('#sign_up_inputs').toggle();
|
201
|
+
$('#sign_up_inputs').toggleClass('m-20-bottom');
|
202
|
+
var login_title_text = $('#login_title').text();
|
203
|
+
$('#login_title').text(
|
204
|
+
login_title_text == "Sign In" ? "Sign Up" : "Sign In");
|
205
|
+
toggle_oauth();
|
206
|
+
toggle_sign_up_validation($('#login_title').text());
|
207
|
+
toggle_sign_up_text();
|
208
|
+
}
|
209
|
+
|
210
|
+
var credential_exists = function(def,e,field_id){
|
211
|
+
var res = {
|
212
|
+
"url": "/profiles/credential_exists",
|
213
|
+
"dataType":"json",
|
214
|
+
"data":{
|
215
|
+
"credential":{
|
216
|
+
"resource":resource,
|
217
|
+
"email":$("#" + field_id).val()
|
218
|
+
}
|
219
|
+
}
|
220
|
+
}
|
221
|
+
return res;
|
222
|
+
}
|
223
|
+
|
224
|
+
var toggle_sign_up_validation = function(login_text){
|
225
|
+
if(login_text == "Sign In"){
|
226
|
+
//function should be defined in the daughter app
|
227
|
+
//it is currently defined in dummy/app/assets/javascripts/application.js
|
228
|
+
validator.args = validation_toggle_on_sign_in();
|
229
|
+
validator.register_handlers();
|
230
|
+
}
|
231
|
+
else
|
232
|
+
{
|
233
|
+
validator.args = validation_toggle_on_sign_up();
|
234
|
+
validator.register_handlers();
|
235
|
+
}
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
/****
|
240
|
+
if the sign in modal is open, then this returns the text in the
|
241
|
+
login_title div.
|
242
|
+
if the sign in modal is not open, then this will return
|
243
|
+
****/
|
244
|
+
var get_current_screen = function(){
|
245
|
+
//if the modal is open then
|
246
|
+
if($('#sign_in_needed_modal').is(':visible')){
|
247
|
+
return $('#login_title').text();
|
248
|
+
}
|
249
|
+
else{
|
250
|
+
return $("#page_title").text();
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
/****
|
255
|
+
provide the input id without the hash.
|
256
|
+
****/
|
257
|
+
var invalidate_input_field = function(input_id,error_message,add_error_message){
|
258
|
+
|
259
|
+
add_error_message = add_error_message || true;
|
260
|
+
var input = $("#" + input_id);
|
261
|
+
var label = $('label[for="'+ input_id +'"]');
|
262
|
+
input.attr("class","invalid");
|
263
|
+
input.attr("aria-invalid",true);
|
264
|
+
if(add_error_message){
|
265
|
+
if($(label).length > 0){
|
266
|
+
label.attr("data-error",error_message);
|
267
|
+
}
|
268
|
+
else{
|
269
|
+
show_modal_error_message(error_message);
|
270
|
+
}
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
/*****
|
275
|
+
focus on the first invalid field.
|
276
|
+
@args:
|
277
|
+
resource : resource.
|
278
|
+
*****/
|
279
|
+
var focus_first_invalid_field = function(resource){
|
280
|
+
|
281
|
+
}
|
282
|
+
|
283
|
+
/***
|
284
|
+
provide the input id without the hash.
|
285
|
+
***/
|
286
|
+
var make_input_field_valid = function(input_id){
|
287
|
+
//provided that the field is not empty.
|
288
|
+
if($("#" + input_id).val()){
|
289
|
+
$("#" + input_id).removeClass("invalid").addClass("valid");
|
290
|
+
$("#" + input_id).attr("aria-invalid",false);
|
291
|
+
$('label[for="' + input_id + '"]').removeClass("invalid").addClass("valid");
|
292
|
+
//remove the aria invalid from the label.
|
293
|
+
$('label[for="' + input_id + '"]').attr('aria-invalid',false);
|
294
|
+
//remove the data-error attribute.
|
295
|
+
$('label[for="' + input_id + '"]').removeAttr('data-error');
|
296
|
+
}
|
297
|
+
}
|
298
|
+
|
299
|
+
var mark_all_input_fields_valid = function(){
|
300
|
+
yield_input_fields(function(field_name,field_jq_obj){
|
301
|
+
make_input_field_valid(field_jq_obj.attr("id"));
|
302
|
+
});
|
303
|
+
}
|
304
|
+
|
305
|
+
/***
|
306
|
+
yields all the input fields of the form to a function called operation.
|
307
|
+
operation should accept two arguments(field_name, and a jquery object representing the input field)
|
308
|
+
***/
|
309
|
+
var yield_input_fields = function(operation){
|
310
|
+
$("#login_form").find("input").each(function(index){
|
311
|
+
|
312
|
+
if($(this).attr("id") != null && $(this).attr("id").indexOf("_") != -1){
|
313
|
+
|
314
|
+
var field_name = ($(this).attr("id").split("_")).pop().toLowerCase();
|
315
|
+
|
316
|
+
operation(field_name,$(this));
|
317
|
+
}
|
318
|
+
});
|
319
|
+
}
|
320
|
+
|
321
|
+
/***
|
322
|
+
here first we make each field valid, and then only invalidate the ones whose names are mentioned in the error message.
|
323
|
+
***/
|
324
|
+
var mark_invalid_fields_on_sign_in_failure = function(error){
|
325
|
+
yield_input_fields(function(field_name,field_jq_obj){
|
326
|
+
make_input_field_valid(field_jq_obj.attr("id"));
|
327
|
+
if(error.toLowerCase().indexOf(field_name) != -1){
|
328
|
+
//invalidate it, show the error in the error notification box.
|
329
|
+
invalidate_input_field(field_jq_obj.attr("id"),null,false);
|
330
|
+
}
|
331
|
+
});
|
332
|
+
|
333
|
+
}
|
334
|
+
|
335
|
+
/***
|
336
|
+
clears the input field value and makes it and its label neither valid nor
|
337
|
+
invalid.
|
338
|
+
***/
|
339
|
+
var normalize_input_field = function(input_id){
|
340
|
+
//if the error is with the email, clear the password
|
341
|
+
$("#" + input_id).val('');
|
342
|
+
//remove its class as being either valid or invalid
|
343
|
+
$('label[for="' + input_id + '"]').removeClass("valid invalid");
|
344
|
+
//its aria-invalid, should be false.
|
345
|
+
$('label[for="' + input_id + '"]').attr('aria-invalid',false);
|
346
|
+
//remove the data-error.
|
347
|
+
$('label[for="' + input_id + '"]').removeAttr('data-error');
|
348
|
+
}
|
349
|
+
|
350
|
+
|
351
|
+
function tryParseJSON (jsonString){
|
352
|
+
try {
|
353
|
+
var o = JSON.parse(jsonString);
|
354
|
+
|
355
|
+
// Handle non-exception-throwing cases:
|
356
|
+
// Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking,
|
357
|
+
// but... JSON.parse(null) returns null, and typeof null === "object",
|
358
|
+
// so we must check for that, too. Thankfully, null is falsey, so this suffices:
|
359
|
+
if (o && typeof o === "object") {
|
360
|
+
return o;
|
361
|
+
}
|
362
|
+
}
|
363
|
+
catch (e) { }
|
364
|
+
|
365
|
+
return false;
|
366
|
+
};
|
367
|
+
|
368
|
+
/****
|
369
|
+
show generic error message.
|
370
|
+
leanmodal modification has been modified to clear any error message when
|
371
|
+
the modal is closed
|
372
|
+
refer to leanModal_modification.js
|
373
|
+
****/
|
374
|
+
var show_modal_error_message = function(error_message){
|
375
|
+
//console.log("came to show modal error message");
|
376
|
+
if(!error_message){
|
377
|
+
error_message = "Your request didn't go through, try again in some time.";
|
378
|
+
}
|
379
|
+
//open the error notification modal if no modal is open
|
380
|
+
if($(".modal:visible").length == 0){
|
381
|
+
toggle_ajax_error_modal();
|
382
|
+
}
|
383
|
+
$(".modal:visible").find(".error_notification").show();
|
384
|
+
//check if the error message is valid json and if yes, then
|
385
|
+
//does it have an errors key
|
386
|
+
//if yes, show that as the error.
|
387
|
+
var json = tryParseJSON(error_message);
|
388
|
+
if(json && json["errors"]){
|
389
|
+
error_message = json["errors"][0];
|
390
|
+
}
|
391
|
+
$(".modal:visible").find(".error_message").html(error_message);
|
392
|
+
}
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
/***
|
397
|
+
all the forms in the auth/modals partials have a submit button incorporated normally in them with the id: #login_submit.
|
398
|
+
however this is hidden by display_none.
|
399
|
+
Instead the button that is shown has an id of #submit.
|
400
|
+
So on clicking that we change the action of the form depending on which form is currently being show.(by get_current_screen())
|
401
|
+
then I trigger a click on ("login_submit")
|
402
|
+
and that automatically triggers the form_submit.
|
403
|
+
***/
|
404
|
+
$(document).on('click','#submit',function(event){
|
405
|
+
//if the login text is "Sign_up, then submit the sign_up form"
|
406
|
+
//if the login text is "Sign In", then submit the sign_in form"
|
407
|
+
var login_type = get_current_screen();
|
408
|
+
|
409
|
+
if(login_type == "Sign In"){
|
410
|
+
//the url should be
|
411
|
+
$("#login_form").attr("action","/" + resource + "/sign_in");
|
412
|
+
$("#login_submit").val("Log In");
|
413
|
+
event.preventDefault();
|
414
|
+
event.stopPropagation();
|
415
|
+
$("#login_submit").trigger("click");
|
416
|
+
return false;
|
417
|
+
}
|
418
|
+
else if(login_type == "Forgot Password"){
|
419
|
+
// the name of the form submitted is login_form_password
|
420
|
+
// the submit button inside it is still having an id of login_submit.
|
421
|
+
// we had to change the id of the form, cuz otherwise it does not trigger remote submit.
|
422
|
+
// since the earlier login_form was present on the page.
|
423
|
+
event.preventDefault();
|
424
|
+
event.stopPropagation();
|
425
|
+
$("#login_submit").trigger("click");
|
426
|
+
return false;
|
427
|
+
}
|
428
|
+
else if(login_type == "Resend Confirmation Email"){
|
429
|
+
$("#login_form").attr("action","/" + resource + "/confirmation");
|
430
|
+
$("#login_submit").val("Resend confirmation instructions");
|
431
|
+
event.preventDefault();
|
432
|
+
event.stopPropagation();
|
433
|
+
$("#login_submit").trigger("click");
|
434
|
+
return false;
|
435
|
+
}
|
436
|
+
else if(login_type == "Sign Up"){
|
437
|
+
$("#login_form").attr("action","/" + resource);
|
438
|
+
$("#login_submit").val("Sign Up");
|
439
|
+
event.preventDefault();
|
440
|
+
event.stopPropagation();
|
441
|
+
$("#login_submit").trigger("click");
|
442
|
+
return false;
|
443
|
+
}
|
444
|
+
else if(login_type == "Edit Account Settings"){
|
445
|
+
console.log("detected the login type correctly");
|
446
|
+
$("#login_form").attr("action","/" + resource);
|
447
|
+
$("#login_submit").val("Update");
|
448
|
+
event.preventDefault();
|
449
|
+
event.stopPropagation();
|
450
|
+
$("#login_submit").trigger("click");
|
451
|
+
return false;
|
452
|
+
}
|
453
|
+
else if(login_type == "Unlock Your Account"){
|
454
|
+
$("#login_form").attr("action","/" + resource);
|
455
|
+
$("#login_submit").val("Update");
|
456
|
+
event.preventDefault();
|
457
|
+
event.stopPropagation();
|
458
|
+
$("#login_submit").trigger("click");
|
459
|
+
return false;
|
460
|
+
}
|
461
|
+
});
|
462
|
+
|
463
|
+
/***
|
464
|
+
on clicking the 'sign_in' option in the nav bar.
|
465
|
+
***/
|
466
|
+
$(document).on('click','.sign_in_nav_option,.profile_nav_option,.sign_in',function(event){
|
467
|
+
resource = $(event.target).parent().attr("data-resource");
|
468
|
+
resource_singular = $(event.target).parent().attr("data-resource-singular");
|
469
|
+
console.log("assigned resource as:" + resource);
|
470
|
+
sign_in_required(event);
|
471
|
+
});
|
472
|
+
|
473
|
+
|
474
|
+
$(document).ready(set_sign_in_modal);
|
475
|
+
$(document).on('page:load', set_sign_in_modal);
|
476
|
+
|
477
|
+
|
478
|
+
|