fix #6862 - infocast screenshot
authorAlan <alan@roojs.com>
Thu, 28 Apr 2022 02:35:20 +0000 (10:35 +0800)
committerAlan <alan@roojs.com>
Thu, 28 Apr 2022 02:35:20 +0000 (10:35 +0800)
domains/infocastfn.com.js [new file with mode: 0644]

diff --git a/domains/infocastfn.com.js b/domains/infocastfn.com.js
new file mode 100644 (file)
index 0000000..229fd61
--- /dev/null
@@ -0,0 +1,52 @@
+function getParameterFromURL(name) {
+    var result = null;
+    var tmp = [];
+    var params = window.location.search.substr(1).split("&");
+    for (var i = 0; i < params.length; i++) {
+        tmp = params[i].split("=");
+        if (tmp[0] === name) result = decodeURIComponent(tmp[1]);
+    }
+    return result;
+}
+
+var today = new Date();
+var fromDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 2);
+var toDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
+
+path = window.location.pathname.split("/");
+
+var locale = "en_US"
+if(path[1] == 'zh') {
+    locale = "zh_TW";
+}
+if(path[1] == 'zh_CN') {
+    locale = "zh_CN";
+}
+
+var tmpUrl= "/iportal-api/ajax/news/getNewsList2?"  
+            + "dateFrom=" + Date.parse(fromDate) 
+            + "&dateTo=" + Date.parse(toDate)
+                       + "&type=3&"
+                       + "&locale=" + locale;
+
+
+var releaseId = getParameterFromURL("release_id");
+var regex = new RegExp("release.php/FeedTrack/" + releaseId + "/");
+
+$.ajax({
+    url: tmpUrl,
+    type: "GET",
+    contentType: "application/json; charset=utf-8",
+    cache: false,
+    success: function(data){
+        $.each(data.newsData, function(index, value){
+            if(!!value.content){
+                value.content = value.content.replace(/&nbsp;/g, " ");
+                var res = value.content.search(regex);
+                if (res != -1) {
+                    window[1].re.viewModel.onSelectRowClick(value); 
+                }
+            }
+        });
+    }
+});
\ No newline at end of file