This repository has been archived by the owner on Nov 12, 2022. It is now read-only.
/
api.js
48 lines (31 loc) · 1.39 KB
/
api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
OccupyInter.net <http://occupyinter.net>
Copyfree 2011. Made for public use.
Developed by Greg Leuch <http://gleuch.com> and the Free Art & Technology Lab <http://fffff.at>.
---------------------------------------------------------------------------------------------------
*/
OccupyInternet.API = {
avatars : function(opts) {
var defaults = {success : function(msg) {eval('OccupyInternet.API._avatars('+ msg +');');}, error : function(a, b, c) {alert('e')}, data : {}},
requires = {url : localStorage.avatars_url, type : 'GET', dataType : 'text'}; // should be json, widget part is nightmare to make true json
if (!opts) opts = {};
opts = jQuery.extend({}, defaults, opts, requires);
jQuery.ajax(opts);
},
_avatars : function(msg) {
OccupyInternet.avatars = msg;
},
update : function(opts) {
var defaults = {success : function() {}, error : function() {}, data : {}},
requires = {url : localStorage.post_url, type : 'POST', dataType : 'json'};
if (!opts) opts = {};
opts = jQuery.extend({}, defaults, opts, requires);
jQuery.ajax(opts);
},
query : function(opts) {
var defaults = {success : function() {}, error : function() {}, data : {}},
requires = {url : localStorage.get_url, method : 'GET', dataType : 'json'};
if (!opts) opts = {};
jQuery.ajax(jQuery.extend({}, defaults, opts, requires));
}
};