Commit 125db333 125db3336269714a4278ddeeb53f097f37ad5c73 by Brikou CARRE

converted most single quote to double quote

1 parent 000df9f4
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 Create a mosaic image from all headline photos on BBC homepage 2 Create a mosaic image from all headline photos on BBC homepage
3 ### 3 ###
4 4
5 casper = require('casper').create() 5 casper = require("casper").create()
6 nbLinks = 0 6 nbLinks = 0
7 currentLink = 1 7 currentLink = 1
8 images = [] 8 images = []
...@@ -13,7 +13,7 @@ casper.hide = (selector) -> ...@@ -13,7 +13,7 @@ casper.hide = (selector) ->
13 document.querySelector(selector).style.display = "none" 13 document.querySelector(selector).style.display = "none"
14 , selector: selector 14 , selector: selector
15 15
16 casper.start 'http://www.bbc.co.uk/', -> 16 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"
...@@ -22,12 +22,12 @@ casper.start 'http://www.bbc.co.uk/', -> ...@@ -22,12 +22,12 @@ casper.start 'http://www.bbc.co.uk/', ->
22 @hide '.nav_right' 22 @hide '.nav_right'
23 @mouse.move '#promo2_carousel' 23 @mouse.move '#promo2_carousel'
24 @waitUntilVisible '.autoplay.nav_pause', -> 24 @waitUntilVisible '.autoplay.nav_pause', ->
25 @echo 'Moving over pause button' 25 @echo "Moving over pause button"
26 @mouse.move '.autoplay.nav_pause' 26 @mouse.move '.autoplay.nav_pause'
27 @click '.autoplay.nav_pause' 27 @click ".autoplay.nav_pause"
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
...@@ -47,8 +47,8 @@ next = -> ...@@ -47,8 +47,8 @@ next = ->
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"
52 @viewport 624, 400 52 @viewport 624, 400
53 pageHtml = "<html><body style='background:black;margin:0;padding:0'>" 53 pageHtml = "<html><body style='background:black;margin:0;padding:0'>"
54 for image in images 54 for image in images
...@@ -56,7 +56,7 @@ buildPage = -> ...@@ -56,7 +56,7 @@ buildPage = ->
56 pageHtml += "</body></html>" 56 pageHtml += "</body></html>"
57 fs.write 'result.html', pageHtml, 'w' 57 fs.write 'result.html', pageHtml, 'w'
58 @thenOpen "file://#{fs.workingDirectory}/result.html", -> 58 @thenOpen "file://#{fs.workingDirectory}/result.html", ->
59 @echo 'Resulting image saved to result.png' 59 @echo "Resulting image saved to result.png"
60 @capture 'result.png' 60 @capture 'result.png'
61 61
62 casper.then next 62 casper.then next
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 Create a mosaic image from all headline photos on BBC homepage 2 Create a mosaic image from all headline photos on BBC homepage
3 */ 3 */
4 4
5 var casper = require('casper').create(); 5 var casper = require("casper").create();
6 var nbLinks = 0; 6 var nbLinks = 0;
7 var currentLink = 1; 7 var currentLink = 1;
8 var images = []; 8 var images = [];
...@@ -15,7 +15,7 @@ casper.hide = function(selector) { ...@@ -15,7 +15,7 @@ casper.hide = function(selector) {
15 }); 15 });
16 }; 16 };
17 17
18 casper.start('http://www.bbc.co.uk/', function() { 18 casper.start("http://www.bbc.co.uk/", function() {
19 nbLinks = this.evaluate(function() { 19 nbLinks = this.evaluate(function() {
20 return __utils__.findAll('#promo2_carousel_items_items li').length; 20 return __utils__.findAll('#promo2_carousel_items_items li').length;
21 }); 21 });
...@@ -25,12 +25,12 @@ casper.start('http://www.bbc.co.uk/', function() { ...@@ -25,12 +25,12 @@ casper.start('http://www.bbc.co.uk/', function() {
25 this.hide('.nav_right'); 25 this.hide('.nav_right');
26 this.mouse.move('#promo2_carousel'); 26 this.mouse.move('#promo2_carousel');
27 this.waitUntilVisible('.autoplay.nav_pause', function() { 27 this.waitUntilVisible('.autoplay.nav_pause', function() {
28 this.echo('Moving over pause button'); 28 this.echo("Moving over pause button");
29 this.mouse.move('.autoplay.nav_pause'); 29 this.mouse.move('.autoplay.nav_pause');
30 this.click('.autoplay.nav_pause'); 30 this.click(".autoplay.nav_pause");
31 this.echo('Clicked on pause button'); 31 this.echo("Clicked on pause button");
32 this.waitUntilVisible('.autoplay.nav_play', function() { 32 this.waitUntilVisible('.autoplay.nav_play', function() {
33 this.echo('Carousel has been paused'); 33 this.echo("Carousel has been paused");
34 // hide play button 34 // hide play button
35 this.hide('.autoplay'); 35 this.hide('.autoplay');
36 }); 36 });
...@@ -54,8 +54,8 @@ var next = function next() { ...@@ -54,8 +54,8 @@ var next = function next() {
54 }; 54 };
55 55
56 var buildPage = function buildPage() { 56 var buildPage = function buildPage() {
57 this.echo('Build result page'); 57 this.echo("Build result page");
58 var fs = require('fs'); 58 var fs = require("fs");
59 this.viewport(624, 400); 59 this.viewport(624, 400);
60 var pageHtml = "<html><body style='background:black;margin:0;padding:0'>"; 60 var pageHtml = "<html><body style='background:black;margin:0;padding:0'>";
61 images.forEach(function(image) { 61 images.forEach(function(image) {
...@@ -64,7 +64,7 @@ var buildPage = function buildPage() { ...@@ -64,7 +64,7 @@ var buildPage = function buildPage() {
64 pageHtml += "</body></html>"; 64 pageHtml += "</body></html>";
65 fs.write('result.html', pageHtml, 'w'); 65 fs.write('result.html', pageHtml, 'w');
66 this.thenOpen("file://" + fs.workingDirectory + "/result.html", function() { 66 this.thenOpen("file://" + fs.workingDirectory + "/result.html", function() {
67 this.echo('Resulting image saved to result.png'); 67 this.echo("Resulting image saved to result.png");
68 this.capture('result.png'); 68 this.capture('result.png');
69 }); 69 });
70 }; 70 };
......
1 casper = require('casper').create() 1 casper = require("casper").create()
2 2
3 # listening to a custom event 3 # listening to a custom event
4 casper.on 'google.loaded', (title) -> 4 casper.on 'google.loaded', (title) ->
5 casper.echo "Google page title is #{title}" 5 casper.echo "Google page title is #{title}"
6 6
7 casper.start 'http://google.com/', -> 7 casper.start "http://google.com/", ->
8 # emitting a custom event 8 # emitting a custom event
9 @emit 'google.loaded', @getTitle() 9 @emit 'google.loaded', @getTitle()
10 10
......
1 var casper = require('casper').create(); 1 var casper = require("casper").create();
2 2
3 // listening to a custom event 3 // listening to a custom event
4 casper.on('google.loaded', function(title) { 4 casper.on('google.loaded', function(title) {
5 casper.echo("Google page title is " + title); 5 casper.echo("Google page title is " + title);
6 }); 6 });
7 7
8 casper.start('http://google.com/', function() { 8 casper.start("http://google.com/", function() {
9 // emitting a custom event 9 // emitting a custom event
10 this.emit('google.loaded', this.getTitle()); 10 this.emit('google.loaded', this.getTitle());
11 }); 11 });
......
...@@ -3,7 +3,7 @@ A basic custom logging implementation. The idea is to (extremely) verbosely ...@@ -3,7 +3,7 @@ A basic custom logging implementation. The idea is to (extremely) verbosely
3 log every received resource. 3 log every received resource.
4 ### 4 ###
5 5
6 casper = require('casper').create 6 casper = require("casper").create
7 # Every time a resource is received, a new log entry is added to the stack 7 # Every time a resource is received, a new log entry is added to the stack
8 # at the 'verbose' level. 8 # at the 'verbose' level.
9 onResourceReceived: (self, resource) -> 9 onResourceReceived: (self, resource) ->
...@@ -20,5 +20,5 @@ casper = require('casper').create ...@@ -20,5 +20,5 @@ casper = require('casper').create
20 casper.logLevels = ['verbose'].concat casper.logLevels 20 casper.logLevels = ['verbose'].concat casper.logLevels
21 21
22 # test our new logger with google 22 # test our new logger with google
23 casper.start 'http://www.google.com/' 23 casper.start "http://www.google.com/"
24 casper.run() 24 casper.run()
......
...@@ -3,7 +3,7 @@ A basic custom logging implementation. The idea is to (extremely) verbosely ...@@ -3,7 +3,7 @@ A basic custom logging implementation. The idea is to (extremely) verbosely
3 log every received resource. 3 log every received resource.
4 */ 4 */
5 5
6 var casper = require('casper').create({ 6 var casper = require("casper").create({
7 /** 7 /**
8 * Every time a resource is received, a new log entry is added to the stack 8 * Every time a resource is received, a new log entry is added to the stack
9 * at the 'verbose' level. 9 * at the 'verbose' level.
...@@ -31,6 +31,6 @@ var casper = require('casper').create({ ...@@ -31,6 +31,6 @@ var casper = require('casper').create({
31 casper.logLevels = ['verbose'].concat(casper.logLevels); 31 casper.logLevels = ['verbose'].concat(casper.logLevels);
32 32
33 // test our new logger with google 33 // test our new logger with google
34 casper.start('http://www.google.com/').run(function(self) { 34 casper.start("http://www.google.com/").run(function(self) {
35 self.exit(); 35 self.exit();
36 }); 36 });
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
2 Download the google logo image as base64 2 Download the google logo image as base64
3 ### 3 ###
4 4
5 casper = require('casper').create verbose: true 5 casper = require("casper").create verbose: true
6 6
7 casper.start 'http://www.google.fr/', -> 7 casper.start "http://www.google.fr/", ->
8 @echo @base64encode 'http://www.google.fr/images/srpr/logo3w.png' 8 @echo @base64encode "http://www.google.fr/images/srpr/logo3w.png"
9 9
10 casper.run() 10 casper.run()
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
2 Download the google logo image as base64 2 Download the google logo image as base64
3 */ 3 */
4 4
5 var casper = require('casper').create({ 5 var casper = require("casper").create({
6 verbose: true 6 verbose: true
7 }); 7 });
8 8
9 casper.start('http://www.google.fr/', function() { 9 casper.start("http://www.google.fr/", function() {
10 this.echo(this.base64encode('http://www.google.fr/images/srpr/logo3w.png')); 10 this.echo(this.base64encode("http://www.google.fr/images/srpr/logo3w.png"));
11 }); 11 });
12 12
13 casper.run(); 13 casper.run();
......
1 casper = require('casper').create verbose: true 1 casper = require("casper").create verbose: true
2 2
3 # If we don't set a limit, it could go on forever 3 # If we don't set a limit, it could go on forever
4 upTo = ~~casper.cli.get(0) || 10 # max 10 links 4 upTo = ~~casper.cli.get(0) || 10 # max 10 links
...@@ -35,7 +35,7 @@ addLinks = (link) -> ...@@ -35,7 +35,7 @@ addLinks = (link) ->
35 35
36 casper.start() 36 casper.start()
37 37
38 casper.then -> @echo 'Starting' 38 casper.then -> @echo "Starting"
39 39
40 currentLink = 0; 40 currentLink = 0;
41 41
...@@ -48,7 +48,7 @@ check = -> ...@@ -48,7 +48,7 @@ check = ->
48 currentLink++ 48 currentLink++
49 @run check 49 @run check
50 else 50 else
51 @echo 'All done.' 51 @echo "All done."
52 @exit() 52 @exit()
53 53
54 casper.run check 54 casper.run check
......
1 var casper = require('casper').create({ 1 var casper = require("casper").create({
2 verbose: true 2 verbose: true
3 }); 3 });
4 4
...@@ -44,7 +44,7 @@ var addLinks = function addLinks(link) { ...@@ -44,7 +44,7 @@ var addLinks = function addLinks(link) {
44 casper.start(); 44 casper.start();
45 45
46 casper.then(function() { 46 casper.then(function() {
47 this.echo('Starting'); 47 this.echo("Starting");
48 }); 48 });
49 49
50 var currentLink = 0; 50 var currentLink = 0;
...@@ -58,7 +58,7 @@ var check = function check() { ...@@ -58,7 +58,7 @@ var check = function check() {
58 currentLink++; 58 currentLink++;
59 this.run(check); 59 this.run(check);
60 } else { 60 } else {
61 this.echo('All done.'); 61 this.echo("All done.");
62 this.exit(); 62 this.exit();
63 } 63 }
64 }; 64 };
......
1 casper = require('casper').create() 1 casper = require("casper").create()
2 2
3 links = [ 3 links = [
4 'http://google.com/' 4 'http://google.com/'
......
1 var casper = require('casper').create(); 1 var casper = require("casper").create();
2 2
3 var links = [ 3 var links = [
4 'http://google.com/', 4 'http://google.com/',
......
1 casper = require('casper').create() 1 casper = require("casper").create()
2 2
3 casper.on "http.status.200", (resource) -> 3 casper.on "http.status.200", (resource) ->
4 @echo "#{resource.url} is OK", "INFO" 4 @echo "#{resource.url} is OK", "INFO"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * This script will add a custom HTTP status code handler, here for 404 pages. 2 * This script will add a custom HTTP status code handler, here for 404 pages.
3 * 3 *
4 */ 4 */
5 var casper = require('casper').create(); 5 var casper = require("casper").create();
6 6
7 casper.on('http.status.200', function(resource) { 7 casper.on('http.status.200', function(resource) {
8 this.echo(resource.url + ' is OK', 'INFO'); 8 this.echo(resource.url + ' is OK', 'INFO');
......
...@@ -4,7 +4,7 @@ links = ...@@ -4,7 +4,7 @@ links =
4 'http://www.bbc.co.uk/': 0 4 'http://www.bbc.co.uk/': 0
5 'http://www.guardian.co.uk/': 0 5 'http://www.guardian.co.uk/': 0
6 6
7 class Fantomas extends require('casper').Casper 7 class Fantomas extends require("casper").Casper
8 countLinks: -> 8 countLinks: ->
9 @evaluate -> 9 @evaluate ->
10 __utils__.findAll('a').length 10 __utils__.findAll('a').length
......
1 var casper = require('casper').create({ 1 var casper = require("casper").create({
2 loadImages: false, 2 loadImages: false,
3 logLevel: "debug", 3 logLevel: "debug",
4 verbose: true 4 verbose: true
......
...@@ -3,7 +3,7 @@ getLinks = -> ...@@ -3,7 +3,7 @@ getLinks = ->
3 Array::map.call links, (e) -> e.getAttribute "href" 3 Array::map.call links, (e) -> e.getAttribute "href"
4 4
5 links = [] 5 links = []
6 casper = require('casper').create() 6 casper = require("casper").create()
7 7
8 casper.start "http://google.fr/", -> 8 casper.start "http://google.fr/", ->
9 # search for 'casperjs' from google form 9 # search for 'casperjs' from google form
......
...@@ -7,7 +7,7 @@ var getLinks = function getLinks() { ...@@ -7,7 +7,7 @@ var getLinks = function getLinks() {
7 }; 7 };
8 8
9 var links = []; 9 var links = [];
10 var casper = require('casper').create(); 10 var casper = require("casper").create();
11 11
12 casper.start("http://google.fr/", function() { 12 casper.start("http://google.fr/", function() {
13 // search for 'casperjs' from google form 13 // search for 'casperjs' from google form
......
...@@ -10,7 +10,7 @@ Usage: ...@@ -10,7 +10,7 @@ Usage:
10 winner is "nicolas" with 69600000 results 10 winner is "nicolas" with 69600000 results
11 ### 11 ###
12 12
13 casper = require('casper').create verbose: true 13 casper = require("casper").create verbose: true
14 14
15 casper.fetchScore = -> 15 casper.fetchScore = ->
16 @evaluate -> 16 @evaluate ->
......
...@@ -10,7 +10,7 @@ Usage: ...@@ -10,7 +10,7 @@ Usage:
10 winner is "nicolas" with 69600000 results 10 winner is "nicolas" with 69600000 results
11 */ 11 */
12 12
13 var casper = require('casper').create({ 13 var casper = require("casper").create({
14 verbose: true 14 verbose: true
15 }); 15 });
16 16
......
...@@ -6,7 +6,7 @@ Usage: $ casperjs googlepagination.coffee my search terms ...@@ -6,7 +6,7 @@ Usage: $ casperjs googlepagination.coffee my search terms
6 (all arguments will be used as the query) 6 (all arguments will be used as the query)
7 ### 7 ###
8 8
9 casper = require('casper').create() 9 casper = require("casper").create()
10 currentPage = 1 10 currentPage = 1
11 11
12 if casper.cli.args.length is 0 12 if casper.cli.args.length is 0
...@@ -32,7 +32,7 @@ processPage = -> ...@@ -32,7 +32,7 @@ processPage = ->
32 else 32 else
33 @echo "that's all, folks." 33 @echo "that's all, folks."
34 34
35 casper.start 'http://google.fr/', -> 35 casper.start "http://google.fr/", ->
36 @fill 'form[action="/search"]', q: casper.cli.args.join(' '), true 36 @fill 'form[action="/search"]', q: casper.cli.args.join(' '), true
37 37
38 casper.then processPage 38 casper.then processPage
......
...@@ -6,7 +6,7 @@ Usage: $ casperjs googlepagination.coffee my search terms ...@@ -6,7 +6,7 @@ Usage: $ casperjs googlepagination.coffee my search terms
6 (all arguments will be used as the query) 6 (all arguments will be used as the query)
7 */ 7 */
8 8
9 var casper = require('casper').create(); 9 var casper = require("casper").create();
10 10
11 var currentPage = 1; 11 var currentPage = 1;
12 12
...@@ -38,7 +38,7 @@ var processPage = function processPage() { ...@@ -38,7 +38,7 @@ var processPage = function processPage() {
38 } 38 }
39 }; 39 };
40 40
41 casper.start('http://google.fr/', function() { 41 casper.start("http://google.fr/", function() {
42 return this.fill('form[action="/search"]', { 42 return this.fill('form[action="/search"]', {
43 q: casper.cli.args.join(' ') 43 q: casper.cli.args.join(' ')
44 }, true); 44 }, true);
......
1 casper = require('casper').create logLevel: "debug" 1 casper = require("casper").create logLevel: "debug"
2 2
3 casper.start 'http://www.google.fr/', -> 3 casper.start "http://www.google.fr/", ->
4 @test.assertTitle 'Google', 'google homepage title is the one expected' 4 @test.assertTitle 'Google', 'google homepage title is the one expected'
5 @test.assertExists 'form[action="/search"]', 'main form is found' 5 @test.assertExists 'form[action="/search"]', 'main form is found'
6 @fill 'form[action="/search"]', q: 'foo', true 6 @fill 'form[action="/search"]', q: 'foo', true
......
1 var casper = require('casper').create({ 1 var casper = require("casper").create({
2 logLevel: "debug" 2 logLevel: "debug"
3 }); 3 });
4 4
5 casper.start('http://www.google.fr/', function(self) { 5 casper.start("http://www.google.fr/", function(self) {
6 self.test.assertTitle('Google', 'google homepage title is the one expected'); 6 self.test.assertTitle('Google', 'google homepage title is the one expected');
7 self.test.assertExists('form[action="/search"]', 'main form is found'); 7 self.test.assertExists('form[action="/search"]', 'main form is found');
8 self.fill('form[action="/search"]', { 8 self.fill('form[action="/search"]', {
......
1 casper = require('casper').create 1 casper = require("casper").create
2 verbose: true 2 verbose: true
3 logLevel: 'debug' 3 logLevel: 'debug'
4 4
5 casper.log 'this is a debug message', 'debug' 5 casper.log "this is a debug message", 'debug'
6 casper.log 'and an informative one', 'info' 6 casper.log "and an informative one", 'info'
7 casper.log 'and a warning', 'warning' 7 casper.log "and a warning", 'warning'
8 casper.log 'and an error', 'error' 8 casper.log "and an error", 'error'
9 9
10 casper.exit() 10 casper.exit()
......
1 var casper = require('casper').create({ 1 var casper = require("casper").create({
2 verbose: true, 2 verbose: true,
3 logLevel: 'debug' 3 logLevel: 'debug'
4 }); 4 });
5 5
6 casper.log('this is a debug message', 'debug'); 6 casper.log("this is a debug message", 'debug');
7 casper.log('and an informative one', 'info'); 7 casper.log("and an informative one", 'info');
8 casper.log('and a warning', 'warning'); 8 casper.log("and a warning", 'warning');
9 casper.log('and an error', 'error'); 9 casper.log("and an error", 'error');
10 10
11 casper.exit(); 11 casper.exit();
......
...@@ -4,7 +4,7 @@ var casper = require("casper").create() ...@@ -4,7 +4,7 @@ var casper = require("casper").create()
4 4
5 if (!url) { 5 if (!url) {
6 casper 6 casper
7 .echo('Usage: casperjs [url]') 7 .echo("Usage: casperjs [url]")
8 .exit(1) 8 .exit(1)
9 ; 9 ;
10 } 10 }
......
1 casper = require('casper').create verbose: true 1 casper = require("casper").create verbose: true
2 2
3 countLinks = -> 3 countLinks = ->
4 document.querySelectorAll('a').length 4 document.querySelectorAll('a').length
5 5
6 suites = [ 6 suites = [
7 -> 7 ->
8 @echo 'Suite 1' 8 @echo "Suite 1"
9 @start 'http://google.com/', -> @echo "Page title: #{@getTitle()}" 9 @start "http://google.com/", -> @echo "Page title: #{@getTitle()}"
10 @then -> @echo "#{@evaluate(countLinks)} links" 10 @then -> @echo "#{@evaluate(countLinks)} links"
11 -> 11 ->
12 @echo 'Suite 2' 12 @echo "Suite 2"
13 @start 'http://yahoo.com/', -> @echo "Page title: #{@getTitle()}" 13 @start "http://yahoo.com/", -> @echo "Page title: #{@getTitle()}"
14 @then -> @echo "#{@evaluate(countLinks)} links" 14 @then -> @echo "#{@evaluate(countLinks)} links"
15 -> 15 ->
16 @echo 'Suite 3' 16 @echo "Suite 3"
17 @start 'http://bing.com/', -> @echo "Page title: #{@getTitle()}" 17 @start "http://bing.com/", -> @echo "Page title: #{@getTitle()}"
18 @then -> @echo "#{@evaluate(countLinks)} links" 18 @then -> @echo "#{@evaluate(countLinks)} links"
19 ] 19 ]
20 20
21 casper.start() 21 casper.start()
22 22
23 casper.then -> 23 casper.then ->
24 @echo('Starting') 24 @echo("Starting")
25 25
26 currentSuite = 0; 26 currentSuite = 0;
27 27
......
1 var casper = require('casper').create({ 1 var casper = require("casper").create({
2 verbose: true 2 verbose: true
3 }); 3 });
4 4
...@@ -8,24 +8,24 @@ var countLinks = function countLinks() { ...@@ -8,24 +8,24 @@ var countLinks = function countLinks() {
8 8
9 var suites = [ 9 var suites = [
10 function() { 10 function() {
11 this.echo('Suite 1'); 11 this.echo("Suite 1");
12 this.start('http://google.com/', function() { 12 this.start("http://google.com/", function() {
13 this.echo("Page title: " + (this.getTitle())); 13 this.echo("Page title: " + (this.getTitle()));
14 }); 14 });
15 this.then(function() { 15 this.then(function() {
16 this.echo((this.evaluate(countLinks)) + " links"); 16 this.echo((this.evaluate(countLinks)) + " links");
17 }); 17 });
18 }, function() { 18 }, function() {
19 this.echo('Suite 2'); 19 this.echo("Suite 2");
20 this.start('http://yahoo.com/', function() { 20 this.start("http://yahoo.com/", function() {
21 this.echo("Page title: " + (this.getTitle())); 21 this.echo("Page title: " + (this.getTitle()));
22 }); 22 });
23 this.then(function() { 23 this.then(function() {
24 this.echo((this.evaluate(countLinks)) + " links"); 24 this.echo((this.evaluate(countLinks)) + " links");
25 }); 25 });
26 }, function() { 26 }, function() {
27 this.echo('Suite 3'); 27 this.echo("Suite 3");
28 this.start('http://bing.com/', function() { 28 this.start("http://bing.com/", function() {
29 this.echo("Page title: " + (this.getTitle())); 29 this.echo("Page title: " + (this.getTitle()));
30 }); 30 });
31 this.then(function() { 31 this.then(function() {
...@@ -37,7 +37,7 @@ var suites = [ ...@@ -37,7 +37,7 @@ var suites = [
37 casper.start(); 37 casper.start();
38 38
39 casper.then(function() { 39 casper.then(function() {
40 this.echo('Starting'); 40 this.echo("Starting");
41 }); 41 });
42 42
43 var currentSuite = 0; 43 var currentSuite = 0;
......
...@@ -3,7 +3,7 @@ This script will capture a screenshot of a twitter account page ...@@ -3,7 +3,7 @@ This script will capture a screenshot of a twitter account page
3 Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]> 3 Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>
4 ### 4 ###
5 5
6 casper = require('casper').create 6 casper = require("casper").create
7 viewportSize: 7 viewportSize:
8 width: 1024 8 width: 1024
9 height: 768 9 height: 768
......
...@@ -3,7 +3,7 @@ This script will capture a screenshot of a twitter account page ...@@ -3,7 +3,7 @@ This script will capture a screenshot of a twitter account page
3 Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]> 3 Usage: $ casperjs screenshot.coffee <twitter-account> <filename.[jpg|png|pdf]>
4 */ 4 */
5 5
6 var casper = require('casper').create({ 6 var casper = require("casper").create({
7 viewportSize: { 7 viewportSize: {
8 width: 1024, 8 width: 1024,
9 height: 768 9 height: 768
...@@ -20,7 +20,7 @@ if (!twitterAccount || !filename || !/\.(png|jpg|pdf)$/i.test(filename)) { ...@@ -20,7 +20,7 @@ if (!twitterAccount || !filename || !/\.(png|jpg|pdf)$/i.test(filename)) {
20 ; 20 ;
21 } 21 }
22 22
23 casper.start('https://twitter.com/#!/' + twitterAccount, function() { 23 casper.start("https://twitter.com/#!/" + twitterAccount, function() {
24 this.waitForSelector('.tweet-row', function() { 24 this.waitForSelector('.tweet-row', function() {
25 this.captureSelector(filename, 'html'); 25 this.captureSelector(filename, 'html');
26 this.echo("Saved screenshot of " + this.getCurrentUrl() + " to " + filename); 26 this.echo("Saved screenshot of " + this.getCurrentUrl() + " to " + filename);
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
2 This script will add a custom HTTP status code handler, here for 404 pages. 2 This script will add a custom HTTP status code handler, here for 404 pages.
3 ### 3 ###
4 4
5 casper = require('casper').create 5 casper = require("casper").create
6 httpStatusHandlers: 6 httpStatusHandlers:
7 404: (self, resource) -> 7 404: (self, resource) ->
8 @echo "Resource at #{resource.url} not found (404)", "COMMENT" 8 @echo "Resource at #{resource.url} not found (404)", "COMMENT"
9 verbose: true 9 verbose: true
10 10
11 casper.start 'http://www.google.com/plop', -> 11 casper.start "http://www.google.com/plop", ->
12 @echo "Done." 12 @echo "Done."
13 @exit() 13 @exit()
14 14
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 This script will add a custom HTTP status code handler, here for 404 pages. 2 This script will add a custom HTTP status code handler, here for 404 pages.
3 */ 3 */
4 4
5 var casper = require('casper').create({ 5 var casper = require("casper").create({
6 httpStatusHandlers: { 6 httpStatusHandlers: {
7 404: function(self, resource) { 7 404: function(self, resource) {
8 this.echo("Resource at " + resource.url + " not found (404)", "COMMENT"); 8 this.echo("Resource at " + resource.url + " not found (404)", "COMMENT");
...@@ -11,7 +11,7 @@ var casper = require('casper').create({ ...@@ -11,7 +11,7 @@ var casper = require('casper').create({
11 verbose: true 11 verbose: true
12 }); 12 });
13 13
14 casper.start('http://www.google.com/plop', function() { 14 casper.start("http://www.google.com/plop", function() {
15 this.echo("Done."); 15 this.echo("Done.");
16 this.exit(); 16 this.exit();
17 }); 17 });
......
1 failed = []; 1 failed = [];
2 2
3 casper = require('casper').create 3 casper = require("casper").create
4 onStepTimeout: -> failed.push @requestUrl 4 onStepTimeout: -> failed.push @requestUrl
5 5
6 links = [ 6 links = [
......
1 var failed = []; 1 var failed = [];
2 2
3 var casper = require('casper').create({ 3 var casper = require("casper").create({
4 onStepTimeout: function() { 4 onStepTimeout: function() {
5 failed.push(this.requestUrl); 5 failed.push(this.requestUrl);
6 } 6 }
......
...@@ -15,9 +15,9 @@ Will google.com load in less than 2000ms? ...@@ -15,9 +15,9 @@ Will google.com load in less than 2000ms?
15 YES! 15 YES!
16 ### 16 ###
17 17
18 casper = require('casper').create 18 casper = require("casper").create
19 onTimeout: -> 19 onTimeout: ->
20 @echo 'NOPE.', 'RED_BAR' 20 @echo "NOPE.", 'RED_BAR'
21 @exit() 21 @exit()
22 22
23 timeout = ~~casper.cli.get 0 23 timeout = ~~casper.cli.get 0
...@@ -29,8 +29,8 @@ if timeout < 1 ...@@ -29,8 +29,8 @@ if timeout < 1
29 casper.echo "Will google.com load in less than #{timeout}ms?" 29 casper.echo "Will google.com load in less than #{timeout}ms?"
30 casper.options.timeout = timeout 30 casper.options.timeout = timeout
31 31
32 casper.start 'http://www.google.com/', -> 32 casper.start "http://www.google.com/", ->
33 @echo 'YES!', 'GREEN_BAR' 33 @echo "YES!", 'GREEN_BAR'
34 @exit() 34 @exit()
35 35
36 casper.run() 36 casper.run()
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -15,10 +15,10 @@ Will google.com load in less than 2000ms? ...@@ -15,10 +15,10 @@ Will google.com load in less than 2000ms?
15 YES! 15 YES!
16 */ 16 */
17 17
18 var casper = require('casper').create({ 18 var casper = require("casper").create({
19 onTimeout: function() { 19 onTimeout: function() {
20 this 20 this
21 .echo('NOPE.', 'RED_BAR') 21 .echo("NOPE.", 'RED_BAR')
22 .exit() 22 .exit()
23 ; 23 ;
24 } 24 }
...@@ -35,9 +35,9 @@ if (timeout < 1) { ...@@ -35,9 +35,9 @@ if (timeout < 1) {
35 casper.echo("Will google.com load in less than " + timeout + "ms?"); 35 casper.echo("Will google.com load in less than " + timeout + "ms?");
36 casper.options.timeout = timeout; 36 casper.options.timeout = timeout;
37 37
38 casper.start('http://www.google.com/', function() { 38 casper.start("http://www.google.com/", function() {
39 this 39 this
40 .echo('YES!', 'GREEN_BAR') 40 .echo("YES!", 'GREEN_BAR')
41 .exit() 41 .exit()
42 ; 42 ;
43 }); 43 });
......