midas 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -0
- data/.document +5 -0
- data/.gitignore +32 -0
- data/Gemfile +12 -0
- data/LICENSE +20 -0
- data/README.textile +21 -0
- data/Rakefile +84 -0
- data/VERSION +1 -0
- data/features/step_definitions/editor_steps.rb +16 -0
- data/features/step_definitions/web_steps.rb +205 -0
- data/features/support/env.rb +39 -0
- data/features/support/paths.rb +29 -0
- data/features/view_editor.feature +8 -0
- data/generators/midas/midas_generator.rb +1 -0
- data/lib/midas.rb +1 -0
- data/midas.gemspec +131 -0
- data/public/images/midas/toolbars/actions/_background.png +0 -0
- data/public/images/midas/toolbars/actions/_background_radio.png +0 -0
- data/public/images/midas/toolbars/actions/_separator.png +0 -0
- data/public/images/midas/toolbars/actions/extra/prefspane.png +0 -0
- data/public/images/midas/toolbars/actions/extra/todospane.png +0 -0
- data/public/images/midas/toolbars/actions/historypanel.png +0 -0
- data/public/images/midas/toolbars/actions/insertcharacter.png +0 -0
- data/public/images/midas/toolbars/actions/insertlink.png +0 -0
- data/public/images/midas/toolbars/actions/insertmedia.png +0 -0
- data/public/images/midas/toolbars/actions/insertobject.png +0 -0
- data/public/images/midas/toolbars/actions/inserttable.png +0 -0
- data/public/images/midas/toolbars/actions/inspectorpanel.png +0 -0
- data/public/images/midas/toolbars/actions/notespanel.png +0 -0
- data/public/images/midas/toolbars/actions/preview.png +0 -0
- data/public/images/midas/toolbars/actions/redo.png +0 -0
- data/public/images/midas/toolbars/actions/save.png +0 -0
- data/public/images/midas/toolbars/actions/undo.png +0 -0
- data/public/images/midas/toolbars/htmleditor/_background.png +0 -0
- data/public/images/midas/toolbars/htmleditor/_line_separator.png +0 -0
- data/public/images/midas/toolbars/htmleditor/_separator.png +0 -0
- data/public/images/midas/toolbars/htmleditor/buttons.png +0 -0
- data/public/javascripts/midas/config.js +181 -0
- data/public/javascripts/midas/dialog.js +9 -0
- data/public/javascripts/midas/midas.js +307 -0
- data/public/javascripts/midas/native_extensions.js +43 -0
- data/public/javascripts/midas/palette.js +108 -0
- data/public/javascripts/midas/region.js +194 -0
- data/public/javascripts/midas/statusbar.js +84 -0
- data/public/javascripts/midas/toolbar.js +255 -0
- data/public/javascripts/prototype.js +6001 -0
- data/public/midas/backcolor.html +97 -0
- data/public/midas/examples/bundled.html +60 -0
- data/public/midas/examples/iframe.html +73 -0
- data/public/midas/examples/index.html +73 -0
- data/public/midas/examples/javascript_archive.js +111 -0
- data/public/midas/forecolor.html +97 -0
- data/public/stylesheets/midas/dialog.css +2 -0
- data/public/stylesheets/midas/midas.css +9 -0
- data/public/stylesheets/midas/palette.css +50 -0
- data/public/stylesheets/midas/region.css +16 -0
- data/public/stylesheets/midas/statusbar.css +17 -0
- data/public/stylesheets/midas/toolbar.css +262 -0
- data/rails/init.rb +1 -0
- data/spec/javascripts/dialog_spec.js +7 -0
- data/spec/javascripts/fixtures/midas_fixture.html +27 -0
- data/spec/javascripts/fixtures/midas_styles.css +14 -0
- data/spec/javascripts/fixtures/native_extensions_fixture.html +5 -0
- data/spec/javascripts/helpers/browser_detection.js +15 -0
- data/spec/javascripts/helpers/event_simulation.js +505 -0
- data/spec/javascripts/helpers/spec_helper.js +125 -0
- data/spec/javascripts/midas_spec.js +284 -0
- data/spec/javascripts/native_extensions_spec.js +39 -0
- data/spec/javascripts/palette_spec.js +59 -0
- data/spec/javascripts/region_spec.js +441 -0
- data/spec/javascripts/statusbar_spec.js +61 -0
- data/spec/javascripts/support/jasmine.yml +82 -0
- data/spec/javascripts/support/jasmine_config.rb +39 -0
- data/spec/javascripts/support/jasmine_runner.rb +19 -0
- data/spec/javascripts/toolbar_spec.js +149 -0
- data/spec/ruby/helpers/spec_helper.rb +9 -0
- data/spec/ruby/midas_spec.rb +9 -0
- data/spec/spec.opts +1 -0
- data/tasks/midas_tasks.rake +105 -0
- metadata +166 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
/* Palette
|
2
|
+
*----------------------------------------------------------------------------*/
|
3
|
+
.midas-palette {
|
4
|
+
position: fixed;
|
5
|
+
background: #E2E1E2;
|
6
|
+
border: 1px solid #727272;
|
7
|
+
margin-top: -1px;
|
8
|
+
-moz-box-shadow: 1px 1px 4px rgba(0, 0, 0, .5);
|
9
|
+
-webkit-box-shadow: 1px 1px 4px rgba(0, 0, 0, .5);
|
10
|
+
box-shadow: 1px 1px 4px rgba(0, 0, 0, .5);
|
11
|
+
}
|
12
|
+
.midas-htmleditorbar .midas-button-forecolor,
|
13
|
+
.midas-htmleditorbar .midas-button-backcolor {
|
14
|
+
background-position: 0 -54px;
|
15
|
+
}
|
16
|
+
.midas-htmleditorbar .midas-button-forecolor {
|
17
|
+
background-color: #000;
|
18
|
+
}
|
19
|
+
|
20
|
+
#midas_forecolor_selector,
|
21
|
+
#midas_backcolor_selector {
|
22
|
+
width: 170px;
|
23
|
+
padding: 1px;
|
24
|
+
}
|
25
|
+
#midas_forecolor_selector div,
|
26
|
+
#midas_backcolor_selector div {
|
27
|
+
float: left;
|
28
|
+
border: 1px solid #E2E1E2;
|
29
|
+
width: 15px;
|
30
|
+
height: 15px;
|
31
|
+
cursor: pointer;
|
32
|
+
}
|
33
|
+
#midas_forecolor_selector div:hover,
|
34
|
+
#midas_backcolor_selector div:hover {
|
35
|
+
border: 1px solid #333;
|
36
|
+
}
|
37
|
+
#midas_forecolor_selector div#midas_forecolor_last_picked,
|
38
|
+
#midas_backcolor_selector div#midas_backcolor_last_picked {
|
39
|
+
border: 1px solid #333;
|
40
|
+
width: 166px;
|
41
|
+
clear: left;
|
42
|
+
text-align: center;
|
43
|
+
margin: 1px 1px 2px 1px;
|
44
|
+
position: relative;
|
45
|
+
top: 1px;
|
46
|
+
float: none;
|
47
|
+
line-height: 15px;
|
48
|
+
font-family: Helvetica, Tahoma, Arial, sans-serif;
|
49
|
+
font-size: 8.5pt;
|
50
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/* Region
|
2
|
+
*----------------------------------------------------------------------------*/
|
3
|
+
.midas-region {
|
4
|
+
outline: 1px dotted #F00;
|
5
|
+
}
|
6
|
+
.midas-region .midas-page-break {
|
7
|
+
height: 5px;
|
8
|
+
background: #EEE;
|
9
|
+
overflow: hidden;
|
10
|
+
border: 1px dotted #999;
|
11
|
+
border-width: 1px 0;
|
12
|
+
margin: 2px 0;
|
13
|
+
}
|
14
|
+
.midas-region .midas-page-break em {
|
15
|
+
display: none;
|
16
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/* Statusbar
|
2
|
+
*----------------------------------------------------------------------------*/
|
3
|
+
.midas-statusbar {
|
4
|
+
position: fixed;
|
5
|
+
z-index: 10001;
|
6
|
+
padding: 5px 10px 4px 10px;
|
7
|
+
background: #E2E1E2;
|
8
|
+
border-top: 1px solid #727272;
|
9
|
+
bottom: 0;
|
10
|
+
left: 0;
|
11
|
+
width: 100%;
|
12
|
+
font-family: Helvetica, Tahoma, Arial, sans-serif;
|
13
|
+
font-size: 8.5pt;
|
14
|
+
}
|
15
|
+
.midas-statusbar span {
|
16
|
+
margin-right: 25px;
|
17
|
+
}
|
@@ -0,0 +1,262 @@
|
|
1
|
+
/* Toolbar
|
2
|
+
*----------------------------------------------------------------------------*/
|
3
|
+
.midas-toolbar {
|
4
|
+
position: fixed;
|
5
|
+
z-index: 10001;
|
6
|
+
top: 0;
|
7
|
+
left: 0;
|
8
|
+
width: 100%;
|
9
|
+
overflow: hidden;
|
10
|
+
}
|
11
|
+
|
12
|
+
.midas-actionsbar {
|
13
|
+
width: 10000px;
|
14
|
+
text-shadow: #EEE 0 1px 0;
|
15
|
+
height: 60px;
|
16
|
+
padding-right: 10px;
|
17
|
+
background: #E2E1E2 url(../../images/midas/toolbars/actions/_background.png) repeat-x bottom;
|
18
|
+
}
|
19
|
+
.midas-actionsbar .midas-button {
|
20
|
+
display: block;
|
21
|
+
float: left;
|
22
|
+
margin-left: 7px;
|
23
|
+
background-repeat: no-repeat;
|
24
|
+
background-position: 50% 7px;
|
25
|
+
height: 10px;
|
26
|
+
min-width: 30px;
|
27
|
+
text-align: center;
|
28
|
+
padding: 43px 5px 0 5px;
|
29
|
+
white-space: nowrap;
|
30
|
+
text-decoration: none;
|
31
|
+
outline: none;
|
32
|
+
font-family: Helvetica, Tahoma, Arial, sans-serif;
|
33
|
+
}
|
34
|
+
.midas-actionsbar .midas-button em {
|
35
|
+
display: block;
|
36
|
+
margin: 0 -5px;
|
37
|
+
font-style: normal;
|
38
|
+
color: #222;
|
39
|
+
font-size: 8.5pt;
|
40
|
+
}
|
41
|
+
.midas-actionsbar .midas-separator,
|
42
|
+
.midas-actionsbar .midas-line-separator,
|
43
|
+
.midas-actionsbar .midas-flex-separator {
|
44
|
+
display: block;
|
45
|
+
float: left;
|
46
|
+
border: 0;
|
47
|
+
height: 47px;
|
48
|
+
padding: 0 20px;
|
49
|
+
background: url(../../images/midas/toolbars/actions/_separator.png) no-repeat;
|
50
|
+
}
|
51
|
+
.midas-actionsbar .midas-button-save { background-image: url(../../images/midas/toolbars/actions/save.png); }
|
52
|
+
.midas-actionsbar .midas-button-preview { background-image: url(../../images/midas/toolbars/actions/preview.png); }
|
53
|
+
.midas-actionsbar .midas-button-undo { background-image: url(../../images/midas/toolbars/actions/undo.png); }
|
54
|
+
.midas-actionsbar .midas-button-redo { background-image: url(../../images/midas/toolbars/actions/redo.png); }
|
55
|
+
.midas-actionsbar .midas-button-insertlink { background-image: url(../../images/midas/toolbars/actions/insertlink.png); }
|
56
|
+
.midas-actionsbar .midas-button-insertmedia { background-image: url(../../images/midas/toolbars/actions/insertmedia.png); }
|
57
|
+
.midas-actionsbar .midas-button-inserttable { background-image: url(../../images/midas/toolbars/actions/inserttable.png); }
|
58
|
+
.midas-actionsbar .midas-button-insertobject { background-image: url(../../images/midas/toolbars/actions/insertobject.png); }
|
59
|
+
.midas-actionsbar .midas-button-insertcharacter { background-image: url(../../images/midas/toolbars/actions/insertcharacter.png); }
|
60
|
+
.midas-actionsbar .midas-button-inspectorpanel { background-image: url(../../images/midas/toolbars/actions/inspectorpanel.png); }
|
61
|
+
.midas-actionsbar .midas-button-notespanel { background-image: url(../../images/midas/toolbars/actions/notespanel.png); }
|
62
|
+
.midas-actionsbar .midas-button-historypanel { background-image: url(../../images/midas/toolbars/actions/historypanel.png); }
|
63
|
+
|
64
|
+
/* Editor menu bar
|
65
|
+
*----------------------------------------------------------------------------*/
|
66
|
+
.midas-htmleditorbar {
|
67
|
+
padding: 3px 13px 1px 10px;
|
68
|
+
background: #D2D2D1 url(../../images/midas/toolbars/htmleditor/_background.png) repeat-x bottom;
|
69
|
+
}
|
70
|
+
.midas-htmleditorbar:after {
|
71
|
+
content: ".";
|
72
|
+
display: block;
|
73
|
+
clear: both;
|
74
|
+
visibility: hidden;
|
75
|
+
line-height: 0;
|
76
|
+
height: 0;
|
77
|
+
}
|
78
|
+
|
79
|
+
.midas-htmleditorbar .midas-separator,
|
80
|
+
.midas-htmleditorbar .midas-line-separator,
|
81
|
+
.midas-htmleditorbar .midas-flex-separator {
|
82
|
+
display: block;
|
83
|
+
float: left;
|
84
|
+
border: 0;
|
85
|
+
height: 18px;
|
86
|
+
padding: 0;
|
87
|
+
margin: 0 7px 0 0;
|
88
|
+
width: 1px;
|
89
|
+
background: url(../../images/midas/toolbars/htmleditor/_separator.png) no-repeat;
|
90
|
+
}
|
91
|
+
.midas-htmleditorbar .midas-line-separator {
|
92
|
+
background: url(../../images/midas/toolbars/htmleditor/_line_separator.png) no-repeat;
|
93
|
+
}
|
94
|
+
.midas-htmleditorbar .midas-button {
|
95
|
+
display: block;
|
96
|
+
outline: none;
|
97
|
+
float: left;
|
98
|
+
height: 18px;
|
99
|
+
width: 23px;
|
100
|
+
margin: 0 7px 4px 0;
|
101
|
+
background-image: url(../../images/midas/toolbars/htmleditor/buttons.png);
|
102
|
+
}
|
103
|
+
.midas-htmleditorbar .midas-button em {
|
104
|
+
display: none;
|
105
|
+
}
|
106
|
+
.midas-htmleditorbar .midas-group {
|
107
|
+
float: left;
|
108
|
+
}
|
109
|
+
.midas-htmleditorbar .midas-group .midas-separator,
|
110
|
+
.midas-htmleditorbar .midas-group .midas-line-separator,
|
111
|
+
.midas-htmleditorbar .midas-group .midas-flex-separator {
|
112
|
+
margin-left: 7px;
|
113
|
+
}
|
114
|
+
|
115
|
+
.midas-htmleditorbar .midas-group .midas-button {
|
116
|
+
width: 22px;
|
117
|
+
margin-left: 0;
|
118
|
+
margin-right: 0;
|
119
|
+
}
|
120
|
+
.midas-htmleditorbar .midas-group .midas-button:first-child {
|
121
|
+
width: 23px;
|
122
|
+
}
|
123
|
+
/*menu#edit command.select {*/
|
124
|
+
/*width: auto;*/
|
125
|
+
/*padding-right: 14px;*/
|
126
|
+
/*background: url(/images/protosite_editor/edit/buttons.gif) no-repeat right top;*/
|
127
|
+
/*}*/
|
128
|
+
/*menu#edit command.select.disabled, .disabled command.select {*/
|
129
|
+
/*background-position: right bottom !important;*/
|
130
|
+
/*}*/
|
131
|
+
/*menu#edit command.select.disabled label, .disabled command.select label {*/
|
132
|
+
/*background-position: left bottom !important;*/
|
133
|
+
/*text-indent: -1000px;*/
|
134
|
+
/*}*/
|
135
|
+
/*menu#edit #style { margin-right: 5px }*/
|
136
|
+
/*menu#edit #style label { width: 100px }*/
|
137
|
+
/*menu#edit #size label { width: 30px }*/
|
138
|
+
|
139
|
+
.midas-htmleditorbar .midas-button-bold { background-position: -68px 0 }
|
140
|
+
.midas-htmleditorbar .midas-button-bold.active { background-position: -68px -18px }
|
141
|
+
.midas-htmleditorbar .midas-button-bold.disabled,
|
142
|
+
.disabled .midas-button-bold { background-position: -68px -36px !important }
|
143
|
+
|
144
|
+
.midas-htmleditorbar .midas-button-italic { background-position: -91px 0 }
|
145
|
+
.midas-htmleditorbar .midas-button-italic.active { background-position: -91px -18px }
|
146
|
+
.midas-htmleditorbar .midas-button-italic.disabled,
|
147
|
+
.disabled .midas-button-italic { background-position: -91px -36px !important }
|
148
|
+
|
149
|
+
.midas-htmleditorbar .midas-button-overline { background-position: -113px 0 }
|
150
|
+
.midas-htmleditorbar .midas-button-overline.active { background-position: -113px -18px }
|
151
|
+
.midas-htmleditorbar .midas-button-overline.disabled,
|
152
|
+
.disabled .midas-button-overline { background-position: -113px -36px !important }
|
153
|
+
|
154
|
+
.midas-htmleditorbar .midas-button-strikethrough { background-position: -135px 0 }
|
155
|
+
.midas-htmleditorbar .midas-button-strikethrough.active { background-position: -135px -18px }
|
156
|
+
.midas-htmleditorbar .midas-button-strikethrough.disabled,
|
157
|
+
.disabled .midas-button-strikethrough { background-position: -135px -36px !important }
|
158
|
+
|
159
|
+
.midas-htmleditorbar .midas-button-underline { background-position: -157px 0 }
|
160
|
+
.midas-htmleditorbar .midas-button-underline.active { background-position: -157px -18px }
|
161
|
+
.midas-htmleditorbar .midas-button-underline.disabled,
|
162
|
+
.disabled .midas-button-underline { background-position: -157px -36px !important }
|
163
|
+
|
164
|
+
.midas-htmleditorbar .midas-button-subscript { background-position: -180px 0 }
|
165
|
+
.midas-htmleditorbar .midas-button-subscript.active { background-position: -180px -18px }
|
166
|
+
.midas-htmleditorbar .midas-button-subscript.disabled,
|
167
|
+
.disabled .midas-button-subscript { background-position: -180px -36px !important }
|
168
|
+
|
169
|
+
.midas-htmleditorbar .midas-button-superscript { background-position: -203px 0 }
|
170
|
+
.midas-htmleditorbar .midas-button-superscript.active { background-position: -203px -18px }
|
171
|
+
.midas-htmleditorbar .midas-button-superscript.disabled,
|
172
|
+
.disabled .midas-button-superscript { background-position: -203px -36px !important }
|
173
|
+
|
174
|
+
.midas-htmleditorbar .midas-button-justifyleft { background-position: -226px 0 }
|
175
|
+
.midas-htmleditorbar .midas-button-justifyleft.active { background-position: -226px -18px }
|
176
|
+
.midas-htmleditorbar .midas-button-justifyleft.disabled,
|
177
|
+
.disabled .midas-button-justifyleft { background-position: -226px -36px !important }
|
178
|
+
|
179
|
+
.midas-htmleditorbar .midas-button-justifycenter { background-position: -249px 0 }
|
180
|
+
.midas-htmleditorbar .midas-button-justifycenter.active { background-position: -249px -18px }
|
181
|
+
.midas-htmleditorbar .midas-button-justifycenter.disabled,
|
182
|
+
.disabled .midas-button-justifycenter { background-position: -249px -36px !important }
|
183
|
+
|
184
|
+
.midas-htmleditorbar .midas-button-justifyright { background-position: -271px 0 }
|
185
|
+
.midas-htmleditorbar .midas-button-justifyright.active { background-position: -271px -18px }
|
186
|
+
.midas-htmleditorbar .midas-button-justifyright.disabled,
|
187
|
+
.disabled .midas-button-justifyright { background-position: -271px -36px !important }
|
188
|
+
|
189
|
+
.midas-htmleditorbar .midas-button-justifyfull { background-position: -293px 0 }
|
190
|
+
.midas-htmleditorbar .midas-button-justifyfull.active { background-position: -293px -18px }
|
191
|
+
.midas-htmleditorbar .midas-button-justifyfull.disabled,
|
192
|
+
.disabled .midas-button-justifyfull { background-position: -293px -36px !important }
|
193
|
+
|
194
|
+
.midas-htmleditorbar .midas-button-insertunorderedlist { background-position: -316px 0 }
|
195
|
+
.midas-htmleditorbar .midas-button-insertunorderedlist.active { background-position: -316px -18px }
|
196
|
+
.midas-htmleditorbar .midas-button-insertunorderedlist.disabled,
|
197
|
+
.disabled .midas-button-insertunorderedlist { background-position: -316px -36px !important }
|
198
|
+
|
199
|
+
.midas-htmleditorbar .midas-button-insertorderedlist { background-position: -339px 0 }
|
200
|
+
.midas-htmleditorbar .midas-button-insertorderedlist.active { background-position: -339px -18px }
|
201
|
+
.midas-htmleditorbar .midas-button-insertorderedlist.disabled,
|
202
|
+
.disabled .midas-button-insertorderedlist { background-position: -339px -36px !important }
|
203
|
+
|
204
|
+
.midas-htmleditorbar .midas-button-outdent { background-position: -362px 0 }
|
205
|
+
.midas-htmleditorbar .midas-button-outdent.active { background-position: -362px -18px }
|
206
|
+
.midas-htmleditorbar .midas-button-outdent.disabled,
|
207
|
+
.disabled .midas-button-outdent { background-position: -362px -36px !important }
|
208
|
+
|
209
|
+
.midas-htmleditorbar .midas-button-indent { background-position: -385px 0 }
|
210
|
+
.midas-htmleditorbar .midas-button-indent.active { background-position: -385px -18px }
|
211
|
+
.midas-htmleditorbar .midas-button-indent.disabled,
|
212
|
+
.disabled .midas-button-indent { background-position: -385px -36px !important }
|
213
|
+
|
214
|
+
.midas-htmleditorbar .midas-button-insertrowbefore { background-position: -408px 0 }
|
215
|
+
.midas-htmleditorbar .midas-button-insertrowbefore.active { background-position: -408px -18px }
|
216
|
+
.midas-htmleditorbar .midas-button-insertrowbefore.disabled,
|
217
|
+
.disabled .midas-button-insertrowbefore { background-position: -408px -36px !important }
|
218
|
+
|
219
|
+
.midas-htmleditorbar .midas-button-insertrowafter { background-position: -431px 0 }
|
220
|
+
.midas-htmleditorbar .midas-button-insertrowafter.active { background-position: -431px -18px }
|
221
|
+
.midas-htmleditorbar .midas-button-insertrowafter.disabled,
|
222
|
+
.disabled .midas-button-insertrowafter { background-position: -431px -36px !important }
|
223
|
+
|
224
|
+
.midas-htmleditorbar .midas-button-deleterow { background-position: -453px 0 }
|
225
|
+
.midas-htmleditorbar .midas-button-deleterow.active { background-position: -453px -18px }
|
226
|
+
.midas-htmleditorbar .midas-button-deleterow.disabled,
|
227
|
+
.disabled .midas-button-deleterow { background-position: -453px -36px !important }
|
228
|
+
|
229
|
+
.midas-htmleditorbar .midas-button-insertcolumnbefore { background-position: -475px 0 }
|
230
|
+
.midas-htmleditorbar .midas-button-insertcolumnbefore.active { background-position: -475px -18px }
|
231
|
+
.midas-htmleditorbar .midas-button-insertcolumnbefore.disabled,
|
232
|
+
.disabled .midas-button-insertcolumnbefore { background-position: -475px -36px !important }
|
233
|
+
|
234
|
+
.midas-htmleditorbar .midas-button-insertcolumnafter { background-position: -497px 0 }
|
235
|
+
.midas-htmleditorbar .midas-button-insertcolumnafter.active { background-position: -497px -18px }
|
236
|
+
.midas-htmleditorbar .midas-button-insertcolumnafter.disabled,
|
237
|
+
.disabled .midas-button-insertcolumnafter { background-position: -497px -36px !important }
|
238
|
+
|
239
|
+
.midas-htmleditorbar .midas-button-deletecolumn { background-position: -519px 0 }
|
240
|
+
.midas-htmleditorbar .midas-button-deletecolumn.active { background-position: -519px -18px }
|
241
|
+
.midas-htmleditorbar .midas-button-deletecolumn.disabled,
|
242
|
+
.disabled .midas-button-deletecolumn { background-position: -519px -36px !important }
|
243
|
+
|
244
|
+
.midas-htmleditorbar .midas-button-horizontalrule { background-position: -542px 0 }
|
245
|
+
.midas-htmleditorbar .midas-button-horizontalrule.active { background-position: -542px -18px }
|
246
|
+
.midas-htmleditorbar .midas-button-horizontalrule.disabled,
|
247
|
+
.disabled .midas-button-horizontalrule { background-position: -542px -36px !important }
|
248
|
+
|
249
|
+
.midas-htmleditorbar .midas-button-pagebreak { background-position: -565px 0 }
|
250
|
+
.midas-htmleditorbar .midas-button-pagebreak.active { background-position: -565px -18px }
|
251
|
+
.midas-htmleditorbar .midas-button-pagebreak.disabled,
|
252
|
+
.disabled .midas-button-pagebreak { background-position: -565px -36px !important }
|
253
|
+
|
254
|
+
.midas-htmleditorbar .midas-button-removeformatting { background-position: -588px 0 }
|
255
|
+
.midas-htmleditorbar .midas-button-removeformatting.active { background-position: -588px -18px }
|
256
|
+
.midas-htmleditorbar .midas-button-removeformatting.disabled,
|
257
|
+
.disabled .midas-button-removeformatting { background-position: -588px -36px !important }
|
258
|
+
|
259
|
+
.midas-htmleditorbar .midas-button-html { background-position: -612px 0 }
|
260
|
+
.midas-htmleditorbar .midas-button-html.active { background-position: -588px -18px }
|
261
|
+
.midas-htmleditorbar .midas-button-html.disabled,
|
262
|
+
.disabled .midas-button-html { background-position: -588px -36px !important }
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# initialize for rails
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<div id="toolbar">toolbar</div>
|
2
|
+
<div id="statusbar">statusbar</div>
|
3
|
+
<div id="palette_button">palette button</div>
|
4
|
+
|
5
|
+
<div id="region1" class="editable">
|
6
|
+
region1
|
7
|
+
</div>
|
8
|
+
<div id="region2" class="editable">
|
9
|
+
region2
|
10
|
+
</div>
|
11
|
+
<div id="region3" class="not-editable">
|
12
|
+
|
13
|
+
</div>
|
14
|
+
<div id="region4" class="editable">
|
15
|
+
<div id="action">action in region4</div>
|
16
|
+
<div id="div1">div1 <div id="div4">in</div> region4</div>
|
17
|
+
<div id="div2">
|
18
|
+
<div id="div3">th<em>e</em>re is <big>no</big> html here</div>
|
19
|
+
</div>
|
20
|
+
<div id="div5">
|
21
|
+
<ul>
|
22
|
+
<li>first li</li>
|
23
|
+
<li><span>this is in a li</span></li>
|
24
|
+
</ul>
|
25
|
+
</div>
|
26
|
+
<div id="div6"><span>this isn't in a li</span></div>
|
27
|
+
</div>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<div id="div1">thi<span>s is</span> a <div>test</div></div>
|
2
|
+
<div id="div2">banana</div>
|
3
|
+
<div id="div3">thi<span>s </span><em>a </em><span>test</span></div>
|
4
|
+
<div id="div4">thi<blockquote>s is</blockquote> a <span>test</span><table><tr><td>aa</td></tr></table></div>
|
5
|
+
<iframe src="about:blank" id="iframe1"></iframe>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
jasmine.browser = (function(){
|
2
|
+
var ua = navigator.userAgent;
|
3
|
+
var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
|
4
|
+
var isWebKit = ua.indexOf('AppleWebKit/') > -1;
|
5
|
+
|
6
|
+
return {
|
7
|
+
IE: !!window.attachEvent && !isOpera,
|
8
|
+
Opera: isOpera,
|
9
|
+
WebKit: isWebKit,
|
10
|
+
AppleWebKit: isWebKit && ua.indexOf('Chrome') < 0,
|
11
|
+
ChromeWebKit: isWebKit && ua.indexOf('Chrome') > -1,
|
12
|
+
Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
|
13
|
+
MobileSafari: /Apple.*Mobile/.test(ua)
|
14
|
+
}
|
15
|
+
})();
|
@@ -0,0 +1,505 @@
|
|
1
|
+
jasmine.simulate = {
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Simulates a key event using the given event information to populate
|
5
|
+
* the generated event object. This method does browser-equalizing
|
6
|
+
* calculations to account for differences in the DOM and IE event models
|
7
|
+
* as well as different browser quirks. Note: keydown causes Safari 2.x to
|
8
|
+
* crash.
|
9
|
+
*
|
10
|
+
* @param {HTMLElement} target The target of the given event.
|
11
|
+
* @param {String} type The type of event to fire. This can be any one of
|
12
|
+
* the following: keyup, keydown, and keypress.
|
13
|
+
* @param {Boolean} bubbles (Optional) Indicates if the event can be
|
14
|
+
* bubbled up. DOM Level 3 specifies that all key events bubble by
|
15
|
+
* default. The default is true.
|
16
|
+
* @param {Boolean} cancelable (Optional) Indicates if the event can be
|
17
|
+
* canceled using preventDefault(). DOM Level 3 specifies that all
|
18
|
+
* key events can be cancelled. The default
|
19
|
+
* is true.
|
20
|
+
* @param {Window} view (Optional) The view containing the target. This is
|
21
|
+
* typically the window object. The default is window.
|
22
|
+
* @param {Boolean} ctrlKey (Optional) Indicates if one of the CTRL keys
|
23
|
+
* is pressed while the event is firing. The default is false.
|
24
|
+
* @param {Boolean} altKey (Optional) Indicates if one of the ALT keys
|
25
|
+
* is pressed while the event is firing. The default is false.
|
26
|
+
* @param {Boolean} shiftKey (Optional) Indicates if one of the SHIFT keys
|
27
|
+
* is pressed while the event is firing. The default is false.
|
28
|
+
* @param {Boolean} metaKey (Optional) Indicates if one of the META keys
|
29
|
+
* is pressed while the event is firing. The default is false.
|
30
|
+
* @param {int} keyCode (Optional) The code for the key that is in use.
|
31
|
+
* The default is 0.
|
32
|
+
* @param {int} charCode (Optional) The Unicode code for the character
|
33
|
+
* associated with the key being used. The default is 0.
|
34
|
+
* @static
|
35
|
+
*/
|
36
|
+
keyEvent: function (target, type, bubbles, cancelable, view, ctrlKey, altKey, shiftKey, metaKey, keyCode, charCode) {
|
37
|
+
if (!target) throw('simulateKeyEvent(): Invalid target.');
|
38
|
+
if (typeof(type) != 'string') throw('simulateKeyEvent(): Event type must be a string.');
|
39
|
+
|
40
|
+
type = type.toLowerCase();
|
41
|
+
switch(type) {
|
42
|
+
case 'keyup':
|
43
|
+
case 'keydown':
|
44
|
+
case 'keypress':
|
45
|
+
break;
|
46
|
+
case 'textevent': // DOM Level 3
|
47
|
+
type = 'keypress';
|
48
|
+
break;
|
49
|
+
default: throw("simulateKeyEvent(): Event type '" + type + "' not supported.");
|
50
|
+
}
|
51
|
+
|
52
|
+
// setup default values
|
53
|
+
if (typeof(bubbles) == 'undefined') bubbles = true; // all key events bubble
|
54
|
+
if (typeof(cancelable) == 'undefined') cancelable = true; // all key events can be cancelled
|
55
|
+
if (typeof(view) == 'undefined') view = window;
|
56
|
+
if (typeof(ctrlKey) == 'undefined') ctrlKey = false;
|
57
|
+
if (typeof(altKey) == 'undefined') altKey = false;
|
58
|
+
if (typeof(shiftKey) == 'undefined') shiftKey = false;
|
59
|
+
if (typeof(metaKey) == 'undefined') metaKey = false;
|
60
|
+
if (typeof(keyCode) == 'undefined') keyCode = 0;
|
61
|
+
if (typeof(charCode) == 'undefined') charCode = 0;
|
62
|
+
|
63
|
+
// try to create a mouse event
|
64
|
+
var customEvent = null;
|
65
|
+
|
66
|
+
// check for DOM-compliant browsers first
|
67
|
+
if (typeof(document.createEvent) == 'function') {
|
68
|
+
try {
|
69
|
+
customEvent = document.createEvent('KeyEvents');
|
70
|
+
// Interesting problem: Firefox implemented a non-standard version
|
71
|
+
// of initKeyEvent() based on DOM Level 2 specs. Key event was
|
72
|
+
// removed from DOM Level 2 and re-introduced in DOM Level 3 with a
|
73
|
+
// different interface. Firefox is the only browser with any
|
74
|
+
// implementation of Key Events, so for now, assume it's Firefox if
|
75
|
+
// the above line doesn't error.
|
76
|
+
// TODO: Decipher between Firefox's implementation and a correct one.
|
77
|
+
customEvent.initKeyEvent(type, bubbles, cancelable, view, ctrlKey, altKey, shiftKey, metaKey, keyCode, charCode);
|
78
|
+
} catch (ex) {
|
79
|
+
// If we got here, that means key events aren't officially supported.
|
80
|
+
// Safari/WebKit is a real problem now. WebKit 522 won't let you set
|
81
|
+
// keyCode, charCode, or other properties if you use a UIEvent, so we
|
82
|
+
// first must try to create a generic event. The fun part is that
|
83
|
+
// this will throw an error on Safari 2.x. The end result is that we
|
84
|
+
// need another try...catch statement just to deal with this mess.
|
85
|
+
try {
|
86
|
+
// try to create generic event - will fail in Safari 2.x
|
87
|
+
customEvent = document.createEvent('Events');
|
88
|
+
} catch (uierror) {
|
89
|
+
// the above failed, so create a UIEvent for Safari 2.x
|
90
|
+
customEvent = document.createEvent('UIEvents');
|
91
|
+
} finally {
|
92
|
+
customEvent.initEvent(type, bubbles, cancelable);
|
93
|
+
customEvent.view = view;
|
94
|
+
customEvent.altKey = altKey;
|
95
|
+
customEvent.ctrlKey = ctrlKey;
|
96
|
+
customEvent.shiftKey = shiftKey;
|
97
|
+
customEvent.metaKey = metaKey;
|
98
|
+
customEvent.keyCode = keyCode;
|
99
|
+
customEvent.charCode = charCode;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
// fire the event
|
103
|
+
target.dispatchEvent(customEvent);
|
104
|
+
} else if (typeof(document.createEventObject) == 'object') {
|
105
|
+
//create an IE event object
|
106
|
+
customEvent = document.createEventObject();
|
107
|
+
customEvent.bubbles = bubbles;
|
108
|
+
customEvent.cancelable = cancelable;
|
109
|
+
customEvent.view = view;
|
110
|
+
customEvent.ctrlKey = ctrlKey;
|
111
|
+
customEvent.altKey = altKey;
|
112
|
+
customEvent.shiftKey = shiftKey;
|
113
|
+
customEvent.metaKey = metaKey;
|
114
|
+
|
115
|
+
// IE doesn't support charCode explicitly. CharCode should take
|
116
|
+
// precedence over any keyCode value for accurate representation.
|
117
|
+
customEvent.keyCode = (charCode > 0) ? charCode : keyCode;
|
118
|
+
|
119
|
+
// fire the event
|
120
|
+
target.fireEvent('on' + type, customEvent);
|
121
|
+
} else {
|
122
|
+
throw('simulateKeyEvent(): No event simulation framework present.');
|
123
|
+
}
|
124
|
+
},
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Simulates a mouse event using the given event information to populate
|
128
|
+
* the generated event object. This method does browser-equalizing
|
129
|
+
* calculations to account for differences in the DOM and IE event models
|
130
|
+
* as well as different browser quirks.
|
131
|
+
*
|
132
|
+
* @param {HTMLElement} target The target of the given event.
|
133
|
+
* @param {String} type The type of event to fire. This can be any one of
|
134
|
+
* the following: click, dblclick, mousedown, mouseup, mouseout,
|
135
|
+
* mouseover, and mousemove.
|
136
|
+
* @param {Boolean} bubbles (Optional) Indicates if the event can be
|
137
|
+
* bubbled up. DOM Level 2 specifies that all mouse events bubble by
|
138
|
+
* default. The default is true.
|
139
|
+
* @param {Boolean} cancelable (Optional) Indicates if the event can be
|
140
|
+
* canceled using preventDefault(). DOM Level 2 specifies that all
|
141
|
+
* mouse events except mousemove can be cancelled. The default
|
142
|
+
* is true for all events except mousemove, for which the default
|
143
|
+
* is false.
|
144
|
+
* @param {Window} view (Optional) The view containing the target. This is
|
145
|
+
* typically the window object. The default is window.
|
146
|
+
* @param {int} detail (Optional) The number of times the mouse button has
|
147
|
+
* been used. The default value is 1.
|
148
|
+
* @param {int} screenX (Optional) The x-coordinate on the screen at which
|
149
|
+
* point the event occured. The default is 0.
|
150
|
+
* @param {int} screenY (Optional) The y-coordinate on the screen at which
|
151
|
+
* point the event occured. The default is 0.
|
152
|
+
* @param {int} clientX (Optional) The x-coordinate on the client at which
|
153
|
+
* point the event occured. The default is 0.
|
154
|
+
* @param {int} clientY (Optional) The y-coordinate on the client at which
|
155
|
+
* point the event occured. The default is 0.
|
156
|
+
* @param {Boolean} ctrlKey (Optional) Indicates if one of the CTRL keys
|
157
|
+
* is pressed while the event is firing. The default is false.
|
158
|
+
* @param {Boolean} altKey (Optional) Indicates if one of the ALT keys
|
159
|
+
* is pressed while the event is firing. The default is false.
|
160
|
+
* @param {Boolean} shiftKey (Optional) Indicates if one of the SHIFT keys
|
161
|
+
* is pressed while the event is firing. The default is false.
|
162
|
+
* @param {Boolean} metaKey (Optional) Indicates if one of the META keys
|
163
|
+
* is pressed while the event is firing. The default is false.
|
164
|
+
* @param {int} button (Optional) The button being pressed while the event
|
165
|
+
* is executing. The value should be 0 for the primary mouse button
|
166
|
+
* (typically the left button), 1 for the terciary mouse button
|
167
|
+
* (typically the middle button), and 2 for the secondary mouse button
|
168
|
+
* (typically the right button). The default is 0.
|
169
|
+
* @param {HTMLElement} relatedTarget (Optional) For mouseout events,
|
170
|
+
* this is the element that the mouse has moved to. For mouseover
|
171
|
+
* events, this is the element that the mouse has moved from. This
|
172
|
+
* argument is ignored for all other events. The default is null.
|
173
|
+
* @static
|
174
|
+
*/
|
175
|
+
mouseEvent: function(target, type, bubbles, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget) {
|
176
|
+
if (!target) throw('simulateMouseEvent(): Invalid target.');
|
177
|
+
if (typeof(type) != 'string') throw('simulateMouseEvent(): Event type must be a string.');
|
178
|
+
|
179
|
+
type = type.toLowerCase();
|
180
|
+
switch(type){
|
181
|
+
case 'mouseover':
|
182
|
+
case 'mouseout':
|
183
|
+
case 'mousedown':
|
184
|
+
case 'mouseup':
|
185
|
+
case 'click':
|
186
|
+
case 'dblclick':
|
187
|
+
case 'mousemove':
|
188
|
+
break;
|
189
|
+
default: throw("simulateMouseEvent(): Event type '" + type + "' not supported.");
|
190
|
+
}
|
191
|
+
|
192
|
+
//setup default values
|
193
|
+
if (typeof(bubbles) == 'undefined') bubbles = true; // all mouse events bubble
|
194
|
+
if (typeof(cancelable) == 'undefined') cancelable = (type != "mousemove"); // mousemove is the only one that can't be cancelled
|
195
|
+
if (typeof(view) == 'undefined') view = window; // view is typically window
|
196
|
+
if (typeof(detail) == 'undefined') detail = 1; // number of mouse clicks must be at least one
|
197
|
+
if (typeof(screenX) == 'undefined') screenX = 0;
|
198
|
+
if (typeof(screenY) == 'undefined') screenY = 0;
|
199
|
+
if (typeof(clientX) == 'undefined') clientX = 0;
|
200
|
+
if (typeof(clientY) == 'undefined') clientY = 0;
|
201
|
+
if (typeof(ctrlKey) == 'undefined') ctrlKey = false;
|
202
|
+
if (typeof(altKey) == 'undefined') altKey = false;
|
203
|
+
if (typeof(shiftKey) == 'undefined') shiftKey = false;
|
204
|
+
if (typeof(metaKey) == 'undefined') metaKey = false;
|
205
|
+
if (typeof(button) == 'undefined') button = 0;
|
206
|
+
|
207
|
+
// try to create a mouse event
|
208
|
+
var customEvent = null;
|
209
|
+
|
210
|
+
// check for DOM-compliant browsers first
|
211
|
+
if (typeof(document.createEvent) == 'function') {
|
212
|
+
customEvent = document.createEvent("MouseEvents");
|
213
|
+
|
214
|
+
// Safari 2.x (WebKit 418) still doesn't implement initMouseEvent()
|
215
|
+
if (customEvent.initMouseEvent) {
|
216
|
+
customEvent.initMouseEvent(type, bubbles, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);
|
217
|
+
} else {
|
218
|
+
// the closest thing available in Safari 2.x is UIEvents
|
219
|
+
customEvent = document.createEvent("UIEvents");
|
220
|
+
customEvent.initEvent(type, bubbles, cancelable);
|
221
|
+
customEvent.view = view;
|
222
|
+
customEvent.detail = detail;
|
223
|
+
customEvent.screenX = screenX;
|
224
|
+
customEvent.screenY = screenY;
|
225
|
+
customEvent.clientX = clientX;
|
226
|
+
customEvent.clientY = clientY;
|
227
|
+
customEvent.ctrlKey = ctrlKey;
|
228
|
+
customEvent.altKey = altKey;
|
229
|
+
customEvent.metaKey = metaKey;
|
230
|
+
customEvent.shiftKey = shiftKey;
|
231
|
+
customEvent.button = button;
|
232
|
+
customEvent.relatedTarget = relatedTarget;
|
233
|
+
}
|
234
|
+
|
235
|
+
// Check to see if relatedTarget has been assigned. Firefox versions
|
236
|
+
// less than 2.0 don't allow it to be assigned via initMouseEvent()
|
237
|
+
// and the property is readonly after event creation, so in order to
|
238
|
+
// keep YAHOO.util.getRelatedTarget() working, assign to the IE
|
239
|
+
// proprietary toElement property for mouseout event and fromElement
|
240
|
+
// property for mouseover event.
|
241
|
+
if (relatedTarget && !customEvent.relatedTarget) {
|
242
|
+
if (type == "mouseout") {
|
243
|
+
customEvent.toElement = relatedTarget;
|
244
|
+
} else if (type == "mouseover") {
|
245
|
+
customEvent.fromElement = relatedTarget;
|
246
|
+
}
|
247
|
+
}
|
248
|
+
|
249
|
+
//fire the event
|
250
|
+
target.dispatchEvent(customEvent);
|
251
|
+
} else if (typeof(document.createEventObject) == 'object') {
|
252
|
+
//create an IE event object
|
253
|
+
customEvent = document.createEventObject();
|
254
|
+
customEvent.bubbles = bubbles;
|
255
|
+
customEvent.cancelable = cancelable;
|
256
|
+
customEvent.view = view;
|
257
|
+
customEvent.detail = detail;
|
258
|
+
customEvent.screenX = screenX;
|
259
|
+
customEvent.screenY = screenY;
|
260
|
+
customEvent.clientX = clientX;
|
261
|
+
customEvent.clientY = clientY;
|
262
|
+
customEvent.ctrlKey = ctrlKey;
|
263
|
+
customEvent.altKey = altKey;
|
264
|
+
customEvent.metaKey = metaKey;
|
265
|
+
customEvent.shiftKey = shiftKey;
|
266
|
+
//fix button property for IE's wacky implementation
|
267
|
+
switch(button) {
|
268
|
+
case 0: customEvent.button = 1; break;
|
269
|
+
case 1: customEvent.button = 4; break;
|
270
|
+
case 2: break; // leave as is
|
271
|
+
default: customEvent.button = 0;
|
272
|
+
}
|
273
|
+
// Have to use relatedTarget because IE won't allow assignment to
|
274
|
+
// toElement or fromElement on generic events. This keeps
|
275
|
+
// YAHOO.util.customEvent.getRelatedTarget() functional.
|
276
|
+
customEvent.relatedTarget = relatedTarget;
|
277
|
+
|
278
|
+
//fire the event
|
279
|
+
target.fireEvent("on" + type, customEvent);
|
280
|
+
} else {
|
281
|
+
throw('simulateMouseEvent(): No event simulation framework present.');
|
282
|
+
}
|
283
|
+
},
|
284
|
+
|
285
|
+
//--------------------------------------------------------------------------
|
286
|
+
// Mouse events
|
287
|
+
//--------------------------------------------------------------------------
|
288
|
+
|
289
|
+
/**
|
290
|
+
* Simulates a mouse event on a particular element.
|
291
|
+
*
|
292
|
+
* @param {HTMLElement} target The element to click on.
|
293
|
+
* @param {String} type The type of event to fire. This can be any one of
|
294
|
+
* the following: click, dblclick, mousedown, mouseup, mouseout,
|
295
|
+
* mouseover, and mousemove.
|
296
|
+
* @param {Object} options Additional event options (use DOM standard names).
|
297
|
+
* @static
|
298
|
+
*/
|
299
|
+
fireMouseEvent: function(type, target, options) {
|
300
|
+
options = options || {};
|
301
|
+
this.mouseEvent(target, type, options.bubbles,
|
302
|
+
options.cancelable, options.view, options.detail, options.screenX,
|
303
|
+
options.screenY, options.clientX, options.clientY, options.ctrlKey,
|
304
|
+
options.altKey, options.shiftKey, options.metaKey, options.button,
|
305
|
+
options.relatedTarget);
|
306
|
+
},
|
307
|
+
|
308
|
+
/**
|
309
|
+
* Simulates a click on a particular element.
|
310
|
+
*
|
311
|
+
* @param {HTMLElement} target The element to click on.
|
312
|
+
* @param {Object} options Additional event options (use DOM standard names).
|
313
|
+
* @static
|
314
|
+
*/
|
315
|
+
click: function(target, options) {
|
316
|
+
this.fireMouseEvent('click', target, options);
|
317
|
+
},
|
318
|
+
|
319
|
+
/**
|
320
|
+
* Simulates a double click on a particular element.
|
321
|
+
*
|
322
|
+
* @param {HTMLElement} target The element to double click on.
|
323
|
+
* @param {Object} options Additional event options (use DOM standard names).
|
324
|
+
* @static
|
325
|
+
*/
|
326
|
+
dblclick: function(target, options) {
|
327
|
+
this.fireMouseEvent('dblclick', target, options);
|
328
|
+
},
|
329
|
+
|
330
|
+
/**
|
331
|
+
* Simulates a mousedown on a particular element.
|
332
|
+
*
|
333
|
+
* @param {HTMLElement} target The element to act on.
|
334
|
+
* @param {Object} options Additional event options (use DOM standard names).
|
335
|
+
* @static
|
336
|
+
*/
|
337
|
+
mousedown: function(target, options) {
|
338
|
+
this.fireMouseEvent('mousedown', target, options);
|
339
|
+
},
|
340
|
+
|
341
|
+
/**
|
342
|
+
* Simulates a mousemove on a particular element.
|
343
|
+
*
|
344
|
+
* @param {HTMLElement} target The element to act on.
|
345
|
+
* @param {Object} options Additional event options (use DOM standard names).
|
346
|
+
* @static
|
347
|
+
*/
|
348
|
+
mousemove: function(target, options) {
|
349
|
+
this.fireMouseEvent('mousemove', target, options);
|
350
|
+
},
|
351
|
+
|
352
|
+
/**
|
353
|
+
* Simulates a mouseout event on a particular element. Use 'relatedTarget'
|
354
|
+
* on the options object to specify where the mouse moved to.
|
355
|
+
*
|
356
|
+
* Quirks: Firefox less than 2.0 doesn't set relatedTarget properly, so
|
357
|
+
* toElement is assigned in its place. IE doesn't allow toElement to be
|
358
|
+
* be assigned, so relatedTarget is assigned in its place. Both of these
|
359
|
+
* concessions allow YAHOO.util.Event.getRelatedTarget() to work correctly
|
360
|
+
* in both browsers.
|
361
|
+
*
|
362
|
+
* @param {HTMLElement} target The element to act on.
|
363
|
+
* @param {Object} options Additional event options (use DOM standard names).
|
364
|
+
* @static
|
365
|
+
*/
|
366
|
+
mouseout: function(target, options) {
|
367
|
+
this.fireMouseEvent('mouseout', target, options);
|
368
|
+
},
|
369
|
+
|
370
|
+
/**
|
371
|
+
* Simulates a mouseover event on a particular element. Use 'relatedTarget'
|
372
|
+
* on the options object to specify where the mouse moved from.
|
373
|
+
*
|
374
|
+
* Quirks: Firefox less than 2.0 doesn't set relatedTarget properly, so
|
375
|
+
* fromElement is assigned in its place. IE doesn't allow fromElement to be
|
376
|
+
* be assigned, so relatedTarget is assigned in its place. Both of these
|
377
|
+
* concessions allow YAHOO.util.Event.getRelatedTarget() to work correctly
|
378
|
+
* in both browsers.
|
379
|
+
*
|
380
|
+
* @param {HTMLElement} target The element to act on.
|
381
|
+
* @param {Object} options Additional event options (use DOM standard names).
|
382
|
+
* @static
|
383
|
+
*/
|
384
|
+
mouseover: function(target, options) {
|
385
|
+
this.fireMouseEvent('mouseover', target, options);
|
386
|
+
},
|
387
|
+
|
388
|
+
/**
|
389
|
+
* Simulates a mouseup on a particular element.
|
390
|
+
*
|
391
|
+
* @param {HTMLElement} target The element to act on.
|
392
|
+
* @param {Object} options Additional event options (use DOM standard names).
|
393
|
+
* @static
|
394
|
+
*/
|
395
|
+
mouseup: function(target, options) {
|
396
|
+
this.fireMouseEvent('mouseup', target, options);
|
397
|
+
},
|
398
|
+
|
399
|
+
//--------------------------------------------------------------------------
|
400
|
+
// Key events
|
401
|
+
//--------------------------------------------------------------------------
|
402
|
+
|
403
|
+
/**
|
404
|
+
* Fires an event that normally would be fired by the keyboard (keyup,
|
405
|
+
* keydown, keypress). Make sure to specify either keyCode or charCode as
|
406
|
+
* an option.
|
407
|
+
*
|
408
|
+
* @param {String} type The type of event ("keyup", "keydown" or "keypress").
|
409
|
+
* @param {HTMLElement} target The target of the event.
|
410
|
+
* @param {Object} options Options for the event. Either keyCode or charCode are required.
|
411
|
+
* @static
|
412
|
+
*/
|
413
|
+
fireKeyEvent: function(type, target, options) {
|
414
|
+
options = options || {};
|
415
|
+
this.keyEvent(target, type, options.bubbles,
|
416
|
+
options.cancelable, options.view, options.ctrlKey,
|
417
|
+
options.altKey, options.shiftKey, options.metaKey,
|
418
|
+
options.keyCode, options.charCode);
|
419
|
+
},
|
420
|
+
|
421
|
+
/**
|
422
|
+
* Simulates a keydown event on a particular element.
|
423
|
+
*
|
424
|
+
* @param {HTMLElement} target The element to act on.
|
425
|
+
* @param {Object} options Additional event options (use DOM standard names).
|
426
|
+
* @static
|
427
|
+
*/
|
428
|
+
keydown: function(target, options) {
|
429
|
+
this.fireKeyEvent('keydown', target, options);
|
430
|
+
},
|
431
|
+
|
432
|
+
/**
|
433
|
+
* Simulates a keypress on a particular element.
|
434
|
+
*
|
435
|
+
* @param {HTMLElement} target The element to act on.
|
436
|
+
* @param {Object} options Additional event options (use DOM standard names).
|
437
|
+
* @static
|
438
|
+
*/
|
439
|
+
keypress: function(target, options) {
|
440
|
+
this.fireKeyEvent('keypress', target, options);
|
441
|
+
},
|
442
|
+
|
443
|
+
/**
|
444
|
+
* Simulates a keyup event on a particular element.
|
445
|
+
*
|
446
|
+
* @param {HTMLElement} target The element to act on.
|
447
|
+
* @param {Object} options Additional event options (use DOM standard names).
|
448
|
+
* @static
|
449
|
+
*/
|
450
|
+
keyup: function(target, options) {
|
451
|
+
this.fireKeyEvent('keyup', target, options);
|
452
|
+
},
|
453
|
+
|
454
|
+
//--------------------------------------------------------------------------
|
455
|
+
// Other events
|
456
|
+
//--------------------------------------------------------------------------
|
457
|
+
|
458
|
+
/**
|
459
|
+
* Emulates a selection.. This doesn't simulate moving the mouse to make a
|
460
|
+
* selection, or using the arrow keys with shift, but it does create a
|
461
|
+
* selection that contains whatever target element you pass to it.
|
462
|
+
*
|
463
|
+
* @param {HTMLElement} target The element to select.
|
464
|
+
* @static
|
465
|
+
*/
|
466
|
+
selection: function(target) {
|
467
|
+
var selection = window.getSelection();
|
468
|
+
var range = document.createRange();
|
469
|
+
range.selectNode(target);
|
470
|
+
selection.removeAllRanges();
|
471
|
+
selection.addRange(range);
|
472
|
+
},
|
473
|
+
|
474
|
+
/**
|
475
|
+
* Emulates pressing the tab button.
|
476
|
+
*
|
477
|
+
* @param {HTMLElement} target The element to press tab in.
|
478
|
+
* @static
|
479
|
+
*/
|
480
|
+
tab: function(target) {
|
481
|
+
this.keypress(target, {keyCode: 9});
|
482
|
+
},
|
483
|
+
|
484
|
+
/**
|
485
|
+
* Executes a focus event
|
486
|
+
* -- not simulated, but it seems like the right place to put it.
|
487
|
+
*
|
488
|
+
* @param {HTMLElement} target The element to act on.
|
489
|
+
* @static
|
490
|
+
*/
|
491
|
+
focus: function(target) {
|
492
|
+
target.focus();
|
493
|
+
},
|
494
|
+
|
495
|
+
/**
|
496
|
+
* Executes a focus event
|
497
|
+
* -- not simulated, but it seems like the right place to put it.
|
498
|
+
*
|
499
|
+
* @param {HTMLElement} target The element to act on.
|
500
|
+
* @static
|
501
|
+
*/
|
502
|
+
blur: function(target) {
|
503
|
+
target.blur();
|
504
|
+
}
|
505
|
+
};
|