Skip to content

Commit f6b5aaa

Browse files
committed
优化 代码(自动无缝翻页相关)
1 parent db1025e commit f6b5aaa

5 files changed

+12
-22
lines changed

Diff for: 3dm-Enhanced.user.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,8 @@
288288
// 修改自 https://greasyfork.org/scripts/14178 , https://github.com/machsix/Super-preloader
289289
var ShowPager = {
290290
getFullHref: function (e) {
291-
if(e == null) return '';
292-
'string' != typeof e && (e = e.getAttribute('href'));
293-
var t = this.getFullHref.a;
294-
return t || (this.getFullHref.a = t = document.createElement('a')), (t.href = e), t.href;
291+
if (e != null && e.nodeType === 1 && e.href && e.href.slice(0,4) === 'http') return e.href;
292+
return '';
295293
},
296294
createDocumentByString: function (e) {
297295
if (e) {

Diff for: 52pojie-Enhanced.user.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,8 @@
277277
function showPager() {
278278
ShowPager = {
279279
getFullHref: function (e) {
280-
if(e == null) return '';
281-
'string' != typeof e && (e = e.getAttribute('href'));
282-
var t = this.getFullHref.a;
283-
return t || (this.getFullHref.a = t = document.createElement('a')), (t.href = e), t.href;
280+
if (e != null && e.nodeType === 1 && e.href && e.href.slice(0,4) === 'http') return e.href;
281+
return '';
284282
},
285283
createDocumentByString: function (e) {
286284
if (e) {

Diff for: Hostloc-Enhanced.user.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,8 @@
567567
// 修改自 https://greasyfork.org/scripts/14178 , https://github.com/machsix/Super-preloader
568568
var ShowPager = {
569569
getFullHref: function (e) {
570-
if(e == null) return '';
571-
'string' != typeof e && (e = e.getAttribute('href'));
572-
var t = this.getFullHref.a;
573-
return t || (this.getFullHref.a = t = document.createElement('a')), (t.href = e), t.href;
570+
if (e != null && e.nodeType === 1 && e.href && e.href.slice(0,4) === 'http') return e.href;
571+
return '';
574572
},
575573
createDocumentByString: function (e) {
576574
if (e) {

Diff for: V2ex-Enhanced.user.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@
325325
if (event.target==this) {
326326
if (document.querySelector('.box.reply-box-sticky')) {
327327
document.getElementById('undock-button').click();
328-
}else{
328+
} else {
329329
let _top = document.body.scrollTop + document.documentElement.scrollTop;
330330
document.getElementById('reply_content').focus();
331331
window.scrollTo(0,_top);console.log(_top);
@@ -336,7 +336,7 @@
336336
/*document.getElementById('reply_233').onclick = function () {
337337
if (document.querySelector('.box.reply-box-sticky')) {
338338
document.getElementById('undock-button').click();
339-
}else{
339+
} else {
340340
let _top = document.body.scrollTop + document.documentElement.scrollTop;
341341
document.getElementById('reply_content').focus();
342342
window.scrollTo(0,_top);console.log(_top);
@@ -405,10 +405,8 @@
405405
// 修改自 https://greasyfork.org/scripts/14178 , https://github.com/machsix/Super-preloader
406406
var ShowPager = {
407407
getFullHref: function (e) {
408-
if(e == null) return '';
409-
'string' != typeof e && (e = e.getAttribute('href'));
410-
var t = this.getFullHref.a;
411-
return t || (this.getFullHref.a = t = document.createElement('a')), (t.href = e), t.href;
408+
if (e != null && e.nodeType === 1 && e.href && e.href.slice(0,4) === 'http') return e.href;
409+
return '';
412410
},
413411
createDocumentByString: function (e) {
414412
if (e) {

Diff for: Zhiyoo-Enhanced.user.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,8 @@
352352
// 修改自 https://greasyfork.org/scripts/14178 , https://github.com/machsix/Super-preloader
353353
var ShowPager = {
354354
getFullHref: function (e) {
355-
if(e == null) return '';
356-
'string' != typeof e && (e = e.getAttribute('href'));
357-
var t = this.getFullHref.a;
358-
return t || (this.getFullHref.a = t = document.createElement('a')), (t.href = e), t.href;
355+
if (e != null && e.nodeType === 1 && e.href && e.href.slice(0,4) === 'http') return e.href;
356+
return '';
359357
},
360358
createDocumentByString: function (e) {
361359
if (e) {

0 commit comments

Comments
 (0)