-
Notifications
You must be signed in to change notification settings - Fork 1
/
dm5_img_download.user.js
31 lines (27 loc) · 1.04 KB
/
dm5_img_download.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// ==UserScript==
// @name DM5 image download
// @author Shiaupiau (https://github.com/stu43005)
// @include http://*.dm5.com/*
// @include https://*.dm5.com/*
// @version 1.1
// ==/UserScript==
(function init(func) {
setTimeout(function () {
if (typeof jQuery === 'undefined') {
console.log('[DM5 image download] No jQuery, try again later');
init(func);
return;
}
const script = document.createElement('script');
script.textContent = '(' + func.toString() + ')(window)';
document.body.appendChild(script);
}, 500);
})(function () {
if (!jQuery(".view-main").length) return;
jQuery(".rightToolBar").prepend(`<a href="javascript:void(0);" title="下載圖片" id="img-download-button" class="logo_1" style="display: block !important;transform: rotate(-90deg);" target="_blank"><div class="tip">下載圖片</div></a>`);
const btn = jQuery("#img-download-button");
jQuery(document).on("mousemove touchmove", ".view-main img", function (e) {
const img = e.target;
btn.attr("href", img.src);
});
});