// ==UserScript==
// @name Mental's Host Checker for fritchy.com
// @version 34.85
// @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
// @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',
'fastpic.ru',
'imaaage.com',
'imagebam.com',
'imageho.me',
'imagetwist.com',
'imageupper.com',
'imagevenue.com',
'imagezilla.net',
'imgbox.com',
'nudiehost.com',
'picstate.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 = [
'admy.link',
'anysend.com',
'asfile.com',
'bit.cur.lv',
'bitshare.com',
'cashmoneyuploads',
'downloadsafe.org',
'dy.cx',
'egofiles.com',
'eufile.eu',
'fileace',
'filebounty',
'filehost.ws',
'filemad',
'fileme',
'filemates.com',
'fileml.com',
'fileom.com',
'filerack.net',
'fileserve',
'filesmonster.com',
'filesmy.com',
'filesonic',
'getmyfile.org',
'gigabase.com',
'gotlinks.co',
'hitfile.net',
'letitbit',
'linkbabes.com',
'luckyshare.net',
'megaupload.com',
'oron.com',
'packupload.com',
'q.gs',
'qube cash',
'queenshare.com',
'rapidu.net',
'sh.st',
'share-links.biz',
'shareflare.net',
'sharingmatrix.com',
'shareloading.net',
'speedyfiles.net',
'st0rage.to',
'storebit.net',
'surefile.org',
'terafile.co',
'terafile.com',
'turbobit.net',
'ultramegabit.com',
'unibytes.com',
'upfolder.net',
'uploadto.us',
'vip-file',
'wupload.com',
'*****'
];
// redirect image hosts
var redirect_hosts = [
'37v.net',
'adultsimage.com',
'avseesee.com',
'bestofcelebs.com',
'http://blogspot.com',
'buspic.com',
'casimages.com',
'cloudimg.net',
'damimage.com',
'dimtus.com',
'directupload.net',
'dumparump.com',
'dumppix.com',
'ericsony.com',
'famouscelebritiespictures.com',
'fapoff.com',
'fapomatic.com',
'filefap.com',
'fileshared.net',
'fotoupload.ru',
'free-image-hosting.com',
'gallerynova.se',
'gasica77pornpp.com',
'gfycat.com',
'gokoimage.com',
'hostimage.ru',
'hostingfailov.com',
'hostingpics.net',
'hostmypixxx.org',
'hosturimage.com',
'hotimg.com',
'hqpictures.org',
'image-bugs.com',
'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',
'imagedecode.com',
'imageeer.com',
'imagefast.org',
'imagefolks.com',
'imagehaven.net',
'imageleon.com',
'imagelink.cz',
'imagelook.org',
'imagen69.com',
'imagenimage.com',
'image.nofansclub.ru',
'imagenpic.com',
'imageophilia.com',
'imagepicsa.com',
'imagepix.org',
'imageporter.com',
'images-host.biz',
'imagescream.com',
'imageshost.us',
'imagesadda.com',
'imageshost.ru',
'imageshack.com',
'imageshimage.com',
'imagesion.com',
'imagesious.com',
'imagesist.com',
'imagesplace.net',
'imagespot.org',
'imageteam.org',
'imagewaste.com',
'imgadult.com',
'imgah.com',
'imgbabes.com',
'imgbar.net',
'imgbd.net',
'imgblow.com',
'imgcandy.net',
'imgchili.com',
'imgchili.net',
'imgclick.net',
'imgclick.biz',
'imgcloud.co',
'imgdino.com',
'imgdollar.com',
'imgearn.net',
'imgelite.com',
'imgempire.com',
'imgfap.net',
'imgfest.com',
'imgrill.com',
'imghaven.com',
'imgheat.com',
'imghostz.com',
'imgim.com',
'imgimg.de',
'imgmad.com',
'imgmaster.net',
'imgmega.com',
'imgnext.com',
'imgpaying.com',
'imgphun.com',
'imgpony.com',
'imgmoney.com',
'imgpo.st',
'imgrex.com',
'imgrock.net',
'imgserve.net',
'imgshow.com',
'imgspice.com',
'imgsure.com',
'imgtab.net',
'imgtiger.com',
'imgtrex.com',
'imgtube.net',
'imgult.com',
'imgur.com',
'keezmovies',
'kiwi.com',
'linkbucks.com',
'lostpic.net',
'miragepics.com',
'motherless.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',
'picturescream.com',
'pic-upload.de',
'pixhost.biz',
'pixhub.eu',
'picsious.com',
'pixtreat.com',
'pixup.us',
"pixxx.me",
'pornhome.com',
'premiumpics.net',
'pzy.be',
'radikal.ru',
'sexyimg.com',
'shotimg.net',
'shotpix.com',
'sleekpix.com',
'someimage.com',
'spetson.com',
'storeimgs.net',
'subirporno.com',
'swagirl.com',
'sxpics.nl',
'teenvideomegathread.com',
'theimghost.com',
'threepicture.com',
'tnabucks.com',
'tuspic.net',
'up4.upppic.com',
'uploadbox.com',
'uploadedimg.com',
'uploadyourimages.org',
'upix.me',
'uppix.net',
'vavvi.com',
'vfl.ru',
'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',
'http://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);
})();
var allowed_hosts = new Array("fritchy.com");
var images = document.getElementsByTagName('img');
var images_count = images.length;
var thumbnail;
allowed_hosts_count = allowed_hosts.length;
for(i = 0; i < images_count; i++){
image = images[i];
thumbnail = false;
var image_container = image.parentNode;
if (image_container.localName == 'a')
{
thumbnail = true;
for(j = 0; j < allowed_hosts_count; j++)
if(image_container.href.indexOf(allowed_hosts[j]) >= 0) {
}
}
if (thumbnail == false)
{
var toplevelnode = image.parentNode;
var cur_id="";
while (true)
{
cur_id=toplevelnode.id;
if (cur_id.length>0)
if (cur_id.indexOf('post_message_')>=0)
{
if(image.src.indexOf(allowed_hosts[0]) == -1)
image.style.border = "thick solid purple";
break;
}
if (toplevelnode.localName == 'body' || cur_id.indexOf('posts')>=0) break;
toplevelnode = toplevelnode.parentNode;
}
}
}