Last active
January 30, 2018 17:18
-
-
Save jdanyow/041652a9247574fbf9a6c930bea3638d to your computer and use it in GitHub Desktop.
grep pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>GistRun</title> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> | |
<h1>Hello world!</h1> | |
<script src="script.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//const selector = 'img[data-hoverimage]'; | |
const selector = 'img[data-scaleimage]'; | |
const baseUrl = 'https://docs.microsoft.com/en-us'; | |
const pathnames = [ | |
'/advanced-threat-analytics/', | |
'/aspnet/', | |
'/azure/', | |
'/azure/architecture/', | |
'/azure/cloud-solution-provider/', | |
'/azure/containers/', | |
'/azure/hdinsight/hdinsight-troubleshoot-guide', | |
'/bingads/', | |
'/biztalk/', | |
'/cognitive-toolkit/', | |
'/common-data-service/', | |
'/cpp/', | |
'/cpp/c-language/c-language-reference', | |
'/cpp/cpp/cpp-language-reference', | |
'/cpp/cpp/expressions-cpp', | |
'/cpp/cpp/keywords-cpp', | |
'/cpp/cpp/lexical-conventions', | |
'/cpp/linux/', | |
'/cpp/windows/cpp-attributes-reference', | |
'/cpp/windows/safeint-library', | |
'/dotnet/', | |
'/dynamics365/customer-engagement/gamification/for-commissioners-game-managers', | |
'/dynamics365/customer-engagement/gamification/increase-employee-productivity', | |
'/dynamics365/unified-operations/dev-itpro/', | |
'/dynamics365/unified-operations/dev-itpro/dev-tools/continuous-delivery-home-page', | |
'/dynamics365/unified-operations/dev-itpro/lcs-solutions/country-region', | |
'/dynamics365/unified-operations/financials/budgeting/budgeting-overview', | |
'/dynamics365/unified-operations/financials/cash-bank-management/cash-bank-management', | |
'/dynamics365/unified-operations/retail/', | |
'/dynamics365/unified-operations/talent/', | |
'/education/', | |
'/ef/', | |
'/enterprise-mobility-security/', | |
'/globalization/', | |
'/healthvault/', | |
'/information-protection/', | |
'/intune/', | |
'/java/azure/', | |
'/javascript/azure/?view=azure-node-2.2.0', | |
'/microsoft-edge/', | |
'/microsoft-edge/webvr/', | |
'/microsoft-identity-manager/', | |
'/microsoftteams/microsoft-teams', | |
'/office/', | |
'/office/admins-itprofessionals', | |
'/outlook/', | |
'/outlook/rest/', | |
'/python/azure/?view=azure-python', | |
'/sccm/', | |
'/scripting/', | |
'/scripting/javascript/', | |
'/security-risk-detection/', | |
'/sql/', | |
'/sql/database-engine/install-windows/install-sql-server-using-a-configuration-file', | |
'/teamblog/', | |
'/virtualization/', | |
'/visualstudio/', | |
'/visualstudio/data-tools/', | |
'/visualstudio/debugger/', | |
'/visualstudio/products/', | |
'/visualstudio/profiling/', | |
'/vsts/', | |
'/vsts/build-release/', | |
'/vsts/deploy-azure/', | |
'/vsts/git/', | |
'/vsts/package/', | |
'/vsts/tfvc/', | |
'/windows-server/administration/performance-tuning/', | |
'/windows/', | |
'/windows/uwp/', | |
'/windows/uwpcommunitytoolkit/', | |
'/', | |
'/active-directory/active-directory-reporting-azure-portal', | |
'/azure/active-directory-b2c/', | |
'/azure/active-directory-domain-services/', | |
'/azure/active-directory/', | |
'/azure/advisor/', | |
'/azure/aks/', | |
'/azure/analysis-services/', | |
'/azure/api-management/', | |
'/azure/app-service-mobile/', | |
'/azure/app-service-mobile/', | |
'/azure/app-service/', | |
'/azure/app-service/containers/', | |
'/azure/app-service/containers/', | |
'/azure/application-gateway/', | |
'/azure/application-insights/', | |
'/azure/architecture/guide/', | |
'/azure/architecture/guide/architecture-styles/', | |
'/azure/architecture/guide/design-principles/', | |
'/azure/architecture/guide/design-principles/build-for-business', | |
'/azure/architecture/guide/design-principles/design-for-evolution', | |
'/azure/architecture/guide/design-principles/design-for-operations', | |
'/azure/architecture/guide/design-principles/minimize-coordination', | |
'/azure/architecture/guide/design-principles/partition', | |
'/azure/architecture/guide/design-principles/redundancy', | |
'/azure/architecture/guide/design-principles/scale-out', | |
'/azure/architecture/guide/design-principles/self-healing', | |
'/azure/architecture/guide/design-principles/use-the-best-data-store', | |
'/azure/architecture/guide/technology-choices/', | |
'/azure/architecture/guide/technology-choices/compute-comparison', | |
'/azure/architecture/reference-architectures/', | |
'/azure/architecture/reference-architectures/app-service-web-app/', | |
'/azure/architecture/reference-architectures/dmz/', | |
'/azure/architecture/reference-architectures/hybrid-networking/', | |
'/azure/architecture/reference-architectures/identity/', | |
'/azure/architecture/reference-architectures/virtual-machines-windows/', | |
'/azure/automation/', | |
'/azure/azure-functions/', | |
'/azure/azure-government/', | |
'/azure/azure-resource-manager/', | |
'/azure/azure-stack/', | |
'/azure/azure-stack/user/', | |
'/azure/backup/', | |
'/azure/batch-ai/', | |
'/azure/batch/', | |
'/azure/billing/', | |
'/azure/biztalk-services/', | |
'/azure/cdn/', | |
'/azure/china/', | |
'/azure/cloud-services/', | |
'/azure/cloudfoundry/', | |
'/azure/cognitive-services/bing-image-search/', | |
'/azure/cognitive-services/computer-vision/', | |
'/azure/cognitive-services/face/', | |
'/azure/cognitive-services/text-analytics/', | |
'/azure/container-instances/', | |
'/azure/container-registry/', | |
'/azure/container-service/', | |
'/azure/container-service/dcos-swarm/', | |
'/azure/container-service/kubernetes/', | |
'/azure/cosmos-db/', | |
'/azure/cost-management/', | |
'/azure/data-catalog/', | |
'/azure/data-factory/', | |
'/azure/data-lake-analytics/', | |
'/azure/data-lake-store/', | |
'/azure/devtest-lab/', | |
'/azure/dns/', | |
'/azure/event-grid/', | |
'/azure/event-hubs/', | |
'/azure/expressroute/', | |
'/azure/germany/', | |
'/azure/hdinsight/', | |
'/azure/iot-dps/', | |
'/azure/iot-hub/', | |
'/azure/iot-suite/', | |
'/azure/jenkins/', | |
'/azure/key-vault/', | |
'/azure/load-balancer/', | |
'/azure/log-analytics/', | |
'/azure/logic-apps/', | |
'/azure/machine-learning/preview/', | |
'/azure/machine-learning/studio/', | |
'/azure/mobile-engagement/', | |
'/azure/monitoring-and-diagnostics/', | |
'/azure/multi-factor-authentication/', | |
'/azure/mysql/', | |
'/azure/network-watcher/', | |
'/azure/notification-hubs/', | |
'/azure/openshift/', | |
'/azure/operations-management-suite/', | |
'/azure/postgresql/', | |
'/azure/power-bi-embedded/', | |
'/azure/redis-cache/', | |
'/azure/scheduler/', | |
'/azure/search/', | |
'/azure/security-center/', | |
'/azure/security/', | |
'/azure/service-bus-messaging/', | |
'/azure/service-bus-relay/', | |
'/azure/service-bus/', | |
'/azure/service-fabric/', | |
'/azure/service-health/', | |
'/azure/site-recovery/', | |
'/azure/sql-data-warehouse/', | |
'/azure/sql-database/', | |
'/azure/storage/', | |
'/azure/storsimple/', | |
'/azure/stream-analytics/', | |
'/azure/terraform/', | |
'/azure/time-series-insights/', | |
'/azure/traffic-manager/', | |
'/azure/virtual-machine-scale-sets/', | |
'/azure/virtual-machines/', | |
'/azure/virtual-machines/linux/', | |
'/azure/virtual-machines/windows/', | |
'/azure/virtual-network/', | |
'/azure/vpn-gateway/', | |
'/bot-framework/', | |
'/cortana/skills/', | |
'/dotnet/api/', | |
'/dotnet/azure/', | |
'/flow/', | |
'/flow/guided-learning/', | |
'/legal/windows/agreements/app-developer-agreement', | |
'/legal/windows/agreements/app-developer-agreement-change-history', | |
'/legal/windows/agreements/store-policies', | |
'/legal/windows/agreements/store-policies-and-code-of-conduct', | |
'/legal/windows/agreements/xbox-one-developer-mode-activation', | |
'/machine-learning-server/', | |
'/microsoft-365-business/', | |
'/microsoft-365-enterprise/', | |
'/microsoft-365/', | |
'/nuget/', | |
'/onedrive/developer/', | |
'/powerapps/', | |
'/powerapps/guided-learning/', | |
'/powershell/', | |
'/powershell/module/', | |
'/sandbox/', | |
'/stream/', | |
'/uwp/', | |
'/visualstudio/cross-platform/', | |
'/visualstudio/extensibility/', | |
'/visualstudio/ide/', | |
'/visualstudio/ide/index-writing-code', | |
'/visualstudio/rtvs/data-science-workload', | |
'/windows/iot-core/', | |
]; | |
const parser = new DOMParser(); | |
function checkPage(url, selector) { | |
return fetch(url, { mode: 'cors' }) | |
.then(response => { | |
console.log(url, response.status); | |
if (!response.ok) { | |
return ''; | |
} | |
return response.text(); | |
}) | |
.then(html => { | |
const document = parser.parseFromString(html, "text/html"); | |
return document.querySelector(selector) !== null; | |
}); | |
} | |
function checkPages(selector) { | |
Promise.all(pathnames.map(pathname => checkPage(baseUrl + pathname, selector).then(found => ({ pathname, found })))) | |
.then(results => { | |
const matches = results.filter(result => result.found); | |
console.log(`%c\n${matches.length} page(s) match the "${selector}" selector:`, 'color: green'); | |
matches.map(result => console.info('%c' + baseUrl + result.pathname, 'color: green')); | |
}); | |
} | |
checkPages(selector); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* todo: add styles */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment