-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace jQuery document load event handler with javascript native ver…
…sion (#6630) --------- Co-authored-by: David Liu <[email protected]>
- Loading branch information
1 parent
b9311ba
commit 0ba549f
Showing
45 changed files
with
522 additions
and
410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
$(document).ready(function () { | ||
window.modal_add_section = new ModalMarkus("#add_new_section_dialog"); | ||
}); | ||
(function () { | ||
const domContentLoadedCB = function () { | ||
window.modal_add_section = new ModalMarkus("#add_new_section_dialog"); | ||
}; | ||
|
||
if (document.readyState === "loading") { | ||
document.addEventListener("DOMContentLoaded", domContentLoadedCB); | ||
} else { | ||
domContentLoadedCB(); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
var modalNotesGroup = null; | ||
|
||
$(document).ready(function () { | ||
modalNotesGroup = new ModalMarkus("#notes_dialog"); | ||
}); | ||
(function () { | ||
const domContentLoadedCB = function () { | ||
modalNotesGroup = new ModalMarkus("#notes_dialog"); | ||
}; | ||
|
||
if (document.readyState === "loading") { | ||
document.addEventListener("DOMContentLoaded", domContentLoadedCB); | ||
} else { | ||
domContentLoadedCB(); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
$(document).ready(function () { | ||
document.addEventListener("DOMContentLoaded", function () { | ||
window.modal_add_section = new ModalMarkus("#add_new_section_dialog"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
$(document).ready(function () { | ||
var MAX_SIZE = 120; | ||
var current_char = 0; | ||
(function () { | ||
const domContentLoadedCB = function () { | ||
var MAX_SIZE = 120; | ||
var current_char = 0; | ||
|
||
// Gets the area where the char count is. | ||
var char_count = $("#descript_amount"); | ||
char_count.html(current_char + "/" + MAX_SIZE); | ||
// Gets the area where the char count is. | ||
var char_count = $("#descript_amount"); | ||
char_count.html(current_char + "/" + MAX_SIZE); | ||
|
||
//Sets the max size on the text field. | ||
$("#description").attr("maxlength", MAX_SIZE.toString()); | ||
//Sets the max size on the text field. | ||
$("#description").attr("maxlength", MAX_SIZE.toString()); | ||
|
||
// Now, on key up, we update. | ||
$("#description").keyup(function () { | ||
current_char = $("#description").val().length; | ||
char_count.html(current_char + "/" + MAX_SIZE); | ||
}); | ||
}); | ||
// Now, on key up, we update. | ||
$("#description").keyup(function () { | ||
current_char = $("#description").val().length; | ||
char_count.html(current_char + "/" + MAX_SIZE); | ||
}); | ||
}; | ||
|
||
if (document.readyState === "loading") { | ||
document.addEventListener("DOMContentLoaded", domContentLoadedCB); | ||
} else { | ||
domContentLoadedCB(); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,49 @@ | ||
// Requires Chart.js to have been loaded. | ||
$(document).ready(function () { | ||
let bars = document.documentElement.style.getPropertyValue("--primary_one"); | ||
let ticksColor = document.documentElement.style.getPropertyValue("--line"); | ||
let labelColor = document.documentElement.style.getPropertyValue("--line"); | ||
let gridLineColor = document.documentElement.style.getPropertyValue("--gridline"); | ||
|
||
Chart.defaults.color = labelColor; | ||
Chart.defaults.borderColor = bars; | ||
Chart.defaults.backgroundColor = bars; | ||
Chart.defaults.elements.bar.backgroundColor = bars; | ||
Chart.defaults.elements.bar.borderColor = bars; | ||
|
||
Chart.overrides.bar.scales.y = { | ||
grid: { | ||
color: gridLineColor, | ||
}, | ||
beginAtZero: true, | ||
ticks: { | ||
color: ticksColor, | ||
}, | ||
}; | ||
(function () { | ||
// Requires Chart.js to have been loaded. | ||
const domContentLoadedCB = function () { | ||
let bars = document.documentElement.style.getPropertyValue("--primary_one"); | ||
let ticksColor = document.documentElement.style.getPropertyValue("--line"); | ||
let labelColor = document.documentElement.style.getPropertyValue("--line"); | ||
let gridLineColor = document.documentElement.style.getPropertyValue("--gridline"); | ||
|
||
Chart.defaults.color = labelColor; | ||
Chart.defaults.borderColor = bars; | ||
Chart.defaults.backgroundColor = bars; | ||
Chart.defaults.elements.bar.backgroundColor = bars; | ||
Chart.defaults.elements.bar.borderColor = bars; | ||
|
||
Chart.overrides.bar.scales.y = { | ||
grid: { | ||
color: gridLineColor, | ||
}, | ||
beginAtZero: true, | ||
ticks: { | ||
color: ticksColor, | ||
}, | ||
}; | ||
|
||
Chart.defaults.type = "bar"; | ||
Chart.defaults.type = "bar"; | ||
|
||
Chart.overrides.bar.scales.x = { | ||
ticks: { | ||
type: "linear", | ||
color: ticksColor, | ||
}, | ||
grid: { | ||
color: gridLineColor, | ||
Chart.overrides.bar.scales.x = { | ||
ticks: { | ||
type: "linear", | ||
color: ticksColor, | ||
}, | ||
grid: { | ||
color: gridLineColor, | ||
offset: true, | ||
}, | ||
offset: true, | ||
}, | ||
offset: true, | ||
}; | ||
}; | ||
|
||
Chart.defaults.plugins.legend.display = false; | ||
Chart.defaults.plugins.legend.labels.fontColor = labelColor; | ||
|
||
Chart.defaults.plugins.legend.display = false; | ||
Chart.defaults.plugins.legend.labels.fontColor = labelColor; | ||
Chart.defaults.datasets.bar.barPercentage = 0.9; | ||
Chart.defaults.datasets.bar.categoryPercentage = 0.8; | ||
|
||
Chart.defaults.datasets.bar.barPercentage = 0.9; | ||
Chart.defaults.datasets.bar.categoryPercentage = 0.8; | ||
Chart.defaults.animation.duration = 0; | ||
}; | ||
|
||
Chart.defaults.animation.duration = 0; | ||
}); | ||
document.addEventListener("DOMContentLoaded", domContentLoadedCB); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
$(document).ready(() => { | ||
setInterval(() => { | ||
$.get(Routes.check_timeout_main_index_path()); | ||
}, 120000); | ||
}); | ||
(function () { | ||
const domContentLoadedCB = () => { | ||
setInterval(() => { | ||
$.get(Routes.check_timeout_main_index_path()); | ||
}, 120000); | ||
}; | ||
|
||
document.addEventListener("DOMContentLoaded", domContentLoadedCB); | ||
})(); |
Oops, something went wrong.