百度翻译的圆角框以及删除广告
当前为
// ==UserScript==
// @name baidu fanyi radius and shadow
// @namespace http://tampermonkey.net/
// @version 0.2
// @description 百度翻译的圆角框以及删除广告
// @author You
// @match https://fanyi.baidu.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function addRadiusAndShadow (className,widthPercent) {
const targetElement = document.getElementsByClassName(className)[0];
handleStyled(targetElement,widthPercent);
};
function handleStyled (targetElement,widthPercent) {
targetElement.style['border-radius']='10px';
targetElement.style['box-shadow']='2px 2px 10px #ccc';
targetElement.style['overflow']='hidden';
if(widthPercent) targetElement.style['width'] = widthPercent+'%';
}
addRadiusAndShadow('trans-left',49.5);
addRadiusAndShadow('trans-right',49.5);
addRadiusAndShadow('history-wrap',99);
addRadiusAndShadow('trans-input-wrap');
//右侧广告
const transRight = document.getElementsByClassName("trans-right")[1];
transRight.parentNode.removeChild(transRight);
//翻译结果
const resultWrap = document.getElementById('left-result-container');
const resultBox = resultWrap.children[0];
handleStyled(resultBox);
})();