@@ -69,10 +69,10 @@ process.on("message", function(data)
69
69
{
70
70
sitemap_content +=
71
71
'<url>' +
72
- '<loc>' + doc . url + '</loc>' +
73
- // '<lastmod>---</lastmod>' +
74
- // '<changefreq>---</changefreq>' +
75
- '<priority>0.7</priority>' +
72
+ '<loc>' + doc . url + '</loc>' +
73
+ // '<lastmod>---</lastmod>' +
74
+ // '<changefreq>---</changefreq>' +
75
+ '<priority>0.7</priority>' +
76
76
'</url>' ;
77
77
} )
78
78
@@ -302,37 +302,35 @@ function checkUrl()
302
302
* @return {String } The revised link
303
303
*/
304
304
function check_link ( link , parent_link ) {
305
- // check for "empty" links
306
- if ( link === undefined ) {
307
- return false ;
308
- } else if ( link === '' || link == '#' ) {
309
- return false ;
310
- }
311
- // parse the link
312
- parts = url . parse ( link ) ;
313
- // check the scheme
314
- if ( parts . protocol == 'mailto' || parts . protocol == 'javascript' || parts . protocol == 'ftp' ) {
315
- // incompatible protocol
316
- return false ;
317
- } else if ( parts . protocol == 'http' || parts . protocol == 'https' ) {
318
- // make sure host is our ___domain
319
- if ( parts . host != scrapeHost ) {
320
- return false ;
321
- }
322
- } else if ( link . indexOf ( '//' ) === 0 ) {
323
- // handle schema-less; ensure host is ours
324
- if ( link . indexOf ( '//' + scrapeHost ) !== 0 ) {
325
- return false ;
326
- }
327
- link = 'http:' + link ;
328
- } else if ( parts . protocol ) {
329
- // unknown protocol
330
- return false ;
331
- } else {
332
- // relative link
333
- link = url . resolve ( parent_link , link ) ;
334
- }
335
- return link ;
305
+ // check for "empty" links
306
+ if ( link === undefined ) {
307
+ return false ;
308
+ } else if ( link === '' || link == '#' ) {
309
+ return false ;
310
+ }
311
+ // parse the link
312
+ parts = url . parse ( link ) ;
313
+
314
+ // check the scheme
315
+ if ( parts . protocol == 'http' || parts . protocol == 'https' ) {
316
+ // make sure host is our ___domain
317
+ if ( parts . host != scrapeHost ) {
318
+ return false ;
319
+ }
320
+ } else if ( link . indexOf ( '//' ) === 0 ) {
321
+ // handle schema-less; ensure host is ours
322
+ if ( link . indexOf ( '//' + scrapeHost ) !== 0 ) {
323
+ return false ;
324
+ }
325
+ link = 'http:' + link ;
326
+ } else if ( parts . protocol ) {
327
+ // unknown or unsupported protocol
328
+ return false ;
329
+ } else {
330
+ // relative link
331
+ link = url . resolve ( parent_link , link ) ;
332
+ }
333
+ return link ;
336
334
}
337
335
338
336
function make_request ( protocol , host , path , depth , callback )
@@ -397,27 +395,27 @@ function randomString(len)
397
395
398
396
function bytesToSize ( bytes , precision )
399
397
{
400
- var kilobyte = 1024 ;
401
- var megabyte = kilobyte * 1024 ;
402
- var gigabyte = megabyte * 1024 ;
403
- var terabyte = gigabyte * 1024 ;
398
+ var kilobyte = 1024 ;
399
+ var megabyte = kilobyte * 1024 ;
400
+ var gigabyte = megabyte * 1024 ;
401
+ var terabyte = gigabyte * 1024 ;
404
402
405
- if ( ( bytes >= 0 ) && ( bytes < kilobyte ) ) {
406
- return bytes + ' B' ;
403
+ if ( ( bytes >= 0 ) && ( bytes < kilobyte ) ) {
404
+ return bytes + ' B' ;
407
405
408
- } else if ( ( bytes >= kilobyte ) && ( bytes < megabyte ) ) {
409
- return ( bytes / kilobyte ) . toFixed ( precision ) + ' KB' ;
406
+ } else if ( ( bytes >= kilobyte ) && ( bytes < megabyte ) ) {
407
+ return ( bytes / kilobyte ) . toFixed ( precision ) + ' KB' ;
410
408
411
- } else if ( ( bytes >= megabyte ) && ( bytes < gigabyte ) ) {
412
- return ( bytes / megabyte ) . toFixed ( precision ) + ' MB' ;
409
+ } else if ( ( bytes >= megabyte ) && ( bytes < gigabyte ) ) {
410
+ return ( bytes / megabyte ) . toFixed ( precision ) + ' MB' ;
413
411
414
- } else if ( ( bytes >= gigabyte ) && ( bytes < terabyte ) ) {
415
- return ( bytes / gigabyte ) . toFixed ( precision ) + ' GB' ;
412
+ } else if ( ( bytes >= gigabyte ) && ( bytes < terabyte ) ) {
413
+ return ( bytes / gigabyte ) . toFixed ( precision ) + ' GB' ;
416
414
417
- } else if ( bytes >= terabyte ) {
418
- return ( bytes / terabyte ) . toFixed ( precision ) + ' TB' ;
415
+ } else if ( bytes >= terabyte ) {
416
+ return ( bytes / terabyte ) . toFixed ( precision ) + ' TB' ;
419
417
420
- } else {
421
- return bytes + ' B' ;
422
- }
418
+ } else {
419
+ return bytes + ' B' ;
420
+ }
423
421
}
0 commit comments