github-search-helper

在新标签页打开github搜索结果

Ajankohdalta 8.7.2024. Katso uusin versio.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         github-search-helper
// @namespace    github.com/leychan
// @version      0.1
// @description  在新标签页打开github搜索结果
// @author       leychan
// @match        https://github.com/trending
// @match        https://github.com/explore
// @match        https://github.com/search*
// @icon         https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png
// @run-at document-end
// @grant        none
// @license       MIT
// ==/UserScript==

(function() {
    'use strict';
  
    const element = document.querySelector('[data-testid="results-list"]');
    if (element) {
        let allSearchResultATag = element.getElementsByTagName('a')
        for (let i = 0 ;i < allSearchResultATag.length; i++) {
            allSearchResultATag[i].setAttribute('target', '_blank')
        }
    }
    
    let allExploreResultATag = exploreResult.getElementsByTagName('a')
    for (let i = 0 ;i < allExploreResultATag.length; i++) {
        allExploreResultATag[i].setAttribute('target', '_blank')
    }

    let allTrendingResultATag = trendingResult.getElementsByTagName('a')
    for (let i = 0 ;i < allTrendingResultATag.length; i++) {
        allTrendingResultATag[i].setAttribute('target', '_blank')
    }
  })();