Zum Inhalt dieser Seite

Greasemonkey-Skripte

Weiter unten sind die in meiner Firefox-Konfiguration verwendeten und selbst geschriebenen bzw. veränderten Greasemonkey-Skripte aufgeführt.
  • Icon für Abschnitt erweitern/schliessen - erweitert/schliesst den Code-Abschnitt.
  • Icon für Markiervorgang - markiert den Code-Abschnitt, um ihn bequemer kopieren zu können.
  • Icon für Download - lädt das Skript herunter bzw. installiert dieses im Firefox.

Nach oben fxforumnewtab.user.js

Gepostete Links werden in einem neuen Tab geöffnet.
Abschnitt erweitern/schliessen Code markieren  Download Dauerhaft aktiviert  Ist auch auf userscripts.org zu finden
// ==UserScript==
// @name         FxForumNewTab
// @namespace    http://userscripts.org/people/5587
// @description  Opens posted links in new tabs
// @source       http://userscripts.org/scripts/show/49555
// @identifier   http://userscripts.org/scripts/source/49555.user.js
// @version      1.01
// @date         2009-05-19
// @creator      Arne Dieckmann (aka "Mithrandir")
// @include      http://www.camp-firefox.de/forum/*
// ==/UserScript==
 
var res = document.evaluate("//div[@class='content']/a|//blockquote/div/a", document, null,
                            XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE , null);
for(var i = 0; i < res.snapshotLength; i++) {
  var elem = res.snapshotItem(i);
  elem.target = "_blank";
}

Nach oben googleblank.user.js

Ersetzt auf google das Attribut target="nw" durch target="_blank" und verbessert damit das Verhalten beim Öffnen der Suchergebnisse (ansonsten wird der letzte Tab überschrieben).
Abschnitt erweitern/schliessen Code markieren  Download Dauerhaft aktiviert
// ==UserScript==
// @name         googleBlank
// @version      0.8
// @homepage     http://www.ardiman.de
// @description  Ersetzt auf google das Attribut target="nw" durch target="_blank" und verbesssert damit
//  das Verhalten beim Oeffnen der Suchergebnisse (ansonsten wird der letzte Tab ueberschrieben).
// @author       Arne Dieckmann
// @namespace    http://www.ardiman.de/assets/files/firefox/googleblank.user.js
// @include      *www.google*
// ==/UserScript==
 
(function (){
 
	var a = window.document.getElementsByTagName("a");
	var regTarget = /^(nw)$/i;
	for (i=0;i<a.length;i++) {
		if (a[i].target.match(regTarget)) {
			a[i].setAttribute("target","_blank"); 
		}
	}
 
}());
 
 

Nach oben kennytranslator.user.js

Übersetzt Text in das, was Kenny von South Park sagen würde und zurück. Das Übersetzungsfenster erscheint bei Textmarkierung und auf Klick mit gleichzeitig gehaltener Alt-Taste
Abschnitt erweitern/schliessen Code markieren  Download Nur bei Bedarf aktiviert  Ist auch auf userscripts.org zu finden
// ==UserScript==
// @name         Kenny Translator
// @namespace    http://userscripts.org/people/5587
// @description  Translates text into what Kenny from South Park would say and back again. A translation window appears when you click selected text with the alt key pressed.
// @source       http://userscripts.org/scripts/show/15987
// @identifier   http://userscripts.org/scripts/source/15987.user.js
// @version      0.1
// @date         2007-12-08
// @creator      Arne Dieckmann (aka "Mithrandir")
// @include      *
// @exclude      http://www.namesuppressed.com/kenny/
// ==/UserScript==
 
 
(function () {
 function kenny_it(text){
   kenny="";
   for(i=0;i<text.length;i++){
     item=text.charAt(i);
     if((item>="a" && item<="z")||(item>="A" && item<="Z")){
       if(item>="a"){
         offset=97;
         }else{
         offset=65;
        }
        char=((item.charCodeAt(0)-offset).toString(3));
        if(char.length<3){
          do {
            char="0"+char;
          } while (char.length<3);
        }
        for(j=0;j<3;j++){
          n=char.charAt(j);
          if(j==0 && offset==65){     
            kenny=kenny+["M","P","F"][n];
            }else{
            kenny=kenny+["m","p","f"][n];
          }
        }
        }else{
          kenny=kenny+item;
      }
    }
  return (kenny);
}
 
 
function kenny_said(text){
  output="";
  upper=false;
  do{
    item=text.charAt(0);
    n="mpfMPF".indexOf(item);
    if(n != -1){
      if(n>2){
        upper=true;
        n-=3;
      }
      for(i=0;i<2;i++){            
        text=text.substring(1,text.length);
        char=text.charAt(0);
        n=n*10+"mpf".indexOf(char);
      }
      item=String.fromCharCode(parseInt(n,3)+97);
      if(upper){
        item=item.toUpperCase();
        upper=false;
      }
    }
    text=text.substring(1,text.length);
    output=output+item;
    }while(text != "")
  return(output);
}
 
 
var from, to;
from = "K";
to = "O";
var defaultTranslation = from + "_" + to;
 
 
//provides to make visible kenny fish box only when mouse up and alt key pressed
//or provides to hide kenny fish box when user click out of box
window.addEventListener('mouseup', function(mouseEvent) {
	var boxLeft = window.kennySpeak.offsetLeft;
	var boxRight = boxLeft + window.kennySpeak.offsetWidth;
	var boxTop = window.kennySpeak.offsetTop;
	var boxBottom = boxTop + window.kennySpeak.offsetHeight;
 
	if (window.kennySpeak.style.display == "inline"
			&& (mouseEvent.pageX < boxLeft
					|| mouseEvent.pageX > boxRight
					|| mouseEvent.pageY < boxTop
					|| mouseEvent.pageY > boxBottom)) {
		window.kennySpeak.stopCapture();
	} else if (window.getSelection() != '' && mouseEvent.altKey) {
		window.kennySpeak.psychicalWavesCapture(mouseEvent, window.getSelection());
	}
}, true);
 
//create kenny fish object and box instance. make it unvisible on start
function engagekennySpeak() {
	//set global css
	var head, style;
	head = document.getElementsByTagName('head')[0];
	if (!head) { alert('ugh'); }
	style = document.createElement('style');
	style.type = 'text/css';
	style.innerHTML = "span.gmkennyTranslatorToolBar {margin: 1px; border: 1px dotted gray; padding: 0px 5px 0px 5px;}";
	head.appendChild(style);
 
	var kennySpeak = document.createElement("div");
	kennySpeak.id = "gmkennySpeak";
	kennySpeak.translationFrom = from;
	kennySpeak.translationTo = to;
	kennySpeak.fish_imgSrc = "data:image/gif;base64,R0lGODlhEAAQAOe8AHRDIXRFI3VFI3RGJHZGI3dGIndGJHZHI3VHJnpHI3dIJnlIJHZJKH1HInxOLo5KG45LG5VPG5VPHJhQHINXN55RGIhaNqNTGahTFqlUF4deP41fOrBVE7NVEb9UDYlmSrhYFbpYE8JXDb9YEMFaEYtsVctbC71gHM1cDsVgGddcCdZdCNxbBthdCNRfCttcB9ZeCtNgC9xdCN9cBtVhCd1fB99eCOBeBuBeB91gBt1gB9xhB%2BBgCONfBsFqLN9iCelgBehiBehjBuVlCO1iBfBjBOpmBe9kBaJ8V%2FBkBO1mBfJkA%2FNkA%2FFlBPNkBOtoBvBmBPJlBPNlA%2FNlBO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F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FyH5BAEAAP8ALAAAAAAQABAAAAj%2BAP8JFLjozhs3dRANXPhP0RcsWbBogVjmEMNAWTJq1OLFSxZAAxt16aJlyIgTKWCIMYMGjSGBa7o8qXAAiaVJGx7QQEMmzT9GYqhAGNCHFCdNlSg0cMFlTKI9aEwAKEEr1ypVuRwhuGCEjB04ZjoQ%2BJMLUqpcklAxmKBDDJs2YDgE0JMrlytcr2o5iJADjRo6W0QI%2BACLFahTuSIZyLBjTJxCV15IUJCnUydPmDQUiFFDC6F%2FToiowLAAz6ZHFhKEWDFGjMBBS4CwEILCBwgSP1ooCeNn4JwpUWbg8MDDxo0tY%2BQs5FNkipQeMqowqRLFiqCBlLRoOXIESpAmUZIHHNFy5tO%2FgAA7";
	kennySpeak.supportedTranslations = {
		"O_K" : "Original in Kenny",
		"K_O" : "Kenny in Original"
	}
 
	//hides the kennyspeak box
	kennySpeak.stopCapture = function() {
		this.style.display = "none";
	}
 
	//capture selected text and show the kennyspeak box near the pointer
	kennySpeak.psychicalWavesCapture = function(mouseEvent, selectedText) {
		if (this.style.display == "none") {
			this.style.display = "inline";
			this.kennySpeakImage.style.display = "inline";
			this.style.left = (mouseEvent.pageX - 20).toString(10) + 'px';
			this.style.top  = (mouseEvent.pageY - 5).toString(10) + 'px';
			this.kennyTextSpan.value = selectedText;
		}
	}
 
	//translate the code and after set box properties
	kennySpeak.defecates = function () {
		this.kennySpeakImage.src = this.fish_imgSrc;
		if (kennySpeak.translationFrom == "K") {
	   	var t= kenny_said(this.kennyTextSpan.value);
	    } else {
		  var t= kenny_it(this.kennyTextSpan.value);
	  }
 
	  window.kennySpeak.kennyTextSpan.value = t;
		window.kennySpeak.kennySpeakImage.src = window.kennySpeak.fish_imgSrc;
	}
 
	// kenny fish box style properties 
	kennySpeak.style.border = "1px solid #006699";
	kennySpeak.style.display = "none";
	kennySpeak.style.position = "absolute";
	kennySpeak.style.backgroundColor = "#F4F4F4";
	kennySpeak.style.padding = "2px";
	kennySpeak.style.MozBorderRadius = "4px";
	kennySpeak.style.font = "arial";
	kennySpeak.style.fontSize = "12px";
	kennySpeak.style.color = "black";
	kennySpeak.style.textAlign = "left";
	kennySpeak.style.zIndex = "100";
 
	//image button to translate text
	var kennySpeakImg = document.createElement("img");
	kennySpeakImg.src = kennySpeak.fish_imgSrc;
	kennySpeakImg.title = "Click to translate";
	kennySpeakImg.style.border = "none";
	kennySpeakImg.style.cursor = "pointer";
	kennySpeakImg.style.marginBottom = "-3px";
	kennySpeakImg.style.marginLeft = "20px";
	kennySpeakImg.addEventListener('click', function() {kennySpeak.defecates();}, true);
 
	//text to translate/translated text span
	var kennyTextSpan = document.createElement("textarea");
	kennyTextSpan.cols = "40";
	kennyTextSpan.rows = "7";
 
	//close button
	var closeButton = document.createElement("span");
	closeButton.innerHTML = "x";
	closeButton.style.cursor = "pointer";
	closeButton.className = "gmkennyTranslatorToolBar";
	closeButton.title = "Close Kenny Translator";
	closeButton.addEventListener('click', function() {kennySpeak.stopCapture();}, true);
 
	//translation from and to source
	var langsSpan = document.createElement("span");
	langsSpan.refreshData = function() {
	langsSpan.innerHTML = kennySpeak.supportedTranslations[kennySpeak.translationFrom + "_" + kennySpeak.translationTo];
	langsSpan.title = "Click to change direction";
	langsSpan.style.cursor = "pointer";
	}
	langsSpan.className = "gmkennyTranslatorToolBar";
	langsSpan.style.cursor = "default";
	langsSpan.addEventListener('click', function() {
		var temp = kennySpeak.translationTo;
		kennySpeak.translationTo = kennySpeak.translationFrom;
		kennySpeak.translationFrom = temp;
		langsSpan.refreshData();
	}, true);
	langsSpan.refreshData();
 
	//toolbar
	var toolBarDiv = document.createElement("div");
	toolBarDiv.style.borderBottom = "1px solid #cccccc";
	toolBarDiv.style.margin = "2px 0px";
	toolBarDiv.style.paddingBottom = "2px";
 
	//append objects to toolbar
	toolBarDiv.appendChild(closeButton);	
	toolBarDiv.appendChild(langsSpan);
	toolBarDiv.appendChild(kennySpeakImg);
 
	//put html objects into kennyspeak box
	kennySpeak.appendChild(toolBarDiv);
	kennySpeak.appendChild(kennyTextSpan);
 
	//set objects into kennyspeak instance
	kennySpeak.kennySpeakImage = kennySpeakImg
	kennySpeak.kennyTextSpan = kennyTextSpan;
	kennySpeak.kennyLangLabel = langsSpan;
 
	window.kennySpeak = kennySpeak;
	document.body.insertBefore(window.kennySpeak, document.body.firstChild);
}
 
engagekennySpeak();
 
})();

Nach oben showmoreextensions.user.js

Zeigt auf AMO mehr Erweiterungen pro Seite an.
Abschnitt erweitern/schliessen Code markieren  Download Dauerhaft aktiviert  Ist auch auf userscripts.org zu finden
// ==UserScript==
// @name         showMoreExtensions
// @namespace    http://userscripts.org/people/5587
// @description  Shows more extensions on AMO by default
// @source       http://userscripts.org/scripts/show/23710
// @identifier   http://userscripts.org/scripts/source/23710.user.js
// @version      1.04
// @date         2009-06-13
// @creator      Arne Dieckmann (aka "Mithrandir")
// @include      https://addons.mozilla.org*
// ==/UserScript==
 
(function (){
 
// left navigation:
 var res = document.evaluate("//ul[@id='categoriesdropdown']/li/ul/li/a", document, null,
                            XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE , null);
// var res = document.evaluate("//a[contains(@href,'cat:')]", document, null,
//                             XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE , null);
for(var i = 0; i < res.snapshotLength; i++) {
  var elem = res.snapshotItem(i);
  elem.href = elem.href +'?sort=name&show=100';
}
 
 
// search:
var res = document.evaluate("//form[@id='search-form']", document, null,
                            XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE , null);
for(i = 0; i < res.snapshotLength; i++) {
  var elem = res.snapshotItem(i);
  var inp = document.createElement("input");
  inp.setAttribute("type", "hidden");
  inp.setAttribute("name", "show");
  inp.setAttribute("value", "100");
  elem.appendChild(inp);
}
 
 
// advanced search:
var res = document.evaluate("//select[@id='pp']/option", document, null,
                            XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE , null);
for(i = 0; i < res.snapshotLength; i++) {
  var elem = res.snapshotItem(i);
  elem.removeAttribute("selected");
  if (i==4) {
    elem.setAttribute("selected", "selected");
  }
}
}());

Nach oben softwrapper.user.js

Verändert bei Textfeldern das Attribut "wrap" von "off" auf "soft". Auf SelfHTML lässt sich der Effekt testen.
Abschnitt erweitern/schliessen Code markieren  Download Nur bei Bedarf aktiviert  Ist auch auf userscripts.org zu finden
// ==UserScript==
// @name         softWrapper
// @namespace    http://userscripts.org/people/5587
// @description  Changes textareas with wrap="off" to wrap="soft"
// @source       http://userscripts.org/scripts/show/17062
// @identifier   http://userscripts.org/scripts/source/17062.user.js
// @version      0.2
// @date         2008-02-17
// @creator      Arne Dieckmann (aka "Mithrandir")
// @include      *
// ==/UserScript==
 
// Code by Malte Kraus
 
(function (){
 
var res = document.evaluate("//textarea[@wrap='off']", document, null,
                            XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE , null);
for(var i = 0; i < res.snapshotLength; i++) {
  var elem = res.snapshotItem(i);
  elem.setAttribute("wrap", "soft");
  var next = elem.nextSibling;
  var parent = elem.parentNode;
  parent.removeChild(elem);
  parent.insertBefore(elem, next);
}
}());
Home