Imports for index.js

This commit is contained in:
Tim Mickel 2016-01-13 16:04:36 -05:00
parent b7b1520a55
commit 0563821d6b

View file

@ -1,25 +1,27 @@
import {Lib, isAndroid, isiOS} from '../utils/lib'; import {isAndroid, isiOS, gn, getUrlVars, preprocessAndLoadCss} from '../utils/lib';
import Localization from '../utils/Localization'; import Localization from '../utils/Localization';
import iOS from '../iPad/iOS';
import ScratchAudio from '../utils/ScratchAudio';
function startup () { function startup () {
ScratchAudio.init(); ScratchAudio.init();
var urlvars = Lib.getUrlVars(); var urlvars = getUrlVars();
if (urlvars.back) { if (urlvars.back) {
loadOptions(); loadOptions();
} else { } else {
firstTime(); firstTime();
} }
setTimeout(function () { setTimeout(function () {
Lib.gn('rays').className = 'rays spinme'; gn('rays').className = 'rays spinme';
}, 250); }, 250);
} }
function firstTime () { function firstTime () {
Lib.gn('authors').className = 'credits show'; gn('authors').className = 'credits show';
Lib.gn('authorsText').className = 'creditsText show'; gn('authorsText').className = 'creditsText show';
Lib.gn('purpleguy').className = 'purple show'; gn('purpleguy').className = 'purple show';
Lib.gn('blueguy').className = 'blue show'; gn('blueguy').className = 'blue show';
Lib.gn('redguy').className = 'red show'; gn('redguy').className = 'red show';
iOS.askpermission(); // ask for sound recording iOS.askpermission(); // ask for sound recording
setTimeout(function () { setTimeout(function () {
iOS.hidesplash(doit); iOS.hidesplash(doit);
@ -36,13 +38,13 @@ function firstTime () {
} }
function loadOptions () { function loadOptions () {
Lib.gn('authors').className = 'credits hide'; gn('authors').className = 'credits hide';
Lib.gn('authorsText').className = 'creditsText hide'; gn('authorsText').className = 'creditsText hide';
Lib.gn('purpleguy').className = 'purple hide'; gn('purpleguy').className = 'purple hide';
Lib.gn('blueguy').className = 'blue hide'; gn('blueguy').className = 'blue hide';
Lib.gn('redguy').className = 'red hide'; gn('redguy').className = 'red hide';
Lib.gn('gettings').className = 'gettings show'; gn('gettings').className = 'gettings show';
Lib.gn('startcode').className = 'startcode show'; gn('startcode').className = 'startcode show';
document.ontouchmove = function (e) { document.ontouchmove = function (e) {
e.preventDefault(); e.preventDefault();
}; };
@ -74,12 +76,12 @@ function gettingstarted () {
window.onload = () => { window.onload = () => {
Localization.includeLocales(); Localization.includeLocales();
Lib.preprocessAndLoadCss('css', 'css/font.css'); preprocessAndLoadCss('css', 'css/font.css');
Lib.preprocessAndLoadCss('css', 'css/base.css'); preprocessAndLoadCss('css', 'css/base.css');
Lib.preprocessAndLoadCss('css', 'css/start.css'); preprocessAndLoadCss('css', 'css/start.css');
Lib.preprocessAndLoadCss('css', 'css/thumbs.css'); preprocessAndLoadCss('css', 'css/thumbs.css');
Lib.gn('gettings').ontouchend = gettingstarted; gn('gettings').ontouchend = gettingstarted;
Lib.gn('startcode').ontouchend = gohome; gn('startcode').ontouchend = gohome;
iOS.waitForInterface(startup); iOS.waitForInterface(startup);
}; };