// ==UserScript== // @name HF Mobile // @author Polunom // @namespace http://hackforums.net/ // @version 0.1 // @description A mobile theme for HackForums // @include http://hackforums.net/* // @copyright 2015+, Polunom // @grant GM_xmlhttpRequest // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js // @downloadURL none // ==/UserScript== $("body").prepend('
'); $('head').append(''); $('head').append(''); $('head').append(''); $('head').append(''); $('input[type="submit"]').addClass("btn btn-default").css("height", "50px"); $('.links').remove(); $('div[class="pm_alert"]').addClass("alert alert-info").prependTo('.quick_keys'); function check_and_wait(callback) { var interval = setInterval(function() { if ($('body').css("margin") == "0px") { $(".load").hide(); clearInterval(interval); callback(); } }, 30); } check_and_wait(function() { if(document.title === "Hack Forums - 503"){ $('.bottommenu').css("display", "none"); $('#container').css({"position" : "fixed", "top" : "69px"}); }else{ $('link[href="http://hackforums.net/cache/themes/theme5/global.css"]')[0].disabled=true; if(window.location.href == "http://hackforums.net/" || window.location.href == "http://hackforums.net/index.php"){ $('a[rel="tabmenu_1"]').click(); $('link[href="http://hackforums.net/cache/themes/theme5/tabbed.css"]')[0].disabled=true; $(".menu").hide(); $(".menu1").hide(); $('ul#menutabs').each(function() { var select = $(document.createElement('select')).insertBefore($(this).hide()); $('>li a', this).each(function() { $('select').change(function(){ $('a[rel=' + $(this).val() + ']').click(); }), option = $(document.createElement('option')).appendTo(select).val(this.rel).html($(this).html()); }); }); }else if(window.location.href.indexOf("http://hackforums.net/showthread.php") > -1){ $('.post_body').css("color", "#F2F2F2"); $('table[id^="post_"] tbody').after("
");
$('.post_avatar img').each(function() {
$(this).attr("height", $(this).height()/2);
$(this).attr("width", $(this).width()/2);
});
$('.post_author .smalltext:not(.post_author_info)').css({"display" : "block"});
$('strong[class^="reputation_"]').each(function(){
$(this).appendTo($(this).parent().parent().prev().find(".largetext"));
$(this).before(' (').after(')');
});
$('textarea').css("display", "none");
$('a[title="Post Reply"]').addClass("btn btn-default").css({"color" : "#212121", "width" : "100%"}).eq(0).after($('table[style="clear: both; border-bottom-width: 0;"] strong').eq(1).addClass("post_title"));
$('div[class="pagination"]').first().remove();
$('a[title="Post Reply"]').eq(1).after('');
$('div[class="pagination"] a').appendTo('ul[class="pagination"]').wrap("");
$('div.float_left.smalltext').each(function(){
$(this).prependTo($(this).parent().parent().parent().parent());
});
$('img[src^="http://hackforums.net/images/modern_bl/groupimages"]').wrap("").parent().css({"display" : "block"});
$('span[class="bitButton"] a').remove();
$('div[style="float:left;"]').each(function(){
$(this).html($(this).html().replace(/ /gi,''));
$(this).attr("style", "");
});
}else if(window.location.href.indexOf("http://hackforums.net/member.php") > -1 && window.location.href.indexOf("http://hackforums.net/member.php?action=profile") < 0){
$('input[name="username"]').attr("placeholder", "Username/Email");
$('input[name="password"]').attr("placeholder", "Password");
$('input[name="gauth_code"]').attr("placeholder", "Gauth");
$('input[name="remember"]').before("Remember me?");
$('td:not(".error")').css("color", "#333");
}else if(window.location.href.indexOf("http://hackforums.net/member.php?action=profile") > -1){
$('table .largetext').css({"display" : "block", "font-weight" : "600", "font-size" : "24pt"}).append($('table .smalltext img[src^="http://hackforums.net/images/modern_bl/groupimages"]').css("display", "block"));
$('td[width="50%"]:nth-child(1)').attr("width", "100%");
$('td[width="50%"]').css("display", "none");
$('a').css("font-size", "12pt");
$('a[href^="private.php?action=send"]').addClass("btn btn-default").text("PM User");
$('table .smalltext').eq(1).css("display", "block");
}else if(window.location.href.indexOf("http://hackforums.net/forumdisplay.php") > -1){
$('a[title="Post Thread"]').addClass("btn btn-default").css("color", "#212121");
$('td[class="trow_sep"]').css("display", "none");
}else if(window.location.href.indexOf("http://hackforums.net/reputation.php") > -1){
$('.float_right a').addClass("btn btn-default");
$('tbody tr:nth-child(3)').css("display", "none");
$('.repvote').css({"padding-left" : "0", "max-width" : "90vw", "word-wrap" : "break-word"}).after("
");
$('tbody').after('');
$('div[class="pagination"] a').appendTo('ul[class="pagination"]').wrap("");
$('div.float_left.smalltext').each(function(){
$(this).prependTo($(this).parent().parent().parent().parent());
});
}else if(window.location.href.indexOf("http://hackforums.net/newthread.php") > -1){
$('td[valign="top"]').css("display", "none");
$('td[width="20%"]').css("display", "none");
$('.toolbar_button_with_arrow').css("display", "none");
$('input[name="subject"]').attr("placeholder", "Thread Title").after('').before("
");
if(window.location.href == "http://hackforums.net/private.php" || window.location.href.indexOf("http://hackforums.net/private.php?fid") > -1){
$(".quick_keys img").css("display", "none");
$('.checkbox').css("display", "none");
$('span[style="float:right"]').css("display", "none").before("
");
}else if(window.location.href.indexOf("http://hackforums.net/private.php?action=send") > -1){
$('#clickable_smilies').parent().css("display", "none");
$('.toolbar_button_with_arrow').css("display", "none");
$('.messageEditor').attr('style', '').css("width", "90vw").prepend('').before("
");
}else if(window.location.href.indexOf("http://hackforums.net/misc.php") > -1){
$('#content br').css("display", "block");
}else if(window.location.href.indexOf("http://hackforums.net/contact.php") > -1){
$("legend").css("max-width", "90vw");
$("input").css("max-width", "90vw");
$("select").css("max-width", "90vw");
$("textarea").css({"max-width" : "90vw", "border-radius" : "5px", "color" : "black"});
}else if(window.location.href.indexOf("http://hackforums.net/allhelp.php") > -1){
$("td").css({"max-width" : "90vw", "word-wrap" : "break-word"});
$("blockquote").css({"max-width" : "90vw", "word-wrap" : "break-word"});
}else if(window.location.href.indexOf("http://hackforums.net/memberlist.php") > -1){
$('td[width="33%"]').eq(1).css("display", "none");
$('td[width="33%"]').eq(0).attr("width", "100%");
$('select').css({"display" : "block", "width" : "90vw"}).prependTo('div[align="center"]');
$('input[type="submit"]').addClass("btn btn-default").css({"height" : "50px", "margin-bottom" : "20px"});
$('input:not(.button)').attr("placeholder", "Username");
$('tr:not(form)').each(function(){
$(this).children('td[align="center"]').css("display", "none");
});
$('td[align="center"] img').parent().attr("style", "").css("width", "100px");
}else if(window.location.href == "http://hackforums.net/search.php"){
$('form').prepend('');
$('form[action="search.php"]').css("display", "block");
$('table').css("display", "none");
$('tbody tr:nth-child(2)').css("display", "none");
$('tr').css({"display" : "block", "width" : "90vw"});
$('td[rowspan="5"]').css({"display" : "block", "width" : "90vw"});
$('.trow1').css({"display" : "block", "width" : "90vw"});
$('input:not(.radio)').css({"display" : "block", "width" : "90vw"});
$('select[name="forums[]"]').css({"overflow-y" : "scroll", "font-size" : "12pt", "text-align" : "left", "white-space" : "pre-wrap"});
$('input[type="submit"]').addClass("btn btn-default").css("height", "50px");
$('#author').css("display", "none");
$('tbody tr:nth-child(3)').children('td:nth-child(2)').css("display", "none");
$('#searchform').append($('input[name="keywords"]').css("margin-bottom", "20px").attr("placeholder", "Search"));
$('#searchform').append($('td[rowspan="5"]'));
$('#searchform').append($('input[type="submit"]'));
}else if(window.location.href.indexOf("http://hackforums.net/extras.php") > -1){
$('td:contains("√")').css("display", "none");
}
}
$('#header').append("");
$('input').each(function() {
$(this).addClass("form-control");
});
$('strong').each(function() {
$(this).after("