Benutzer:Flominator/js/Grabsteine
Zur Navigation springen
Zur Suche springen
Greasemonkey-Skript zum optimierten Dateneingabe im Grabstein-Projekt:
// ==UserScript==
// @name Gravestone input
// @namespace http://grabsteine.genealogy.net
// @description A basic example of Greasemonkey that causes an alert at each page load.
// @match http://grabsteine.genealogy.net/*
// @include http://grabsteine.genealogy.net/
// ==/UserScript==
//add copy surname links
if(document.getElementById('sur1')!=null)
{
i=0;
do
{
insert_link_before('span', 'sur'+i, "<a href=\"#\" onClick=\"document.getElementById('sur"+i+"').value=document.getElementsByTagName('table')[5].getElementsByTagName('b')[0].innerHTML + ''\">↳</a>");
i++;
}while(document.getElementById('sur'+i)!=null)
}
/*
//scrollable picture list
if((window.location + "").search(/action=edit/) != -1 || (window.location + "").search(/action=add/) != -1)
{
var pictureTable = document.getElementsByTagName("table")[6];
if(pictureTable.innerHTML.search(/Nachname/)!=-1)
{
pictureTable = document.getElementsByTagName("table")[7]
}
pictureTable.parentNode.innerHTML = '<div style="overflow-y: scroll; height:600px; border:thin">' + pictureTable.parentNode.innerHTML +"</div>";
}*/
killLinkNodes = new Array();
editLinkNodes = new Array();
for (var i=0; aNode = document.getElementsByTagName("a")[i]; i++)
{
//change arrow link to first grave that actually contains data
if(aNode.accessKey=="v")
{
aNode.href = document.getElementsByName("tomb")[0].value;
continue;
}
//change arrow link to first grave that actually contains data
if(aNode.accessKey=="n")
{
aNode.href = document.getElementsByName("tomb")[1].value;
continue;
}
//do not ask again when deleting datasets
if(aNode.href.search(/action=drop/) != -1)
{
killLinkNodes.push(aNode);
aNode.href = aNode.href.replace(/action=drop/, "drop=ok");
if(killLinkNodes.length == 1)
{
aNode.accessKey="k";
}
continue;
}
//collect edit links for shortcuts
if(aNode.href.search(/action=edit/) != -1)
{
editLinkNodes.push(aNode);
if(editLinkNodes.length > 1 && editLinkNodes.length <= 10)
{
aNode.innerHTML = aNode.innerHTML + editLinkNodes.length;
}
if(editLinkNodes.length==1)
{
aNode.accessKey="e";
}
continue;
}
//add shortcut for updating pictures
if(aNode.href.search(/update_form/) != -1)
{
aNode.accessKey="u";
continue;
}
}
if(killLinkNodes.length > 1)
{
killLinkNodes[killLinkNodes.length-1].accessKey="-";
}
for (var i=1; i<=10 && i< editLinkNodes.length; i++)
{
editLinkNodes[i].accessKey="" + (i+1);
}
if(document.getElementsByName('ziel_tomb')[0]!=null)
{
document.getElementsByName('ziel_tomb')[0].focus();
}
if(document.getElementsByName('userfile')[0]!=null)
{
document.getElementsByName('userfile')[0].focus();
}
//Insert any tag before any element with an id
function insert_link_before(tagname, previous_element, linkcode)
{
var vl_logout = document.getElementById(previous_element);
if (vl_logout)
{
var ins_li = document.createElement(tagname);
ins_li.innerHTML=/* */linkcode;/* */
vl_logout.parentNode.insertBefore(ins_li, vl_logout);
}
}