@@ -23,7 +23,7 @@ var _outlineElements = [];
23
23
//-- EVENT OF ADDON ELEMENT
24
24
25
25
function onbuttonGuideAutomatorClicked ( state ) {
26
- if ( state . checked ) {
26
+ if ( state . checked ) {
27
27
popupGuideAutomator . show ( {
28
28
position : button
29
29
} ) ;
@@ -38,7 +38,7 @@ function onContextGetCssSelector(message) {
38
38
function onContextGDFunction ( message ) {
39
39
message = JSON . parse ( message ) ;
40
40
message = getGDCommand ( message ) ;
41
- if ( message !== "" ) {
41
+ if ( message !== "" ) {
42
42
clipboard . set ( message ) ;
43
43
popupGuideAutomator . port . emit ( "text-received" , message ) ;
44
44
}
@@ -172,7 +172,7 @@ popupGuideAutomator.port.on("hideMessage", function(text) {
172
172
} ) ;
173
173
174
174
popupGuideAutomator . port . on ( "CopyMessage" , function ( text ) {
175
- if ( text !== "" ) {
175
+ if ( text !== "" ) {
176
176
clipboard . set ( text ) ;
177
177
}
178
178
} ) ;
@@ -192,27 +192,27 @@ popupGuideAutomator.port.on("clear", function() {
192
192
193
193
function getGDCommand ( data ) {
194
194
var result = "" ;
195
- if ( data . pageContext && data . command !== "Outline" ) {
196
- if ( data . pageContext !== _pageContext )
195
+ if ( data . pageContext && data . command !== "Outline" ) {
196
+ if ( data . pageContext !== _pageContext )
197
197
result = `pageContext(` + data . pageContext . toString ( ) + `);\n` ;
198
198
_pageContext = data . pageContext ;
199
199
} else {
200
- if ( _pageContext !== "" ) {
200
+ if ( _pageContext !== "" ) {
201
201
_pageContext = "" ;
202
202
result = `pageContext();\n` ;
203
203
}
204
204
}
205
205
206
206
207
- switch ( data . command ) {
207
+ switch ( data . command ) {
208
208
case "GetUrl" :
209
209
result += `get(` + data . result [ 0 ] + `);` ;
210
210
break ;
211
211
case "Click" :
212
212
result += `click(` + data . result [ 0 ] + `);` ;
213
213
break ;
214
214
case "TakeScreenshot" :
215
- if ( _outlineElements . length === 0 )
215
+ if ( _outlineElements . length === 0 )
216
216
result += `takeScreenshot(` + data . result [ 0 ] + `);` ;
217
217
else {
218
218
result += `takeScreenshotOf([` + getAllOutlines ( ) + `],` +
@@ -223,14 +223,14 @@ function getGDCommand(data) {
223
223
}
224
224
break ;
225
225
case "TakeScreenshotOf" :
226
- if ( _outlineElements . length === 0 )
226
+ if ( _outlineElements . length === 0 )
227
227
result += `takeScreenshotOf(` + data . result [ 0 ] + `,` +
228
228
data . result [ 1 ] + `,` +
229
229
data . result [ 2 ] + `,` +
230
230
data . result [ 3 ] +
231
231
`);` ;
232
232
else {
233
- if ( data . pageContext )
233
+ if ( data . pageContext )
234
234
_outlineElements . push ( [ data . result [ 0 ] , data . pageContext ] ) ;
235
235
else
236
236
_outlineElements . push ( data . result [ 0 ] ) ;
@@ -257,7 +257,7 @@ function getGDCommand(data) {
257
257
result += `console.print(` + data . result [ 0 ] + `);` ;
258
258
break ;
259
259
case "Outline" :
260
- if ( data . pageContext )
260
+ if ( data . pageContext )
261
261
_outlineElements . push ( [ data . result [ 0 ] , data . pageContext ] ) ;
262
262
else
263
263
_outlineElements . push ( data . result [ 0 ] ) ;
@@ -272,13 +272,13 @@ function getGDCommand(data) {
272
272
273
273
function getAllOutlines ( ) {
274
274
var selectors = [ ] ;
275
- var nodeOutline = _outlineElements . pop ( ) ;
276
- while ( nodeOutline ) {
277
- if ( nodeOutline . constructor === Array )
275
+ var nodeOutline = _outlineElements . shift ( ) ;
276
+ while ( nodeOutline ) {
277
+ if ( nodeOutline . constructor === Array )
278
278
selectors . push ( "[" + nodeOutline + "]" ) ;
279
279
else
280
280
selectors . push ( nodeOutline ) ;
281
- nodeOutline = _outlineElements . pop ( ) ;
281
+ nodeOutline = _outlineElements . shift ( ) ;
282
282
}
283
283
return selectors ;
284
284
}
0 commit comments