1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-28 05:15:54 +00:00
FrankerFaceZ/src/entry.js

26 lines
873 B
JavaScript
Raw Normal View History

2017-11-13 01:23:39 -05:00
/* eslint strict: off */
'use strict';
(() => {
// Don't run on certain sub-domains.
if ( /^(?:localhost\.rig|blog|im|chatdepot|tmi|api|brand|dev|gql|passport)\./.test(location.hostname) )
2017-11-13 01:23:39 -05:00
return;
const DEBUG = localStorage.ffzDebugMode == 'true' && document.body.classList.contains('ffz-dev'),
HOST = location.hostname,
SERVER = DEBUG ? '//localhost:8000' : '//cdn.frankerfacez.com',
script = document.createElement('script');
let FLAVOR =
HOST.includes('player') ? 'player' :
HOST.includes('clips') ? 'clips' :
(location.pathname === '/p/ffz_bridge/' ? 'bridge' : 'avalon');
2017-11-13 01:23:39 -05:00
if (FLAVOR === 'clips' && location.pathname === '/embed')
FLAVOR = 'player';
2017-11-13 01:23:39 -05:00
script.id = 'ffz-script';
script.async = true;
script.crossOrigin = 'anonymous';
script.src = `${SERVER}/script/${FLAVOR}.js?_=${Date.now()}`;
2017-11-13 01:23:39 -05:00
document.head.appendChild(script);
})();