UD Scale

Betrays the weight of things

当前为 2014-11-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name UD Scale
  3. // @namespace http://www.cursedtower.com/dem
  4. // @version 1.0
  5. // @description Betrays the weight of things
  6. // @include http://urbandead.com/*
  7. // @include http://www.urbandead.com/*
  8. // @grant
  9. // ==/UserScript==
  10.  
  11. /* Urban Dead Scale
  12. * v1.0
  13. *
  14. * Copyright (C) 2014 Dr Heward
  15. * Author: Elaine M Heward (MEMS) aka Ayelis
  16. * Last Modified: 2014-04-27
  17. *
  18. * Tested under: Firefox 28 on Windows
  19. *
  20. * Changes:
  21. * v1.0 - Now works in Firefox
  22. *
  23. */
  24.  
  25. var drops = document.evaluate("//select[@name='drop']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  26.  
  27. for(var i=0;i<drops.snapshotLength;i++){
  28. drop = drops.snapshotItem(i);
  29. for(j=0;j<drop.options.length;j++){
  30. if(drop.options[j].value!="")
  31. drop.options[j].text=drop.options[j].text+" - "+getWeight(drop.options[j].value)+"%";
  32. }
  33. }
  34.  
  35. function getWeight(item){
  36. switch(item.substring(0,1)){
  37. case "a": case "c": case "e": case "f":
  38. case "g": case "h": case "j": case "k":
  39. case "l": case "m": case "n": case "r":
  40. case "t": case "x": case "y": case "z":
  41. val=2;
  42. break;
  43. case "b": case "B": case "d": case "D":
  44. case "F": case "p": case "q": case "u":
  45. case "w":
  46. val=4;
  47. break;
  48. case "o": case "s":
  49. val=6;
  50. break;
  51. case "i":
  52. val=10;
  53. break;
  54. default:
  55. switch(item){
  56. case "G6":
  57. val=0;
  58. break;
  59. case "J1":
  60. val=16;
  61. break;
  62. case "G2": case "G3": case "G4": case "J2":
  63. val=2;
  64. break;
  65. case "I39":
  66. val=6;
  67. break;
  68. default:
  69. val=20;
  70. }
  71. }
  72. return val;
  73. }