MyFigureCollection: style thingy and date input

Also switches item info to Japanese

目前为 2018-03-17 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name MyFigureCollection: style thingy and date input
  3. // @namespace https://myfigurecollection.net/profile/darkfader
  4. // @version 0.1
  5. // @description Also switches item info to Japanese
  6. // @author Rafael Vuijk
  7. // //@require http://code.jquery.com/jquery-latest.js
  8. // @match http*://myfigurecollection.net/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. function addGlobalStyle(css) {
  13. var head, style;
  14. head = document.getElementsByTagName('head')[0];
  15. if (!head) { return; }
  16. style = document.createElement('style');
  17. style.type = 'text/css';
  18. style.innerHTML = css;
  19. head.appendChild(style);
  20. }
  21.  
  22. $(document).ready(function() {
  23. 'use strict';
  24.  
  25. var ex = "";
  26.  
  27. addGlobalStyle('.form-label { font-variant: normal !important; }');
  28. addGlobalStyle('.item-object .item-entry.important { font-weight: normal !important; }');
  29. addGlobalStyle('.form .form-field { padding: 2px 2px 2px 2px !important; }');
  30. addGlobalStyle('h1.ellipsis { max-width: 100% !important; text-overflow: initial !important; }');
  31. addGlobalStyle('div.date-chooser { display: none; }');
  32.  
  33. // change date input to text field. unreliable though!
  34. $('a.tbx-window').each(function() {
  35. this.addEventListener('click', function(event) {
  36. setTimeout(function() {
  37. $('input.tbx-date').each(function() {
  38. $(this).attr('type', 'text');
  39. });
  40.  
  41. $('a.toggle').each(function() {
  42. this.addEventListener('click', function(event) {
  43. setTimeout(function() {
  44. $('input.tbx-date').each(function() {
  45. $(this).attr('type', 'text');
  46. });
  47. }, 1000);
  48. });
  49. });
  50. }, 1000);
  51. });
  52. });
  53.  
  54. // Japanese
  55. $('a.item-switch-alphabet').click();
  56.  
  57. $('div.error').each(function() {
  58. $(this).prop('style', 'display: none');
  59. });
  60. $('a.over18').each(function() {
  61. $(this).prop('style', 'display: none');
  62. });
  63. $('div.tbx-toggle-target').each(function() {
  64. $(this).prop('style', '');
  65. });
  66. });