mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
6a946b99fc
Use current Sentry browser package and forward errorId into eventId Fix up errorInfo reference Put Sentry on the window object for GUI to use Remove unneeded reference to old style Raven and raven-js Move Sentry webpack config into production only Add GA tracker ID to window Allows scratch-gui to use same GA id
49 lines
1.8 KiB
JavaScript
49 lines
1.8 KiB
JavaScript
const jar = require('./lib/jar');
|
|
|
|
/**
|
|
* -----------------------------------------------------------------------------
|
|
* L10N
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
(() => {
|
|
/*
|
|
* Bind locale code from cookie if available. Uses navigator language API as a fallback.
|
|
*
|
|
* @return {string}
|
|
*/
|
|
const updateLocale = () => {
|
|
let obj = jar.get('scratchlanguage');
|
|
if (typeof obj === 'undefined') {
|
|
obj = window.navigator.userLanguage || window.navigator.language;
|
|
if (['pt', 'pt-pt', 'PT', 'PT-PT'].indexOf(obj) !== -1) {
|
|
obj = 'pt-br'; // default Portuguese users to Brazilian Portuguese due to our user base. Added in 2.2.5.
|
|
}
|
|
}
|
|
return obj;
|
|
};
|
|
|
|
window._locale = updateLocale();
|
|
document.documentElement.lang = window._locale;
|
|
})();
|
|
|
|
/**
|
|
* -----------------------------------------------------------------------------
|
|
* Console warning
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
(() => {
|
|
window.onload = function () {
|
|
/* eslint-disable no-console */
|
|
console.log('%cStop!', 'color: #F00; font-size: 30px; -webkit-text-stroke: 1px black; font-weight:bold');
|
|
console.log(
|
|
'This is part of your browser intended for developers. ' +
|
|
'If someone told you to copy-and-paste something here, ' +
|
|
'don\'t do it! It could allow them to take over your ' +
|
|
'Scratch account, delete all of your projects, or do many ' +
|
|
'other harmful things. If you don\'t understand what exactly ' +
|
|
'you are doing here, you should close this window without doing ' +
|
|
'anything.'
|
|
);
|
|
/* eslint-enable no-console */
|
|
};
|
|
})();
|