mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-04-25 07:21:36 +00:00
Fix the wrong behaviour for reply anchor introduced by the base tag
This commit is contained in:
@@ -120,7 +120,7 @@
|
|||||||
{% if msg.reply is not none %}
|
{% if msg.reply is not none %}
|
||||||
<div class="reply">
|
<div class="reply">
|
||||||
<span class="blue">Replying to </span>
|
<span class="blue">Replying to </span>
|
||||||
<a href="#{{msg.reply}}" class="reply_link">
|
<a href="#{{msg.reply}}" target="_self" class="reply_link no-base">
|
||||||
{% if msg.quoted_data is not none %}
|
{% if msg.quoted_data is not none %}
|
||||||
"{{msg.quoted_data}}"
|
"{{msg.quoted_data}}"
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
{% if msg.reply is not none %}
|
{% if msg.reply is not none %}
|
||||||
<div class="reply">
|
<div class="reply">
|
||||||
<span class="blue">Replying to </span>
|
<span class="blue">Replying to </span>
|
||||||
<a href="#{{msg.reply}}" class="reply_link">
|
<a href="#{{msg.reply}}" target="_self" class="reply_link no-base">
|
||||||
{% if msg.quoted_data is not none %}
|
{% if msg.quoted_data is not none %}
|
||||||
"{{msg.quoted_data}}"
|
"{{msg.quoted_data}}"
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -313,5 +313,17 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
// Prevent the <base> tag from affecting links with the class "no-base"
|
||||||
|
document.querySelectorAll('.no-base').forEach(link => {
|
||||||
|
link.addEventListener('click', function(event) {
|
||||||
|
const href = this.getAttribute('href');
|
||||||
|
if (href.startsWith('#')) {
|
||||||
|
window.location.hash = href;
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
<div class="flex justify-end" id="{{ msg.key_id }}">
|
<div class="flex justify-end" id="{{ msg.key_id }}">
|
||||||
<div class="bg-whatsapp-light rounded-lg p-2 max-w-[80%] shadow-sm">
|
<div class="bg-whatsapp-light rounded-lg p-2 max-w-[80%] shadow-sm">
|
||||||
{% if msg.reply is not none %}
|
{% if msg.reply is not none %}
|
||||||
<a href="#{{msg.reply}}" target="_self">
|
<a href="#{{msg.reply}}" target="_self" class="no-base">
|
||||||
<div class="mb-2 p-1 bg-whatsapp-chat-light rounded border-l-4 border-whatsapp text-sm reply-box">
|
<div class="mb-2 p-1 bg-whatsapp-chat-light rounded border-l-4 border-whatsapp text-sm reply-box">
|
||||||
<p class="text-whatsapp font-medium text-xs">Replying to</p>
|
<p class="text-whatsapp font-medium text-xs">Replying to</p>
|
||||||
<p class="text-[#111b21] text-xs truncate">
|
<p class="text-[#111b21] text-xs truncate">
|
||||||
@@ -271,7 +271,7 @@
|
|||||||
<div class="flex justify-start" id="{{ msg.key_id }}">
|
<div class="flex justify-start" id="{{ msg.key_id }}">
|
||||||
<div class="bg-white rounded-lg p-2 max-w-[80%] shadow-sm">
|
<div class="bg-white rounded-lg p-2 max-w-[80%] shadow-sm">
|
||||||
{% if msg.reply is not none %}
|
{% if msg.reply is not none %}
|
||||||
<a href="#{{msg.reply}}" target="_self">
|
<a href="#{{msg.reply}}" target="_self" class="no-base">
|
||||||
<div class="mb-2 p-1 bg-whatsapp-chat-light rounded border-l-4 border-whatsapp text-sm reply-box">
|
<div class="mb-2 p-1 bg-whatsapp-chat-light rounded border-l-4 border-whatsapp text-sm reply-box">
|
||||||
<p class="text-whatsapp font-medium text-xs">Replying to</p>
|
<p class="text-whatsapp font-medium text-xs">Replying to</p>
|
||||||
<p class="text-[#808080] text-xs truncate">
|
<p class="text-[#808080] text-xs truncate">
|
||||||
@@ -409,4 +409,16 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
// Prevent the <base> tag from affecting links with the class "no-base"
|
||||||
|
document.querySelectorAll('.no-base').forEach(link => {
|
||||||
|
link.addEventListener('click', function(event) {
|
||||||
|
const href = this.getAttribute('href');
|
||||||
|
if (href.startsWith('#')) {
|
||||||
|
window.location.hash = href;
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user