diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index e9642de..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,63 +0,0 @@ -# Contributing - -The SheetJS Libraries should be free and clear to use in your projects. In -order to maintain that, every contributor must be vigilant. - -There have been many projects in the past that have been very lax regarding -licensing, and we are of the opinion that those are ticking timebombs and that -no commercial product should depend on them. - - -# Required Reading - -These are pretty short reads and emphasize the importance of proper licensing: - -- https://github.com/kennethreitz/tablib/issues/114 (discussion of other tools) - -- http://www.codinghorror.com/blog/2007/04/pick-a-license-any-license.html - - -# Raising Issues - -Issues should generally be accompanied by test files. Since github does not -support attachments, the best method is to send files to -(subject line should contain issue number or message) or to share using some -storage service. Unless expressly permitted, any attachments will not be -shared or included in a test suite (although I will ask :) - -If sending email to a gmail account is problematic, the email -inbox is self-hosted. - -# Pre-Contribution Checklist - -Before thinking about contributing, make sure that: - -- You are not, nor have ever been, an employee of Microsoft Corporation. - -- You have not signed any NDAs or Shared Source Agreements with Microsoft - Corporation or a subsidiary - -- You have not consulted any existing relevant codebase (if you have, please - take note of which codebases were consulted). - -If you cannot attest to each of these items, the best approach is to raise an -issue. If it is a particularly high-priority issue, please drop an email to - and it will be prioritized. - - -# Intra-Contribution - -Keep these in mind as you work: - -- Your contributions are your original work. Take note of any resources you - consult in the process (and be extra careful not to use unlicensed code on - the internet. - -- You are working on your own time. Unless they explicitly grant permission, - your employer may be the ultimate owner of your IP - -# Post-Contribution - -Before contributions are merged, you will receive an email (at the address -associated with the git commit) and will be asked to confirm the aforementioned -items. Ensure that the email addresses associated with the commits is valid. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f769c2c..0000000 --- a/LICENSE +++ /dev/null @@ -1,17 +0,0 @@ -Copyright (C) 2012-2015 SheetJS - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -Except where noted, this license applies to any and all software programs and associated documentation files created by the Original Author and distributed with the Software: - -'jszip.js' is a modified version of JSZip, Copyright (c) Stuart Knightley, David Duponchel, Franz Buchinger, Ant'onio Afonso. JSZip is dual licensed and is used according to the terms of the MIT License. diff --git a/MENU11-18.xlsx b/MENU11-18.xlsx deleted file mode 100644 index c083f6c..0000000 Binary files a/MENU11-18.xlsx and /dev/null differ diff --git a/Menu 12th sept 17th sept.xlsx b/Menu 12th sept 17th sept.xlsx deleted file mode 100644 index ad2a7d4..0000000 Binary files a/Menu 12th sept 17th sept.xlsx and /dev/null differ diff --git a/README.md b/README.md index 5881d55..8846805 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ -# snumess_foodapp -Backend portal for uploading the excel file and parsing it into JSON +# Excel2JSON +A simple portal to upload an Excel .xlsx or .xls file and convert them to JSON format. Good for use with android platform. + +# COntributing +All pull requests are humbly welcome. diff --git a/css/reset.css b/css/reset.css deleted file mode 100644 index af94440..0000000 --- a/css/reset.css +++ /dev/null @@ -1,48 +0,0 @@ -/* http://meyerweb.com/eric/tools/css/reset/ - v2.0 | 20110126 - License: none (public domain) -*/ - -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, canvas, details, embed, -figure, figcaption, footer, header, hgroup, -menu, nav, output, ruby, section, summary, -time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} -/* HTML5 display-role reset for older browsers */ -article, aside, details, figcaption, figure, -footer, header, hgroup, menu, nav, section { - display: block; -} -body { - line-height: 1; -} -ol, ul { - list-style: none; -} -blockquote, q { - quotes: none; -} -blockquote:before, blockquote:after, -q:before, q:after { - content: ''; - content: none; -} -table { - border-collapse: collapse; - border-spacing: 0; -} \ No newline at end of file diff --git a/css/style.css b/css/style.css deleted file mode 100644 index 6b16699..0000000 --- a/css/style.css +++ /dev/null @@ -1,490 +0,0 @@ -/* -------------------------------- - -Primary style - --------------------------------- */ -html * { - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -*, *:after, *:before { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -body { - font-size: 100%; - font-family: "PT Sans", sans-serif; - color: #505260; - background-color: white; -} - -a { - color: #2f889a; - text-decoration: none; -} - -img { - max-width: 100%; -} - -input, textarea { - font-family: "PT Sans", sans-serif; - font-size: 16px; - font-size: 1rem; -} -input::-ms-clear, textarea::-ms-clear { - display: none; -} - -/* -------------------------------- - -Main components - --------------------------------- */ -header[role=banner] { - position: relative; - height: 50px; - background: #343642; -} -header[role=banner] #cd-logo { - float: left; - margin: 4px 0 0 5%; - /* reduce logo size on mobile and make sure it is left aligned with the transform-origin property */ - -webkit-transform-origin: 0 50%; - -moz-transform-origin: 0 50%; - -ms-transform-origin: 0 50%; - -o-transform-origin: 0 50%; - transform-origin: 0 50%; - -webkit-transform: scale(0.8); - -moz-transform: scale(0.8); - -ms-transform: scale(0.8); - -o-transform: scale(0.8); - transform: scale(0.8); -} -header[role=banner] #cd-logo img { - display: block; -} -header[role=banner]::after { - /* clearfix */ - content: ''; - display: table; - clear: both; -} -@media only screen and (min-width: 768px) { - header[role=banner] { - height: 80px; - } - header[role=banner] #cd-logo { - margin: 20px 0 0 5%; - -webkit-transform: scale(1); - -moz-transform: scale(1); - -ms-transform: scale(1); - -o-transform: scale(1); - transform: scale(1); - } -} - -.main-nav { - float: right; - margin-right: 5%; - width: 44px; - height: 100%; - background: url("../img/cd-icon-menu.svg") no-repeat center center; - cursor: pointer; -} -.main-nav ul { - position: absolute; - top: 0; - left: 0; - width: 100%; - -webkit-transform: translateY(-100%); - -moz-transform: translateY(-100%); - -ms-transform: translateY(-100%); - -o-transform: translateY(-100%); - transform: translateY(-100%); -} -.main-nav ul.is-visible { - -webkit-transform: translateY(50px); - -moz-transform: translateY(50px); - -ms-transform: translateY(50px); - -o-transform: translateY(50px); - transform: translateY(50px); -} -.main-nav a { - display: block; - height: 50px; - line-height: 50px; - padding-left: 5%; - background: #292a34; - border-top: 1px solid #3b3d4b; - color: #FFF; -} -@media only screen and (min-width: 768px) { - .main-nav { - width: auto; - height: auto; - background: none; - cursor: auto; - } - .main-nav ul { - position: static; - width: auto; - -webkit-transform: translateY(0); - -moz-transform: translateY(0); - -ms-transform: translateY(0); - -o-transform: translateY(0); - transform: translateY(0); - line-height: 80px; - } - .main-nav ul.is-visible { - -webkit-transform: translateY(0); - -moz-transform: translateY(0); - -ms-transform: translateY(0); - -o-transform: translateY(0); - transform: translateY(0); - } - .main-nav li { - display: inline-block; - margin-left: 1em; - } - .main-nav li:nth-last-child(2) { - margin-left: 2em; - } - .main-nav a { - display: inline-block; - height: auto; - line-height: normal; - background: transparent; - } - .main-nav a.cd-signin, .main-nav a.cd-signup { - padding: .6em 1em; - border: 1px solid rgba(255, 255, 255, 0.6); - border-radius: 50em; - } - .main-nav a.cd-signup { - background: #2f889a; - border: none; - } -} - -/* -------------------------------- - -xsigin/signup popup - --------------------------------- */ -.cd-user-modal { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: rgba(52, 54, 66, 0.9); - z-index: 3; - overflow-y: auto; - cursor: pointer; - visibility: hidden; - opacity: 0; - -webkit-transition: opacity 0.3s, visibility 0.3s; - -moz-transition: opacity 0.3s, visibility 0.3s; - transition: opacity 0.3s, visibility 0.3s; -} -.cd-user-modal.is-visible { - visibility: visible; - opacity: 1; -} -.cd-user-modal.is-visible .cd-user-modal-container { - -webkit-transform: translateY(0); - -moz-transform: translateY(0); - -ms-transform: translateY(0); - -o-transform: translateY(0); - transform: translateY(0); -} - -.cd-user-modal-container { - position: relative; - width: 90%; - max-width: 600px; - background: #FFF; - margin: 3em auto 4em; - cursor: auto; - border-radius: 0.25em; - -webkit-transform: translateY(-30px); - -moz-transform: translateY(-30px); - -ms-transform: translateY(-30px); - -o-transform: translateY(-30px); - transform: translateY(-30px); - -webkit-transition-property: -webkit-transform; - -moz-transition-property: -moz-transform; - transition-property: transform; - -webkit-transition-duration: 0.3s; - -moz-transition-duration: 0.3s; - transition-duration: 0.3s; -} -.cd-user-modal-container .cd-switcher:after { - content: ""; - display: table; - clear: both; -} -.cd-user-modal-container .cd-switcher li { - width: 50%; - float: left; - text-align: center; -} -.cd-user-modal-container .cd-switcher li:first-child a { - border-radius: .25em 0 0 0; -} -.cd-user-modal-container .cd-switcher li:last-child a { - border-radius: 0 .25em 0 0; -} -.cd-user-modal-container .cd-switcher a { - display: block; - width: 100%; - height: 50px; - line-height: 50px; - background: #d2d8d8; - color: #809191; -} -.cd-user-modal-container .cd-switcher a.selected { - background: #FFF; - color: #505260; -} -@media only screen and (min-width: 600px) { - .cd-user-modal-container { - margin: 4em auto; - } - .cd-user-modal-container .cd-switcher a { - height: 70px; - line-height: 70px; - } -} - -.cd-form { - padding: 1.4em; -} -.cd-form .fieldset { - position: relative; - margin: 1.4em 0; -} -.cd-form .fieldset:first-child { - margin-top: 0; -} -.cd-form .fieldset:last-child { - margin-bottom: 0; -} -.cd-form label { - font-size: 14px; - font-size: 0.875rem; -} -.cd-form label.image-replace { - /* replace text with an icon */ - display: inline-block; - position: absolute; - left: 15px; - top: 50%; - bottom: auto; - -webkit-transform: translateY(-50%); - -moz-transform: translateY(-50%); - -ms-transform: translateY(-50%); - -o-transform: translateY(-50%); - transform: translateY(-50%); - height: 20px; - width: 20px; - overflow: hidden; - text-indent: 100%; - white-space: nowrap; - color: transparent; - text-shadow: none; - background-repeat: no-repeat; - background-position: 50% 0; -} -.cd-form label.cd-username { - background-image: url("../img/cd-icon-username.svg"); -} -.cd-form label.cd-email { - background-image: url("../img/cd-icon-email.svg"); -} -.cd-form label.cd-password { - background-image: url("../img/cd-icon-password.svg"); -} -.cd-form input { - margin: 0; - padding: 0; - border-radius: 0.25em; -} -.cd-form input.full-width { - width: 100%; -} -.cd-form input.has-padding { - padding: 12px 20px 12px 50px; -} -.cd-form input.has-border { - border: 1px solid #d2d8d8; - -webkit-appearance: none; - -moz-appearance: none; - -ms-appearance: none; - -o-appearance: none; - appearance: none; -} -.cd-form input.has-border:focus { - border-color: #343642; - box-shadow: 0 0 5px rgba(52, 54, 66, 0.1); - outline: none; -} -.cd-form input.has-error { - border: 1px solid #d76666; -} -.cd-form input[type=password] { - /* space left for the HIDE button */ - padding-right: 65px; -} -.cd-form input[type=submit] { - padding: 16px 0; - cursor: pointer; - background: #2f889a; - color: #FFF; - font-weight: bold; - border: none; - -webkit-appearance: none; - -moz-appearance: none; - -ms-appearance: none; - -o-appearance: none; - appearance: none; -} -.no-touch .cd-form input[type=submit]:hover, .no-touch .cd-form input[type=submit]:focus { - background: #3599ae; - outline: none; -} -.cd-form .hide-password { - display: inline-block; - position: absolute; - right: 0; - top: 0; - padding: 6px 15px; - border-left: 1px solid #d2d8d8; - top: 50%; - bottom: auto; - -webkit-transform: translateY(-50%); - -moz-transform: translateY(-50%); - -ms-transform: translateY(-50%); - -o-transform: translateY(-50%); - transform: translateY(-50%); - font-size: 14px; - font-size: 0.875rem; - color: #343642; -} -.cd-form .cd-error-message { - display: inline-block; - position: absolute; - left: -5px; - bottom: -35px; - background: rgba(215, 102, 102, 0.9); - padding: .8em; - z-index: 2; - color: #FFF; - font-size: 13px; - font-size: 0.8125rem; - border-radius: 0.25em; - /* prevent click and touch events */ - pointer-events: none; - visibility: hidden; - opacity: 0; - -webkit-transition: opacity 0.2s 0, visibility 0 0.2s; - -moz-transition: opacity 0.2s 0, visibility 0 0.2s; - transition: opacity 0.2s 0, visibility 0 0.2s; -} -.cd-form .cd-error-message::after { - /* triangle */ - content: ''; - position: absolute; - left: 22px; - bottom: 100%; - height: 0; - width: 0; - border-left: 8px solid transparent; - border-right: 8px solid transparent; - border-bottom: 8px solid rgba(215, 102, 102, 0.9); -} -.cd-form .cd-error-message.is-visible { - opacity: 1; - visibility: visible; - -webkit-transition: opacity 0.2s 0, visibility 0 0; - -moz-transition: opacity 0.2s 0, visibility 0 0; - transition: opacity 0.2s 0, visibility 0 0; -} -@media only screen and (min-width: 600px) { - .cd-form { - padding: 2em; - } - .cd-form .fieldset { - margin: 2em 0; - } - .cd-form .fieldset:first-child { - margin-top: 0; - } - .cd-form .fieldset:last-child { - margin-bottom: 0; - } - .cd-form input.has-padding { - padding: 16px 20px 16px 50px; - } - .cd-form input[type=submit] { - padding: 16px 0; - } -} - -.cd-form-message { - padding: 1.4em 1.4em 0; - font-size: 14px; - font-size: 0.875rem; - line-height: 1.4; - text-align: center; -} -@media only screen and (min-width: 600px) { - .cd-form-message { - padding: 2em 2em 0; - } -} - -.cd-form-bottom-message { - position: absolute; - width: 100%; - left: 0; - bottom: -30px; - text-align: center; - font-size: 14px; - font-size: 0.875rem; -} -.cd-form-bottom-message a { - color: #FFF; - text-decoration: underline; -} - -.cd-close-form { - /* form X button on top right */ - display: block; - position: absolute; - width: 40px; - height: 40px; - right: 0; - top: -40px; - background: url("../img/cd-icon-close.svg") no-repeat center center; - text-indent: 100%; - white-space: nowrap; - overflow: hidden; -} -@media only screen and (min-width: 1170px) { - .cd-close-form { - display: none; - } -} - -#cd-login, #cd-signup, #cd-reset-password { - display: none; -} - -#cd-login.is-selected, #cd-signup.is-selected, #cd-reset-password.is-selected { - display: block; -} diff --git a/img/cd-icon-close.svg b/img/cd-icon-close.svg deleted file mode 100644 index 40a8b32..0000000 --- a/img/cd-icon-close.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - diff --git a/img/cd-icon-email.svg b/img/cd-icon-email.svg deleted file mode 100644 index 6fb38fe..0000000 --- a/img/cd-icon-email.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/img/cd-icon-menu.svg b/img/cd-icon-menu.svg deleted file mode 100644 index 242ab88..0000000 --- a/img/cd-icon-menu.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - diff --git a/img/cd-icon-password.svg b/img/cd-icon-password.svg deleted file mode 100644 index b26fcf1..0000000 --- a/img/cd-icon-password.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - diff --git a/img/cd-icon-username.svg b/img/cd-icon-username.svg deleted file mode 100644 index 6ef699d..0000000 --- a/img/cd-icon-username.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/img/cd-logo.svg b/img/cd-logo.svg deleted file mode 100644 index 4f511c1..0000000 --- a/img/cd-logo.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/index.html b/index.html deleted file mode 100644 index 6e6f324..0000000 --- a/index.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - Shiv Nadar University | Mess Menu Uploader - - -
- - - -
- -
-
- - -
-
-

- - - You seem not to be a valid user of this system -

- -

- - - Show - Incorrect or Bad credentials -

- -

- - -

- -

- -

-
- -

Forgot your password?

- -
- - - - -
-

Lost your password? Please enter your email address. You will receive a link to create a new password.

- -
-

- - - Error message here! -

- -

- -

-
- -

Back to log-in

-
- Close -
-
- - - - diff --git a/js/.DS_Store b/js/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/js/.DS_Store and /dev/null differ diff --git a/js/main.js b/js/main.js deleted file mode 100644 index a28eea8..0000000 --- a/js/main.js +++ /dev/null @@ -1,146 +0,0 @@ -jQuery(document).ready(function($){ - var formModal = $('.cd-user-modal'), - formLogin = formModal.find('#cd-login'), - formSignup = formModal.find('#cd-signup'), - formForgotPassword = formModal.find('#cd-reset-password'), - formModalTab = $('.cd-switcher'), - tabLogin = formModalTab.children('li').eq(0).children('a'), - tabSignup = formModalTab.children('li').eq(1).children('a'), - forgotPasswordLink = formLogin.find('.cd-form-bottom-message a'), - backToLoginLink = formForgotPassword.find('.cd-form-bottom-message a'), - mainNav = $('.main-nav'); - - //open modal - mainNav.on('click', function(event){ - $(event.target).is(mainNav) && mainNav.children('ul').toggleClass('is-visible'); - }); - - //open sign-up form - mainNav.on('click', '.cd-signup', signup_selected); - //open login-form form - mainNav.on('click', '.cd-signin', login_selected); - - //close modal - formModal.on('click', function(event){ - if( $(event.target).is(formModal) || $(event.target).is('.cd-close-form') ) { - formModal.removeClass('is-visible'); - } - }); - //close modal when clicking the esc keyboard button - $(document).keyup(function(event){ - if(event.which=='27'){ - formModal.removeClass('is-visible'); - } - }); - - //switch from a tab to another - formModalTab.on('click', function(event) { - event.preventDefault(); - ( $(event.target).is( tabLogin ) ) ? login_selected() : signup_selected(); - }); - - //hide or show password - $('.hide-password').on('click', function(){ - var togglePass= $(this), - passwordField = togglePass.prev('input'); - - ( 'password' == passwordField.attr('type') ) ? passwordField.attr('type', 'text') : passwordField.attr('type', 'password'); - ( 'Hide' == togglePass.text() ) ? togglePass.text('Show') : togglePass.text('Hide'); - //focus and move cursor to the end of input field - passwordField.putCursorAtEnd(); - }); - - //show forgot-password form - forgotPasswordLink.on('click', function(event){ - event.preventDefault(); - forgot_password_selected(); - }); - - //back to login from the forgot-password form - backToLoginLink.on('click', function(event){ - event.preventDefault(); - login_selected(); - }); - - function login_selected(){ - mainNav.children('ul').removeClass('is-visible'); - formModal.addClass('is-visible'); - formLogin.addClass('is-selected'); - formSignup.removeClass('is-selected'); - formForgotPassword.removeClass('is-selected'); - tabLogin.addClass('selected'); - tabSignup.removeClass('selected'); - } - - function signup_selected(){ - mainNav.children('ul').removeClass('is-visible'); - formModal.addClass('is-visible'); - formLogin.removeClass('is-selected'); - formSignup.addClass('is-selected'); - formForgotPassword.removeClass('is-selected'); - tabLogin.removeClass('selected'); - tabSignup.addClass('selected'); - } - - function forgot_password_selected(){ - formLogin.removeClass('is-selected'); - formSignup.removeClass('is-selected'); - formForgotPassword.addClass('is-selected'); - } - - //REMOVE THIS - it's just to show error messages - /*formLogin.find('input[type="submit"]').on('click', function(event){ - event.preventDefault(); - formLogin.find('input[type="email"]').toggleClass('has-error').next('span').toggleClass('is-visible'); - }); - formSignup.find('input[type="submit"]').on('click', function(event){ - event.preventDefault(); - formSignup.find('input[type="email"]').toggleClass('has-error').next('span').toggleClass('is-visible'); - }); - */ - - - //IE9 placeholder fallback - //credits http://www.hagenburger.net/BLOG/HTML5-Input-Placeholder-Fix-With-jQuery.html - if(!Modernizr.input.placeholder){ - $('[placeholder]').focus(function() { - var input = $(this); - if (input.val() == input.attr('placeholder')) { - input.val(''); - } - }).blur(function() { - var input = $(this); - if (input.val() == '' || input.val() == input.attr('placeholder')) { - input.val(input.attr('placeholder')); - } - }).blur(); - $('[placeholder]').parents('form').submit(function() { - $(this).find('[placeholder]').each(function() { - var input = $(this); - if (input.val() == input.attr('placeholder')) { - input.val(''); - } - }) - }); - } - -}); - - -//credits http://css-tricks.com/snippets/jquery/move-cursor-to-end-of-textarea-or-input/ -jQuery.fn.putCursorAtEnd = function() { - return this.each(function() { - // If this function exists... - if (this.setSelectionRange) { - // ... then use it (Doesn't work in IE) - // Double the length because Opera is inconsistent about whether a carriage return is one character or two. Sigh. - var len = $(this).val().length * 2; - this.focus(); - this.setSelectionRange(len, len); - } else { - // ... otherwise replace the contents with itself - // (Doesn't work in Google Chrome) - $(this).val($(this).val()); - } - }); -}; diff --git a/js/modernizr.js b/js/modernizr.js deleted file mode 100644 index 07ea93f..0000000 --- a/js/modernizr.js +++ /dev/null @@ -1,1406 +0,0 @@ -/*! - * Modernizr v2.7.1 - * www.modernizr.com - * - * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton - * Available under the BSD and MIT licenses: www.modernizr.com/license/ - */ - -/* - * Modernizr tests which native CSS3 and HTML5 features are available in - * the current UA and makes the results available to you in two ways: - * as properties on a global Modernizr object, and as classes on the - * element. This information allows you to progressively enhance - * your pages with a granular level of control over the experience. - * - * Modernizr has an optional (not included) conditional resource loader - * called Modernizr.load(), based on Yepnope.js (yepnopejs.com). - * To get a build that includes Modernizr.load(), as well as choosing - * which tests to include, go to www.modernizr.com/download/ - * - * Authors Faruk Ates, Paul Irish, Alex Sexton - * Contributors Ryan Seddon, Ben Alman - */ - -window.Modernizr = (function( window, document, undefined ) { - - var version = '2.7.1', - - Modernizr = {}, - - /*>>cssclasses*/ - // option for enabling the HTML classes to be added - enableClasses = true, - /*>>cssclasses*/ - - docElement = document.documentElement, - - /** - * Create our "modernizr" element that we do most feature tests on. - */ - mod = 'modernizr', - modElem = document.createElement(mod), - mStyle = modElem.style, - - /** - * Create the input element for various Web Forms feature tests. - */ - inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ , - - /*>>smile*/ - smile = ':)', - /*>>smile*/ - - toString = {}.toString, - - // TODO :: make the prefixes more granular - /*>>prefixes*/ - // List of property values to set for css tests. See ticket #21 - prefixes = ' -webkit- -moz- -o- -ms- '.split(' '), - /*>>prefixes*/ - - /*>>domprefixes*/ - // Following spec is to expose vendor-specific style properties as: - // elem.style.WebkitBorderRadius - // and the following would be incorrect: - // elem.style.webkitBorderRadius - - // Webkit ghosts their properties in lowercase but Opera & Moz do not. - // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+ - // erik.eae.net/archives/2008/03/10/21.48.10/ - - // More here: github.com/Modernizr/Modernizr/issues/issue/21 - omPrefixes = 'Webkit Moz O ms', - - cssomPrefixes = omPrefixes.split(' '), - - domPrefixes = omPrefixes.toLowerCase().split(' '), - /*>>domprefixes*/ - - /*>>ns*/ - ns = {'svg': 'http://www.w3.org/2000/svg'}, - /*>>ns*/ - - tests = {}, - inputs = {}, - attrs = {}, - - classes = [], - - slice = classes.slice, - - featureName, // used in testing loop - - - /*>>teststyles*/ - // Inject element with style element and some CSS rules - injectElementWithStyles = function( rule, callback, nodes, testnames ) { - - var style, ret, node, docOverflow, - div = document.createElement('div'), - // After page load injecting a fake body doesn't work so check if body exists - body = document.body, - // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it. - fakeBody = body || document.createElement('body'); - - if ( parseInt(nodes, 10) ) { - // In order not to give false positives we create a node for each test - // This also allows the method to scale for unspecified uses - while ( nodes-- ) { - node = document.createElement('div'); - node.id = testnames ? testnames[nodes] : mod + (nodes + 1); - div.appendChild(node); - } - } - - // '].join(''); - div.id = mod; - // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody. - // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270 - (body ? div : fakeBody).innerHTML += style; - fakeBody.appendChild(div); - if ( !body ) { - //avoid crashing IE8, if background image is used - fakeBody.style.background = ''; - //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible - fakeBody.style.overflow = 'hidden'; - docOverflow = docElement.style.overflow; - docElement.style.overflow = 'hidden'; - docElement.appendChild(fakeBody); - } - - ret = callback(div, rule); - // If this is done after page load we don't want to remove the body so check if body exists - if ( !body ) { - fakeBody.parentNode.removeChild(fakeBody); - docElement.style.overflow = docOverflow; - } else { - div.parentNode.removeChild(div); - } - - return !!ret; - - }, - /*>>teststyles*/ - - /*>>mq*/ - // adapted from matchMedia polyfill - // by Scott Jehl and Paul Irish - // gist.github.com/786768 - testMediaQuery = function( mq ) { - - var matchMedia = window.matchMedia || window.msMatchMedia; - if ( matchMedia ) { - return matchMedia(mq).matches; - } - - var bool; - - injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) { - bool = (window.getComputedStyle ? - getComputedStyle(node, null) : - node.currentStyle)['position'] == 'absolute'; - }); - - return bool; - - }, - /*>>mq*/ - - - /*>>hasevent*/ - // - // isEventSupported determines if a given element supports the given event - // kangax.github.com/iseventsupported/ - // - // The following results are known incorrects: - // Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative - // Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333 - // ... - isEventSupported = (function() { - - var TAGNAMES = { - 'select': 'input', 'change': 'input', - 'submit': 'form', 'reset': 'form', - 'error': 'img', 'load': 'img', 'abort': 'img' - }; - - function isEventSupported( eventName, element ) { - - element = element || document.createElement(TAGNAMES[eventName] || 'div'); - eventName = 'on' + eventName; - - // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those - var isSupported = eventName in element; - - if ( !isSupported ) { - // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element - if ( !element.setAttribute ) { - element = document.createElement('div'); - } - if ( element.setAttribute && element.removeAttribute ) { - element.setAttribute(eventName, ''); - isSupported = is(element[eventName], 'function'); - - // If property was created, "remove it" (by setting value to `undefined`) - if ( !is(element[eventName], 'undefined') ) { - element[eventName] = undefined; - } - element.removeAttribute(eventName); - } - } - - element = null; - return isSupported; - } - return isEventSupported; - })(), - /*>>hasevent*/ - - // TODO :: Add flag for hasownprop ? didn't last time - - // hasOwnProperty shim by kangax needed for Safari 2.0 support - _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; - - if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { - hasOwnProp = function (object, property) { - return _hasOwnProperty.call(object, property); - }; - } - else { - hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */ - return ((property in object) && is(object.constructor.prototype[property], 'undefined')); - }; - } - - // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js - // es5.github.com/#x15.3.4.5 - - if (!Function.prototype.bind) { - Function.prototype.bind = function bind(that) { - - var target = this; - - if (typeof target != "function") { - throw new TypeError(); - } - - var args = slice.call(arguments, 1), - bound = function () { - - if (this instanceof bound) { - - var F = function(){}; - F.prototype = target.prototype; - var self = new F(); - - var result = target.apply( - self, - args.concat(slice.call(arguments)) - ); - if (Object(result) === result) { - return result; - } - return self; - - } else { - - return target.apply( - that, - args.concat(slice.call(arguments)) - ); - - } - - }; - - return bound; - }; - } - - /** - * setCss applies given styles to the Modernizr DOM node. - */ - function setCss( str ) { - mStyle.cssText = str; - } - - /** - * setCssAll extrapolates all vendor-specific css strings. - */ - function setCssAll( str1, str2 ) { - return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); - } - - /** - * is returns a boolean for if typeof obj is exactly type. - */ - function is( obj, type ) { - return typeof obj === type; - } - - /** - * contains returns a boolean for if substr is found within str. - */ - function contains( str, substr ) { - return !!~('' + str).indexOf(substr); - } - - /*>>testprop*/ - - // testProps is a generic CSS / DOM property test. - - // In testing support for a given CSS property, it's legit to test: - // `elem.style[styleName] !== undefined` - // If the property is supported it will return an empty string, - // if unsupported it will return undefined. - - // We'll take advantage of this quick test and skip setting a style - // on our modernizr element, but instead just testing undefined vs - // empty string. - - // Because the testing of the CSS property names (with "-", as - // opposed to the camelCase DOM properties) is non-portable and - // non-standard but works in WebKit and IE (but not Gecko or Opera), - // we explicitly reject properties with dashes so that authors - // developing in WebKit or IE first don't end up with - // browser-specific content by accident. - - function testProps( props, prefixed ) { - for ( var i in props ) { - var prop = props[i]; - if ( !contains(prop, "-") && mStyle[prop] !== undefined ) { - return prefixed == 'pfx' ? prop : true; - } - } - return false; - } - /*>>testprop*/ - - // TODO :: add testDOMProps - /** - * testDOMProps is a generic DOM property test; if a browser supports - * a certain property, it won't return undefined for it. - */ - function testDOMProps( props, obj, elem ) { - for ( var i in props ) { - var item = obj[props[i]]; - if ( item !== undefined) { - - // return the property name as a string - if (elem === false) return props[i]; - - // let's bind a function - if (is(item, 'function')){ - // default to autobind unless override - return item.bind(elem || obj); - } - - // return the unbound function or obj or value - return item; - } - } - return false; - } - - /*>>testallprops*/ - /** - * testPropsAll tests a list of DOM properties we want to check against. - * We specify literally ALL possible (known and/or likely) properties on - * the element including the non-vendor prefixed one, for forward- - * compatibility. - */ - function testPropsAll( prop, prefixed, elem ) { - - var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), - props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); - - // did they call .prefixed('boxSizing') or are we just testing a prop? - if(is(prefixed, "string") || is(prefixed, "undefined")) { - return testProps(props, prefixed); - - // otherwise, they called .prefixed('requestAnimationFrame', window[, elem]) - } else { - props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); - return testDOMProps(props, prefixed, elem); - } - } - /*>>testallprops*/ - - - /** - * Tests - * ----- - */ - - // The *new* flexbox - // dev.w3.org/csswg/css3-flexbox - - tests['flexbox'] = function() { - return testPropsAll('flexWrap'); - }; - - // The *old* flexbox - // www.w3.org/TR/2009/WD-css3-flexbox-20090723/ - - tests['flexboxlegacy'] = function() { - return testPropsAll('boxDirection'); - }; - - // On the S60 and BB Storm, getContext exists, but always returns undefined - // so we actually have to call getContext() to verify - // github.com/Modernizr/Modernizr/issues/issue/97/ - - tests['canvas'] = function() { - var elem = document.createElement('canvas'); - return !!(elem.getContext && elem.getContext('2d')); - }; - - tests['canvastext'] = function() { - return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function')); - }; - - // webk.it/70117 is tracking a legit WebGL feature detect proposal - - // We do a soft detect which may false positive in order to avoid - // an expensive context creation: bugzil.la/732441 - - tests['webgl'] = function() { - return !!window.WebGLRenderingContext; - }; - - /* - * The Modernizr.touch test only indicates if the browser supports - * touch events, which does not necessarily reflect a touchscreen - * device, as evidenced by tablets running Windows 7 or, alas, - * the Palm Pre / WebOS (touch) phones. - * - * Additionally, Chrome (desktop) used to lie about its support on this, - * but that has since been rectified: crbug.com/36415 - * - * We also test for Firefox 4 Multitouch Support. - * - * For more info, see: modernizr.github.com/Modernizr/touch.html - */ - - tests['touch'] = function() { - var bool; - - if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { - bool = true; - } else { - injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) { - bool = node.offsetTop === 9; - }); - } - - return bool; - }; - - - // geolocation is often considered a trivial feature detect... - // Turns out, it's quite tricky to get right: - // - // Using !!navigator.geolocation does two things we don't want. It: - // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513 - // 2. Disables page caching in WebKit: webk.it/43956 - // - // Meanwhile, in Firefox < 8, an about:config setting could expose - // a false positive that would throw an exception: bugzil.la/688158 - - tests['geolocation'] = function() { - return 'geolocation' in navigator; - }; - - - tests['postmessage'] = function() { - return !!window.postMessage; - }; - - - // Chrome incognito mode used to throw an exception when using openDatabase - // It doesn't anymore. - tests['websqldatabase'] = function() { - return !!window.openDatabase; - }; - - // Vendors had inconsistent prefixing with the experimental Indexed DB: - // - Webkit's implementation is accessible through webkitIndexedDB - // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB - // For speed, we don't test the legacy (and beta-only) indexedDB - tests['indexedDB'] = function() { - return !!testPropsAll("indexedDB", window); - }; - - // documentMode logic from YUI to filter out IE8 Compat Mode - // which false positives. - tests['hashchange'] = function() { - return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7); - }; - - // Per 1.6: - // This used to be Modernizr.historymanagement but the longer - // name has been deprecated in favor of a shorter and property-matching one. - // The old API is still available in 1.6, but as of 2.0 will throw a warning, - // and in the first release thereafter disappear entirely. - tests['history'] = function() { - return !!(window.history && history.pushState); - }; - - tests['draganddrop'] = function() { - var div = document.createElement('div'); - return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div); - }; - - // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10 - // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17. - // FF10 still uses prefixes, so check for it until then. - // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/ - tests['websockets'] = function() { - return 'WebSocket' in window || 'MozWebSocket' in window; - }; - - - // css-tricks.com/rgba-browser-support/ - tests['rgba'] = function() { - // Set an rgba() color and check the returned value - - setCss('background-color:rgba(150,255,150,.5)'); - - return contains(mStyle.backgroundColor, 'rgba'); - }; - - tests['hsla'] = function() { - // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally, - // except IE9 who retains it as hsla - - setCss('background-color:hsla(120,40%,100%,.5)'); - - return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla'); - }; - - tests['multiplebgs'] = function() { - // Setting multiple images AND a color on the background shorthand property - // and then querying the style.background property value for the number of - // occurrences of "url(" is a reliable method for detecting ACTUAL support for this! - - setCss('background:url(https://),url(https://),red url(https://)'); - - // If the UA supports multiple backgrounds, there should be three occurrences - // of the string "url(" in the return value for elemStyle.background - - return (/(url\s*\(.*?){3}/).test(mStyle.background); - }; - - - - // this will false positive in Opera Mini - // github.com/Modernizr/Modernizr/issues/396 - - tests['backgroundsize'] = function() { - return testPropsAll('backgroundSize'); - }; - - tests['borderimage'] = function() { - return testPropsAll('borderImage'); - }; - - - // Super comprehensive table about all the unique implementations of - // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance - - tests['borderradius'] = function() { - return testPropsAll('borderRadius'); - }; - - // WebOS unfortunately false positives on this test. - tests['boxshadow'] = function() { - return testPropsAll('boxShadow'); - }; - - // FF3.0 will false positive on this test - tests['textshadow'] = function() { - return document.createElement('div').style.textShadow === ''; - }; - - - tests['opacity'] = function() { - // Browsers that actually have CSS Opacity implemented have done so - // according to spec, which means their return values are within the - // range of [0.0,1.0] - including the leading zero. - - setCssAll('opacity:.55'); - - // The non-literal . in this regex is intentional: - // German Chrome returns this value as 0,55 - // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632 - return (/^0.55$/).test(mStyle.opacity); - }; - - - // Note, Android < 4 will pass this test, but can only animate - // a single property at a time - // daneden.me/2011/12/putting-up-with-androids-bullshit/ - tests['cssanimations'] = function() { - return testPropsAll('animationName'); - }; - - - tests['csscolumns'] = function() { - return testPropsAll('columnCount'); - }; - - - tests['cssgradients'] = function() { - /** - * For CSS Gradients syntax, please see: - * webkit.org/blog/175/introducing-css-gradients/ - * developer.mozilla.org/en/CSS/-moz-linear-gradient - * developer.mozilla.org/en/CSS/-moz-radial-gradient - * dev.w3.org/csswg/css3-images/#gradients- - */ - - var str1 = 'background-image:', - str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', - str3 = 'linear-gradient(left top,#9f9, white);'; - - setCss( - // legacy webkit syntax (FIXME: remove when syntax not in use anymore) - (str1 + '-webkit- '.split(' ').join(str2 + str1) + - // standard syntax // trailing 'background-image:' - prefixes.join(str3 + str1)).slice(0, -str1.length) - ); - - return contains(mStyle.backgroundImage, 'gradient'); - }; - - - tests['cssreflections'] = function() { - return testPropsAll('boxReflect'); - }; - - - tests['csstransforms'] = function() { - return !!testPropsAll('transform'); - }; - - - tests['csstransforms3d'] = function() { - - var ret = !!testPropsAll('perspective'); - - // Webkit's 3D transforms are passed off to the browser's own graphics renderer. - // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in - // some conditions. As a result, Webkit typically recognizes the syntax but - // will sometimes throw a false positive, thus we must do a more thorough check: - if ( ret && 'webkitPerspective' in docElement.style ) { - - // Webkit allows this media query to succeed only if the feature is enabled. - // `@media (transform-3d),(-webkit-transform-3d){ ... }` - injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) { - ret = node.offsetLeft === 9 && node.offsetHeight === 3; - }); - } - return ret; - }; - - - tests['csstransitions'] = function() { - return testPropsAll('transition'); - }; - - - /*>>fontface*/ - // @font-face detection routine by Diego Perini - // javascript.nwbox.com/CSSSupport/ - - // false positives: - // WebOS github.com/Modernizr/Modernizr/issues/342 - // WP7 github.com/Modernizr/Modernizr/issues/538 - tests['fontface'] = function() { - var bool; - - injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) { - var style = document.getElementById('smodernizr'), - sheet = style.sheet || style.styleSheet, - cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : ''; - - bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0; - }); - - return bool; - }; - /*>>fontface*/ - - // CSS generated content detection - tests['generatedcontent'] = function() { - var bool; - - injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) { - bool = node.offsetHeight >= 3; - }); - - return bool; - }; - - - - // These tests evaluate support of the video/audio elements, as well as - // testing what types of content they support. - // - // We're using the Boolean constructor here, so that we can extend the value - // e.g. Modernizr.video // true - // Modernizr.video.ogg // 'probably' - // - // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845 - // thx to NielsLeenheer and zcorpan - - // Note: in some older browsers, "no" was a return value instead of empty string. - // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2 - // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5 - - tests['video'] = function() { - var elem = document.createElement('video'), - bool = false; - - // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224 - try { - if ( bool = !!elem.canPlayType ) { - bool = new Boolean(bool); - bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,''); - - // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546 - bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,''); - - bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,''); - } - - } catch(e) { } - - return bool; - }; - - tests['audio'] = function() { - var elem = document.createElement('audio'), - bool = false; - - try { - if ( bool = !!elem.canPlayType ) { - bool = new Boolean(bool); - bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,''); - bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,''); - - // Mimetypes accepted: - // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements - // bit.ly/iphoneoscodecs - bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,''); - bool.m4a = ( elem.canPlayType('audio/x-m4a;') || - elem.canPlayType('audio/aac;')) .replace(/^no$/,''); - } - } catch(e) { } - - return bool; - }; - - - // In FF4, if disabled, window.localStorage should === null. - - // Normally, we could not test that directly and need to do a - // `('localStorage' in window) && ` test first because otherwise Firefox will - // throw bugzil.la/365772 if cookies are disabled - - // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem - // will throw the exception: - // QUOTA_EXCEEDED_ERRROR DOM Exception 22. - // Peculiarly, getItem and removeItem calls do not throw. - - // Because we are forced to try/catch this, we'll go aggressive. - - // Just FWIW: IE8 Compat mode supports these features completely: - // www.quirksmode.org/dom/html5.html - // But IE8 doesn't support either with local files - - tests['localstorage'] = function() { - try { - localStorage.setItem(mod, mod); - localStorage.removeItem(mod); - return true; - } catch(e) { - return false; - } - }; - - tests['sessionstorage'] = function() { - try { - sessionStorage.setItem(mod, mod); - sessionStorage.removeItem(mod); - return true; - } catch(e) { - return false; - } - }; - - - tests['webworkers'] = function() { - return !!window.Worker; - }; - - - tests['applicationcache'] = function() { - return !!window.applicationCache; - }; - - - // Thanks to Erik Dahlstrom - tests['svg'] = function() { - return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect; - }; - - // specifically for SVG inline in HTML, not within XHTML - // test page: paulirish.com/demo/inline-svg - tests['inlinesvg'] = function() { - var div = document.createElement('div'); - div.innerHTML = ''; - return (div.firstChild && div.firstChild.namespaceURI) == ns.svg; - }; - - // SVG SMIL animation - tests['smil'] = function() { - return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate'))); - }; - - // This test is only for clip paths in SVG proper, not clip paths on HTML content - // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg - - // However read the comments to dig into applying SVG clippaths to HTML content here: - // github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491 - tests['svgclippaths'] = function() { - return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath'))); - }; - - /*>>webforms*/ - // input features and input types go directly onto the ret object, bypassing the tests loop. - // Hold this guy to execute in a moment. - function webforms() { - /*>>input*/ - // Run through HTML5's new input attributes to see if the UA understands any. - // We're using f which is the element created early on - // Mike Taylr has created a comprehensive resource for testing these attributes - // when applied to all input types: - // miketaylr.com/code/input-type-attr.html - // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary - - // Only input placeholder is tested while textarea's placeholder is not. - // Currently Safari 4 and Opera 11 have support only for the input placeholder - // Both tests are available in feature-detects/forms-placeholder.js - Modernizr['input'] = (function( props ) { - for ( var i = 0, len = props.length; i < len; i++ ) { - attrs[ props[i] ] = !!(props[i] in inputElem); - } - if (attrs.list){ - // safari false positive's on datalist: webk.it/74252 - // see also github.com/Modernizr/Modernizr/issues/146 - attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement); - } - return attrs; - })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ')); - /*>>input*/ - - /*>>inputtypes*/ - // Run through HTML5's new input types to see if the UA understands any. - // This is put behind the tests runloop because it doesn't return a - // true/false like all the other tests; instead, it returns an object - // containing each input type with its corresponding true/false value - - // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/ - Modernizr['inputtypes'] = (function(props) { - - for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) { - - inputElem.setAttribute('type', inputElemType = props[i]); - bool = inputElem.type !== 'text'; - - // We first check to see if the type we give it sticks.. - // If the type does, we feed it a textual value, which shouldn't be valid. - // If the value doesn't stick, we know there's input sanitization which infers a custom UI - if ( bool ) { - - inputElem.value = smile; - inputElem.style.cssText = 'position:absolute;visibility:hidden;'; - - if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { - - docElement.appendChild(inputElem); - defaultView = document.defaultView; - - // Safari 2-4 allows the smiley as a value, despite making a slider - bool = defaultView.getComputedStyle && - defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && - // Mobile android web browser has false positive, so must - // check the height to see if the widget is actually there. - (inputElem.offsetHeight !== 0); - - docElement.removeChild(inputElem); - - } else if ( /^(search|tel)$/.test(inputElemType) ){ - // Spec doesn't define any special parsing or detectable UI - // behaviors so we pass these through as true - - // Interestingly, opera fails the earlier test, so it doesn't - // even make it here. - - } else if ( /^(url|email)$/.test(inputElemType) ) { - // Real url and email support comes with prebaked validation. - bool = inputElem.checkValidity && inputElem.checkValidity() === false; - - } else { - // If the upgraded input compontent rejects the :) text, we got a winner - bool = inputElem.value != smile; - } - } - - inputs[ props[i] ] = !!bool; - } - return inputs; - })('search tel url email datetime date month week time datetime-local number range color'.split(' ')); - /*>>inputtypes*/ - } - /*>>webforms*/ - - - // End of test definitions - // ----------------------- - - - - // Run through all tests and detect their support in the current UA. - // todo: hypothetically we could be doing an array of tests and use a basic loop here. - for ( var feature in tests ) { - if ( hasOwnProp(tests, feature) ) { - // run the test, throw the return value into the Modernizr, - // then based on that boolean, define an appropriate className - // and push it into an array of classes we'll join later. - featureName = feature.toLowerCase(); - Modernizr[featureName] = tests[feature](); - - classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); - } - } - - /*>>webforms*/ - // input tests need to run. - Modernizr.input || webforms(); - /*>>webforms*/ - - - /** - * addTest allows the user to define their own feature tests - * the result will be added onto the Modernizr object, - * as well as an appropriate className set on the html element - * - * @param feature - String naming the feature - * @param test - Function returning true if feature is supported, false if not - */ - Modernizr.addTest = function ( feature, test ) { - if ( typeof feature == 'object' ) { - for ( var key in feature ) { - if ( hasOwnProp( feature, key ) ) { - Modernizr.addTest( key, feature[ key ] ); - } - } - } else { - - feature = feature.toLowerCase(); - - if ( Modernizr[feature] !== undefined ) { - // we're going to quit if you're trying to overwrite an existing test - // if we were to allow it, we'd do this: - // var re = new RegExp("\\b(no-)?" + feature + "\\b"); - // docElement.className = docElement.className.replace( re, '' ); - // but, no rly, stuff 'em. - return Modernizr; - } - - test = typeof test == 'function' ? test() : test; - - if (typeof enableClasses !== "undefined" && enableClasses) { - docElement.className += ' ' + (test ? '' : 'no-') + feature; - } - Modernizr[feature] = test; - - } - - return Modernizr; // allow chaining. - }; - - - // Reset modElem.cssText to nothing to reduce memory footprint. - setCss(''); - modElem = inputElem = null; - - /*>>shiv*/ - /** - * @preserve HTML5 Shiv prev3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed - */ - ;(function(window, document) { - /*jshint evil:true */ - /** version */ - var version = '3.7.0'; - - /** Preset options */ - var options = window.html5 || {}; - - /** Used to skip problem elements */ - var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; - - /** Not all elements can be cloned in IE **/ - var saveClones = /^(?: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; - - /** Detect whether the browser supports default html5 styles */ - var supportsHtml5Styles; - - /** Name of the expando, to work with multiple documents or to re-shiv one document */ - var expando = '_html5shiv'; - - /** The id for the the documents expando */ - var expanID = 0; - - /** Cached data for each document */ - var expandoData = {}; - - /** Detect whether the browser supports unknown elements */ - var supportsUnknownElements; - - (function() { - try { - var a = document.createElement('a'); - a.innerHTML = ''; - //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles - supportsHtml5Styles = ('hidden' in a); - - supportsUnknownElements = a.childNodes.length == 1 || (function() { - // assign a false positive if unable to shiv - (document.createElement)('a'); - var frag = document.createDocumentFragment(); - return ( - typeof frag.cloneNode == 'undefined' || - typeof frag.createDocumentFragment == 'undefined' || - typeof frag.createElement == 'undefined' - ); - }()); - } catch(e) { - // assign a false positive if detection fails => unable to shiv - supportsHtml5Styles = true; - supportsUnknownElements = true; - } - - }()); - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a style sheet with the given CSS text and adds it to the document. - * @private - * @param {Document} ownerDocument The document. - * @param {String} cssText The CSS text. - * @returns {StyleSheet} The style element. - */ - function addStyleSheet(ownerDocument, cssText) { - var p = ownerDocument.createElement('p'), - parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; - - p.innerHTML = 'x'; - return parent.insertBefore(p.lastChild, parent.firstChild); - } - - /** - * Returns the value of `html5.elements` as an array. - * @private - * @returns {Array} An array of shived element node names. - */ - function getElements() { - var elements = html5.elements; - return typeof elements == 'string' ? elements.split(' ') : elements; - } - - /** - * Returns the data associated to the given document - * @private - * @param {Document} ownerDocument The document. - * @returns {Object} An object of data. - */ - function getExpandoData(ownerDocument) { - var data = expandoData[ownerDocument[expando]]; - if (!data) { - data = {}; - expanID++; - ownerDocument[expando] = expanID; - expandoData[expanID] = data; - } - return data; - } - - /** - * returns a shived element for the given nodeName and document - * @memberOf html5 - * @param {String} nodeName name of the element - * @param {Document} ownerDocument The context document. - * @returns {Object} The shived element. - */ - function createElement(nodeName, ownerDocument, data){ - if (!ownerDocument) { - ownerDocument = document; - } - if(supportsUnknownElements){ - return ownerDocument.createElement(nodeName); - } - if (!data) { - data = getExpandoData(ownerDocument); - } - var node; - - if (data.cache[nodeName]) { - node = data.cache[nodeName].cloneNode(); - } else if (saveClones.test(nodeName)) { - node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); - } else { - node = data.createElem(nodeName); - } - - // Avoid adding some elements to fragments in IE < 9 because - // * Attributes like `name` or `type` cannot be set/changed once an element - // is inserted into a document/fragment - // * Link elements with `src` attributes that are inaccessible, as with - // a 403 response, will cause the tab/window to crash - // * Script elements appended to fragments will execute when their `src` - // or `text` property is set - return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; - } - - /** - * returns a shived DocumentFragment for the given document - * @memberOf html5 - * @param {Document} ownerDocument The context document. - * @returns {Object} The shived DocumentFragment. - */ - function createDocumentFragment(ownerDocument, data){ - if (!ownerDocument) { - ownerDocument = document; - } - if(supportsUnknownElements){ - return ownerDocument.createDocumentFragment(); - } - data = data || getExpandoData(ownerDocument); - var clone = data.frag.cloneNode(), - i = 0, - elems = getElements(), - l = elems.length; - for(;i>shiv*/ - - // Assign private properties to the return object with prefix - Modernizr._version = version; - - // expose these for the plugin API. Look in the source for how to join() them against your input - /*>>prefixes*/ - Modernizr._prefixes = prefixes; - /*>>prefixes*/ - /*>>domprefixes*/ - Modernizr._domPrefixes = domPrefixes; - Modernizr._cssomPrefixes = cssomPrefixes; - /*>>domprefixes*/ - - /*>>mq*/ - // Modernizr.mq tests a given media query, live against the current state of the window - // A few important notes: - // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false - // * A max-width or orientation query will be evaluated against the current state, which may change later. - // * You must specify values. Eg. If you are testing support for the min-width media query use: - // Modernizr.mq('(min-width:0)') - // usage: - // Modernizr.mq('only screen and (max-width:768)') - Modernizr.mq = testMediaQuery; - /*>>mq*/ - - /*>>hasevent*/ - // Modernizr.hasEvent() detects support for a given event, with an optional element to test on - // Modernizr.hasEvent('gesturestart', elem) - Modernizr.hasEvent = isEventSupported; - /*>>hasevent*/ - - /*>>testprop*/ - // Modernizr.testProp() investigates whether a given style property is recognized - // Note that the property names must be provided in the camelCase variant. - // Modernizr.testProp('pointerEvents') - Modernizr.testProp = function(prop){ - return testProps([prop]); - }; - /*>>testprop*/ - - /*>>testallprops*/ - // Modernizr.testAllProps() investigates whether a given style property, - // or any of its vendor-prefixed variants, is recognized - // Note that the property names must be provided in the camelCase variant. - // Modernizr.testAllProps('boxSizing') - Modernizr.testAllProps = testPropsAll; - /*>>testallprops*/ - - - /*>>teststyles*/ - // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards - // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... }) - Modernizr.testStyles = injectElementWithStyles; - /*>>teststyles*/ - - - /*>>prefixed*/ - // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input - // Modernizr.prefixed('boxSizing') // 'MozBoxSizing' - - // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style. - // Return values will also be the camelCase variant, if you need to translate that to hypenated style use: - // - // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); - - // If you're trying to ascertain which transition end event to bind to, you might do something like... - // - // var transEndEventNames = { - // 'WebkitTransition' : 'webkitTransitionEnd', - // 'MozTransition' : 'transitionend', - // 'OTransition' : 'oTransitionEnd', - // 'msTransition' : 'MSTransitionEnd', - // 'transition' : 'transitionend' - // }, - // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ]; - - Modernizr.prefixed = function(prop, obj, elem){ - if(!obj) { - return testPropsAll(prop, 'pfx'); - } else { - // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame' - return testPropsAll(prop, obj, elem); - } - }; - /*>>prefixed*/ - - - /*>>cssclasses*/ - // Remove "no-js" class from element, if it exists: - docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') + - - // Add the new classes to the element. - (enableClasses ? ' js ' + classes.join(' ') : ''); - /*>>cssclasses*/ - - return Modernizr; - -})(this, this.document); diff --git a/login.php b/login.php deleted file mode 100644 index 98c5d16..0000000 --- a/login.php +++ /dev/null @@ -1,20 +0,0 @@ - diff --git a/partials/_layout.scss b/partials/_layout.scss deleted file mode 100644 index 25ed3c7..0000000 --- a/partials/_layout.scss +++ /dev/null @@ -1,27 +0,0 @@ -// breakpoints - -$S: 600px; -$M: 768px; -$L: 1170px; - -// media queries - -@mixin MQ($canvas) { - @if $canvas == S { - @media only screen and (min-width: $S) { @content; } - } - @else if $canvas == M { - @media only screen and (min-width: $M) { @content; } - } - @else if $canvas == L { - @media only screen and (min-width: $L) { @content; } - } -} - -// super light grid - it works with the .cd-container class - -@mixin column($percentage, $float-direction:left) { - width: 100% * $percentage; - float: $float-direction; -} - diff --git a/partials/_mixins.scss b/partials/_mixins.scss deleted file mode 100644 index 4898114..0000000 --- a/partials/_mixins.scss +++ /dev/null @@ -1,40 +0,0 @@ -// rem fallback - credits: http://zerosixthree.se/ - -@function calculateRem($size) { - $remSize: $size / 16px; - @return $remSize * 1rem; -} - -@mixin font-size($size) { - font-size: $size; - font-size: calculateRem($size); -} - -// center vertically and/or horizontally an absolute positioned element - -@mixin center($xy:xy) { - @if $xy == xy { - left: 50%; - top: 50%; - bottom: auto; - right: auto; - @include transform(translateX(-50%) translateY(-50%)); - } - @else if $xy == x { - left: 50%; - right: auto; - @include transform(translateX(-50%)); - } - @else if $xy == y { - top: 50%; - bottom: auto; - @include transform(translateY(-50%)); - } -} - -// border radius - -@mixin border-radius($radius:.25em) { - border-radius: $radius; -} - diff --git a/partials/_variables.scss b/partials/_variables.scss deleted file mode 100644 index 34d6ac3..0000000 --- a/partials/_variables.scss +++ /dev/null @@ -1,24 +0,0 @@ -// colors - -$main-text: #505260; // main text -$background: #fff; // body background color - -$color-1: #343642; // blue-dark -$color-2: #2f889a; // blue-light -$color-3: #d2d8d8; // grey - -$red: #d76666; // error messages - -// fonts - -$primary-font: 'PT Sans', sans-serif; - -// z-index - -$header-zindex: 2; -$modal-zindex: 3; - -// header - -$header-height-S: 50px; -$header-height-M: 80px; \ No newline at end of file diff --git a/password.txt b/password.txt deleted file mode 100644 index f3097ab..0000000 --- a/password.txt +++ /dev/null @@ -1 +0,0 @@ -password diff --git a/scss/style.scss b/scss/style.scss deleted file mode 100644 index 489041c..0000000 --- a/scss/style.scss +++ /dev/null @@ -1,478 +0,0 @@ -@import 'bourbon'; // http://bourbon.io/ - -@import '../partials/variables'; // colors, fonts etc... - -@import '../partials/mixins'; // custom mixins - -@import '../partials/layout'; // responsive grid and media queries - -/* -------------------------------- - -Primary style - --------------------------------- */ - -html * { - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -*, *:after, *:before { - @include box-sizing(border-box); -} - -body { - font: { - size: 100%; - family: $primary-font; // variables inside partials > _variables.scss - } - color: $main-text; - background-color: $background; -} - -a { - color: $color-2; - text-decoration: none; -} - -img { - max-width: 100%; -} - -input, textarea { - font-family: $primary-font; - @include font-size(16px); - - &::-ms-clear { - display: none; - } -} - -/* -------------------------------- - -Main components - --------------------------------- */ - -header[role=banner] { - position: relative; - height: $header-height-S; - background: $color-1; - - #cd-logo { - float: left; - margin: 4px 0 0 5%; - - /* reduce logo size on mobile and make sure it is left aligned with the transform-origin property */ - @include transform-origin(0 50%); - @include transform(scale(.8)); - - img { - display: block; - } - } - - &::after { /* clearfix */ - content: ''; - display: table; - clear: both; - } - - @include MQ(M) { - height: $header-height-M; - - #cd-logo { - margin: 20px 0 0 5%; - @include transform(scale(1)); - } - } -} - -.main-nav { - float: right; - margin-right: 5%; - width: 44px; - height: 100%; - background: url('../img/cd-icon-menu.svg') no-repeat center center; - cursor: pointer; - - ul { - position: absolute; - top: 0; - left: 0; - width: 100%; - - @include transform(translateY(-100%)); - - &.is-visible { - @include transform(translateY($header-height-S)); - } - } - - a { - display: block; - height: $header-height-S; - line-height: $header-height-S; - padding-left: 5%; - background: darken($color-1, 5%); - border-top: 1px solid lighten($color-1, 3%); - color: #FFF; - } - - @include MQ(M) { - width: auto; - height: auto; - background: none; - cursor: auto; - - ul { - position: static; - width: auto; - @include transform(translateY(0)); - line-height: $header-height-M; - - &.is-visible { - @include transform(translateY(0)); - } - } - - li { - display: inline-block; - margin-left: 1em; - - &:nth-last-child(2) { - margin-left: 2em; - } - } - - a { - display: inline-block; - height: auto; - line-height: normal; - background: transparent; - - &.cd-signin, &.cd-signup { - padding: .6em 1em; - border: 1px solid rgba(#FFF, .6); - border-radius: 50em; - } - - &.cd-signup { - background: $color-2; - border: none; - } - } - } -} - -/* -------------------------------- - -xsigin/signup popup - --------------------------------- */ - - -.cd-user-modal { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: rgba($color-1, .9); - z-index: $modal-zindex; - overflow-y: auto; - cursor: pointer; - - visibility: hidden; - opacity: 0; - @include transition(opacity .3s, visibility .3s); - - &.is-visible { - visibility: visible; - opacity: 1; - - .cd-user-modal-container { - @include transform(translateY(0)); - } - } -} - -.cd-user-modal-container { - position: relative; - width: 90%; - max-width: 600px; - background: #FFF; - margin: 3em auto 4em; - cursor: auto; - @include border-radius; - @include transform(translateY(-30px)); - - @include transition-property (transform); - @include transition-duration(.3s); - - .cd-switcher { - @include clearfix; - - li { - @include column(.5); - text-align: center; - - &:first-child a { - border-radius: .25em 0 0 0; - } - - &:last-child a { - border-radius: 0 .25em 0 0; - } - } - - a { - display: block; - width: 100%; - height: 50px; - line-height: 50px; - background: $color-3; - color: darken($color-3, 30%); - - &.selected { - background: #FFF; - color: $main-text; - } - } - } - - @include MQ(S) { - margin: 4em auto; - - .cd-switcher a { - height: 70px; - line-height: 70px; - } - } -} - -.cd-form { - padding: 1.4em; - - .fieldset { - position: relative; - margin: 1.4em 0; - - &:first-child { - margin-top: 0; - } - - &:last-child { - margin-bottom: 0; - } - } - - label { - @include font-size(14px); - - &.image-replace { - /* replace text with an icon */ - display: inline-block; - position: absolute; - left: 15px; - @include center(y); - height: 20px; - width: 20px; - - overflow: hidden; - text-indent: 100%; - white-space: nowrap; - color: transparent; - text-shadow: none; - - background-repeat: no-repeat; - background-position: 50% 0; - } - - &.cd-username { - background-image: url('../img/cd-icon-username.svg'); - } - - &.cd-email { - background-image: url('../img/cd-icon-email.svg'); - } - - &.cd-password { - background-image: url('../img/cd-icon-password.svg'); - } - } - - input { - margin: 0; - padding: 0; - @include border-radius; - - &.full-width { - width: 100%; - } - - &.has-padding { - padding: 12px 20px 12px 50px; - } - - &.has-border { - border: 1px solid $color-3; - @include appearance(none); - - &:focus { - border-color: $color-1; - box-shadow: 0 0 5px rgba($color-1, .1); - outline: none; - } - } - - &.has-error { - border: 1px solid $red; - } - - &[type=password] { - /* space left for the HIDE button */ - padding-right: 65px; - } - - &[type=submit] { - padding: 16px 0; - cursor: pointer; - background: $color-2; - color: #FFF; - font-weight: bold; - border: none; - @include appearance(none); - - .no-touch &:hover, .no-touch &:focus { - background: lighten($color-2, 5%); - outline: none; - } - } - } - - .hide-password { - display: inline-block; - position: absolute; - right: 0; - top: 0; - padding: 6px 15px; - border-left: 1px solid $color-3; - @include center(y); // see partials > _mixins.scss - @include font-size(14px); - color: $color-1; - } - - .cd-error-message { - display: inline-block; - position: absolute; - left: -5px; - bottom: -35px; - background: rgba($red, .9); - padding: .8em; - z-index: 2; - color: #FFF; - @include font-size(13px); - @include border-radius; - - /* prevent click and touch events */ - pointer-events: none; - - visibility: hidden; - opacity: 0; - - @include transition(opacity .2s 0, visibility 0 .2s); - - &::after { - /* triangle */ - content: ''; - position: absolute; - left: 22px; - bottom: 100%; - @include triangle(16px, rgba($red, .9), up); - } - - &.is-visible { - opacity: 1; - visibility: visible; - - @include transition(opacity .2s 0, visibility 0 0); - } - } - - @include MQ(S) { - padding: 2em; - - .fieldset { - margin: 2em 0; - - &:first-child { - margin-top: 0; - } - - &:last-child { - margin-bottom: 0; - } - } - - input.has-padding { - padding: 16px 20px 16px 50px; - } - - input[type=submit] { - padding: 16px 0; - } - } -} - -.cd-form-message { - padding: 1.4em 1.4em 0; - @include font-size(14px); - line-height: 1.4; - text-align: center; - - @include MQ(S) { - padding: 2em 2em 0; - } -} - -.cd-form-bottom-message { - position: absolute; - width: 100%; - left: 0; - bottom: -30px; - text-align: center; - @include font-size(14px); - - a { - color: #FFF; - text-decoration: underline; - } -} - -.cd-close-form { - /* form X button on top right */ - display: block; - position: absolute; - width: 40px; - height: 40px; - right: 0; - top: -40px; - background: url('../img/cd-icon-close.svg') no-repeat center center; - text-indent: 100%; - white-space: nowrap; - overflow: hidden; - - @include MQ(L) { - display: none; - } -} - -#cd-login, #cd-signup, #cd-reset-password { - display: none; -} - -#cd-login.is-selected, #cd-signup.is-selected, #cd-reset-password.is-selected { - display: block; -} - diff --git a/upload.html b/upload.html index 3f2c59f..7f64705 100644 --- a/upload.html +++ b/upload.html @@ -2,7 +2,7 @@ -Menu Uploader +Excel2JSON | JavaScript