Skip to content

Instantly share code, notes, and snippets.

@paretje
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paretje/a4186175756f72e8e5e0 to your computer and use it in GitHub Desktop.
Save paretje/a4186175756f72e8e5e0 to your computer and use it in GitHub Desktop.
Force HTTPS, in combination with HTTPS Everywhere, on UGent Minerva
// ==UserScript==
// @name HTTPS Minerva
// @version 0.1.3
// @namespace http://www.online-urbanus.be
// @downloadURL https://gist.github.com/paretje/a4186175756f72e8e5e0/raw/https-minerva.user.js
// @updateURL https://gist.github.com/paretje/a4186175756f72e8e5e0/raw/https-minerva.user.js
// @include https://minerva.ugent.be/*
// @grant none
// ==/UserScript==
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
if (url.substr(0, 23) == "http://minerva.ugent.be") {
url = "https" + url.substr(4);
}
return jQuery.ajax({
url: url,
type: method,
dataType: type,
data: data,
success: callback
});
};
});
$("img").each(function() {
url = $(this).attr('src');
if (url && url.substr(0, 23) == "http://minerva.ugent.be") {
$(this).attr('src', "https" + url.substr(4));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment