diff --git a/bower.json b/bower.json deleted file mode 100644 index 636b5f1..0000000 --- a/bower.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "sciencealchemy", - "description": "Science Alchemy", - "main": "js/app.js", - "moduleType": [], - "license": "MIT", - "homepage": "", - "private": true, - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test" - ], - "dependencies": { - "angular": "1.4.x", - "angular-mocks": "1.4.x", - "jquery": "~2.1.1", - "bootstrap": "~3.1.1", - "angular-route": "1.4.x", - "angular-resource": "1.4.x", - "angular-animate": "1.4.x", - "angular-dragdrop": "~1.0.13", - "lodash": "~4.5.1", - "chai": "~3.5.0", - "angular-ui-grid": "~3.1.1", - "jquery-ui": "~1.11.4", - "font-awesome": "~4.5.0" - } -} diff --git a/gulpfile.js b/gulpfile.js index b912aeb..2289d93 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,6 +4,8 @@ var gulp = require('gulp'); var fs = require('fs'); var gutil = require('gulp-util') +var webpack = require('webpack-stream'); + // var source = require('vinyl-source-stream'); // var buffer = require('vinyl-buffer'); // var del = require('del'); @@ -19,21 +21,22 @@ var pjson = require('./package.json'); var production = (process.env.NODE_ENV === 'production'); var DEBUG = !production; -console.log('Running in DEBUG='+DEBUG+' mode') +console.log('Running in DEBUG='+DEBUG+' mode'); var config = { app_entry: 'client/scripts/main.js', debug: DEBUG, -} +}; /* Just run webpack */ -DEBUG = false -var webpack = require('webpack-stream'); -gulp.task('webpack', function () { - var webpackConfig = require('./webpack.config.js') + +gulp.task('webpack', function () { + DEBUG = config.debug=false; // run production mode + process.env.NODE_ENV='production'; + var webpackConfig = require('./webpack.config.js'); console.log('debug: ', webpackConfig.debug); return gulp.src(config.app_entry) @@ -62,9 +65,9 @@ gulp.task('s3', function () { return gulp.src('./dist/**',{cwd:'.'}) // rename to put in subfolder - .pipe(rename(function (path) { - path.dirname = pjson.name + '/' + path.dirname; - })) + // .pipe(rename(function (path) { + // path.dirname = pjson.name + '/' + path.dirname; // for /module/path/file.ext + // })) // gzip, Set Content-Encoding headers and add .gz extension .pipe(awspublish.gzip()) diff --git a/index.js b/index.js deleted file mode 100644 index 0cf4ef4..0000000 --- a/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** App imports **/ - -// css -require("css/bootstrap.min.css"); -require("font-awesome/css/font-awesome.css"); -// require("font-awesome/scss/font-awesome.scss"); -// require("bower_components/angular-ui-grid/ui-grid.min.css"); -// require("css/ui-grid.css"); -require("css/style.css"); - -// img -require("assets/favicon.png"); -require("assets/mobile/icon.png"); -require("assets/mobile/icon.png"); -require("assets/pc32sw.png"); - -// json -var jquery = require("jquery"); -var jqueryUi = require("jquery-ui"); -var jqueryUiTouchPunch = require("jquery-ui-touch-punch"); -var jqueryCookie = require("js-cookie"); - -var bootstrap = require("bootstrap"); -// var retina = require("retina"); -var FastClick = require("fastclick"); - -var chai = require("chai"); -var lodash = require("lodash"); - -var angular = require("angular"); -var angularDragdrop = require("angular-dragdrop"); -var angularAnimate = require("angular-animate"); - -var ObjectStorage = require("js/storage.js"); -var Helpers = require("js/helpers.js"); -var Analytics = require("js/analytics.js"); -var GameObjects = require("js/gameobjects.js"); -var Rules = require("js/rules.js"); -var UI = require("js/ui.js"); -var Game = require("js/game.js"); -var app = require("js/app.js"); diff --git a/js/external/fastclick.js b/js/external/fastclick.js deleted file mode 100644 index 35a81d6..0000000 --- a/js/external/fastclick.js +++ /dev/null @@ -1,821 +0,0 @@ -/** - * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs. - * - * @version 1.0.3 - * @codingstandard ftlabs-jsv2 - * @copyright The Financial Times Limited [All Rights Reserved] - * @license MIT License (see LICENSE.txt) - */ - -/*jslint browser:true, node:true*/ -/*global define, Event, Node*/ - - -/** - * Instantiate fast-clicking listeners on the specified layer. - * - * @constructor - * @param {Element} layer The layer to listen on - * @param {Object} options The options to override the defaults - */ -function FastClick(layer, options) { - 'use strict'; - var oldOnClick; - - options = options || {}; - - /** - * Whether a click is currently being tracked. - * - * @type boolean - */ - this.trackingClick = false; - - - /** - * Timestamp for when click tracking started. - * - * @type number - */ - this.trackingClickStart = 0; - - - /** - * The element being tracked for a click. - * - * @type EventTarget - */ - this.targetElement = null; - - - /** - * X-coordinate of touch start event. - * - * @type number - */ - this.touchStartX = 0; - - - /** - * Y-coordinate of touch start event. - * - * @type number - */ - this.touchStartY = 0; - - - /** - * ID of the last touch, retrieved from Touch.identifier. - * - * @type number - */ - this.lastTouchIdentifier = 0; - - - /** - * Touchmove boundary, beyond which a click will be cancelled. - * - * @type number - */ - this.touchBoundary = options.touchBoundary || 10; - - - /** - * The FastClick layer. - * - * @type Element - */ - this.layer = layer; - - /** - * The minimum time between tap(touchstart and touchend) events - * - * @type number - */ - this.tapDelay = options.tapDelay || 200; - - if (FastClick.notNeeded(layer)) { - return; - } - - // Some old versions of Android don't have Function.prototype.bind - function bind(method, context) { - return function() { return method.apply(context, arguments); }; - } - - - var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel']; - var context = this; - for (var i = 0, l = methods.length; i < l; i++) { - context[methods[i]] = bind(context[methods[i]], context); - } - - // Set up event handlers as required - if (deviceIsAndroid) { - layer.addEventListener('mouseover', this.onMouse, true); - layer.addEventListener('mousedown', this.onMouse, true); - layer.addEventListener('mouseup', this.onMouse, true); - } - - layer.addEventListener('click', this.onClick, true); - layer.addEventListener('touchstart', this.onTouchStart, false); - layer.addEventListener('touchmove', this.onTouchMove, false); - layer.addEventListener('touchend', this.onTouchEnd, false); - layer.addEventListener('touchcancel', this.onTouchCancel, false); - - // Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2) - // which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick - // layer when they are cancelled. - if (!Event.prototype.stopImmediatePropagation) { - layer.removeEventListener = function(type, callback, capture) { - var rmv = Node.prototype.removeEventListener; - if (type === 'click') { - rmv.call(layer, type, callback.hijacked || callback, capture); - } else { - rmv.call(layer, type, callback, capture); - } - }; - - layer.addEventListener = function(type, callback, capture) { - var adv = Node.prototype.addEventListener; - if (type === 'click') { - adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) { - if (!event.propagationStopped) { - callback(event); - } - }), capture); - } else { - adv.call(layer, type, callback, capture); - } - }; - } - - // If a handler is already declared in the element's onclick attribute, it will be fired before - // FastClick's onClick handler. Fix this by pulling out the user-defined handler function and - // adding it as listener. - if (typeof layer.onclick === 'function') { - - // Android browser on at least 3.2 requires a new reference to the function in layer.onclick - // - the old one won't work if passed to addEventListener directly. - oldOnClick = layer.onclick; - layer.addEventListener('click', function(event) { - oldOnClick(event); - }, false); - layer.onclick = null; - } -} - - -/** - * Android requires exceptions. - * - * @type boolean - */ -var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0; - - -/** - * iOS requires exceptions. - * - * @type boolean - */ -var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent); - - -/** - * iOS 4 requires an exception for select elements. - * - * @type boolean - */ -var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent); - - -/** - * iOS 6.0(+?) requires the target element to be manually derived - * - * @type boolean - */ -var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS ([6-9]|\d{2})_\d/).test(navigator.userAgent); - -/** - * BlackBerry requires exceptions. - * - * @type boolean - */ -var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0; - -/** - * Determine whether a given element requires a native click. - * - * @param {EventTarget|Element} target Target DOM element - * @returns {boolean} Returns true if the element needs a native click - */ -FastClick.prototype.needsClick = function(target) { - 'use strict'; - switch (target.nodeName.toLowerCase()) { - - // Don't send a synthetic click to disabled inputs (issue #62) - case 'button': - case 'select': - case 'textarea': - if (target.disabled) { - return true; - } - - break; - case 'input': - - // File inputs need real clicks on iOS 6 due to a browser bug (issue #68) - if ((deviceIsIOS && target.type === 'file') || target.disabled) { - return true; - } - - break; - case 'label': - case 'video': - return true; - } - - return (/\bneedsclick\b/).test(target.className); -}; - - -/** - * Determine whether a given element requires a call to focus to simulate click into element. - * - * @param {EventTarget|Element} target Target DOM element - * @returns {boolean} Returns true if the element requires a call to focus to simulate native click. - */ -FastClick.prototype.needsFocus = function(target) { - 'use strict'; - switch (target.nodeName.toLowerCase()) { - case 'textarea': - return true; - case 'select': - return !deviceIsAndroid; - case 'input': - switch (target.type) { - case 'button': - case 'checkbox': - case 'file': - case 'image': - case 'radio': - case 'submit': - return false; - } - - // No point in attempting to focus disabled inputs - return !target.disabled && !target.readOnly; - default: - return (/\bneedsfocus\b/).test(target.className); - } -}; - - -/** - * Send a click event to the specified element. - * - * @param {EventTarget|Element} targetElement - * @param {Event} event - */ -FastClick.prototype.sendClick = function(targetElement, event) { - 'use strict'; - var clickEvent, touch; - - // On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24) - if (document.activeElement && document.activeElement !== targetElement) { - document.activeElement.blur(); - } - - touch = event.changedTouches[0]; - - // Synthesise a click event, with an extra attribute so it can be tracked - clickEvent = document.createEvent('MouseEvents'); - clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null); - clickEvent.forwardedTouchEvent = true; - targetElement.dispatchEvent(clickEvent); -}; - -FastClick.prototype.determineEventType = function(targetElement) { - 'use strict'; - - //Issue #159: Android Chrome Select Box does not open with a synthetic click event - if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') { - return 'mousedown'; - } - - return 'click'; -}; - - -/** - * @param {EventTarget|Element} targetElement - */ -FastClick.prototype.focus = function(targetElement) { - 'use strict'; - var length; - - // Issue #160: on iOS 7, some input elements (e.g. date datetime) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724. - if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time') { - length = targetElement.value.length; - targetElement.setSelectionRange(length, length); - } else { - targetElement.focus(); - } -}; - - -/** - * Check whether the given target element is a child of a scrollable layer and if so, set a flag on it. - * - * @param {EventTarget|Element} targetElement - */ -FastClick.prototype.updateScrollParent = function(targetElement) { - 'use strict'; - var scrollParent, parentElement; - - scrollParent = targetElement.fastClickScrollParent; - - // Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the - // target element was moved to another parent. - if (!scrollParent || !scrollParent.contains(targetElement)) { - parentElement = targetElement; - do { - if (parentElement.scrollHeight > parentElement.offsetHeight) { - scrollParent = parentElement; - targetElement.fastClickScrollParent = parentElement; - break; - } - - parentElement = parentElement.parentElement; - } while (parentElement); - } - - // Always update the scroll top tracker if possible. - if (scrollParent) { - scrollParent.fastClickLastScrollTop = scrollParent.scrollTop; - } -}; - - -/** - * @param {EventTarget} targetElement - * @returns {Element|EventTarget} - */ -FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) { - 'use strict'; - - // On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node. - if (eventTarget.nodeType === Node.TEXT_NODE) { - return eventTarget.parentNode; - } - - return eventTarget; -}; - - -/** - * On touch start, record the position and scroll offset. - * - * @param {Event} event - * @returns {boolean} - */ -FastClick.prototype.onTouchStart = function(event) { - 'use strict'; - var targetElement, touch, selection; - - // Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111). - if (event.targetTouches.length > 1) { - return true; - } - - targetElement = this.getTargetElementFromEventTarget(event.target); - touch = event.targetTouches[0]; - - if (deviceIsIOS) { - - // Only trusted events will deselect text on iOS (issue #49) - selection = window.getSelection(); - if (selection.rangeCount && !selection.isCollapsed) { - return true; - } - - if (!deviceIsIOS4) { - - // Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23): - // when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched - // with the same identifier as the touch event that previously triggered the click that triggered the alert. - // Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an - // immediately preceeding touch event (issue #52), so this fix is unavailable on that platform. - // Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string, - // which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long, - // random integers, it's safe to to continue if the identifier is 0 here. - if (touch.identifier && touch.identifier === this.lastTouchIdentifier) { - event.preventDefault(); - return false; - } - - this.lastTouchIdentifier = touch.identifier; - - // If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and: - // 1) the user does a fling scroll on the scrollable layer - // 2) the user stops the fling scroll with another tap - // then the event.target of the last 'touchend' event will be the element that was under the user's finger - // when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check - // is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42). - this.updateScrollParent(targetElement); - } - } - - this.trackingClick = true; - this.trackingClickStart = event.timeStamp; - this.targetElement = targetElement; - - this.touchStartX = touch.pageX; - this.touchStartY = touch.pageY; - - // Prevent phantom clicks on fast double-tap (issue #36) - if ((event.timeStamp - this.lastClickTime) < this.tapDelay) { - event.preventDefault(); - } - - return true; -}; - - -/** - * Based on a touchmove event object, check whether the touch has moved past a boundary since it started. - * - * @param {Event} event - * @returns {boolean} - */ -FastClick.prototype.touchHasMoved = function(event) { - 'use strict'; - var touch = event.changedTouches[0], boundary = this.touchBoundary; - - if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) { - return true; - } - - return false; -}; - - -/** - * Update the last position. - * - * @param {Event} event - * @returns {boolean} - */ -FastClick.prototype.onTouchMove = function(event) { - 'use strict'; - if (!this.trackingClick) { - return true; - } - - // If the touch has moved, cancel the click tracking - if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) { - this.trackingClick = false; - this.targetElement = null; - } - - return true; -}; - - -/** - * Attempt to find the labelled control for the given label element. - * - * @param {EventTarget|HTMLLabelElement} labelElement - * @returns {Element|null} - */ -FastClick.prototype.findControl = function(labelElement) { - 'use strict'; - - // Fast path for newer browsers supporting the HTML5 control attribute - if (labelElement.control !== undefined) { - return labelElement.control; - } - - // All browsers under test that support touch events also support the HTML5 htmlFor attribute - if (labelElement.htmlFor) { - return document.getElementById(labelElement.htmlFor); - } - - // If no for attribute exists, attempt to retrieve the first labellable descendant element - // the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label - return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea'); -}; - - -/** - * On touch end, determine whether to send a click event at once. - * - * @param {Event} event - * @returns {boolean} - */ -FastClick.prototype.onTouchEnd = function(event) { - 'use strict'; - var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement; - - if (!this.trackingClick) { - return true; - } - - // Prevent phantom clicks on fast double-tap (issue #36) - if ((event.timeStamp - this.lastClickTime) < this.tapDelay) { - this.cancelNextClick = true; - return true; - } - - // Reset to prevent wrong click cancel on input (issue #156). - this.cancelNextClick = false; - - this.lastClickTime = event.timeStamp; - - trackingClickStart = this.trackingClickStart; - this.trackingClick = false; - this.trackingClickStart = 0; - - // On some iOS devices, the targetElement supplied with the event is invalid if the layer - // is performing a transition or scroll, and has to be re-detected manually. Note that - // for this to function correctly, it must be called *after* the event target is checked! - // See issue #57; also filed as rdar://13048589 . - if (deviceIsIOSWithBadTarget) { - touch = event.changedTouches[0]; - - // In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null - targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement; - targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent; - } - - targetTagName = targetElement.tagName.toLowerCase(); - if (targetTagName === 'label') { - forElement = this.findControl(targetElement); - if (forElement) { - this.focus(targetElement); - if (deviceIsAndroid) { - return false; - } - - targetElement = forElement; - } - } else if (this.needsFocus(targetElement)) { - - // Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through. - // Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37). - if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) { - this.targetElement = null; - return false; - } - - this.focus(targetElement); - this.sendClick(targetElement, event); - - // Select elements need the event to go through on iOS 4, otherwise the selector menu won't open. - // Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others) - if (!deviceIsIOS || targetTagName !== 'select') { - this.targetElement = null; - event.preventDefault(); - } - - return false; - } - - if (deviceIsIOS && !deviceIsIOS4) { - - // Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled - // and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42). - scrollParent = targetElement.fastClickScrollParent; - if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) { - return true; - } - } - - // Prevent the actual click from going though - unless the target node is marked as requiring - // real clicks or if it is in the whitelist in which case only non-programmatic clicks are permitted. - if (!this.needsClick(targetElement)) { - event.preventDefault(); - this.sendClick(targetElement, event); - } - - return false; -}; - - -/** - * On touch cancel, stop tracking the click. - * - * @returns {void} - */ -FastClick.prototype.onTouchCancel = function() { - 'use strict'; - this.trackingClick = false; - this.targetElement = null; -}; - - -/** - * Determine mouse events which should be permitted. - * - * @param {Event} event - * @returns {boolean} - */ -FastClick.prototype.onMouse = function(event) { - 'use strict'; - - // If a target element was never set (because a touch event was never fired) allow the event - if (!this.targetElement) { - return true; - } - - if (event.forwardedTouchEvent) { - return true; - } - - // Programmatically generated events targeting a specific element should be permitted - if (!event.cancelable) { - return true; - } - - // Derive and check the target element to see whether the mouse event needs to be permitted; - // unless explicitly enabled, prevent non-touch click events from triggering actions, - // to prevent ghost/doubleclicks. - if (!this.needsClick(this.targetElement) || this.cancelNextClick) { - - // Prevent any user-added listeners declared on FastClick element from being fired. - if (event.stopImmediatePropagation) { - event.stopImmediatePropagation(); - } else { - - // Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2) - event.propagationStopped = true; - } - - // Cancel the event - event.stopPropagation(); - event.preventDefault(); - - return false; - } - - // If the mouse event is permitted, return true for the action to go through. - return true; -}; - - -/** - * On actual clicks, determine whether this is a touch-generated click, a click action occurring - * naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or - * an actual click which should be permitted. - * - * @param {Event} event - * @returns {boolean} - */ -FastClick.prototype.onClick = function(event) { - 'use strict'; - var permitted; - - // It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early. - if (this.trackingClick) { - this.targetElement = null; - this.trackingClick = false; - return true; - } - - // Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target. - if (event.target.type === 'submit' && event.detail === 0) { - return true; - } - - permitted = this.onMouse(event); - - // Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through. - if (!permitted) { - this.targetElement = null; - } - - // If clicks are permitted, return true for the action to go through. - return permitted; -}; - - -/** - * Remove all FastClick's event listeners. - * - * @returns {void} - */ -FastClick.prototype.destroy = function() { - 'use strict'; - var layer = this.layer; - - if (deviceIsAndroid) { - layer.removeEventListener('mouseover', this.onMouse, true); - layer.removeEventListener('mousedown', this.onMouse, true); - layer.removeEventListener('mouseup', this.onMouse, true); - } - - layer.removeEventListener('click', this.onClick, true); - layer.removeEventListener('touchstart', this.onTouchStart, false); - layer.removeEventListener('touchmove', this.onTouchMove, false); - layer.removeEventListener('touchend', this.onTouchEnd, false); - layer.removeEventListener('touchcancel', this.onTouchCancel, false); -}; - - -/** - * Check whether FastClick is needed. - * - * @param {Element} layer The layer to listen on - */ -FastClick.notNeeded = function(layer) { - 'use strict'; - var metaViewport; - var chromeVersion; - var blackberryVersion; - - // Devices that don't support touch don't need FastClick - if (typeof window.ontouchstart === 'undefined') { - return true; - } - - // Chrome version - zero for other browsers - chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1]; - - if (chromeVersion) { - - if (deviceIsAndroid) { - metaViewport = document.querySelector('meta[name=viewport]'); - - if (metaViewport) { - // Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89) - if (metaViewport.content.indexOf('user-scalable=no') !== -1) { - return true; - } - // Chrome 32 and above with width=device-width or less don't need FastClick - if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) { - return true; - } - } - - // Chrome desktop doesn't need FastClick (issue #15) - } else { - return true; - } - } - - if (deviceIsBlackBerry10) { - blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/); - - // BlackBerry 10.3+ does not require Fastclick library. - // https://github.com/ftlabs/fastclick/issues/251 - if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) { - metaViewport = document.querySelector('meta[name=viewport]'); - - if (metaViewport) { - // user-scalable=no eliminates click delay. - if (metaViewport.content.indexOf('user-scalable=no') !== -1) { - return true; - } - // width=device-width (or less than device-width) eliminates click delay. - if (document.documentElement.scrollWidth <= window.outerWidth) { - return true; - } - } - } - } - - // IE10 with -ms-touch-action: none, which disables double-tap-to-zoom (issue #97) - if (layer.style.msTouchAction === 'none') { - return true; - } - - return false; -}; - - -/** - * Factory method for creating a FastClick object - * - * @param {Element} layer The layer to listen on - * @param {Object} options The options to override the defaults - */ -FastClick.attach = function(layer, options) { - 'use strict'; - return new FastClick(layer, options); -}; - - -if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { - - // AMD. Register as an anonymous module. - define(function() { - 'use strict'; - return FastClick; - }); -} else if (typeof module !== 'undefined' && module.exports) { - module.exports = FastClick.attach; - module.exports.FastClick = FastClick; -} else { - window.FastClick = FastClick; -} diff --git a/js/external/jquery.cookie-1.4.1.min.js b/js/external/jquery.cookie-1.4.1.min.js deleted file mode 100644 index c0f19d8..0000000 --- a/js/external/jquery.cookie-1.4.1.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jquery.cookie v1.4.1 | MIT */ -!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}}); \ No newline at end of file diff --git a/js/external/jquery.ui.touch-punch.min.js b/js/external/jquery.ui.touch-punch.min.js deleted file mode 100644 index 31272ce..0000000 --- a/js/external/jquery.ui.touch-punch.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! - * jQuery UI Touch Punch 0.2.3 - * - * Copyright 2011–2014, Dave Furfero - * Dual licensed under the MIT or GPL Version 2 licenses. - * - * Depends: - * jquery.ui.widget.js - * jquery.ui.mouse.js - */ -!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); \ No newline at end of file diff --git a/package.json b/package.json index 0f87d10..d86dcba 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "sciencealchemy", - "version": "0.0.5", - "description": "Science Alchemy", + "name": "CardsForScience", + "version": "0.0.6", + "description": "Cards For Science", "keywords": [ "cards", "inductive", @@ -10,20 +10,21 @@ "eleusis" ], "main": "index.js", - "repository": "https://gitlab.com/wassname/sciencealchemy", + "repository": "https://gitlab.com/wassname/cardsforscience", "directories": { "test": "tests" }, "scripts": { "postinstall": "bower install", "prestart": "npm install", - "dev": "webpack-dev-server -d", + "dev": "webpack-dev-server -d --progress", "start": "webpack-dev-server", - "prod": "NODE_ENV=production & webpack-dev-server", + "prod": "NODE_ENV=production webpack-dev-server", "pretest": "npm install", "test": "node node_modules/karma/bin/karma start test/karma.conf.js", "test-single-run": "node node_modules/karma/bin/karma start test/karma.conf.js --single-run", - "build": "webpack", + "build": "webpack --display-error-details", + "dist": "NODE_ENV=production webpack --display-error-details --progress", "preupdate-webdriver": "npm install", "update-webdriver": "webdriver-manager update", "preprotractor": "npm run update-webdriver", @@ -51,6 +52,7 @@ "babel-loader": "^6.2.4", "bower": "^1.7.7", "colors": "^1.1.2", + "concurrent-transform": "^1.0.0", "css-loader": "^0.23.1", "csswring": "^4.2.1", "eslint": "^2.2.0", @@ -59,11 +61,18 @@ "exports-loader": "^0.6.3", "extract-text-webpack-plugin": "^1.0.1", "file-loader": "^0.8.5", + "fs": "0.0.2", "gulp-awspublish": "^3.0.1", + "gulp-debug": "^2.1.2", + "gulp-rename": "^1.2.2", + "gulp-util": "^3.0.7", + "html-minifier": "^1.2.0", + "html-minify-loader": "^1.1.0", "html-webpack-plugin": "^2.9.0", "http-server": "^0.9.0", "imports-loader": "^0.6.5", "jasmine": "^2.4.1", + "json-loader": "^0.5.4", "karma": "^0.13.21", "karma-chrome-launcher": "^0.2.2", "karma-firefox-launcher": "^0.1.7", @@ -77,6 +86,8 @@ "tmp": "0.0.28", "url-loader": "^0.5.7", "webdriver": "0.0.1", - "webpack": "^1.12.14" + "webpack": "^1.12.14", + "webpack-config": "^4.0.0", + "webpack-stream": "^3.1.0" } } diff --git a/assets/favicon.ico b/src/assets/favicon.ico similarity index 100% rename from assets/favicon.ico rename to src/assets/favicon.ico diff --git a/assets/favicon.png b/src/assets/favicon.png similarity index 100% rename from assets/favicon.png rename to src/assets/favicon.png diff --git a/assets/icons/png/BBbar.png b/src/assets/icons/png/BBbar.png similarity index 100% rename from assets/icons/png/BBbar.png rename to src/assets/icons/png/BBbar.png diff --git a/assets/icons/png/BBbar@2x.png b/src/assets/icons/png/BBbar@2x.png similarity index 100% rename from assets/icons/png/BBbar@2x.png rename to src/assets/icons/png/BBbar@2x.png diff --git a/assets/icons/png/CPV.png b/src/assets/icons/png/CPV.png similarity index 100% rename from assets/icons/png/CPV.png rename to src/assets/icons/png/CPV.png diff --git a/assets/icons/png/CPV@2x.png b/src/assets/icons/png/CPV@2x.png similarity index 100% rename from assets/icons/png/CPV@2x.png rename to src/assets/icons/png/CPV@2x.png diff --git a/assets/icons/png/Dstar_s.png b/src/assets/icons/png/Dstar_s.png similarity index 100% rename from assets/icons/png/Dstar_s.png rename to src/assets/icons/png/Dstar_s.png diff --git a/assets/icons/png/Dstar_s@2x.png b/src/assets/icons/png/Dstar_s@2x.png similarity index 100% rename from assets/icons/png/Dstar_s@2x.png rename to src/assets/icons/png/Dstar_s@2x.png diff --git a/assets/icons/png/H.png b/src/assets/icons/png/H.png similarity index 100% rename from assets/icons/png/H.png rename to src/assets/icons/png/H.png diff --git a/assets/icons/png/H@2x.png b/src/assets/icons/png/H@2x.png similarity index 100% rename from assets/icons/png/H@2x.png rename to src/assets/icons/png/H@2x.png diff --git a/assets/icons/png/Jpsi.png b/src/assets/icons/png/Jpsi.png similarity index 100% rename from assets/icons/png/Jpsi.png rename to src/assets/icons/png/Jpsi.png diff --git a/assets/icons/png/Jpsi@2x.png b/src/assets/icons/png/Jpsi@2x.png similarity index 100% rename from assets/icons/png/Jpsi@2x.png rename to src/assets/icons/png/Jpsi@2x.png diff --git a/assets/icons/png/Xi_b.png b/src/assets/icons/png/Xi_b.png similarity index 100% rename from assets/icons/png/Xi_b.png rename to src/assets/icons/png/Xi_b.png diff --git a/assets/icons/png/Xi_b@2x.png b/src/assets/icons/png/Xi_b@2x.png similarity index 100% rename from assets/icons/png/Xi_b@2x.png rename to src/assets/icons/png/Xi_b@2x.png diff --git a/assets/icons/png/b.png b/src/assets/icons/png/b.png similarity index 100% rename from assets/icons/png/b.png rename to src/assets/icons/png/b.png diff --git a/assets/icons/png/b@2x.png b/src/assets/icons/png/b@2x.png similarity index 100% rename from assets/icons/png/b@2x.png rename to src/assets/icons/png/b@2x.png diff --git a/assets/icons/png/gluons.png b/src/assets/icons/png/gluons.png similarity index 100% rename from assets/icons/png/gluons.png rename to src/assets/icons/png/gluons.png diff --git a/assets/icons/png/gluons@2x.png b/src/assets/icons/png/gluons@2x.png similarity index 100% rename from assets/icons/png/gluons@2x.png rename to src/assets/icons/png/gluons@2x.png diff --git a/assets/icons/png/t.png b/src/assets/icons/png/t.png similarity index 100% rename from assets/icons/png/t.png rename to src/assets/icons/png/t.png diff --git a/assets/icons/png/t@2x.png b/src/assets/icons/png/t@2x.png similarity index 100% rename from assets/icons/png/t@2x.png rename to src/assets/icons/png/t@2x.png diff --git a/assets/icons/png/tau.png b/src/assets/icons/png/tau.png similarity index 100% rename from assets/icons/png/tau.png rename to src/assets/icons/png/tau.png diff --git a/assets/icons/png/tau@2x.png b/src/assets/icons/png/tau@2x.png similarity index 100% rename from assets/icons/png/tau@2x.png rename to src/assets/icons/png/tau@2x.png diff --git a/assets/icons/png/unknown.png b/src/assets/icons/png/unknown.png similarity index 100% rename from assets/icons/png/unknown.png rename to src/assets/icons/png/unknown.png diff --git a/assets/icons/png/unknown@2x.png b/src/assets/icons/png/unknown@2x.png similarity index 100% rename from assets/icons/png/unknown@2x.png rename to src/assets/icons/png/unknown@2x.png diff --git a/assets/icons/png/weak.png b/src/assets/icons/png/weak.png similarity index 100% rename from assets/icons/png/weak.png rename to src/assets/icons/png/weak.png diff --git a/assets/icons/png/weak@2x.png b/src/assets/icons/png/weak@2x.png similarity index 100% rename from assets/icons/png/weak@2x.png rename to src/assets/icons/png/weak@2x.png diff --git a/assets/icons/svg/BBbar.svg b/src/assets/icons/svg/BBbar.svg similarity index 100% rename from assets/icons/svg/BBbar.svg rename to src/assets/icons/svg/BBbar.svg diff --git a/assets/icons/svg/CPV.svg b/src/assets/icons/svg/CPV.svg similarity index 100% rename from assets/icons/svg/CPV.svg rename to src/assets/icons/svg/CPV.svg diff --git a/assets/icons/svg/Dstar_s.svg b/src/assets/icons/svg/Dstar_s.svg similarity index 100% rename from assets/icons/svg/Dstar_s.svg rename to src/assets/icons/svg/Dstar_s.svg diff --git a/assets/icons/svg/H.svg b/src/assets/icons/svg/H.svg similarity index 100% rename from assets/icons/svg/H.svg rename to src/assets/icons/svg/H.svg diff --git a/assets/icons/svg/Jpsi.svg b/src/assets/icons/svg/Jpsi.svg similarity index 100% rename from assets/icons/svg/Jpsi.svg rename to src/assets/icons/svg/Jpsi.svg diff --git a/assets/icons/svg/Xi_b.svg b/src/assets/icons/svg/Xi_b.svg similarity index 100% rename from assets/icons/svg/Xi_b.svg rename to src/assets/icons/svg/Xi_b.svg diff --git a/assets/icons/svg/b.svg b/src/assets/icons/svg/b.svg similarity index 100% rename from assets/icons/svg/b.svg rename to src/assets/icons/svg/b.svg diff --git a/assets/icons/svg/gluons.svg b/src/assets/icons/svg/gluons.svg similarity index 100% rename from assets/icons/svg/gluons.svg rename to src/assets/icons/svg/gluons.svg diff --git a/assets/icons/svg/t.svg b/src/assets/icons/svg/t.svg similarity index 100% rename from assets/icons/svg/t.svg rename to src/assets/icons/svg/t.svg diff --git a/assets/icons/svg/tau.svg b/src/assets/icons/svg/tau.svg similarity index 100% rename from assets/icons/svg/tau.svg rename to src/assets/icons/svg/tau.svg diff --git a/assets/icons/svg/unknown.svg b/src/assets/icons/svg/unknown.svg similarity index 100% rename from assets/icons/svg/unknown.svg rename to src/assets/icons/svg/unknown.svg diff --git a/assets/icons/svg/weak.svg b/src/assets/icons/svg/weak.svg similarity index 100% rename from assets/icons/svg/weak.svg rename to src/assets/icons/svg/weak.svg diff --git a/assets/info/b.png b/src/assets/info/b.png similarity index 100% rename from assets/info/b.png rename to src/assets/info/b.png diff --git a/assets/info/cpv.png b/src/assets/info/cpv.png similarity index 100% rename from assets/info/cpv.png rename to src/assets/info/cpv.png diff --git a/assets/info/jpsi.png b/src/assets/info/jpsi.png similarity index 100% rename from assets/info/jpsi.png rename to src/assets/info/jpsi.png diff --git a/assets/info/t.png b/src/assets/info/t.png similarity index 100% rename from assets/info/t.png rename to src/assets/info/t.png diff --git a/assets/info/tau.png b/src/assets/info/tau.png similarity index 100% rename from assets/info/tau.png rename to src/assets/info/tau.png diff --git a/assets/info/w.png b/src/assets/info/w.png similarity index 100% rename from assets/info/w.png rename to src/assets/info/w.png diff --git a/assets/mobile/flame-icon.svg b/src/assets/mobile/flame-icon.svg similarity index 100% rename from assets/mobile/flame-icon.svg rename to src/assets/mobile/flame-icon.svg diff --git a/assets/mobile/icon-72.png b/src/assets/mobile/icon-72.png similarity index 100% rename from assets/mobile/icon-72.png rename to src/assets/mobile/icon-72.png diff --git a/assets/mobile/icon-72@2x.png b/src/assets/mobile/icon-72@2x.png similarity index 100% rename from assets/mobile/icon-72@2x.png rename to src/assets/mobile/icon-72@2x.png diff --git a/assets/mobile/icon.png b/src/assets/mobile/icon.png similarity index 100% rename from assets/mobile/icon.png rename to src/assets/mobile/icon.png diff --git a/assets/mobile/icon@2x.png b/src/assets/mobile/icon@2x.png similarity index 100% rename from assets/mobile/icon@2x.png rename to src/assets/mobile/icon@2x.png diff --git a/assets/mobile/original.png b/src/assets/mobile/original.png similarity index 100% rename from assets/mobile/original.png rename to src/assets/mobile/original.png diff --git a/assets/pc32.png b/src/assets/pc32.png similarity index 100% rename from assets/pc32.png rename to src/assets/pc32.png diff --git a/assets/pc32@2x.png b/src/assets/pc32@2x.png similarity index 100% rename from assets/pc32@2x.png rename to src/assets/pc32@2x.png diff --git a/assets/pc32sw.png b/src/assets/pc32sw.png similarity index 100% rename from assets/pc32sw.png rename to src/assets/pc32sw.png diff --git a/assets/pc32sw@2x.png b/src/assets/pc32sw@2x.png similarity index 100% rename from assets/pc32sw@2x.png rename to src/assets/pc32sw@2x.png diff --git a/css/bootstrap.min.css b/src/css/bootstrap.min.css old mode 100755 new mode 100644 similarity index 100% rename from css/bootstrap.min.css rename to src/css/bootstrap.min.css diff --git a/css/style.css b/src/css/style.css similarity index 99% rename from css/style.css rename to src/css/style.css index 5bb1e08..171dbdc 100644 --- a/css/style.css +++ b/src/css/style.css @@ -102,18 +102,12 @@ h1 br { top: -1.42857em; height: 1.42857em; } - .update-plus { color: green; - /*right: -1em;*/ - /*top: -1em;*/ position: relative; } - .update-minus { color: red; - /*right: -1em;*/ - /*top: -1em;*/ position: relative; } @@ -432,7 +426,7 @@ h1 br { /*margin: 10px;*/ border:2px red solid; border-radius: 5px; - min-height: 200px; + min-height: 400px; } .card-line{ margin-bottom: 5px; diff --git a/css/ui-grid.css b/src/css/ui-grid.css similarity index 100% rename from css/ui-grid.css rename to src/css/ui-grid.css diff --git a/fonts/glyphicons-halflings-regular.eot b/src/fonts/glyphicons-halflings-regular.eot old mode 100755 new mode 100644 similarity index 100% rename from fonts/glyphicons-halflings-regular.eot rename to src/fonts/glyphicons-halflings-regular.eot diff --git a/fonts/glyphicons-halflings-regular.svg b/src/fonts/glyphicons-halflings-regular.svg old mode 100755 new mode 100644 similarity index 100% rename from fonts/glyphicons-halflings-regular.svg rename to src/fonts/glyphicons-halflings-regular.svg diff --git a/fonts/glyphicons-halflings-regular.ttf b/src/fonts/glyphicons-halflings-regular.ttf old mode 100755 new mode 100644 similarity index 100% rename from fonts/glyphicons-halflings-regular.ttf rename to src/fonts/glyphicons-halflings-regular.ttf diff --git a/fonts/glyphicons-halflings-regular.woff b/src/fonts/glyphicons-halflings-regular.woff old mode 100755 new mode 100644 similarity index 100% rename from fonts/glyphicons-halflings-regular.woff rename to src/fonts/glyphicons-halflings-regular.woff diff --git a/fonts/ui-grid.eot b/src/fonts/ui-grid.eot similarity index 100% rename from fonts/ui-grid.eot rename to src/fonts/ui-grid.eot diff --git a/fonts/ui-grid.svg b/src/fonts/ui-grid.svg similarity index 100% rename from fonts/ui-grid.svg rename to src/fonts/ui-grid.svg diff --git a/fonts/ui-grid.ttf b/src/fonts/ui-grid.ttf similarity index 100% rename from fonts/ui-grid.ttf rename to src/fonts/ui-grid.ttf diff --git a/fonts/ui-grid.woff b/src/fonts/ui-grid.woff similarity index 100% rename from fonts/ui-grid.woff rename to src/fonts/ui-grid.woff diff --git a/html/detector.html b/src/html/detector.html similarity index 100% rename from html/detector.html rename to src/html/detector.html diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..1af95c2 --- /dev/null +++ b/src/index.js @@ -0,0 +1,47 @@ +/** App imports **/ + +// css +require("css/bootstrap.min.css"); +require("font-awesome/css/font-awesome.css"); +// require("font-awesome/scss/font-awesome.scss"); +// require("bower_components/angular-ui-grid/ui-grid.min.css"); +// require("css/ui-grid.css"); +require("css/style.css"); + +// img +require("assets/favicon.png"); +require("assets/mobile/icon.png"); +require("assets/mobile/icon.png"); +require("assets/pc32sw.png"); + +// json +// var element = require("json/elements.json"); +// var acheivements = require("json/achievements.json"); + +// deps +// var jquery = require("jquery"); +// var jqueryUi = require("jquery-ui"); +// var jqueryUiTouchPunch = require("jquery-ui-touch-punch"); +// var jqueryCookie = require("js-cookie"); +// +var bootstrap = require("bootstrap"); +// // var retina = require("retina"); +// var FastClick = require("fastclick"); +// +// var chai = require("chai"); +// var lodash = require("lodash"); +// +// var angular = require("angular"); +// var angularDragdrop = require("angular-dragdrop"); +// var angularAnimate = require("angular-animate"); + + +// app +// var ObjectStorage = require("js/storage.js"); +// var Helpers = require("js/helpers.js"); +// var Analytics = require("js/analytics.js"); +// var GameObjects = require("js/gameobjects.js"); +// var Rules = require("js/rules.js"); +// var UI = require("js/ui.js"); +// var Game = require("js/game.js"); +var app = require("js/app.js"); diff --git a/webpack.html b/src/index.webpack similarity index 91% rename from webpack.html rename to src/index.webpack index 40d7bba..c5dd0cc 100644 --- a/webpack.html +++ b/src/index.webpack @@ -1,11 +1,11 @@ - +
-