github-search-helper

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

目前為 2024-07-08 提交的版本,檢視 最新版本

// ==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')
    }
  })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址