make all apps use clientside templates

pull/1/head
ansuz 8 years ago
parent f232675cc9
commit 7de2683169

@ -263,7 +263,7 @@ define([
}; };
var loadingScreen = function () { var loadingScreen = function () {
return h('div#loading', return h('div#loading',
h('div.loadingContainer', [ h('div.loadingContainer', [
h('img.cryptofist', { h('img.cryptofist', {
src: '/customize/cryptofist_small.png' src: '/customize/cryptofist_small.png'
@ -479,5 +479,25 @@ define([
]; ];
}; };
Pages['/drive/'] = Pages['/drive/index.html'] = function () {
return loadingScreen();
};
Pages['/file/'] = Pages['/file/index.html'] = function () {
return loadingScreen();
};
Pages['/pad/'] = Pages['/pad/index.html'] = function () {
return loadingScreen();
};
Pages['/code/'] = Pages['/code/index.html'] = function () {
return loadingScreen();
};
Pages['/slide/'] = Pages['/slide/index.html'] = function () {
return loadingScreen();
};
return Pages; return Pages;
}); });

@ -1,3 +1,5 @@
@import "./variables.less";
.cp #loading { .cp #loading {
position: fixed; position: fixed;
z-index: 9999; z-index: 9999;

@ -10,7 +10,8 @@ $(function () {
var Messages = Cryptpad.Messages; var Messages = Cryptpad.Messages;
var $body = $('body'); var $body = $('body');
var isMainApp = function () { var isMainApp = function () {
return /^\/(pad|code|slide|poll|whiteboard|file|media)\//.test(location.pathname); console.error("Checking if is main app");
return /^\/(pad|code|slide|poll|whiteboard|file|media|drive)\/$/.test(location.pathname);
}; };
var rightLink = function (ref, loc, txt) { var rightLink = function (ref, loc, txt) {
@ -115,25 +116,61 @@ $(function () {
var pathname = location.pathname; var pathname = location.pathname;
if (isMainApp()) { if (isMainApp()) {
console.log("Is main app");
if (typeof(Pages[pathname]) === 'function') { if (typeof(Pages[pathname]) === 'function') {
$('body').html(h('body', Pages[pathname]()).innerHTML); require([
'less!/customize/src/less/loading.less'
], function () {
//$('body').html(h('body', Pages[pathname]()).innerHTML);
console.log("TEMPLATED");
if (/whiteboard/.test(pathname)) { if (/whiteboard/.test(pathname)) {
setTimeout(function () { $('body').html(h('body', Pages[pathname]()).innerHTML);
require(['/whiteboard/main.js'], function () { setTimeout(function () {
$('body').removeClass('noscroll'); require(['/whiteboard/main.js'], function () {
$('body').removeClass('noscroll');
});
});
} else if (/poll/.test(pathname)) {
$('body').html(h('body', Pages[pathname]()).innerHTML);
setTimeout(function () {
require(['/poll/main.js'], function () {
$('body').removeClass('noscroll');
console.log("TEMPLATE!");
});
});
} else if (/drive/.test(pathname)) {
$('body').append(h('body', Pages[pathname]()).innerHTML);
setTimeout(function () {
require(['/drive/main.js'], function () {
console.log("Templating done");
});
}); });
}); } else if (/file/.test(pathname)) {
} else if (/poll/.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML);
setTimeout(function () { require([ '/file/main.js' ], function () {
require(['/poll/main.js'], function () { console.log("Templating done");
$('body').removeClass('noscroll');
console.log("TEMPLATE!");
}); });
}); } else if (/pad/.test(pathname)) {
} $('body').append(h('body', Pages[pathname]()).innerHTML);
require([ '/pad/main.js' ], function () {
console.log("Templating done");
});
} else if (/code/.test(pathname)) {
$('body').append(h('body', Pages[pathname]()).innerHTML);
require([ '/code/main.js' ], function () {
console.log("Templating done");
});
} else if (/slide/.test(pathname)) {
$('body').append(h('body', Pages[pathname]()).innerHTML);
require([ '/slide/main.js' ], function () {
console.log("Templating done");
});
}
});
return; return;
} }
} }

@ -5,12 +5,7 @@
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="referrer" content="no-referrer" /> <meta name="referrer" content="no-referrer" />
<script data-bootload="main.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script> <script data-bootload="/customize/template.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script>
<link rel="icon" type="image/png"
href="/customize/main-favicon.png"
data-main-favicon="/customize/main-favicon.png"
data-alt-favicon="/customize/alt-favicon.png"
id="favicon" />
<style> <style>
html, body { html, body {
overflow-y: hidden; overflow-y: hidden;
@ -44,14 +39,3 @@
<div id="iframe-container"> <div id="iframe-container">
<iframe id="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script> <iframe id="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script>
</div> </div>
<div id="loading">
<div class="loadingContainer">
<img class="cryptofist" src="/customize/cryptofist_small.png" />
<div class="spinnerContainer">
<span class="fa fa-spinner fa-pulse fa-4x fa-fw"></span>
</div>
<p data-localization="loading"></p>
</div>
</div>
</body>
</html>

@ -12,6 +12,7 @@ define([
'/bower_components/tweetnacl/nacl-fast.min.js', // needed for media-tag '/bower_components/tweetnacl/nacl-fast.min.js', // needed for media-tag
'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/cryptpad.less'
], function ($, Crypto, Realtime, TextPatcher, Toolbar, JSONSortify, JsonOT, Cryptpad, ], function ($, Crypto, Realtime, TextPatcher, Toolbar, JSONSortify, JsonOT, Cryptpad,
Cryptget, DiffMd) { Cryptget, DiffMd) {
var Messages = Cryptpad.Messages; var Messages = Cryptpad.Messages;

@ -4,12 +4,7 @@
<title>CryptDrive</title> <title>CryptDrive</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link rel="icon" type="image/png" <script data-bootload="/customize/template.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script>
href="/customize/main-favicon.png"
data-main-favicon="/customize/main-favicon.png"
data-alt-favicon="/customize/alt-favicon.png"
id="favicon" />
<script data-bootload="main.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script>
<style> <style>
html, body { html, body {
margin: 0px; margin: 0px;
@ -32,14 +27,3 @@
</head> </head>
<body> <body>
<iframe id="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script> <iframe id="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script>
<div id="loading">
<div class="loadingContainer">
<img class="cryptofist" src="/customize/cryptofist_small.png" />
<div class="spinnerContainer">
<span class="fa fa-spinner fa-pulse fa-4x fa-fw"></span>
</div>
<p data-localization="loading"></p>
</div>
</div>
</body>
</html>

@ -4,12 +4,7 @@
<title>CryptPad</title> <title>CryptPad</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<script data-bootload="main.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script> <script data-bootload="/customize/template.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script>
<link rel="icon" type="image/png"
href="/customize/main-favicon.png"
data-main-favicon="/customize/main-favicon.png"
data-alt-favicon="/customize/alt-favicon.png"
id="favicon" />
<style> <style>
html, body { html, body {
margin: 0px; margin: 0px;
@ -32,14 +27,4 @@
</head> </head>
<body> <body>
<iframe id="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script> <iframe id="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script>
<div id="loading">
<div class="loadingContainer">
<img class="cryptofist" src="/customize/cryptofist_small.png" />
<div class="spinnerContainer">
<span class="fa fa-spinner fa-pulse fa-4x fa-fw"></span>
</div>
<p data-localization="loading"></p>
</div>
</div>
</body>
</html>

@ -5,12 +5,7 @@
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="referrer" content="no-referrer" /> <meta name="referrer" content="no-referrer" />
<script data-bootload="main.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script> <script data-bootload="/customize/template.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script>
<link rel="icon" type="image/png"
href="/customize/main-favicon.png"
data-main-favicon="/customize/main-favicon.png"
data-alt-favicon="/customize/alt-favicon.png"
id="favicon" />
<style> <style>
html, body { html, body {
margin: 0px; margin: 0px;
@ -56,14 +51,4 @@
</head> </head>
<body> <body>
<iframe id="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script> <iframe id="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script>
<div id="loading">
<div class="loadingContainer">
<img class="cryptofist" src="/customize/cryptofist_small.png" />
<div class="spinnerContainer">
<span class="fa fa-spinner fa-pulse fa-4x fa-fw"></span>
</div>
<p data-localization="loading"></p>
</div>
</div>
</body>
</html>

@ -1,15 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html class="cp poll"> <html class="cp poll">
<head> <head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<title data-localization="poll_title">Zero Knowledge Date Picker</title> <title data-localization="poll_title">Zero Knowledge Date Picker</title>
<link rel="icon" type="image/png" <script data-main="/common/boot.js" src="/bower_components/requirejs/require.js"
href="/customize/main-favicon.png" data-bootload="/customize/template.js"></script>
data-main-favicon="/customize/main-favicon.png"
data-alt-favicon="/customize/alt-favicon.png"
id="favicon" />
<script data-bootload="/customize/template.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script>
</head> </head>
<body> <body>

@ -11,7 +11,6 @@ define([
'/bower_components/file-saver/FileSaver.min.js', '/bower_components/file-saver/FileSaver.min.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less/cryptpad.less',
'less!/customize/src/less/toolbar.less', 'less!/customize/src/less/toolbar.less',
'less!/poll/poll.less', 'less!/poll/poll.less',
], function ($, TextPatcher, Listmap, Crypto, Cryptpad, Cryptget, Hyperjson, Renderer, Toolbar) { ], function ($, TextPatcher, Listmap, Crypto, Cryptpad, Cryptget, Hyperjson, Renderer, Toolbar) {

@ -5,15 +5,7 @@
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="referrer" content="no-referrer" /> <meta name="referrer" content="no-referrer" />
<script data-bootload="main.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script> <script data-bootload="/customize/template.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script>
<link rel="icon" type="image/png"
href="/customize/main-favicon.png"
data-main-favicon="/customize/main-favicon.png"
data-alt-favicon="/customize/alt-favicon.png"
id="favicon" />
<link rel="stylesheet" href="/bower_components/components-font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/customize/main.css" />
<style> <style>
html, body { html, body {
overflow-y: hidden; overflow-y: hidden;
@ -49,14 +41,4 @@
<div id="iframe-container"> <div id="iframe-container">
<iframe id="pad-iframe", name="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script> <iframe id="pad-iframe", name="pad-iframe"></iframe><script src="/common/noscriptfix.js"></script>
</div> </div>
<div id="loading">
<div class="loadingContainer">
<img class="cryptofist" src="/customize/cryptofist_small.png" />
<div class="spinnerContainer">
<span class="fa fa-spinner fa-pulse fa-4x fa-fw"></span>
</div>
<p data-localization="loading"></p>
</div>
</div>
</body>
</html>

@ -4,11 +4,6 @@
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script data-bootload="/customize/template.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script> <script data-bootload="/customize/template.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script>
<link rel="icon" type="image/png"
href="/customize/main-favicon.png"
data-main-favicon="/customize/main-favicon.png"
data-alt-favicon="/customize/alt-favicon.png"
id="favicon" />
<style> .noscroll { overflow-y: hidden; } </style> <style> .noscroll { overflow-y: hidden; } </style>
</head> </head>
<body class='noscroll'> <body class='noscroll'>

Loading…
Cancel
Save