JS and CSS on Feeder. V.2

It helps your life customizing Feeder.

  1. // ==UserScript==
  2. // @name JS and CSS on Feeder. V.2
  3. // @version 2.0.0
  4. // @description It helps your life customizing Feeder.
  5. // @author はー / h /
  6. // @match *.x-feeder.info/*
  7. // @grant GM.setValue
  8. // @grant GM.getValue
  9. // @namespace https://greasyfork.org/users/534841
  10. // ==/UserScript==
  11.  
  12. // Remove Ads
  13. $("#main_right div:first").remove();
  14. $("#main_right div:last").remove();
  15.  
  16. // Load Saved Data
  17. (async () => {
  18. let css_first = await GM.getValue("css_save");
  19. let js_first = await GM.getValue("js_save");
  20.  
  21. // Add JS Textarea
  22. $("head").append(`<div id="scripts"><script>` + js_first + `</script></div>`)
  23.  
  24. $("#main_right").prepend(`<textarea id="js_code" style="width: 300px; height: 250px; margin-bottom: 8px;">` + js_first + `</textarea>`);
  25.  
  26. $(function() {
  27. $('textarea[id="js_code"]').keyup(function() {
  28. const js_code = $("#js_code").val();
  29. $("#scripts").append("<script>" + js_code + "</script>");
  30. $("#scripts").empty();
  31. });
  32. });
  33.  
  34. // Add CSS Textarea
  35. $("head").append(`<style type="text/css" id="css">` + css_first + `</style>`);
  36.  
  37. $("#main_right").prepend(`<textarea id="css_code" style="width: 300px; height: 250px; margin-bottom: 8px;">` + css_first + `</textarea>`);
  38.  
  39. $(function() {
  40. $('textarea[id="css_code"]').keyup(function() {
  41. const css_code = $("#css_code").val();
  42. $("#css")[0].innerHTML = css_code ;
  43. });
  44. });
  45.  
  46. })();
  47.  
  48. // Add Description
  49. $("#feeder_links_frame").after(`
  50. <div id="about_this_script">
  51. Save: Ctrl + S<br>
  52. Load: Ctrl + L
  53. </div>
  54. `);
  55.  
  56. // Input It in CSS Textarea If You Want
  57. /*
  58. div#about_this_script{
  59. background-color: #FFFFFF;
  60. margin-bottom: 8px;
  61. padding: 4px;
  62. border-radius: 8px;
  63. dispray: block;
  64. }
  65. */
  66.  
  67. // Save ( Ctrl + S )
  68. $(window).keydown(function (e) {
  69. if (event.shiftKey) {
  70. if (e.keyCode === 83) {
  71. (async () => {
  72. await GM.setValue('css_save', $("#css_code").val());
  73. await GM.setValue('js_save', $("#js_code").val());
  74. alert("Your code is saved !");
  75. })();
  76. }
  77. }
  78. });
  79.  
  80. // Load ( Ctrl + L )
  81. $(window).keydown(function (e) {
  82. if (event.shiftKey) {
  83. if (e.keyCode === 76) {
  84. (async () => {
  85. let css_load = await GM.getValue('css_save');
  86. let js_load = await GM.getValue('js_save');
  87. $("#css_code").val(css_load);
  88. $("#js_code").val(js_load);
  89. alert("Loaded !")
  90. })();
  91. }
  92. }
  93. });