Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name QL Gametype Switcher
- // @version 1.0
- // @include http://*.quakelive.com/*
- // @description Script that makes QuakeLive navigation between gametypes faster and user friendly.
- // @author aiken
- // ==/UserScript==
- function QLGameTypeSwitcherInit(unsafeWindow) {
- var $ = unsafeWindow.jQuery;
- var quakelive = unsafeWindow.quakelive;
- var oldHomeShowContent = quakelive.ShowContent;
- quakelive.ShowContent = function (v) {
- oldHomeShowContent(v);
- $('#matchlist_header').append('<div style="margin-top: 8px; margin-left: 5px; padding: 2px; word-spacing: 5px; color: black; border-bottom: 1px solid grey;"> \
- <b>Gametype:</b> \
- <a id="quickfilter_ffa" href="javascript:;" style="color: black; text-decoration: none;"><img style="margin: 0 2px; vertical-align: middle;" src='+quakelive.resource("/images/gametypes/xsm/ffa.png")+' />FFA</a> \
- <a id="quickfilter_ca" href="javascript:;" style="color: black; text-decoration: none;"><img style="margin: 0 2px; vertical-align: middle;" src='+quakelive.resource("/images/gametypes/xsm/ca.png")+' />CA</a> \
- <a id="quickfilter_duel" href="javascript:;" style="color: black; text-decoration: none;"><img style="margin: 0 2px; vertical-align: middle;" src='+quakelive.resource("/images/gametypes/xsm/duel.png")+' />DUEL</a> \
- <a id="quickfilter_any" href="javascript:;" style="color: black; text-decoration: none;"><img style="margin: 0 2px; vertical-align: middle;" src='+quakelive.resource("/images/gametypes/xsm/dom.png")+' />All</a></div>');
- $('#matchlist_header').css('height', 30);
- var divHeight = 24;
- $('#qlv_postlogin_matches').css('margin-top', divHeight);
- $('#qlv_postlogin_matches').css('height', $('#qlv_postlogin_matches').height() - divHeight + 'px');
- $('#quickfilter_ffa').click(function() { // FFA
- $("#ctrl_filter_gametype").val("2").attr("selected", "selected");
- $("#ctrl_filter_gametype").change();
- });
- $('#quickfilter_ca').click(function() { // CA
- $("#ctrl_filter_gametype").val("4").attr("selected", "selected");
- $("#ctrl_filter_gametype").change();
- });
- $('#quickfilter_duel').click(function() { // DUEL
- $("#ctrl_filter_gametype").val("7").attr("selected", "selected");
- $("#ctrl_filter_gametype").change();
- });
- $('#quickfilter_any').click(function() { // all
- $("#ctrl_filter_gametype").val("1111").attr("selected", "selected");
- $("#ctrl_filter_gametype").change();
- });
- }
- }
- if (new RegExp('Firefox/\\d', 'i').test(navigator.userAgent)) {
- //Firefox
- QLGameTypeSwitcherInit(unsafeWindow);
- } else {
- //Chrome
- var scriptNode = document.createElement("script");
- scriptNode.setAttribute("type", "text/javascript");
- scriptNode.text = "(" + QLGameTypeSwitcherInit.toString() + ")(window);";
- document.body.appendChild(scriptNode);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement