Json.cn-clean

json.cn 广告屏蔽

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

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