forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -179,7 +179,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
var renderRange = document.getElementById('renderRange');
|
||||
var options = calendar.getOptions();
|
||||
var viewName = calendar.getViewName();
|
||||
|
||||
var html = [];
|
||||
if (viewName === 'day') {
|
||||
html.push(calendar.getDate().toDate().toLocaleString('fr-Fr', {
|
||||
@ -221,13 +220,15 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
changeCalendarDate();
|
||||
}
|
||||
// Update current URL when date change (newDate=ISO string)
|
||||
function updateCurrentDateInUrl(newDate) {
|
||||
function updateParametersInUrl(newParams) {
|
||||
// Parse the current URL
|
||||
const currentUrl = new URL(window.location.href);
|
||||
|
||||
// Access and modify the search parameters
|
||||
const searchParams = currentUrl.searchParams;
|
||||
searchParams.set('current_date', newDate); // Set the new date
|
||||
Object.entries(newParams).forEach(([key, value]) => {
|
||||
searchParams.set(key, value);
|
||||
});
|
||||
|
||||
// Create the new URL
|
||||
const newUrl = `${currentUrl.origin}${currentUrl.pathname}?${searchParams.toString()}`;
|
||||
@ -240,7 +241,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
setRenderRangeText();
|
||||
// current calendar date, ISO, without time
|
||||
const iso_date = calendar.getDateRangeStart().toDate().toISOString().split('T')[0];
|
||||
updateCurrentDateInUrl(iso_date);
|
||||
updateParametersInUrl( { current_date: iso_date } );
|
||||
calendar_control_form.current_date.value = iso_date;
|
||||
}
|
||||
// View menu
|
||||
@ -260,6 +261,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const selectedText = this.textContent;
|
||||
const selectedView = this.getAttribute('data-view');
|
||||
calendar.changeView(selectedView); // Change the calendar view
|
||||
updateParametersInUrl( { view : selectedView } );
|
||||
setRenderRangeText();
|
||||
dropbtn.textContent = selectedText; // Update the button text
|
||||
dropdownContent.style.display = 'none';
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.6.75"
|
||||
SCOVERSION = "9.6.76"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user