// ==UserScript==
// @name 在 bing词典 中聚合显示 有道 的结果 添加转跳至 linggle 的按钮
// @namespace http://tampermonkey.net/
// @version 3.02
// @license MIT
// @description 1. Display youdao.com results alongside the original results on bing.com/dict. 2. Provide a shortcut for linggle.
// @author 庶民player
// @match *.bing.com/dict*
// @icon https://cn.bing.com/sa/simg/favicon-2x.ico
// @require https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js
// @run-at document-idle
// @compatible edge
// @compatible chrome
// @grant none
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
var wd = "none"
var qry = window.location.search.substring(1);
var vals = qry.split('&');
for(var i in vals){
var pair = vals[i].split('=');
if(pair[0] == "q") wd = pair[1];
}
//-=-=-=-=-=-=-=-=-=-=-=-=-以下显示linggle按钮-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
const button = document.createElement('button');
button.className = 'btn btn-sm';
$(button).css({
"border":"0",
"background-color":"transparent",
"cursor": "pointer",
"position": "absolute",
"left": ($("#b_header").position().left + 50) +"px",
"top": ($("#b_header").position().top + $("#b_header").height() - 12) + "px",
});
button.innerHTML = `
`;
button.onclick = function click_linggle() {
location.href = "https://www.linggle.com/?q=" + wd;
}
document.body.append(button);
//-=-=-=-=-=-=-=-=-=-=-=-=-=-以下显示有道-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
if(wd.length > 50) return;
var youdao_top_padding = 190;
var youdao_left_padding = 120;
var youdao_width = 640;
var bing_width = $(".lf_area").width(); //532
var margin = window.innerWidth -youdao_width -bing_width;
$("#b_footer").css("display", "none");
$(".sidebar").css("display", "none");
$(".lf_area").css({
"position": "absolute",
"left": parseInt(margin * 0.34)+"px",
});
let m = `