NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name ACBL Live Usability // @namespace http://weinberg.acbl // @description When loading the first board, load all of the boards and stick it in a tabbed container so don't have to wait for the server to take 5 seconds to respond to every single request. // @include http://live.acbl.org/event/*board_num=1 // @version 1 // @grant none // ==/UserScript== $(document).ready( function(){ var handContainer = document.createElement('div'); handContainer.innerHTML = ` <div class="container"> <div id="content"> <ul id="tabs" class="nav nav-tabs" data-tabs="tabs"> <li class="active"><a href="#tab1" data-toggle="tab">1</a></li> </ul> <div id="my-tab-content" class="tab-content"> <div class="tab-pane active" id="tab1"> </div> </div> </div> </div> ` $(".main-content-inner").children().detach().appendTo($(handContainer).find("#tab1")); $(".main-content-inner").append(handContainer); $("select[name=board_num]").children().each(function() { if (this.value != "1") { $("#tabs").append(`<li><a href="#tab` + this.value + `" data-toggle="tab">` + this.value + `</a></li>`) var newTab = document.createElement("div") newTab.className = "tab-pane"; newTab.setAttribute("id", "tab" + this.value); $(newTab).append("<h1>Loading...</h1>"); $("#my-tab-content").append(newTab); var url = window.location.pathname + "?board_num=" + this.value; var selector = ".main-content-inner >" $(newTab).load(url + " " + selector) } }); })