Reverts raw image links on danbooru to old format, adds key bind for said links (~)
// ==UserScript==
// @name Danboodu - Old image urls
// @namespace iwsfg
// @version 0.1.6
// @description Reverts raw image links on danbooru to old format, adds key bind for said links (~)
// @author Iwasawafag
// @include http://*.donmai.us/posts/*
// @include https://*.donmai.us/posts/*
// ==/UserScript==
$(function() {
'use strict';
$('#post-information a')
.filter(function(i, el) {
return (/^(?:https?:\/\/[a-z0-9]+\.donmai\.us)?\/(data\/|[a-f0-9/]{5}\/)(__).*?__([a-f0-9]+)\.[a-z]+$/i).test(el.href);
})
.each(function() {
var link = $(this);
var oldHref = $(this).attr('href');
link.attr('href', oldHref.replace(/\/[^\/]*?([^_-]+$)/i, '/$1'));
$(document).keydown(function(e) {
if (e.keyCode === 192) document.location.href = link.attr('href');
});
});
});