| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Uses a Google Custom Search Engine to find pages on | 2 * Uses a Google Custom Search Engine to find pages on |
| 3 * developer.mozilla.org that appear to match types from the Webkit IDL | 3 * developer.mozilla.org that appear to match types from the Webkit IDL |
| 4 */ | 4 */ |
| 5 var https = require('https'); | 5 var https = require('https'); |
| 6 var fs = require('fs'); | 6 var fs = require('fs'); |
| 7 | 7 |
| 8 var domTypes = JSON.parse(fs.readFileSync('data/domTypes.json', 'utf8')); | 8 var domTypes = JSON.parse(fs.readFileSync('data/domTypes.json', 'utf8')); |
| 9 | 9 |
| 10 try { | 10 try { |
| 11 fs.mkdirSync('output'); | 11 fs.mkdirSync('output'); |
| 12 fs.mkdirSync('output/search'); | 12 fs.mkdirSync('output/search'); |
| 13 } catch (e) { | 13 } catch (e) { |
| 14 // It doesn't matter if the directories already exist. | 14 // It doesn't matter if the directories already exist. |
| 15 } | 15 } |
| 16 | 16 |
| 17 function searchForType(type) { | 17 function searchForType(type) { |
| 18 // Strip off WebKit specific prefixes from type names to increase the chances | 18 // Strip off WebKit specific prefixes from type names to increase the chances |
| 19 // of getting matches on developer.mozilla.org. | 19 // of getting matches on developer.mozilla.org. |
| 20 var shortType = type.replace(/^WebKit/, ""); | 20 var shortType = type.replace(/^WebKit/, ""); |
| 21 | 21 |
| 22 // We use a Google Custom Search Engine provisioned for 10,000 API based | 22 // We use a Google Custom Search Engine provisioned for 10,000 API based |
| 23 // queries per day that limits search results to developer.mozilla.org. | 23 // queries per day that limits search results to developer.mozilla.org. |
| 24 // You shouldn't need to, but if you want to create your own Google Custom | 24 // You shouldn't need to, but if you want to create your own Google Custom |
| (...skipping 24 matching lines...) Expand all Loading... |
| 49 req.end(); | 49 req.end(); |
| 50 | 50 |
| 51 req.on('error', function(e) { | 51 req.on('error', function(e) { |
| 52 console.error(e); | 52 console.error(e); |
| 53 }); | 53 }); |
| 54 } | 54 } |
| 55 | 55 |
| 56 for (var i = 0; i < domTypes.length; i++) { | 56 for (var i = 0; i < domTypes.length; i++) { |
| 57 searchForType(domTypes[i]); | 57 searchForType(domTypes[i]); |
| 58 } | 58 } |
| OLD | NEW |