From 5019c4109f99ce0cbadfdad29404b47b9a2edb08 Mon Sep 17 00:00:00 2001 From: pdeva Date: Mon, 6 Jul 2015 21:27:05 -0700 Subject: Bugfix when theme is used on https url Without this fix, when you load this theme on https url and click on 'Browse Posts', the site will hang --- assets/js/scripts.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/assets/js/scripts.js b/assets/js/scripts.js index ee47bc6..3d471ec 100644 --- a/assets/js/scripts.js +++ b/assets/js/scripts.js @@ -94,6 +94,14 @@ jQuery(function($) { var url = $(this).attr('href'); var title = $(this).attr('title') || null; + //if url starts with http:// and currentState.url starts with + // https://, replace the protocol in url + if(url.startsWith("http://")) + { + var urlNoProt = url.replace(/.*?:\/\//g, ""); + var curProt = currentState.url.split("/")[0]; + url = curProt + "//" + urlNoProt; + } // If the requested url is not the current states url push // the new state and make the ajax call. if (url !== currentState.url.replace(/\/$/, "")) { -- cgit v1.2.3 From 36e674ed6bebb7a6580a552cea5b982600f847ca Mon Sep 17 00:00:00 2001 From: Rory Gibson Date: Tue, 7 Jul 2015 12:00:41 +0400 Subject: Use indexOf instead of startsWith --- assets/js/scripts.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/js/scripts.js b/assets/js/scripts.js index 3d471ec..72ca12c 100644 --- a/assets/js/scripts.js +++ b/assets/js/scripts.js @@ -96,12 +96,13 @@ jQuery(function($) { //if url starts with http:// and currentState.url starts with // https://, replace the protocol in url - if(url.startsWith("http://")) + if (url.indexOf("http://", 0) === 0) { var urlNoProt = url.replace(/.*?:\/\//g, ""); var curProt = currentState.url.split("/")[0]; url = curProt + "//" + urlNoProt; } + // If the requested url is not the current states url push // the new state and make the ajax call. if (url !== currentState.url.replace(/\/$/, "")) { -- cgit v1.2.3