OLD SCHOOL Hackforums Theme - made by Krew

This script replaces HF with the oldschool theme and images.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name       OLD SCHOOL Hackforums Theme - made by Krew
// @namespace  OldSchoolHF.pw
// @version    1.0
// @description  This script replaces HF with the oldschool theme and images.
// @match       *://*.hackforums.net/*
// @copyright  2014 OldschoolHF.pw
// @run-at document-start
// ==/UserScript==


window.addEventListener('load', function() { 
var images = document.getElementsByTagName('img'); 
for (var i = 0; i < images.length; i++) { 
images[i].src = images[i].src.replace('http://x.hackforums.net/images/modern_bl/starreg.png', 'http://oldschoolhf.pw/backup/HF/images/star.gif');
images[i].src = images[i].src.replace('http://x.hackforums.net/images/modern_bl/starl33t.png', 'http://oldschoolhf.pw/backup/HF/images/star.gif'); 
images[i].src = images[i].src.replace('http://x.hackforums.net/images/modern_bl/staradmin.png', 'http://oldschoolhf.pw/backup/HF/images/star.gif');
images[i].src = images[i].src.replace('http://x.hackforums.net/images/modern_bl/starstaff.png', 'http://oldschoolhf.pw/backup/HF/images/staff_star1.png');
images[i].src = images[i].src.replace('http://hackforums.net:8080/images/modern_bl/logo_bl.gif', 'http://oldschoolhf.pw/backup/HF/images/logo.jpg');
images[i].src = images[i].src.replace('http://hackforums.net:8080/images/modern_pl/logo_pl.gif', 'http://oldschoolhf.pw/backup/HF/images/logo.jpg');
images[i].src = images[i].src.replace('http://www.hackforums.net/images/groupimages/english/ub3r.png', 'http://oldschoolhf.pw/backup/HF/images/ub3r.png');
images[i].src = images[i].src.replace('http://x.hackforums.net/images/modern_bl/groupimages/english/ub3r.png', 'http://oldschoolhf.pw/backup/HF/images/ub3r.png');
images[i].src = images[i].src.replace('http://www.hackforums.net/images/groupimages/english/admin2.png', 'http://oldschoolhf.pw/backup/HF/images/admin.jpg');
images[i].src = images[i].src.replace('http://x.hackforums.net/images/modern_bl/groupimages/english/admin-bar.png', 'http://oldschoolhf.pw/backup/HF/images/admin.jpg');
images[i].src = images[i].src.replace('http://www.hackforums.net/images/groupimages/english/staff.png', 'http://oldschoolhf.pw/backup/HF/images/staff.png');
images[i].src = images[i].src.replace('http://x.hackforums.net/images/modern_bl/groupimages/english/staff.png', 'http://oldschoolhf.pw/backup/HF/images/staff.png');
images[i].src = images[i].src.replace('http://www.hackforums.net/images/groupimages/english/mentor.jpg', 'http://oldschoolhf.pw/backup/HF/images/mentor.jpg');
images[i].src = images[i].src.replace('http://x.hackforums.net/images/modern_bl/groupimages/english/mentor.png', 'http://oldschoolhf.pw/backup/HF/images/mentor.jpg');   
images[i].src = images[i].src.replace('http://www.hackforums.net/images/groupimages/english/l33t.png', 'http://oldschoolhf.pw/backup/HF/images/hf_l33t.png');
images[i].src = images[i].src.replace('http://x.hackforums.net/images/modern_bl/groupimages/english/l33t.png', 'http://oldschoolhf.pw/backup/HF/images/hf_l33t.png');
images[i].src = images[i].src.replace('http://x.hackforums.net/images/modern_bl/starub3r2.png', 'http://oldschoolhf.pw/backup/HF/images/ub3rstar.gif');
images[i].src = images[i].src.replace('http://x.hackforums.net/images/modern_bl/minion.gif', 'http://oldschoolhf.pw/backup/HF/images/minion.gif');
images[i].src = images[i].src.replace('http://x.hackforums.net/images/blackreign/buddy_offline.gif', 'http://oldschoolhf.pw/backup/HF/images/buddy_offline.gif');
images[i].src = images[i].src.replace('http://x.hackforums.net/images/blackreign/buddy_online.gif', 'http://oldschoolhf.pw/backup/HF/images/buddy_online.gif');


} 
}, false);

function addStyleSheet(style){
  var elementStyle= document.getElementsByTagName("HEAD")[0].appendChild(window.document.createElement('style'));
  elementStyle.innerHTML = style;
  return elementStyle;
}

function removejscssfile(filename, filetype){
 var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none"; //determine element type to create nodelist from
 var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none"; //determine corresponding attribute to test for
 var allsuspects=document.getElementsByTagName(targetelement);
 for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
  if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1)
   allsuspects[i].parentNode.removeChild(allsuspects[i]); //remove element by calling parentNode.removeChild()
 }
}

removejscssfile('global.css', 'css', 'tabbed.css');
addStyleSheet('@import "http://oldschoolhf.pw/backup/HF/global.css";\n@import "http://oldschoolhf.pw/backup/HF/tabbed.css";\n@import "http://oldschoolhf.pw/backup/HF/star_rating.css";');