Revision 50035
Added by Sandro La Bruzzo over 6 years ago
service_v10.js | ||
---|---|---|
9 | 9 |
var factory = {} |
10 | 10 |
factory.query = function (query, page, filter, value) { |
11 | 11 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
12 |
if (page == null){ |
|
12 |
if (page === null){
|
|
13 | 13 |
return $http.post('/api/post/', $.param({'action': "query", 'query': query, 'filter':filter, 'value':value})); |
14 | 14 |
} |
15 | 15 |
else { |
16 | 16 |
return $http.post('/api/post/', $.param({'action': "query", 'query': query, 'start': (page - 1) * 10, 'filter':filter, 'value':value})); |
17 | 17 |
} |
18 |
} |
|
18 |
};
|
|
19 | 19 |
factory.getStatsDetail = function () { |
20 | 20 |
//$http.defaults.headers.get["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
21 | 21 |
return $http.get('currentStats.json'); |
22 |
} |
|
22 |
};
|
|
23 | 23 |
|
24 | 24 |
factory.getStats = function () { |
25 | 25 |
//$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
26 | 26 |
return $http.get('stats2.json'); |
27 |
} |
|
27 |
};
|
|
28 | 28 |
|
29 | 29 |
factory.getDatasources = function() { |
30 | 30 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
31 | 31 |
return $http.post('/api/ds_info/'); |
32 |
} |
|
32 |
};
|
|
33 | 33 |
|
34 | 34 |
|
35 | 35 |
factory.getItem = function (identifier) { |
36 | 36 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
37 | 37 |
return $http.post('/api/item/' + identifier); |
38 |
} |
|
38 |
};
|
|
39 | 39 |
|
40 | 40 |
factory.getItem = function (identifier, type, from) { |
41 | 41 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
42 | 42 |
return $http.post('/api/item/' + identifier, $.param({'type': type, 'from': from})); |
43 |
} |
|
43 |
};
|
|
44 | 44 |
|
45 | 45 |
factory.getDsInfo = function (identifier, name) { |
46 | 46 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
47 | 47 |
return $http.post('/api/ds_info/', $.param({'id': identifier, 'name':name})); |
48 |
} |
|
48 |
};
|
|
49 | 49 |
|
50 |
|
|
51 |
factory.resolveIdentifier = function (pid, pid_type) { |
|
52 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
|
53 |
return $http.post('api/resolveId/', $.param({'pid': pid, 'pid_type':pid_type})); |
|
54 |
}; |
|
55 |
|
|
50 | 56 |
return factory; |
51 | 57 |
}]); |
Also available in: Unified diff
made a new look