Skip to content

Commit

Permalink
Apply proper fix for #1509 to xkit_patches
Browse files Browse the repository at this point in the history
  • Loading branch information
puxlit authored and hobinjk committed Mar 31, 2018
1 parent f66a964 commit a86e092
Showing 1 changed file with 56 additions and 1 deletion.
57 changes: 56 additions & 1 deletion Extensions/xkit_patches.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* TITLE XKit Patches **//
//* VERSION 6.8.10 **//
//* VERSION 6.8.11 **//
//* DESCRIPTION Patches framework **//
//* DEVELOPER new-xkit **//

Expand Down Expand Up @@ -2435,6 +2435,61 @@ XKit.extensions.xkit_patches = new Object({
}
};

// Expedited fix for #1509; revert after updated XKit extension has been widely installed.
XKit.download.github_fetch = function(path, callback) {
var url = 'https://new-xkit.github.io/XKit/Extensions/dist/' + path;
GM_xmlhttpRequest({
method: "GET",
url: url,
onerror: function(response) {
XKit.console.add("Unable to download '" + path + "'");
callback({errors: true, server_down: true});
},
onload: function(response) {
// We are done!
var mdata = {};
try {
mdata = jQuery.parseJSON(response.responseText);
} catch (e) {
// Server returned bad thingy.
XKit.console.add("Unable to download '" + path +
"', server returned non-json object." + e.message);
callback({errors: true, server_down: true});
return;
}
callback(mdata);
}
});
};
XKit.download.extension = function(extension_id, callback) {
XKit.download.github_fetch(extension_id + '.json', callback);
};
XKit.download.page = function(page, callback) {
if (page === 'list.php') {
XKit.download.github_fetch('page/list.json', callback);
return;
}
if (page === 'gallery.php') {
XKit.download.github_fetch('page/gallery.json', callback);
return;
}
if (page === 'themes/index.php') {
XKit.download.github_fetch('page/themes.json', callback);
return;
}
if (page === 'paperboy/index.php') {
XKit.download.github_fetch('page/paperboy.json', callback);
return;
}
if (page === 'framework_version.php') {
XKit.download.github_fetch('page/framework_version.json', callback);
return;
}
};
delete XKit.servers;
delete XKit.download.try_count;
delete XKit.download.max_try_count;

},

/**
Expand Down

0 comments on commit a86e092

Please sign in to comment.