Run x2t in an iframe
parent
73eb80ea30
commit
2abe187f67
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="height: 100%; background: transparent;">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<script async data-bootload="/unsafeiframe/inner.js" data-main="/common/sframe-boot.js?ver=1.7" src="/bower_components/requirejs/require.js?ver=2.3.5"></script>
|
||||
<style>
|
||||
html, body { display: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="cp-app-unsafeiframe" style="background: transparent;">
|
||||
</body>
|
||||
</html>
|
||||
|
@ -0,0 +1,79 @@
|
||||
define([
|
||||
'jquery',
|
||||
'/bower_components/chainpad-crypto/crypto.js',
|
||||
'/bower_components/nthen/index.js',
|
||||
'/common/sframe-common.js',
|
||||
'/common/common-interface.js',
|
||||
'/common/common-ui-elements.js',
|
||||
'/common/common-util.js',
|
||||
'/common/common-hash.js',
|
||||
'/common/hyperscript.js',
|
||||
'json.sortify',
|
||||
'/customize/messages.js',
|
||||
], function (
|
||||
$,
|
||||
Crypto,
|
||||
nThen,
|
||||
SFCommon,
|
||||
UI,
|
||||
UIElements,
|
||||
Util,
|
||||
Hash,
|
||||
h,
|
||||
Sortify,
|
||||
Messages)
|
||||
{
|
||||
var APP = window.APP = {};
|
||||
|
||||
var andThen = function (common) {
|
||||
var metadataMgr = common.getMetadataMgr();
|
||||
var sframeChan = common.getSframeChannel();
|
||||
var $body = $('body');
|
||||
var displayed;
|
||||
|
||||
var create = {};
|
||||
|
||||
var x2t;
|
||||
var onConvert = function (obj, cb) {
|
||||
x2t.convert(obj, cb);
|
||||
};
|
||||
create['x2t'] = function (obj, cb) {
|
||||
if (x2t) { return void onConvert(obj, cb); }
|
||||
require(['/common/outer/x2t.js'], function (X2T) {
|
||||
x2t = X2T.start();
|
||||
onConvert(obj, cb);
|
||||
});
|
||||
};
|
||||
|
||||
sframeChan.on('Q_COMMAND', function (data, cb) {
|
||||
if (!data) { return; }
|
||||
var type = data.modal;
|
||||
if (!create[type]) { return; }
|
||||
create[type](data, cb);
|
||||
});
|
||||
|
||||
UI.removeLoadingScreen();
|
||||
};
|
||||
|
||||
var main = function () {
|
||||
var common;
|
||||
var _andThen = Util.once(andThen);
|
||||
|
||||
nThen(function (waitFor) {
|
||||
$(waitFor(function () {
|
||||
UI.addLoadingScreen({hideTips: true, hideLogo: true});
|
||||
}));
|
||||
SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
|
||||
}).nThen(function (/*waitFor*/) {
|
||||
var metadataMgr = common.getMetadataMgr();
|
||||
if (metadataMgr.getMetadataLazy() !== 'uninitialized') {
|
||||
_andThen(common);
|
||||
return;
|
||||
}
|
||||
metadataMgr.onChange(function () {
|
||||
_andThen(common);
|
||||
});
|
||||
});
|
||||
};
|
||||
main();
|
||||
});
|
Loading…
Reference in New Issue