Compare commits
2 Commits
8c4b8c97a1
...
28b9b9b9e8
Author | SHA1 | Date | |
---|---|---|---|
28b9b9b9e8 | |||
b7aec81ff0 |
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name Folklife 2024 schedule fixes
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 2.0
|
||||
// @version 3.0
|
||||
// @description Show schedule as a grid.
|
||||
// @author Daniel Perelman (perelman@aweirdimagination.net)
|
||||
// @match https://app.nwfolklife.org/embeddable/events/2/schedule
|
||||
|
@ -19,11 +19,27 @@
|
|||
|
||||
const w = window.wrappedJSObject || window;
|
||||
|
||||
if (window.wrappedJSObject) {
|
||||
const ourSetData = json => {
|
||||
if (!data) data = [];
|
||||
data.push(...JSON.parse(json).data.blocks);
|
||||
const ourSetData = json => {
|
||||
if (!data) data = [];
|
||||
const newData = JSON.parse(json).data;
|
||||
const newBlocks = newData.blocks;
|
||||
if (newBlocks) data.push(...newBlocks);
|
||||
const newVenues = newData.venues;
|
||||
if (newVenues) {
|
||||
// To avoid rewriting the code below, just rewrite into list of blocks.
|
||||
for (const venue of newVenues) {
|
||||
const name = venue.name
|
||||
const blocks = venue.blocks
|
||||
for (const b of blocks) {
|
||||
b.venue = { name }
|
||||
}
|
||||
data.push(...blocks)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (window.wrappedJSObject) {
|
||||
|
||||
|
||||
exportFunction(ourSetData, window, { defineAs: "shareDataWithFixes" })
|
||||
w.eval("window.originalFetch = window.fetch")
|
||||
|
@ -47,9 +63,7 @@
|
|||
const response = await originalFetch(resource, config);
|
||||
// response interceptor here
|
||||
if (!data) data = [];
|
||||
const newData = (await response.clone().json()).data
|
||||
const newBlocks = newData.blocks
|
||||
if (newBlocks) data.push(...newBlocks);
|
||||
ourSetData(await response.clone().text());
|
||||
return response;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user