AtCoder Hide Editorial

hide editorial

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         AtCoder Hide Editorial
// @namespace    AtCoder
// @version      0.5
// @description  hide editorial
// @author       harurun
// @match        https://atcoder.jp/contests/*/tasks/*/editorial*
// @match        https://atcoder.jp/contests/*/editorial*
// @match        https://atcoder.jp/contests/*/tasks/*
// @license      MIT
// @grant        none
// ==/UserScript==

function usernames() {
  var usr=document.getElementsByClassName("username")
  for(var i=0;i<usr.length;i++){
    usr[i].removeAttribute("href")
    usr[i].textContent="hide editorial"
  }
}

function editional() {
  'use strict';
  var alist=document.getElementsByTagName("a")
  for(var i=0;i<alist.length;i++){
    var target=alist[i]
    var url=target.href
    if(target.textContent==''||url.match('https://www.addtoany.com/.*')||url.match('http://www.timeanddate.com/worldclock/.*')||url.match('https://www.timeanddate.com/worldclock/.*')){
      continue;
    }
    if(url.match('https://youtu.be/.*')||url.match('https://atcoder.jp/contests/.*/editorial/.*')||!(url.match('https://atcoder.jp/.*'))){
      //target.href="javascript:void(0)"
      target.removeAttribute("href")
      target.textContent="hide editorial"
    }
  }
  usernames()
}

function problem() {
  var alist=document.getElementsByTagName("a")
  for(var i=0;i<alist.length;i++){
    var target=alist[i]
    var url=target.href
    if(url.match('https://atcoder.jp/contests/.*/tasks/.*/editorial')||url.match('https://atcoder.jp/contests/*/tasks/*/editorial')){
      target.removeAttribute("href")
      target.textContent="hide editorial"
    }
  }
  usernames()
}

function main() {
  var url=location.href
  if(url.match('https://atcoder.jp/contests/.*/tasks/.*/editorial')){
    //console.log("hide editorial(editorial)")
    editional()
  }else if(url.match('https://atcoder.jp/contests/.*/tasks/.*')||url.match('https://atcoder.jp/contests/.*/tasks/.*?lang=en')){
    //console.log('hide editorial(problem)')
    problem()
  }else if(url.match('https://atcoder.jp/contests/.*/editorial')||url.match('https://atcoder.jp/contests/.*/tasks/.*/editorial')||url.match('https://atcoder.jp/contests/.*/editorial?lang=en')||url.match('https://atcoder.jp/contests/.*/tasks/.*/editorial')){
    //console.log('hide editorial(editorial)')
    editional()
  }
}

main()