From f45ee1162aa0d8451bf5dbd7e49401c44019d699 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Mon, 8 Apr 2013 05:20:33 +0100 Subject: [PATCH] plugin: force redirect to https when accessed via http --- plugins/force-https.user.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 plugins/force-https.user.js diff --git a/plugins/force-https.user.js b/plugins/force-https.user.js new file mode 100644 index 00000000..4770aebe --- /dev/null +++ b/plugins/force-https.user.js @@ -0,0 +1,25 @@ +// ==UserScript== +// @id force-https@jonatkins +// @name IITC plugin: force https access for ingress.com/intel +// @version 0.1.0.@@DATETIMEVERSION@@ +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Force https access for ingress.com/intel. If the intel site is accessed via http, it redirects to the https version +// @include https://www.ingress.com/intel* +// @include http://www.ingress.com/intel* +// @match https://www.ingress.com/intel* +// @match http://www.ingress.com/intel* +// ==/UserScript== + + + +//NOTE: plugin authors - due to the unique requirements of this plugin, it doesn't use the standard IITC +//plugin architechure. do NOT use it as a template for other plugins + + +if(window.location.protocol !== 'https:') { + var redir = window.location.href.replace(/^http:/, 'https:'); + window.location = redir; + throw('Need to load HTTPS version.'); +}