Fix note layout (#274)

* Re-structure note lists

Signed-off-by: hossainemruz <hossainemruz@gmail.com>

* Support note splitting

Signed-off-by: hossainemruz <hossainemruz@gmail.com>

* Update single page

Signed-off-by: hossainemruz <hossainemruz@gmail.com>

* Refactor separator logic in navbar

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
Emruz Hossain 2021-05-02 05:02:27 +06:00 committed by GitHub
parent fc5656c937
commit 67c49c7432
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 127 additions and 45 deletions

32
static/js/note.js Normal file
View file

@ -0,0 +1,32 @@
"use strict";
(function ($) {
jQuery(document).ready(function () {
function resizeGridItem(item) {
var grid = document.getElementsByClassName("note-card-holder")[0];
var rowHeight = parseInt(window.getComputedStyle(grid).getPropertyValue('grid-auto-rows'));
var rowGap = parseInt(window.getComputedStyle(grid).getPropertyValue('grid-row-gap'));
var rowSpan = Math.ceil((item.querySelector('.item').getBoundingClientRect().height + rowGap) / (rowHeight + rowGap));
item.style.gridRowEnd = "span " + rowSpan;
}
function resizeAllGridItems() {
var allItems = document.getElementsByClassName("note-card");
for (var x = 0; x < allItems.length; x++) {
resizeGridItem(allItems[x]);
}
}
function resizeInstance(instance) {
var item = instance.elements[0];
resizeGridItem(item);
}
// window.onload = resizeAllGridItems();
window.addEventListener("resize", resizeAllGridItems);
var allItems = document.getElementsByClassName("note-card");
for (var x = 0; x < allItems.length; x++) {
imagesLoaded(allItems[x], resizeInstance);
}
});
})(jQuery);