TinyPic Cleaned Up

By JoeSimmons Last update Apr 30, 2009 — Installed 373 times.

There are 2 previous versions of this script.

// ==UserScript==
// @name           TinyPic Cleaned Up
// @namespace      http://userscripts.org/users/23652
// @include        http://tinypic.com/*
// @description    Cleans up TinyPic.com
// @copyright      JoeSimmons
// @version        1.0.0
// ==/UserScript==

// Delete id/node
function del(N) {
var n = (typeof N=='string') ? document.getElementById(N) : N;
if(n!=null) n.parentNode.removeChild(n);
}

// deleteAll(array) by JoeSimmons
function deleteAll(array) {
if(array.snapshotItem) for(var i=array.snapshotLength-1; i>=0; i--) array.snapshotItem(i).parentNode.removeChild(array.snapshotItem(i));
else if(!array.snapshotItem) for(var i=array.length-1; i>=0; i--) array[i].parentNode.removeChild(array[i]);
}

// addGlobalStyle
function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}

try {
addGlobalStyle('.body-container {padding:0!important;} div.container {width:auto!important;margin:0!important;position:static!important;text-align:center!important;} #upload-tool {border-width:0!important;margin:0!important;padding:0!important;width:auto!important;} #upload-tool .content-main {width:auto!important;margin:0 0 0 '+Math.floor(window.innerWidth/3)+'px!important;}');

// Delete member header
del('member-container-header');

// Delete Unneeded DIVs
var bodycontainer = document.evaluate("//div[@class='body-container']",document,null,9,null).singleNodeValue;
while(bodycontainer!=null && (pr=bodycontainer.previousSibling)!=null) pr.parentNode.removeChild(pr);

// Delete iframes
deleteAll(document.getElementsByTagName('iframe'));

// Delete browse columns
deleteAll(document.evaluate("//*[@class='browse columns']",document,null,6,null));

// Delete about section
deleteAll(document.evaluate("//*[@class='about']",document,null,6,null));

// Delete clear BRs
deleteAll(document.evaluate("//br[@class='clear']",document,null,6,null));

// Delete ads
deleteAll(document.evaluate("//*[@class='content-sec ad']",document,null,6,null));

// Delete home iframe
del('home_iframe');

// Delete site info  bar
del('site-info');
} catch(e) {alert('Error: '+e);}