PageSourceSearch

https://www.miyagin.co.jp/cms-hjeg2ccyg8jy/wp-content/themes/miyag…/js/remove-last-line-margin.js?ver=v0-1

js miyagin.co.jp collected 2026-09-24 10:11:03 UTC 1,526 bytes, 52 lines download raw bytes

1// リストを取得
2const listElems = Array.from(document.getElementsByClassName('remove-last-margin-list'));
3let marginBottomNum = [];
4
5const getMarginBottom = (ulElem) => {
6    let liElems = Array.from(ulElem.children);
7    marginBottomNum.push(getComputedStyle(liElems[0]).getPropertyValue("margin-bottom"));
8}
9const marginBottom = () => {
10    listElems.forEach(listElem => {
11        getMarginBottom(listElem);
12    });
13
14}
15window.addEventListener('load', marginBottom);
16
17// 入: HTML要素
18// 出: Y座標数値
19const getYPosition = (elem) => {
20    let clientRect = elem.getBoundingClientRect() ;
21    return window.pageYOffset + clientRect.top;
22}
23
24const removeLastLineMargin = (ulElem) => {
25    let liElems = Array.from(ulElem.children);
26    let liElemsYPotitions = liElems.map(getYPosition);
27    let uniqueliElemsYPotitions = Array.from(new Set(liElemsYPotitions));
28    let lastRowYposition = uniqueliElemsYPotitions[uniqueliElemsYPotitions.length - 1 ];
29
30    let lastRowLiElems = liElems.filter((elem) => {
31        return getYPosition(elem) == lastRowYposition;
32    })
33
34    for (let i = 0; i < liElems.length; i++) {
35        liElems[i].style.marginBottom = "";
36    }
37
38    for (let index = 0; index < lastRowLiElems.length; index++) {
39        lastRowLiElems[index].style.marginBottom = 0 + 'px';
40    }
41
42}
43
44const removeMargins = () => {
45
46    listElems.forEach(listElem => {
47        removeLastLineMargin(listElem);
48    });
49
50}
51window.addEventListener('load', removeMargins);
52window.addEventListener('resize', removeMargins);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.