forked from Gyran/Transweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCookiesSettings.js
45 lines (35 loc) · 1.34 KB
/
CookiesSettings.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
enyo.kind({
name: "CookiesSettings",
kind: enyo.Control,
tag: "div",
classes: "cookiesSettings",
components: [
{ name: "cookiesStr", kind: enyo.TextArea, disabled: true, content: "Loading..." },
{ tag: "div", content: "Format: host|cookie1=value1;cooke2=value2;" },
{ name: "saveCookies", kind: "Button", content: "Save cookies", ontap: "saveCookies" }
],
create: function(){
this.inherited(arguments);
this.getCookies();
},
getCookies: function () {
new enyo.Ajax({url: "plugins/Cookies/cookies.php", method: "post" }).
response(this, "gotCookies").
go({ method: "getCookies" });
},
gotCookies: function ( sender, response ) {
this.$.cookiesStr.setValue( response );
this.$.cookiesStr.setDisabled( false );
},
saveCookies: function ( sender, response ) {
var cookiesStr = this.$.cookiesStr.getValue();
new enyo.Ajax({url: "plugins/cookies/cookies.php", method: "post" }).
response(this, "cookiesSaved").
go({ method: "saveCookies",
cookies: cookiesStr });
},
cookiesSaved: function ( sender, response ) {
var event = { title: "Cookies saved", message: "The cookies has been saved to file" };
this.bubble( "onDoNotify", event );
}
});