| @@ -74,28 +74,30 @@ var swiperOrg = new Swiper(".homeorg-list", { | |||||
| }, | }, | ||||
| }); | }); | ||||
| var output = document.getElementById("newmessage"); | |||||
| var url = "ws://" + document.location.host + "/action/notification"; | |||||
| if(document.location.host == "git.openi.org.cn" || document.URL.startsWith("https")){ | |||||
| url = "wss://" + document.location.host + "/action/notification" | |||||
| } | |||||
| var socket = new WebSocket(url); | |||||
| socket.onopen = function () { | |||||
| messageQueue = []; | |||||
| console.log("message has connected."); | |||||
| }; | |||||
| var maxSize = 20; | var maxSize = 20; | ||||
| var html =document.documentElement; | var html =document.documentElement; | ||||
| var lang = html.attributes["lang"] | var lang = html.attributes["lang"] | ||||
| var isZh = true; | var isZh = true; | ||||
| if(lang != null && lang.nodeValue =="en-US" ){ | if(lang != null && lang.nodeValue =="en-US" ){ | ||||
| isZh=false; | isZh=false; | ||||
| }else{ | |||||
| } | } | ||||
| socket.onmessage = function (e) { | |||||
| $(document).onreadystatechange(function(){ | |||||
| var output = document.getElementById("newmessage"); | |||||
| var url = "ws://" + document.location.host + "/action/notification"; | |||||
| if(document.location.host == "git.openi.org.cn" || document.URL.startsWith("https")){ | |||||
| url = "wss://" + document.location.host + "/action/notification" | |||||
| } | |||||
| var socket = new WebSocket(url); | |||||
| socket.onopen = function () { | |||||
| messageQueue = []; | |||||
| console.log("message has connected."); | |||||
| }; | |||||
| socket.onmessage = function (e) { | |||||
| var data =JSON.parse(e.data) | var data =JSON.parse(e.data) | ||||
| var html = ""; | var html = ""; | ||||
| if (data != null){ | if (data != null){ | ||||
| @@ -177,6 +179,8 @@ socket.onmessage = function (e) { | |||||
| swiperNewMessage.updateSlides(); | swiperNewMessage.updateSlides(); | ||||
| swiperNewMessage.updateProgress(); | swiperNewMessage.updateProgress(); | ||||
| }; | }; | ||||
| }); | |||||
| function getTaskLink(record){ | function getTaskLink(record){ | ||||
| var re = getRepoLink(record); | var re = getRepoLink(record); | ||||
| @@ -437,7 +441,10 @@ function getAction(opType,isZh){ | |||||
| } | } | ||||
| } | } | ||||
| queryRecommendData(); | |||||
| $(document).onreadystatechange(function(){ | |||||
| queryRecommendData(); | |||||
| }); | |||||
| function queryRecommendData(){ | function queryRecommendData(){ | ||||
| $.ajax({ | $.ajax({ | ||||