diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/webapp/scripts.js | 15 |
1 files changed, 8 insertions, 7 deletions
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("<p>OK!</p>"); @@ -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("<p>OK!</p>"); }); @@ -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("<p>OK!</p>"); }); |