11fs = require (' fs' )
22system = require (' system' )
3- colors = require (' colors ' )
3+ consolex = require (' ./app/console-xtra ' )
44imports = require (' ./app/imports' )
55spinner = require (' ./app/spinner' )
66page = require (' webpage' ).create ()
@@ -13,20 +13,20 @@ casper = require('casper').create(
1313 waitTimeout : 60000 # 1 min default wait timeout
1414 verbose : true
1515 onError : (self , msg ) ->
16- console .log ( ' FATAL:' + msg). red
16+ consolex .log ' red ' , ' FATAL:' + msg
1717 self .exit ()
1818 return
1919 onTimeout : (self , msg ) ->
2020 @ .capture (' ./capture/timeout.png' )
21- console .log ( ' general timeout error: ' + msg). red
21+ consolex .log ' red ' , ' general timeout error: ' + msg
2222 return
2323 onStepTimeout : (self , msg ) ->
2424 @ .capture (' ./capture/timeout.png' )
25- console .log ( ' step timeout error: step ' + msg). red
25+ consolex .log ' red ' , ' step timeout error: step ' + msg
2626 return
2727 onWaitTimeout : (self , msg ) ->
28- @ .capture (' ./capture/timeout.png' )
29- console .log ( ' wait timeout error: ' + msg). red
28+ @ .capture (' ./capture/timeout.png' )
29+ consolex .log ' red ' , ' wait timeout error: ' + msg
3030 return
3131)
3232
@@ -39,11 +39,11 @@ fileBacklinks = './backlinks/' + casper.cli.get(2) + '.txt'
3939numPosts = casper .cli .get (3 )
4040
4141console .log ' \n '
42- console .log ' ---------------- Submission Details ---------------------- ' . cyan
43- console .log ( ' Accounts file: ' + fileAccounts). cyan
44- console .log ( ' Articles file: ' + fileArticles). cyan
45- console .log ( ' Backlinks saved to file: ' + fileBacklinks). cyan
46- console .log ( ' Number of Submissions: ' + numPosts). cyan
42+ consolex .log ' cyan ' , ' ---------------- Submission Details --------------------'
43+ consolex .log ' cyan ' , ' Accounts file: ' + fileAccounts
44+ consolex .log ' cyan ' , ' Articles file: ' + fileArticles
45+ consolex .log ' cyan ' , ' Backlinks saved to file: ' + fileBacklinks
46+ consolex .log ' cyan ' , ' Number of Submissions: ' + numPosts
4747
4848currentService = 0
4949currentStep = 0
@@ -123,7 +123,7 @@ casper.doStep = (objStep, serviceName) ->
123123 submitArticle = spinner .getArticle (articles, objStep .micro ,objStep .noHTML )
124124 randomAccount = spinner .getAccount (accounts, serviceName)
125125 str = ' -------------- Submit to ' + serviceName+ ' ----------------'
126- console .log (str). yellow
126+ consolex .log ' yellow' , str
127127# -------------------------- Open ---------------------------------------
128128 else if objStep .command == ' open'
129129 @ echo ' Opening url ' + objStep .url + ' ...'
@@ -255,17 +255,17 @@ casper.doStep = (objStep, serviceName) ->
255255 if objStep .confirm
256256 @ waitForSelector objStep .confirm ,
257257 ->
258- @ echo ' Confirmed .'
258+ @ echo ' Found confirm selector .'
259259 ->
260260 @ echo ' Confirm DOM selector not found' , ' ERROR'
261261 errorMsg ()
262262 @ capture (' ./capture/error.png' )
263263 if objStep .confirmtxt
264264 @ waitForText objStep .confirmtxt ,
265265 ->
266- @ echo ' Confirmed : ' + objStep .confirmtxt
266+ @ echo ' Found confirm text : ' + objStep .confirmtxt
267267 ->
268- @ echo ' Confirm text not found' , ' ERROR'
268+ @ echo ' Confirm text' + objStep . confirmtxt + ' not found' , ' ERROR'
269269 errorMsg ()
270270 @ capture (' ./capture/error.png' )
271271 else
@@ -334,7 +334,7 @@ casper.doStep = (objStep, serviceName) ->
334334 if @ exists (tempObj)
335335 submitURL = @ getElementAttribute tempObj, ' href'
336336 backlinksList += submitURL + ' \n '
337- console .log ( ' Submitted post to URL: ' + submitURL). cyan
337+ consolex .log ' cyan ' , ' Submitted post to URL: ' + submitURL
338338 # Save backlinks.txt
339339 try
340340 fs .write fileBacklinks, submitURL, ' a'
@@ -364,12 +364,15 @@ casper.repeat numLoops, ->
364364 ++ currentStep
365365 if currentStep == service[currentService].steps .length
366366 serviceName = service[currentService].name
367- console .log ( ' Completed submit to ' + serviceName + ' \n ' ). green
367+ consolex .log ' green ' , ' Completed submit to ' + serviceName + ' \n '
368368 ++ currentService
369369 currentStep = 0
370370 return
371371 return
372372
373+ casper .then ->
374+ consolex .log ' blue' , ' Submitting links to indexeing services'
375+
373376casper .repeat numIndexerLoops, ->
374377 @ then ->
375378 if currentIndexer < indexers .length
@@ -382,7 +385,7 @@ casper.repeat numIndexerLoops, ->
382385 currentIndexerStep = 0
383386
384387casper .run ->
385- console .log ( ' Finished all submissions.' ). green
388+ consolex .log ' green ' , ' Finished all submissions.'
386389 @ echo ' Press ctrl C to exit'
387390 @ exit (0 )
388391 @ bypass (1 )
0 commit comments