Json.cn-clean

json.cn 广告屏蔽

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

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

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         Json.cn-clean
// @namespace    http://tampermonkey.net/
// @version      0.1.0
// @description  json.cn 广告屏蔽
// @author       半块苹果
// @match        https://www.json.cn/**
// @grant        none
// @license MIT
// ==/UserScript==

window.onload = function () {
  // 全屏
  const bodyElement = document.querySelector('body');
  bodyElement.classList.add('format-fullscreen');

  // 添加 placeholder
  var j = document.getElementById('json-src');
  var alt = '在这里输入 json 数据';
  if (j) {
    j.setAttribute('placeholder', alt);
  }

  // 移除广告和弹窗
  var topLinkArea = document.getElementsByClassName('top-link-area');
  var dialog = document.getElementsByClassName('modal-dialog');
  if (topLinkArea) {
    topLinkArea[0].parentNode.removeChild(topLinkArea[0]);
  }
  if (dialog) {
    dialog[0].parentNode.removeChild(dialog[0]);
  }
};