Skip to content

Commit

Permalink
Move hash to window
Browse files Browse the repository at this point in the history
  • Loading branch information
V13Axel committed Jul 7, 2024
1 parent 75cdc54 commit 010294e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions resources/js/calendar-events-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ export default () => ({
let type = condition_selected[0][0];
let placeholder = condition_selected[0][1];
let alt = condition_selected[0][0];
let value = this.epoch_data ? this.epoch_data.year : dynamic_data.year;
let value = this.epoch_data ? this.epoch_data.year : window.dynamic_data.year;
let min = condition_selected[0][4];
let max = condition_selected[0][5];

Expand Down Expand Up @@ -2500,7 +2500,7 @@ export default () => ({
let post = "";

if (window.location.pathname !== '/calendars/create' && !event_has_changed) {
pre = `<a href='${window.baseurl}calendars/${hash}?year=${year}&month=${timespan}&day=${day}' target="_blank">`;
pre = `<a href='${window.baseurl}calendars/${window.hash}?year=${year}&month=${timespan}&day=${day}' target="_blank">`;
post = `</a>`;
}

Expand Down
2 changes: 1 addition & 1 deletion resources/js/calendar-layouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default () => ({
show_loading_screen();
let previous_layout = window.static_data.settings.layout;
window.static_data.settings.layout = layout.name.toLowerCase();
do_update_all(hash, function(){
do_update_all(window.hash, function(){
window.onbeforeunload = function () {}
window.location.reload(false);
}, function(){
Expand Down
30 changes: 15 additions & 15 deletions resources/js/calendar/calendar_ajax_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export function getUrlParameter(sParam) {

export function update_name() {
$.ajax({
url: window.baseurl + "calendars/" + hash,
url: window.baseurl + "calendars/" + window.hash,
type: "post",
dataType: 'json',
data: { _method: 'PATCH', name: calendar_name, hash: hash },
data: { _method: 'PATCH', name: window.calendar_name, hash: window.hash },
success: function(result) {
prev_calendar_name = calendar_name;
document.title = calendar_name + " - Fantasy Calendar";
window.prev_calendar_name = window.calendar_name;
document.title = window.calendar_name + " - Fantasy Calendar";
calendar_saved();
},
error: function(error) {
Expand Down Expand Up @@ -91,7 +91,7 @@ export function update_dynamic(calendar_hash, callback) {

export function update_all() {

check_last_change(hash, function(output) {
check_last_change(window.hash, function(output) {

var new_static_change = new Date(output.last_static_change)

Expand All @@ -105,7 +105,7 @@ export function update_all() {

}

do_update_all(hash);
do_update_all(window.hash);

});
}
Expand Down Expand Up @@ -218,12 +218,12 @@ export function link_child_calendar(child_hash, parent_link_date, parent_offset)
dataType: 'json',
data: {
_method: "PATCH",
parent_hash: hash,
parent_hash: window.hash,
parent_link_date: parent_link_date,
parent_offset: parent_offset
},
success: function(result) {
update_dynamic(hash, () => {
update_dynamic(window.hash, () => {
window.location.reload();
});
},
Expand All @@ -248,7 +248,7 @@ export function unlink_child_calendar(output, child_hash) {
parent_offset: "",
},
success: function(result) {
update_dynamic(hash, () => {
update_dynamic(window.hash, () => {
window.location.reload();
});
},
Expand All @@ -262,7 +262,7 @@ export function unlink_child_calendar(output, child_hash) {

export function get_calendar_users(callback) {
$.ajax({
url: window.apiurl + "/calendar/" + hash + "/users",
url: window.apiurl + "/calendar/" + window.hash + "/users",
type: "get",
dataType: "json",
success: function(result) {
Expand All @@ -275,7 +275,7 @@ export function get_calendar_users(callback) {
}

export function add_calendar_user(email, output) {
axios.post(window.apiurl + "/calendar/" + hash + "/inviteUser", { email: email })
axios.post(window.apiurl + "/calendar/" + window.hash + "/inviteUser", { email: email })
.then(function(result) {
output(true, `Sent email to ${email}!`);
})
Expand All @@ -286,7 +286,7 @@ export function add_calendar_user(email, output) {

export function update_calendar_user(user_id, permission, output) {

axios.post(window.apiurl + "/calendar/" + hash + "/changeUserRole", { user_role: permission, user_id: user_id })
axios.post(window.apiurl + "/calendar/" + window.hash + "/changeUserRole", { user_role: permission, user_id: user_id })
.then(function(result) {
output(true, 'Updated permissions!');
})
Expand All @@ -302,7 +302,7 @@ export function remove_calendar_user(user_id, remove_all, callback, email = null
userdata.email = email;
}

axios.post(window.apiurl + "/calendar/" + hash + "/removeUser", userdata)
axios.post(window.apiurl + "/calendar/" + window.hash + "/removeUser", userdata)
.then(function(result) {
callback();
})
Expand All @@ -315,7 +315,7 @@ export function remove_calendar_user(user_id, remove_all, callback, email = null

export function resend_calendar_invite(email, output) {

axios.post(window.apiurl + "/calendar/" + hash + "/resend_invite", { email: email })
axios.post(window.apiurl + "/calendar/" + window.hash + "/resend_invite", { email: email })
.then(function(result) {
output(true, 'Resent invitation');
})
Expand Down Expand Up @@ -472,7 +472,7 @@ export function submit_delete_comment(comment_id, callback) {

export function get_owned_calendars(output) {
$.ajax({
url: window.apiurl + "/calendar/" + hash + "/owned",
url: window.apiurl + "/calendar/" + window.hash + "/owned",
type: "get",
dataType: 'json',
data: {},
Expand Down
10 changes: 5 additions & 5 deletions resources/js/calendar/calendar_inputs_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function set_up_edit_inputs() {
if (!events_same || !event_categories_same || !static_same || !advancement_same) {
update_all();
} else if (!dynamic_same) {
update_dynamic(hash);
update_dynamic(window.hash);
} else if (!calendar_name_same) {
update_name();
}
Expand Down Expand Up @@ -145,7 +145,7 @@ export function set_up_edit_inputs() {
delete_button = $('#btn_delete');

delete_button.click(function() {
delete_calendar(hash, calendar_name, function() { self.location = '/calendars' });
delete_calendar(window.hash, calendar_name, function() { self.location = '/calendars' });
});

calendar_container = $('#calendar');
Expand Down Expand Up @@ -5472,7 +5472,7 @@ function populate_calendar_lists() {

var calendar = owned_calendars[calendar_hash];

if (calendar.hash == hash) {
if (calendar.hash == window.hash) {

for (var index in calendar.children) {

Expand All @@ -5495,13 +5495,13 @@ function populate_calendar_lists() {

var child_calendar = owned_calendars[calendar_hash];

if (child_calendar.hash != hash) {
if (child_calendar.hash != window.hash) {

if (child_calendar.parent_hash) {

var calendar_owner = clone(owned_calendars[child_calendar.parent_hash]);

if (calendar_owner.hash == hash) {
if (calendar_owner.hash == window.hash) {
calendar_owner.name = "this calendar";
}

Expand Down

0 comments on commit 010294e

Please sign in to comment.