Pas d'en-tête en mode iframe
parent
f857e369c1
commit
921497ea52
|
@ -23,6 +23,7 @@ var scriptEl = document.createElement('script')
|
|||
scriptEl.setAttribute('type', 'text/javascript')
|
||||
scriptEl.setAttribute('src', 'dist/bundle.js')
|
||||
scriptEl.setAttribute('couleur', '#' + couleur)
|
||||
scriptEl.setAttribute('iframe', true)
|
||||
document.body.appendChild(scriptEl)
|
||||
</script>
|
||||
<script src="https://use.fontawesome.com/1da10bbdec.js"></script>
|
||||
|
|
25
package.json
25
package.json
|
@ -40,7 +40,6 @@
|
|||
"reduce-reducers": "^0.1.2",
|
||||
"redux": "^3.7.2",
|
||||
"redux-form": "6.8.0",
|
||||
"redux-saga": "^0.15.3",
|
||||
"reselect": "^3.0.1",
|
||||
"whatwg-fetch": "^2.0.3",
|
||||
"yaml-loader": "^0.5.0"
|
||||
|
@ -95,13 +94,21 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "node source/server.js",
|
||||
"compile": "NODE_ENV='production' webpack --config source/webpack.config.js",
|
||||
"surge": "npm run compile && surge --domain scientific-wish.surge.sh -p ./ && rm -rf dist/",
|
||||
"test": "mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js \"test/**/*.test.js\"",
|
||||
"test-watch": "mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js \"test/**/*.test.js\" --watch",
|
||||
"test-meca": "mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js test/mecanisms.test.js --watch",
|
||||
"test-rules": "mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js test/real-rules.test.js --watch",
|
||||
"heroku-postbuild": "npm install --dev && webpack --config source/webpack.config.js --progress",
|
||||
"test-inversions": "mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js \"test/inversion.test.js\" --watch"
|
||||
"compile":
|
||||
"NODE_ENV='production' webpack --config source/webpack.config.js",
|
||||
"surge":
|
||||
"npm run compile && surge --domain scientific-wish.surge.sh -p ./ && rm -rf dist/",
|
||||
"test":
|
||||
"mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js \"test/**/*.test.js\"",
|
||||
"test-watch":
|
||||
"mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js \"test/**/*.test.js\" --watch",
|
||||
"test-meca":
|
||||
"mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js test/mecanisms.test.js --watch",
|
||||
"test-rules":
|
||||
"mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js test/real-rules.test.js --watch",
|
||||
"heroku-postbuild":
|
||||
"npm install --dev && webpack --config source/webpack.config.js --progress",
|
||||
"test-inversions":
|
||||
"mocha-webpack --webpack-config source/webpack.test.config.js --require source-map-support/register --require test/helpers/browser.js \"test/inversion.test.js\" --watch"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import React, { Component } from 'react'
|
||||
import 'Components/pages/Header.css'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { getJsScriptAttribute } from '../../utils'
|
||||
|
||||
export default class Header extends Component {
|
||||
state = {
|
||||
|
@ -15,6 +16,8 @@ export default class Header extends Component {
|
|||
)
|
||||
if (!displayHeader) return null
|
||||
|
||||
if (getJsScriptAttribute('iframe')()) return null
|
||||
|
||||
return (
|
||||
<div id="header">
|
||||
<Link id="brand" to="/">
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
import findContrastedTextColour from './findContrastedTextColour'
|
||||
import { getJsScriptAttribute } from '../utils'
|
||||
|
||||
export default forcedThemeColour => {
|
||||
let scriptColour = () => {
|
||||
let script =
|
||||
document.currentScript ||
|
||||
[...document.getElementsByTagName('script')].pop()
|
||||
return script && script.getAttribute('couleur')
|
||||
},
|
||||
let scriptColour = getJsScriptAttribute('couleur'),
|
||||
// Use the default theme colour if the host page hasn't made a choice
|
||||
defaultColour = '#2975D1',
|
||||
colour = forcedThemeColour || scriptColour() || defaultColour,
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { Component } from 'react'
|
|||
import './Layout.css'
|
||||
import './reset.css'
|
||||
|
||||
import { Link, Route, Router, Switch, Redirect } from 'react-router-dom'
|
||||
import { Route, Router, Switch, Redirect } from 'react-router-dom'
|
||||
|
||||
import Home from 'Components/pages/Home'
|
||||
import RulePage from 'Components/RulePage'
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
export let capitalise0 = name => name[0].toUpperCase() + name.slice(1)
|
||||
export let getJsScriptAttribute = attribute => () => {
|
||||
let script =
|
||||
document.currentScript || [...document.getElementsByTagName('script')].pop()
|
||||
return script && script.getAttribute(attribute)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue