reverted inline comments
Showing
8 changed files
with
20 additions
and
22 deletions
... | @@ -7,7 +7,7 @@ nbLinks = 0 | ... | @@ -7,7 +7,7 @@ nbLinks = 0 |
7 | currentLink = 1 | 7 | currentLink = 1 |
8 | images = [] | 8 | images = [] |
9 | 9 | ||
10 | ### helper to hide some element from remote DOM ### | 10 | # helper to hide some element from remote DOM |
11 | casper.hide = (selector) -> | 11 | casper.hide = (selector) -> |
12 | @evaluate (selector) -> | 12 | @evaluate (selector) -> |
13 | document.querySelector(selector).style.display = "none" | 13 | document.querySelector(selector).style.display = "none" |
... | @@ -17,7 +17,7 @@ casper.start "http://www.bbc.co.uk/", -> | ... | @@ -17,7 +17,7 @@ casper.start "http://www.bbc.co.uk/", -> |
17 | nbLinks = @evaluate -> | 17 | nbLinks = @evaluate -> |
18 | return __utils__.findAll('#promo2_carousel_items_items li').length | 18 | return __utils__.findAll('#promo2_carousel_items_items li').length |
19 | @echo "#{nbLinks} items founds" | 19 | @echo "#{nbLinks} items founds" |
20 | ### hide navigation arrows ### | 20 | # hide navigation arrows |
21 | @hide ".nav_left" | 21 | @hide ".nav_left" |
22 | @hide ".nav_right" | 22 | @hide ".nav_right" |
23 | @mouse.move "#promo2_carousel" | 23 | @mouse.move "#promo2_carousel" |
... | @@ -28,10 +28,10 @@ casper.start "http://www.bbc.co.uk/", -> | ... | @@ -28,10 +28,10 @@ casper.start "http://www.bbc.co.uk/", -> |
28 | @echo "Clicked on pause button" | 28 | @echo "Clicked on pause button" |
29 | @waitUntilVisible ".autoplay.nav_play", -> | 29 | @waitUntilVisible ".autoplay.nav_play", -> |
30 | @echo "Carousel has been paused" | 30 | @echo "Carousel has been paused" |
31 | ### hide play button ### | 31 | # hide play button |
32 | @hide ".autoplay" | 32 | @hide ".autoplay" |
33 | 33 | ||
34 | ### Capture carrousel area ### | 34 | # Capture carrousel area |
35 | next = -> | 35 | next = -> |
36 | image = "bbcshot#{currentLink}.png" | 36 | image = "bbcshot#{currentLink}.png" |
37 | images.push image | 37 | images.push image |
... | @@ -45,7 +45,7 @@ next = -> | ... | @@ -45,7 +45,7 @@ next = -> |
45 | else | 45 | else |
46 | @then buildPage | 46 | @then buildPage |
47 | 47 | ||
48 | ### Building resulting page and image ### | 48 | # Building resulting page and image |
49 | buildPage = -> | 49 | buildPage = -> |
50 | @echo "Build result page" | 50 | @echo "Build result page" |
51 | fs = require "fs" | 51 | fs = require "fs" | ... | ... |
... | @@ -9,7 +9,7 @@ nbLinks = 0; | ... | @@ -9,7 +9,7 @@ nbLinks = 0; |
9 | currentLink = 1; | 9 | currentLink = 1; |
10 | images = []; | 10 | images = []; |
11 | 11 | ||
12 | /* helper to hide some element from remote DOM */ | 12 | // helper to hide some element from remote DOM |
13 | casper.hide = function(selector) { | 13 | casper.hide = function(selector) { |
14 | this.evaluate(function(selector) { | 14 | this.evaluate(function(selector) { |
15 | document.querySelector(selector).style.display = "none"; | 15 | document.querySelector(selector).style.display = "none"; |
... | @@ -23,7 +23,7 @@ casper.start("http://www.bbc.co.uk/", function() { | ... | @@ -23,7 +23,7 @@ casper.start("http://www.bbc.co.uk/", function() { |
23 | return __utils__.findAll('#promo2_carousel_items_items li').length; | 23 | return __utils__.findAll('#promo2_carousel_items_items li').length; |
24 | }); | 24 | }); |
25 | this.echo(nbLinks + " items founds"); | 25 | this.echo(nbLinks + " items founds"); |
26 | /* hide navigation arrows */ | 26 | // hide navigation arrows |
27 | this.hide(".nav_left"); | 27 | this.hide(".nav_left"); |
28 | this.hide(".nav_right"); | 28 | this.hide(".nav_right"); |
29 | this.mouse.move("#promo2_carousel"); | 29 | this.mouse.move("#promo2_carousel"); |
... | @@ -34,13 +34,13 @@ casper.start("http://www.bbc.co.uk/", function() { | ... | @@ -34,13 +34,13 @@ casper.start("http://www.bbc.co.uk/", function() { |
34 | this.echo("Clicked on pause button"); | 34 | this.echo("Clicked on pause button"); |
35 | this.waitUntilVisible(".autoplay.nav_play", function() { | 35 | this.waitUntilVisible(".autoplay.nav_play", function() { |
36 | this.echo("Carousel has been paused"); | 36 | this.echo("Carousel has been paused"); |
37 | /* hide play button */ | 37 | // hide play button |
38 | this.hide(".autoplay"); | 38 | this.hide(".autoplay"); |
39 | }); | 39 | }); |
40 | }); | 40 | }); |
41 | }); | 41 | }); |
42 | 42 | ||
43 | /* Capture carrousel area */ | 43 | // Capture carrousel area |
44 | next = function() { | 44 | next = function() { |
45 | var image; | 45 | var image; |
46 | image = "bbcshot" + currentLink + ".png"; | 46 | image = "bbcshot" + currentLink + ".png"; |
... | @@ -58,7 +58,7 @@ next = function() { | ... | @@ -58,7 +58,7 @@ next = function() { |
58 | } | 58 | } |
59 | }; | 59 | }; |
60 | 60 | ||
61 | /* Building resulting page and image */ | 61 | // Building resulting page and image |
62 | buildPage = function() { | 62 | buildPage = function() { |
63 | var fs, pageHtml; | 63 | var fs, pageHtml; |
64 | this.echo("Build result page"); | 64 | this.echo("Build result page"); | ... | ... |
1 | casper = require("casper").create() | 1 | casper = require("casper").create() |
2 | dump = require("utils").dump | 2 | dump = require("utils").dump |
3 | 3 | ||
4 | ### removing default options passed by the Python executable ### | 4 | # removing default options passed by the Python executable |
5 | casper.cli.drop "cli" | 5 | casper.cli.drop "cli" |
6 | casper.cli.drop "casper-path" | 6 | casper.cli.drop "casper-path" |
7 | 7 | ... | ... |
... | @@ -3,7 +3,7 @@ var casper, dump; | ... | @@ -3,7 +3,7 @@ var casper, dump; |
3 | casper = require("casper").create(); | 3 | casper = require("casper").create(); |
4 | dump = require("utils").dump; | 4 | dump = require("utils").dump; |
5 | 5 | ||
6 | /* removing default options passed by the Python executable */ | 6 | // removing default options passed by the Python executable |
7 | casper.cli.drop("cli"); | 7 | casper.cli.drop("cli"); |
8 | casper.cli.drop("casper-path"); | 8 | casper.cli.drop("casper-path"); |
9 | 9 | ... | ... |
... | @@ -33,7 +33,7 @@ var casper = require("casper").create({ | ... | @@ -33,7 +33,7 @@ var casper = require("casper").create({ |
33 | logLevel: "verbose" | 33 | logLevel: "verbose" |
34 | }); | 34 | }); |
35 | 35 | ||
36 | /* add a new 'verbose' logging level at the lowest priority */ | 36 | // add a new 'verbose' logging level at the lowest priority |
37 | casper.logLevels = ["verbose"].concat(casper.logLevels); | 37 | casper.logLevels = ["verbose"].concat(casper.logLevels); |
38 | 38 | ||
39 | // test our new logger with google | 39 | // test our new logger with google | ... | ... |
1 | casper = require("casper").create | 1 | casper = require("casper").create |
2 | verbose: true | 2 | verbose: true |
3 | 3 | ||
4 | ### If we don't set a limit, it could go on forever ### | 4 | # If we don't set a limit, it could go on forever |
5 | upTo = ~~casper.cli.get(0) || 10 | 5 | upTo = ~~casper.cli.get(0) || 10 |
6 | 6 | ||
7 | ### | 7 | ### |
... | @@ -16,14 +16,14 @@ searchLinks = -> | ... | @@ -16,14 +16,14 @@ searchLinks = -> |
16 | ), (a) -> | 16 | ), (a) -> |
17 | a.getAttribute "href" | 17 | a.getAttribute "href" |
18 | 18 | ||
19 | ### The base links array ### | 19 | # The base links array |
20 | links = [ | 20 | links = [ |
21 | "http://google.com/" | 21 | "http://google.com/" |
22 | "http://yahoo.com/" | 22 | "http://yahoo.com/" |
23 | "http://bing.com/" | 23 | "http://bing.com/" |
24 | ] | 24 | ] |
25 | 25 | ||
26 | ### Just opens the page and prints the title ### | 26 | # Just opens the page and prints the title |
27 | start = (link) -> | 27 | start = (link) -> |
28 | @start link, -> | 28 | @start link, -> |
29 | @echo "Page title: #{ @getTitle() }" | 29 | @echo "Page title: #{ @getTitle() }" |
... | @@ -45,7 +45,7 @@ casper.then -> | ... | @@ -45,7 +45,7 @@ casper.then -> |
45 | 45 | ||
46 | currentLink = 0; | 46 | currentLink = 0; |
47 | 47 | ||
48 | ### As long as it has a next link, and is under the maximum limit, will keep running ### | 48 | # As long as it has a next link, and is under the maximum limit, will keep running |
49 | check = -> | 49 | check = -> |
50 | if links[currentLink] && currentLink < upTo | 50 | if links[currentLink] && currentLink < upTo |
51 | @echo "--- Link #{currentLink} ---" | 51 | @echo "--- Link #{currentLink} ---" | ... | ... |
... | @@ -4,7 +4,7 @@ casper = require("casper").create({ | ... | @@ -4,7 +4,7 @@ casper = require("casper").create({ |
4 | verbose: true | 4 | verbose: true |
5 | }); | 5 | }); |
6 | 6 | ||
7 | /* If we don't set a limit, it could go on forever */ | 7 | // If we don't set a limit, it could go on forever |
8 | upTo = ~~casper.cli.get(0) || 10; | 8 | upTo = ~~casper.cli.get(0) || 10; |
9 | 9 | ||
10 | /* | 10 | /* |
... | @@ -22,7 +22,7 @@ searchLinks = function() { | ... | @@ -22,7 +22,7 @@ searchLinks = function() { |
22 | }); | 22 | }); |
23 | }; | 23 | }; |
24 | 24 | ||
25 | /* The base links array */ | 25 | // The base links array |
26 | links = [ | 26 | links = [ |
27 | "http://google.com/", | 27 | "http://google.com/", |
28 | "http://yahoo.com/", | 28 | "http://yahoo.com/", | ... | ... |
-
Please register or sign in to post a comment