Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init(startFn) {
// Warn users of unsupported browsers that they can try something newer,
// specifically anything before IE 11 or Safari 8.
if (
(bowser.msie && bowser.version < 11) ||
(bowser.safari && bowser.version < 8)
) {
$("#browser-support-warning").removeClass("hide");
analytics.event({
category: analytics.eventCategories.TROUBLESHOOTING,
action: "Browser version warning shown"
});
$(".let-me-in").on("click", function() {
analytics.event({
category: analytics.eventCategories.TROUBLESHOOTING,
action: "Browser version warning dismissed"
});
$("#browser-support-warning").fadeOut();
return;
});
}
function selectSlotWithinClickedStep( aEvent ) {
// only when supported, and even then not on Safari... =/
if ( !( "caretRangeFromPoint" in document ) || Bowser.safari )
return;
const el = document.caretRangeFromPoint( aEvent.clientX, aEvent.clientY );
let slot = 0;
if ( el && el.startContainer ) {
let startContainer = el.startContainer;
if ( !( startContainer instanceof Element && startContainer.parentElement instanceof Element ))
startContainer = startContainer.parentElement;
if ( startContainer.classList.contains( "moduleValue" ))
slot = 3;
else if ( startContainer.classList.contains( "moduleParam" ))
slot = 2;
else if ( startContainer.classList.contains( "instrument" ))
slot = 1;
import WorkerEmulationService from '../../../service/worker/EmulationService';
import VanillaEmulationService from '../../../service/vanilla/EmulationService';
import EmulationContextInterface from '../../../service/EmulationContextInterface';
import StorageManager from '../StorageManager';
import DriverManager from '../../../service/DriverManager';
import WebAudioDriver from '../../../driver/WebAudio';
import GamepadDriver from '../../../../driver/Gamepad';
import StellaConfig from '../../../../../machine/stella/Config';
import Settings from '../../model/Settings';
import * as VideoProcessorConfig from '../../../../../video/processing/config';
import CpuFactory from '../../../../../machine/cpu/Factory';
import { Target } from '../../../../driver/gamepad/Mapping';
import Switch from '../../../../../machine/io/Switch';
const POLL_GAMEPAD_INTERVALL = 100;
const isSafari = bowser.safari || bowser.ios;
class EmulationProvider implements EmulationProviderInterface {
constructor(private _storage: StorageManager) {}
setStore(store: Store): void {
this._store = store;
}
async init(stellaWorkerUrl: string, videoPipelingWorkerUrl: string): Promise {
this._service = stellaWorkerUrl
? new WorkerEmulationService(`${stellaWorkerUrl}`, isSafari ? undefined : `${videoPipelingWorkerUrl}`)
: new VanillaEmulationService();
await this._service.init();
this._driverManager = new DriverManager();
static async init(options: AppUserConfig) {
logMethodCall('init');
await InitHelper.polyfillSafariFetch();
InitHelper.errorIfInitAlreadyCalled();
await OneSignal.initializeConfig(options);
if (!OneSignal.config) {
throw new Error("OneSignal config not initialized!");
}
if (bowser.safari && !OneSignal.config.safariWebId) {
/**
* Don't throw an error for missing Safari config; many users set up
* support on Chrome/Firefox and don't intend to support Safari but don't
* place conditional initialization checks.
*/
Log.warn(new SdkInitError(SdkInitErrorKind.MissingSafariWebId));
return;
}
if (OneSignal.config.userConfig.requiresUserPrivacyConsent) {
const providedConsent = await Database.getProvideUserConsent();
if (!providedConsent) {
OneSignal.pendingInit = true;
return;
}
}
static async init(options: AppUserConfig) {
logMethodCall('init');
await InitHelper.polyfillSafariFetch();
InitHelper.errorIfInitAlreadyCalled();
await OneSignal.initializeConfig(options);
if (!OneSignal.config) {
throw new Error("OneSignal config not initialized!");
}
if (bowser.safari && !OneSignal.config.safariWebId) {
/**
* Don't throw an error for missing Safari config; many users set up
* support on Chrome/Firefox and don't intend to support Safari but don't
* place conditional initialization checks.
*/
Log.warn(new SdkInitError(SdkInitErrorKind.MissingSafariWebId));
return;
}
if (OneSignal.config.userConfig.requiresUserPrivacyConsent) {
const providedConsent = await Database.getProvideUserConsent();
if (!providedConsent) {
OneSignal.pendingInit = true;
return;
}
}
} catch (e) {}
return supportsPassive
})()
AppState.browserSupportsPassiveEvents = browserSupportsPassiveEvents
export { browserSupportsPassiveEvents }
AppState.focusingInput = null
AppState.shouldResponseKeyboardShortcut = () => {
let { focusingInput } = AppState
return !focusingInput && !(document.activeElement && document.activeElement.contentEditable === 'true')
}
AppState.sspdfDecacheVersion = 2
AppState.isSafari = bowser.safari || bowser.ios
if (AppState.isSafari) {
AppState.supportSspdfView = bowser.check({
safari: '9'
})
AppState.supportOverall = bowser.check({
safari: '9'
})
} else {
AppState.supportSspdfView = bowser.check({
msie: '11',
chrome: '35',
firefox: '50'
})
AppState.supportOverall = bowser.check({
msie: '11',
chrome: '29',
function handleFileIconClick(event) {
if (event.type === 'click' || event.type === 'keydown' && (event.keyCode === 13 || event.keyCode === 32)) {
if (!bowser.safari) {
document.getElementById('messageFileUpload').click();
}
}
}
if (this.bell.state !== Bell.STATES.SUBSCRIBED)
buttonHtml = `<button id="${this.subscribeButtonSelectorId}" class="action" type="button">${this.bell.options.text['dialog.main.button.subscribe']}</button>`;
else
buttonHtml = `<button id="${this.unsubscribeButtonSelectorId}" class="action" type="button">${this.bell.options.text['dialog.main.button.unsubscribe']}</button>`;
contents = `<h1>${this.bell.options.text['dialog.main.title']}</h1><div class="divider"></div><div class="push-notification">${notificationIconHtml}<div class="push-notification-text-container"><div class="push-notification-text push-notification-text-short"></div><div class="push-notification-text"></div><div class="push-notification-text push-notification-text-medium"></div><div class="push-notification-text"></div><div class="push-notification-text push-notification-text-medium"></div></div></div><div class="action-container">${buttonHtml}</div>${footer}`;
}
else if (this.bell.state === Bell.STATES.BLOCKED) {
let imageUrl = null;
if (bowser.chrome) {
if (!bowser.mobile && !bowser.tablet)
imageUrl = '/bell/chrome-unblock.jpg';
}
else if (bowser.firefox)
imageUrl = '/bell/firefox-unblock.jpg';
else if (bowser.safari)
imageUrl = '/bell/safari-unblock.jpg';
else if (bowser.msedge)
imageUrl = '/bell/edge-unblock.png';
let instructionsHtml = '';
if (imageUrl) {
imageUrl = SdkEnvironment.getOneSignalApiUrl().origin + imageUrl;
instructionsHtml = `<a href="${imageUrl}"><img src="${imageUrl}"></a>`;
}
if ((bowser.mobile || bowser.tablet) && bowser.chrome) {
instructionsHtml = `<ol><li>Access <strong>Settings</strong> by tapping the three menu dots <strong>⋮</strong></li><li>Click <strong>Site settings</strong> under Advanced.</li><li>Click <strong>Notifications</strong>.</li><li>Find and click this entry for this website.</li><li>Click <strong>Notifications</strong> and set it to <strong>Allow</strong>.</li></ol>`;
}
contents = `<h1>${this.bell.options.text['dialog.blocked.title']}</h1><div class="divider"></div><div class="instructions"><p>${this.bell.options.text['dialog.blocked.message']}</p>${instructionsHtml}</div>${footer}`;
}
if (this.nestedContentSelector) {
serialize() {
const serializedBundle: any = super.serialize();
if (this.subscription) {
serializedBundle.identifier = bowser.safari ?
this.subscription.safariDeviceToken :
this.subscription.w3cEndpoint ? this.subscription.w3cEndpoint.toString() : null;
serializedBundle.web_auth = this.subscription.w3cAuth;
serializedBundle.web_p256 = this.subscription.w3cP256dh;
}
return serializedBundle;
}
isSafari(): boolean {
return bowser.safari && window.safari !== undefined && window.safari.pushNotification !== undefined;
}