Raw Source
mental / Mental's Host Checker for fritchy.com

// ==UserScript==
// @name           Mental's Host Checker for fritchy.com
// @version        34.57
// @namespace      mental
// @description    Marks allowed & banned image & file hosts on fritchy.com
// @license	   GPL version 3 or any later version (http://www.gnu.org/copyleft/gpl.html)
// @include        http://fritchy.com/*
// @include        http://*.fritchy.com/*
// @grant          none
// @icon  http://sharenxs.com/photos/2013/10/10/525637063011d/nxs-frl.jpg
// @downloadURL http://www.mentalps.5gbfree.com/Mentals_Host_Checker_for_fritchy.com.user.js
// @updateURL http://www.mentalps.5gbfree.com/Mentals_Host_Checker_for_fritchy.com.user.js
// @homepage        http://www.mentalps.5gbfree.com
// ==/UserScript==

(function() { 
'use strict';

if (window.self !== window.top) { return; } // end execution if in a frame

// List Of Allowed Image Hosts & Links
var imgHosts = [
	'depic.me',
	'fapomatic.com',
	'fastpic.ru',
	'imaaage.com',
	'imagebam.com',
	'imagetwist.com',
	'imagevenue.com',
	'imagezilla.net',
	'imgbox.com',
	'nudiehost.com',
	'picszone.net',
	'pimpandhost.com',
	'pixhost.org',
	'pixroute.com',
	'postimg.org',
	'postimage.org',
	'sharenxs.com',
	'stooorage.com',
	'turboimagehost.com',
	'uploadhouse.com',
	'upmyphoto.com',

];

// List Of banned File Hosts
var fileHosts = [  
    'anysend.com',
    'bit.cur.lv',
    'cashmoneyuploads',
    'downloadsafe.org',
    'dy.cx',
    'egofiles.com',
    'eufile.eu',
    'fileace',
    'filebounty',
    'filehost.ws',
    'filemad',
    'fileme',
    'filemates.com',
    'fileml.com',
    'filerack.net',
    'fileserve',
    'filesmonster.com',
    'filesmy.com',
    'filesonic',
    'getmyfile.org',
    'gigabase.com',
    'gotlinks.co',
    'hitfile.net',
    'letitbit',
    'linkbabes.com',
    'megaupload.com',
    'oron.com',
    'q.gs',
    'qube cash',
    'queenshare.com',
    'share-links.biz',
    'shareflare.net',
    'sharingmatrix.com',
    'shareloading.net',
    'speedyfiles.net',
    'st0rage.to',
    'storebit.net',
    'surefile.org',
    'turbobit.net',
    'unibytes.com',
    'upfolder.net',
    'vip-file',
    'wupload.com',

];

// redirect image hosts
var redirect_hosts = [
    'adultsimage.com',
    'avseesee.com',
    'http://blogspot.com',
    'buspic.com',
    'casimages.com',
    'cloudimg.net',
    'dimtus.com',
    'directupload.net',
    'dumparump.com',
    'dumppix.com',
    'ericsony.com',
    'famouscelebritiespictures.com',
    'fapoff.com',
    'filefap.com',
    'fileshared.net',
    'fotoupload.ru',
    'free-image-hosting.com',
    'gasica77pornpp.com',
    'gfycat.com',
    'gokoimage.com',
    'hostimage.ru',
    'hostingfailov.com',
    'hostingpics.net',
    'hostmypixxx.org',
    'hosturimage.com',
    'hotimg.com',
    'hqpictures.org',
    'image2share.net',
    'image2you.ru',
    'image18.org',
    'image-hoster.de',
    'imageban.ru',
    'imagebing',
    'imagebax.com',
    'image-boom.com',
    'imagebunk.com',
    'imagecarry.com',
    'imagecherry.com',
    'imagecorn.com',
    'imagedax.net',
    'imageeer.com',
    'imagefast.org',
    'imagefolks.com',
    'imagehaven.net',
    'imagelink.cz',
    'imagelook.org',
    'imagen69.com',
    'imagenimage.com',
    'imagenpic.com',
    'imagepicsa.com',
    'imagepix.org',
    'imageporter.com',
    'imagesadda.com',
    'imageshost.ru',
    'imageshack.com',
    'imageshimage.com',
    'imagesion.com',
    'imagesious.com',
    'imagesist.com',
    'imagesplace.net',
    'imagespot.org',
    'imageteam.org',
    'imageupper.com',
    'imagewaste.com',
    'imgadult.com',
    'imgah.com',
    'imgbabes.com',
    'imgbar.net',
    'imgbd.net',
    'imgcandy.net',
    'imgchili.com',
    'imgchili.net',
    'imgcloud.co',
    'imgdino.com',
    'imgdollar.com',
    'imgearn.net',
    'imgelite.com',
    'imgempire.com',
    'imgfap.net',
    'imgfest.com',
    'imghaven.com',
    'imgheat.com',
    'imgim.com',
    'imgimg.de',
    'imgmad.com',
    'imgmaster.net',     
    'imgnext.com',
    'imgpaying.com',
    'imgphun.com',
    'imgpony.com',
    'imgmoney.com',
    'imgpo.st',
    'imgrex.com',
    'imgrill.com',
    'imgserve.net',
    'imgshow.com',
    'imgspice.com',
    'imgsure.com',
    'imgtab.net',
    'imgtiger.com',
    'imgur.com',
    'keezmovies',
    'kiwi.com',
    'linkbucks.com',
    'lostpic.net',
    'miragepics.com',
    'nudeshare.com',
    'paidimg.com',
    'passpix.com',
    'photobucket.com',
    'photoearn.com',
    'photosex.biz',
    'phototo.org',
    'pic2profit.com',
    'pic4you.ru',
    'pic5you.ru',
    'picbucks.com',
    'piccash.net',
    'piclambo.net',
    'picload.org',
    'piclead.com',
    'picp2.com',
    'pics-sharing.net',
    'picsee.net',
    'picstate.com',
    'picturescream.com',
    'pic-upload.de',
    'pixhost.biz',
    'pixhub.eu',
    'picsious.com',
    'pixtreat.com',
    'pixup.us',
    'pornhome.com',
    'premiumpics.net',
    'pzy.be',
    'radikal.ru',
    'sexyimg.com',
    'shotimg.net',
    'shotpix.com',
    'someimage.com',
    'spetson.com',
    'storeimgs.net',
    'subirporno.com',
    'swagirl.com',
    'sxpics.nl',
    'teenvideomegathread.com',
    'threepicture.com',
    'tnabucks.com',
    'tuspic.net',
    'up4.upppic.com',
    'uploadbox.com',
    'uploadedimg.com',
    'uploadyourimages.org',
    'upix.me',
    'uppix.net',
    'vavvi.com',
    'viewcube.org',
    'wewpic.com',
    'winimg.com',
    'xlocker.net',
    'xxxupload.org',
    'yapeee.com',
    'zooomimg.com',
];

// List Of Mirror File Hosts
var mirHosts = [
'rapidgator.net',
'rg.to',
'ul.to',
'uploaded.net',
'uploaded.to',
];

var Allowed = new RegExp (imgHosts.join('|').replace(/[*.]/g,'\\$&'), 'i');
var BannedFile = new RegExp (fileHosts.join('|').replace(/[*.]/g,'\\$&'), 'i');
var hostredirect = new RegExp (redirect_hosts.join('|').replace(/[*.]/g,'\\$&'), 'i');
var hostmirror = new RegExp (mirHosts.join('|').replace(/[*.]/g,'\\$&'), 'i');

// set image border size, type, & color here
var allowedImgStyle = 'border: 5px solid #008000;';
var bannedImgStyle = 'border: 4px solid #FF0000;';

// set file border border, background, size, type & color here
var allowedUrlStyle = 'border: 3px solid #008000;';
var bannedUrlStyle = 'border: 3px solid #FF0000;';
var redirectStyle = 'background-color: #FF0000; border: 3px solid #FF0000;';
var mirrorStyle = 'background-color: #DEB887; border: 3px solid #008000;';

var imgArray =[];
var hostArray = [];
var pat = /[^./]+\.[^./]+(?=\/)/;
var local = location.hostname;

// check all the images in the Post (not including the signature)
var img = document.querySelectorAll('[id^="post_message"] img');

for (var i = 0, len = img.length; i < len; i++) {
  
  var dom = img[i].src.match(pat)[0];
  if (local.indexOf(dom) !== -1) { continue; } // disregards links/Images from local domain
  
  imgArray[dom] = 1; // cache for notice display
  
  img[i].setAttribute('title', img[i].src); // set the src to title for mouse-over display

  // set a style for allowed/unallowed Image hosts
  if (Allowed.test(img[i].src)<=0) {
    img[i].setAttribute('style', bannedImgStyle); //images not on the allowed list will get a red border
  }
  else if (Allowed.test(img[i].src)) {
    img[i].setAttribute('style', allowedImgStyle); //images on the allowed list will get a green border
  } 
}

//Mark url links
var urls = document.querySelectorAll('[id^="post_message"] a');

for (var i = 0, len = urls.length; i < len; i++) {

  var dom = urls[i].href.match(pat)[0];
  if (local.indexOf(dom) !== -1) { continue; } // disregards links/Images from local domain
  
  hostArray[dom] = 1; // cache for notice display
  
  if (BannedFile.test(urls[i].href)<=0) {
    urls[i].setAttribute('style', allowedUrlStyle); // puts a green box around links on allowed hosts
    }
  if (BannedFile.test(urls[i].href)) {
    urls[i].setAttribute('style', bannedUrlStyle);  // puts a red box around links on banned hosts
    }
  if (Allowed.test(urls[i].href)) {
    urls[i].setAttribute('style', allowedUrlStyle);  // puts a green underline on pics on allowed hosts
    }
  if (hostmirror.test(urls[i].href)) {
    urls[i].setAttribute('style', mirrorStyle);  // puts a shaded background on hosts that require mirror links
    
  } 
}

    //check for redirected images
var urls = document.querySelectorAll('[id^="post_message"] a');

for (var i = 0, len = urls.length; i < len; i++) {
  
  if (hostredirect.test(urls[i].href)) {
    urls[i].setAttribute('style', redirectStyle); // puts red underline under images redirecting to a banned image host

  } 
}

// mark URLs inside CODE tags
var pre = document.getElementsByTagName('pre');

if (pre[0]) {

  for (var i = 0, len = pre.length; i < len; i++) {
  
  hostArray[dom] = 1; // cache for notice display

    // replace HTML links with text links in pre tags
    var a = pre[i].getElementsByTagName('a');
    if (a[0]) { 
      
      for (var n = 0, len = a.length; n < len; n++) {
    
        console.log(a[0].href);
        a[n].parentNode.replaceChild(document.createTextNode(a[n].href), a[n]);
      }
    }
    
    
    // mark text links in pre tags
    pre[i].innerHTML = pre[i].innerHTML.replace(/https?:\/\/\S+/gi, function(m) { 
      if (BannedFile.test(m)<=0) {
        return '<span style="' + allowedUrlStyle + '">' + m + '</span>'; //puts a green box around links on allowed hosts that are posted inside code tags
      }
      if (hostmirror.test(m)) {
          return '<span style="' + mirrorStyle + '">' + m + '</span>';  // puts a shaded background on hosts that require mirror links that are posted inside code tags
        }
      else if (BannedFile.test(m)) {
        return '<span style="' + bannedUrlStyle + '">' + m + '</span>';  //puts a red box around links on banned hosts that are posted inside code tags
      }
      return m;
    });
  }
}

var td = document.querySelector('td.alt1:only-child[width="100%"]');
if (!td) { return; }

// adds a list of all image and file hosts used on the page at the top of the page
var span = document.createElement('span');
span.setAttribute('style', 'color: #008;');
span.innerHTML = '<br />' +
  '<b>Image & File Host Links Used On This Page:</b> ' + (Object.keys(hostArray).join(' | ') || 'n/a');
td.appendChild(span);

})();