Advertisement
Guest User

Untitled

a guest
Dec 28th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  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_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>');
  20.  
  21. $('#matchlist_header').css('height', 30);
  22. var divHeight = 24;
  23. $('#qlv_postlogin_matches').css('margin-top', divHeight);
  24. $('#qlv_postlogin_matches').css('height', $('#qlv_postlogin_matches').height() - divHeight + 'px');
  25.  
  26. $('#quickfilter_ffa').click(function() { // FFA
  27. $("#ctrl_filter_gametype").val("2").attr("selected", "selected");
  28. $("#ctrl_filter_gametype").change();
  29. });
  30. $('#quickfilter_ca').click(function() { // CA
  31. $("#ctrl_filter_gametype").val("4").attr("selected", "selected");
  32. $("#ctrl_filter_gametype").change();
  33. });
  34. $('#quickfilter_any').click(function() { // all
  35. $("#ctrl_filter_gametype").val("1111").attr("selected", "selected");
  36. $("#ctrl_filter_gametype").change();
  37. });
  38. }
  39.  
  40.  
  41. }
  42.  
  43. if (new RegExp('Firefox/\\d', 'i').test(navigator.userAgent)) {
  44. //Firefox
  45. QLGameTypeSwitcherInit(unsafeWindow);
  46. } else {
  47. //Chrome
  48. var scriptNode = document.createElement("script");
  49. scriptNode.setAttribute("type", "text/javascript");
  50. scriptNode.text = "(" + QLGameTypeSwitcherInit.toString() + ")(window);";
  51. document.body.appendChild(scriptNode);
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement