feat: add "other" button with dynamic link list for additional projects and services
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
+48
-1
@@ -100,10 +100,31 @@
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<form method="get" action="/about_me">
|
||||
<form method="get" action="/about_me">
|
||||
<button class="name noselect">about me</button>
|
||||
</form>
|
||||
</table>
|
||||
|
||||
<div id="Other_wrap">
|
||||
<button type="button" id="Other_btn" class="noselect" aria-expanded="false" aria-controls="Other_list">other</button>
|
||||
<div id="Other_list">
|
||||
<?php foreach ($global->other_links as $section => $links): ?>
|
||||
<div class="other-section"><?php echo htmlspecialchars($section); ?></div>
|
||||
<ul>
|
||||
<?php foreach ($links as $link):
|
||||
$is_external = strpos($link[1], 'http') === 0; ?>
|
||||
<li><a href="<?php echo htmlspecialchars($link[1]); ?>"<?php if ($is_external) echo ' target="_blank" rel="noopener"'; ?>>
|
||||
<span><?php echo htmlspecialchars($link[0]); ?></span>
|
||||
<?php if ($link[2] !== ''): ?>
|
||||
<span class="other-note"><?php echo htmlspecialchars($link[2]); ?></span>
|
||||
<?php endif; ?>
|
||||
</a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endforeach; ?>
|
||||
<div id="Other_list_arrow"></div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -136,6 +157,32 @@
|
||||
$("#Bank_info_ext").stop().fadeOut(300);
|
||||
});
|
||||
|
||||
var $otherBtn = $("#Other_btn");
|
||||
var $otherList = $("#Other_list");
|
||||
|
||||
function setOtherOpen(open) {
|
||||
if (open === ($otherBtn.attr("aria-expanded") === "true")) return;
|
||||
$otherBtn.attr("aria-expanded", open ? "true" : "false");
|
||||
if (open) {
|
||||
$otherList.stop(true, true).fadeIn(200);
|
||||
} else {
|
||||
$otherList.stop(true, true).fadeOut(200);
|
||||
}
|
||||
}
|
||||
|
||||
$otherBtn.on("click", function () {
|
||||
setOtherOpen($otherBtn.attr("aria-expanded") !== "true");
|
||||
});
|
||||
|
||||
// close on click outside or Escape
|
||||
$(document).on("click", function (e) {
|
||||
if (!$(e.target).closest("#Other_wrap").length) setOtherOpen(false);
|
||||
});
|
||||
|
||||
$(document).on("keydown", function (e) {
|
||||
if (e.key === "Escape" || e.keyCode === 27) setOtherOpen(false);
|
||||
});
|
||||
|
||||
function copyNumber() {
|
||||
copyToClipboard('<?php echo $global->phone_list[0]; ?>');
|
||||
alert("phone copied to clipboard")
|
||||
|
||||
Reference in New Issue
Block a user