Skip to content

Instantly share code, notes, and snippets.

@KrofDrakula
Created June 7, 2012 07:52
Show Gist options
  • Save KrofDrakula/2887256 to your computer and use it in GitHub Desktop.
Save KrofDrakula/2887256 to your computer and use it in GitHub Desktop.
// Scripting Chrome for awesome
// This script finds all matching history entries
// in the chrome://chrome/history/ panel and turns
// the checkboxes on so you don't have to click through
// all of them.
// Retrieve all entries from the currently displayed
// history list (use the Search history to limit your
// list first).
var entries = document.querySelectorAll('.entry');
entries = Array.prototype.slice.apply(entries);
// Set up a RegExp to test URLs. I only want to match
// those URLs that are invalid in the new URL scheme.
var matcher = /^https:\/\/[a-z.]+\.klemen\/public/g;
// Find all entries that match
var matches = entries.filter(function(item) {
var a = item.querySelector('a');
if (a) return matcher.test(a.href);
return false;
});
// Loop over the matches and select the checkboxes.
matches.forEach(function(item) {
var checkbox = item.querySelector('input');
if (checkbox) checkbox.checked = true;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment