|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 蓝奏云网盘增强 |
3 | | -// @version 1.1.0 |
| 3 | +// @version 1.1.1 |
4 | 4 | // @author X.I.U |
5 | 5 | // @description 刷新不返回根目录、右键文件显示菜单、自动显示更多文件、自动打开分享链接、自动复制分享链接 |
6 | 6 | // @match *://*.lanzous.com/* |
|
143 | 143 | // 右键文件显示菜单 |
144 | 144 | function rightClickMenu() { |
145 | 145 | if(menu_rightClickMenu){ // 脚本菜单开启时才继续 |
146 | | - var folder_list = mainframe.document.getElementById("sub_folder_list"); |
147 | | - if(folder_list){ // 文件夹列表 |
148 | | - folder_list.oncontextmenu = function(e){ |
149 | | - e.preventDefault(); // 屏蔽浏览器自身右键菜单 |
150 | | - let folder_list_ID = e.target.id; |
151 | | - //console.log(e.target.nodeName) |
152 | | - //console.log(e.target.className) |
153 | | - //console.log(e.target.id) |
154 | | - if(e.target.nodeName == "FONT") |
155 | | - { |
156 | | - folder_list_ID = e.target.parentNode.parentNode.id |
157 | | - }else if(e.target.id == ""){ |
158 | | - folder_list_ID = e.target.parentNode.id |
159 | | - } |
160 | | - folder_list_ID = /\d+/.exec(folder_list_ID) |
161 | | - if(folder_list_ID.length > 0){ |
162 | | - mainframe.document.getElementById("folse" + folder_list_ID[0]).focus(); |
163 | | - mainframe.document.getElementById("folse" + folder_list_ID[0]).click(); |
164 | | - } |
| 146 | + rightClickMenu_("sub_folder_list", "fols", "folse") // 文件夹 |
| 147 | + rightClickMenu_("filelist", "fs", "fse") // 文件 |
| 148 | + } |
| 149 | + } |
| 150 | + |
| 151 | + |
| 152 | + // 右键文件显示菜单,参数:文件/文件夹列表 ID、菜单 ID 前缀 |
| 153 | + function rightClickMenu_(list_id_name, menu_id_name_prefix, list_id_name_prefix) { |
| 154 | + let list_ = mainframe.document.getElementById(list_id_name); |
| 155 | + if(list_){ // 文件/文件夹列表 |
| 156 | + list_.oncontextmenu = function(e){ |
| 157 | + e.preventDefault(); // 屏蔽浏览器自身右键菜单 |
| 158 | + let left = e.pageX - 30; // 右键菜单弹出位置 |
| 159 | + let list_ID = e.target.id; |
| 160 | + if(e.target.nodeName == "FONT"){ |
| 161 | + list_ID = e.target.parentNode.parentNode.id |
| 162 | + }else if(e.target.id == ""){ |
| 163 | + list_ID = e.target.parentNode.id |
165 | 164 | } |
166 | | - } |
167 | | - var file_list = mainframe.document.getElementById("filelist"); |
168 | | - if(file_list){ // 文件列表 |
169 | | - file_list.oncontextmenu = function(e){ |
170 | | - e.preventDefault(); // 屏蔽浏览器自身右键菜单 |
171 | | - let file_list_ID = e.target.id; |
172 | | - //console.log(e.target.nodeName) |
173 | | - //console.log(e.target.className) |
174 | | - //console.log(e.target.id) |
175 | | - if(e.target.nodeName == "FONT") |
176 | | - { |
177 | | - file_list_ID = e.target.parentNode.parentNode.id |
178 | | - }else if(e.target.id == ""){ |
179 | | - file_list_ID = e.target.parentNode.id |
180 | | - } |
181 | | - file_list_ID = /\d+/.exec(file_list_ID) |
182 | | - if(file_list_ID.length > 0){ |
183 | | - mainframe.document.getElementById("fse" + file_list_ID[0]).focus(); |
184 | | - mainframe.document.getElementById("fse" + file_list_ID[0]).click(); |
185 | | - } |
| 165 | + list_ID = /\d+/.exec(list_ID) |
| 166 | + if(list_ID.length > 0){ |
| 167 | + mainframe.document.getElementById(menu_id_name_prefix + list_ID[0]).style.cssText="position: absolute !important; left: " + left + "px;" // 修改右键菜单弹出位置(X) |
| 168 | + mainframe.document.getElementById(list_id_name_prefix + list_ID[0]).focus(); |
| 169 | + mainframe.document.getElementById(list_id_name_prefix + list_ID[0]).click(); |
186 | 170 | } |
187 | 171 | } |
188 | 172 | } |
189 | 173 | } |
190 | 174 |
|
191 | 175 |
|
192 | | - // 自动显示更多文件 |
| 176 | + // 自动显示更多文件(后台页) |
193 | 177 | function fileMore() { |
194 | 178 | let filemore = mainframe.document.getElementById("filemore"); // 寻找 [显示更多文件] 按钮 |
195 | 179 | if(filemore && filemore.style.display == "block"){ // 判断按钮是否存在且可见 |
|
200 | 184 | } |
201 | 185 |
|
202 | 186 |
|
203 | | - // 自动显示更多文件 |
| 187 | + // 自动显示更多文件(分享链接列表页) |
204 | 188 | function fileMoreS() { |
205 | 189 | let filemore = document.getElementById("filemore"); // 寻找 [显示更多文件] 按钮 |
206 | 190 | if(filemore && filemore.style.display != "none"){ // 判断按钮是否存在且可见 |
|
0 commit comments