Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
35ac229d
...
35ac229d31eeab364738f63f313b9935a9be71b3
authored
2011-10-17 13:14:19 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
rewrote samples/googlematch.js using Casper#each()
1 parent
cd69df4e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
14 deletions
samples/googlematch.js
samples/googlematch.js
View file @
35ac229
...
...
@@ -30,25 +30,17 @@ if (terms.length < 2) {
casper
.
start
(
"http://google.fr/"
);
casper
.
repeat
(
terms
.
length
,
function
(
self
)
{
self
.
then
((
function
(
casper
,
i
)
{
return
function
(
self
)
{
self
.
fill
(
'form[name=f]'
,
{
q
:
terms
[
i
]
},
true
);
};
})(
self
,
i
));
self
.
then
((
function
(
casper
,
i
)
{
return
function
(
self
)
{
var
term
=
terms
[
i
],
score
=
self
.
fetchScore
();
casper
.
each
(
terms
,
function
(
self
,
term
,
i
)
{
self
.
then
(
function
(
self
)
{
self
.
fill
(
'form[name=f]'
,
{
q
:
term
},
true
);
}).
then
(
function
(
self
)
{
var
score
=
self
.
fetchScore
();
scores
.
push
({
term
:
term
,
score
:
score
});
self
.
echo
(
term
+
': '
+
score
);
};
})(
self
,
i
));
i
++
;
});
});
casper
.
run
(
function
(
self
)
{
...
...
Please
register
or
sign in
to post a comment