Skip to content

Commit a96f8e8

Browse files
committed
checkbox for dac
1 parent e3ce516 commit a96f8e8

2 files changed

Lines changed: 29 additions & 13 deletions

File tree

DownloadAllContent/DownloadAllContent.user.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// @name:zh-TW 怠惰小説下載器
55
// @name:ja 怠惰者小説ダウンロードツール
66
// @namespace hoothin
7-
// @version 2.8.3.8
7+
// @version 2.8.3.9
88
// @description Lightweight web scraping script. Fetch and download main textual content from the current page, provide special support for novels
99
// @description:zh-CN 通用网站内容爬虫抓取工具,可批量抓取任意站点的小说、论坛内容等并保存为TXT文档
1010
// @description:zh-TW 通用網站內容爬蟲抓取工具,可批量抓取任意站點的小說、論壇內容等並保存為TXT文檔
@@ -788,6 +788,7 @@ if (window.top != window.self) {
788788
`);
789789
dacLinksCon = filterListContainer.querySelector("#dacLinksCon");
790790
shadowContainer = document.createElement("div");
791+
shadowContainer.id = "download-all-content";
791792
document.body.appendChild(shadowContainer);
792793
let shadow = shadowContainer.attachShadow({ mode: "open" });
793794
shadow.appendChild(listStyle);

Select All Checkboxes/Select All Checkboxes.user.js

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
// @name:zh-CN 多选框伴侣
44
// @name:zh-TW 多選框伴侶
55
// @namespace hoothin
6-
// @version 0.6.1
6+
// @version 0.6.2
77
// @description A mate for checkbox, select all checkboxes by press Ctrl+Alt+mouse1, or select checkboxes with mouse over by press Alt, or select checkboxes between 2 marks by press Shift.
88
// @description:zh-CN Ctrl+Alt点击全选多选框,Alt加鼠标悬停选择多选框,Shift选择两个多选框之间的所有多选框
99
// @description:zh-TW Ctrl+Alt點擊全選多選框,Alt加鼠標懸停選擇多選框,Shift選擇兩個多選框之間的所有多選框
1010
// @author Hoothin
1111
// @include http*://*/*
12-
// @require http://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js
12+
// @require https://unpkg.com/jquery@3.7.1/dist/jquery.min.js
1313
// @grant GM_registerMenuCommand
1414
// @grant GM.registerMenuCommand
1515
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=rixixi@sina.com&item_name=Greasy+Fork+donation
@@ -46,19 +46,31 @@
4646
}
4747

4848
var preObj;
49-
$(document).on("mousedown",selector,function (event) {
49+
var mouseDownHandler = function (event) {
50+
let self = this, doc = document;
51+
if (this.shadowRoot && this.shadowRoot.activeElement) {
52+
if (this.shadowRoot.activeElement.type != "checkbox" || !/^input$/i.test(this.shadowRoot.activeElement.nodeName)) {
53+
return;
54+
} else {
55+
self = this.shadowRoot.activeElement;
56+
doc = this.shadowRoot;
57+
}
58+
}
5059
if(!event.shiftKey&&event.altKey&&event.ctrlKey){
51-
$(selector).click();
52-
this.click();
60+
$(selector, doc).click();
61+
self.click();
5362
}else if(event.shiftKey&&!event.altKey&&!event.ctrlKey){
54-
var curParent=this;
63+
var curParent=self;
5564
var preParent=preObj;
5665
for(var i=0;i<5;i++){
5766
curParent=curParent.parentNode;
5867
preParent=preParent.parentNode;
59-
if(!curParent||!preParent)return;
68+
if(!curParent||!preParent) {
69+
preObj=self;
70+
return;
71+
}
6072
if(curParent==preParent){
61-
var target=this;
73+
var target=self;
6274
var find=false;
6375
$(curParent).find(selector).each(function(){
6476
if(this==preObj||this==target){
@@ -75,11 +87,14 @@
7587
}
7688
}
7789
}
78-
preObj=this;
79-
});
80-
$(document).on("mouseenter",selector,function (event) {
90+
preObj=self;
91+
};
92+
var mouseEnterHandler = function (event) {
8193
if(!event.shiftKey&&event.altKey&&!event.ctrlKey){
8294
this.click();
8395
}
84-
});
96+
};
97+
$(document).on("mousedown", selector, mouseDownHandler);
98+
$(document).on("mouseup", "#download-all-content", mouseDownHandler);
99+
$(document).on("mouseenter", selector, mouseEnterHandler);
85100
})();

0 commit comments

Comments
 (0)