domains/infocastfn.com.js
authorleon <leon@roojs.com>
Fri, 22 Apr 2022 08:59:07 +0000 (16:59 +0800)
committerleon <leon@roojs.com>
Fri, 22 Apr 2022 08:59:07 +0000 (16:59 +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..ed72144
--- /dev/null
@@ -0,0 +1,42 @@
+var today = new Date();
+var fromDate = new Date(today.getFullYear(), today.getMonth(), today.getDate());
+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 urlParams = new URLSearchParams(window.location.search);
+var releaseId = urlParams.get("release_id");
+var regex = new RegExp("<img src=\\\"https://release.media-outreach.com/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