如何更改Google栏的链接?[关闭]


9

我正在使用Chrome,并且想更改工具栏的链接,但是我不知道如何操作。它可能是一个Greasemonkey脚本,但我不知道该怎么写。


您是在说要访问Google网站时显示的书签栏还是Google导航栏?
丽贝卡·德森维尔

@Dez是的 关于新的Google黑色栏。
Garmen1778 2012年

谷歌几年前退休了谷歌酒吧。
ale

Answers:


5

重新排列谷歌Apps的菜单栏 userscript应该起到很好的为您服务。

根据需要添加或移动项目看起来相当简单。该脚本所做的只是删除当前列表项,并用新列表项替换它们。

因此,要将Google文档添加到要添加的链接列表中:

newOrderedList.innerHTML += '<li class=gbt><a target="_blank" class="gbzt" href="https://docs.google.com"><span class="gbtb2"></span><span class="gbts">Documents</span></a></li>';

只是或参考完整的用户脚本如下:

// ==UserScript==
// @name          Rearrange Google Apps Menu Bar
// @namespace     http://divergentblue.com
// @version       0.1
// @description   Customizes the google black bar
// @include       *
// ==/UserScript==


function reformatList()
{
    // Remove the OL containing the nav links
    var divContainingOrderedList = document.getElementById('gbz');
    var orderedList = document.getElementById("gbz").getElementsByTagName("ol")[0];
    divContainingOrderedList.removeChild(orderedList);
    var newOrderedList = document.createElement("ol");
    newOrderedList.setAttribute("class", "gbtc");

    // Add Plus
    newOrderedList.innerHTML += '<li class=gbt><a target="_blank" class="gbzt" href="https://plus.google.com"><span class="gbtb2"></span><span class="gbts">+</span></a></li>';
    // Add Gmail
    newOrderedList.innerHTML += '<li class=gbt><a target="_blank" class="gbzt" href="https://mail.google.com"><span class="gbtb2"></span><span class="gbts">Gmail</span></a></li>';
    // Add Voice
    newOrderedList.innerHTML += '<li class=gbt><a target="_blank" class="gbzt" href="https://voice.google.com/"><span class="gbtb2"></span><span class="gbts">Voice</span></a></li>';
    // Add Calendar
    newOrderedList.innerHTML += '<li class=gbt><a target="_blank" class="gbzt" href="https://calendar.google.com/"><span class="gbtb2"></span><span class="gbts">Calendar</span></a></li>';
    // Add Contacts
    newOrderedList.innerHTML += '<li class=gbt><a target="_blank" class="gbzt" href="https://www.google.com/contacts"><span class="gbtb2"></span><span class="gbts">Contacts</span></a></li>';
    // Add Reader
    newOrderedList.innerHTML += '<li class=gbt><a target="_blank" class="gbzt" href="https://reader.google.com"><span class="gbtb2"></span><span class="gbts">Reader</span></a></li>';
    // Add News
    newOrderedList.innerHTML += '<li class=gbt><a target="_blank" class="gbzt" href="https://news.google.com"><span class="gbtb2"></span><span class="gbts">News</span></a></li>';
    // Add Finance
    newOrderedList.innerHTML += '<li class=gbt><a target="_blank" class="gbzt" href="https://finance.google.com"><span class="gbtb2"></span><span class="gbts">Finance</span></a></li>';

    // Add the OL to the DOM
    divContainingOrderedList.appendChild(newOrderedList);
}

reformatList();

这很棒,但是在“ GMail”页面上不起作用。另外,如何保持“更多”下拉列表?
Tipsy

3

我为Chrome创建了一个用户脚本,该用户脚本使用jQuery在Google+之后移动Gmail和日历链接。它使用我的同事tghw的这段代码将jQuery添加到页面中。更新:此版本还添加了Google语音链接

// ==UserScript==
// @name           Reorder Google links
// @namespace      http://adambox.org
// @description    Put the gmail and calendar links right after g+ where they belong
// ==/UserScript==

if (window.location.host.toLowerCase() == "www.google.com" || window.location.host.toLowerCase() == "mail.google.com")
{
    // a function that loads jQuery and calls a callback function when jQuery has finished loading
    function addJQuery(callback) {
      var script = document.createElement("script");
      var sProtocol = window.location.protocol;
      script.setAttribute("src", sProtocol + "//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js");
      script.addEventListener('load', function() {
        var script = document.createElement("script");
        script.textContent = "(" + callback.toString() + ")();";
        document.body.appendChild(script);
      }, false);
      document.body.appendChild(script);
    }

    // the guts of this userscript
    function main() {
        var calendar = $('li.gbt:contains("Calendar")');
        var gplus = $('li.gbt:contains("+Adam")');
        var gmail = $('li.gbt:contains("Gmail")');

        calendar.insertAfter(gplus);
        gmail.insertAfter(gplus);

        var gvoiceLi = document.createElement("li");
        gvoiceLi.className = "gbt";
        gvoiceLi.innerHTML = '<a target="_blank" class="gbzt" href="https://www.google.com/voice"><span class="gbtb2"></span><span class="gbts">Voice</span></a>';
        $(gvoiceLi).insertAfter(calendar);

        var gplay = $('li.gbt:contains("Play")');
        gplay.hide();
    }

    // load jQuery and execute the main function
    addJQuery(main);
}

1

没有脚本,您将无法做到。

我不知道油腻的猴子脚本,但对于chrome用户,chrome网上商店中有一个GTools +扩展程序,可以选择对Google栏链接重新排序。


1

这里有一些使用Greasemonkey的提示。我写脚本的速度非常快,可以做得更好,但可能会有所帮助。有一个示例如何在Google More之后添加自定义链接,以及一个如何删除链接的示例。

如有疑问,请发表评论,我将尝试添加更多代码。

function addEntry()
{
    // If you want to add a link (for example to Google Books)
    if(document.getElementById("gbzc"))
    {
        newItem = document.createElement("li");
        newItem.setAttribute("class", "gbt");
        newItem.innerHTML = '<a target="_blank" class="gbzt" href="http://books.google.com/"><span class="gbtb2"></span><span class="gbts">Books</span></a>';

        topMenu = document.getElementById("gbzc")

        // Get the total menu entries
        var totalEntries = topMenu.getElementsByTagName("li").length;

        // Insert a link to the one before the last
        topMenu.insertBefore(newItem, topMenu.getElementsByTagName("li")[totalEntries]);
    }

    // If you want to remove a link (for example the first link to your Google+ profile)
    if(document.getElementById("gbzc"))
    {
        topMenu = document.getElementById("gbzc")

        // Get the first menu entry
        var child = topMenu.getElementsByTagName("li")[0];

        // Remove it
        topMenu.removeChild(child);
    }
}

setTimeout(addEntry, 0);
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.