Expand collapsed GitHub code blocks

Adds click event and distinct hover style to collapsed code indicator

2020-06-09 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

// ==UserScript==
// @name        Expand collapsed GitHub code blocks
// @namespace   http://tampermonkey.net/
// @description Adds click event and distinct hover style to collapsed code indicator
// @match       https://github.com/*
// @version     1.2
// @grant       GM_addStyle
// ==/UserScript==

// Use with violentmonkey
// https://addons.mozilla.org/en-US/firefox/addon/violentmonkey/
// https://chrome.google.com/webstore/detail/violentmonkey/jinjaccalgkegednnccohejagnlnfdag?hl=en

(function() {
    'use strict';
  
    const expandables = document.querySelectorAll('.js-expandable-line')
    
    expandables.forEach(line => {
      line.style.cursor='pointer'
      line.addEventListener('click', () => {
        line.querySelector('.blob-num-expandable').children[0].click()
      })
    })
    
    GM_addStyle ( `
      .is-hovered.blob-code.blob-code-inner.blob-code-hunk {
          background-color: #ffedde !important;
      }` 
    );
})();