Raw Source
mental / Mental's Host Checker for planetsuzy.org

// ==UserScript==
// @name           Mental's Host Checker for planetsuzy.org
// @version        70.55
// @namespace      mental
// @description    Marks allowed & banned image & file hosts on planetsuzy.org
// @license	   GPL version 3 or any later version (http://www.gnu.org/copyleft/gpl.html)
// @include        http://planetsuzy.org/*
// @include        http://*.planetsuzy.org/*
// @grant          none
// @icon           http://sharenxs.com/photos/2013/10/10/52563781d358c/nxs-psl.jpg
// @downloadURL    http://www.mentalps.5gbfree.com/Mentals_Host_Checker_for_planetsuzy.org.user.js
// @updateURL      http://www.mentalps.5gbfree.com/Mentals_Host_Checker_for_planetsuzy.org.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',
  'dodaj.rs',
  'easyimghost.com',
  'egafd.com',
  'fapomatic.com',
  'gfycat.com',
  'iafd.com',
  'imagebam.com',
  'imageho.me',
  'imagetwist.com',
  'imageupper.com',
  'imagevenue.com',
  'imagezilla.net',
  'imdb.com',
  'imgbox.com',
  'pics-hosting.com',
  'pics-sharing.net',
  'picszone.net',
  'pimpandhost.com',
  'pixelup.net',
  'pixhost.org',
  'pixroute.com',
  'photosex.biz',
  'postimage.org',
  'postimg.org',
  'postxxximage.org',
  'sharenxs.com',
  'stooorage.com',
  'turboimagehost.com',
  'uploadhouse.com',
  'winimg.com', 

];

// List Of Allowed File Hosts
var fileHosts = [  
  '1fichier.com',
  'anonfiles.com',
  'anonym.to',
  'asfile.com',
  'billionuploads.com',
  'bitshare.com',
  'datafile.com',
  'depositfiles.com',
  'depositfiles.org',
  'dfiles.eu',
  'dfiles.ru',
  'fboom.me',
  'filedrive.com',
  'filefactory.com',
  'Fileom.com',
  'filepost.com',
  'fileswap.com',
  'firedrive.com',
  'fp.io',
  'FreakShare.com',
  'hugefiles.net',
  'k2s.cc',
  'keep2s.cc',
  'keep2share.cc',
  'keep2share.com',
  'luckyshare.net',
  'mega.co',
  'packupload.com',
  'planetsuzy.org',
  'putlocker.com',
  'rapidgator.net',
  'rg.to',
  'terafile.co',
  'ul.to',
  'ultramegabit.com',
  'uploadable.ch',
  'uploaded.net',
  'uploaded.to',
  'uploading.com',
  'zippyshare.com',

];

// redirect image hosts
var redirect_hosts = [
  'adultsimage.com',
  'anonpics.com',
  'binimage.org',
  'http://blogspot.com',   
  'buspic.com',
  'casimages.com',
  'casinimages.com',
  'cloudimg.net',
  'damimage.com',
  'dimtus.com',
  'directupload.net',
  'dumparump.com',
  'dumppix.com',
  'ericsony.com',
  'famouscelebritiespictures.com',
  'fapoff.com',
  'fastpic.ru',
  'filefap.com', 
  'fileshared.net',
  'fotoupload.ru',
  'free-image-hosting.com',
  'freeimage.us',
  'freeimagehosting.net',
  'galleries.bz',
  'gasica77pornpp.com',
  'girlscanner.com',
  'gokoimage.com',
  'hizliresim.com',
  'hostimage.ru',
  'hostingfailov.com',
  'hostingpics.net',
  'hostmypixxx.org',
  'hosturimage.com',
  'hotchyx.com',
  'hotimg.com',
  'hqpictures.org',
  'hybridupload.com',
  'image2share.net',
  'image2you.ru',
  'image-boom.com',
  'image-hoster.de',
  'imageban.net',
  'imageban.ru',
  'imagebanana.com',
  'imagebax.com',
  'imagebin.org',
  'imagebunk.com',
  'imagecarry.com',
  'imagecherry.com',
  'imagecorn.com',
  'imagecurl.org',
  'imagedax.net',
  'imageeer.com',
  'imagefast.org',
  'imagefolks.com',
  'imagehaven.net',
  'imageheli.com',
  'imagehousing.com',
  'imagejumbo.com',
  'imagelink.cz',
  'imagelook.org',
  'imagenimage.com',
  'imagenpic.com',
  'imagepicsa.com',
  'imagepix.org',
  'imageporter.com',
  'imagesadda.com',
  'imagescream.com',
  'imageshost.ru',
  'imageshack.com',
  'imageshimage.com',
  'imagesion.com',
  'imagesious.com',
  'imagesist.com',
  'imagesplace.net',
  'imagespot.org',
  'imageteam.org',
  'imageupper.com',
  'imagewaste.com',
  'imagik.fr',
  'imgadult.com',
  'imgah.com',
  'imgbabes.com',
  'imgbar.net',
  'imgbd.net',
  'imgcandy.net',
  'imgchili.com',
  'imgchili.net',
  'imgcloud.co',
  'imgcorn.com',
  'imgdino.com',
  'imgdollar.com',
  'imgearn.net',
  'imgearner.com',
  'imgelite.com',
  'imgempire.com',
  'imgfap.net',
  'imgfest.com',
  'imgflare.com',
  'imggoo.com',
  'imghaven.com',
  'imgheat.com',
  'imghosting.cz',
  'imgim.com',
  'imgimg.de',
  'imgko.com',
  'imgmad.com',
  'imgmaster.net',
  'imgmoney.com',
  'imgnext.com',
  'imgpapa.com',
  'imgpaying.com',
  'imgphun.com',
  'imgpo.st',
  'imgpony.com',
  'imgrex.com',
  'imgrill.com',
  'imgserve.net',
  'imgshow.com',
  'imgspice.com',
  'imgsure.com',
  'imgtab.net', 
  'imgtiger.com',
  'imgtrick.com',
  'imgur.com',
  'kepfeltoltes.hu',
  'kiwi.com',
  'linkbucks.com',
  'lostpic.net',
  'minus.com',
  'miragepics.com',
  'moneyplatform.biz',
  'nudeimagehost.com',
  'nudeshare.com',
  'paidimg.com',
  'passpix.com',
  'photobucket.com',
  'photoearn.com',
  'phototo.org',
  'pic2profit.com',
  'pic4you.ru',
  'pic5you.ru',
  'pic-upload.de',
  'picage.ru',
  'picbucks.com',
  'piccash.net',
  'piclambo.net',
  'piclead.com',
  'picload.org',
  'picp2.com',
  'picsee.net',
  'picsious.com',
  'picstate.com',
  'picthost.net',
  'pictr.com',
  'pictures.se',
  'picturesion.com',
  'picturescream.com',
  'pixhost.biz',
  'pixhub.eu',
  'pixic.ru',
  'pixpal.net',
  'pixtreat.com',
  'pixup.us',
  'posteram.ru',
  'premiumpics.net',
  'pzy.be',
  'qrrro.com',
  'radikal.ru',
  'sexfetishforum.com',
  'sexyimg.com',
  'shotimg.net',
  'shotpix.com',
  'someimage.com',
  'spetson.com',
  'storeimgs.net',
  'subirimagenes.com',
  'subirporno.com',
  'swagirl.com',
  'sxpics.nl',
  'teenvideomegathread.com',
  'threepicture.com',
  'thumbhost.eu',
  'tinyuploads.com',
  'tnabucks.com',
  'tuspic.net',
  'ultraimg.com',
  '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',
  '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 AllowedFile = 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 (AllowedFile.test(urls[i].href)<=0) {
    urls[i].setAttribute('style', bannedUrlStyle); // puts a red box around links on banned hosts
    }
  if (AllowedFile.test(urls[i].href)) {
    urls[i].setAttribute('style', allowedUrlStyle);  // puts a green box around links on allowed 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 (AllowedFile.test(m)<=0) {
        return '<span style="' + bannedUrlStyle + '">' + m + '</span>'; //puts a red box around links on banned 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 (AllowedFile.test(m)) {
        return '<span style="' + allowedUrlStyle + '">' + m + '</span>';  //puts a green box around links on allowed 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);

})();