improve home page formatting
This commit is contained in:
@@ -128,8 +128,9 @@
|
|||||||
<script>
|
<script>
|
||||||
require([
|
require([
|
||||||
'/customize/DecorateToolbar.js',
|
'/customize/DecorateToolbar.js',
|
||||||
|
'/bower_components/lil-uri/uri.min.js',
|
||||||
'/bower_components/jquery/dist/jquery.min.js'
|
'/bower_components/jquery/dist/jquery.min.js'
|
||||||
], function (Dt) {
|
], function (Dt, LilUri) {
|
||||||
var $ = window.$;
|
var $ = window.$;
|
||||||
Dt.main($('#bottom-bar'));
|
Dt.main($('#bottom-bar'));
|
||||||
var localStorageKey = 'CryptPad_RECENTPADS';
|
var localStorageKey = 'CryptPad_RECENTPADS';
|
||||||
@@ -152,23 +153,27 @@
|
|||||||
return pad[0] !== url;
|
return pad[0] !== url;
|
||||||
});
|
});
|
||||||
localStorage[localStorageKey] = JSON.stringify(recentPads);
|
localStorage[localStorageKey] = JSON.stringify(recentPads);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// show recent pads if they exist
|
var padTypes = {
|
||||||
|
'/pad/': 'Pad',
|
||||||
|
'/code/': 'Code'
|
||||||
|
};
|
||||||
|
|
||||||
recentPads.length && recentPads.some(function (pad, index) {
|
recentPads.length && recentPads.some(function (pad, index) {
|
||||||
if (!pad) return true;
|
if (!pad) return true;
|
||||||
|
|
||||||
|
// don't link to old pads
|
||||||
if (now.getTime() - pad[1] > memorySpan) return true;
|
if (now.getTime() - pad[1] > memorySpan) return true;
|
||||||
|
|
||||||
hasRecent = true;
|
hasRecent = true;
|
||||||
|
|
||||||
// TODO add support for newer types...
|
// split up the uri
|
||||||
var name = /\/sheet\//.test(pad[0])?
|
var uri = LilUri(pad[0]);
|
||||||
'Sheet':
|
|
||||||
/\/code\//.test(pad[0])?
|
// derive the name
|
||||||
'Code':
|
var name = padTypes[uri.path()];
|
||||||
'Pad';
|
|
||||||
|
|
||||||
var date = new Date(pad[1]).toLocaleDateString();
|
var date = new Date(pad[1]).toLocaleDateString();
|
||||||
if (date === now.toLocaleDateString()) {
|
if (date === now.toLocaleDateString()) {
|
||||||
@@ -212,8 +217,8 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div id="buttons" class="buttons">
|
<div id="buttons" class="buttons">
|
||||||
<a id="create-pad" class="button create" href="/pad/">CREATE NEW WYSIWYG PAD</a>
|
<a id="create-pad" class="button create" href="pad">CREATE NEW WYSIWYG PAD</a>
|
||||||
<a id="create-code" class="button create" href="/code/">CREATE NEW CODE PAD</a>
|
<a id="create-code" class="button create" href="code">CREATE NEW CODE PAD</a>
|
||||||
</div>
|
</div>
|
||||||
</center>
|
</center>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user