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:
parent
fc5656c937
commit
67c49c7432
9 changed files with 127 additions and 45 deletions
32
static/js/note.js
Normal file
32
static/js/note.js
Normal 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);
|
Loading…
Add table
Add a link
Reference in a new issue