hotfix: fix js bug for code controls

pull/4739/head
Scott Anderson 2023-02-02 09:45:06 -07:00
parent f70a22afea
commit aff1587d8d
2 changed files with 30 additions and 4 deletions

View File

@ -28,11 +28,11 @@ $(document).click(function() {
// Click the code controls toggle to open code controls
$('.code-controls-toggle').click(function() {
$(this).parent().toggleClass('open');
$(this).parent('.code-controls').toggleClass('open');
})
// Stop event propagation for clicks inside of the code-controls div
$(".code-controls").click(function(e) {
$('.code-controls').click(function(e) {
e.stopPropagation();
});

View File

@ -82,9 +82,18 @@ function updateTimestamps(newStartDate) {
}
})
$('.get-started-timestamps').each(function() {
var updateBlockElWhitelist = [
'.get-started-timestamps pre',
'.get-started-timestamps li',
'.get-started-timestamps p',
'.get-started-timestamps table'
]
$(updateBlockElWhitelist.join()).each(function() {
var wrapper = $(this)[0]
console.log(wrapper)
times.forEach(function(x) {
oldDatePart = datePart(x.rfc3339.replace(/T.*$/, ""))
newDatePart = datePart(x.rfc3339_new.replace(/T.*$/, ""))
@ -96,9 +105,26 @@ function updateTimestamps(newStartDate) {
.replaceAll(x.unix, x.unix_new)
.replaceAll(rfc3339Regex, rfc3339Repl)
})
console.log(times)
})
$('span.get-started-timestamps').each(function() {
var wrapper = $(this)[0]
console.log(wrapper)
times.forEach(function(x) {
oldDatePart = datePart(x.rfc3339.replace(/T.*$/, ""))
newDatePart = datePart(x.rfc3339_new.replace(/T.*$/, ""))
rfc3339Regex = new RegExp(`${oldDatePart.year}-${oldDatePart.month}-${oldDatePart.day}`, 'g')
rfc3339Repl = `${newDatePart.year}-${newDatePart.month}-${newDatePart.day}`
wrapper.innerHTML =
wrapper.innerHTML
.replaceAll(x.unix, x.unix_new)
.replaceAll(rfc3339Regex, rfc3339Repl)
})
})
// Create a new seed times array with new start time for next change
times = times.map(x => {
var newStartTimestamp = x.rfc3339.replace(/^.*T/, newStartDate + "T")