Skip to content

Commit a86e092

Browse files
puxlithobinjk
authored andcommitted
Apply proper fix for #1509 to xkit_patches
1 parent f66a964 commit a86e092

1 file changed

Lines changed: 56 additions & 1 deletion

File tree

Extensions/xkit_patches.js

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//* TITLE XKit Patches **//
2-
//* VERSION 6.8.10 **//
2+
//* VERSION 6.8.11 **//
33
//* DESCRIPTION Patches framework **//
44
//* DEVELOPER new-xkit **//
55

@@ -2435,6 +2435,61 @@ XKit.extensions.xkit_patches = new Object({
24352435
}
24362436
};
24372437

2438+
// Expedited fix for #1509; revert after updated XKit extension has been widely installed.
2439+
XKit.download.github_fetch = function(path, callback) {
2440+
var url = 'https://new-xkit.github.io/XKit/Extensions/dist/' + path;
2441+
GM_xmlhttpRequest({
2442+
method: "GET",
2443+
url: url,
2444+
onerror: function(response) {
2445+
XKit.console.add("Unable to download '" + path + "'");
2446+
callback({errors: true, server_down: true});
2447+
},
2448+
onload: function(response) {
2449+
// We are done!
2450+
var mdata = {};
2451+
try {
2452+
mdata = jQuery.parseJSON(response.responseText);
2453+
} catch (e) {
2454+
// Server returned bad thingy.
2455+
XKit.console.add("Unable to download '" + path +
2456+
"', server returned non-json object." + e.message);
2457+
callback({errors: true, server_down: true});
2458+
return;
2459+
}
2460+
callback(mdata);
2461+
}
2462+
});
2463+
};
2464+
XKit.download.extension = function(extension_id, callback) {
2465+
XKit.download.github_fetch(extension_id + '.json', callback);
2466+
};
2467+
XKit.download.page = function(page, callback) {
2468+
if (page === 'list.php') {
2469+
XKit.download.github_fetch('page/list.json', callback);
2470+
return;
2471+
}
2472+
if (page === 'gallery.php') {
2473+
XKit.download.github_fetch('page/gallery.json', callback);
2474+
return;
2475+
}
2476+
if (page === 'themes/index.php') {
2477+
XKit.download.github_fetch('page/themes.json', callback);
2478+
return;
2479+
}
2480+
if (page === 'paperboy/index.php') {
2481+
XKit.download.github_fetch('page/paperboy.json', callback);
2482+
return;
2483+
}
2484+
if (page === 'framework_version.php') {
2485+
XKit.download.github_fetch('page/framework_version.json', callback);
2486+
return;
2487+
}
2488+
};
2489+
delete XKit.servers;
2490+
delete XKit.download.try_count;
2491+
delete XKit.download.max_try_count;
2492+
24382493
},
24392494

24402495
/**

0 commit comments

Comments
 (0)