Munzee Convert

Show the name of each type

目前为 2019-03-04 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Munzee Convert
  3. // @version 0.6
  4. // @description Show the name of each type
  5. // @author rabe85
  6. // @match https://www.munzee.com/m/*/*
  7. // @grant none
  8. // @namespace https://gf.qytechs.cn/users/156194
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function munzee_convert() {
  15.  
  16. // Show the credits in page-header (not for greenies)
  17. var type = document.getElementsByClassName('pull-left pin')[0];
  18. if(type) {
  19. var type_src = document.getElementsByClassName('pull-left pin')[0].getAttribute('src');
  20. }
  21. var class_type = document.getElementsByClassName('type')[0];
  22. if(class_type) {
  23. if(type_src.split("/")[type_src.split("/").length - 1] != "munzee.png") document.getElementsByClassName('page-header')[0].getElementsByTagName('h2')[0].innerHTML += " - Credits: " + document.getElementsByClassName('type')[0].getElementsByTagName('h5')[0].innerHTML;
  24. }
  25.  
  26. // Add title + alt tag to current pin
  27. if(type) {
  28. var current_pin_name = type_src.split("/")[type_src.split("/").length - 1].replace(/_/g," ");
  29. var current_pin_name_formatted = current_pin_name.substr(0, current_pin_name.length-4).charAt(0).toUpperCase() + current_pin_name.substr(0, current_pin_name.length-4).slice(1);
  30. if(current_pin_name_formatted == "Virtual") current_pin_name_formatted += " white"; // add 'white' to uncolored virtuals
  31. document.getElementsByClassName('pull-left pin')[0].setAttribute('title', current_pin_name_formatted);
  32. document.getElementsByClassName('pull-left pin')[0].setAttribute('alt', current_pin_name_formatted);
  33. }
  34.  
  35. // Add names, remove credits
  36. if(class_type) {
  37. var colors0 = document.getElementsByClassName('col-lg-1 col-xs-6 col-sm-1 col-md-1 type');
  38. for(var c = 0, colors; !!(colors=colors0[c]); c++) {
  39. colors.setAttribute('style', 'width: 16.66%;');
  40. var color_name = colors.querySelector('input[name="type"]').getAttribute('value');
  41. if(color_name !== null) {
  42. var color_name_formatted = "";
  43. if(color_name.substr(0, 8) == "virtual_") color_name_formatted = color_name.substr(8).replace(/_/g," ").charAt(0).toUpperCase() + color_name.substr(8).replace(/_/g," ").slice(1);
  44. else color_name_formatted = color_name.replace(/_/g," ").charAt(0).toUpperCase() + color_name.replace(/_/g," ").slice(1);
  45. colors.getElementsByTagName('a')[0].setAttribute('title', color_name_formatted);
  46. colors.getElementsByTagName('img')[0].setAttribute('alt', color_name_formatted);
  47. colors.getElementsByTagName('img')[0].setAttribute('style', 'width: 75px;');
  48. colors.getElementsByTagName('img')[0].insertAdjacentHTML("afterend", "<div style='white-space: nowrap; margin-bottom: 20px; margin-top: 5px;'>" + color_name_formatted + "</div>");
  49. if(type_src.split("/")[type_src.split("/").length - 1] != "munzee.png") colors.getElementsByTagName('h5')[0].remove(); // not for greenies
  50. else colors.getElementsByTagName('h5')[0].setAttribute('style', 'margin-bottom: 30px; margin-top: 0px;');
  51. }
  52. }
  53. }
  54.  
  55. }
  56.  
  57.  
  58. // DOM vollständig aufgebaut?
  59. if (/complete|interactive|loaded/.test(document.readyState)) {
  60. munzee_convert();
  61. } else {
  62. document.addEventListener("DOMContentLoaded", munzee_convert, false);
  63. }
  64.  
  65. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址