Created
March 29, 2013 09:06
-
-
Save sylwit/5269691 to your computer and use it in GitHub Desktop.
Userscript for customizing Google navbar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Custom Google Menu 2 | |
| // @namespace http://witmeyer.me | |
| // @description Custom Google Menu 2 | |
| // @include /^https?://www\.google\.(com|fr)// | |
| // @grant none | |
| // @version 1 | |
| // ==/UserScript== | |
| (function() { | |
| var settings = [ | |
| { label: 'Adwords', url: 'https://adwords.google.com/um/StartNewLogin?sourceid=awo&subid=ww-fr-et-newAC1' }, | |
| { label: 'Analytics', url: 'https://www.google.com/analytics/home/?hl=fr&authuser=0'}, | |
| { label: 'TagManager', url: 'https://www.google.com/tagmanager'}, | |
| { label: 'Google s\'engage', url: 'https://www.engageforagencies.com/fr/tableau-de-bord/'}, | |
| { label: 'GWT', url: 'https://www.google.com/webmasters/tools/home?hl=fr'}, | |
| ]; | |
| var execute = function( settings ){ | |
| // ATTRIBUTES | |
| var menuContainer, | |
| createMenu; | |
| // INITIALISATION | |
| menuContainer = document.getElementById('gbzc'); | |
| createMenu = function( menu ) { | |
| var createLink = function( link ) { | |
| return '<li class="gbt"><a href="'+link.url+'" class="gbzt"><span class="gbtb2"></span><span class="gbts">'+link.label+'</span></a></li>'; | |
| } | |
| var str = ''; | |
| for ( var i=0, j=menu.length; i<j; i++ ) { | |
| str += createLink( menu[i] ); | |
| } | |
| return str; | |
| } | |
| // CONSTRUCTOR | |
| if ( menuContainer ) { | |
| menuContainer.innerHTML += createMenu( settings ); | |
| } | |
| } | |
| var script = document.createElement("script"); | |
| script.innerHTML = '(' + execute.toString() + ')( ' + JSON.stringify( settings ) + ');'; | |
| document.head.appendChild(script); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment