replace "DOMContentLoaded" with "load"

master
Aevann 2022-12-27 03:45:30 +02:00
parent 8bb55236e3
commit 264ed60cc4
13 changed files with 15 additions and 15 deletions

View File

@ -281,7 +281,7 @@ if (document.readyState === "complete" ||
(document.readyState !== "loading" && !document.documentElement.doScroll)) { (document.readyState !== "loading" && !document.documentElement.doScroll)) {
bsTriggerOnReady(); bsTriggerOnReady();
} else { } else {
document.addEventListener("DOMContentLoaded", bsTriggerOnReady); document.addEventListener("load", bsTriggerOnReady);
} }
function escapeHTML(unsafe) { function escapeHTML(unsafe) {

View File

@ -41,7 +41,7 @@ if (
) { ) {
lotteryOnReady(); lotteryOnReady();
} else { } else {
document.addEventListener("DOMContentLoaded", lotteryOnReady); document.addEventListener("load", lotteryOnReady);
} }
function purchaseLotteryTicket() { function purchaseLotteryTicket() {

View File

@ -224,7 +224,7 @@
) { ) {
initializeBlackjack(); initializeBlackjack();
} else { } else {
document.addEventListener("DOMContentLoaded", initializeBlackjack); document.addEventListener("load", initializeBlackjack);
} }
</script> </script>
{% endblock %} {% endblock %}

View File

@ -41,7 +41,7 @@
) { ) {
initializeGame(); initializeGame();
} else { } else {
document.addEventListener("DOMContentLoaded", initializeGame); document.addEventListener("load", initializeGame);
} }
function initializeGame() { function initializeGame() {

View File

@ -8,7 +8,7 @@
) { ) {
initializeGame(); initializeGame();
} else { } else {
document.addEventListener("DOMContentLoaded", initializeGame); document.addEventListener("load", initializeGame);
} }
// Kiss my ass if you're judgin' // Kiss my ass if you're judgin'

View File

@ -81,7 +81,7 @@
{% if g.browser == 'apple' %} {% if g.browser == 'apple' %}
<script nonce="{{g.nonce}}"> <script nonce="{{g.nonce}}">
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('load', function() {
const videos = document.querySelectorAll('video') const videos = document.querySelectorAll('video')
for (const video of videos) { for (const video of videos) {

View File

@ -10,7 +10,7 @@
{% if p.award_count("snow", v) %} {% if p.award_count("snow", v) %}
<script defer src="{{'event/js/snow.js'|asset}}"></script> <script defer src="{{'event/js/snow.js'|asset}}"></script>
<script nonce="{{g.nonce}}"> <script nonce="{{g.nonce}}">
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("load", () => {
snow(80) snow(80)
}); });
</script> </script>

View File

@ -2,7 +2,7 @@
{% if request.path == '/' %} {% if request.path == '/' %}
<script defer src="{{'event/js/snow.js'|asset}}"></script> <script defer src="{{'event/js/snow.js'|asset}}"></script>
<script nonce="{{g.nonce}}"> <script nonce="{{g.nonce}}">
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("load", () => {
snow(80) snow(80)
}); });
</script> </script>

View File

@ -170,7 +170,7 @@
{% if request.path == '/' and v %} {% if request.path == '/' and v %}
<script defer src="/assets/js/register_service_worker.js"></script> <script defer src="/assets/js/register_service_worker.js"></script>
<script nonce="{{g.nonce}}"> <script nonce="{{g.nonce}}">
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('load', function () {
registerServiceWorker( registerServiceWorker(
"/assets/js/service_worker.js", "/assets/js/service_worker.js",
"{{VAPID_PUBLIC_KEY}}", "{{VAPID_PUBLIC_KEY}}",
@ -196,7 +196,7 @@
<script nonce="{{g.nonce}}"> <script nonce="{{g.nonce}}">
if (!window.matchMedia('(display-mode: minimal-ui)')['matches']) { if (!window.matchMedia('(display-mode: minimal-ui)')['matches']) {
if (window.innerWidth <= 737) { if (window.innerWidth <= 737) {
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('load', function() {
const tt = bootstrap.Tooltip.getOrCreateInstance(document.getElementById('mobile-prompt')) const tt = bootstrap.Tooltip.getOrCreateInstance(document.getElementById('mobile-prompt'))
tt.show() tt.show()
document.getElementsByClassName('tooltip')[0].onclick = function(e) { document.getElementsByClassName('tooltip')[0].onclick = function(e) {

View File

@ -43,7 +43,7 @@
</div> </div>
<script nonce="{{g.nonce}}"> <script nonce="{{g.nonce}}">
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('load', function() {
for (const x of ['css','profilecss']) { for (const x of ['css','profilecss']) {
const ta = document.getElementById(`${x}-textarea`); const ta = document.getElementById(`${x}-textarea`);
autoExpand(ta); autoExpand(ta);

View File

@ -280,7 +280,7 @@
{% if v.flairchanged %} {% if v.flairchanged %}
<script nonce="{{g.nonce}}"> <script nonce="{{g.nonce}}">
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('load', function() {
const date = formatDate(new Date({{v.flairchanged}}*1000)); const date = formatDate(new Date({{v.flairchanged}}*1000));
const text = ` - Your flair has been locked until ${date}`; const text = ` - Your flair has been locked until ${date}`;
document.getElementById('flair-body').value += text; document.getElementById('flair-body').value += text;
@ -327,7 +327,7 @@
{%- endif %} {%- endif %}
{% if FEATURES['USERS_PERMANENT_WORD_FILTERS'] -%} {% if FEATURES['USERS_PERMANENT_WORD_FILTERS'] -%}
<script nonce="{{g.nonce}}"> <script nonce="{{g.nonce}}">
document.addEventListener("DOMContentLoaded", function (event) { document.addEventListener("load", function (event) {
const sr_toggle = document.getElementById("slurreplacer"); const sr_toggle = document.getElementById("slurreplacer");
const sr_link = document.getElementById('slurreplacer-perma-link'); const sr_link = document.getElementById('slurreplacer-perma-link');
const pr_toggle = document.getElementById("profanityreplacer"); const pr_toggle = document.getElementById("profanityreplacer");

View File

@ -418,7 +418,7 @@
{% if not v or v.highlightcomments %} {% if not v or v.highlightcomments %}
<script nonce="{{g.nonce}}"> <script nonce="{{g.nonce}}">
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('load', function() {
showNewCommentCounts('{{p.id}}', {{p.comment_count}}) showNewCommentCounts('{{p.id}}', {{p.comment_count}})
{% if "?context" not in request.full_path %} {% if "?context" not in request.full_path %}
localStorage.setItem("old-comment-counts", localStorage.getItem("comment-counts")) localStorage.setItem("old-comment-counts", localStorage.getItem("comment-counts"))

View File

@ -216,7 +216,7 @@
<script nonce="{{g.nonce}}"> <script nonce="{{g.nonce}}">
{% if not v or v.highlightcomments %} {% if not v or v.highlightcomments %}
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('load', function() {
showNewCommentCounts({{p.id}}, {{p.comment_count}}) showNewCommentCounts({{p.id}}, {{p.comment_count}})
}) })
{% endif %} {% endif %}