Commit ca75a1e4 ca75a1e48bb7e846aa0f60b3b141448341e45a0d by Brikou CARRE

(re) added 'name' to functions

1 parent ab96d89c
......@@ -37,7 +37,7 @@ casper.start('http://www.bbc.co.uk/', function() {
});
});
var next = function() {
var next = function next() {
var image = "bbcshot" + currentLink + ".png";
images.push(image);
this.echo("Processing image " + currentLink);
......@@ -53,7 +53,7 @@ var next = function() {
}
};
var buildPage = function() {
var buildPage = function buildPage() {
this.echo('Build result page');
var fs = require('fs');
this.viewport(624, 400);
......
......@@ -7,7 +7,7 @@ var upTo = ~~casper.cli.get(0) || 10; // max 10 links
// Fetch all <a> elements from the page and return
// the ones which contains a href starting with 'http://'
var searchLinks = function() {
var searchLinks = function searchLinks() {
var filter = Array.prototype.filter;
var map = Array.prototype.map;
return map.call(filter.call(document.querySelectorAll("a"), function(a) {
......@@ -25,7 +25,7 @@ var links = [
];
// Just opens the page and prints the title
var start = function(link) {
var start = function start(link) {
this.start(link, function() {
this.echo("Page title: " + (this.getTitle()));
});
......@@ -33,7 +33,7 @@ var start = function(link) {
// Get the links, and add them to the links array
// (It could be done all in one step, but it is intentionally splitted)
var addLinks = function(link) {
var addLinks = function addLinks(link) {
this.then(function() {
var found = this.evaluate(searchLinks);
this.echo("" + found.length + " links found on " + link);
......@@ -50,7 +50,7 @@ casper.then(function() {
var currentLink = 0;
// As long as it has a next link, and is under the maximum limit, will keep running
var check = function() {
var check = function check() {
if (links[currentLink] && currentLink < upTo) {
this.echo("--- Link " + currentLink + " ---");
start.call(this, links[currentLink]);
......
var getLinks = function() {
var getLinks = function getLinks() {
var links;
links = document.querySelectorAll("h3.r a");
return Array.prototype.map.call(links, function(e) {
......
......@@ -17,7 +17,7 @@ if (casper.cli.args.length === 0) {
;
}
var processPage = function() {
var processPage = function processPage() {
var url;
this.echo("capturing page " + currentPage);
this.capture("google-results-p" + currentPage + ".png");
......
......@@ -2,7 +2,7 @@ var casper = require('casper').create({
verbose: true
});
var countLinks = function() {
var countLinks = function countLinks() {
return document.querySelectorAll('a').length;
};
......@@ -42,7 +42,7 @@ casper.then(function() {
var currentSuite = 0;
var check = function() {
var check = function check() {
if (suites[currentSuite]) {
suites[currentSuite].call(this);
currentSuite++;
......