fix #6862 - infocast screenshot
[app.webkitpdf] / domains / infocastfn.com.js
1 function getParameterFromURL(name) {
2     var result = null;
3     var tmp = [];
4     var params = window.location.search.substr(1).split("&");
5     for (var i = 0; i < params.length; i++) {
6         tmp = params[i].split("=");
7         if (tmp[0] === name) result = decodeURIComponent(tmp[1]);
8     }
9     return result;
10 }
11
12 var today = new Date();
13 var fromDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 2);
14 var toDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
15
16 path = window.location.pathname.split("/");
17
18 var locale = "en_US"
19 if(path[1] == 'zh') {
20     locale = "zh_TW";
21 }
22 if(path[1] == 'zh_CN') {
23     locale = "zh_CN";
24 }
25
26 var tmpUrl= "/iportal-api/ajax/news/getNewsList2?"  
27             + "dateFrom=" + Date.parse(fromDate) 
28             + "&dateTo=" + Date.parse(toDate)
29                         + "&type=3&"
30                         + "&locale=" + locale;
31
32
33 var releaseId = getParameterFromURL("release_id");
34 var regex = new RegExp("release.php/FeedTrack/" + releaseId + "/");
35
36 $.ajax({
37     url: tmpUrl,
38     type: "GET",
39     contentType: "application/json; charset=utf-8",
40     cache: false,
41     success: function(data){
42         $.each(data.newsData, function(index, value){
43             if(!!value.content){
44                 value.content = value.content.replace(/&nbsp;/g, " ");
45                 var res = value.content.search(regex);
46                 if (res != -1) {
47                     window[1].re.viewModel.onSelectRowClick(value); 
48                 }
49             }
50         });
51     }
52 });