How to use the bowser.safari function in bowser

To help you get started, we’ve selected a few bowser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / thimble.mozilla.org / public / editor / scripts / lib / startup.js View on Github external
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;
    });
  }
github igorski / efflux-tracker / src / js / view / PatternTrackListView.js View on Github external
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;
github 6502ts / 6502.ts / src / web / stella / stellerator / service / implementation / EmulationProvider.ts View on Github external
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();
github OneSignal / OneSignal-Website-SDK / src / OneSignal.ts View on Github external
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;
      }
    }
github OneSignal / OneSignal-Website-SDK / src / OneSignal.ts View on Github external
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;
      }
    }
github micromaomao / schsrch / view / appstate.js View on Github external
} 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',
github webex / react-widgets / packages / node_modules / @ciscospark / react-container-message-composer / src / components / ComposerButtons.js View on Github external
function handleFileIconClick(event) {
    if (event.type === 'click' || event.type === 'keydown' && (event.keyCode === 13 || event.keyCode === 32)) {
      if (!bowser.safari) {
        document.getElementById('messageFileUpload').click();
      }
    }
  }
github OneSignal / OneSignal-Website-SDK / src / bell / Dialog.ts View on Github external
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 &amp;&amp; !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) &amp;&amp; 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) {
github OneSignal / OneSignal-Website-SDK / src / models / PushDeviceRecord.ts View on Github external
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;
  }
github OneSignal / OneSignal-Website-SDK / src / models / DeviceRecord.ts View on Github external
isSafari(): boolean {
    return bowser.safari && window.safari !== undefined && window.safari.pushNotification !== undefined;
  }