You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
801 B
28 lines
801 B
(function() { |
|
// Code Here |
|
const formats = ['jpeg', 'jpg', 'png'] |
|
let links = document.querySelectorAll('a[href]:not([itemprop])'); |
|
|
|
links.forEach(function(link){ |
|
let url = link.getAttribute('href'); |
|
let ext = _getUrlExt(url); |
|
|
|
if(formats.includes(ext)){ |
|
let content = link.textContent; |
|
|
|
if(content != 'Просмотр'){ |
|
let image = document.createElement("img"); |
|
|
|
image.setAttribute('class', 'lorpic'); |
|
image.setAttribute('src', url); |
|
//link.replaceWith(image); |
|
link.appendChild(image); |
|
link.setAttribute('target', '_blank'); |
|
} |
|
} |
|
}); |
|
|
|
function _getUrlExt(url){ |
|
return url.split('.').pop(); |
|
} |
|
})();
|
|
|