@@ -34,7 +34,7 @@ if (process.env.NODE_ENV !== 'production') {
3434 global . Perf = require ( 'react-addons-perf' ) ;
3535}
3636
37- import RunModernizrTests from './modernizr' ; // this side-effects a global
37+ import './modernizr' ;
3838import ReactDOM from 'react-dom' ;
3939import sdk from 'matrix-react-sdk' ;
4040import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg' ;
@@ -43,16 +43,14 @@ import VectorConferenceHandler from 'matrix-react-sdk/lib/VectorConferenceHandle
4343import Promise from 'bluebird' ;
4444import request from 'browser-request' ;
4545import * as languageHandler from 'matrix-react-sdk/lib/languageHandler' ;
46- // Also import _t directly so we can call it just `_t` as this is what gen-i18n.js expects
47- import { _t } from 'matrix-react-sdk/lib/languageHandler' ;
4846
4947import url from 'url' ;
5048
5149import { parseQs , parseQsFromFragment } from './url_utils' ;
5250import Platform from './platform' ;
5351
5452import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg' ;
55- import SettingsStore , { SettingLevel } from "matrix-react-sdk/lib/settings/SettingsStore" ;
53+ import SettingsStore from "matrix-react-sdk/lib/settings/SettingsStore" ;
5654import Tinter from 'matrix-react-sdk/lib/Tinter' ;
5755import SdkConfig from "matrix-react-sdk/lib/SdkConfig" ;
5856
@@ -73,12 +71,12 @@ function checkBrowserFeatures(featureList) {
7371 console . error ( "Cannot check features - Modernizr global is missing." ) ;
7472 return false ;
7573 }
76- var featureComplete = true ;
77- for ( var i = 0 ; i < featureList . length ; i ++ ) {
74+ let featureComplete = true ;
75+ for ( let i = 0 ; i < featureList . length ; i ++ ) {
7876 if ( window . Modernizr [ featureList [ i ] ] === undefined ) {
7977 console . error (
8078 "Looked for feature '%s' but Modernizr has no results for this. " +
81- "Has it been configured correctly?" , featureList [ i ]
79+ "Has it been configured correctly?" , featureList [ i ] ,
8280 ) ;
8381 return false ;
8482 }
@@ -99,7 +97,7 @@ function getScreenFromLocation(location) {
9997 return {
10098 screen : fragparts . location . substring ( 1 ) ,
10199 params : fragparts . params ,
102- }
100+ } ;
103101}
104102
105103// Here, we do some crude URL analysis to allow
@@ -124,10 +122,10 @@ function onHashChange(ev) {
124122// so a web page can update the URL bar appropriately.
125123function onNewScreen ( screen ) {
126124 console . log ( "newscreen " + screen ) ;
127- var hash = '#/' + screen ;
125+ const hash = '#/' + screen ;
128126 lastLocationHashSet = hash ;
129127 window . location . hash = hash ;
130- } ;
128+ }
131129
132130// We use this to work out what URL the SDK should
133131// pass through when registering to allow the user to
@@ -164,7 +162,7 @@ function makeRegistrationUrl(params) {
164162 return url ;
165163}
166164
167- function getConfig ( configJsonFilename ) {
165+ export function getConfig ( configJsonFilename ) {
168166 return new Promise ( function ( resolve , reject ) {
169167 request (
170168 { method : "GET" , url : configJsonFilename } ,
@@ -200,9 +198,9 @@ function onTokenLoginCompleted() {
200198 // if we did a token login, we're now left with the token, hs and is
201199 // url as query params in the url; a little nasty but let's redirect to
202200 // clear them.
203- var parsedUrl = url . parse ( window . location . href ) ;
201+ const parsedUrl = url . parse ( window . location . href ) ;
204202 parsedUrl . search = "" ;
205- var formatted = url . format ( parsedUrl ) ;
203+ const formatted = url . format ( parsedUrl ) ;
206204 console . log ( "Redirecting to " + formatted + " to drop loginToken " +
207205 "from queryparams" ) ;
208206 window . location . href = formatted ;
@@ -256,7 +254,6 @@ async function loadApp() {
256254 }
257255
258256 // as quickly as we possibly can, set a default theme...
259- const styleElements = Object . create ( null ) ;
260257 let a ;
261258 const theme = SettingsStore . getValue ( "theme" ) ;
262259 for ( let i = 0 ; ( a = document . getElementsByTagName ( "link" ) [ i ] ) ; i ++ ) {
@@ -280,7 +277,7 @@ async function loadApp() {
280277 // in case it is the first time loading Riot.
281278 // `InstallTrigger` is a Object which only exists on Firefox
282279 // (it is used for their Plugins) and can be used as a
283- // feature check.
280+ // feature check.
284281 // Firefox loads css always before js. This is why we dont use
285282 // onload or it's EventListener as thoose will never trigger.
286283 if ( typeof InstallTrigger !== 'undefined' ) {
@@ -332,19 +329,19 @@ async function loadApp() {
332329 initialScreenAfterLogin = { getScreenFromLocation ( window . location ) }
333330 defaultDeviceDisplayName = { platform . getDefaultDeviceDisplayName ( ) }
334331 /> ,
335- document . getElementById ( 'matrixchat' )
332+ document . getElementById ( 'matrixchat' ) ,
336333 ) ;
337334 } else {
338335 console . error ( "Browser is missing required features." ) ;
339336 // take to a different landing page to AWOOOOOGA at the user
340- var CompatibilityPage = sdk . getComponent ( "structures.CompatibilityPage" ) ;
337+ const CompatibilityPage = sdk . getComponent ( "structures.CompatibilityPage" ) ;
341338 window . matrixChat = ReactDOM . render (
342339 < CompatibilityPage onAccept = { function ( ) {
343340 if ( window . localStorage ) window . localStorage . setItem ( 'mx_accepts_unsupported_browser' , true ) ;
344341 console . log ( "User accepts the compatibility risks." ) ;
345342 loadApp ( ) ;
346343 } } /> ,
347- document . getElementById ( 'matrixchat' )
344+ document . getElementById ( 'matrixchat' ) ,
348345 ) ;
349346 }
350347}
0 commit comments