Skip to content

Instantly share code, notes, and snippets.

@pallih
Created December 13, 2017 13:14
Show Gist options
  • Save pallih/9ebc694daf7835042261374467a67617 to your computer and use it in GitHub Desktop.
Save pallih/9ebc694daf7835042261374467a67617 to your computer and use it in GitHub Desktop.
Greasemonkey/Tampermonkey skrifta til að bæta tengli á teikningar við fundargerðir byggingarfulltrúa í Reykjavík
// ==UserScript==
// @name Fundargerðir byggingafulltrúa með teikningum
// @namespace namespace
// @version 0.1
// @description
// @author pallih
// @match http://gamli.rvk.is/vefur/owa/edutils.parse_page?nafn*
// @grant none
// ==/UserScript==
(function() {
var pattern = /nafn=(BN\d+)/;
var anchors = document.getElementsByTagName('a');
for (i=0; i<anchors.length; i++)
{test = pattern.exec(anchors[i].href);
if (pattern.exec(anchors[i].href) !== null)
{
var foo = document.createTextNode(' ');
var newlink = document.createElement('a');
newlink.href = 'http://teikningar.reykjavik.is/fotoweb/archives/5000-Aðaluppdrættir/?q=' + test[1];
newlink.innerHTML = 'Teikningar';
newlink.target = '_blank';
anchors[i].parentNode.insertBefore(newlink, anchors[i].nextSibling);
anchors[i].parentNode.insertBefore(foo, anchors[i].nextSibling);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment