/*
* @title ++img-src
* @description bulk replace linked images to link-to images
* @include http://*
* @include https://*
* @contributor unarist http://let.hatelabo.jp/unarist/let/hJmev5Xw3b9Y (Fork of)
* @license MIT License http://opensource.org/licenses/MIT
* @javascript_url
*/
(function() {
'use strict';
Array.prototype.slice.call(document.body.querySelectorAll([
'a[href] > img[src]'
])).forEach(function(img) {
if (!img.src) return;
var link = img.parentElement;
if (/\.(?:jpe?g|png|gif)(?:\?|$)/i.test(link.href)) {
img.src = link.href;
}
});
// TBD observe auto-paging
})();
// similar script tree
// http://let.hatelabo.jp/os0x/let/gYC-xpO_gdLBCA
// http://let.hatelabo.jp/os0x/let/gYC-xpO93uu1BA
// `- http://let.hatelabo.jp/noromanba/let/hLHX5oTN2bUh
// `- http://let.hatelabo.jp/noromanba/let/hLHUyPWq9N0p