diff --git a/src/components/Screens/WebViewScreen.js b/src/components/Screens/WebViewScreen.js index f8fd665..5af746d 100644 --- a/src/components/Screens/WebViewScreen.js +++ b/src/components/Screens/WebViewScreen.js @@ -21,6 +21,7 @@ type Props = { theme: CustomTheme, url: string, customJS: string, + customPaddingFunction: null | (padding: number) => string, collapsibleStack: Collapsible, onMessage: Function, onScroll: Function, @@ -37,6 +38,7 @@ class WebViewScreen extends React.PureComponent { static defaultProps = { customJS: '', showAdvancedControls: true, + customPaddingFunction: null, }; webviewRef: Object; @@ -157,8 +159,10 @@ class WebViewScreen extends React.PureComponent { getRenderLoading = () => ; getJavascriptPadding(padding: number) { + const customPadding = this.props.customPaddingFunction != null ? this.props.customPaddingFunction(padding) : ""; return ( "document.getElementsByTagName('body')[0].style.paddingTop = '" + padding + "px';" + + customPadding + "true;" ); } diff --git a/src/screens/Services/Websites/WiketudWebsiteScreen.js b/src/screens/Services/Websites/WiketudWebsiteScreen.js index d4eda67..c075fd7 100644 --- a/src/screens/Services/Websites/WiketudWebsiteScreen.js +++ b/src/screens/Services/Websites/WiketudWebsiteScreen.js @@ -4,6 +4,17 @@ import * as React from 'react'; import WebViewScreen from "../../../components/Screens/WebViewScreen"; const URL = 'https://wiki.etud.insa-toulouse.fr/'; + +const customPadding = (padding: string) => { + return ( + "$('#p-logo-text').css('top', 10 + " + padding + ");" + + "$('#site-navigation h2').css('top', 10 + " + padding + ");" + + "$('#site-tools h2').css('top', 10 + " + padding + ");" + + "$('#user-tools h2').css('top', 10 + " + padding + ");" + ); +} + + /** * Class defining the app's available rooms screen. * This screen uses a webview to render the page @@ -12,6 +23,7 @@ export const WiketudWebsiteScreen = (props: Object) => { return ( ); };