-
Notifications
You must be signed in to change notification settings - Fork 2
/
iPhoneDesktopButton.js
60 lines (50 loc) · 1.53 KB
/
iPhoneDesktopButton.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
49
50
51
52
53
54
55
56
57
58
59
60
Ext.ns('simfla.ux.plugins');
simfla.ux.plugins.iPhoneDesktopButton = Ext.extend(Ext.util.Observable, {
iPhoneDesktopButtonCss: 'iPhoneDesktopButton',
iPhoneDesktopButtonRemoveCss: 'iPhoneDesktopButtonRemove',
init: function(cmp){
this.cmp = cmp;
cmp.on('render', this.initButton, this);
cmp.startEdit = this.startEdit;
cmp.endEdit = this.endEdit;
},
initButton: function() {
var me = this;
me.cmp.el.addCls(me.iPhoneDesktopButtonCss);
if (!me.imgEl && me.image) {
me.imgEl = me.cmp.el.createChild({
tag: 'img',
src: me.image
});
}
if (!me.imgShineEl) {
me.imgShineEl = me.cmp.el.createChild({
tag: 'img',
src: 'bg.png'
});
}
},
startEdit: function(cmp) {
if( cmp.el.dom.className.indexOf('shake') < 0)
{
cmp.el.addCls('shake');
}
if (!cmp.imgRemoveEl) {
cmp.imgRemoveEl = cmp.el.createChild({
tag: 'span',
cls: 'iPhoneDesktopButtonRemove'
});
}
},
endEdit: function(cmp) {
if( cmp.el.dom.className.indexOf('shake') >= 0)
{
cmp.el.removeCls('shake');
}
if (cmp.imgRemoveEl) {
cmp.imgRemoveEl.remove();
cmp.imgRemoveEl = undefined;
}
}
});
Ext.preg('iphonedesktopbutton', simfla.ux.plugins.iPhoneDesktopButton);