From a70a54f67c8dda7333d0af89a66912e24e2ab447 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 9 Dec 2021 18:01:12 +0100 Subject: [PATCH] more SPA --- www/common/sframe-common-outer.js | 61 +++++++++++++++++++++++++++++-- www/spa/main.js | 1 - 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index e5ccffb92..6e7d57bef 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -7,9 +7,47 @@ define([ 'jquery', ], function (nThen, ApiConfig, RequireConfig, Messages, $) { var common = {}; + var isSPAOuter = false; common.initIframe = function (waitFor, isRt, pathname) { var requireConfig = RequireConfig(); + var urlArgs = requireConfig.urlArgs; + var path = pathname || window.location.pathname; + + + // XXX + // * Add UI in settings + // * Note: if no shared worker on this machine, display a warning about performances + // * Reload a page + // * grep window.open in inner + if (localStorage.CP_SPA === "1") { + if (!window.parent || window.parent === window || window.parent.location.host !== window.location.host) { + // SPA enabled and we're in the upper level: init "outer" iframe + var worker = new SharedWorker('/common/outer/sharedworker.js?' + urlArgs); + var $i = $('