添加移动端楼主标记支持
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name NGA优化摸鱼体验插件-移动端支持
|
// @name NGA优化摸鱼体验插件-移动端支持
|
||||||
// @namespace https://github.com/lifegpc/userscript/tree/master/NGA_BBS_plugins/MobileSupport
|
// @namespace https://github.com/lifegpc/userscript/tree/master/NGA_BBS_plugins/MobileSupport
|
||||||
// @version 1.0.3
|
// @version 1.0.4
|
||||||
// @author lifegpc
|
// @author lifegpc
|
||||||
// @description 支持移动端页面
|
// @description 支持移动端页面
|
||||||
// @license MIT
|
// @license MIT
|
||||||
@@ -24,6 +24,11 @@
|
|||||||
key: 'showPostReadingRecord',
|
key: 'showPostReadingRecord',
|
||||||
title: '显示帖子浏览记录标记',
|
title: '显示帖子浏览记录标记',
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'authorMark',
|
||||||
|
title: '标记楼主',
|
||||||
|
default: true
|
||||||
}],
|
}],
|
||||||
buttons: [],
|
buttons: [],
|
||||||
beforeSaveSettingFunc(settings) {
|
beforeSaveSettingFunc(settings) {
|
||||||
@@ -36,6 +41,9 @@
|
|||||||
if (typeof this.pluginSettings['showPostReadingRecord'] === 'string') {
|
if (typeof this.pluginSettings['showPostReadingRecord'] === 'string') {
|
||||||
this.pluginSettings['showPostReadingRecord'] = false;
|
this.pluginSettings['showPostReadingRecord'] = false;
|
||||||
}
|
}
|
||||||
|
if (typeof this.pluginSettings['authorMark'] === 'string') {
|
||||||
|
this.pluginSettings['authorMark'] = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
currentThread: {},
|
currentThread: {},
|
||||||
async renderThreadsFunc($el) {
|
async renderThreadsFunc($el) {
|
||||||
@@ -52,9 +60,9 @@
|
|||||||
$el.find('.c2 > a').attr('style', markStyle)
|
$el.find('.c2 > a').attr('style', markStyle)
|
||||||
}
|
}
|
||||||
if (postReadingRecord.pluginSettings['replyCountEnable'] && recordCount > -1 && currentCount > recordCount) {
|
if (postReadingRecord.pluginSettings['replyCountEnable'] && recordCount > -1 && currentCount > recordCount) {
|
||||||
$el.find('.c2 > span[id^=t_pc]').append(`<span class="hld__new-reply-count-${postReadingRecord.pluginSettings['replyCountStyle']}">${currentCount-recordCount}</span>`)
|
$el.find('.c2 > span[id^=t_pc]').append(`<span class="hld__new-reply-count-${postReadingRecord.pluginSettings['replyCountStyle']}">${currentCount - recordCount}</span>`)
|
||||||
}
|
}
|
||||||
this.currentThread[tid] = {currentCount}
|
this.currentThread[tid] = { currentCount }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -77,12 +85,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.pluginSettings['authorMark']) {
|
||||||
|
const $ = this.mainScript.libs.$;
|
||||||
|
const authorMark = this.mainScript.getModule('AuthorMark');
|
||||||
|
if (authorMark) {
|
||||||
|
const author = $('#postauthor0.userlink').text().replace('楼主', '');
|
||||||
|
const tid = authorMark.getQueryString('tid')
|
||||||
|
const authorStr = `${tid}:${author}`
|
||||||
|
if (author && !authorMark.postAuthor.includes(authorStr) && !window.location.href.includes('authorid')) {
|
||||||
|
authorMark.postAuthor.unshift(authorStr) > 10 && authorMark.postAuthor.pop()
|
||||||
|
this.mainScript.setValue('hld__NGA_post_author', authorMark.postAuthor.join(','))
|
||||||
|
}
|
||||||
|
$el.find('a.b').each(function () {
|
||||||
|
const name = $(this).attr('hld-mark-before-name') || $(this).text().replace('[', '').replace(']', '')
|
||||||
|
if (name && authorMark.postAuthor.includes(`${tid}:${name}`)) {
|
||||||
|
$(this).append('<span class="hld__post-author">楼主</span>')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
style: ``
|
style: ``
|
||||||
}
|
}
|
||||||
registerPlugin(MobileSupport)
|
registerPlugin(MobileSupport)
|
||||||
|
|
||||||
})(function(plugin) {
|
})(function (plugin) {
|
||||||
plugin.meta = GM_info.script
|
plugin.meta = GM_info.script
|
||||||
unsafeWindow.ngaScriptPlugins = unsafeWindow.ngaScriptPlugins || []
|
unsafeWindow.ngaScriptPlugins = unsafeWindow.ngaScriptPlugins || []
|
||||||
unsafeWindow.ngaScriptPlugins.push(plugin)
|
unsafeWindow.ngaScriptPlugins.push(plugin)
|
||||||
|
|||||||
Reference in New Issue
Block a user