User:WelpThatWorked/vector.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
$.bodyBorderResize = mw.util.debounce(0, function() {
var $body = $("#content");
var $lnav = $("#left-navigation");
var $rnav = $("#right-navigation");
$body.css("--p1", $lnav.outerWidth() + "px");
$body.css("--p4", $body.css("border-top-width"));
if( ($lnav.outerWidth()+$rnav.outerWidth()) > $body.outerWidth()){
$body.css("--p2", $body.outerWidth() + "px");
} else {
$body.css("--p2", $body.outerWidth() + parseFloat($body.css("margin-right")) - $rnav.outerWidth(true) + "px");
$body.css("--p3", $body.outerWidth() + parseFloat($body.css("margin-right")) - $("#p-search").outerWidth(true) + "px");
}
});
$(window).on("resize", $.bodyBorderResize);
var obs = new MutationObserver($.bodyBorderResize);
obs.observe(document.querySelector("#right-navigation"), { subtree: true, attributes: true });
console.warn("test");