GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — snoopymod.github.io/src/playground/render-gui.jsx at develop · SnoopyMod/snoopymod.github.io Expand file tree/ Copy pathrender-gui.jsxMore file actions 85 lines (74 loc) · 2.89 KB / Copy pathrender-gui.jsxFile metadata and controls85 lines (74 loc) · 2.89 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 import React from 'react'; import ReactDOM from 'react-dom'; import {compose} from 'redux'; import AppStateHOC from '../lib/app-state-hoc.jsx'; import GUI from '../containers/gui.jsx'; import HashParserHOC from '../lib/hash-parser-hoc.jsx'; import log from '../lib/log.js'; const onClickLogo = () => { window.location = 'https://scratch.mit.edu'; }; const handleTelemetryModalCancel = () => { log('User canceled telemetry modal'); }; const handleTelemetryModalOptIn = () => { log('User opted into telemetry'); }; const handleTelemetryModalOptOut = () => { log('User opted out of telemetry'); }; /* * Render the GUI playground. This is a separate function because importing anything * that instantiates the VM causes unsupported browsers to crash * {object} appTarget - the DOM element to render to */ export default appTarget => { GUI.setAppElement(appTarget); // note that redux's 'compose' function is just being used as a general utility to make // the hierarchy of HOC constructor calls clearer here; it has nothing to do with redux's // ability to compose reducers. const WrappedGui = compose( AppStateHOC, HashParserHOC )(GUI); // TODO a hack for testing the backpack, allow backpack host to be set by url param const backpackHostMatches = window.location.href.match(/[?&]backpack_host=([^&]*)&?/); const backpackHost = backpackHostMatches ? backpackHostMatches[1] : null; const scratchDesktopMatches = window.location.href.match(/[?&]isScratchDesktop=([^&]+)/); let simulateScratchDesktop; if (scratchDesktopMatches) { try { // parse 'true' into `true`, 'false' into `false`, etc. simulateScratchDesktop = JSON.parse(scratchDesktopMatches[1]); } catch { // it's not JSON so just use the string // note that a typo like "falsy" will be treated as true simulateScratchDesktop = scratchDesktopMatches[1]; } } if (process.env.NODE_ENV === 'production' && typeof window === 'object') { // Warn before navigating away window.onbeforeunload = () => true; } ReactDOM.render( // important: this is checking whether `simulateScratchDesktop` is truthy, not just defined! simulateScratchDesktop ? <WrappedGui canEditTitle isScratchDesktop showTelemetryModal canSave={false} onTelemetryModalCancel={handleTelemetryModalCancel} onTelemetryModalOptIn={handleTelemetryModalOptIn} onTelemetryModalOptOut={handleTelemetryModalOptOut} /> : <WrappedGui canEditTitle backpackVisible showComingSoon backpackHost={backpackHost} canSave={false} onClickLogo={onClickLogo} />, appTarget); }; |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |