Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xiee/utils

Package Overview
Dependencies
Maintainers
1
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xiee/utils - npm Package Compare versions

Comparing version 1.2.9 to 1.2.10

build.sh

40

js/center-img.js

@@ -1,14 +0,22 @@

(function() {
(function(d) {
function one_child(el) {
if (el.childElementCount !== 1) return false;
const nodes = el.childNodes;
if (nodes.length === 1) return true;
for (let i in nodes) {
let node = nodes[i];
if (node.nodeName === '#text' && !/^\s$/.test(node.textContent)) return false;
}
return true;
}
function center_el(tagName) {
var tags = document.getElementsByTagName(tagName), i, tag;
for (i = 0; i < tags.length; i++) {
tag = tags[i];
var parent = tag.parentElement;
d.querySelectorAll(tagName).forEach(tag => {
let parent = tag.parentElement;
// center an image if it is the only element of its parent
if (parent.childElementCount === 1) {
if (one_child(parent)) {
// if there is a link on image, check grandparent
var parentA = parent.nodeName === 'A';
const parentA = parent.nodeName === 'A';
if (parentA) {
parent = parent.parentElement;
if (parent.childElementCount != 1) continue;
if (!one_child(parent)) return;
parent.firstElementChild.style.border = 'none';

@@ -24,13 +32,9 @@ }

}
}
});
}
var tagNames = ['img', 'embed', 'object'];
for (var i = 0; i < tagNames.length; i++) {
center_el(tagNames[i]);
}
['img', 'embed', 'object'].forEach(tag => center_el(tag));
// also center paragraphs that contain `* * *`
var ps = document.getElementsByTagName('p');
for (var i = 0; i < ps.length; i++) {
if (ps[i].innerText === '* * *') ps[i].style.textAlign = 'center';
};
})();
d.querySelectorAll('p').forEach(p => {
if (p.innerText === '* * *') p.style.textAlign = 'center';
});
})(document);
{
"name": "@xiee/utils",
"version": "1.2.9",
"version": "1.2.10",
"description": "Miscellaneous tools and utilities to manipulate HTML pages",

@@ -5,0 +5,0 @@ "scripts": {

@@ -53,5 +53,3 @@ This repo contains miscellaneous tools and utilities written in JavaScript. They

Fix links to/from footnotes rendered by lower versions of Hugo (Blackfriday)
when footnotes do not contain any ASCII characters, in which case Hugo is unable
to render unique `id`s for the footnote items (the `id` is `fn:-`).
Add `[ ]` to footnote numbers and move the return symbols in footnotes.

@@ -58,0 +56,0 @@ ## fix-toc.js

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc