HankLloydright / Autoclose Empty Craigslist Tabs

// ==UserScript==
// @name      Autoclose Empty Craigslist Tabs
// @namespace    http://tampermonkey.net/
// @namespace Autoclose Empty Craigslist Tabs (useful with SearchTempest)
// @description Autoclose Empty Craigslist Tabs (useful with SearchTempest)
// @version  1.4
// @include        https://*.craigslist.org*
// @license  MIT
// ==/UserScript==

// separate words or phrases with a comma
var blacklist = ["Nothing found for that search"],
  re = new RegExp(blacklist.join('|'), "i");
if (re.test(document.body.textContent)) {
  window.open('location', '_self', '');
  window.close();
  open(location, '_self').close();
  var win = window.open("", "_self");
  win.close();
}