User:BioBrain/global.js

var noscript = false; wk_site = document.URL.split('.')[0]; switch (wk_site) { case 'http://unchartedwaters': case 'http://biobrain': case 'http://gbi-putera': noscript = true; break; }

if (noscript == false) { //alert('Global.js running');

// Resize Wikia page if desktop screen wider than 1024 pixels. // Resize to 85% if aspect-ratio 16:9 or 80% if aspect-ratio 4:3

screen_ratio = screen.width / screen.height; width_scale = (screen_ratio.toFixed(2) == 1,78) ? 0.85 : 0.85;

desktop = 1024; $w_main = $('section#WikiaPage'); w_main = (screen.width > desktop) ? screen.width * width_scale : $w_main.width;

$w_rail = $('div.WikiaRail#WikiaRail');

/*w_rail = (document.URL.split('?')[0]            == 'http://biobrain.wikia.com/wiki/Test_BioBrain_Wiki') ? 0 : 320;*/ wk_url = document.URL.split('?')[0]; wk_id = wk_url.slice(wk_url.lastIndexOf('/wiki/') + 6); wk_ttl = document.title.replace(/ /g, '_'); w_rail = (wk_id == wk_ttl) ? 0 : 320;

$w_head = $('header#wikiheader'); w_head = w_main - 20;

$w_navi = $('div.navbackground'); w_navi = w_head - 251;

$w_content = $('article.WikiaMainContent'); w_content = (screen.width > desktop) ? w_main - w_rail : $w_content.width;

xpanbutt = 'Xpand -->'; xpanded = false;

function rszpg(content, rail, opacity, display, speed1, speed2, xpanstat, txt, title) { xpanded = xpanstat; $w_content.stop; $w_rail.stop; $w_content.animate({ 'width': content }, speed1); $w_rail.animate({ 'width': rail, 'opacity': opacity }, speed2, function {        $w_rail.css({ 'display': display });        $xpanbutt.html(txt).attr('title', title);    }); }

if (w_rail != 0) { $('div.buttons', 'header#WikiHeader').prepend(xpanbutt); $xpanbutt = $('a#XpanButton'); $xpanbutt.click(function {        if (xpanded == false) {            rszpg(w_main - 5, 0, 0, 'none', 'slow', 'normal', true, 'Restor <--', 'Compress the content area & restore the side rail');       } else {            $w_rail.css({ 'display': 'block' });            rszpg(w_content, w_rail - 20, 1, 'block', 'normal', 'slow', false, 'Xpand -->', 'Expands the content area & hide the side rail');       }    }); }

if (screen.width > desktop) { $('header#WikiaHeader').width(w_main + 14); $w_main.width(w_main); $w_head.width(w_head); $w_navi.width(w_navi); $w_content.width(w_content); $('div.wikiaPhotoGallery-slider-body').css('margin', 'auto'); $('div.toolbar').width(w_main + 10); $('section#EditPageDialog').width(w_content);

//$shr = $('a.wikia-button.share-button.secondary') //$pos_shr = $shr.offset.left + 3; //$('div#SharingToolbar').css({ 'left': $pos_shr, 'z-index': '5' }); $('div#SharingToolbar').css({ 'left': w_main + 3, 'z-index': '5' }); }

}