2020-08-01 03:43:15 +02:00
|
|
|
"use strict";
|
|
|
|
|
2018-07-26 19:50:15 +02:00
|
|
|
exports.update_padding = function (opts) {
|
2019-11-02 00:06:25 +01:00
|
|
|
const content = $(opts.content_sel);
|
|
|
|
const padding = $(opts.padding_sel);
|
|
|
|
const total_rows = opts.total_rows;
|
|
|
|
const shown_rows = opts.shown_rows;
|
|
|
|
const hidden_rows = total_rows - shown_rows;
|
2018-07-26 19:50:15 +02:00
|
|
|
|
|
|
|
if (shown_rows === 0) {
|
|
|
|
padding.height(0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-11-02 00:06:25 +01:00
|
|
|
const ratio = hidden_rows / shown_rows;
|
2018-07-26 19:50:15 +02:00
|
|
|
|
2019-11-02 00:06:25 +01:00
|
|
|
const content_height = content.height();
|
|
|
|
const new_padding_height = ratio * content_height;
|
2018-07-26 19:50:15 +02:00
|
|
|
|
|
|
|
padding.height(new_padding_height);
|
|
|
|
padding.width(1);
|
|
|
|
};
|
|
|
|
|
2019-10-25 09:45:13 +02:00
|
|
|
window.padded_widget = exports;
|