Greasy Fork is available in English.

GitHub Issues Editor Full Screen

Add a full screen button in the right-top of the github issue editor.

  1. // ==UserScript==
  2. // @name GitHub Issues Editor Full Screen
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Add a full screen button in the right-top of the github issue editor.
  6. // @match https://github.com/*/issues/*
  7. // @grant none
  8. // @author m2kar (m2kar.cn#gmail.com)
  9. // @origin-url https://gist.github.com/m2kar/a9beddbd946dada991e87ed366b9b24e
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Your code here...
  17. // Create a button element
  18. var button = document.createElement("a");
  19. // Set the button text
  20. button.textContent = "";
  21. // Set the button id
  22. button.id = "toggle-div-style-button";
  23. // Set the button style
  24. button.style.marginLeft = "10px";
  25.  
  26.  
  27. var span = document.createElement("span");
  28. // Set the span text
  29. span.textContent = "\u2922"; // Unicode character for full-screen symbol
  30. // Set the span style
  31. span.style.fontSize = "16px";
  32. span.style.lineHeight = "18px";
  33. span.style.textAlign = "center";
  34. // Append the span to the button
  35. button.appendChild(span);
  36.  
  37. // Get the element with id="slash-issue_body"
  38. var slash = document.getElementById("slash-issue_body");
  39. // Insert the button after the slash element
  40. slash.parentNode.insertBefore(button, slash.nextSibling);
  41.  
  42. // Add a click event listener to the button
  43. button.addEventListener("click", function() {
  44. // Get all div elements with the specified class name
  45. var divs = document.getElementsByClassName("timeline-comment color-bg-default hx_comment-box--tip");
  46. // Loop through the divs and toggle their style attribute
  47. for (var i = 0; i < divs.length; i++) {
  48. // If the div has the original style, change it to the new style
  49. if (divs[i].getAttribute("style") === null || divs[i].getAttribute("style") === "") {
  50. divs[i].setAttribute("style", "position: fixed; height: 100%; width: 100%; left: 0px; top: 0px; z-index: 999;");
  51. }
  52. // If the div has the new style, change it to the original style
  53. else {
  54. divs[i].setAttribute("style", "");
  55. }
  56. }
  57. });
  58. })();