Skip to content

Commit 88b253a

Browse files
Nikola HristovNikola Hristov
authored andcommitted
1 parent 7b0e076 commit 88b253a

6 files changed

Lines changed: 89 additions & 13 deletions

File tree

.cache/Commit/Cache.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7662,6 +7662,6 @@
76627662
]
76637663
}
76647664
],
7665-
"TimeStamp": 1738945466692
7665+
"TimeStamp": 1738952188303
76667666
}
76677667
}

Source/Function/Commit/Layout.astro

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,39 @@ const UUID = (await import("@Function/UUID/Fn.js")).default();
6767
content: "●";
6868
content: "●"/"";
6969
}
70+
71+
.HighLight {
72+
color: black;
73+
position: relative;
74+
}
75+
76+
.HighLight::before {
77+
content: "";
78+
display: block;
79+
position: absolute;
80+
z-index: -1;
81+
top: -0.25rem;
82+
left: -0.5rem;
83+
right: -0.5rem;
84+
bottom: -0.25rem;
85+
background-color: yellow;
86+
}
87+
88+
html.dark table.dataTable.cell-border > tbody > tr > td,
89+
html.dark table.dataTable.cell-border > tbody > tr > th,
90+
table.dataTable.cell-border > tbody > tr > * {
91+
border-top-width: 2px;
92+
border-right-width: 2px;
93+
}
94+
95+
html.dark table.dataTable.cell-border > tbody > tr > td:first-child,
96+
html.dark table.dataTable.cell-border > tbody > tr > th:first-child {
97+
border-left-width: 2px;
98+
}
99+
100+
html.dark .dt-container.dt-empty-footer table.dataTable {
101+
border-bottom-width: 2px;
102+
}
70103
</style>
71104

72105
<script define:vars={{ Last, UUID }}>
@@ -77,6 +110,28 @@ const UUID = (await import("@Function/UUID/Fn.js")).default();
77110
<script>
78111
import DataTable from "datatables.net-dt";
79112

113+
export const Remove = (Container: HTMLElement, HighLight = "HighLight") =>
114+
Container.querySelectorAll<HTMLSpanElement>(
115+
`span.${HighLight}`,
116+
).forEach((Span) => (Span.outerHTML = Span.textContent ?? ""));
117+
118+
export const HighLight = (
119+
Container: HTMLElement,
120+
Search: string,
121+
HighLight = "HighLight",
122+
) => {
123+
Remove(Container, HighLight);
124+
125+
if (!Container || !Search) {
126+
return;
127+
}
128+
129+
Container.innerHTML = Container.innerHTML.replace(
130+
new RegExp(Search.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gi"),
131+
(Match: string) => `<span class="${HighLight}">${Match}</span>`,
132+
);
133+
};
134+
80135
document.addEventListener("DOMContentLoaded", () => {
81136
const Theme = () =>
82137
document
@@ -98,29 +153,38 @@ const UUID = (await import("@Function/UUID/Fn.js")).default();
98153

99154
new DataTable(`[data-uuid=${UUID}] table`, {
100155
columns: [
101-
{ title: "COMMIT MESSAGE", data: "Commit Message" },
156+
{
157+
title: "COMMIT MESSAGE",
158+
data: "Commit Message",
159+
render: (Text) =>
160+
`<span class="Text">${Text}</span>`,
161+
},
102162
{
103163
title: "AUTHOR",
104164
data: "Author",
165+
render: (Text) =>
166+
`<span class="Text">${Text}</span>`,
105167
},
106168
{
107169
title: "DATE",
108170
render: (Text) =>
109-
`${new Date(Text).toLocaleDateString()}`,
171+
`<span class="Text">${new Date(Text).toLocaleDateString()}</span>`,
110172
data: (Row) => new Date(Row.Date).getTime(),
111173
},
112174
{
113175
title: "HREF",
114176
render: (
115-
Text,
177+
_Text,
116178
_Type,
117179
Row,
118-
) => `<a class="font-medium text-amber-950 Pulse" \
119-
href="${Text}" \
180+
) => `<a class="font-medium text-green-600 dark:text-red-600 Pulse" \
181+
href="${Row.HREF}" \
120182
rel="noopener noreferrer" \
121-
target="_blank" \
122-
>@COMMIT_<span class="tabular-nums uppercase font-Hack ">${Row.SHA}</span></a>`,
123-
data: "HREF",
183+
target="_blank"> \
184+
<span class="Text">@COMMIT_</span> \
185+
<span class="tabular-nums uppercase font-Hack Text">${Row.SHA}</span> \
186+
</a>`,
187+
data: (Row) => `@COMMIT_${Row.SHA}`,
124188
},
125189
],
126190
// @ts-expect-error
@@ -131,6 +195,18 @@ const UUID = (await import("@Function/UUID/Fn.js")).default();
131195
scrollY: "1000px",
132196
processing: true,
133197
order: [[2, "desc"]],
198+
drawCallback(Internal) {
199+
document
200+
.querySelectorAll<HTMLSpanElement>(
201+
`#${Internal["sInstance"]} .Text`,
202+
)
203+
.forEach((Element) => {
204+
HighLight(
205+
Element,
206+
Internal["oPreviousSearch"]["search"],
207+
);
208+
});
209+
},
134210
});
135211
}
136212
}

Target/.vite/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Source/Function/Commit/Layout.astro?astro&type=script&index=0&lang.ts": {
3-
"file": "_astro/Layout.astro_astro_type_script_index_0_lang.CNny-EpA.js",
3+
"file": "_astro/Layout.astro_astro_type_script_index_0_lang.BPdMSmyi.js",
44
"name": "Layout.astro_astro_type_script_index_0_lang",
55
"src": "Source/Function/Commit/Layout.astro?astro&type=script&index=0&lang.ts",
66
"isEntry": true

Target/_astro/Layout.astro_astro_type_script_index_0_lang.CNny-EpA.js renamed to Target/_astro/Layout.astro_astro_type_script_index_0_lang.BPdMSmyi.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Target/index.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)