🐛 :ie: 💩 Répare les bugs sur IE

pull/294/head
Johan Girod 2018-07-18 15:14:55 +02:00 committed by Mael
parent 13610f76d5
commit 336266b2b3
6 changed files with 31 additions and 18 deletions

View File

@ -26,8 +26,16 @@
<body>
<div id="js" />
<script src="https://use.fontawesome.com/1da10bbdec.js"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,Intl.~locale.en,Intl.~locale.fr,IntersectionObserver,fetch,Array.prototype.find,Object.values,
Number.parseFloat&unknown=polyfill"></script>
<script type="text/javascript">
if (/MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
// For ie, polyfill everything, as I can't figure what's going on, and which polyfill is missing...
document.write('<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=all"><\/script>');
} else {
document.write(
'<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,Intl.~locale.en,Intl.~locale.fr,IntersectionObserver,fetch,Array.prototype.find,Object.values,Number.parseFloat,Array.prototype.includes,Object.entries,Object.values,Object.keys,Math.log2&unknown=polyfill"><\/script>');
}
</script>
</body>
</html>

View File

@ -1,6 +1,7 @@
import classnames from 'classnames'
import { dissoc } from 'ramda'
import React, { Component } from 'react'
import { isIE } from '../../utils'
import './CurrencyInput.css'
let isCurrencyPrefixed = language =>
@ -11,16 +12,6 @@ let isCurrencyPrefixed = language =>
.format(12)
.match(/€.*12/)
function isIE() {
return (
navigator.appName == 'Microsoft Internet Explorer' ||
(navigator.appName == 'Netscape' &&
new RegExp('Trident/.*rv:([0-9]{1,}[.0-9]{0,})').exec(
navigator.userAgent
) != null)
)
}
class CurrencyInput extends Component {
state = {
value: ''

View File

@ -4,6 +4,8 @@ import Observer from '@researchgate/react-intersection-observer'
import withColours from 'Components/utils/withColours'
import React, { Component } from 'react'
import emoji from 'react-easy-emoji'
import { isIE } from '../utils'
import { Trans } from 'react-i18next'
import { connect } from 'react-redux'
import { config, Spring } from 'react-spring'
@ -157,11 +159,14 @@ let ChartItemBar = ({ styles, colour, montant, total }) => (
<div
className="distribution-chart__bar"
style={{
flex: styles.flex,
backgroundColor: colour
backgroundColor: colour,
...(!isIE() ?
{flex: styles.flex} :
{minWidth: styles.flex * 500 + 'px'}
)
}}
/>
<div style={{ flex: 0 }}>
<div>
<Montant
className="distribution-chart__amount"
numFractionDigit={0}

View File

@ -8,7 +8,7 @@ export type Tracker = {
connectToHistory: Function
}
export const defaultTracker: Tracker = {
push: console.log, // eslint-disable-line no-console
push: (console && console.log) || (() => {}), // eslint-disable-line no-console
connectToHistory: history => history
}
const TrackerContext = createContext(defaultTracker)

View File

@ -17,7 +17,6 @@ let lang =
queryString.parse(location.search)['lang'] ||
parseDataAttributes(getFromSessionStorage('lang')) ||
'fr'
console.log('i18n', lang)
setToSessionStorage('lang', lang)
i18next.init(
@ -31,7 +30,7 @@ i18next.init(
}
},
(err, t) => {
console.log('Error from i18n load', err, t) //eslint-disable-line no-console
console && console.error('Error from i18n load', err, t) //eslint-disable-line no-console
}
)

View File

@ -35,3 +35,13 @@ export function debounce<ArgType: any>(
timeoutId = setTimeout(() => fn(...args), timeout)
}
}
export function isIE() {
return (
navigator.appName == 'Microsoft Internet Explorer' ||
(navigator.appName == 'Netscape' &&
new RegExp('Trident/.*rv:([0-9]{1,}[.0-9]{0,})').exec(
navigator.userAgent
) != null)
)
}