Skip to content

Commit

Permalink
move new utility function to xkit.js
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon committed Dec 4, 2024
1 parent b343c5f commit f7ef200
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
13 changes: 0 additions & 13 deletions Extensions/xkit_patches.js
Original file line number Diff line number Diff line change
Expand Up @@ -1178,19 +1178,6 @@ XKit.extensions.xkit_patches = new Object({
destroy_collapsed: function(id) {
$(`.${id}-collapsed`).removeClass(`${id}-collapsed`);
$(`.${id}-collapsed-note`).remove();
},

api_fetch: async function(resource, init) {
return XKit.tools.async_add_function(
async ({ resource, init = {}, headerVersion }) => { // eslint-disable-line no-shadow
// add XKit header to all API requests
if (!init.headers) init.headers = {};
init.headers['X-XKit-Version'] = headerVersion;

return window.tumblr.apiFetch(resource, init);
},
{ resource, init, headerVersion: XKit.version }
);
}
};

Expand Down
13 changes: 13 additions & 0 deletions xkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4239,6 +4239,19 @@ var xkit_global_start = Date.now(); // log start timestamp
destroy_collapsed: function(id) {
$(`.${id}-collapsed`).removeClass(`${id}-collapsed`);
$(`.${id}-collapsed-note`).remove();
},

api_fetch: async function(resource, init) {
return XKit.tools.async_add_function(
async ({ resource, init = {}, headerVersion }) => { // eslint-disable-line no-shadow
// add XKit header to all API requests
if (!init.headers) init.headers = {};
init.headers['X-XKit-Version'] = headerVersion;

return window.tumblr.apiFetch(resource, init);
},
{ resource, init, headerVersion: XKit.version }
);
}
};

Expand Down

0 comments on commit f7ef200

Please sign in to comment.