New Inline Tier Charts

This will provide an inline tier chart for Dawn of the Dragons.Maps created by Brayden.Tiers collected by Warric.

  1. // ==UserScript==
  2. // @name New Inline Tier Charts
  3. // @namespace DusanAndWarric
  4. // @description This will provide an inline tier chart for Dawn of the Dragons.Maps created by Brayden.Tiers collected by Warric.
  5. // @include *www.27thdimension.com/dotd/tierChartsStandalone.html
  6. // @include *kongregate.com/games/5thplanetgames/dawn-of-the-dragons*
  7. // @include *kongregate.com/games/5thPlanetGames/dawn-of-the-dragons*
  8. // @include *50.18.191.15/kong/?DO_NOT_SHARE_THIS_LINK*
  9. // @include *dawnofthedragons.com*
  10. // @include *apps.facebook.com/dawnofthedragons*
  11. // @include *web1.dawnofthedragons.com/live_standalone*
  12. // @include *newgrounds.com/portal/view/609826*
  13. // @include *armorgames.com/dawn-of-the-dragons-game/13509*
  14. // @include *armorgames.com/*/13509*
  15. // @version 3.6.22
  16. // @grant none
  17. // ==/UserScript==
  18. ( function ( data ) {
  19. "use strict";
  20. /**
  21. * creates a new element for the list
  22. * @param {string} label the name of the dataset
  23. * @param {string} src the image id
  24. * @param {Function} func the function to be called when clicked
  25. * @returns {unresolved}
  26. */
  27. var create = function ( label, src, func ) {
  28. var wrapper = document.createElement ( "li" );
  29. wrapper.onclick = func;
  30. if ( src ) {
  31. wrapper.appendChild ( document.createElement('div') );
  32. wrapper.firstChild.appendChild ( document.createElement ( "img" ) );
  33. wrapper.firstChild.firstChild.setAttribute ( "src", src );
  34. wrapper.firstChild.firstChild.setAttribute ( "alt", label );
  35. }
  36. if(label) {
  37. wrapper.appendChild ( document.createElement ( "button" ) );
  38. wrapper.lastChild.appendChild ( document.createTextNode ( label ) );
  39. }
  40. return wrapper;
  41. };
  42. var list = document.createElement ( "ul" );
  43. list.setAttribute ( "id", "NewInlineTierCharts" );
  44. list.appendChild ( create ( "\u21C6", "", function () {
  45. this.parentNode.setAttribute("class",( this.parentNode.getAttribute ( "class" ) === "right" ? "" : "right" ));
  46. } ) );
  47. /**
  48. * switches between active and inactive
  49. * @returns {undefined}
  50. */
  51. var showHide = function () {
  52. var status = this.getAttribute ( "class" ) === "active" ? "" : "active";
  53. for (var counter = 0; counter < this.parentNode.childNodes.length; counter++) {
  54. this.parentNode.childNodes[counter].setAttribute ( "class", "" );
  55. }
  56. this.setAttribute ( "class", status );
  57. this.parentNode.setAttribute("active",status);
  58. };
  59. for (var counter = 0; counter < data.length; counter++) {
  60. list.appendChild ( create ( data[counter][0], data[counter][1], showHide ) );
  61. }
  62. var styles = document.createElement ( "style" );
  63. styles.setAttribute ( "type", "text/css" );
  64. styles.setAttribute ( "id", "NewInlineTierChartsStyles" );
  65. styles.appendChild ( document.createTextNode (
  66. "#NewInlineTierCharts{position:fixed;top:0;left:-65px;z-index:100000;max-height:100%;}" +
  67. "#NewInlineTierCharts:hover,#NewInlineTierCharts[active=\"active\"]{left:0;}" +
  68. "#NewInlineTierCharts.right{left:auto;right:-65px;}" +
  69. "#NewInlineTierCharts.right:hover,#NewInlineTierCharts.right[active=\"active\"]{right:0;}" +
  70. "#NewInlineTierCharts,#NewInlineTierCharts li{margin:0;padding:0;list-style: none;display:block;}" +
  71. "#NewInlineTierCharts li{min-height:0.25em;}" +
  72. "#NewInlineTierCharts img{width:auto;height:auto;display:block;background-color:#fff;}" +
  73. "#NewInlineTierCharts div{width:auto;max-height:100%;display:none;overflow:auto;}" +
  74. "#NewInlineTierCharts button{border-radius:2px;background:#fff;height:auto;font-size: 12px;font-family: monospace;padding:1px;text-align: center;box-sizing: border-box;text-align:center;color:#000;border: 1px solid #000;width:75px;display:block;background-color:#fff;background-image:linear-gradient(to bottom,rgba(255,255,255,0.1),rgba(255,255,255,0.2),rgba(0,0,0,0.1));font-weight:normal;line-height:normal;}" +
  75. "#NewInlineTierCharts .active div{display:block;position:fixed;top:0;left:75px;z-index:100000;max-height:100%;max-width:"+(window.innerWidth-150)+"px;}" +
  76. "#NewInlineTierCharts.right .active div{left:auto;right:75px;}" +
  77. "#NewInlineTierCharts .active button{background:#222;color:#fff;}"
  78. ) );
  79. window.addEventListener('resize',function() {
  80. document.getElementById("NewInlineTierChartsStyles").innerHTML = document.getElementById("NewInlineTierChartsStyles").innerHTML.replace(/(#NewInlineTierCharts .active div\{.*?max-width:)[0-9]+(px;.*?\})/,'$1'+(window.innerWidth-150)+'$2');
  81. });
  82. document.getElementsByTagName ( "head" )[0].appendChild ( styles );
  83. document.getElementsByTagName ( "body" )[0].appendChild ( list );
  84. } ) (
  85. [
  86. [ "", "" ],
  87. [ "Z1-9", "https://vignette.wikia.nocookie.net/imw/images/d/d0/Z1-9.png/revision/latest/scale-to-width-down/618" ],
  88. [ "Small", "https://vignette.wikia.nocookie.net/godra/images/b/b6/Small.png/revision/latest/scale-to-width-down/786" ],
  89. [ "Medium", "https://vignette.wikia.nocookie.net/godra/images/9/96/Medium.png/revision/latest/scale-to-width-down/786" ],
  90. [ "Large", "https://vignette.wikia.nocookie.net/godra/images/7/71/Large.png/revision/latest/scale-to-width-down/786" ],
  91. [ "Epic", "https://vignette.wikia.nocookie.net/godra/images/2/26/Epic.png/revision/latest/scale-to-width-down/786" ],
  92. [ "Colossal", "https://vignette.wikia.nocookie.net/godra/images/2/24/Collossal.png/revision/latest/scale-to-width-down/786" ],
  93. [ "Gigantic", "https://vignette.wikia.nocookie.net/godra/images/3/37/Gigantic.png/revision/latest/scale-to-width-down/786" ],
  94. [ "Elite", "https://vignette.wikia.nocookie.net/godra/images/7/7b/Elites.png/revision/latest/scale-to-width-down/786" ],
  95. [ "Deadly", "https://vignette.wikia.nocookie.net/godra/images/8/88/Deadlies.png/revision/latest/scale-to-width-down/786" ],
  96. [ "", "" ],
  97. [ "Old Guild", "https://vignette.wikia.nocookie.net/imw/images/2/2a/Guild_old.png/revision/latest/scale-to-width-down/426" ],
  98. [ "Guild 1/2", "https://vignette.wikia.nocookie.net/imw/images/5/5c/Guild1.png/revision/latest/scale-to-width-down/786" ],
  99. [ "Guild 2/2", "https://vignette.wikia.nocookie.net/godra/images/9/9d/Guild_II.png/revision/latest/scale-to-width-down/786" ],
  100. [ "", "" ],
  101. [ "BoB Map", "https://vignette.wikia.nocookie.net/imw/images/f/f0/BoB.png/revision/latest/scale-to-width-down/666" ],
  102. [ "MaM Map", "https://vignette.wikia.nocookie.net/imw/images/2/22/MaM.png/revision/latest/scale-to-width-down/666" ],
  103. [ "GD Map", "https://vignette.wikia.nocookie.net/imw/images/5/55/GD.png/revision/latest/scale-to-width-down/666" ],
  104. [ "GoC Map", "https://vignette.wikia.nocookie.net/imw/images/3/30/GoC.png/revision/latest/scale-to-width-down/666" ],
  105. [ "FW Map", "https://vignette.wikia.nocookie.net/imw/images/3/38/FW.png/revision/latest/scale-to-width-down/666" ],
  106. [ "NQ Map", "https://vignette.wikia.nocookie.net/imw/images/0/01/NMQ.png/revision/latest/scale-to-width-down/666" ],
  107. [ "RT Map", "https://vignette.wikia.nocookie.net/imw/images/2/24/RT.png/revision/latest/scale-to-width-down/688" ],
  108. [ "BHH Map", "https://vignette.wikia.nocookie.net/godra/images/4/49/BHH.png/revision/latest/scale-to-width-down/665" ],
  109. [ "CC Map", "https://vignette.wikia.nocookie.net/godra/images/9/9f/CC.png/revision/latest/scale-to-width-down/664" ],
  110. [ "IH Map", "https://vignette.wikia.nocookie.net/imw/images/c/ce/IH.png/revision/latest/scale-to-width-down/608" ],
  111. [ "SoB Map", "https://vignette.wikia.nocookie.net/godra/images/2/29/SoB.png/revision/latest/scale-to-width-down/608" ],
  112. [ "DC Map", "https://vignette.wikia.nocookie.net/imw/images/f/f5/DC.png/revision/latest/scale-to-width-down/608" ]
  113. ]
  114. );