From 73efc0facea38f5b59b56ffe43fba428b2d2a9ae Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 23 Nov 2015 12:10:10 +0300 Subject: scripts.js: make remained links protocol-relative --- src/main/webapp/scripts.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main/webapp/scripts.js b/src/main/webapp/scripts.js index 8c3b46af..17dce6f9 100644 --- a/src/main/webapp/scripts.js +++ b/src/main/webapp/scripts.js @@ -4,10 +4,11 @@ var pageTitle; function initWS() { if(typeof(pageMID)!="undefined" && pageMID>0) { var url; + var protocolPrefix = (window.location.protocol === 'https:') ? 'wss:' : 'ws:'; if(typeof(juickDebug)!="undefined") { - url="ws://ws.juick.com/_replies"; + url= protocolPrefix + "//ws.juick.com/_replies"; } else { - url="ws://ws.juick.com/"+pageMID; + url= protocolPrefix + "//ws.juick.com/"+pageMID; } if(typeof(hash)!="undefined" && hash) { url+="?hash="+hash; @@ -238,7 +239,7 @@ function unfoldReply() { } function showMessageLinksDialog(mid,rid) { - var hlink="http://juick.com/"+mid; + var hlink="//juick.com/"+mid; var mlink="#"+mid; if(rid>0) { hlink+="#"+rid; @@ -296,7 +297,7 @@ function openSocialWindow(a) { function checkUsername() { var uname=$('#username').val(); - $.ajax('http://api.juick.com/users?uname='+uname).done(function() { + $.ajax('//api.juick.com/users?uname='+uname).done(function() { $('#username').css('background','#FFCCCC'); }).fail(function() { $('#username').css('background','#CCFFCC'); @@ -323,7 +324,7 @@ function openDialogLogin() { function likeMessage(e,mid) { $.ajax({ - url: 'http://juick.com/like?mid='+mid, + url: '//juick.com/like?mid='+mid, type: 'POST' }).done(function() { $(e).closest("article").append("

OK!

"); @@ -336,7 +337,7 @@ function likeMessage(e,mid) { /******************************************************************************/ function setPopular(e,mid,popular) { - $.ajax('http://api.juick.com/messages/set_popular?mid='+mid+'&popular='+popular+'&hash='+hash).done(function() { + $.ajax('//api.juick.com/messages/set_popular?mid='+mid+'&popular='+popular+'&hash='+hash).done(function() { var a=$(e).closest("article"); a.append("

OK!

"); }); @@ -344,7 +345,7 @@ function setPopular(e,mid,popular) { } function setPrivacy(e,mid) { - $.ajax('http://api.juick.com/messages/set_privacy?mid='+mid+'&hash='+hash).done(function() { + $.ajax('//api.juick.com/messages/set_privacy?mid='+mid+'&hash='+hash).done(function() { var a=$(e).closest("article"); a.append("

OK!

"); }); -- cgit v1.2.3