mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 15:31:52 +00:00
Merge pull request #2265 from nunocoracao/codex/review-code-and-suggest-improvements
🤖 Fix JS issues and modernize node scripts
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ const oid_likes =
|
||||
pageScriptElement && pageScriptElement.getAttribute("data-oid-likes")
|
||||
? pageScriptElement.getAttribute("data-oid-likes")
|
||||
: (console.error("data-oid-likes is null"), null);
|
||||
const liked_page = false;
|
||||
let liked_page = false;
|
||||
const id = oid ? oid.replaceAll("/", "-") : oid;
|
||||
const id_likes = oid_likes ? oid_likes.replaceAll("/", "-") : oid_likes;
|
||||
|
||||
|
||||
@@ -156,7 +156,6 @@ function executeQuery(term) {
|
||||
|
||||
if (results.length > 0) {
|
||||
results.forEach(function (value, key) {
|
||||
console.log(value.item.summary);
|
||||
var html = value.item.summary;
|
||||
var div = document.createElement("div");
|
||||
div.innerHTML = html;
|
||||
|
||||
@@ -6,14 +6,33 @@ function _getDefaultPackeryOptions() {
|
||||
};
|
||||
}
|
||||
|
||||
function _getPackeryOptions(nodeGallery) {
|
||||
const defaults = _getDefaultPackeryOptions();
|
||||
const {
|
||||
packeryGutter,
|
||||
packeryPercentPosition,
|
||||
packeryResize,
|
||||
} = nodeGallery.dataset;
|
||||
|
||||
return {
|
||||
percentPosition:
|
||||
packeryPercentPosition !== undefined
|
||||
? packeryPercentPosition === "true"
|
||||
: defaults.percentPosition,
|
||||
gutter:
|
||||
packeryGutter !== undefined ? parseInt(packeryGutter, 10) : defaults.gutter,
|
||||
resize:
|
||||
packeryResize !== undefined ? packeryResize === "true" : defaults.resize,
|
||||
};
|
||||
}
|
||||
|
||||
(function init() {
|
||||
$(window).on("load", function () {
|
||||
let packeries = [];
|
||||
let nodeGalleries = document.querySelectorAll(".gallery");
|
||||
|
||||
nodeGalleries.forEach((nodeGallery) => {
|
||||
// TODO : implement a reader of Packery configuration _getPackeryOptions; for example by reading data-attribute
|
||||
let packery = new Packery(nodeGallery, _getDefaultPackeryOptions());
|
||||
let packery = new Packery(nodeGallery, _getPackeryOptions(nodeGallery));
|
||||
packeries.push(packery);
|
||||
});
|
||||
console.groupEnd();
|
||||
|
||||
Reference in New Issue
Block a user