SHARE
TWEET

Untitled

a guest Dec 28th, 2012 30 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     // ==UserScript==
  2.     // @name            QL Gametype Switcher
  3.     // @version         1.0
  4.     // @include         http://*.quakelive.com/*
  5.     // @description     Script that makes QuakeLive navigation between gametypes faster and user friendly.
  6.     // @author          aiken
  7.     // ==/UserScript==
  8.      
  9.     function QLGameTypeSwitcherInit(unsafeWindow) {
  10.         var $ = unsafeWindow.jQuery;
  11.         var quakelive = unsafeWindow.quakelive;
  12.         var oldHomeShowContent = quakelive.ShowContent;
  13.         quakelive.ShowContent = function (v) {
  14.             oldHomeShowContent(v);
  15.             $('#matchlist_header').append('<div style="margin-top: 8px; margin-left: 5px; padding: 2px; word-spacing: 5px; color: black; border-bottom: 1px solid grey;"> \
  16.                 <b>Gametype:</b> \
  17.                 <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> \
  18.                 <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> \
  19.                 <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> \
  20.                 <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>');
  21.                
  22.             $('#matchlist_header').css('height', 30);
  23.             var divHeight = 24;
  24.             $('#qlv_postlogin_matches').css('margin-top', divHeight);
  25.             $('#qlv_postlogin_matches').css('height', $('#qlv_postlogin_matches').height() - divHeight + 'px');
  26.      
  27.             $('#quickfilter_ffa').click(function() { // FFA
  28.                 $("#ctrl_filter_gametype").val("2").attr("selected", "selected");
  29.                 $("#ctrl_filter_gametype").change();
  30.             });
  31.             $('#quickfilter_ca').click(function() { // CA
  32.                 $("#ctrl_filter_gametype").val("4").attr("selected", "selected");
  33.                 $("#ctrl_filter_gametype").change();
  34.             });
  35.             $('#quickfilter_duel').click(function() { // DUEL
  36.                 $("#ctrl_filter_gametype").val("7").attr("selected", "selected");
  37.                 $("#ctrl_filter_gametype").change();
  38.             });
  39.             $('#quickfilter_any').click(function() { // all
  40.                 $("#ctrl_filter_gametype").val("1111").attr("selected", "selected");
  41.                 $("#ctrl_filter_gametype").change();
  42.             });
  43.         }
  44.        
  45.        
  46.     }
  47.      
  48.     if (new RegExp('Firefox/\\d', 'i').test(navigator.userAgent)) {
  49.         //Firefox
  50.         QLGameTypeSwitcherInit(unsafeWindow);
  51.     } else {
  52.         //Chrome
  53.         var scriptNode = document.createElement("script");
  54.         scriptNode.setAttribute("type", "text/javascript");
  55.         scriptNode.text = "(" + QLGameTypeSwitcherInit.toString() + ")(window);";
  56.         document.body.appendChild(scriptNode);
  57.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top