Json.cn-clean

json.cn 广告屏蔽

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