aboutsummaryrefslogtreecommitdiff
path: root/beamer/viewer/init.js
blob: c8b1ccf73d2ec1bf482cb98e3d8923a4d6b19b49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * Beamer Viewer, a web-based PDF presentation viewer
 * Copyright 2018-2024 Pacien TRAN-GIRARD
 * SPDX-License-Identifier: EUPL-1.2
 */

"use strict";

function isController() {
  return window.opener == null || window.opener.location.href != window.location.href;
}

function initCache() {
  if (!navigator.serviceWorker) return;
  navigator.serviceWorker.register("appcache.js");
  
  const offlineCapableIndicator = document.getElementById("offlineCapable");
  offlineCapableIndicator.style.visibility = "visible";
}

function init() {
  initCache();
  const viewer = new Viewer();
}

if (isController())
  init();