Created
February 3, 2015 04:09
-
-
Save Langerz82/2e3eae3ace2bf7a97242 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name ChatForFree Fix Resizing (Langerz31) | |
// @description This fixes the ChatForFree Chat Site by re-sizing the window to be within the window. | |
// Tested on FireFox 33.1.1. | |
// Chrome 39.0.2171.65 | |
// If it's broken send me an e-mail: [email protected] or | |
// message me on cff Langerz31. | |
// @namespace Langerz.ChatForFree | |
// @include http://mobile.chatforfree.org/index.php?do=/desktop-chat/ | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js | |
// @version 1.3.1 | |
// @grant none | |
// ==/UserScript== | |
var nW = "100%"; | |
var nH = "100%"; | |
var cbl = $("#chatblazerLayer"); | |
cbl.width(nW); | |
cbl.height(nH); | |
var cbe8 = $("#cbe8"); | |
cbe8.width(nW); | |
cbe8.height(nH); | |
$(window).resize(function () { resizeChat(); }); | |
//$(window).load(function () { }); | |
function resizeChat() { | |
var windowW = $(window).width(); | |
var windowH = $(window).height(); | |
var adBar = $("#site_content").children('table'); | |
var cb8embed = $("#cbe8").children('embed'); | |
var navHdr = $("#header"); | |
var body = $("#nb_body"); | |
var mainpad = $("#main_content_padding"); | |
if (windowW < 475) | |
{ | |
cb8embed.width(470); | |
// Reduce padding to 0. | |
mainpad.css("padding-left", "0"); | |
mainpad.css("padding-right", "0"); | |
} | |
else | |
{ | |
// main_content_padding = 15px + 15px. main_content border 2px. | |
cb8embed.width(windowW - 32); | |
// Reduce padding to 0. | |
mainpad.css("padding-left", "15px"); | |
mainpad.css("padding-right", "15px"); | |
} | |
if (windowH < 445) | |
{ | |
cb8embed.height(440); | |
// Move the Nav and Ad Bar to the bottom. | |
adBar.insertAfter(cbl); | |
navHdr.insertAfter(body); | |
navHdr.css("position","relative"); | |
body.css("padding-top","0"); | |
// Reduce padding to 0. | |
mainpad.css("padding-top", "0"); | |
mainpad.css("padding-bottom", "0"); | |
} | |
else | |
{ | |
// main_content_padding = 10px + 10px | |
// main_content border 1px. | |
// miscellaneous 4px. | |
// body height 40px (but used in header). | |
var bodyH = body.outerHeight() - body.height(); | |
cb8embed.height(windowH - adBar.outerHeight() - bodyH - 38); | |
// Move the Nav and Ad Bar to the top. | |
adBar.insertBefore(cbl); | |
navHdr.insertBefore(body); | |
navHdr.css("position","absolute"); | |
body.css("padding-top","40px"); | |
// Reduce padding to 0. | |
mainpad.css("padding-top", "10px"); | |
mainpad.css("padding-bottom", "10px"); | |
} | |
} | |
resizeChat(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment