PROJET AUTOBLOG


Shaarli - le hollandais volant

Site original : Shaarli - le hollandais volant

⇐ retour index

[JS][Firefox] Script Greasemonkey – Mettre les liens de langues Wiki en rouge

vendredi 3 avril 2015 à 20:39
Sur la partie gauche d’une page Wiki se trouvent les langues disponibles pour un article.
Le script suivant marque en rouge les liens « français » et « anglais » (juste parce que ça me fait chier de passer 3h à chercher ces liens tout le temps).


// ==UserScript==
// @name        Wikipédia langues
// @namespace   wikipedia
// @include     http://*.wikipedia.org/*
// @include     https://*.wikipedia.org/*
// @version     1
// @grant       none
// ==/UserScript==

//injectCSS('#p-lang a[lang="fr"], #p-lang a[lang="en"] { font-weight: bold!important; color:red!important; }');

function addGlobalStyle(css) {
  var head,
  style;
  head = document.getElementsByTagName('head') [0];
  if (!head) {
    return;
  }
  style = document.createElement('style');
  style.type = 'text/css';
  style.innerHTML = css;
  head.appendChild(style);
}
addGlobalStyle('#p-lang a[lang="fr"], #p-lang a[lang="en"] { font-weight: bold!important; color:red!important; }');




(la fonction « injectCSS » ne marche pas, étrangement…)