您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add buttons to hide sidebar and topbar, inbox and compose. The script is tested on "GMail for domain".
当前为
// ==UserScript== // @name GMail Compact-View with Buttons and Search // @name:pl GMail - kompaktowy widok z przyciskami i paskiem wyszukiwania // @author Jimi // @namespace https://gf.qytechs.cn/pl/users/174756-jimi // @include /^https?:\/\/mail\.google\.com(?:.*)$/ // @version 1.0beta // @description Add buttons to hide sidebar and topbar, inbox and compose. The script is tested on "GMail for domain". // @description:pl Dodaje przyciski do ukrycia paska bocznego i górnego, skrzynki odbiorczej oraz nowej wiadomości. Skrypt testowany na "GMail dla domen". // @grant none // @require http://code.jquery.com/jquery-latest.js // ==/UserScript== $(window).on("load", function() { //config var myBarRight = 450; //try to change the right margin of div with buttons var hideBarsOnStart = true; //config - tooltips var sideBarText = "Show/hide SideBar"; var topBarText = "Sow/hide TopBar"; var inboxButtonText = "INBOX"; var composeButtonText = "Compose"; //end of config :) var composeBtn = document.querySelector('.T-I-KE'); var inboxBtn = document.querySelector('.J-Ke.n0'); $('<div id="my-Bar" style="position: absolute; left: auto; right: '+myBarRight+'px; top: 15px; z-index: 6;"></div>').prependTo($("body")); $('<div id="gm-sideBar" class="T-I J-J5-Ji lR T-I-ax7 T-I-Js-IF ar7" role="button" tabindex="0" aria-haspopup="false" aria-expanded="false" style="-moz-user-select: none;" data-tooltip="'+sideBarText+'"><div class="bjy T-I-J3 J-J5-Ji" style="background: url(//ssl.gstatic.com/ui/v1/icons/mail/sprite_black2.png) -21px -84px no-repeat; width: 21px; height: 21px; transform: rotate(-90deg);"></div></div>').appendTo('#my-Bar'); $('<div id="gm-topBar" class="T-I J-J5-Ji nN T-I-ax7 T-I-Js-Gs T-I-Js-IF ar7" role="button" tabindex="0" aria-haspopup="false" aria-expanded="false" style="-moz-user-select: none;" data-tooltip="'+topBarText+'"><div class="bjy T-I-J3 J-J5-Ji" style="background: url(//ssl.gstatic.com/ui/v1/icons/mail/sprite_black2.png) -21px -84px no-repeat; width: 21px; height: 21px;"></div></div>').insertAfter("#gm-sideBar"); $('<div id="gm-myinbox" class="T-I J-J5-Ji nX T-I-ax7 T-I-Js-Gs T-I-Js-IF ar7" role="button" tabindex="0" aria-haspopup="false" aria-expanded="false" style="user-select: none;" data-tooltip="'+inboxButtonText+'"><div class="bjy T-I-J3 J-J5-Ji" style="background: url(//ssl.gstatic.com/ui/v1/icons/mail/sprite_black2.png) -84px -21px no-repeat; width: 21px; height: 21px;"></div></div>').insertAfter('#gm-topBar'); $('<div id="gm-compo" class="T-I J-J5-Ji m9 T-I-ax7 T-I-Js-Gs ar7" role="button" tabindex="0" aria-haspopup="false" aria-expanded="false" gh="cm" style="user-select: none; color: white; background: -webkit-linear-gradient(top,#4387fd,#4683ea); background: linear-gradient(top,#4387fd,#4683ea);" data-tooltip="'+composeButtonText+'"><div class="bjy T-I-J3 J-J5-Ji" style="background: url(//ssl.gstatic.com/ui/v1/icons/mail/skinnable/skinnable_ltr_light_1x.png) -56px -115px no-repeat; width: 21px; height: 21px; -webkit-filter: invert(100%);"></div></div>').insertAfter('#gm-myinbox'); $('#gm-myinbox').hover(function() {$(this).addClass("T-I-JW");}, function() {$(this).removeClass("T-I-JW");}); $('#gm-sideBar').hover(function() {$(this).addClass("T-I-JW");}, function() {$(this).removeClass("T-I-JW");}); $('#gm-topBar').hover(function() {$(this).addClass("T-I-JW");}, function() {$(this).removeClass("T-I-JW");}); $('#gm-compo').hover(function() {$(this).addClass("T-I-JW");}, function() {$(this).removeClass("T-I-JW");}); $("#my-Bar>.T-I").css("padding", "0 0px"); var gmMainView = $('.nH.bkK.nn'), gmMainViewWidth = $('.nH.bkK.nn').width(), sideBar = $(".nH.oy8Mbf.nn.aeN"); var topBar = $(".nH.w-asV.aiw"), div1 = $('.nH.age.apP.aZ6.apk.nn'), div2 = $('.nH.aNW.apk.nn'), div3 = $('.nH.nn .apj'); var he1 = $('[role=banner]'), df1 = $("#gb").children("div:first-child").children("div:nth-child(1)"), db1 = $("#gb").children("div:first-child").children("div:nth-child(2)"); var height1 = he1.height(); var se1 = $('#gbq2'), spad1 = se1.css("padding-top"), swidth1 = se1.css("width"); var se3 = $("#gb").children("div:first-child").children("div:nth-child(3)"), seh3 = se3.css("height"), sew3 = se3.css("width"); var tbheight = topBar.height(); function setSearchLeft () { se3.css("height", "0px").css("left", "calc("+$("#my-Bar").css("left")+" - 16px"+" - 200px)").css("width", "0"); } function checkIcons () { $("[act=1]").find(".Bn").html('<div class="T-I-J3 J-J5-Ji" style="background: transparent url(//ssl.gstatic.com/mail/sprites/general_black-2eb471de5e5ea7371fa18ebc5339694d.png) 0px 291px; width: 22px; height: 21px;" data-tooltip="Oznacz jako przeczytane"></div>'); $("[act=10]").css("background-color", "red"); $("[act=7]").css("background-color", "yellow"); } function topBarHide () { topBar.css("margin-bottom", "0").css("width", "0"); $("#my-Bar").css("top", "4px"); df1.css("display", "none"); db1.css("display", "none"); he1.css("height", "0"); se1.css("padding-top", "4px"); setSearchLeft(); se3l = se3.css("left"); $('.b8.UC > .J-J5-Ji').css("top", "47px"); div1.height(div1.outerHeight()+tbheight); div2.height(div2.outerHeight()+tbheight); div3.height(div3.outerHeight()+tbheight); checkIcons(); } function topBarShow () { topBar.css("margin-bottom", "5px").css("width", "100%"); $("#my-Bar").css("top", "15px"); df1.css("display", "flex"); db1.css("display", "block"); he1.css("height", height1); se1.css("padding-top", spad1); se3.css("height", seh3).css("left", "0").css("width", sew3); se3l = se3.css("left"); $('.b8.UC > .J-J5-Ji').css("top", "0"); div1.height(div1.outerHeight()-tbheight); div2.height(div2.outerHeight()-tbheight); div3.height(div3.outerHeight()-tbheight); } function sideBarHide () { sideBar.css("display", "none"); gmMainView.width("100%"); checkIcons(); } function sideBarShow () { sideBar.css("display", "block"); gmMainView.css("width", gmMainViewWidth); } $("#gb").children("div:first-child").css("height", "0"); $('.nH.bkL > .no').css("width", "100%"); $("#gm-myinbox").click(function() { inboxBtn.click(); }); $("#gm-compo").click(function() { var mousedownEvent = new MouseEvent('mousedown'); composeBtn.dispatchEvent(mousedownEvent); var mouseupEvent = new MouseEvent('mouseup'); composeBtn.dispatchEvent(mouseupEvent); }); $("#gbq").focusin(function() { if (he1.css("height") == "0px") { se3.css("width", sew3); se3.css("left", "calc("+$("#my-Bar").css("left")+" - 16px"+" - "+se3.css("width")+")"); $(".gstl_50.gssb_c").css("left", se3.css("left")); } }); $("#gbq").focusout(function() { if (he1.css("height") == "0px" && $(".ZF-Av").css("visibility") == "hidden") { se3.css("width", "0"); se3.css("left", "calc("+$("#my-Bar").css("left")+" - 16px"+" - 200px)"); $(".gstl_50.gssb_c").css("left", se3.css("left")); } }); $(".aoq").click(function () { if (he1.css("height") == "0px") { se3.css("width", sew3); se3.css("left", "calc("+$("#my-Bar").css("left")+" - 16px"+" - "+se3.css("width")+")"); $(".gstl_50.gssb_c").css("left", se3.css("left")); } }); $(document).on("click", "#gm-sideBar", function() { if(sideBar.css("display") == "none") {sideBarShow();} else {sideBarHide();} }); $(document).on("click", "#gm-topBar", function() { if(he1.css("height") == "0px") {topBarShow();} else {topBarHide();} }); $(".l2.ov").css("padding-bottom", "0px"); checkIcons(); if (hideBarsOnStart) { sideBarHide(); topBarHide(); } $(window).resize(function() { if(sideBar.css("display") == "none") { gmMainView.css("width", "100%"); if (he1.css("height") == "0px") { se3.css("left", "calc("+$("#my-Bar").css("left")+" - 16px"+" - 200px)"); } } gmMainViewWidth = $('.nH.bkK.nn').width(); }); });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址