Yet Another Weibo Filter

新浪微博根据关键词、作者、话题、来源等过滤微博;修改版面。 新浪微博根據關鍵字、作者、話題、來源等篩選微博;修改版面。 filter Sina Weibo by keywords, authors, topics, sources, etc.; modify layout

当前为 2014-08-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Yet Another Weibo Filter
  3. // @namespace https://github.com/tiansh
  4. // @description 新浪微博根据关键词、作者、话题、来源等过滤微博;修改版面。 新浪微博根據關鍵字、作者、話題、來源等篩選微博;修改版面。 filter Sina Weibo by keywords, authors, topics, sources, etc.; modify layout
  5. // @include http://www.weibo.com/*
  6. // @include http://weibo.com/*
  7. // @exclude http://weibo.com/a/bind/test
  8. // @version 1.1.54
  9. // @supportURL https://tiansh.github.io/yawf/
  10. // @author 田生 http://weibo.com/tsh90
  11. // @copyright 田生; The MIT License
  12. // @license The MIT License (MIT); http://opensource.org/licenses/MIT
  13. // @grant GM_xmlhttpRequest
  14. // @grant GM_setValue
  15. // @grant GM_getValue
  16. // @grant GM_deleteValue
  17. // @grant GM_addStyle
  18. // @grant GM_registerMenuCommand
  19. // @grant GM_info
  20. // @grant unsafeWindow
  21. // @run-at document-start
  22. // ==/UserScript==
  23.  
  24. // 图片
  25. var images = {
  26. 'filter': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAFEUExURUxpcZ6eno6OjpmZmf////v7+/j4+Pr6+vr6+uzs7MvLy8rKyuzs7Ly8vLy8vO7u7r29vb29ve7u7unp6by8vOrq6ufn5+/v776+vry8vO3t7ejo6Ojo6Ovr6+/v7729ve7u7ry8vO/v7+vr6+jo6L6+vu7u7ry8vO/v7+rq6ujo6L6+vu3t7e/v77e3t+vr6+jo6Jubm5qampqamp+fn7m5uezs7MXFxe7u7p2dnZubm5+fn5ycnOzs7L6+vsDAwMLCwsHBwevr6/Ly8vr6+sPDw+3t7e/v78TExMHBwcnJycXFxff39+np6e7u7vPz8/f39/j4+O/v7/T09Ovr6/////Dw8PT09P///9zc3Pn5+fv7+////+3t7f///9ra2v///8DAwOPj49PT0////8LCwtHR0b+/v+Pj48bGxsHBwcfHx0ifhqUAAABsdFJOUwA/Skoauru8u8K7u40sLY8yMYeULoqRijIxjIiNkI42jTWQko86nDaeoJ08sLRKuLQ1Nj8yUL2twEc9Nzq6op6lqbbGn6K/wKymsqmExsO6foDKuMV+wchsm3qmF8l6l2ZWC7oWtrpSCLq2ugo9naEAAAClSURBVBjTY2DAANGsbOzsHEDAzs7G6gIUCI9Ny8rm4ubmykxNDnIGCniFxKczMjEzMzEmRvqaAwUsvYMTMkB6kyL8HYxBDCuPsLgUBgaWUD9HI4ixNp6cUTEsgZx2hjCLrF3dA3zc7E0QVptaONma6SG5RVvXQF9HHUlAVUNLU00RSUBeSUVZQRJJQEJORlaKD0lAQFxaVEgESUCQX0yYh5cBKwAASvgW88X18swAAAAASUVORK5CYII=',
  27. };
  28.  
  29. // 多行字符串
  30. var funcStr = function (f) {
  31. var s = f.toString().split(/\r\n|\r|\n/g).slice(1, -1).join('\n');
  32. return s;
  33. };
  34.  
  35. // 快速创建一段文档元素
  36. var cewih = function (tag, inner) {
  37. var d = document.createElement(tag);
  38. d.innerHTML = inner;
  39. return d;
  40. };
  41.  
  42. var isGecko = navigator.userAgent.indexOf('Gecko') !== -1 &&
  43. navigator.userAgent.indexOf('like Gecko') === -1;
  44.  
  45. // 文本常量
  46. // 请以简体中文为原文,参考这些资料翻译
  47. // http://zh.wikipedia.org/wiki/Template:CGroup/IT
  48. // http://www.microsoft.com/Language/zh-cn/Search.aspx
  49. var text = {
  50. // 基本按钮
  51. 'okButtonTitle': { 'zh-cn': '确定', 'zh-hk': '確定', 'zh-tw': '確定', 'en': 'Confirm' },
  52. 'cancelButtonTitle': { 'zh-cn': '取消', 'zh-hk': '取消', 'zh-tw': '取消', 'en': 'Cancel' },
  53. 'closeButtonTitle': { 'zh-cn': '关闭', 'zh-hk': '關閉', 'zh-tw': '關閉', 'en': 'Close' },
  54. 'configStringsAdd': { 'zh-cn': '添加', 'zh-hk': '新增', 'zh-tw': '新增', 'en': 'Add' },
  55. 'configUsersAdd': { 'zh-cn': '添加', 'zh-hk': '新增', 'zh-tw': '新增', 'en': 'Add' },
  56. 'foldedWeiboText': {
  57. 'zh-cn': '"来自 @" attr(yawf-author) " 的一条微博被折叠,请点击查看"',
  58. 'zh-hk': '"來自 @" attr(yawf-author) " 的一條微博被折疊,請點擊查看"',
  59. 'zh-tw': '"來自 @" attr(yawf-author) " 的一條微博被折疊,請點擊查看"',
  60. 'en': '"A Weibo from @" attr(yawf-author) " was folded, click to view."'
  61. },
  62. 'disabledKey': { 'zh-cn': '(已禁用)', 'zh-hk': '(已停用)', 'zh-tw': '(已停用)', 'en': '(Disabled)' },
  63. // 设置框
  64. 'filter': { 'zh-cn': '过滤器', 'zh-hk': '篩選器', 'zh-tw': '篩選器', 'en': 'Filter' },
  65. 'configDialogTitle': { 'zh-cn': '过滤器设置', 'zh-hk': '篩選器設定', 'zh-tw': '篩選器設定', 'en': 'Filter Settings' },
  66. 'whitelistFilterDesc': { 'zh-cn': '总是显示{{{typed}}}', 'zh-hk': '總是顯示{{{typed}}}', 'zh-tw': '總是顯示{{{typed}}}', 'en': 'Always show {{{typed}}}' },
  67. 'blacklistFilterDesc': { 'zh-cn': '隐藏{{{typed}}}', 'zh-hk': '隱藏{{{typed}}}', 'zh-tw': '隱藏{{{typed}}}', 'en': 'Hide {{{typed}}}' },
  68. 'foldlistFilterDesc': { 'zh-cn': '折叠{{{typed}}}', 'zh-hk': '折疊{{{typed}}}', 'zh-tw': '折疊{{{typed}}}', 'en': 'Fold {{{typed}}}' },
  69. 'whitelistActionDesc': { 'zh-cn': '显示', 'zh-hk': '顯示', 'zh-tw': '顯示', 'en': 'Show' },
  70. 'blacklistActionDesc': { 'zh-cn': '隐藏', 'zh-hk': '隱藏', 'zh-tw': '隱藏', 'en': 'Hide' },
  71. 'foldlistActionDesc': { 'zh-cn': '折叠', 'zh-hk': '折疊', 'zh-tw': '折疊', 'en': 'Fold' },
  72. // 内容
  73. 'contentFilterGroupTitle': { 'zh-cn': '内容', 'zh-hk': '內容', 'zh-tw': '內容', 'en': 'Content' },
  74. // 关键词
  75. 'keywordFilterDesc': { 'zh-cn': '关键词', 'zh-hk': '關鍵字', 'zh-tw': '關鍵字', 'en': 'Keyword' },
  76. 'keywordFilterDetails': { 'zh-cn': '包含以下关键词的微博', 'zh-hk': '包含以下關鍵字的微博', 'zh-tw': '包含以下關鍵字的微博', 'en': 'Weibo with these keywords' },
  77. 'keywordFilterFast': { 'zh-cn': '包含关键词', 'zh-hk': '包含關鍵字', 'zh-tw': '包含關鍵字', 'en': 'Weibo contains keyword ' },
  78. 'keywordFilterFastInput': { 'zh-cn': '“{{text}}”', 'zh-hk': '「{{text}}」', 'zh-tw': '「{{text}}」', 'en': '"{{text}}"' },
  79. // 正则表达式
  80. 'regexpFilterGroupTitle': { 'zh-cn': '正则', 'zh-hk': '正則', 'zh-tw': '正規', 'en': 'Regexp' },
  81. 'regexpFilterDesc': { 'zh-cn': '正则式', 'zh-hk': '正則式', 'zh-tw': '正規式', 'en': 'Regexp' },
  82. 'regexpFilterDetails': { 'zh-cn': '匹配以下正则表达式的微博', 'zh-hk': '匹配以下正則表達式的微博', 'zh-tw': '匹配以下正規表示式的微博', 'en': 'Weibo matches these regular expressions' },
  83. 'regexpFilterFast': { 'zh-cn': '匹配正则式', 'zh-hk': '匹配正則式', 'zh-tw': '匹配正規式', 'en': 'Weibo matches regexp ' },
  84. 'regexpFilterFastInput': { 'zh-cn': '/{{text}}/', 'zh-hk': '/{{text}}/', 'zh-tw': '/{{text}}/', 'en': '/{{text}}/' },
  85. 'regexpFilterRemark': {
  86. 'zh-cn': '正则表达式的过滤方式提供了基于微博内容的高级过滤方式,如果只是需要简单地关键词过滤请使用内容标签页的关键词以获得更好的效率。正则表达式书写时不需要对“/”字符转义。',
  87. 'zh-hk': '正則表達式的篩選方式提供了基於微博內容的高級篩選方式,如果只是需要簡單地關鍵字篩選請使用內容標籤頁的關鍵字以獲得更好的效率。正則表達式書寫時不需要對「/」字符轉義。',
  88. 'zh-tw': '正規表示式的篩選方式提供了基於微博內容的高級篩選方式,如果只是需要簡單地關鍵字篩選請使用內容標籤頁的關鍵字以獲得更好的效率。正規表示式書寫時不需要對「/」字符轉義。',
  89. 'en': 'Regular expression provide advanced filter settings based on content. You may set keywords in Content tab for better performance. You do not need to escape "/" in your regexp.'
  90. },
  91. 'regexpBadFormedTitle': { 'zh-cn': '非法的正则表达式', 'zh-hk': '不合法的正則表達式', 'zh-tw': '不合法的正規表示式', 'en': 'Illegal Regexp' },
  92. 'regexpBadFormed': {
  93. 'zh-cn': '您输入的/{{regexp}}/不能被正确地解析为正则表达式,请检查您的输入。如需关键词屏蔽请到内容标签页设置。',
  94. 'zh-hk': '您输入的/{{regexp}}/不能被正确地解析为正则表达式,请检查您的输入。如需关键词屏蔽请到内容标签页面设置。',
  95. 'zh-tw': '您輸入的/{{regexp}}/不能被正確地解析為正規表示式,請檢查您的輸入。如需關鍵詞屏蔽請到內容標籤頁面設置。',
  96. 'en': 'Cannot parse /{{regexp}}/ as regexp. Please check your input. You may hide Weibo by keywords in Content tab page.'
  97. },
  98. // 其他元素
  99. 'contentTypesTitle': { 'zh-cn': '将以下元素同样作为内容处理', 'zh-hk': '將以下元素同樣作為內容處理', 'zh-tw': '將以下元素同樣作為內容處理', 'en': 'Handle these elements as content' },
  100. 'contentTypesMention': { 'zh-cn': '提到某人', 'zh-hk': '提到某人', 'zh-tw': '提到某人', 'en': 'Mention' },
  101. 'contentTypesTopic': { 'zh-cn': '话题标题', 'zh-hk': '話題標題', 'zh-tw': '話題標題', 'en': 'Topic' },
  102. 'contentTypesLink': { 'zh-cn': '链接地址', 'zh-hk': '連結位址', 'zh-tw': '連結位址', 'en': 'Link target URL' },
  103. 'contentTypesEmotion': { 'zh-cn': '表情备注', 'zh-hk': '表情備註', 'zh-tw': '表情備註', 'en': 'Remark of emotion' },
  104. // 帐号
  105. 'accountFilterGroupTitle': { 'zh-cn': '帐号', 'zh-hk': '帳號', 'zh-tw': '帳號', 'en': 'Account' },
  106. 'accountFilterDesc': { 'zh-cn': '帐号', 'zh-hk': '帳號', 'zh-tw': '帳號', 'en': 'Account' },
  107. 'accountFilterDetails': { 'zh-cn': '来自以下帐号的微博', 'zh-hk': '來自以下帳號的微博', 'zh-tw': '來自以下帳號的微博', 'en': 'Weibo from these accounts' },
  108. 'accountFilterFast': { 'zh-cn': '作者是“@{{name}}”的微博', 'zh-hk': '作者是「@{{name}}」的微博', 'zh-tw': '作者是「@{{name}}」的微博', 'en': 'Weibo by "@{{name}}"', },
  109. 'accountFilterRemark': {
  110. 'zh-cn': '推荐您到<a target="_blank" href="http://account.weibo.com/set/privacy#open=privacy_feeduser">隐私设置 - 屏蔽账号</a>屏蔽您关注了但不想在首页看到的帐号。',
  111. 'zh-hk': '推薦您到<a target="_blank" href="http://account.weibo.com/set/privacy#open=privacy_feeduser">隱私設置 - 屏蔽帐号</a>封鎖您關注了但不想在首頁看到的帳號。',
  112. 'zh-tw': '推薦您到<a target="_blank" href="http://account.weibo.com/set/privacy#open=privacy_feeduser">隱私設置 - 屏蔽帐号</a>封鎖您關注了但不想在首頁看到的帳號。',
  113. 'en': 'You can block Weibo from accounts you followed in the page <a target="_blank" href="http://account.weibo.com/set/privacy#open=privacy_feeduser">Privacy - Block account</a>.'
  114. },
  115. 'accountNotExistErrorTitle': { 'zh-cn': '帐号不存在', 'zh-hk': '帳號不存在', 'zh-tw': '帳號不存在', 'en': 'Account does not exist' },
  116. 'accountNotExistError': { 'zh-cn': '不存在名为{{name}}的账号', 'zh-hk': '不存在名為{{name}}的賬號', 'zh-tw': '不存在名為{{name}}的賬號', 'en': 'Account named {{name}} does not exist' },
  117. // 原创
  118. 'originalFilterGroupTitle': { 'zh-cn': '原创', 'zh-hk': '原創', 'zh-tw': '原創', 'en': 'Original' },
  119. 'originalFilterDesc': { 'zh-cn': '帐号', 'zh-hk': '帳號', 'zh-tw': '帳號', 'en': 'Account' },
  120. 'originalFilterDetails': { 'zh-cn': '原创是以下账号的微博', 'zh-hk': '原創是以下帳號的微博', 'zh-tw': '原創是以下帳號的微博', 'en': 'Hide original Weibo from these accounts' },
  121. 'originalFilterFast': { 'zh-cn': '原创是“@{{name}}”的微博', 'zh-hk': '原創是「@{{name}}」的微博', 'zh-tw': '原創是「@{{name}}」的微博', 'en': 'Original Weibo from "@{{name}}"' },
  122. // 提到
  123. 'mentionFilterGroupTitle': { 'zh-cn': '提到', 'zh-hk': '提到', 'zh-tw': '提到', 'en': 'Mention' },
  124. 'mentionFilterDesc': { 'zh-cn': '帐号', 'zh-hk': '帳號', 'zh-tw': '帳號', 'en': 'Account' },
  125. 'mentionFilterDetails': { 'zh-cn': '提到以下帐号的微博', 'zh-hk': '提到以下帳號的微博', 'zh-tw': '提到以下帳號的微博', 'en': 'Weibo mentioned these accounts' },
  126. 'mentionFilterFast': { 'zh-cn': '提到了“@{{name}}”的微博', 'zh-hk': '提到了「@{{name}}」的微博', 'zh-tw': '提到了「@{{name}}」的微博', 'en': 'Weibo mentioned "@{{name}}"' },
  127. // 话题
  128. 'topicFilterGroupTitle': { 'zh-cn': '话题', 'zh-hk': '話題', 'zh-tw': '話題', 'en': 'Topic' },
  129. 'topicFilterDesc': { 'zh-cn': '话题', 'zh-hk': '話題', 'zh-tw': '話題', 'en': 'Topic' },
  130. 'topicFilterDetails': { 'zh-cn': '包含以下话题的微博', 'zh-hk': '包含以下話題的微博', 'zh-tw': '包含以下話題的微博', 'en': 'Weibo with these topics' },
  131. 'topicFilterFast': { 'zh-cn': '包含“#{{topic}}#”话题的微博', 'zh-hk': '包含「#{{topic}}#」話題的微博', 'zh-tw': '包含「#{{topic}}#」話題的微博', 'en': 'Weibo contained topic "#{{topic}}#"' },
  132. 'rtopicFilterDesc': { 'zh-cn': '正则式', 'zh-hk': '正則式', 'zh-tw': '正規式', 'en': 'Regexp' },
  133. 'rtopicFilterDetails': { 'zh-cn': '包含匹配以下正则表达式的话题的微博', 'zh-hk': '包含匹配以下正則表達式的话题的微博', 'zh-tw': '包含匹配以下正規表示式的话题的微博', 'en': 'Weibo with topic matches these regular expressions' },
  134. // 来源
  135. 'sourceFilterGroupTitle': { 'zh-cn': '来源', 'zh-hk': '來源', 'zh-tw': '來源', 'en': 'Source' },
  136. 'sourceFilterDesc': { 'zh-cn': '来自', 'zh-hk': '來自', 'zh-tw': '來自', 'en': 'Via' },
  137. 'sourceFilterDetails': { 'zh-cn': '以下来源的微博', 'zh-hk': '以下來源的微博', 'zh-tw': '以下來源的微博', 'en': 'Weibo from these sources' },
  138. 'sourceFilterFast': { 'zh-cn': '来自“{{source}}”的微博', 'zh-hk': '來自「{{source}}」的微博', 'zh-tw': '來自「{{source}}」的微博', 'en': 'Weibo via "{{source}}"' },
  139. 'sourceFilterWarningTitle': { 'zh-cn': '默认来源', 'zh-hk': '預設來源', 'zh-tw': '預設來源', 'en': 'Default Source' },
  140. 'sourceFilterWarning': { 'zh-cn': '不能添加默认来源', 'zh-hk': '不能新增預設來源', 'zh-tw': '不能新增預設來源', 'en': 'You cannot add default source' },
  141. // 超链接
  142. 'hyperlinkFilterGroupTitle': { 'zh-cn': '链接', 'zh-hk': '連結', 'zh-tw': '連結', 'en': 'Link' },
  143. 'hyperlinkFilterDesc': { 'zh-cn': '超链接', 'zh-hk': '超連結', 'zh-tw': '超連結', 'en': 'Hyperlink' },
  144. 'hyperlinkFilterDetails': { 'zh-cn': '包含指向以下网站的超链接的微博', 'zh-hk': '包含指向以下站點的超連結的微博', 'zh-tw': '包含指向以下站點的超連結的微博', 'en': 'Weibo with hyperlink to these website' },
  145. 'hyperlinkFilterFast': { 'zh-cn': '包含指向包含“{{host}}”地址链接的微博', 'zh-hk': '包含指向包含「{{host}}」位址連結的微博', 'zh-tw': '包含指向包含「{{host}}」位址連結的微博', 'en': 'Weibo contains hyperlink to "{{host}}"' },
  146. // 更多
  147. 'otherFilterGroupTitle': { 'zh-cn': '更多', 'zh-hk': '其他', 'zh-tw': '其他', 'en': 'More' },
  148. // 显示
  149. 'otherWhitelistTitle': { 'zh-cn': '显示以下内容(不计入白名单)', 'zh-hk': '顯示以下內容(不計入白名單)', 'zh-tw': '顯示以下內容(不計入白名單)', 'en': 'Show following content (not regard as whitelist)' },
  150. 'showMyWeiboDesc': { 'zh-cn': '自己的微博', 'zh-hk': '自己的微博', 'zh-tw': '自己的微博', 'en': 'Weibo by myself' },
  151. 'showMyOriginalDesc': { 'zh-cn': '自己微博的转发', 'zh-hk': '自己微博的轉發', 'zh-tw': '自己微博的轉發', 'en': 'Forward of my Weibo' },
  152. 'showMentionMeDesc': { 'zh-cn': '提到自己的微博', 'zh-hk': '提到自己的微博', 'zh-tw': '提到自己的微博', 'en': 'Weibo mentioned myself' },
  153. // 隐藏
  154. 'otherBlacklistTitle': { 'zh-cn': '隐藏以下内容', 'zh-hk': '隱藏以下內容', 'zh-tw': '隱藏以下內容', 'en': 'Hide following content' },
  155. 'adfeedFilterDesc': { 'zh-cn': '推广微博', 'zh-hk': '推廣微博', 'zh-tw': '推廣微博', 'en': 'Ad Weibo' },
  156. 'recommandFeedDesc': { 'zh-cn': '推荐微博', 'zh-hk': '建議微博', 'zh-tw': '建議微博', 'en': 'Recommended Weibo' },
  157. 'fakeWeiboFilterDesc': { 'zh-cn': '混入微博列表的其它内容', 'zh-hk': '混入微博列表的其它內容', 'zh-tw': '混入微博列表的其它內容', 'en': 'Other contents in Weibo list' },
  158. 'deletedForwardFilterDesc': { 'zh-cn': '已删除微博的转发', 'zh-hk': '已刪除微博的轉發', 'zh-tw': '已刪除微博的轉發', 'en': 'Forward of deleted Weibo' },
  159. 'voteWeiboFilterDesc': { 'zh-cn': '投票微博', 'zh-hk': '投票微博', 'zh-tw': '投票微博', 'en': 'Voting weibo' },
  160. 'taobaoTianmaoWeibo': { 'zh-cn': '带有淘宝或天猫商品的微博', 'zh-hk': '帶有淘寶或天貓商品的微博', 'zh-tw': '帶有淘寶或天貓商品的微博', 'en': 'Weibo with Taobao / Tmall commodity' },
  161. // 刷屏与版聊
  162. 'otherSpammingTitle': { 'zh-cn': '刷屏与版聊', 'zh-hk': '洗版與版聊', 'zh-tw': '洗版與版聊', 'en': 'Spamming &amp; Chatting' },
  163. 'sameAccountFilterDesc': { 'zh-cn': '相同作者的微博:|超过{{<number>}}条|时{{<action>}}', 'zh-hk': '相同作者的微博:|超過{{<number>}}條|時{{<action>}}', 'zh-tw': '相同作者的微博:|超過{{<number>}}條|時{{<action>}}', 'en': 'Weibo from same account: |{{<action>}} the part | which exceeds {{<number>}} Weibo' },
  164. 'sameForwardFilterDesc': { 'zh-cn': '相同微博的转发:|超过{{<number>}}条|时{{<action>}}', 'zh-hk': '相同微博的轉發:|超過{{<number>}}條|時{{<action>}}', 'zh-tw': '相同微博的轉發:|超過{{<number>}}條|時{{<action>}}', 'en': 'Forward from same Weibo: |{{<action>}} the part | which exceeds {{<number>}} Weibo' },
  165. // 分组浏览
  166. 'otherGroupTitle': { 'zh-cn': '分组浏览', 'zh-hk': '分組流覽', 'zh-tw': '分組流覽', 'en': 'Browse by Group' },
  167. 'accountByGroup': { 'zh-cn': '分组浏览时禁用按帐号隐藏', 'zh-hk': '分組流覽時禁用按帳號隱藏', 'zh-tw': '分組流覽時禁用按帳號隱藏', 'en': 'Disable hide by account filter when browsing by group' },
  168. 'sameAccountByGroup': { 'zh-cn': '浏览分组时禁用相同作者数量限制', 'zh-hk': '流覽分組時禁用相同作者數量限制', 'zh-tw': '流覽分組時禁用相同作者數量限制', 'en': 'Disable hide too many Weibo from same account filter when browsing by group' },
  169. // 脚本
  170. 'scriptToolsTitle': { 'zh-cn': '脚本', 'zh-hk': '腳本', 'zh-tw': '腳本', 'en': 'Script' },
  171. 'useFastCreator': { 'zh-cn': '使用拖放快速创建过滤器', 'zh-hk': '使用拖放快速創建篩選器', 'zh-tw': '使用拖放快速創建篩選器', 'en': 'Use drag and drop to create filters' },
  172. 'blockHiddenWeiboDesc': { 'zh-cn': '告知服务器被隐藏的微博以避免再次加载', 'zh-hk': '告知伺服器被隱藏的微博以避免再次載入', 'zh-tw': '告知伺服器被隱藏的微博以避免再次載入', 'en': 'Send blocked Weibo to server to avoid reloading' },
  173. // 自动载入
  174. 'autoLoadNewWeiboTitle': { 'zh-cn': '自动载入新微博', 'zh-hk': '自動載入新微博', 'zh-tw': '自動載入新微博', 'en': 'New Weibo Auto Load' },
  175. 'autoLoadNewWeibo': { 'zh-cn': '自动载入新微博', 'zh-hk': '自動載入新微博', 'zh-tw': '自動載入新微博', 'en': 'New Weibo Auto Load' },
  176. // 分隔条
  177. 'timeTipHour': { 'zh-cn': '小时', 'zh-hk': '小時', 'zh-tw': '小時', 'en': ' hour' },
  178. 'timeTipMin': { 'zh-cn': '分钟', 'zh-hk': '分鐘', 'zh-tw': '分鐘', 'en': ' min' },
  179. 'timeTipText': { 'zh-cn': '前,你看到这里', 'zh-hk': '前,你看到這裡', 'zh-tw': '前,你看到這裡', 'en': ' ago, you see here' /* as is */ },
  180. // 自动展开
  181. 'autoExpand': {
  182. 'zh-cn': '自动载入后直接展开显示||{{<etypes>}}仅对白名单的微博自动展开显示||{{<background>}}页面处于活动状态时暂停',
  183. 'zh-hk': '自動載入後直接展開顯示||{{<etypes>}}僅對白名單的微博自動展開顯示||{{<background>}}頁面處於活動狀態時暫停',
  184. 'zh-tw': '自動載入後直接展開顯示||{{<etypes>}}僅對白名單的微博自動展開顯示||{{<background>}}頁面處於活動狀態時暫停',
  185. 'en': 'Expand Weibo after auto load || {{<etypes>}} Only auto expand whitelist Weibo || {{<background>}} Pause when page actived',
  186. },
  187. 'autoExpandAll': { 'zh-cn': '所有新微博', 'zh-hk': '所有新微博', 'zh-tw': '所有新微博', 'en': 'all new Weibo' },
  188. 'autoExpandWhite': { 'zh-cn': '白名单微博', 'zh-hk': '白名單微博', 'zh-tw': '白名單微博', 'en': 'whitelist Weibo' },
  189. // 桌面提示
  190. 'desktopNotification': {
  191. 'zh-cn': '载入新微博后显示桌面提示||{{<types>}}仅对白名单的微博显示桌面提示||{{<autohide>}}桌面提醒延时自动关闭|显示{{<duration>}}毫秒|+字数×{{<durationc>}}毫秒||{{<ntypes>}}使用 webkitNotifications 而非 Notification',
  192. 'zh-hk': '载入新微博后顯示桌面提示||{{<types>}}僅對白名單的微博顯示桌面提示||{{<autohide>}}桌面提醒延時自動關閉|顯示{{<duration>}}毫秒|+字數×{{<durationc>}}毫秒||{{<ntypes>}}使用 webkitNotifications 而非 Notification',
  193. 'zh-tw': '载入新微博后顯示桌面提示||{{<types>}}僅對白名單的微博顯示桌面提示||{{<autohide>}}桌面提醒延時自動關閉|顯示{{<duration>}}毫秒|+字數×{{<durationc>}}毫秒||{{<ntypes>}}使用 webkitNotifications 而非 Notification',
  194. 'en': 'Show desktop notification after auto load | {{<types>}} Only show desktop notification for whitelist Weibo || {{<autohide>}} auto hide desktop notification after | {{<duration>}}ms | + {{<durationc>}}ms/char || {{<ntypes>}} Use webkitNotifications instead of Notification',
  195. },
  196. 'desktopNotificationDisallowedTitle': { 'zh-cn': '桌面提示被阻止', 'zh-hk': '桌面提示被阻止', 'zh-tw': '桌面提示被阻止', 'en': 'Desktop Notification Disallowed' },
  197. 'desktopNotificationDisallowed': {
  198. 'zh-cn': '您的浏览器阻止了桌面提示。请按照如下步骤解除阻止:<br />右击网页—查看页面信息—权限—显示通知—允许<br />此外,如果您安装了 Tab notifier 等扩展,请到扩展的设置中允许显示桌面提示。',
  199. 'zh-hk': '您的流覽器阻止了桌面提示。請按照如下步驟解除阻止:<br />右擊網頁—檢視頁面資訊—權限—顯示通知—允許<br />此外,如果您安裝了 Tab notifier 等擴充套件,請到擴充套件的設置中允許顯示桌面提示。',
  200. 'zh-tw': '您的流覽器阻止了桌面提示。請按照如下步驟解除阻止:<br />右擊網頁—檢視頁面資訊—權限—顯示通知—允許<br />此外,如果您安裝了 Tab notifier 等擴充套件,請到擴充套件的設置中允許顯示桌面提示。',
  201. 'en': 'Your browser blocked desktop notifications. Please follow the instruction to unblock: <br />Right click webpage - View Page Info - Permission - Notifications - Allow. You should also check settings of extensions, if you installed extensions like Tab notifier.',
  202. },
  203. 'autoCloseWarning': {
  204. 'zh-cn': '当前火狐浏览器提供的 Notification 会强制显示 4 秒后关闭,如果您希望显示较长时间,请考虑使用 Tab notifier 等扩展提供的 webkitNotifications。',
  205. 'zh-hk': '當前火狐流覽器提供的 Notification 會強制顯示 4 秒後關閉,如果您希望顯示較長時間,請考慮使用 Tab notifier 等擴充套件提供的 webkitNotifications。',
  206. 'zh-tw': '當前火狐流覽器提供的 Notification 會強制顯示 4 秒後關閉,如果您希望顯示較長時間,請考慮使用 Tab notifier 等擴充套件提供的 webkitNotifications。',
  207. 'en': 'Currently, Notification provided by Firefox will be mandatorily closed with 4 seconds delay after shown. You may need to use webkitNotifications provided by add-ons like Tab notifier for longer notification display.',
  208. },
  209. // 模块
  210. 'layoutFilterGroupTitle': { 'zh-cn': '模块', 'zh-hk': '模組', 'zh-tw': '模組', 'en': 'Module' },
  211. 'layoutFilterGroupDesc': { 'zh-cn': '隐藏以下模块', 'zh-hk': '隱藏以下模組', 'zh-tw': '隱藏以下模組', 'en': 'Hide following modules' },
  212. // 标识图标
  213. 'layoutHideIcon': { 'zh-cn': '标识/图标', 'zh-hk': '標誌/圖示', 'zh-tw': '標誌/圖示', 'en': 'Logo / Icon' },
  214. 'layoutHideIconLevel': { 'zh-cn': '等级', 'zh-hk': 'Level', 'zh-tw': '等級', 'en': 'Level' },
  215. 'layoutHideIconMember': { 'zh-cn': '微博会员', 'zh-hk': '微博會員', 'zh-tw': '微博會員', 'en': 'Weibo VIP / Member' },
  216. 'layoutHideIconApprove': { 'zh-cn': '个人认证', 'zh-hk': '個人認證', 'zh-tw': '個人認證', 'en': 'Personal Authentication / 個人認證' },
  217. 'layoutHideIconApproveCo': { 'zh-cn': '机构认证', 'zh-hk': '企業認證', 'zh-tw': '企業認證', 'en': 'Weibo Verification / 企業認證' },
  218. 'layoutHideIconClub': { 'zh-cn': '微博达人', 'zh-hk': '微博達人', 'zh-tw': '微博達人', 'en': 'Pioneer' },
  219. 'layoutHideIconVGirl': { 'zh-cn': '微博女郎', 'zh-hk': '微博女郎', 'zh-tw': '微博女郎', 'en': 'Weibo girl' },
  220. 'layoutHideIconTaobao': { 'zh-cn': '淘宝商户', 'zh-hk': '淘寶商戶', 'zh-tw': '淘寶商戶', 'en': 'Taobao Merchant' },
  221. 'layoutHideIconZongyika': { 'zh-cn': '我是综艺咖', 'zh-hk': '我是综艺咖'/* as is */, 'zh-tw': '我是综艺咖', 'en': '我是综艺咖 (Variety Wack)' },
  222. 'layoutHideIconYouji': { 'zh-cn': '邂逅有机', 'zh-hk': '邂逅有机'/* as is */, 'zh-tw': '邂逅有机', 'en': '邂逅有机 (Travel Notes)' },
  223. // 导航栏
  224. 'layoutHideNav': { 'zh-cn': '导航栏', 'zh-hk': '導覽列', 'zh-tw': '導覽列', 'en': 'Navigation Bar' },
  225. 'layoutHideNavMain': { 'zh-cn': '首页', 'zh-hk': '首頁', 'zh-tw': '首頁', 'en': 'Home' },
  226. 'layoutHideNavHot': { 'zh-cn': '热门', 'zh-hk': '熱門', 'zh-tw': '熱門', 'en': 'Hot' },
  227. 'layoutHideNavApp': { 'zh-cn': '应用', 'zh-hk': '應用', 'zh-tw': '應用', 'en': 'Apps' },
  228. 'layoutHideNavGame': { 'zh-cn': '游戏', 'zh-hk': '遊戲', 'zh-tw': '遊戲', 'en': 'Game' },
  229. 'layoutHideNavMember': { 'zh-cn': '会员菜单', 'zh-hk': '會員功能表', 'zh-tw': '會員功能表', 'en': 'VIP Menu' },
  230. // 左栏
  231. 'layoutHideLeft': { 'zh-cn': '左栏', 'zh-hk': '左欄', 'zh-tw': '左欄', 'en': 'Left Column' },
  232. 'layoutHideLeftToMe': { 'zh-cn': '发给我的', 'zh-hk': '發給我的', 'zh-tw': '發給我的', 'en': 'Send to me' },
  233. 'layoutHideLeftFriends': { 'zh-cn': '好友圈', 'zh-hk': '好友圈', 'zh-tw': '好友圈', 'en': 'Friends' },
  234. 'layoutHideLeftApp': { 'zh-cn': '应用', 'zh-hk': '应用', 'zh-tw': '应用'/* as is */, 'en': 'Apps' },
  235. // 中栏
  236. 'layoutHideMiddle': { 'zh-cn': '中栏', 'zh-hk': '中欄', 'zh-tw': '中欄', 'en': 'Middle Column' },
  237. 'layoutHideMiddleRecommendedTopic': { 'zh-cn': '热门微博(发布框上方)', 'zh-hk': '热门微博(發布框上方)', 'zh-tw': '热门微博(發布框上方)'/* as is */, 'en': '热门微博 (Hot Weibo), on top of publishing field' },
  238. 'layoutHideMiddleFeedRecommand': { 'zh-cn': '微博兴趣推荐(顶部)', 'zh-hk': '微博興趣推薦(頂部)', 'zh-tw': '微博興趣推薦(頂部)', 'en': 'Feed Recommendation, top' },
  239. 'layoutHideMiddleMemberTip': { 'zh-cn': '开通会员提示(底部)', 'zh-hk': '開通會員提示(底部)', 'zh-tw': '開通會員提示(底部)', 'en': 'Tip of Joining Weibo VIP, bottom' },
  240. // 右栏
  241. 'layoutHideRight': { 'zh-cn': '右栏', 'zh-hk': '右欄', 'zh-tw': '右欄', 'en': 'Right Column' },
  242. 'layoutHideRightTemplate': { 'zh-cn': '设置模板', 'zh-hk': '背景設定', 'zh-tw': '背景設定', 'en': 'Template Settings' },
  243. 'layoutHideRightInfo': { 'zh-cn': '头像', 'zh-hk': '頭像', 'zh-tw': '頭像', 'en': 'Avatar' },
  244. 'layoutHideRightTrial': { 'zh-cn': '登录赢会员', 'zh-hk': '登录赢会员', 'zh-tw': '登录赢会员'/* as is */, 'en': '登录赢会员 (Login for VIP Trial)' },
  245. 'layoutHideRightAtten': { 'zh-cn': '关注/粉丝/微博数', 'zh-hk': '關注/粉絲/微博數', 'zh-tw': '關注/粉絲/微博數', 'en': 'Numbers of Following/Followers/Weibo' },
  246. 'layoutHideRightInterest': { 'zh-cn': '可能感兴趣的人', 'zh-hk': '可能感興趣的人', 'zh-tw': '可能感興趣的人', 'en': 'You may know' },
  247. 'layoutHideRightHotTopic': { 'zh-cn': '热门话题', 'zh-hk': '熱門話題', 'zh-tw': '熱門話題', 'en': 'Hot Topic' },
  248. 'layoutHideRightMember': { 'zh-cn': '会员专区', 'zh-hk': '會員專區', 'zh-tw': '會員專區', 'en': 'Weibo VIP' },
  249. 'layoutHideRightWeibo': { 'zh-cn': '热门微博', 'zh-hk': '熱門微博', 'zh-tw': '熱門微博', 'en': 'Hot Weibo' },
  250. 'layoutHideRightLocation': { 'zh-cn': '地点推荐', 'zh-hk': '地點推薦', 'zh-tw': '地點推薦', 'en': 'Location' },
  251. 'layoutHideRightMusic': { 'zh-cn': ' 热门歌曲', 'zh-hk': '熱門歌曲', 'zh-tw': '熱門歌曲', 'en': 'Hot Music' },
  252. 'layoutHideRightMovie': { 'zh-cn': '最新电影', 'zh-hk': '最新電影', 'zh-tw': '最新電影', 'en': 'Hot Movie' },
  253. 'layoutHideRightBook': { 'zh-cn': '人气图书', 'zh-hk': '人氣圖書', 'zh-tw': '人氣圖書', 'en': 'Hot Book' },
  254. 'layoutHideRightNotice': { 'zh-cn': '公告栏', 'zh-hk': '公告欄', 'zh-tw': '公告欄', 'en': 'Bulletin Board' },
  255. // 微博内
  256. 'layoutHideWeibo': { 'zh-cn': '微博内', 'zh-hk': '微博內', 'zh-tw': '微博內', 'en': 'In Weibo' },
  257. 'layoutHideWeiboRecomFeed': { 'zh-cn': '精彩微博推荐', 'zh-hk': '精彩微博推薦', 'zh-tw': '精彩微博推薦', 'en': '精彩微博推荐 (Weibo you may interested in)' },
  258. 'layoutHideWeiboTopicCard': { 'zh-cn': '话题卡片', 'zh-hk': '話題卡片', 'zh-tw': '話題卡片', 'en': 'Topic Cards' },
  259. 'layoutHideWeiboFeedTip': { 'zh-cn': '评论框提示横幅', 'zh-hk': '評論框提示橫幅', 'zh-tw': '評論框提示橫幅', 'en': 'Tips for Comment' },
  260. 'layoutHideWeiboTopComment': { 'zh-cn': '热门评论', 'zh-hk': '热门评论', 'zh-tw': '热门评论'/* as is */, 'en': 'Top comments' },
  261. 'layoutHideWeiboSonTitle': { 'zh-cn': '同源转发合并提示', 'zh-hk': '同源转发合并提示', 'zh-tw': '同源转发合并提示', 'en': '同源转发合并 (Merge forwards from same origin)' },
  262. 'layoutHideWeiboLocationCard': { 'zh-cn': '位置卡片', 'zh-hk': '位置卡片', 'zh-tw': '位置卡片', 'en': 'Location Cards' },
  263. 'layoutHideWeiboSource': { 'zh-cn': '来源', 'zh-hk': '來源', 'zh-tw': '來源', 'en': 'Source' },
  264. 'layoutHideWeiboReport': { 'zh-cn': '举报', 'zh-hk': '檢舉', 'zh-tw': '檢舉', 'en': 'Report' },
  265. 'layoutHideWeiboLike': { 'zh-cn': '赞', 'zh-hk': '讚', 'zh-tw': '讚', 'en': 'Like' },
  266. 'layoutHideWeiboForward': { 'zh-cn': '转发', 'zh-hk': '轉發', 'zh-tw': '轉發', 'en': 'Forward' },
  267. 'layoutHideWeiboFavourite': { 'zh-cn': '收藏', 'zh-hk': '收藏', 'zh-tw': '收藏', 'en': 'Favourite' },
  268. 'layoutHideWeiboBlockBySource': { 'zh-cn': '屏蔽来源', 'zh-hk': '屏蔽來源', 'zh-tw': '屏蔽來源', 'en': 'Block Source' },
  269. 'layoutHideWeiboBlockByKeyword': { 'zh-cn': '屏蔽关键词', 'zh-hk': '屏蔽關鍵詞', 'zh-tw': '屏蔽關鍵詞', 'en': 'Block Keywords' },
  270. // 个人主页
  271. 'layoutHidePerson': { 'zh-cn': '个人主页', 'zh-hk': '個人主頁', 'zh-tw': '個人主頁', 'en': 'Ones home page' },
  272. 'layoutHidePersonMoveThings': { 'zh-cn': '移动部件(会员模板)', 'zh-hk': '移動部件(會員模板)', 'zh-tw': '移動部件(會員模板)', 'en': 'Moving Things (VIP Template)' },
  273. 'layoutHidePersonCover': { 'zh-cn': '封面图', 'zh-hk': '封面圖', 'zh-tw': '封面圖', 'en': 'Cover Picture' },
  274. 'layoutHidePersonTemplate': { 'zh-cn': '模板设置', 'zh-hk': '模板設置', 'zh-tw': '模板設置', 'en': 'Template Settings' },
  275. 'layoutHidePersonBadgeIcon': { 'zh-cn': '勋章', 'zh-hk': '勳章', 'zh-tw': '勳章', 'en': 'Badges' },
  276. 'layoutHidePersonStats': { 'zh-cn': '关注/粉丝/微博数', 'zh-hk': '關注/粉絲/微博數', 'zh-tw': '關注/粉絲/微博數', 'en': 'Numbers of Following/Followers/Weibo' },
  277. 'layoutHidePersonMyData': { 'zh-cn': '我的微博人气', 'zh-hk': '我的微博人气', 'zh-tw': '我的微博人气', 'en': '我的微博人气 (My Micro World)' },
  278. 'layoutHidePersonSuggestUser': { 'zh-cn': '可能感兴趣的人', 'zh-hk': '可能感兴趣的人', 'zh-tw': '可能感兴趣的人'/* as is */, 'en': 'Suggested' },
  279. 'layoutHidePersonGroup': { 'zh-cn': '推荐的人', 'zh-hk': '推荐的人', 'zh-tw': '推荐的人'/* as is */, 'en': '推荐的人 (Suggested Group)' },
  280. 'layoutHidePersonRelation': { 'zh-cn': '微关系', 'zh-hk': '微关系', 'zh-tw': '微关系'/* as is */, 'en': 'Relationship' },
  281. 'layoutHidePersonAlbum': { 'zh-cn': '图片', 'zh-hk': '相冊', 'zh-tw': '相冊', 'en': 'Album' },
  282. 'layoutHidePersonHotTopic': { 'zh-cn': '话题', 'zh-hk': '話題', 'zh-tw': '話題', 'en': 'Topic' },
  283. 'layoutHidePersonHotWeibo': { 'zh-cn': '热门微博', 'zh-hk': '熱門微博', 'zh-tw': '熱門微博', 'en': 'Hot Weibo' },
  284. // 杂项
  285. 'layoutHideOther': { 'zh-cn': '杂项', 'zh-hk': '雜項', 'zh-tw': '雜項', 'en': 'Others' },
  286. 'layoutHideOtherAds': { 'zh-cn': '广告', 'zh-hk': '廣告', 'zh-tw': '廣告', 'en': 'Advertisement' },
  287. 'layoutHideOtherFeedRecom': { 'zh-cn': '相关微博推荐', 'zh-hk': '相关推荐', 'zh-tw': '相关推荐', 'en': '相关推荐 (Related Weibo Suggestion)' },
  288. 'layoutHideOtherFooter': { 'zh-cn': '页面底部', 'zh-hk': '頁面底部', 'zh-tw': '頁面底部', 'en': 'Footer' },
  289. 'layoutHideOtherWbIm': { 'zh-cn': '微博桌面推荐(右下)', 'zh-hk': '微博桌面推薦(右下)', 'zh-tw': '微博桌面推薦(右下)', 'en': '微博桌面2014 (Desktop Weibo), bottom right' },
  290. 'layoutHideOtherTip': { 'zh-cn': '功能提示框', 'zh-hk': '功能提示框', 'zh-tw': '功能提示框', 'en': 'Function Tips' },
  291. 'layoutHideOtherIM': { 'zh-cn': '聊天联系人列表', 'zh-hk': '聊天連絡人列表', 'zh-tw': '聊天連絡人列表', 'en': 'IM Side bar' },
  292. // 工具
  293. 'toolFilterGroupTitle': { 'zh-cn': '工具', 'zh-hk': '工具', 'zh-tw': '工具', 'en': 'Tool' },
  294. // 边栏
  295. 'sideColumnToolsTitle': { 'zh-cn': '边栏', 'zh-hk': '邊欄', 'zh-tw': '邊欄', 'en': 'Side Column' },
  296. 'showAllGroupDesc': { 'zh-cn': '展开左栏分组', 'zh-hk': '展開左欄分組', 'zh-tw': '展開左欄分組', 'en': 'Unfold groups in left column' },
  297. 'showAllMsgNavDesc': { 'zh-cn': '展开左栏消息', 'zh-hk': '展開左欄消息', 'zh-tw': '展開左欄消息', 'en': 'Unfold news in left column' },
  298. 'mergeLeftRight': { 'zh-cn': '合并左右边栏|到{{<side>}}', 'zh-hk': '合併左右邊欄|到{{<side>}}', 'zh-tw': '合併左右邊欄|到{{<side>}}', 'en': 'Merge left &amp; right column | to {{<side>}}' },
  299. 'mergeLeftRightLeft': { 'zh-cn': '左侧', 'zh-hk': '左側', 'zh-tw': '左側', 'en': 'left side' },
  300. 'mergeLeftRightRight': { 'zh-cn': '右侧', 'zh-hk': '右側', 'zh-tw': '右側', 'en': 'right side' },
  301. 'fixedLeft': { 'zh-cn': '浮动左边栏|{{<items>}}', 'zh-hk': '浮動左邊欄|{{<items>}}', 'zh-tw': '浮動左邊欄|{{<items>}}', 'en': 'Float left column | {{<items>}}' },
  302. 'fixedLeftDefault': { 'zh-cn': '默认元素', 'zh-hk': '預設元素', 'zh-tw': '預設元素', 'en': 'default elements' },
  303. 'fixedLeftWhole': { 'zh-cn': '整个左栏', 'zh-hk': '整個左欄', 'zh-tw': '整個左欄', 'en': 'whole column' },
  304. 'filteRightTopic': { 'zh-cn': '应用话题黑名单到右栏热门话题', 'zh-hk': '應用話題黑名單到右欄熱門話題', 'zh-tw': '應用話題黑名單到右欄熱門話題', 'en': 'Apply topic blacklist to Hot Topic in right column' },
  305. // 微博
  306. 'weiboToolsTitle': { 'zh-cn': '微博', 'zh-hk': '微博', 'zh-tw': '微博', 'en': 'Weibo' },
  307. 'clearDefTopicDesc': { 'zh-cn': '清除发布框中的默认话题', 'zh-hk': '清除發布框中的預設話題', 'zh-tw': '清除發布框中的預設話題', 'en': 'Remove default topic in Publisher' },
  308. 'unwrapTextDesc': { 'zh-cn': '微博作者和正文同行', 'zh-hk': '微博作者和正文同行', 'zh-tw': '微博作者和正文同行', 'en': 'No line break after author' },
  309. 'personalRedirectWeibo': { 'zh-cn': '访问帐号主页显示微博页面', 'zh-hk': '訪問帳號主頁顯示微博頁面', 'zh-tw': '訪問帳號主頁顯示微博頁面', 'en': 'Show Weibo page instead of personal main page by default' },
  310. 'viewOriginalDesc': { 'zh-cn': '添加“查看原图”链接', 'zh-hk': '添加「查看原圖」連結', 'zh-tw': '添加「查看原圖」連結', 'en': 'add "Original Picture" link' },
  311. 'viewOriginalText': { 'zh-cn': '查看原图', 'zh-hk': '查看原圖', 'zh-tw': '查看原圖', 'en': 'Original Picture' },
  312. 'expandShortenedLink': { 'zh-cn': '自动展开新浪 t.cn 短网址', 'zh-hk': '自動展開新浪 t.cn 短網址', 'zh-tw': '自動展開新浪 t.cn 短網址', 'en': 'Auto expand Sina shortened URL (t.cn)' },
  313. 'newWeiboNotify': { 'zh-cn': '有 {{count}} 条新微博,点击查看', 'zh-hk': '有 {{count}} 條新微博,點擊查看', 'zh-tw': '有 {{count}} 條新微博,點擊查看', 'en': 'You have {{count}} new Weibo,click to view', },
  314. // 样式
  315. 'styleToolsTitle': { 'zh-cn': '外观', 'zh-hk': '外觀', 'zh-tw': '外觀', 'en': 'Appearance' },
  316. 'whitelistHighlightDesc': { 'zh-cn': '高亮显示白名单的微博|背景色{{<color>}}|透明度{{<transparency>}}%', 'zh-hk': '高亮顯示白名單的微博|背景色{{<color>}}|透明度{{<transparency>}}%', 'zh-tw': '高亮顯示白名單的微博|背景色{{<color>}}|透明度{{<transparency>}}%', 'en': 'Highlight Weibo in whitelist with | background color {{<color>}} | transparency {{<transparency>}}%' },
  317. 'mainBackgroundColorOverride': { 'zh-cn': '首页背景|颜色{{<color>}}|透明度{{<transparency>}}%', 'zh-hk': '首頁背景|色彩{{<color>}}|透明度{{<transparency>}}%', 'zh-tw': '首頁背景|色彩{{<color>}}|透明度{{<transparency>}}%', 'en': 'Background color for home page | {{<color>}} | transparency {{<transparency>}}%' },
  318. 'profileBackgroundColorOverride': { 'zh-cn': '个人主页背景|颜色{{<color>}}|透明度{{<transparency>}}%', 'zh-hk': '個人主頁背景|色彩{{<color>}}|透明度{{<transparency>}}%', 'zh-tw': '個人主頁背景|色彩{{<color>}}|透明度{{<transparency>}}%', 'en': 'Background color for personal home page | {{<color>}} | transparency {{<transparency>}}%' },
  319. 'weiboOnly': {
  320. 'zh-cn': '阅读视图|宽度{{<width>}}px|快捷键{{<key>}}||{{<usebgc>}}使用指定背景色|{{<color>}}|透明度{{<transparency>}}%||{{<switch>}}在微博列表顶部显示快捷开关按钮',
  321. 'zh-hk': '閱讀視圖|寬度{{<width>}}px|快速鍵{{<key>}}||{{<usebgc>}}使用指定背景色|{{<color>}}|透明度{{<transparency>}}%||{{<switch>}}在微博清單頂部顯示快速開關按鈕',
  322. 'zh-tw': '閱讀視圖|寬度{{<width>}}px|快速鍵{{<key>}}||{{<usebgc>}}使用指定背景色|{{<color>}}|透明度{{<transparency>}}%||{{<switch>}}在微博清單頂部顯示快速開關按鈕',
  323. 'en': 'Reading View | width {{<width>}}px | shortcut {{<key>}} || {{<usebgc>}} override background color | with {{<color>}} | transparency {{<transparency>}} || {{<switch>}} show switch button at top of Weibo list'
  324. },
  325. 'weiboOnlyButton': { 'zh-cn': '切换视图', 'zh-hk': '切換視圖', 'zh-tw': '切換視圖', 'en': 'Switch View' },
  326. 'keyInputTip': { 'zh-cn': '按下键盘修改快捷键设置', 'zh-hk': '按下鍵盤修改快速鍵設置', 'zh-tw': '按下鍵盤修改快速鍵設置', 'en': 'Press key to modify shortcut key setting' },
  327. 'userstyleTitle': {
  328. 'zh-cn': '<span>自定义CSS<a class="yawf-userstyles-tip" href="https://userstyles.org/styles/browse/weibo" target="_blank">在 userstyles.org 上搜索样式</a><a class="yawf-userstyles-tip" target="_blank" href="https://github.com/tiansh/yawf/wiki/%E5%85%B6%E4%BB%96%E5%8F%AF%E5%B1%8F%E8%94%BD%E5%85%83%E7%B4%A0">常用自定义CSS</a></span>{{}}',
  329. 'zh-hk': '<span>自訂CSS<a class="yawf-userstyles-tip" href="https://userstyles.org/styles/browse/weibo" target="_blank">在 userstyles.org 上搜尋樣式</a><a class="yawf-userstyles-tip" target="_blank" href="https://github.com/tiansh/yawf/wiki/%E5%85%B6%E4%BB%96%E5%8F%AF%E5%B1%8F%E8%94%BD%E5%85%83%E7%B4%A0">常用自訂CSS</a></span>{{}}',
  330. 'zh-tw': '<span>自訂CSS<a class="yawf-userstyles-tip" href="https://userstyles.org/styles/browse/weibo" target="_blank">在 userstyles.org 上搜尋樣式</a><a class="yawf-userstyles-tip" target="_blank" href="https://github.com/tiansh/yawf/wiki/%E5%85%B6%E4%BB%96%E5%8F%AF%E5%B1%8F%E8%94%BD%E5%85%83%E7%B4%A0">常用自訂CSS</a></span>{{}}',
  331. 'en': '<span>Customize CSS<a class="yawf-userstyles-tip" href="https://userstyles.org/styles/browse/weibo" target="_blank">Search styles on userstyles.org</a><a class="yawf-userstyles-tip" target="_blank" href="https://github.com/tiansh/yawf/wiki/%E5%85%B6%E4%BB%96%E5%8F%AF%E5%B1%8F%E8%94%BD%E5%85%83%E7%B4%A0">Common Customize CSS</a></span>{{}}'
  332. },
  333. 'userstyleEditDesc': { 'zh-cn': '编辑 YAWF 自定义 CSS', 'zh-hk': '編輯 YAWF 自訂 CSS', 'zh-tw': '編輯 YAWF 自訂 CSS', 'en': 'Edit YAWF Customize CSS' },
  334. 'userstyleEditDetails': { 'zh-cn': 'YAWF 自定义 CSS:', 'zh-hk': 'YAWF 自訂 CSS:', 'zh-tw': 'YAWF 自訂 CSS:', 'en': 'YAWF Customize CSS:' },
  335. // 脚本
  336. 'scriptFilterGroupTitle': { 'zh-cn': '脚本', 'zh-hk': '腳本', 'zh-tw': '腳本', 'en': 'Script' },
  337. // 导入导出
  338. 'configImportAndExport': { 'zh-cn': '设置', 'zh-hk': '設定', 'zh-tw': '設定', 'en': 'Setting' },
  339. 'configImportButton': { 'zh-cn': '导入', 'zh-hk': '匯入', 'zh-tw': '匯入', 'en': 'Import' },
  340. 'configImportWarningTitle': { 'zh-cn': '设置导入', 'zh-hk': '設定匯入', 'zh-tw': '設定匯入', 'en': 'Setting Import' },
  341. 'configImportWarning': {
  342. 'zh-cn': '导入的设置会覆盖您当前已有的设置,确实要导入设置吗?',
  343. 'zh-hk': '匯入的設定會覆蓋您當前已有的設定,您確定要匯入設定嗎?',
  344. 'zh-tw': '匯入的設定會覆蓋您當前已有的設定,您確定要匯入設定嗎?',
  345. 'en': 'The imported settings may replace your current settings. Are you sure you want to import this file?'
  346. },
  347. 'configImportSuccessTitle': { 'zh-cn': '设置导入完成', 'zh-hk': '設定匯入完成', 'zh-tw': '設定匯入完成', 'en': 'Import settings completed' },
  348. 'configImportSuccess': { 'zh-cn': '已经成功地导入了设置', 'zh-hk': '已经成功地匯入了設定', 'zh-tw': '已经成功地匯入了設定', 'en': 'Successfully imported settings' },
  349. 'configImportFailTitle': { 'zh-cn': '设置导入失败', 'zh-hk': '設定匯入失败', 'zh-tw': '設定匯入失败', 'en': 'Import settings failed' },
  350. 'configImportFail': {
  351. 'zh-cn': '导入设置文件时出现错误,可能是使用了错误的文件,文件已损坏或文件的版本不支持',
  352. 'zh-hk': '匯入設定檔案時出現錯誤,可能是使用了錯誤的檔案,檔案已損壞或為不支援的版本',
  353. 'zh-tw': '匯入設定檔案時出現錯誤,可能是使用了錯誤的檔案,檔案已損壞或為不支援的版本',
  354. 'en': 'Error occurred during importing process. Wrong file may be used, the file may be broken, or the version of setting file is not supported.'
  355. },
  356. 'configExportButton': { 'zh-cn': '导出', 'zh-hk': '匯出', 'zh-tw': '匯出', 'en': 'Export' },
  357. 'configResetButton': { 'zh-cn': '重置', 'zh-hk': '重設', 'zh-tw': '重設', 'en': 'Reset' },
  358. 'configResetWarningTitle': { 'zh-cn': '设置重置', 'zh-hk': '設定重設', 'zh-tw': '設定重設', 'en': 'Setting Reset' },
  359. 'configResetWarning': { 'zh-cn': '这将会清空您当前的所有配置,确实要重置设置吗?', 'zh-hk': '這將會清空您當前的所有設定,您確定要重置設定嗎?', 'zh-tw': '這將會清空您當前的所有設定,您確定要重置設定嗎?', 'en': 'You are deleting all your settings. Are you sure you want to reset your settings?' },
  360. // 调试
  361. 'scriptDebugTitle': { 'zh-cn': '调试', 'zh-hk': '偵錯', 'zh-tw': '偵錯', 'en': 'Debug' },
  362. 'scriptDebug': { 'zh-cn': '在控制台打印调试信息', 'zh-hk': '將偵錯訊息列印到主控台', 'zh-tw': '將偵錯訊息列印到主控台', 'en': 'Print debug info to console' },
  363. // 关于
  364. 'scriptAboutTitle': { 'zh-cn': '关于', 'zh-hk': '關於', 'zh-tw': '關於', 'en': 'About' },
  365. 'scriptAbout': {
  366. 'zh-cn': '<p>Yet Another Weibo Filter (YAWF) {{version}}</p><p>YAWF 使用 MIT 协议授权。您可以访问<a target="_blank" href="https://tiansh.github.io/yawf/" rel="noreferrer">脚本主页</a>获取详细信息。<br />如果您在使用过程中遇到任何脚本的错误,或对脚本有任何建议,您可以到<a target="_blank" href="https://tiansh.github.io/yawf/issues.html" rel="noreferrer">反馈页面</a>提供报告,或直接<a target="_blank" href="http://weibo.com/tsh90/weibo" rel="noreferrer">私信作者</a>;反馈前建议先阅读<a target="_blank" href="https://tiansh.github.io/yawf/fqa.html" rel="noreferrer">常见问题</a>。</p><p>本脚本参考并使用了<a target="_blank" href="https://code.google.com/p/weibo-content-filter/" rel="noreferrer">眼不见心不烦</a>脚本的部分代码。</p>',
  367. 'zh-hk': '<p>Yet Another Weibo Filter (YAWF) {{version}}</p><p>YAWF 使用 MIT 協定授權。您可以訪問<a target="_blank" href="https://tiansh.github.io/yawf/" rel="noreferrer">腳本主頁</a>獲取詳細資訊。<br />如果您在使用過程中遇到任何腳本的錯誤,或對腳本有任何建議,您可以到<a target="_blank" href="https://tiansh.github.io/yawf/issues.html" rel="noreferrer">回饋頁面</a>提供報告,或直接<a target="_blank" href="http://weibo.com/tsh90/weibo" rel="noreferrer">私信作者</a>;回饋前建議先閱讀<a target="_blank" href="https://tiansh.github.io/yawf/fqa.html" rel="noreferrer">常見問題(簡體)</a>。</p><p>本腳本參考並使用了<a target="_blank" href="https://code.google.com/p/weibo-content-filter/" rel="noreferrer">眼不見心不煩</a>腳本的部分原始碼。</p>',
  368. 'zh-tw': '<p>Yet Another Weibo Filter (YAWF) {{version}}</p><p>YAWF 使用 MIT 協定授權。您可以訪問<a target="_blank" href="https://tiansh.github.io/yawf/" rel="noreferrer">腳本主頁</a>獲取詳細資訊。<br />如果您在使用過程中遇到任何腳本的錯誤,或對腳本有任何建議,您可以到<a target="_blank" href="https://tiansh.github.io/yawf/issues.html" rel="noreferrer">回饋頁面</a>提供報告,或直接<a target="_blank" href="http://weibo.com/tsh90/weibo" rel="noreferrer">私信作者</a>;回饋前建議先閱讀<a target="_blank" href="https://tiansh.github.io/yawf/fqa.html" rel="noreferrer">常見問題(簡體)</a>。</p><p>本腳本參考並使用了<a target="_blank" href="https://code.google.com/p/weibo-content-filter/" rel="noreferrer">眼不見心不煩</a>腳本的部分原始碼。</p>',
  369. 'en': '<p>Yet Another Weibo Filter (YAWF) {{version}}</p><p>YAWF is under the MIT License. You may want to visit <a target="_blank" href="https://tiansh.github.io/yawf/" rel="noreferrer">project homepage</a> for more information.<br />If you find any bugs or have feature request, please report them in the <a target="_blank" href="https://tiansh.github.io/yawf/issues.html" rel="noreferrer">feedback page</a>, or <a target="_blank" href="http://weibo.com/tsh90/weibo" rel="noreferrer">send message to author</a>. Please read <a target="_blank" href="https://tiansh.github.io/yawf/fqa.html" rel="noreferrer">FQA (Chinese)</a> page for common questions.</p><p>Some codes of this script come from <a target="_blank" href="https://code.google.com/p/weibo-content-filter/" rel="noreferrer"><span lang="zh-cn">眼不见心不烦</span> (Weibo Content Filter)</a> script.</p>',
  370. },
  371. // 拖拽
  372. 'dropAreaTitle': { 'zh-cn': '拖放至此<br />快速创建过滤器', 'zh-hk': '拖放至此<br />快速創建篩選器', 'zh-tw': '拖放至此<br />快速創建篩選器', 'en': 'Drop Here to Create Filter' },
  373. 'dropAreaText': { 'zh-cn': '将文字或链接拖放至此,快速创建过滤器。', 'zh-hk': '將文字或連結拖放至此,快速創建篩選器。', 'zh-tw': '將文字或連結拖放至此,快速創建篩選器。', 'en': 'Drop text or link here to create filter.' },
  374. 'fastCreateChoseTitle': { 'zh-cn': '创建过滤器', 'zh-hk': '創建篩選器', 'zh-tw': '創建篩選器', 'en': 'Create Filter' },
  375. 'fastFilterChoseText': { 'zh-cn': '请选择要创建的过滤器:', 'zh-hk': '請選擇要創建的篩選器:', 'zh-tw': '請選擇要創建的篩選器:', 'en': 'Chose the filter(s) you want:' },
  376. };
  377.  
  378. // 页面常量
  379. var html = {
  380. '|': '</label><label>', // 先关闭前面的label,再从后面开一个,所以这里没写反
  381. '||': '</label><br /><label>',
  382. 'select': '<select>{{options}}</select>',
  383. 'option': '<option value="{{value}}">{{{text}}}</option>',
  384. // 对话框
  385. 'cover': '<div node-type="outer" style="position: fixed; top: 0px; left: 0px; width: 100%; height: 100%; background: #000; opacity: 0.3; z-index: 10001;"></div>',
  386. 'dialog': '<div style="position: absolute; z-index: 10001;" node-type="outer" class="W_layer yawf-Layer" id="{{id}}"><div class="bg"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td><div node-type="layoutContent" class="content"><div node-type="title" class="title"><span node-type="title_content">{{title}}</span></div><a node-type="close" title="{{closeButtonTitle}}" class="W_close" href="javascript:void(0);"></a><div node-type="inner"></div></div></td></tr></tbody></table></div></div>',
  387. 'alert': '<div style="position: absolute; z-index: 10001;" node-type="outer" class="W_layer yawf-Layer" id="{{id}}"><div class="bg"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td><div node-type="layoutContent" class="content"><div node-type="title" class="title" style=""><span node-type="title_content">{{title}}</span></div><a node-type="close" title="{{closeButtonTitle}}" class="W_close" href="javascript:void(0);"></a><div node-type="inner"><div class="layer_point" node-type="outer"><dl class="point clearfix"><dt><span node-type="icon" class="icon_{{icon}}M"></span></dt><dd node-type="inner"><p node-type="textLarge" class="S_txt1">{{text}}</p><p node-type="textSmall" class="S_txt2"></p></dd></dl><div class="btn"><a node-type="OK" class="W_btn_a" href="javascript:void(0)"><span class="btn_30px W_f14">{{okButtonTitle}}</span></a></div></div></div></div></td></tr></tbody></table></div></div>',
  388. 'confirm': '<div style="position: absolute; z-index: 10001;" node-type="outer" class="W_layer yawf-Layer" id="{{id}}"><div class="bg"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td><div node-type="layoutContent" class="content"><div node-type="title" class="title" style=""><span node-type="title_content">{{title}}</span></div><a node-type="close" title="{{closeButtonTitle}}" class="W_close" href="javascript:void(0);"></a><div node-type="inner"><div class="layer_point" node-type="outer"><dl class="point clearfix"><dt><span node-type="icon" class="icon_{{icon}}M"></span></dt><dd node-type="inner"><p node-type="textLarge" class="S_txt1">{{text}}</p><p node-type="textComplex" class="S_txt2" style="display: none;"></p><p node-type="textSmall" class="S_txt2" style="display: none;"></p></dd></dl><div class="btn"><a node-type="OK" class="W_btn_a" href="javascript:void(0)"><span class="btn_30px W_f14">{{okButtonTitle}}</span></a><a node-type="cancel" class="W_btn_b" href="javascript:void(0)"><span class="btn_30px W_f14">{{cancelButtonTitle}}</span></a></div></div></div></div></td></tr></tbody></table></div></div>',
  389. // 漏斗图标
  390. 'icon': '<div class="gn_setting" node-type="filter"><i><a class="gn_tab gn_filter" href="#"><span class="ico">{{filter}}</span></a></i></div>',
  391. // 设置窗口
  392. 'configHeaderTop': '<div class="profile_tab S_line5 yawf-config-header" node-type="yawf-config-header"><ul class="pftb_ul S_line1">',
  393. 'configHeaderItem': '<li class="pftb_itm S_line1 {{liclass}}"><a class="pftb_lk S_line5 S_txt1 {{aclass}}" action-type="tab_item" onclick="return false;" href="javascript:void(0);">{{name}}</a>',
  394. 'configHeaderBottom': '</ul></div>',
  395. 'configLayerTop': '<div node-type="yawf-config-body" class="yawf-config-body">',
  396. 'configLayerItem': '<div class="{{name}} yawf-config-layer" node-type="{{name}}" style="display: none;"></div>',
  397. 'configLayerBottom': '</div>',
  398. 'configFooter': '',
  399. // 设置窗口内文字
  400. 'configSubtitle': '<div class="yawf-groupSubtitle">{{{text}}}</div>',
  401. 'configText': '<div class="yawf-groupText">{{{text}}}</div>',
  402. 'configRemark': '<div class="yawf-groupRemark">{{{text}}}</div>',
  403. // 设置项
  404. 'configBoolean': '<div class="yawf-configBoolean yawf-configItem"><label>{{text}}</label></div>',
  405. 'configBooleanInput': '<div class="yawf-configInput yawf-configBooleanInput"><input id="yawf-{{key}}" class="W_checkbox yawf-configBooleanInput" type="checkbox" name="yawf-{{key}}"></div>',
  406. 'configSelect': '<div class="yawf-configSelect yawf-configItem"><label>{{text}}</label></div>',
  407. 'configSelectInput': '<div class="yawf-configInput yawf-configSelectInput"><select class="yawf-configSelectSelect" name="yawf-{{key}}"></select></div>',
  408. 'configString': '<div class="yawf-configString yawf-configItem"><label>{{text}}</label></div>',
  409. 'configStringInput': '<div class="yawf-configInput yawf-configStringInput"><textarea id="yawf-{{key}}" class="W_input yawf-configStringInput" name="yawf-{{key}}"></textarea></div>',
  410. 'configColor': '<div class="yawf-configColor yawf-configItem"><label>{{text}}</label></div>',
  411. 'configColorInput': '<div class="yawf-configInput yawf-configColorInput"><input type="color" class="W_f14" style="width: 40px;" /></div>',
  412. 'configNumber': '<div class="yawf-configNumber yawf-configItem"><label>{{text}}</label></div>',
  413. 'configNumberInput': '<div class="yawf-configInput yawf-configNumberInput"><input type="number" class="W_f14" style="width: 60px;" /></div>',
  414. 'configRange': '<div class="yawf-configRange yawf-configItem"><label>{{text}}</label></div>',
  415. 'configRangeInput': '<div class="yawf-configInput yawf-configRangeInput"><input type="number" min="0" max="100" maxlength="3" class="W_f14" style="text-align: right;" /><div class="yawf-range-container"><input type="range" style="height: 1em; width: 66px; margin-left: 7px; margin-right: 7px; " tabindex="-1" /></div></div>',
  416. 'configKey': '<div class="yawf-configKey yawf-configItem"><label>{{text}}</label></div>',
  417. 'configKeyInput': '<div class="yawf-configInput yawf-configKeyInput"><button class="W_f14 yawf-configKeyName"></button><input type="hidden" /><span class="yawf-configKeyTip">{{keyInputTip}}</span></div>',
  418. 'configStrings': '<div class="yawf-configStrings yawf-configItem"><form action="#"><label><span class="yawf-configDesc yawf-configStringsDesc">{{{text}}}</span><input id="yawf-{{key}}" class="W_input yawf-configStringsInput" type="text" name="yawf-{{key}}"></label><button id="yawf-add-{{key}}" class="W_btn_a yawf-configAdd" type="submit"><span>{{configStringsAdd}}</span></button></form><ul class="yawf-configStringsItems"></ul></div>',
  419. 'configStringsItem': '<li class="W_btn_arrow tag yawf-configStringsItem"><span>{{[item]}}<a class="W_ico12 icon_close" href="javascript:void(0);"></a></span></li>',
  420. 'configUsers': '<div class="yawf-configUsers yawf-configItem"><form action="#"><label><span class="yawf-configDesc yawf-configUsersDesc">{{{text}}}</span><input id="yawf-{{key}}" class="W_input yawf-configUsersInput" type="text" name="yawf-{{key}}"></label><button id="yawf-add-{{key}}" class="W_btn_a yawf-configAdd" type="submit"><span>{{configUsersAdd}}</span></button></form><ul class="yawf-configUsersItems"></ul></div>',
  421. 'configUsersItem': '<li class="yawf-configUsersItem"><div class="shield_object_card"><div class="card_bg clearfix"><div class="card_pic"><span class="pic"><img class="W_face_radius" width="50" height="50" alt="" src="{{avatar}}"></span></div><div class="card_content"><div class="object_info clearfix"><p class="W_fl"><span class="object_name" uid="{{id}}" title="{{name}}">{{name}}</span></p><p class="W_fr"><a class="W_ico12 icon_close" action-data="uid={{id}}" href="javascript:void(0);"></a></p></div><div class="other_info"></div></div></div></div></li>',
  422. 'configPrefill': '<span class="yawf-configPrefill" id="{{id}}"></span>',
  423. // 导入导出
  424. 'configImportExport': '<div class="yawf-configImportExport yawf-configItem"><label><input type="file" style=" width: 1px; height: 1px; margin: 0 -1px 0 0; opacity: 0;" /><span node-type="import" class="W_btn_b" action-type="import"><span class="W_f14">{{configImportButton}}</span></span></label><a node-type="export" class="W_btn_b" action-type="export" href="javascript:;"><span class="W_f14">{{configExportButton}}</span></a><a node-type="reset" class="W_btn_b" action-type="reset" href="javascript:;"><span class="W_f14">{{configResetButton}}</span></a></div>',
  425. // 查看原图
  426. 'viewOriginalLink': '<a target="_blank" class="show_big" suda-data="key=tblog_newimage_feed&value=view_original" action-type="maximum" href="javascript:;"><em class="W_ico12 ico_showbig"></em>{{viewOriginalText}}</a><i class="W_vline">|</i>',
  427. // 拖拽
  428. 'dropArea': '<div id="yawf-drop-area" class="display: none;"><div class="yawf-drop-area-desc"><div class="yawf-drop-area-title">{{dropAreaTitle}}</div><div class="yawf-drop-area-text">{{dropAreaText}}</div></div><div contenteditable="true" id="yawf-drop-area-content"></div></div>',
  429. 'fastFilterHeader': '<div id="yawf-fast-filter-chose"><div class="yawf-fast-filter-option"><span class="yawf-fast-filter-text">{{fastFilterChoseText}}</span><ul id="yawf-fast-filter-list">',
  430. 'fastFilterItem': '<li class="yawf-fast-filter-item"><label><input class="W_checkbox yawf-configBooleanInput" type="checkbox"><span class="yawf-fastFilterItemInner"></span></label><select value="blacklist"><option value="whitelist">{{whitelistActionDesc}}</option><option value="blacklist">{{blacklistActionDesc}}</option><option value="foldlist">{{foldlistActionDesc}}</option></select></li>',
  431. 'fastFilterFooter': '</ul></div><div class="btn clearfix"><a node-type="ok" class="W_btn_a" action-type="ok" href="javascript:;"><span class="btn_30px W_f14">{{okButtonTitle}}</span></a><a node-type="cancel" class="W_btn_b" action-type="cancel" href="javascript:;"><span class="btn_30px W_f14">{{cancelButtonTitle}}</span></a></div></div>',
  432. 'fastFilterString': '<label><span></span></label>',
  433. 'fastFilterStringInput': '<input width="12" class="input_default" type="text" />',
  434. // 只看微博列表
  435. 'weiboOnlyButton': '<div class="right_item"><div><a class="W_btn_round2" href="javascript:void(0);" title="{{text}}{{shortcut}}"><span>{{text}}</span></a></div></div></div>',
  436. // 分组或特别关注的未读提示
  437. 'noticeContainer': '<div class="WB_feed_type SW_fun S_line2" action-type="feed_list_item" yawf-display="notice"></div>',
  438. // 有新微博的替代提示
  439. 'feedListNewBar': '<a class="notes" yawf-id="feed_list_newBar" href="javascript:void(0);"></a>',
  440. 'feedTimeTip': '<fieldset class="S_line2 between_line" yawf-id="feed_list_timeTip"><legend class="S_txt3" yawf-id="feed_list_timeText">{{{time}}}</legend></fieldset>',
  441. };
  442.  
  443. var url = {
  444. 'host': location.hostname === 'weibo.com' ? 'weibo.com' : 'www.weibo.com',
  445. 'newcard': '//{{host}}/aj/user/newcard?type=1&{{query}}&_t=1&callback={{callback}}',
  446. 'view_ori': 'http://photo.weibo.com/{{uid}}/wbphotos/large/mid/{{mid}}/pid/{{pid}}',
  447. 'block_wb': '//{{host}}/aj/user/block?_wv=5&__rnd={{rnd}}',
  448. };
  449.  
  450. // 将按键编号或将显示编号对应名称
  451. var keys = (function () {
  452. var ctrl = 1 << 8, shift = 1 << 9, alt = 1 << 10, meta = 1 << 11, key = ctrl - 1;
  453. var namelist = '#0;#1;#2;Cancel;#4;#5;Help;#7;BackSpace;TAB;#10;#11;Clear;Enter;EnterSpecial;#15;;;;Pause;CapsLock;Kana;Eisu;Junja;Final;Hanja;#26;Esc;Convert;Nonconvert;Accept;ModeChange;Space;PageUp;PageDown;End;Home;Left;Up;Right;Down;Select;Print;Execute;PrintScreen;Insert;Delete;#47;0;1;2;3;4;5;6;7;8;9;Colon;Semicolon;LessThan;Equals;GreaterThan;QuestionMark;At;A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;Win;#92;ContextMenu;#94;Sleep;NumPad0;NumPad1;NumPad2;NumPad3;NumPad4;NumPad5;NumPad6;NumPad7;NumPad8;NumPad9;Multiply;Add;Separator;Subtract;Decimal;Divide;F1;F2;F3;F4;F5;F6;F7;F8;F9;F10;F11;F12;F13;F14;F15;F16;F17;F18;F19;F20;F21;F22;F23;F24;#136;#137;#138;#139;#140;#141;#142;#143;NumLock;ScrollLocK;WIN_OEM_FJ_JISHO;WIN_OEM_FJ_MASSHOU;WIN_OEM_FJ_TOUROKU;WIN_OEM_FJ_LOYA;WIN_OEM_FJ_ROYA;#151;#152;#153;#154;#155;#156;#157;#158;#159;Circumflex;Exclamation;DoubleQuote;Hash;Dollar;Percent;Ampersand;Underscore;OpenParen;CloseParen;Asterisk;Plus;Pipe;HyphenMinus;OpenCurlyBracket;CloseCurlyBracket;Tilde;#177;#178;#179;#180;VolumeMute;VolumeDown;VolumeUp;#184;#185;#186;#187;Comma;#189;Period;Slash;BackQuote;#193;#194;#195;#196;#197;#198;#199;#200;#201;#202;#203;#204;#205;#206;#207;#208;#209;#210;#211;#212;#213;#214;#215;#216;#217;#218;OpenBracket;BackSlash;CloseBracket;Quote;#223;;AltGr;#226;WIN_ICO_HELP;WIN_ICO_00;#229;WIN_ICO_CLEAR;#231;#232;WIN_OEM_RESET;WIN_OEM_JUMP;WIN_OEM_PA1;WIN_OEM_PA2;WIN_OEM_PA3;WIN_OEM_WSCTRL;WIN_OEM_CUSEL;WIN_OEM_ATTN;WIN_OEM_FINISH;WIN_OEM_COPY;WIN_OEM_AUTO;WIN_OEM_ENLW;WIN_OEM_BACKTAB;Attn;Crsel;Exsel;Ereof;Play;Zoom;#252;PA1;WIN_OEM_CLEAR;#255'.split(';');
  454. // 对一个按键事件做编号
  455. var get = function (e) {
  456. var code = e.keyCode & key;
  457. if (e.ctrlKey) code |= ctrl;
  458. if (e.shiftKey) code |= shift;
  459. if (e.altKey) code |= alt;
  460. if (e.metaKey) code |= meta;
  461. return code;
  462. };
  463. // 给一个编号,转换为键名
  464. var name = function (n) {
  465. if (n === 0) return text.disabledKey;
  466. var ret = '';
  467. if (n & ctrl) ret += 'Ctrl-';
  468. if (n & shift) ret += 'Shift-';
  469. if (n & alt) ret += 'Alt-';
  470. if (n & meta) ret += 'Meta-';
  471. ret += namelist[n & key];
  472. if (ret.slice(-1) === '-') ret = ret.slice(0, -1);
  473. return ret;
  474. };
  475. // 注册全局监听按键
  476. var triggers = {};
  477. var reg = function (key, callback) {
  478. triggers[key] = triggers[key] || [];
  479. triggers[key].push(withTry(callback));
  480. };
  481. // 监听按键
  482. var baseEvent = function (e) {
  483. var code = get(e);
  484. if (!triggers[code]) return [];
  485. e.stopPropagation(); e.preventDefault();
  486. return triggers[code];
  487. };
  488. document.addEventListener('keydown', function (e) {
  489. baseEvent(e).forEach(function (f) { f(); })
  490. });
  491. document.addEventListener('keyup', baseEvent);
  492. return {
  493. 'get': get,
  494. 'name': name,
  495. 'reg': reg,
  496. };
  497. }());
  498.  
  499.  
  500. // 根据用户界面上的语言做不同调整
  501. var i18n = (function () {
  502. var defaultLang = 'zh-cn';
  503. var lang = null;
  504. var pending = [];
  505. var chose = function (langObj) {
  506. langObj.local = langObj[lang] || langObj[defaultLang];
  507. };
  508. return function (l) {
  509. lang = l;
  510. pending.map(chose);
  511. pending = [];
  512. i18n = chose;
  513. i18n.lang = l;
  514. };
  515. }());
  516.  
  517. // 将字符串用&#dd的形式转义
  518. var escapeXml = function (s) {
  519. return s.replace(/./g, function (c) { return '&#' + c.charCodeAt(0); });
  520. };
  521.  
  522. // 以参数填充字符串
  523. var fillStr = function (base, func) {
  524. var argdatas = Array.apply(Array, arguments).slice(1);
  525. var datas = argdatas.concat([text]);
  526. var parseFunction;
  527. if (typeof func === 'function') parseFunction = func;
  528. else parseFunction = function (text) {
  529. var ret = null;
  530. datas.some(function (data) {
  531. if (typeof data === 'object' && text in data) ret = '' + data[text];
  532. return ret !== null;
  533. });
  534. return ret;
  535. };
  536. return base.replace(/{{([\[{]?([a-zA-Z0-9_-]*)[\]}]?)}}/g, function (o, i, p) {
  537. var ret = parseFunction(p);
  538. if (ret == null) return o;
  539. if (i[0] === '{') return ret = fillStr(ret, parseFunction);
  540. if (i[0] === '[') return escapeXml(ret);
  541. return ret;
  542. });
  543. };
  544.  
  545. // 设置项
  546. var config = function (uid) {
  547. var config = {}, keys = [], onputs = [], storageKey = 'user' + uid + 'config';
  548. var tonputs = function (key, value, oldValue) {
  549. onputs.map(function (f) { f(key, value, oldValue); });
  550. };
  551. // 读取到内存
  552. var read = function () {
  553. try { config = JSON.parse(GM_getValue(storageKey, '{}')); }
  554. catch (e) { config = {}; }
  555. };
  556. // 从内存写出
  557. var write = function () {
  558. GM_setValue(storageKey, JSON.stringify(config));
  559. };
  560. // 写入到内存
  561. var put = function (key, value) {
  562. if (keys.indexOf(key) === -1) return;
  563. tonputs(key, value, config[key]);
  564. config[key] = value;
  565. write();
  566. return value;
  567. };
  568. // 从内存读取
  569. var get = function (key, value, type) {
  570. read();
  571. if (!(key in config)) return value;
  572. var val = config[key];
  573. if (typeof val === 'undefined') return value;
  574. if (type && (val === null || val.constructor !== type)) return value;
  575. return val;
  576. };
  577. // 当内存配置被修改时调用
  578. var onput = function (f) {
  579. onputs.push(f);
  580. };
  581. // 从字串导入
  582. var import_ = function (s) {
  583. try {
  584. clear();
  585. s = JSON.parse(s).conf;
  586. Object.keys(s).forEach(function (key) {
  587. put(key, s[key]);
  588. });
  589. write();
  590. return true;
  591. } catch (e) { }
  592. return false;
  593. };
  594. // 导出成为字串
  595. var export_ = function () {
  596. var info = GM_info || {}, script = info.script || {};
  597. var conf = {};
  598. Object.keys(config)
  599. .filter(function (x) { return x.indexOf('._') === -1; })
  600. .forEach(function (x) { conf[x] = config[x]; })
  601. return JSON.stringify({
  602. 'ua': navigator.userAgent,
  603. 'yawf': script.name,
  604. 'ver': script.version,
  605. 'gm': (info.scriptHandler || '') + info.version,
  606. 'conf': conf,
  607. }, null, 2);
  608. };
  609. // 清空设置
  610. var clear = function () {
  611. config = {};
  612. tonputs();
  613. write();
  614. };
  615. // 注册键
  616. var reg = function (key) { keys.push(key); };
  617. // 初始化
  618. return {
  619. 'uid': uid,
  620. 'put': put, 'get': get, 'onput': onput,
  621. 'read': read, 'write': write,
  622. 'import': import_, 'export': export_,
  623. 'clear': clear,
  624. 'reg': reg,
  625. };
  626. };
  627.  
  628.  
  629. // 微博过滤规则
  630. var rules = (function () {
  631. var list = [];
  632. var add = function (priority, rule) {
  633. list.push({ 'priority': priority, 'rule': rule });
  634. list.sort(function (x, y) { return y.priority - x.priority; });
  635. };
  636. var parse = function (feed) {
  637. var result = null;
  638. list.some(function (item) {
  639. try { result = item.rule(feed) || result; }
  640. catch (e) { debug('error while parsing rule %o: %o', item.rule, e); }
  641. if (result) debug('%o(%o) -> %s', item.rule, feed, result);
  642. return result;
  643. });
  644. return result;
  645. };
  646. return {
  647. 'add': add,
  648. 'parse': parse,
  649. };
  650. }());
  651.  
  652. // 打印调试信息
  653. var debug = GM_getValue('debug', false) &&
  654. console && console.log && console.log.bind(console) ||
  655. function () { };
  656.  
  657. // 桌面提示
  658. var notify = (function () {
  659. var avaliable = {};
  660. var shown = [];
  661. var use = {
  662. 'hasPermission': function () { return null; },
  663. 'requestPermission': function (callback) { return null; },
  664. 'hideNotification': function (notify) { return null; },
  665. 'showNotification': function (id, title, body, icon, delay, onclick) { return null; }
  666. };
  667.  
  668. // 检查一个微博是不是已经被显示过了,如果显示过了不重复显示
  669. var shownFeed = function (id) {
  670. var shown = [];
  671. try {
  672. shown = JSON.parse(GM_getValue('notification', '[]'));
  673. shown = Array.apply(Array, shown);
  674. id = String(id);
  675. } catch (e) { }
  676. debug('%o %s shown feed list: %o', id, shown.indexOf(id) === -1 ? 'not in' : 'in', shown);
  677. if (shown.indexOf(id) !== -1) return true;
  678. shown.push(id); shown = shown.slice(-20);
  679. GM_setValue('notification', JSON.stringify(shown));
  680. return false;
  681. };
  682.  
  683. // webkitNotifications
  684. // Tab Notifier 扩展实现此接口,但显示的桌面提示最多只能显示前两行
  685. if (typeof webkitNotifications !== 'undefined') avaliable.webkit = {
  686. 'hasPermission': function () {
  687. return [true, null, false][webkitNotifications.checkPermission()];
  688. },
  689. 'requestPermission': function (callback) {
  690. return webkitNotifications.requestPermission(callback);
  691. },
  692. 'hideNotification': function (notify) {
  693. notify.cancel();
  694. },
  695. 'showNotification': function (id, title, body, icon, delay, onclick) {
  696. if (shownFeed(id)) return null;
  697. debug('show (webkit) notification: %s - %s', title, body);
  698. var notify = webkitNotifications.createNotification(icon, title, body);
  699. if (delay && delay > 0) notify.addEventListener('display', function () {
  700. setTimeout(function () { hideNotification(notify); }, delay);
  701. });
  702. if (onclick) notify.addEventListener('click', onclick);
  703. notify.show();
  704. return notify;
  705. },
  706. }
  707.  
  708. // Notification
  709. // Firefox 22+
  710. // 显示4秒会自动关闭 https://bugzilla.mozilla.org/show_bug.cgi?id=875114
  711. if (typeof Notification !== 'undefined') avaliable.standard = {
  712. 'hasPermission': function () {
  713. return {
  714. 'granted': true,
  715. 'denied': false,
  716. 'default': null,
  717. }[Notification.permission];
  718. },
  719. 'requestPermission': function (callback) {
  720. return Notification.requestPermission(callback);
  721. },
  722. 'hideNotification': function (notify) {
  723. notify.close();
  724. },
  725. 'showNotification': function (id, title, body, icon, delay, onclick) {
  726. if (shownFeed(id)) return null;
  727. debug('show notification: %s - %s', title, body);
  728. var notify = new Notification(title, { 'body': body, 'icon': icon });
  729. if (delay && delay > 0) notify.addEventListener('show', function () {
  730. setTimeout(function () { notify.close(); }, delay);
  731. });
  732. if (onclick) notify.addEventListener('click', onclick);
  733. return notify;
  734. },
  735. }
  736.  
  737. // 有哪些接口可用
  738. var avaliableNotification = function () {
  739. return Object.keys(avaliable);
  740. };
  741. // 选择用哪个接口
  742. var choseNotification = function (prefer) {
  743. return use = prefer && avaliable[prefer] || avaliable.standard;
  744. };
  745. choseNotification();
  746. // 检查权限
  747. var hasPermission = function () {
  748. return use.hasPermission.apply(this, arguments);
  749. };
  750. // 请求权限
  751. var requestPermission = function () {
  752. return use.requestPermission.apply(this, arguments);
  753. };
  754. // 显示消息
  755. var showNotification = function (title, body, icon, delay, onclick) {
  756. var notify = use.showNotification.apply(this, arguments);
  757. shown.push(notify);
  758. return notify;
  759. };
  760. // 隐藏已经显示的消息
  761. var hideNotification = function (notify) {
  762. use.hideNotification.apply(this, arguments);
  763. shown = shown.filter(function (x) { return x !== notify; });
  764. return notify;
  765. };
  766.  
  767. document.addEventListener('unload', function () {
  768. shown.forEach(hideNotification);
  769. shown = [];
  770. });
  771.  
  772. return {
  773. 'avaliableNotification': avaliableNotification,
  774. 'choseNotification': choseNotification,
  775. 'hasPermission': hasPermission,
  776. 'requestPermission': requestPermission,
  777. 'showNotification': showNotification,
  778. 'hideNotification': hideNotification
  779. };
  780.  
  781. }());
  782.  
  783. // 显示右上角过滤器图标
  784. var showIcon = function () {
  785. var p = document.querySelector('.WB_global_nav .gn_person');
  786. if (!p) return setTimeout(showIcon, 100);
  787. var d = cewih('div', html.icon).firstChild;
  788. p.appendChild(d);
  789. var f = document.querySelector('.gn_filter');
  790. f.addEventListener('click', function (e) {
  791. filters.showDialog();
  792. e.preventDefault();
  793. });
  794. };
  795.  
  796. // 对话框
  797. var Form = function (dom, display, details) {
  798. var ok = dom.querySelector('[node-type="OK"]');
  799. var cancel = dom.querySelector('[node-type="cancel"]');
  800. var close = dom.querySelector('[node-type="close"]');
  801. var title = dom.querySelector('.title');
  802. var mouse = null, pos;
  803. // 定位对话框的位置
  804. var setPos = function (pos) {
  805. var left = pos[0], top = pos[1];
  806. left = Math.min(Math.max(0, left), document.body.clientWidth - dom.clientWidth - 2);
  807. top = Math.min(Math.max(pageYOffset, top), pageYOffset + window.innerHeight - dom.clientHeight - 2);
  808. dom.style.left = left + 'px';
  809. dom.style.top = top + 'px';
  810. return [left, top];
  811. };
  812. // 开始拖拽
  813. var dragMoveStart = function (e) {
  814. mouse = [e.clientX, e.clientY];
  815. document.addEventListener('mousemove', dragMove);
  816. document.addEventListener('mouseup', dragMoveDone);
  817. dom.classList.add('yawf-drag');
  818. if (dom.setCapture) { dom.setCapture(); }
  819. };
  820. // 拖拽移动
  821. var dragMove = function (e) {
  822. var mouse_new = [e.clientX, e.clientY];
  823. pos[0] += mouse_new[0] - mouse[0];
  824. pos[1] += mouse_new[1] - mouse[1];
  825. setPos(pos);
  826. mouse = mouse_new;
  827. };
  828. // 拖拽结束
  829. var dragMoveDone = function () {
  830. document.removeEventListener('mousemove', dragMove);
  831. document.removeEventListener('mouseup', dragMoveDone);
  832. dom.classList.remove('yawf-drag');
  833. if (dom.releaseCapture) { dom.releaseCapture(); }
  834. pos = setPos(pos);
  835. mouse = null;
  836. };
  837. // 标题栏可以拖拽
  838. if (title) {
  839. title.style.cursor = 'move';
  840. title.addEventListener('mousedown', dragMoveStart);
  841. }
  842. // 确定取消等按钮
  843. if (details.onOk) if (ok) ok.addEventListener('click', details.onOk);
  844. if (details.onCancel) {
  845. if (cancel) cancel.addEventListener('click', details.onCancel);
  846. if (close) close.addEventListener('click', details.onCancel);
  847. }
  848. // 背景遮罩
  849. var cover = cewih('div', html.cover).firstChild;
  850. // 响应按键
  851. var keys = function (e) {
  852. if (e.keyCode === 13) if (ok) ok.click(); // Enter
  853. if (e.keyCode === 27) if (close) close.click(); // Esc
  854. };
  855. // 关闭对话框
  856. var hide = function () {
  857. document.body.removeChild(dom);
  858. document.body.removeChild(cover);
  859. document.removeEventListener('keypress', keys);
  860. };
  861. // 显示对话框
  862. var show = function (top, left) {
  863. document.body.appendChild(cover);
  864. document.body.appendChild(dom);
  865. if (top == null) top = (window.innerHeight - dom.clientHeight) / 2;
  866. if (left == null) left = (window.innerWidth - dom.clientWidth) / 2;
  867. pos = [left, top + pageYOffset];
  868. setPos(pos);
  869. document.addEventListener('keypress', keys);
  870. document.activeElement.blur();
  871. };
  872. if (display) show();
  873. if (ok) ok.addEventListener('click', hide);
  874. if (cancel) cancel.addEventListener('click', hide);
  875. if (close) close.addEventListener('click', hide);
  876. return { 'hide': hide, 'show': show };
  877. };
  878.  
  879. // 显示一个对话框
  880. var Dialog = function (id, title, fillFun) {
  881. var dom = cewih('div', fillStr(html.dialog, { 'id': id, 'title': fillStr(title) })).firstChild;
  882. var form = Form(dom, false, {});
  883. fillFun(dom.querySelector('[node-type="inner"]'));
  884. return form;
  885. };
  886.  
  887. // 显示一个提示框
  888. var Alert = function (id, details) {
  889. var dom = cewih('div', fillStr(html.alert, { 'id': id, 'title': details.title, 'text': details.text, 'icon': details.icon || 'warn' })).firstChild;
  890. var form = Form(dom, true, details);
  891. return form;
  892. };
  893.  
  894. // 显示一个确定框
  895. var Confirm = function (id, details) {
  896. var dom = cewih('div', fillStr(html.confirm, { 'id': id, 'title': details.title, 'text': details.text, 'icon': details.icon || 'question' })).firstChild;
  897. var form = Form(dom, true, details);
  898. return form;
  899. };
  900.  
  901. // 延迟调用函数
  902. var call = function (f) {
  903. setTimeout.bind(this, f, 0).apply(null, Array.apply(Array, arguments).slice(1));
  904. };
  905.  
  906. // 套上try-catch
  907. var withTry = function (f, fc) {
  908. return function () {
  909. try { f.apply(this, arguments); }
  910. catch (e) {
  911. debug('Exception while run %o: %o (%o)', f, e, e.stack);
  912. if (fc) fc(e);
  913. }
  914. };
  915. };
  916.  
  917. // 管理样式
  918. var css = (function () {
  919. var styleText = '';
  920. var fun = function (css) { return fun.add.bind(fun, css); };
  921. fun.init = function () { GM_addStyle(styleText); };
  922. fun.add = function (css) { styleText += css + '\n'; };
  923. return fun;
  924. }());
  925.  
  926. // 产生一个假的回调函数
  927. var dateStr = (function () {
  928. var last = 0;
  929. return function () {
  930. return '' + (last = Math.max(last + 1, Number(new Date())));
  931. };
  932. }());
  933.  
  934. // 维护账号信息,用于显示
  935. var account = (function () {
  936. var idCache = {}, nameCache = {}, working = {};
  937. var request = function (queryStr, onsucc, onerror) {
  938. // 如果同时已经有了同类请求则等待那个请求的返回
  939. if (working[queryStr]) return working[queryStr].push([onsucc, onerror]);
  940. working[queryStr] = [[onsucc, onerror]];
  941. var done = function (success, data) {
  942. working[queryStr].forEach(function (w) { w[success ? 0 : 1](data); });
  943. delete working[queryStr];
  944. };
  945. // 请求获取
  946. GM_xmlhttpRequest({
  947. 'method': 'GET',
  948. 'url': fillStr(url.newcard, { 'query': queryStr, 'callback': 'STK_' + dateStr(), 'host': url.host }),
  949. 'onload': withTry(function (resp) {
  950. var respJson = JSON.parse(resp.responseText.replace(/^try{[^{]*\(/, '').replace(/\)}catch\(e\){};$/, ''));
  951. var namecard = cewih('div', respJson.data);
  952. var avatar = namecard.querySelector('.name dt img').getAttribute('src');
  953. var name = namecard.querySelector('.name dd a[uid]').getAttribute('title');
  954. var uid = namecard.querySelector('.name dd a[uid]').getAttribute('uid');
  955. var data = { 'avatar': avatar, 'id': uid, 'name': name };
  956. nameCache[name] = idCache[uid] = data;
  957. done(true, data);
  958. }, done.bind(this, false)),
  959. 'onerror': function () { done(false); },
  960. });
  961. return queryStr;
  962. };
  963. var byId = function (id, onsucc, onerror) {
  964. if (idCache[id]) onsucc(idCache[id]);
  965. else request('id=' + id, onsucc, onerror);
  966. };
  967. var byName = function (name, onsucc, onerror) {
  968. if (nameCache[name]) onsucc(nameCache[name]);
  969. else request('name=' + encodeURIComponent(name), onsucc, onerror);
  970. };
  971. return { 'id': byId, 'name': byName };
  972. }());
  973.  
  974. // 过滤器管理器
  975. var filters = (function () {
  976. var list = [], preinit = true;
  977. // 添加到表格中
  978. var add = function (details) {
  979. list.push(details);
  980. if (!preinit) details.init();
  981. return details;
  982. };
  983. // 网页加载完毕时初始化
  984. var init = function () {
  985. list.forEach(function (x) { x.init(); });
  986. preinit = false;
  987. };
  988. var dialog = null;
  989. var lastTab = 0;
  990. var dialogTabs = function (list, inner, page) {
  991. var alist = Array.apply(Array, inner.querySelectorAll('.yawf-config-header a'));
  992. var llist = Array.apply(Array, inner.querySelectorAll('.yawf-config-body .yawf-config-layer'));
  993. var choseLList = function (i) {
  994. llist.forEach(function (l) { l.style.display = 'none'; l.innerHTML = ''; });
  995. alist.forEach(function (a) { a.classList.remove('current'); a.classList.remove('S_bg5'); a.classList.add('S_bg1'); });
  996. llist[i].innerHTML = ''; list[i].show(llist[i]); llist[i].style.display = 'block';
  997. alist[i].classList.add('current'); alist[i].classList.remove('S_bg1'); alist[i].classList.add('S_bg5');
  998. lastTab = i;
  999. };
  1000. list.map(function (filter, i) {
  1001. var a = alist[i];
  1002. a.addEventListener('mousedown', function () { choseLList(i); });
  1003. a.addEventListener('keydown', function () { choseLList(i); });
  1004. });
  1005. choseLList(page);
  1006. };
  1007. var showDialog = function (page, count) {
  1008. var showDialogInner = function (inner) {
  1009. inner.innerHTML = [html.configHeaderTop,
  1010. list.map(function (filter, index) {
  1011. return fillStr(html.configHeaderItem, {
  1012. 'name': text[filter.name + 'Title'],
  1013. 'aclass': index === 0 ? 'S_bg5 current' : 'S_bg1',
  1014. 'liclass': index === list.length - 1 ? 'pftb_itm_lst' : ' ',
  1015. });
  1016. }).join(''),
  1017. html.configHeaderBottom,
  1018. html.configLayerTop,
  1019. list.map(function (filter, index) {
  1020. return fillStr(html.configLayerItem, {
  1021. 'name': filter.name + 'Layer',
  1022. });
  1023. }).join(''),
  1024. html.configLayerBottom,
  1025. html.configFooter,
  1026. ].join('');
  1027. call(function () { dialog.show(0); });
  1028. if (list.indexOf(page) === -1) dialogTabs(list, inner, lastTab);
  1029. else dialogTabs(list, inner, list.indexOf(page));
  1030. };
  1031. if (!(dialog = Dialog('yawf-config', '{{configDialogTitle}}', showDialogInner))) {
  1032. if (!count || count < 100) setTimeout(showDialog, 100, page, (count || 0) + 1);
  1033. }
  1034. };
  1035. return {
  1036. 'add': add,
  1037. 'init': init,
  1038. 'showDialog': showDialog,
  1039. };
  1040. }());
  1041.  
  1042. // 快速创建过滤器的对话框
  1043. var fastFilterDialog = function (chose) {
  1044. var dialogInner = function (inner) {
  1045. inner.innerHTML = html.fastFilterHeader + html.fastFilterFooter;
  1046. var items = inner.querySelector('#yawf-fast-filter-list');
  1047. var checkboxList = chose.map(function (c) {
  1048. var item = cewih('ul', html.fastFilterItem).firstChild;
  1049. var inner = item.querySelector('.yawf-fastFilterItemInner');
  1050. var checked = c.filter.desc(inner, c.val) !== false;
  1051. var checkbox = item.querySelector('input[type="checkbox"], input[type="radio"]');
  1052. checkbox.checked = checked;
  1053. items.appendChild(item);
  1054. return checkbox;
  1055. });
  1056. var selectList = Array.apply(Array, inner.querySelectorAll('select'));
  1057. selectList.forEach(function (select) { select.value = 'blacklist'; });
  1058. // 找到所有选择了的过滤器
  1059. var allChecked = function () {
  1060. var active = [];
  1061. checkboxList.forEach(function (checkbox, i) {
  1062. if (checkbox.checked)
  1063. active.push({ 'chose': chose[i], 'action': selectList[i].value });
  1064. });
  1065. return active;
  1066. };
  1067. var updateOkButton = function () {
  1068. if (allChecked().length) ok.classList.remove('W_btn_a_disable');
  1069. else ok.classList.add('W_btn_a_disable');
  1070. };
  1071. var ok = inner.querySelector('[action-type="ok"]');
  1072. ok.addEventListener('click', function () {
  1073. var active = allChecked();
  1074. if (!active.length) return null;
  1075. active.forEach(function (act) {
  1076. act.chose.filter.add(act.chose.val, act.action);
  1077. });
  1078. dialog.hide();
  1079. });
  1080. checkboxList.forEach(function (checkbox) {
  1081. checkbox.addEventListener('change', updateOkButton);
  1082. });
  1083. updateOkButton();
  1084. var cancel = inner.querySelector('[action-type="cancel"]');
  1085. cancel.addEventListener('click', function () { dialog.hide(); });
  1086. };
  1087. var dialog = Dialog('yawf-drop-select', '{{fastCreateChoseTitle}}', dialogInner);
  1088. return dialog;
  1089. };
  1090.  
  1091. // 将文本、链接等拖拽到框内,快速创建过滤器
  1092. var dropdown = (function () {
  1093. var dropArea, content;
  1094. var dropdownFilters = [];
  1095. var got = function (element) {
  1096. if (!element) return;
  1097. // 忽略最外面套的em/strong
  1098. if (element.tagName && element.firstChild === element.lastChild &&
  1099. ['strong', 'em'].indexOf(element.tagName.toLowerCase()) !== -1)
  1100. element = element.firstChild;
  1101. debug('got %o', element);
  1102. var chose = [];
  1103. // 问所有过滤器是不是需要
  1104. dropdownFilters.forEach(function (filter, i) { chose[i] = null; });
  1105. dropdownFilters.forEach(function (filter, i) {
  1106. filter.valid(element, function (val) {
  1107. if (!val) chose[i] = [];
  1108. else if (val.constructor !== Array) chose[i] = [{ 'filter': filter, 'val': val }];
  1109. else chose[i] = val.map(function (val) { return { 'filter': filter, 'val': val }; });
  1110. if (chose.filter(function (x) { return !x; }).length) return;
  1111. var chosen = chose.reduce(function (x, y) { return x.concat(y); });
  1112. if (chosen.length) {
  1113. var dialog = fastFilterDialog(chosen);
  1114. call(function () { dialog.show(); });
  1115. }
  1116. });
  1117. });
  1118. };
  1119. var init = function () {
  1120. // 拖放到的框
  1121. dropArea = cewih('div', html.dropArea).firstChild;
  1122. var active = false, target = null;
  1123. content = dropArea.querySelector('#yawf-drop-area-content');
  1124. document.body.appendChild(dropArea);
  1125. var hideDropArea = function () {
  1126. if (target && target.hover) target.hover(); target = null;
  1127. dropArea.style.display = 'none';
  1128. };
  1129. // 只接受从特定位置拽过来的东西
  1130. var checkTarget = function () {
  1131. var checker = target;
  1132. for (; checker && checker !== document; checker = checker.parentNode) {
  1133. if (!checker.classList || !checker.classList.contains || !checker.tagName) continue;
  1134. if (checker.classList.contains('WB_feed')) return true;
  1135. if (checker.classList.contains('W_miniblog')) return false;
  1136. if (checker.tagName.toLowerCase() === 'body') return true;
  1137. if (checker.classList.contains('right_content') && checker.classList.contains('hot_topic')) return true;
  1138. if (checker.id === 'WB_webim') return false;
  1139. }
  1140. return false;
  1141. };
  1142. // 开始拽
  1143. document.addEventListener('dragstart', function (e) {
  1144. var cover = document.querySelector('body>div[node-type="outer"]');
  1145. if (cover && cover.clientHeight) return;
  1146. target = e.explicitOriginalTarget; if (!target || !checkTarget()) return;
  1147. active = true;
  1148. dropArea.style.display = 'block';
  1149. }, false);
  1150. // 拽完了
  1151. document.addEventListener('dragend', function (e) {
  1152. if (!active) return; active = false;
  1153. e.preventDefault(); e.stopPropagation();
  1154. if (content.firstChild === content.lastChild) got(content.firstChild);
  1155. else got(content);
  1156. content.innerHTML = '';
  1157. hideDropArea();
  1158. }, false);
  1159. // 拽出去了
  1160. document.addEventListener('mouseout', function (e) {
  1161. if (!active) return; active = false;
  1162. hideDropArea();
  1163. });
  1164. };
  1165. var add = function (details) {
  1166. dropdownFilters.push(details);
  1167. };
  1168. return {
  1169. 'init': init,
  1170. 'add': add,
  1171. };
  1172. }());
  1173.  
  1174. // 告诉服务器屏蔽被隐藏的微博
  1175. var blockWeibo = (function () {
  1176. var buffer = [], busy = false;
  1177. var delay = function () { return 3000 + Math.round(20 * Math.random()) * 100; };
  1178. var block = function (mid, callback) {
  1179. var done = function () { setTimeout(callback, delay()); };
  1180. debug('blocking weibo %s', mid);
  1181. GM_xmlhttpRequest({
  1182. 'method': 'POST',
  1183. 'url': fillStr(url.block_wb, { 'rnd': dateStr(), 'host': url.host }),
  1184. 'headers': {
  1185. 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  1186. 'Cache-Control': 'no-cache',
  1187. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
  1188. 'Cookie': document.cookie,
  1189. 'Referer': location.href,
  1190. 'X-Requested-With': 'XMLHttpRequest',
  1191. },
  1192. 'data': 'filter_type=0&mid=' + mid + '&justhide=0&location=home&_t=0',
  1193. 'onload': function (resp) { debug('block %s response: %s', mid, resp.responseText); done(); },
  1194. 'onerror': function () { debug('block %s network error', mid); done(); },
  1195. });
  1196. };
  1197. var active = function () {
  1198. if (!(busy = !!buffer.length)) return;
  1199. var mid = buffer.shift();
  1200. block(mid, active);
  1201. };
  1202. return function (mid) {
  1203. buffer.push(mid);
  1204. if (!busy) active();
  1205. return mid;
  1206. };
  1207. }());
  1208.  
  1209. // 有新节点时分发事件监听
  1210. var newNode = (function () {
  1211. var callbacks = [], actived = false;
  1212. var callAll = function (mutation) {
  1213. callbacks.forEach(function (c) { c(mutation); });
  1214. };
  1215. var observe = function () {
  1216. callAll(); // 初始化
  1217. (new MutationObserver(function (mutations) {
  1218. mutations.forEach(function (mutation) { callAll(mutation); });
  1219. })).observe(document.body, { 'childList': true, 'subtree': true });
  1220. };
  1221. var add = function (callback) {
  1222. callbacks.push(withTry(callback));
  1223. return callback;
  1224. };
  1225. var remove = function (callback) {
  1226. var found = false;
  1227. callbacks = callbacks.filter(function (x) {
  1228. var same = x === callback;
  1229. if (same) found = true;
  1230. return !same;
  1231. });
  1232. return found;
  1233. };
  1234. var active = function () {
  1235. if (actived) return;
  1236. actived = true;
  1237. observe();
  1238. };
  1239. return {
  1240. 'add': add,
  1241. 'remove': remove,
  1242. 'active': active,
  1243. };
  1244. }());
  1245.  
  1246. // 添加点击后展开折叠消息的事件
  1247. var fixFoldWeibo = (function () {
  1248. var fixOne = withTry(function (feed) {
  1249. var display = feed.getAttribute('yawf-display').replace(/-fold$/g, '-unfold');
  1250. var showFeed = function () {
  1251. feed.setAttribute('yawf-display', display);
  1252. feed.removeEventListener('click', showFeed);
  1253. };
  1254. var author = feed.querySelector('.WB_name[usercard]').getAttribute('title');
  1255. feed.setAttribute('yawf-author', author);
  1256. feed.addEventListener('click', showFeed);
  1257. });
  1258. var fix = function (feed) {
  1259. var feeds = [feed].concat(Array.apply(Array, feed.querySelectorAll('.WB_feed_type')));
  1260. feeds.forEach(function (feed) {
  1261. if (feed.getAttribute('yawf-display').lastIndexOf('-fold') === -1) return;
  1262. if (feed.getAttribute('yawf-author')) return;
  1263. fixOne(feed);
  1264. });
  1265. };
  1266. fix.init = function () {
  1267. css.add(fillStr('[node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"]::before { content: {{foldedWeiboText}}; }'));
  1268. };
  1269. return fix;
  1270. }());
  1271.  
  1272. // 将父微博和下面的子微博交换
  1273. var swapParentSonWeibo = function (parent, son) {
  1274. var x = cewih('div', '');
  1275. ['.WB_face', '.WB_info', '.WB_text', '.WB_func'].map(function (q) {
  1276. (function (a, b) {
  1277. b.parentNode.replaceChild(x, b);
  1278. a.parentNode.replaceChild(b, a);
  1279. x.parentNode.replaceChild(a, x);
  1280. }(parent.querySelector(q), son.querySelector(q)));
  1281. });
  1282. var mid = parent.getAttribute('mid');
  1283. parent.setAttribute('mid', son.getAttribute('mid'));
  1284. son.setAttribute('mid', mid);
  1285. // 各种细节的修补(原网站做的太乱了……)
  1286. var pf = parent.querySelector('.WB_face'), sf = son.querySelector('.WB_face');
  1287. var pfa = pf.querySelector('a'), pfi = pf.querySelector('img');
  1288. var sfa = sf.querySelector('a'), sfi = sf.querySelector('img');
  1289. if (pfa.href.indexOf('?') === -1) pfa.href += '?from=feed&loc=avatar';
  1290. if (sfa.href.indexOf('?') !== -1) sfa.href = sfa.href.slice(0, sfa.href.indexOf('?'));
  1291. if (!pfa.title) pfa.title = pfi.title;
  1292. if (sfa.title) sfa.removeAttribute('title');
  1293. sfi.width = sfi.height = '30'; pfi.width = pfi.height = '50';
  1294. return son;
  1295. };
  1296.  
  1297. // 如果有一个微博的子微博都隐藏了,那么就隐藏这个微博的子微博框
  1298. var fixSonWeiboDisplay = function (feed) {
  1299. if (!feed.querySelector('.WB_feed_together')) return fixFoldWeibo(feed);
  1300. var sonList = Array.apply(Array, feed.querySelectorAll('.WB_feed_together .WB_sonFeed .WB_feed_type[yawf-display]'));
  1301. // 交换两个子微博
  1302. var swapSon = function (p, q) {
  1303. var x = sonList[p], y = sonList[q];
  1304. var fakeNode = document.createElement('div');
  1305. x.parentNode.insertBefore(fakeNode, x);
  1306. y.parentNode.insertBefore(x, y);
  1307. fakeNode.parentNode.insertBefore(y, fakeNode);
  1308. fakeNode.parentNode.removeChild(fakeNode);
  1309. sonList[p] = y; sonList[q] = x;
  1310. };
  1311. // 把子微博重新排序一下,按照从想看到不想看的顺序排列,排序算法和一趟快排差不多
  1312. var p = 0, q;
  1313. ['show', 'unset', 'unfold', 'fold', 'hidden'].forEach(function (display) {
  1314. q = sonList.length - 1;
  1315. while (p < q) {
  1316. if (sonList[p].getAttribute('yawf-display').lastIndexOf(display) !== -1) p++;
  1317. else if (sonList[q].getAttribute('yawf-display').lastIndexOf(display) === -1) q--;
  1318. else swapSon(p, q);
  1319. }
  1320. });
  1321. // 看看还有多少显示出来的子微博,更新一下子微博的计数
  1322. var sonCount = feed.querySelectorAll('.WB_feed_together .WB_sonFeed .WB_feed_type:not([yawf-display$="-hidden"])').length;
  1323. if (sonCount === 0) feed.querySelector('.WB_feed_together').setAttribute('yawf-display', 'display-hidden');
  1324. else feed.querySelector('[node-type="followNum"]').textContent = sonCount;
  1325. // 如果下面更多的按钮已经没用了,就藏起来吧
  1326. var foldSonCount = feed.querySelectorAll('[node-type="feed_list_wrapForward"] .WB_feed_type:not([yawf-display$="-hidden"])').length;
  1327. if (foldSonCount === 0 && feed.querySelector('[node-type="feed_list_wrapForward"]')) {
  1328. feed.querySelector('.WB_feed_together').setAttribute('yawf-sonfold', 'display');
  1329. }
  1330. // 把原始微博和子微博拆开
  1331. var another = feed.cloneNode(true);
  1332. feed.parentNode.insertBefore(another, feed.nextSibling);
  1333. feed.setAttribute('yawf-withson', 'son');
  1334. another.setAttribute('yawf-display', 'display-son');
  1335. fixFoldWeibo(feed);
  1336. fixFoldWeibo(another);
  1337. };
  1338.  
  1339. // 真正微博过滤的核心模块
  1340. var weiboFilter = function (feed) {
  1341. // 同源合并的微博
  1342. var sonFeeds = Array.apply(Array, feed.querySelectorAll('[node-type="feed_list"] .WB_feed_type:not([yawf-display])'));
  1343. var action = null, parentAction = null;
  1344. var needSwap = function (action) {
  1345. if (!sonFeeds.length) return false;
  1346. if (['hidden', 'fold'].indexOf(action) === -1) return false;
  1347. return true;
  1348. };
  1349. var setAction = function (feed, action) {
  1350. feed.setAttribute('yawf-display', 'display-' + action);
  1351. };
  1352. while (true) {
  1353. action = rules.parse(feed) || 'unset';
  1354. // 如果父微博被屏蔽或折叠,那么就把下面一条没被屏蔽的拉上来换个位置
  1355. if (!needSwap(action)) break;
  1356. setAction(swapParentSonWeibo(feed, sonFeeds.pop()), action);
  1357. }
  1358. parentAction = action;
  1359. // 最后处理所有下面的子微博
  1360. var fixSonWeibo = function (son) {
  1361. var action = rules.parse(son) || 'unset';
  1362. setAction(son, action);
  1363. // 如果一列里面有白名单的,那么把白名单的特别换到外面去
  1364. if (parentAction !== 'show' && action === 'show') {
  1365. setAction(swapParentSonWeibo(feed, son), parentAction);
  1366. parentAction = action;
  1367. }
  1368. };
  1369. while (sonFeeds.length) fixSonWeibo(sonFeeds.shift());
  1370. setAction(feed, parentAction);
  1371. fixSonWeiboDisplay(feed);
  1372. };
  1373.  
  1374. // 对每条微博应用过滤和其他相关回调
  1375. var eachWeibo = (function () {
  1376. var befores = [], afters = [];
  1377. newNode.add(function () {
  1378. var feeds = Array.apply(Array,
  1379. document.querySelectorAll('[node-type="feed_list"] .WB_feed_type:not([yawf-display])'));
  1380. [befores, [weiboFilter], afters].forEach(function (callbacks) {
  1381. feeds.forEach(function (feed) {
  1382. callbacks.forEach(function (f) { f(feed); });
  1383. });
  1384. });
  1385. });
  1386. var add = function (callbacks) {
  1387. return function (callback) {
  1388. callbacks.push(withTry(callback));
  1389. return callback;
  1390. };
  1391. };
  1392. return {
  1393. 'before': add(befores),
  1394. 'after': add(afters),
  1395. };
  1396. }());
  1397.  
  1398. // 根据选择类型不同生成一些存取设置的函数
  1399. var typedConfig = (function () {
  1400. // 字符串
  1401. var baseConfig = function (type) {
  1402. return function (item) {
  1403. var skey = item.key;
  1404. if (item.internal) skey = skey.replace(/\.([^\.]*)$/, '._$1');
  1405. if (!item.getconf) item.getconf = function () {
  1406. return item.conf = config.get(skey, item['default'] || type(), type);
  1407. };
  1408. if (!item.putconf) item.putconf = function (conf) {
  1409. return config.put(skey, item.conf = conf);
  1410. };
  1411. config.reg(skey);
  1412. return item.putconf(item.getconf());
  1413. };
  1414. };
  1415. // 集合类型的add/del操作
  1416. var itemsConfig = function (item) {
  1417. var value = baseConfig(Array)(item);
  1418. if (!item.delconf) item.delconf = function (str) {
  1419. var val = item.getconf();
  1420. val = val.filter(function (x) { return x !== str; });
  1421. return item.putconf(val);
  1422. };
  1423. if (!item.addconf) item.addconf = function (str) {
  1424. item.delconf(str);
  1425. var val = item.getconf(); val.push(str);
  1426. return item.putconf(val);
  1427. };
  1428. return value;
  1429. };
  1430. return {
  1431. 'string': baseConfig(String),
  1432. 'strings': itemsConfig,
  1433. 'boolean': baseConfig(Boolean),
  1434. 'users': itemsConfig,
  1435. 'number': baseConfig(Number),
  1436. 'range': baseConfig(Number),
  1437. 'select': baseConfig(String),
  1438. 'color': baseConfig(String),
  1439. 'key': baseConfig(Number),
  1440. };
  1441. }());
  1442.  
  1443. // 将输入框和某个设置项绑定
  1444. var bindInputValue = (function () {
  1445. var bind = function (key, input, obj, standlize) {
  1446. var fine = standlize || function (x) { return x; };
  1447. var onchange = function () {
  1448. var val = input[key], valid;
  1449. valid = fine(val);
  1450. if (String(valid) !== val) input[key] = valid;
  1451. obj.putconf(valid);
  1452. };
  1453. input[key] = fine(obj.getconf());
  1454. input.addEventListener('change', onchange);
  1455. return onchange;
  1456. };
  1457. return {
  1458. 'text': bind.bind(null, 'value'),
  1459. 'checkbox': bind.bind(null, 'checked'),
  1460. 'select': bind.bind(null, 'value'),
  1461. };
  1462. }());
  1463.  
  1464. // 根据不同类型生成带有事件的文档节点
  1465. var typedHtml = (function () {
  1466.  
  1467. var base = function (base, binder) {
  1468. return function () {
  1469. var item = this;
  1470. // 引用的设置项
  1471. var ref = item.ref;
  1472. // 显示的文字
  1473. var inp = '{{}}', outer = inp, inner = '', text;
  1474. var hasInput = !!html['config' + base + 'Input'];
  1475. if (!item.nogui) {
  1476. text = fillStr(item.text || '').replace(/\|\|/g, html['||']).replace(/\|/g, html['|']);
  1477. if (hasInput && text.indexOf(inp) === -1) text = inp + text;
  1478. outer = fillStr(html['config' + base], { 'text': text }, item);
  1479. }
  1480. if (hasInput) inner = fillStr(html['config' + base + 'Input'], item);
  1481. var line = outer.replace(inp, inner);
  1482. // 在需要引用其他控件的地方留空
  1483. if (!item.nogui) line = line.replace(/{{<([a-zA-Z0-9_-]*)>}}/g, function (m, p) {
  1484. return ref[p] ? fillStr(html.configPrefill, { 'id': p }) : m;
  1485. });
  1486. // 构造基本的文档
  1487. var dom = cewih('div', line).firstChild;
  1488. // 将引用的设置控件填回
  1489. var pf = Array.apply(Array, dom.querySelectorAll('span.yawf-configPrefill'));
  1490. pf.forEach(function (pfi) {
  1491. pfi.parentNode.replaceChild(ref[pfi.id].show(), pfi);
  1492. });
  1493. if (binder) binder(dom, item);
  1494. return dom;
  1495. };
  1496. };
  1497.  
  1498. // 副标题
  1499. var subtitle = base('Subtitle');
  1500. // 文本
  1501. var text = base('Text');
  1502. // 不缩进的文本
  1503. var remark = base('Remark');
  1504.  
  1505. // 真假值的设置项
  1506. var boolean = base('Boolean', function (dom, item) {
  1507. bindInputValue.checkbox(dom.querySelector('input'), item);
  1508. });
  1509.  
  1510. // 选择框设置项
  1511. var select = base('Select', function (dom, item) {
  1512. var select = dom.querySelector('select');
  1513. var defaultValue = item['default'] || item.select.key;
  1514. var keys = item.select.map(function (option) {
  1515. select.appendChild(cewih('select', fillStr(html.option, option)).firstChild);
  1516. return option.value;
  1517. });
  1518. bindInputValue.select(select, item, function (val) {
  1519. return keys.indexOf(val) === -1 ? defaultValue : val;
  1520. });
  1521. });
  1522.  
  1523. // 字符串的设置项
  1524. var string = base('String', function (dom, item) {
  1525. var textarea = dom.querySelector('textarea');
  1526. var onchange = bindInputValue.text(textarea, item);
  1527. textarea.addEventListener('keyup', function () {
  1528. call(onchange);
  1529. });
  1530. });
  1531.  
  1532. // 颜色的设置项
  1533. var color = base('Color', function (dom, item) {
  1534. bindInputValue.text(dom.querySelector('input'), item);
  1535. });
  1536.  
  1537. // 数字的设置项
  1538. var number = base('Number', function (dom, item) {
  1539. var number = dom.querySelector('input');
  1540. var max = Infinity, min = -Infinity;
  1541. if ('max' in item) max = item.max;
  1542. if ('min' in item) min = item.min;
  1543. if (min > max) min = max;
  1544. number.min = min; number.max = max;
  1545. bindInputValue.text(number, item, function (val) {
  1546. if (isNaN(Number(val))) return val = 0;
  1547. return Math.min(max, Math.max(min, Number(val)));
  1548. });
  1549. });
  1550.  
  1551. // 字符串数组设置项模板
  1552. var items = function (base, genli) {
  1553. var item = this;
  1554. var dom = cewih('div', fillStr(base, item)).firstChild;
  1555. var form = dom.querySelector('form'), input = dom.querySelector('input'), ul = dom.querySelector('ul');
  1556. var shown = {};
  1557. // 将某个已经有的字符串显示到末尾
  1558. var moveToEnd = function (x) {
  1559. var p = x.parentNode; p.appendChild(p.removeChild(x));
  1560. };
  1561. // 显示一个新的字符串
  1562. var showStrings = function (userinput, str, onsucc, ondone) {
  1563. genli(item, userinput, str, function (str, li) {
  1564. if (ondone) ondone();
  1565. if (!str || !li) return;
  1566. if (shown[str]) return moveToEnd(shown[str]);
  1567. var del = li.querySelector('a.icon_close');
  1568. del.addEventListener('click', function () {
  1569. delete shown[str];
  1570. if (item.del) item.del(str);
  1571. li.parentNode.removeChild(li);
  1572. item.delconf(str);
  1573. });
  1574. ul.appendChild(shown[str] = li);
  1575. if (onsucc) onsucc(str);
  1576. });
  1577. };
  1578. item.getconf().forEach(function (str) { showStrings(false, str); });
  1579. form.addEventListener('submit', function (e) {
  1580. e.preventDefault();
  1581. var str = input.value;
  1582. input.disabled = true;
  1583. showStrings(true, str, function (str) {
  1584. if (item.add) item.add(str);
  1585. item.addconf(str);
  1586. }, function () {
  1587. input.value = '';
  1588. input.disabled = false;
  1589. });
  1590. });
  1591. return dom;
  1592. };
  1593.  
  1594. // 字符串设置项
  1595. var strings = function () {
  1596. return items.call(this, html.configStrings, function (item, userinput, str, callback) {
  1597. if (userinput && item.add && !(str = item.add(str))) callback();
  1598. else callback(str, cewih('ul', fillStr(html.configStringsItem, { 'item': item.display ? item.display(str) : str })).firstChild);
  1599. });
  1600. };
  1601.  
  1602. // 用户列表的设置项
  1603. var users = function () {
  1604. return items.call(this, html.configUsers, function (item, userinput, str, callback) {
  1605. var showUserNotExistError = function () {
  1606. Alert('yawf-user-not-exist', {
  1607. 'title': fillStr('{{accountNotExistErrorTitle}}'),
  1608. 'text': fillStr('{{{accountNotExistError}}}', { 'name': escapeXml(str) }),
  1609. 'icon': 'error'
  1610. });
  1611. callback();
  1612. };
  1613. if (userinput) {
  1614. if (!(str = str.trim().replace(/^@/, ''))) return callback();
  1615. account.name(str, function (info) {
  1616. if (!info) showUserNotExistError();
  1617. else if (item.add && !item.add(info)) callback();
  1618. else callback(info.id, cewih('ul', fillStr(html.configUsersItem, info)).firstChild);
  1619. }, showUserNotExistError);
  1620. } else {
  1621. var emptyInfo = { 'id': str, 'name': ' ', 'avatar': ' ' };
  1622. var li = cewih('ul', fillStr(html.configUsersItem, emptyInfo)).firstChild;
  1623. callback(str, li);
  1624. account.id(str, function (info) {
  1625. var u = li.querySelector('[uid]');
  1626. u.setAttribute('uid', info.id); u.setAttribute('title', info.name); u.textContent = info.name;
  1627. var p = li.querySelector('.pic img');
  1628. p.src = info.avatar;
  1629. });
  1630. }
  1631. });
  1632. };
  1633.  
  1634. // 一个有数字和垂直范围条的输入框
  1635. var range = base('Range', function (dom, item) {
  1636. var n = dom.querySelector('input[type="number"]');
  1637. var r = dom.querySelector('input[type="range"]');
  1638. var step = item.step || 1;
  1639. n.max = item.max; r.max = item.max;
  1640. n.min = item.min; r.min = item.min;
  1641. n.step = step; r.step = step;
  1642. n.style.width = 10 * String(item.max).length + 15 + 'px';
  1643. var onchange = bindInputValue.text(n, item, function (val) {
  1644. if (isNaN(parseInt(val))) return item['default'] || item.min;
  1645. var val = Math.min(Math.max(parseInt(val), item.min), item.max);
  1646. return Math.round((val - item.min) / step) * step + item.min;
  1647. });
  1648. r.value = n.value;
  1649. var updateN = function () { if (r.value !== n.value) n.value = r.value; onchange(); };
  1650. var updateR = function () { if (r.value !== n.value) r.value = n.value; onchange(); };
  1651. r.addEventListener('change', updateN); r.addEventListener('mousemove', updateN);
  1652. n.addEventListener('change', updateR); n.addEventListener('keypress', updateR);
  1653. });
  1654.  
  1655. // 一个输入按键的输入框
  1656. var key = base('Key', function (dom, item) {
  1657. var i = dom.querySelector('input'), s = dom.querySelector('button');
  1658. var copyName = function () { s.textContent = keys.name(Number(i.value)); };
  1659. var eventClear = function (e) { e.stopPropagation(); e.preventDefault(); };
  1660. var valid = function (key) { if (key === 27) return 0; return key; }
  1661. var onchange = bindInputValue.text(i, item, function (val) {
  1662. call(copyName); return Number(val);
  1663. });
  1664. dom.addEventListener('keydown', function (e) {
  1665. var val = valid(keys.get(e));
  1666. i.value = val;
  1667. copyName();
  1668. onchange();
  1669. eventClear(e);
  1670. }, false);
  1671. dom.addEventListener('keyup', eventClear, false);
  1672. dom.addEventListener('keypress', eventClear, false);
  1673. i.addEventListener('change', copyName);
  1674. call(copyName);
  1675. });
  1676.  
  1677. return {
  1678. 'subtitle': subtitle,
  1679. 'text': text,
  1680. 'remark': remark,
  1681. 'string': string,
  1682. 'color': color,
  1683. 'number': number,
  1684. 'select': select,
  1685. 'strings': strings,
  1686. 'boolean': boolean,
  1687. 'users': users,
  1688. 'range': range,
  1689. 'key': key,
  1690. };
  1691. }());
  1692.  
  1693. // 过滤器组
  1694. var filterGroup = function (groupName) {
  1695. var items = [];
  1696. // 向过滤器组里面添加一个项目
  1697. var add = function (item) {
  1698. // 先加入所有被引用的对象
  1699. if (item.ref) Object.keys(item.ref).forEach(function (key) {
  1700. item.ref[key].key = item.key + '.' + key;
  1701. item.ref[key].nogui = true;
  1702. add(item.ref[key]);
  1703. });
  1704. // 再加入自己
  1705. items.push(item);
  1706. return item;
  1707. };
  1708. // 网页被初始化时初始化所有过滤器
  1709. var init = function () {
  1710. items.forEach(withTry(function (item) {
  1711. // 初始化过滤器的设置
  1712. if (item.type && typedConfig[item.type])
  1713. item.conf = typedConfig[item.type](item);
  1714. // 初始化过滤器的显示
  1715. if (!item.show && item.type && typedHtml[item.type])
  1716. item.show = typedHtml[item.type].bind(item);
  1717. // 过滤器自己的初始化
  1718. if (item.init) item.init();
  1719. // 真假设置项若设置激活时调用
  1720. if (item.type === 'boolean' && item.conf && item.ainit) item.ainit();
  1721. // 将规则加入到列表中
  1722. if (item.rule) rules.add(item.priority || 0, item.rule.bind(item));
  1723. }));
  1724. };
  1725. // 需要显示选项时生成界面
  1726. var show = function (inner) {
  1727. items.forEach(withTry(function (item) {
  1728. var dom = null;
  1729. if (item.show) dom = item.show(dom);
  1730. if (dom) {
  1731. if (item.shown) item.shown(dom);
  1732. if (!item.nogui) inner.appendChild(dom);
  1733. }
  1734. }));
  1735. };
  1736. // 注册到过滤器分组
  1737. var group = {
  1738. 'name': groupName,
  1739. 'show': show,
  1740. 'init': init,
  1741. 'add': add
  1742. };
  1743. return filters.add(group);
  1744. };
  1745.  
  1746. // 把后面的对象的元素加到第一个上面去
  1747. var extend = function (obj1) {
  1748. return Array.apply(Array, arguments).reduce(function (x, y) {
  1749. for (var k in y) x[k] = y[k];
  1750. return x;
  1751. });
  1752. };
  1753.  
  1754. // 当前是查看分组的页面吗?
  1755. var onGroupPage = function () {
  1756. return location.pathname.slice(-9) === '/mygroups';
  1757. };
  1758.  
  1759. // 白名单、黑名单和折叠名单一式三份
  1760. var allInOneFilters = function (details, typedFilterGroup) {
  1761. var filters = [
  1762. { 'type': 'whitelist', 'priority': 1e5, 'action': 'show' },
  1763. { 'type': 'blacklist', 'priority': 0, 'action': 'hidden' },
  1764. { 'type': 'foldlist', 'priority': -1e5, 'action': 'fold' },
  1765. ];
  1766. var rules = {};
  1767. typedFilterGroup = typedFilterGroup || filterGroup(details.name + 'FilterGroup');
  1768. typedFilterGroup.add({ 'type': 'subtitle', 'text': '{{' + details.name + 'FilterDetails}}' });
  1769. filters.forEach(function (filter) {
  1770. // 标题
  1771. typedFilterGroup.add({
  1772. 'type': 'remark',
  1773. 'text': '{{{' + filter.type + 'FilterDesc}}}',
  1774. 'typed': '{{' + details.name + 'FilterDetails}}',
  1775. 'shown': function (dom) {
  1776. dom.classList.add('yawf-' + filter.type + 'FilterTitle');
  1777. },
  1778. });
  1779. // 过滤器
  1780. var rule = {
  1781. 'type': details.type || 'strings',
  1782. 'key': 'weibo.filters.' + details.name + '.' + filter.type,
  1783. 'priority': filter.priority,
  1784. 'text': '{{' + details.name + 'FilterDesc}}',
  1785. };
  1786. if (details.add) rule.add = details.add.bind(rule);
  1787. if (details.display) rule.display = details.display.bind(rule);
  1788. rule.rule = details.rule.bind(rule, filter.action);
  1789. if (details[filter.type]) {
  1790. Object.keys(details[filter.type]).forEach(function (override) {
  1791. rule[override] = details[filter.type][override](rule[override]);
  1792. });
  1793. }
  1794. rules[filter.type] = typedFilterGroup.add(rule);
  1795. });
  1796. // 快速创建过滤器的拖动
  1797. if (details.fast) {
  1798. dropdown.add({
  1799. 'valid': details.fast.valid,
  1800. 'desc': details.fast.desc,
  1801. 'add': function (val, action) {
  1802. var value = details.fast.add(val);
  1803. if (details.add) value = details.add(value);
  1804. rules[action].addconf(value);
  1805. },
  1806. });
  1807. }
  1808. typedFilterGroup.rules = rules;
  1809. return typedFilterGroup;
  1810. };
  1811.  
  1812. // 方便的选择器
  1813. var weiboContentSelector = function (feed, f) {
  1814. var content = feed.querySelector('[node-type="feed_list_content"]');
  1815. var reason = feed.querySelector('[node-type="feed_list_reason"] em');
  1816. var items = [];
  1817. if (content) items = items.concat(Array.apply(Array, f(content)));
  1818. if (reason) items = items.concat(Array.apply(Array, f(reason)));
  1819. return items;
  1820. };
  1821.  
  1822. var validKeywordItem = function (wrap) {
  1823. wrap = wrap || function (x) { return x; };
  1824. return function (element, callback) {
  1825. var valid = false;
  1826. if (element.nodeType === Node.TEXT_NODE) valid = true;
  1827. else if ((element.tagName || '').toLowerCase() === 'em' &&
  1828. element.firstChild === element.lastChild &&
  1829. element.firstChild.nodeType === Node.TEXT_NODE) valid = true;
  1830. if (valid) callback({ 'text': wrap(element.textContent) }); else callback();
  1831. };
  1832. };
  1833.  
  1834. // 快速创建一个关键词或正则式的过滤器
  1835. var keywordOrRegexFastDesc = function (type) {
  1836. return function (dom, val) {
  1837. dom.innerHTML = fillStr('{{{' + type + 'FilterFast}}}');
  1838. var labelc = cewih('div', html.fastFilterString).firstChild;
  1839. labelc.querySelector('span').innerHTML = fillStr('{{{' + type + 'FilterFastInput}}}', { 'text': html.fastFilterStringInput });
  1840. var input = labelc.querySelector('input'); input.value = val.text;
  1841. var ref = dom.parentNode; ref.parentNode.insertBefore(labelc, ref.nextSibling);
  1842. input.addEventListener('change', function () { val.text = input.value; });
  1843. var checkbox = ref.parentNode.querySelector('input[type=checkbox]');
  1844. checkbox.type = 'radio'; checkbox.name = 'yawfKeywordOrRegexp';
  1845. return type === 'keyword';
  1846. };
  1847. };
  1848.  
  1849. // 从一条微博中获取他的内容
  1850. var getWeiboContent = (function () {
  1851. var active = [function (node) {
  1852. if (node.nodeType === Node.TEXT_NODE) return node.textContent;
  1853. }];
  1854. var types = {
  1855. 'mention': function (node) {
  1856. if (node.tagName.toLowerCase() === 'a' && node.getAttribute('usercard'))
  1857. return node.textContent;
  1858. },
  1859. 'topic': function (node) {
  1860. if (node.tagName.toLowerCase() === 'a' && node.classList.contains('a_topic'))
  1861. return node.textContent;
  1862. },
  1863. 'link': function (node) {
  1864. if (node.tagName.toLowerCase() === 'a' && node.getAttribute('mt') === 'url')
  1865. return node.getAttribute('title');
  1866. },
  1867. 'emotion': function (node) {
  1868. if (node.tagName.toLowerCase() === 'img' && node.getAttribute('alt'))
  1869. return node.getAttribute('alt');
  1870. },
  1871. };
  1872. var match = function (feed) {
  1873. return weiboContentSelector(feed, function (m) {
  1874. return Array.apply(Array, m.childNodes).map(function (node) {
  1875. for (var i = 0, l = active.length; i < l; i++) {
  1876. var val = null;
  1877. try { val = active[i](node); } catch (e) { debug(e); }
  1878. if (val != null) return val;
  1879. }
  1880. return '';
  1881. });
  1882. }).join('');
  1883. };
  1884. match.active = function (type) {
  1885. active.push(types[type]);
  1886. return type;
  1887. };
  1888. return match;
  1889. }());
  1890.  
  1891. // 基于内容的过滤
  1892. var contentFilterGroup = filterGroup('contentFilterGroup');
  1893.  
  1894. // 关键字过滤
  1895. var keywordFilterGroup = allInOneFilters({
  1896. 'name': 'keyword',
  1897. 'add': function (s) { return s.trim(); },
  1898. 'rule': function keywordMatch(action, feed) {
  1899. var keywords = this.conf;
  1900. var texts = getWeiboContent(feed).toUpperCase();
  1901. var match = keywords.some(function (keyword) {
  1902. if (!keyword) return false;
  1903. return texts.indexOf(keyword.toUpperCase()) !== -1;
  1904. });
  1905. if (match) return action; else return null;
  1906. },
  1907. 'fast': {
  1908. 'valid': validKeywordItem(),
  1909. 'desc': keywordOrRegexFastDesc('keyword'),
  1910. 'add': function (val) { return val.text; },
  1911. }
  1912. }, contentFilterGroup);
  1913.  
  1914. var addRegexpChecker = function (s) {
  1915. s = s.trim();
  1916. if (s[0] === '/' && s[s.length - 1] === '/') s = s.slice(1, -1);
  1917. try { RegExp(s).exec(''); } catch (e) {
  1918. Alert('yawf-regexp-bad-formed', {
  1919. 'title': fillStr('{{regexpBadFormedTitle}}'),
  1920. 'text': fillStr('{{{regexpBadFormed}}}', { 'regexp': escapeXml(s) }),
  1921. 'icon': 'error'
  1922. });
  1923. s = null;
  1924. }
  1925. return s;
  1926. };
  1927.  
  1928. var compileRegexen = function () {
  1929. if (!this.regexen) this.regexen = this.conf.map(function (s) {
  1930. try { return RegExp(s); }
  1931. catch (e) { debug('erorr while compile regexp %s : %o', s, e); }
  1932. }).filter(function (x) { return x; });
  1933. };
  1934.  
  1935. // 按照正则式过滤
  1936. var regexpFilterGroup = allInOneFilters({
  1937. 'name': 'regexp',
  1938. 'add': addRegexpChecker,
  1939. 'display': function (s) { return '/' + s + '/'; },
  1940. 'rule': function regexpMatch(action, feed) {
  1941. compileRegexen.call(this);
  1942. var regexen = this.regexen;
  1943. var texts = getWeiboContent(feed);
  1944. var match = regexen.some(function (regexp) {
  1945. return !!(regexp.exec(texts));
  1946. });
  1947. if (match) return action; else return null;
  1948. },
  1949. 'fast': {
  1950. 'valid': validKeywordItem(function (s) {
  1951. return s.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
  1952. }),
  1953. 'desc': keywordOrRegexFastDesc('regexp'),
  1954. 'add': function (val) { return val.text; },
  1955. }
  1956. }, contentFilterGroup);
  1957.  
  1958. // 关于正则式的说明
  1959. regexpFilterGroup.add({
  1960. 'type': 'text',
  1961. 'text': '{{regexpFilterRemark}}',
  1962. });
  1963.  
  1964. // 其他被视为内容的元素
  1965. contentFilterGroup.add({
  1966. 'type': 'subtitle',
  1967. 'text': '{{contentTypesTitle}}',
  1968. });
  1969.  
  1970. var contentTypes = (function (types) {
  1971. var ts = Object.keys(types);
  1972. ts.forEach(function (t) {
  1973. var tt = t[0].toUpperCase() + t.slice(1);
  1974. types[t] = contentFilterGroup.add({
  1975. 'type': 'boolean',
  1976. 'text': '{{contentTypes' + tt + '}}',
  1977. 'key': 'weibo.content.types_' + t,
  1978. 'default': types[t],
  1979. 'ainit': function () {
  1980. getWeiboContent.active(t);
  1981. },
  1982. });
  1983. });
  1984. return types;
  1985. }({
  1986. 'mention': true,
  1987. 'topic': true,
  1988. 'link': false,
  1989. 'emotion': false,
  1990. }));
  1991.  
  1992. // 从一条微博中找到他的作者
  1993. var getFeedAuthorId = function (feed) {
  1994. var author = feed.querySelector('.WB_name[usercard]');
  1995. if (!author) return null;
  1996. return author.getAttribute('usercard').split('=')[1];
  1997. };
  1998.  
  1999. // 检查一个元素是不是用户相关的
  2000. var validUserElement = function (element, callback) {
  2001. if (element.nodeType === Node.TEXT_NODE) return callback();
  2002. var a = null;
  2003. // 作者或来源
  2004. try {
  2005. if (element.classList.contains('WB_name')) a = element;
  2006. else a = element.querySelector('.WB_name');
  2007. if (a && (a.getAttribute('usercard') || '').indexOf('id=') === 0) {
  2008. return callback({
  2009. 'name': a.getAttribute('title'),
  2010. 'id': a.getAttribute('usercard').slice(3),
  2011. });
  2012. }
  2013. } catch (e) { }
  2014. // 提及,别名
  2015. try {
  2016. if (element.getAttribute('usercard')) a = element;
  2017. else a = element.querySelector('[usercard]');
  2018. if (a && (a.getAttribute('usercard') || '').indexOf('name=') === 0) {
  2019. return account.name(a.getAttribute('usercard').slice(5), callback, callback);
  2020. }
  2021. if (a && (a.getAttribute('usercard') || '').indexOf('id=') === 0) {
  2022. return account.id(a.getAttribute('usercard').slice(3), callback, callback);
  2023. }
  2024. } catch (e) { }
  2025. // 其他
  2026. try {
  2027. if (element.getAttribute('title') && element.getAttribute('uid')) a = element;
  2028. else if (element.getAttribute('title') && element.getAttribute('usercard').indexOf('id=') === 0) a = element;
  2029. else a = element.querySelector('[title][uid], [title][usercard^="id="]');
  2030. if (a) {
  2031. return callback({
  2032. 'name': a.getAttribute('title'),
  2033. 'id': a.getAttribute('uid') || a.getAttribute('usercard').slice(3),
  2034. });
  2035. }
  2036. } catch (e) { }
  2037. callback();
  2038. };
  2039.  
  2040. // 作者用户过滤
  2041. var accountFilterGroup = allInOneFilters({
  2042. 'name': 'account',
  2043. 'type': 'users',
  2044. 'rule': function accountMatch(action, feed) {
  2045. var accounts = this.conf, id = getFeedAuthorId(feed);
  2046. if (!id) return null;
  2047. var match = accounts.some(function (x) { return x === id; });
  2048. if (match) return action; else return null;
  2049. },
  2050. 'blacklist': {
  2051. 'rule': function accountMatchBlacklistOverride(_super) {
  2052. return function accountMatchBlacklist(feed) {
  2053. if (!accountByGroup.conf || !onGroupPage()) return _super(feed);
  2054. return null;
  2055. };
  2056. },
  2057. },
  2058. 'fast': {
  2059. 'valid': validUserElement,
  2060. 'desc': function (dom, val) {
  2061. dom.innerHTML = fillStr('{{{accountFilterFast}}}', { 'name': escapeXml(val.name) });
  2062. return true;
  2063. },
  2064. 'add': function (val) { return val.id; },
  2065. },
  2066. });
  2067.  
  2068. accountFilterGroup.add({
  2069. 'type': 'text',
  2070. 'text': '{{accountFilterRemark}}',
  2071. });
  2072.  
  2073.  
  2074. // 从一条微博中找到他的作者
  2075. var getFeedOriginalId = function (feed) {
  2076. var originalAuthor = feed.querySelector('.WB_media_expand .WB_info .WB_name');
  2077. if (!originalAuthor) return null;
  2078. return originalAuthor.getAttribute('usercard').split('=')[1];
  2079. };
  2080.  
  2081. // 原创用户过滤
  2082. var originalFilterGroup = allInOneFilters({
  2083. 'name': 'original',
  2084. 'type': 'users',
  2085. 'rule': function originalMatch(action, feed) {
  2086. var originals = this.conf, id = getFeedOriginalId(feed);
  2087. if (!id) return null;
  2088. var match = originals.some(function (x) { return x === id; });
  2089. if (match) return action; else return null;
  2090. },
  2091. 'fast': {
  2092. 'valid': validUserElement,
  2093. 'desc': function (dom, val) {
  2094. dom.innerHTML = fillStr('{{{originalFilterFast}}}', { 'name': escapeXml(val.name) });
  2095. return true;
  2096. },
  2097. 'add': function (val) { return val.id; },
  2098. },
  2099. }, accountFilterGroup);
  2100.  
  2101. // 找到在一条微博里面被提到的人的昵称
  2102. var getFeedMentionList = function (feed) {
  2103. return weiboContentSelector(feed, function (m) {
  2104. return Array.apply(Array, m.querySelectorAll('a[usercard^="name="][href$="loc=at"]'));
  2105. }).map(function (link) {
  2106. return link.getAttribute('usercard').slice('name='.length);
  2107. });
  2108. };
  2109.  
  2110. // 提到某人的微博
  2111. var mentionFilterGroup = allInOneFilters({
  2112. 'name': 'mention',
  2113. 'type': 'strings',
  2114. 'add': function (s) { return s.trim().replace(/^@/, ''); },
  2115. 'display': function (s) { return '@' + s; },
  2116. 'rule': function mentionMatch(action, feed) {
  2117. var mentions = this.conf, users = getFeedMentionList(feed);
  2118. var match = users.some(function (name) {
  2119. return mentions.indexOf(name) !== -1;
  2120. });
  2121. if (match) return action; else return null;
  2122. },
  2123. 'fast': {
  2124. 'valid': validUserElement,
  2125. 'desc': function (dom, val) {
  2126. dom.innerHTML = fillStr('{{{mentionFilterFast}}}', { 'name': escapeXml(val.name) });
  2127. return true;
  2128. },
  2129. 'add': function (val) { return val.name; },
  2130. },
  2131. }, accountFilterGroup);
  2132.  
  2133. var getFeedTopicList = function (feed) {
  2134. return weiboContentSelector(feed, function (m) {
  2135. return Array.apply(Array, m.querySelectorAll('.a_topic'));
  2136. }).map(function (topic) { return topic.textContent; });
  2137. };
  2138.  
  2139. var validTopicItem = function (element, callback) {
  2140. var a = null;
  2141. if (element.nodeType === Node.TEXT_NODE) return callback();
  2142. try {
  2143. if (element.tagName.toLowerCase() === 'a' && element.classList.contains('a_topic')) a = element;
  2144. else a = element.querySelector('a.a_topic');
  2145. if (a) return callback({ 'topic': a.textContent.trim().replace(/#/g, '') });
  2146. } catch (e) { }
  2147. try {
  2148. if (element.tagName.toLowerCase() === 'a' && element.getAttribute('suda-uatrack').indexOf('hottopic_r1') !== -1) a = element;
  2149. else a = element.querySelector('a[suda-uatrack*="hottopic_r1"]');
  2150. if (a) return callback({ 'topic': a.textContent.trim().replace(/#/g, '') });
  2151. } catch (e) { }
  2152. try {
  2153. if (element.tagName.toLowerCase() === 'a' && element.getAttribute('suda-uatrack').indexOf('1022-topic') !== -1) a = element;
  2154. else a = element.querySelector('a[suda-uatrack*="1022-topic"]');
  2155. if (a) return callback({ 'topic': a.textContent.trim().replace(/#/g, '') });
  2156. } catch (e) { }
  2157. callback();
  2158. };
  2159.  
  2160. // 话题过滤
  2161. var topicFilterGroup = allInOneFilters({
  2162. 'name': 'topic',
  2163. 'add': function (s) { return s.trim().replace(/#/g, ''); },
  2164. 'display': function (s) { return '#' + s + '#'; },
  2165. 'rule': function topicMatch(action, feed) {
  2166. var topics = this.conf;
  2167. var text = getFeedTopicList(feed).join('##');
  2168. var match = topics.some(function (topic) { return text.indexOf(topic) !== -1; });
  2169. if (match) return action; else return null;
  2170. },
  2171. 'fast': {
  2172. 'valid': validTopicItem,
  2173. 'desc': function (dom, val) {
  2174. dom.innerHTML = fillStr('{{{topicFilterFast}}}', { 'topic': escapeXml(val.topic) });
  2175. return true;
  2176. },
  2177. 'add': function (val) { return val.topic; },
  2178. }
  2179. });
  2180.  
  2181. // 正则话题
  2182. var regexpTopicFilterGroup = allInOneFilters({
  2183. 'name': 'rtopic',
  2184. 'add': addRegexpChecker,
  2185. 'display': function (s) { return '/' + s + '/'; },
  2186. 'rule': function rtopicMatch(action, feed) {
  2187. compileRegexen.call(this);
  2188. var regexen = this.regexen;
  2189. var topics = getFeedTopicList(feed);
  2190. var match = regexen.some(function (regexp) {
  2191. return topics.some(function (topic) {
  2192. return !!regexp.exec(topic);
  2193. });
  2194. });
  2195. if (match) return action; else return null;
  2196. },
  2197. }, topicFilterGroup);
  2198.  
  2199.  
  2200. // 获取一条微博的所有来源(包括转发)
  2201. var getFeedSourceList = function (feed) {
  2202. return ['[node-type="feed_list_funcLink"] [action-type="app_source"]',
  2203. '.WB_media_expand [action-type="app_source"]'].map(function (qs) {
  2204. var st = feed.querySelector(qs); if (!st) return null;
  2205. return st.getAttribute('title') || st.textContent || '未通过审核应用';
  2206. }).filter(function (x) { return x; });
  2207. };
  2208.  
  2209. // 来源过滤
  2210. var sourceFilterGroup = allInOneFilters({
  2211. 'name': 'source',
  2212. 'add': function (s) {
  2213. s = s.trim();
  2214. if (s === '微博 weibo.com') {
  2215. Alert('yawf-source-filter-warning', {
  2216. 'title': fillStr('{{sourceFilterWarningTitle}}'),
  2217. 'text': fillStr('{{sourceFilterWarning}}'),
  2218. 'icon': 'error'
  2219. });
  2220. s = null;
  2221. }
  2222. return s;
  2223. },
  2224. 'rule': function sourceMatch(action, feed) {
  2225. var sources = this.conf, _sources = getFeedSourceList(feed);
  2226. var match = _sources.some(function (s) { return sources.indexOf(s) !== -1; });
  2227. if (match) return action; else return null;
  2228. },
  2229. 'fast': {
  2230. 'valid': function (element, callback) {
  2231. var a = null;
  2232. if (element.nodeType === Node.TEXT_NODE) return callback();
  2233. try {
  2234. if (element.getAttribute('action-type') === 'app_source') a = element;
  2235. else a = element.querySelector('[action-type="app_source"]');
  2236. if (a) {
  2237. var source = a.getAttribute('title') || a.textContent || '未通过审核应用';
  2238. if (source && source !== '微博 weibo.com') return callback({ 'source': source });
  2239. }
  2240. } catch (e) { debug('%o: %o', e, e.stack); }
  2241. callback();
  2242. },
  2243. 'desc': function (dom, val) {
  2244. dom.innerHTML = fillStr('{{{sourceFilterFast}}}', { 'source': escapeXml(val.source) });
  2245. return true;
  2246. },
  2247. 'add': function (val) { return val.source; },
  2248. }
  2249. });
  2250.  
  2251. // 从一条微博中找到所有超链接
  2252. var getFeedHyperlinkList = function (feed) {
  2253. return Array.apply(Array, feed.querySelectorAll('a[title][href^="http://t.cn/"]')).map(function (a) {
  2254. return a.getAttribute('title');
  2255. });
  2256. };
  2257.  
  2258. // 超链接过滤
  2259. var hyperlinkFilterGroup = allInOneFilters({
  2260. 'name': 'hyperlink',
  2261. 'add': function (s) { return s.trim(); },
  2262. 'rule': function hyperlinkMatch(action, feed) {
  2263. var links = this.conf, _links = getFeedHyperlinkList(feed);
  2264. var match = _links.some(function (l) {
  2265. return links.some(function (link) {
  2266. return l.indexOf(link) !== -1;
  2267. });
  2268. });
  2269. if (match) return action; else return null;
  2270. },
  2271. 'fast': {
  2272. 'valid': function (element, callback) {
  2273. if (element.nodeType === Node.TEXT_NODE) return callback();
  2274. try {
  2275. var a;
  2276. if (element.tagName.toLowerCase() === 'a' &&
  2277. element.getAttribute('title') &&
  2278. element.getAttribute('href').indexOf('http://t.cn/') === 0) a = element;
  2279. else a = element.querySelector('a[title][href^="http://t.cn/"]');
  2280. if (a) {
  2281. var x = document.createElement('a'); x.href = a.getAttribute('title');
  2282. if (x.host !== 'weibo.com') return callback({ 'host': x.host });
  2283. }
  2284. } catch (e) { }
  2285. callback();
  2286. },
  2287. 'desc': function (dom, val) {
  2288. dom.innerHTML = fillStr('{{{hyperlinkFilterFast}}}', { 'host': escapeXml(val.host) });
  2289. return true;
  2290. },
  2291. 'add': function (val) { return val.host; },
  2292. },
  2293. });
  2294.  
  2295. var otherFilterGroup = filterGroup('otherFilterGroup');
  2296.  
  2297. otherFilterGroup.add({
  2298. 'type': 'subtitle',
  2299. 'text': '{{otherWhitelistTitle}}'
  2300. });
  2301.  
  2302. // 总是显示自己的微博
  2303. otherFilterGroup.add({
  2304. 'type': 'boolean',
  2305. 'key': 'weibo.other.my_weibo',
  2306. 'text': '{{showMyWeiboDesc}}',
  2307. 'priority': 1e5 - 1e3, // 略低于白名单,但高于其他
  2308. 'rule': function showMyWeiboRule(feed) {
  2309. if (!this.conf) return;
  2310. if (getFeedAuthorId(feed) === config.uid) return 'showme'; else return null;
  2311. },
  2312. });
  2313.  
  2314. // 总是显示自己原创的微博
  2315. otherFilterGroup.add({
  2316. 'type': 'boolean',
  2317. 'key': 'weibo.other.my_original',
  2318. 'text': '{{showMyOriginalDesc}}',
  2319. 'priority': 1e5 - 1e3, // 略低于白名单,但高于其他
  2320. 'rule': function showMyOriginalRule(feed) {
  2321. if (!this.conf) return;
  2322. if (getFeedOriginalId(feed) === config.uid) return 'showme'; else return null;
  2323. },
  2324. });
  2325.  
  2326. // 总是显示自己原创的微博
  2327. otherFilterGroup.add({
  2328. 'type': 'boolean',
  2329. 'key': 'weibo.other.mention_me',
  2330. 'text': '{{showMentionMeDesc}}',
  2331. 'priority': 1e5 - 1e3, // 略低于白名单,但高于其他
  2332. 'rule': function showMentionMeRule(feed) {
  2333. if (!this.conf) return;
  2334. if (getFeedMentionList(feed).indexOf(config.uid) !== -1) return 'showme'; else return null;
  2335. },
  2336. });
  2337.  
  2338. otherFilterGroup.add({
  2339. 'type': 'subtitle',
  2340. 'text': '{{otherBlacklistTitle}}'
  2341. });
  2342.  
  2343. // 推广微博
  2344. otherFilterGroup.add({
  2345. 'type': 'boolean',
  2346. 'key': 'weibo.other.ad_feed',
  2347. 'text': '{{adfeedFilterDesc}}',
  2348. 'priority': 1e5 + 1e3, // 优先于白名单
  2349. 'rule': function adFeedFilterRule(feed) {
  2350. if (!this.conf) return null;
  2351. return feed.getAttribute('feedtype') === 'ad' ? 'hidden' : null;
  2352. },
  2353. });
  2354.  
  2355. // 混入新鲜事流的其他东西
  2356. otherFilterGroup.add({
  2357. 'type': 'boolean',
  2358. 'key': 'weibo.other.fake_weibo',
  2359. 'text': '{{fakeWeiboFilterDesc}}',
  2360. 'rule': function fakeWeiboFilterRule(feed) {
  2361. if (!this.conf) return null;
  2362. if (!feed.getAttribute('mid')) return 'hidden';
  2363. return null;
  2364. },
  2365. });
  2366.  
  2367. // 已删除或没有权限查看的微博的转发
  2368. otherFilterGroup.add({
  2369. 'type': 'boolean',
  2370. 'key': 'weibo.other.deleted_forward',
  2371. 'text': '{{deletedForwardFilterDesc}}',
  2372. 'rule': function deletedForwardFilterRule(feed) {
  2373. if (!this.conf) return null;
  2374. if (feed.getAttribute('isforward') === '1' &&
  2375. !feed.querySelector('.WB_media_expand .WB_info .WB_name')) return 'hidden';
  2376. return null;
  2377. },
  2378. });
  2379.  
  2380. // 投票微博
  2381. otherFilterGroup.add({
  2382. 'type': 'boolean',
  2383. 'key': 'weibo.other.vote_weibo',
  2384. 'text': '{{voteWeiboFilterDesc}}',
  2385. 'rule': function voteWeiboFilterRule(feed) {
  2386. if (!this.conf) return null;
  2387. if (feed.querySelector('.WB_from a[href^="http://vote.weibo.com/"]'))
  2388. return 'hidden';
  2389. return null;
  2390. },
  2391. });
  2392.  
  2393. // 淘宝/天猫商品
  2394. otherFilterGroup.add({
  2395. 'type': 'boolean',
  2396. 'key': 'weibo.other.tb_tm_wb',
  2397. 'text': '{{taobaoTianmaoWeibo}}',
  2398. 'rule': function taobaoTianmaoFilterRule(feed) {
  2399. if (!this.conf) return null;
  2400. if (feed.querySelector('a .icon_fl_tb, a .icon_fl_tmall'))
  2401. return 'hidden';
  2402. return null;
  2403. },
  2404. });
  2405.  
  2406. // 刷屏与版聊
  2407. otherFilterGroup.add({
  2408. 'type': 'subtitle',
  2409. 'text': '{{otherSpammingTitle}}',
  2410. });
  2411.  
  2412. // 添加数量和折叠/隐藏的
  2413. var lotShown = function (defnum, defact) {
  2414. return {
  2415. 'number': {
  2416. 'type': 'number',
  2417. 'default': defnum || 3,
  2418. 'min': 1,
  2419. },
  2420. 'action': {
  2421. 'type': 'select',
  2422. 'default': defact || 'fold',
  2423. 'select': [
  2424. { 'value': 'fold', 'text': '{{foldlistActionDesc}}' },
  2425. { 'value': 'hidden', 'text': '{{blacklistActionDesc}}' },
  2426. ]
  2427. },
  2428. };
  2429. };
  2430.  
  2431. // 相同账号的过多微博
  2432. otherFilterGroup.add({
  2433. 'type': 'boolean',
  2434. 'priority': -1e6, // 低优先级
  2435. 'key': 'weibo.other.same_account',
  2436. 'ref': lotShown(5, 'fold'),
  2437. 'text': '{{sameAccountFilterDesc}}',
  2438. 'rule': function sameAccountRule(feed) {
  2439. if (!this.conf) return null;
  2440. // 如果在分组页面,而且用户设置了分组页面忽略该过滤器,则不工作
  2441. if (sameAccountByGroup.conf && onGroupPage()) return null;
  2442. var author = feed.querySelector('.WB_name[usercard]');
  2443. if (!author) return null;
  2444. var id = author.getAttribute('usercard').split('=')[1];
  2445. var number = document.querySelectorAll('[node-type="feed_list"] ' +
  2446. '.WB_feed_type[yawf-display]:not([yawf-display$="-fold"]):not([yawf-display$="-unfold"]):not([yawf-display$="-hidden"])' +
  2447. '>.WB_feed_datail>.WB_detail>.WB_info>a.WB_name[usercard="id=' + id + '"]').length;
  2448. if (number >= this.ref.number.conf) return 'account-' + this.ref.action.conf; else return null;
  2449. },
  2450. });
  2451.  
  2452.  
  2453. // 相同微博的过多转发
  2454. otherFilterGroup.add({
  2455. 'type': 'boolean',
  2456. 'priority': -1e6, // 低优先级
  2457. 'key': 'weibo.other.same_forward',
  2458. 'ref': lotShown(3, 'fold'),
  2459. 'text': '{{sameForwardFilterDesc}}',
  2460. 'rule': function sameForwardRule(feed) {
  2461. if (!this.conf) return null;
  2462. var omid = feed.getAttribute('omid');
  2463. if (!omid) return null;
  2464. var number = document.querySelectorAll('[node-type="feed_list"] ' +
  2465. '.WB_feed_type[omid="' + omid + '"][yawf-display]:not([yawf-display$="-fold"]):not([yawf-display$="-unfold"]):not([yawf-display$="-hidden"])').length;
  2466. if (number >= this.ref.number.conf) return 'forward-' + this.ref.action.conf; else return null;
  2467. },
  2468. });
  2469.  
  2470. // 分组浏览
  2471. otherFilterGroup.add({
  2472. 'type': 'subtitle',
  2473. 'text': '{{otherGroupTitle}}',
  2474. });
  2475.  
  2476. // 分组浏览不做按帐号隐藏
  2477. var accountByGroup = otherFilterGroup.add({
  2478. 'type': 'boolean',
  2479. 'key': 'weibo.other.group_account',
  2480. 'text': '{{accountByGroup}}',
  2481. });
  2482.  
  2483. // 分组浏览不做刷屏检查
  2484. var sameAccountByGroup = otherFilterGroup.add({
  2485. 'type': 'boolean',
  2486. 'key': 'weibo.other.group_same_account',
  2487. 'text': '{{sameAccountByGroup}}',
  2488. });
  2489.  
  2490.  
  2491. // 脚本工具
  2492. otherFilterGroup.add({
  2493. 'type': 'subtitle',
  2494. 'text': '{{scriptToolsTitle}}',
  2495. });
  2496.  
  2497. // 快速创建过滤器
  2498. if (isGecko) otherFilterGroup.add({
  2499. 'type': 'boolean',
  2500. 'key': 'weibo.tool.use_fast_creator',
  2501. 'default': true,
  2502. 'text': '{{useFastCreator}}',
  2503. 'ainit': function () {
  2504. dropdown.init();
  2505. },
  2506. });
  2507.  
  2508. // 屏蔽隐藏微博
  2509. otherFilterGroup.add({
  2510. 'type': 'boolean',
  2511. 'key': 'weibo.tool.block_hidden',
  2512. 'text': '{{blockHiddenWeiboDesc}}',
  2513. 'ainit': function () {
  2514. eachWeibo.after(function (feed) {
  2515. [feed].concat(Array.apply(Array, feed.querySelectorAll('.WB_feed_type'))).forEach(function (feed) {
  2516. var display = feed.getAttribute('yawf-display');
  2517. if (display !== 'display-hidden') return;
  2518. if (!feed.getAttribute('mid')) return;
  2519. blockWeibo(feed.getAttribute('mid'));
  2520. feed.setAttribute('yawf-block', 'block');
  2521. });
  2522. });
  2523. }
  2524. });
  2525.  
  2526. // 自动载入
  2527. otherFilterGroup.add({
  2528. 'type': 'subtitle',
  2529. 'text': '{{autoLoadNewWeiboTitle}}',
  2530. });
  2531.  
  2532. // 自动加载新微博以避免被隐藏微博显示新微博提示
  2533. var autoLoad = otherFilterGroup.add({
  2534. 'type': 'boolean',
  2535. 'key': 'weibo.other.auto_load_new_weibo',
  2536. 'text': '{{autoLoadNewWeibo}}',
  2537. 'ainit': function () {
  2538. var that = this, loading = false;
  2539.  
  2540. // 展开新微博后添加和旧微博的分割线
  2541. var addTimetip = (function () {
  2542. var time0 = new Date(), tip = null;
  2543. return function (feed) {
  2544. if (tip && tip.parentNode) tip.parentNode.removeChild(tip);
  2545. var time = time0; time0 = new Date();
  2546. time = Math.max(Math.round((time0 - time) / 6e4), 2);
  2547. var min = time % 60, hour = (time - min) / 60;
  2548. var text = '{{timeTipText}}';
  2549. if (min) text = min + '{{timeTipMin}}' + text;
  2550. if (hour) text = hour + '{{timeTipHour}}' + text;
  2551. tip = cewih('div', fillStr(html.feedTimeTip, { 'time': text })).firstChild;
  2552. feed.parentNode.insertBefore(tip, feed.nextSibling);
  2553. };
  2554. }());
  2555.  
  2556. // 更新未读提示中的数字
  2557. var updateUnreadCount = function () {
  2558. var count = document.querySelectorAll('.WB_feed_type[yawf-unread="hidden"]:not([yawf-display$="-hidden"]').length;
  2559. var feedList = document.querySelector('.WB_feed');
  2560. var newFeed = feedList.querySelector('.WB_feed a.notes[yawf-id="feed_list_newBar"]');
  2561. // 先移除旧的,再放上新的
  2562. if (newFeed) newFeed.parentNode.removeChild(newFeed);
  2563. if (count) {
  2564. newFeed = cewih('div', html.feedListNewBar).firstChild;
  2565. feedList.insertBefore(newFeed, feedList.firstChild);
  2566. newFeed.addEventListener('click', function () {
  2567. var feeds = Array.apply(Array, document.querySelectorAll('.WB_feed_type[yawf-unread="hidden"]'));
  2568. feeds.forEach(function (feed) { feed.setAttribute('yawf-unread', 'show'); });
  2569. updateUnreadCount();
  2570. addTimetip(feeds[feeds.length - 1]);
  2571. });
  2572. newFeed.textContent = fillStr(text.newWeiboNotify, { 'count': count });
  2573. }
  2574. };
  2575.  
  2576. // 隐藏掉微博原来的新消息提示框
  2577. css.add(funcStr(function () { /*
  2578. .WB_feed .WB_feed_type[yawf-unread="hidden"] { display: none !important; }
  2579. .WB_feed fieldset[node-type="feed_list_timeTip"] { display: none !important; }
  2580. .WB_feed a.notes[action-type="feed_list_newBar"][node-type="feed_list_newBar"] { display: none !important; }
  2581. .WB_feed div.W_loading[requesttype="newFeed"] { display: none !important; }
  2582. */ }));
  2583.  
  2584. // 自动点开有新微博的提示
  2585. newNode.add(function () {
  2586. var newFeed = document.querySelector('.WB_feed a.notes[action-type="feed_list_newBar"][node-type="feed_list_newBar"]');
  2587. if (!newFeed) return;
  2588. newFeed.click(); loading = true;
  2589. });
  2590.  
  2591. // 看见有新微博了,看看是不是新加载出来的
  2592. eachWeibo.before(function (feed) {
  2593. var shown = Array.apply(Array, document.querySelectorAll('.WB_feed_type[yawf-unread="show"], .WB_feed_type[yawf-unread="show"]~*'));
  2594. if (shown.length < 8 || shown.indexOf(feed) !== -1 || loading === false) feed.setAttribute('yawf-unread', 'show');
  2595. else feed.setAttribute('yawf-unread', 'hidden');
  2596. });
  2597.  
  2598. // 走完过滤器之后,如果某条微博还没被隐藏掉,那么就提示用户有新微博要看了
  2599. eachWeibo.after(function (feed) {
  2600. if (feed.getAttribute('yawf-unread') !== 'hidden') return;
  2601. var display = feed.getAttribute('yawf-display').replace(/^.*-([^-]*)$/, '$1');
  2602. if (display === 'hidden') return;
  2603. updateUnreadCount();
  2604. call(function () { autoExpand.expand(feed); updateUnreadCount(); });
  2605. if (desktopNotification) desktopNotification.notify(feed);
  2606. });
  2607.  
  2608. },
  2609. });
  2610.  
  2611. var autoExpand = otherFilterGroup.add({
  2612. 'type': 'boolean',
  2613. 'key': 'weibo.other.auto_expand',
  2614. 'text': '{{autoExpand}}',
  2615. 'ref': {
  2616. 'etypes': {
  2617. 'type': 'boolean',
  2618. },
  2619. 'background': {
  2620. 'type': 'boolean',
  2621. 'default': true,
  2622. },
  2623. },
  2624. 'expand': function (feed) {
  2625. var that = this;
  2626. var display = feed.getAttribute('yawf-display').replace(/^.*-([^-]*)$/, '$1');
  2627. if (!that.conf) return;
  2628. if (that.ref.etypes.conf && display !== 'show') return;
  2629. if (feed.getAttribute('yawf-unread') !== 'hidden') return;
  2630. if (that.ref.background.conf && document.hasFocus()) {
  2631. document.addEventListener('blur', function () { autoExpand.expand(feed); });
  2632. return;
  2633. }
  2634. var unreads = document.querySelectorAll('.WB_feed_type[yawf-unread="hidden"]');
  2635. var ref = unreads[unreads.length - 1];
  2636. ref.parentNode.insertBefore(feed, ref.nextSibling);
  2637. feed.setAttribute('yawf-unread', 'show');
  2638. },
  2639. });
  2640.  
  2641. var desktopNotification = null;
  2642.  
  2643. if (notify.avaliableNotification().length) desktopNotification = otherFilterGroup.add({
  2644. 'type': 'boolean',
  2645. 'key': 'weibo.other.desktop_notification',
  2646. 'text': '{{desktopNotification}}',
  2647. 'ref': {
  2648. 'types': {
  2649. 'type': 'boolean',
  2650. 'default': true,
  2651. },
  2652. 'autohide': {
  2653. 'type': 'boolean',
  2654. 'default': true,
  2655. },
  2656. 'duration': {
  2657. 'type': 'range',
  2658. 'step': 50,
  2659. 'min': 1e3,
  2660. 'default': 3e3,
  2661. 'max': 1e4,
  2662. },
  2663. 'durationc': {
  2664. 'type': 'range',
  2665. 'step': 10,
  2666. 'min': 0,
  2667. 'default': 150,
  2668. 'max': 500,
  2669. },
  2670. 'ntypes': {
  2671. 'type': 'boolean',
  2672. },
  2673. },
  2674. 'shown': function (dom) {
  2675. var that = this;
  2676. that.onopt = dom.querySelector('[name="yawf-weibo.other.desktop_notification"]');
  2677. that.onopt.addEventListener('change', that.update.bind(that));
  2678. var ntypes = dom.querySelector('[name="yawf-weibo.other.desktop_notification.ntypes"]');
  2679. if (notify.avaliableNotification().length <= 1) {
  2680. while (ntypes.tagName.toLowerCase() !== 'label') ntypes = ntypes.parentNode;
  2681. ntypes.style.display = 'none';
  2682. } else ntypes.addEventListener('change', function () {
  2683. that.ref.ntypes.putconf(ntypes.checked);
  2684. that.update();
  2685. });
  2686. },
  2687. 'init': function () {
  2688. notify.choseNotification(this.ref.ntypes.conf ? 'webkit' : 'standard');
  2689. },
  2690. 'update': function () {
  2691. var that = this, desktopNotify = that.onopt;
  2692. that.init();
  2693. if (!desktopNotify.checked) return;
  2694. var permission = notify.hasPermission();
  2695. if (permission === true) return;
  2696. desktopNotify.checked = false;
  2697. if (permission === null) notify.requestPermission(function () {
  2698. desktopNotify.checked = true;
  2699. that.update();
  2700. });
  2701. if (permission === false) Alert('notify-disabled', {
  2702. 'title': fillStr('{{desktopNotificationDisallowedTitle}}'),
  2703. 'text': fillStr('{{desktopNotificationDisallowed}}'),
  2704. 'icon': 'error'
  2705. });
  2706. },
  2707. 'notify': function (feed) {
  2708. var display = feed.getAttribute('yawf-display').replace(/^.*-([^-]*)$/, '$1');
  2709. this.init(); if (!this.conf) return;
  2710. if (this.ref.types.conf && display !== 'show') return;
  2711. var mid, author, text, face, ori_author = '', ori_text = '';
  2712. mid = feed.getAttribute('mid'); if (!mid) return;
  2713. face = feed.querySelector('.WB_face img').src;
  2714. author = feed.querySelector('.WB_info .WB_name').textContent;
  2715. text = feed.querySelector('.WB_text').textContent;
  2716. try {
  2717. ori_author = feed.querySelector('.WB_media_expand .WB_info .WB_name').textContent;
  2718. ori_text = feed.querySelector('.WB_media_expand .WB_text').textContent;
  2719. } catch (e) { }
  2720. var body = text + (ori_text ? ('//' + ori_author + ': ' + ori_text) : '');
  2721. body = body.replace(/\s+/g, ' ').trim(); author = author.trim();
  2722. var delay = 0;
  2723. if (this.conf) delay = this.ref.duration.conf + body.length * this.ref.durationc.conf;
  2724. var showFeed = function () {
  2725. autoExpand.expand(feed);
  2726. feed.scrollIntoView(false);
  2727. feed.querySelector('[action-type="feed_list_comment]').click();
  2728. };
  2729. notify.showNotification(mid, author, body, face, delay, showFeed);
  2730. },
  2731. });
  2732.  
  2733. if (notify.avaliableNotification().length) otherFilterGroup.add({
  2734. 'type': 'remark',
  2735. 'text': '{{autoCloseWarning}}',
  2736. });
  2737.  
  2738. var layoutFilterGroup = filterGroup('layoutFilterGroup');
  2739.  
  2740. layoutFilterGroup.add({
  2741. 'type': 'subtitle',
  2742. 'text': '{{layoutFilterGroupDesc}}',
  2743. });
  2744.  
  2745. // 大部分选择器参考了 眼不见心不烦 脚本
  2746. var layouts = (function () {
  2747. var current = null;
  2748. var subtitle = function (name) {
  2749. layoutFilterGroup.add({
  2750. 'type': 'remark',
  2751. 'text': '{{layoutHide' + name + '}}',
  2752. });
  2753. current = name;
  2754. };
  2755.  
  2756. var item = function (name, cssText, defaultValue) {
  2757. layoutFilterGroup.add({
  2758. 'type': 'boolean',
  2759. 'key': 'weibo.layoutHide' + current + name,
  2760. 'default': defaultValue || false,
  2761. 'text': '{{layoutHide' + current + name + '}}',
  2762. 'ainit': css(cssText),
  2763. });
  2764. };
  2765.  
  2766. subtitle('Icon');
  2767. item('Level', '.icon_bed[node-type="level"], .W_level_ico { display: none !important; }');
  2768. item('Member', '.W_ico16[class*="ico_member"], .ico_member_dis, [class^="ico_vip"] { display: none !important; }');
  2769. item('Approve', '.approve { display: none !important; }');
  2770. item('ApproveCo', '.approve_co { display: none !important; }');
  2771. item('Club', '.ico_club { display: none !important; }');
  2772. item('VGirl', '.ico_vlady { display: none !important; }');
  2773. item('Taobao', '.ico_taobao { display: none !important; }');
  2774. item('Zongyika', '.zongyika2014 { display: none !important; }');
  2775. item('Youji', '.lvxing2014, a[href^="http://huodong.weibo.com/travel2014"] { display: none !important; }');
  2776.  
  2777. subtitle('Nav');
  2778. item('Main', '.gn_nav>div:nth-child(1) { display: none !important; }');
  2779. item('Hot', '.gn_nav>div:nth-child(2) { display: none !important; }');
  2780. item('App', '.gn_nav>div:nth-child(3) { display: none !important; }');
  2781. item('Game', '.gn_nav>div:nth-child(4) { display: none !important; }');
  2782. item('Member', '.gn_setting[node-type="member"] { display: none !important; }');
  2783.  
  2784. subtitle('Left');
  2785. item('ToMe', '#pl_leftnav_common a[href^="/direct/tome"] { display: none !important; }');
  2786. item('Friends', '#pl_leftnav_group > div[node-type="groupList"] > .level_1_Box, #pl_leftnav_common .level_1_Box > form.left_nav_line { display: none !important; }');
  2787. item('App', '#pl_leftnav_app { display: none !important; }');
  2788.  
  2789. subtitle('Middle');
  2790. item('RecommendedTopic', '#pl_content_publisherTop div[node-type="recommendTopic"] { display: none !important; }');
  2791. item('FeedRecommand', 'a.notes[node-type="feed_list_newBar"][href^="http"]:not([action-type="feed_list_newBar"]) { display: none !important; }');
  2792. item('MemberTip', '[node-type="feed_list_shieldKeyword"] { display: none !important; }');
  2793.  
  2794. subtitle('Right');
  2795. item('Template', '.templete_enter { display: none !important; }'); // Spelling as is
  2796. item('Info', '.W_person_info { display: none !important; }');
  2797. item('Atten', '#pl_rightmod_myinfo .user_atten { display: none !important; }');
  2798. item('Trial', '#trustPagelet_checkin_lotteryv5 { display: none !important; }');
  2799. item('Interest', '[yawf-id="rightmod_recom_interest"] { display: none !important; }');
  2800. item('HotTopic', '[yawf-id="rightmod_zt_hottopic"] { display: none !important; }');
  2801. item('Member', '#trustPagelet_recom_memberv5 { display: none !important; }');
  2802. item('Weibo', '[yawf-id="rightmod_recom_weibo"] { display: none !important; }');
  2803. item('Location', '[yawf-id="rightmod_recom_location"] { display: none !important; }');
  2804. item('Music', '[yawf-id="rightmod_recom_music"] { display: none !important; }');
  2805. item('Movie', '[yawf-id="rightmod_recom_movie"] { display: none !important; }');
  2806. item('Book', '[yawf-id="rightmod_recom_book"] { display: none !important; }');
  2807. item('Notice', '#pl_rightmod_noticeboard { display: none !important; }');
  2808.  
  2809. subtitle('Weibo');
  2810. item('RecomFeed', '[node-type="feed_list_recommend"] { display: none !important; }');
  2811. item('FeedTip', '[node-type="feed_privateset_tip"] { display: none !important; }');
  2812. item('TopicCard', '.WB_feed_spec[exp-data*="value=1022-topic"] { display: none !important; }');
  2813. layoutFilterGroup.add({
  2814. 'type': 'boolean',
  2815. 'key': 'weibo.layoutHideWeiboTopComment',
  2816. 'default': false,
  2817. 'text': '{{layoutHideWeiboTopComment}}',
  2818. 'ainit': function () {
  2819. newNode.add(function () {
  2820. var split = document.querySelector('.comment_lists[node-type="feed_list_commentList"] .between_line_v2 a[action-data*="filter=hot"]');
  2821. if (!split) return;
  2822. while (!split.classList.contains('between_line_v2')) split = split.parentNode;
  2823. while (split.parentNode) split.parentNode.removeChild(split.parentNode.firstChild);
  2824. });
  2825. },
  2826. });
  2827. item('SonTitle', '.WB_feed_type .WB_feed_together .wft_hd { display: none !important; }');
  2828. item('LocationCard', '.WB_feed_spec[exp-data*="value=1022-place"] { display: none !important; }');
  2829. item('Source', '.WB_time+.S_txt2, .WB_time+.S_txt2+.S_link2 { display: none !important; }');
  2830. item('Report', '.WB_time~.hover { display: none !important; }');
  2831. item('Like', 'a[action-type="feed_list_like"], a[action-type="feed_list_like"]+.S_txt3 { display: none !important; }');
  2832. item('Forward', 'a[action-type="feed_list_forward"], a[action-type="feed_list_forward"]+.S_txt3 { display: none !important; }');
  2833. item('Favourite', 'a[action-type="feed_list_favorite"], a[action-type="feed_list_favorite"]+.S_txt3 { display: none !important; }');
  2834. item('BlockBySource', 'div.layer_menu_list[action-type="feed_list_layer"] a[action-type="feed_list_shield_by_app"] { display: none !important; }');
  2835. item('BlockByKeyword', 'div.layer_menu_list[action-type="feed_list_layer"] a[action-type="feed_list_shield_setkeyword"] { display: none !important; }');
  2836.  
  2837. subtitle('Person');
  2838. item('MoveThings', '.S_profile .profile_move_things { display: none !important; }');
  2839. item('Cover', funcStr(function () { /*!CSS
  2840. .S_profile_pic { display: none; }
  2841. .profile_top { margin-top: 20px; }
  2842. .profile_top .pf_head { top: 5px; margin-top: 0 !important; }
  2843. .profile_top .pf_head_pic { height: 120px; width: 120px; float: right; }
  2844. .profile_top .pf_head_pic img { height: 120px; }
  2845. .profile_top .pf_head .user_atten { width: 60px; float: left; height: 120px; }
  2846. .profile_top .pf_head .user_atten li, .profile_top .pf_head .user_atten .follower { width: 54px; padding: 0 3px 3px; height: 37px; border-right: none; }
  2847. .profile_top .pf_head .user_atten li strong { margin: 3px 0 0; }
  2848. */ }));
  2849. item('BadgeIcon', '.pf_badge_icon { display: none !important; }');
  2850. item('Stats', '.profile_top .user_atten { display: none !important; } .profile_top .pf_head { margin-top: 51px; } ');
  2851. item('MyData', '.W_main_c [id^="Pl_Official_MyMicroworld__"] { display: none !important; }');
  2852. item('Group', '.W_main_2r [id^="Pl_Core_RightGroupsBtn__"] { display: none !important; }');
  2853. item('SuggestUser', '.W_main_2r [id^="Pl_Core_RightUserList__"] { display: none !important; }');
  2854. item('Relation', '.W_main_2r [id^="Pl_Core_RightUserGrid__"] { display: none !important; }');
  2855. item('Album', '.W_main_2r [id^="Pl_Core_RightPicMulti__"] { display: none !important; }');
  2856. item('HotTopic', '.W_main_2r [id^="Pl_Core_RightTextSingle__"] { display: none !important; }');
  2857. item('HotWeibo', '.W_main_2r [id^="Pl_Core_RightPicText__"] { display: none !important; }');
  2858.  
  2859. subtitle('Other');
  2860. item('Ads', '#plc_main [id^="pl_rightmod_ads"], [id^="ads_"], [id^="ad_"], #trustPagelet_zt_hottopicv5 [class*="hot_topicad"], div[ad-data], .WB_feed .popular_buss, [id^="sinaadToolkitBox"] { display: none !important; } #wrapAD, .news_logo { visibility: hidden !important; }');
  2861. item('FeedRecom', '.W_main_2r [id^="Pl_Third_Inline__"] { display: none !important; }');
  2862. item('Footer', '.global_footer { display: none !important; }');
  2863. item('WbIm', '.WBIM_news, .sendbox_btn_l a[href^="http://desktop.weibo.com/download.php"] { display: none !important; }');
  2864. item('Tip', '.layer_tips { display: none !important; }');
  2865. item('IM', '#WB_webim .wbim_min_friend, #WB_webim .webim_list { display: none !important; } #WB_webim .wbim_chat_box, #WB_webim .wbim_min_chat { right: 20px !important; }');
  2866.  
  2867. var tagRightbarMods = function () {
  2868. var mods = document.querySelectorAll('#trustPagelet_indexright_recom .WB_right_module:not([yawf-id])');
  2869. if (!mods) return;
  2870. var identifiers = {
  2871. '.right_content.hot_topic': 'rightmod_zt_hottopic',
  2872. '.right_content.person_list': 'rightmod_recom_interest',
  2873. '[change-data*="key=index_weibo"]': 'rightmod_recom_weibo',
  2874. '[change-data*="key=index_LBS"]': 'rightmod_recom_location',
  2875. '[change-data*="key=index_song"]': 'rightmod_recom_music',
  2876. '[change-data*="key=index_mov"]': 'rightmod_recom_movie',
  2877. '[change-data*="key=index_book"]': 'rightmod_recom_book'
  2878. };
  2879. Array.apply(Array, mods).forEach(function (mod) {
  2880. Object.keys(identifiers).forEach(function (qs) {
  2881. if (mod.querySelector(qs)) mod.setAttribute('yawf-id', identifiers[qs]);
  2882. });
  2883. });
  2884. };
  2885.  
  2886. newNode.add(tagRightbarMods);
  2887. tagRightbarMods();
  2888. css.add('.W_miniblog { visibility: visible !important; }');
  2889.  
  2890. }());
  2891.  
  2892. // 改造设置
  2893. var toolFilterGroup = filterGroup('toolFilterGroup');
  2894.  
  2895. // 边栏相关工具
  2896. toolFilterGroup.add({
  2897. 'type': 'subtitle',
  2898. 'text': '{{sideColumnToolsTitle}}',
  2899. });
  2900.  
  2901. // 展开左栏分组
  2902. toolFilterGroup.add({
  2903. 'type': 'boolean',
  2904. 'key': 'weibo.tool.showAllGroup',
  2905. 'text': '{{showAllGroupDesc}}',
  2906. 'ainit': css('#pl_leftnav_group div[node-type="moreList"] { display: block !important } #pl_leftnav_group > div[node-type="groupList"] > .level_2_Box > .levmore { display: none }'),
  2907. });
  2908.  
  2909. // 展开左栏消息
  2910. toolFilterGroup.add({
  2911. 'type': 'boolean',
  2912. 'key': 'weibo.tool.showAllMsgNav',
  2913. 'text': '{{showAllMsgNavDesc}}',
  2914. 'ainit': css('#pl_leftnav_common > .level_1_Box > .lev2_new { display: block !important }'),
  2915. });
  2916.  
  2917. // 合并左右边栏
  2918. var mergeLeftRight = toolFilterGroup.add({
  2919. 'type': 'boolean',
  2920. 'key': 'weibo.tool.mergeColumns',
  2921. 'text': '{{mergeLeftRight}}',
  2922. 'ref': {
  2923. 'side': {
  2924. 'type': 'select',
  2925. 'select': [
  2926. { 'value': 'left', 'text': '{{mergeLeftRightLeft}}' },
  2927. { 'value': 'right', 'text': '{{mergeLeftRightRight}}' },
  2928. ],
  2929. 'default': 'right',
  2930. }
  2931. },
  2932. 'init': function () {
  2933. if (!this.conf) return;
  2934. var main = document.body, side = this.ref.side.conf;
  2935. var left = document.querySelector('.W_main_l');
  2936. var attr = 'yawf-left';
  2937. if (!left) return;
  2938. var left0 = cewih('div', '');
  2939. left.parentNode.insertBefore(left0, left);
  2940. left.parentNode.removeChild(left);
  2941. var positionLeft = function () {
  2942. var ref = document.querySelector('#pl_rightmod_myinfo')
  2943. var leftn = document.querySelector('.W_main_l');
  2944. if (leftn) { left = leftn; return; }
  2945. if (ref) {
  2946. ref.parentNode.insertBefore(left, ref.nextSibling);
  2947. main.setAttribute('yawf-merge-left', side);
  2948. } else left0.parentNode.insertBefore(left, left0);
  2949. };
  2950. positionLeft();
  2951. newNode.add(function () { positionLeft(); })
  2952. css.add(funcStr(function () { /*!CSS
  2953. body[yawf-merge-left] .W_main .W_main_l { width: 229px; padding: 0; float: none; }
  2954. body[yawf-merge-left] .W_main .WB_left_nav .lev a:hover, .WB_left_nav .lev2 a:hover, .WB_left_nav .lev2 a.lev_curr, .WB_left_nav .lev2 a.lev_curr:hover, .WB_left_nav .lev3 a:hover { background-image: none; }
  2955. body[yawf-merge-left] .W_main { width: 830px; background-position: -300px center; background-size: 200% 100%; }
  2956. body[yawf-merge-left].B_index:not([yawf-weibo-only]) .W_main~.W_gotop { margin-left: 415px !important; }
  2957. body[yawf-merge-left].B_index:not([yawf-weibo-only]) #yawf-drop-area { left: calc(50% + 185px); }
  2958. body[yawf-merge-left] .global_footer { width: 790px !important; }
  2959. body[yawf-merge-left] .global_footer .list { margin-right: 0 !important; width: 155px !important; }
  2960. body[yawf-merge-left] .global_footer .copy { padding-top: 0 !important; margin-top: -46px; }
  2961. body[yawf-merge-left="left"] .W_main .W_main_r { float: left; }
  2962. body[yawf-merge-left="left"] .W_main .W_main_c { float: right; }
  2963. body[yawf-merge-left="left"] .W_main .templete_enter a { right: auto; left: 0; transform: scaleX(-1); }
  2964. body[yawf-merge-left="left"] .W_main .send_weibo .input .arrow, .send_weibo .input.clicked .arrow { right: auto; left: -11px; transform: scaleX(-1); }
  2965. body[yawf-merge-left="left"] .W_main #Box_center { border-left: 2px solid rgba(128, 128, 128, 0.2); margin-left: -2px; }
  2966. body[yawf-merge-left="left"].B_index:not([yawf-weibo-only]) #yawf-drop-area { left: calc(50% - 415px); }
  2967. body[yawf-merge-left="right"] .W_main #Box_center { border-right: 2px solid rgba(128, 128, 128, 0.2); margin-right: -2px; }
  2968. */ }));
  2969. },
  2970. });
  2971.  
  2972. // 左边栏浮动
  2973. toolFilterGroup.add({
  2974. 'type': 'boolean',
  2975. 'key': 'weibo.tool.fixedLeft',
  2976. 'text': '{{fixedLeft}}',
  2977. 'default': true,
  2978. 'ref': {
  2979. 'items': {
  2980. 'type': 'select',
  2981. 'select': [
  2982. { 'value': 'default', 'text': '{{fixedLeftDefault}}' },
  2983. { 'value': 'whole', 'text': '{{fixedLeftWhole}}' },
  2984. ],
  2985. 'default': 'default',
  2986. }
  2987. },
  2988. 'init': function () {
  2989. var left = document.querySelector('.W_main_l');
  2990. if (!left) return;
  2991. var type = this.conf ? this.ref.items.conf : 'none';
  2992. var merged = mergeLeftRight.conf;
  2993. // 禁用掉默认的浮动
  2994. css.add('.W_main [node-type="left_fixed"]:not([yawf-fixed]) { height: auto !important; padding-top: 0 !important; position: static !important; top: 40px !important; animation: none; }');
  2995. // 不浮动的如果禁用了默认的浮动,那么就完成了
  2996. if (type === 'none') return;
  2997. // 否则如果合并了左右边栏,而且我要浮动,那么右面就不要动
  2998. if (merged) {
  2999. var removeRightFixed = function () {
  3000. var fixed = document.querySelector('.W_main_r [node-type="right_module_fixed"]');
  3001. if (!fixed) return;
  3002. while (fixed.firstChild) fixed.parentNode.insertBefore(fixed.firstChild, fixed);
  3003. fixed.parentNode.removeChild(fixed);
  3004. };
  3005. removeRightFixed();
  3006. newNode.add(removeRightFixed);
  3007. }
  3008. // 最后自定义的浮动
  3009. css.add('.W_main [yawf-fixed] { animation-duration: 0.5s; animation-iteration-count: 1; animation-name: dropdown; animation-timing-function: ease; position: fixed; top: 65px; overflow: hidden; height: auto; }');
  3010. css.add('body[yawf-merge-left] .W_main [yawf-fixed] { width: 229px; }');
  3011. var container = document.querySelector('.W_main');
  3012. var reference = merged && document.querySelector('.W_main_r') || left;
  3013. var floatitem = type === 'default' && left.querySelector('[node-type="left_fixed"]') || left.querySelector('[node-type="left_all"]');
  3014. var floating = false;
  3015. var updatePosition = function () {
  3016. var refc = reference.getClientRects();
  3017. if (!refc || !refc[0]) return;
  3018. var pos = refc[0];
  3019. if (!floating) {
  3020. if (pos.bottom < -65) {
  3021. floating = true;
  3022. floatitem.setAttribute('yawf-fixed', '');
  3023. }
  3024. } else {
  3025. if (pos.bottom > 65 - floatitem.clientHeight) {
  3026. floating = false;
  3027. floatitem.removeAttribute('yawf-fixed');
  3028. call(updatePosition);
  3029. }
  3030. }
  3031. if (floating) {
  3032. var cip = container.getClientRects()[0];
  3033. var fip = floatitem.getClientRects()[0];
  3034. if (cip && fip) {
  3035. floatitem.style.maxHeight = Math.max(cip.bottom - fip.top - 20, 0) + 'px';
  3036. }
  3037. }
  3038. };
  3039. document.addEventListener('scroll', updatePosition);
  3040. newNode.add(updatePosition);
  3041. updatePosition();
  3042. },
  3043. });
  3044.  
  3045. // 将话题黑名单应用到右侧热门话题栏目
  3046. toolFilterGroup.add({
  3047. 'type': 'boolean',
  3048. 'key': 'weibo.tool.filte_right_topic',
  3049. 'text': '{{filteRightTopic}}',
  3050. 'ainit': function () {
  3051. css.add('.right_content.hot_topic li[yawf-rtopic="hidden"] { display: none !important; }');
  3052. newNode.add(function () {
  3053. var topics = Array.apply(Array, document.querySelectorAll('.right_content.hot_topic li:not([yawf-rtopic]) a[suda-uatrack*="hottopic_r1"]'));
  3054. topics.forEach(function (topic) {
  3055. var text = topic.title.replace(/#/g, '');
  3056. var li; for (li = topic; li.tagName.toLowerCase() !== 'li'; li = li.parentNode);
  3057. if (topicFilterGroup.rules.blacklist.conf.indexOf(text) !== -1) li.setAttribute('yawf-rtopic', 'hidden');
  3058. else li.setAttribute('yawf-rtopic', 'show');
  3059. });
  3060. });
  3061. },
  3062. })
  3063.  
  3064. // 微博相关工具
  3065. toolFilterGroup.add({
  3066. 'type': 'subtitle',
  3067. 'text': '{{weiboToolsTitle}}',
  3068. });
  3069.  
  3070. // 清除发布框中的默认话题 (wcf)
  3071. toolFilterGroup.add({
  3072. 'type': 'boolean',
  3073. 'key': 'weibo.tool.clear_def_topic',
  3074. 'text': '{{clearDefTopicDesc}}',
  3075. 'ainit': function () {
  3076. var clearDefTopic = function () {
  3077. var inputBox = document.querySelector('#pl_content_publisherTop .send_weibo .input textarea');
  3078. if (inputBox && inputBox.hasAttribute('hottopic')) {
  3079. inputBox.removeAttribute('hottopic'); inputBox.removeAttribute('hottopicid');
  3080. inputBox.value = 'DUMMY'; inputBox.focus();
  3081. inputBox.value = ''; inputBox.blur();
  3082. }
  3083. };
  3084. newNode.add(clearDefTopic);
  3085. },
  3086. });
  3087.  
  3088. // 微博作者与正文同行
  3089. toolFilterGroup.add({
  3090. 'type': 'boolean',
  3091. 'key': 'weibo.tool.unwrapText',
  3092. 'text': '{{unwrapTextDesc}}',
  3093. 'ainit': css('.WB_info, .WB_text { display: inline } .WB_info+.WB_text::before { content: ": " } .WB_func { margin-top: 5px } .B_index .WB_feed .W_ico16 { vertical-align: -3px !important }'),
  3094. });
  3095.  
  3096. // 个人主页自动打开微博列表
  3097. toolFilterGroup.add({
  3098. 'type': 'boolean',
  3099. 'key': 'weibo.tool.redirectWeibo',
  3100. 'text': '{{personalRedirectWeibo}}',
  3101. 'ainit': function () {
  3102. var locat = unsafeWindow.$CONFIG.location;
  3103. if (!locat || locat.slice(-5) !== '_home') return;
  3104. if (!document.body.classList.contains('B_profile')) return;
  3105. var from = (location.search.match(/from=([^&]*)/) || {})[1];
  3106. if (locat.indexOf(from) === 0) return;
  3107. var redirect = function () {
  3108. var link = document.querySelector('.PRF_tab_noicon li.pftb_itm a[href*="/weibo?"]'); if (!link) return;
  3109. if (!link) return false;
  3110. newNode.remove(redirect);
  3111. window.stop(); // 虽然不知道为什么,但是加上就正常了……
  3112. location.replace(link.href);
  3113. };
  3114. newNode.add(redirect);
  3115. redirect();
  3116. },
  3117. });
  3118.  
  3119. // 查看大图旁添加查看原图链接
  3120. toolFilterGroup.add({
  3121. 'type': 'boolean',
  3122. 'default': true,
  3123. 'key': 'weibo.tool.viewOriginal',
  3124. 'text': '{{viewOriginalDesc}}',
  3125. 'ainit': function () {
  3126. var addOriLink = function () {
  3127. var a = document.querySelector('a.show_big[action-data]:not([yawf-viewori])');
  3128. if (!a) return; a.setAttribute('yawf-viewori', 'yawf-viewori');
  3129. var arg = a.getAttribute('action-data').match(/pid=(\w+)&mid=(\d+)&uid=(\d+)/);
  3130. if (!arg) return;
  3131. var vol = cewih('div', fillStr(html.viewOriginalLink)), l = vol.firstChild;
  3132. l.href = fillStr(url.view_ori, { 'uid': arg[3], 'mid': arg[2], 'pid': arg[1] });
  3133. while (vol.firstChild) a.parentNode.insertBefore(vol.firstChild, a);
  3134. };
  3135. newNode.add(addOriLink);
  3136. },
  3137. });
  3138.  
  3139. // 展开 t.cn 短网址
  3140. toolFilterGroup.add({
  3141. 'type': 'boolean',
  3142. 'key': 'weibo.tool.expandTCn',
  3143. 'text': '{{expandShortenedLink}}',
  3144. 'ainit': function () {
  3145. var expandLink = function () {
  3146. var links = Array.apply(Array, document.querySelectorAll('.WB_text a[mt="url"][title^="http"]:not([yawf-expand])'));
  3147. links.forEach(function (link) {
  3148. link.setAttribute('yawf-expand', 'expand');
  3149. if (link.textContent.indexOf('http://t.cn/') !== 0) return;
  3150. link.textContent = link.title;
  3151. });
  3152. };
  3153. newNode.add(expandLink);
  3154. eachWeibo.before(expandLink);
  3155. expandLink();
  3156. },
  3157. });
  3158.  
  3159. // 样式相关工具
  3160. toolFilterGroup.add({
  3161. 'type': 'subtitle',
  3162. 'text': '{{styleToolsTitle}}',
  3163. });
  3164.  
  3165. // 一个带有颜色/透明度的选框项
  3166. var coloredConfigItem = function (details) {
  3167.  
  3168. // 将颜色和透明度转换为一个表示颜色的字符串
  3169. var colorStr = function (color, transparency) {
  3170. return 'rgba(' + color.slice(1)
  3171. .split(/(..)/).filter(function (x) { return x; })
  3172. .map(function (x) { return parseInt(x, 16); }).join(',') +
  3173. ',' + (100 - transparency) / 100 + ')';
  3174. };
  3175.  
  3176. var color = {
  3177. 'type': 'color',
  3178. 'default': details.color || '#000000',
  3179. };
  3180. var transparency = {
  3181. 'type': 'range',
  3182. 'default': details.transparency || 0,
  3183. 'min': 0,
  3184. 'max': 100,
  3185. };
  3186. return {
  3187. 'color': color,
  3188. 'transparency': transparency,
  3189. 'rgba': {
  3190. 'toString': function () {
  3191. return colorStr(color.conf, transparency.conf);
  3192. },
  3193. }
  3194. };
  3195. };
  3196.  
  3197. // 高亮显示白名单微博
  3198. toolFilterGroup.add({
  3199. 'type': 'boolean',
  3200. 'key': 'weibo.tool.whitelist_highlight',
  3201. 'ref': coloredConfigItem({ 'color': '#dafee4' }),
  3202. 'text': '{{whitelistHighlightDesc}}',
  3203. 'ainit': function () {
  3204. css.add(fillStr(funcStr(function () { /*
  3205. .WB_media_expand .WB_arrow { display: none !important; }
  3206. [node-type="feed_list"] .WB_feed_type[yawf-display$="-show"] { background-color: {{color}} !important; box-shadow: -20px 0 0 {{color}}, 20px 0 0 {{color}}; }
  3207. [node-type="feed_list"] .WB_feed_together .WB_feed_type[yawf-display$="-show"] { background-color: {{color}} !important; box-shadow: -10px 0 0 {{color}}, 10px 0 0 {{color}}; }
  3208. */ }), { 'color': '' + this.ref.rgba }));
  3209. },
  3210. });
  3211.  
  3212. // 首页背景
  3213. toolFilterGroup.add({
  3214. 'type': 'boolean',
  3215. 'key': 'weibo.tool.my_background_color',
  3216. 'ref': coloredConfigItem({
  3217. 'color': '#ffffff',
  3218. 'transparency': 30,
  3219. }),
  3220. 'text': '{{mainBackgroundColorOverride}}',
  3221. 'ainit': function () {
  3222. css.add(fillStr(funcStr(function () { /*
  3223. body:not(.S_profile) .W_main { background-image: none !important; background-color: {{color}} !important }
  3224. body:not(.S_profile) .S_bg4, body:not(.S_profile) .W_main_a, body:not(.S_profile) .W_main_bg { background: transparent !important; }
  3225. */ }), { 'color': '' + this.ref.rgba }));
  3226. },
  3227. });
  3228.  
  3229. // 个人主页背景
  3230. toolFilterGroup.add({
  3231. 'type': 'boolean',
  3232. 'key': 'weibo.tool.other_background_color',
  3233. 'ref': coloredConfigItem({
  3234. 'color': '#ffffff',
  3235. 'transparency': 30,
  3236. }),
  3237. 'text': '{{profileBackgroundColorOverride}}',
  3238. 'ainit': function () {
  3239. css.add(fillStr(funcStr(function () { /*
  3240. .S_profile .W_profile_bg, .S_profile .S_bg5 { background-color: {{color}} !important; }
  3241. .S_profile .S_bg4:not(.W_profile_bg) { background: none transparent !important }
  3242. */ }), { 'color': '' + this.ref.rgba }));
  3243. },
  3244. });
  3245.  
  3246. // 阅读模式
  3247. toolFilterGroup.add({
  3248. 'type': 'boolean',
  3249. 'text': '{{weiboOnly}}',
  3250. 'key': 'weibo.tool.weibo_only',
  3251. 'ref': extend({
  3252. // 宽度
  3253. 'width': {
  3254. 'type': 'range',
  3255. 'min': 600,
  3256. 'max': 980,
  3257. 'default': 600,
  3258. },
  3259. // 快捷键
  3260. 'key': {
  3261. 'type': 'key',
  3262. 'default': 119 // F8
  3263. },
  3264. // 是否显示快捷链接
  3265. 'switch': {
  3266. 'type': 'boolean',
  3267. 'default': false,
  3268. },
  3269. 'usebgc': {
  3270. 'type': 'boolean',
  3271. },
  3272. }, coloredConfigItem({
  3273. // 颜色
  3274. 'color': '#ffffff',
  3275. // 透明度
  3276. 'transparency': 20,
  3277. }), {
  3278. 'enabled': {
  3279. 'type': 'boolean',
  3280. 'default': false,
  3281. 'internal': true,
  3282. },
  3283. }),
  3284. 'ainit': function () {
  3285. if (!document.body.classList.contains('B_index') &&
  3286. !document.body.classList.contains('B_profile')) return;
  3287. var that = this;
  3288. var key = that.ref.key, attr = 'yawf-weibo-only';
  3289. // 切换阅读模式开关
  3290. var switchMode = function (enable) {
  3291. var enabled = document.body.hasAttribute(attr);
  3292. if (enable == null) enable = !enabled;
  3293. else if (enable === enabled) return;
  3294. if (enable) document.body.setAttribute(attr, attr);
  3295. else document.body.removeAttribute(attr);
  3296. that.ref.enabled.putconf(enable);
  3297. };
  3298. // 检查快捷键按键
  3299. if (key.conf) keys.reg(key.conf, function () { switchMode(); });
  3300. // 显示切换按钮
  3301. if (that.ref['switch'].conf) {
  3302. var showSwitch = function () {
  3303. var rightBar = document.querySelector('.group_read .right_bar:not([yawf-weibo-only-added])');
  3304. if (!rightBar) return; rightBar.setAttribute('yawf-weibo-only-added', 'added');
  3305. var weiboOnly = cewih('div', fillStr(html.weiboOnlyButton, {
  3306. 'text': text.weiboOnlyButton,
  3307. 'shortcut': key.conf === 0 ? '' : ' (' + keys.name(key.conf) + ')',
  3308. })).firstChild;
  3309. weiboOnly.addEventListener('click', switchMode.bind(that, null));
  3310. rightBar.insertBefore(weiboOnly, rightBar.querySelector('.right_item~.right_item'));
  3311. newNode.remove(showSwitch);
  3312. };
  3313. newNode.add(showSwitch);
  3314. }
  3315. // 注册样式
  3316. css.add(fillStr(funcStr(function () { /*!CSS
  3317. body.B_index[{{attr}}] .W_main_l,
  3318. body.B_index[{{attr}}] .W_main_r,
  3319. body.B_index[{{attr}}] #Box_center>div:not(#pl_content_homeFeed),
  3320. body.B_index[{{attr}}] .global_footer { display: none; }
  3321. body.B_profile[{{attr}}] #Pl_Official_Header__1,
  3322. body.B_profile[{{attr}}] #Pl_Core_Header__1,
  3323. body.B_profile[{{attr}}] #Pl_Core_Nav__2,
  3324. body.B_profile[{{attr}}] .W_main_2r,
  3325. body.B_profile[{{attr}}] .global_footer { display: none; }
  3326. body.B_index[{{attr}}] .WB_global_nav,
  3327. body.B_profile[{{attr}}] .WB_global_nav { position: absolute !important; }
  3328. body.B_index[{{attr}}] .W_miniblog,
  3329. body.B_profile[{{attr}}] .W_miniblog { padding-top: 60px; }
  3330. body.B_index[{{attr}}] .WB_feed .WB_screen,
  3331. body.B_profile[{{attr}}] .WB_feed .WB_screen { margin-left: calc({{width}} - 48px); }
  3332. body.B_index[{{attr}}] .W_main,
  3333. body.B_profile[{{attr}}] .W_main { width: {{width}} !important; background-position: 40% center; background-size: 165% 100%; }
  3334. body.B_index[{{attr}}] #Box_center,
  3335. body.B_index[{{attr}}] .WB_feed .repeat .input textarea,
  3336. body.B_profile[{{attr}}] .WB_feed .repeat .input textarea { width: 100%; }
  3337. body.B_index[{{attr}}] .WB_feed .type_text,
  3338. body.B_profile[{{attr}}] .WB_feed .type_text { margin-left: calc({{width}} - 165px); }
  3339. body.B_index[{{attr}}] .W_gotop,
  3340. body.B_profile[{{attr}}] .W_gotop { margin-left: calc({{width}} / 2) !important; }
  3341. body.B_index[{{attr}}] .WB_feed .between_line,
  3342. body.B_profile[{{attr}}] .WB_feed .between_line { padding: 0 calc({{width}} / 2 - 132px) !important; }
  3343. body.B_index[{{attr}}] .WB_media_expand .WB_arrow,
  3344. body.B_profile[{{attr}}] .WB_media_expand .WB_arrow { display: none !important; }
  3345. body.B_index[{{attr}}] #yawf-drop-area,
  3346. body.B_profile[{{attr}}] #yawf-drop-area { left: calc(50% + {{width}} / 2 - 230px); top: 0; }
  3347. body.B_index[{{attr}}] .W_main_a { width: {{width}}; }
  3348. body.B_profile[{{attr}}] .W_main_c { padding-top: 9px; width: {{width}}; }
  3349. .input_search { float: left; }
  3350. */ }), {
  3351. 'width': that.ref.width.conf + 'px',
  3352. 'attr': attr,
  3353. }));
  3354. if (that.ref.usebgc.conf) css.add('body.B_index[' + attr + '] .W_main, body.B_profile[' + attr + '] .W_main { background: ' + that.ref.rgba + ' !important; }');
  3355. var updateModeByConf = function () {
  3356. switchMode.call(that, that.ref.enabled.getconf());
  3357. };
  3358. updateModeByConf();
  3359. window.addEventListener('focus', updateModeByConf);
  3360. }
  3361. });
  3362.  
  3363. // 自定义样式
  3364. toolFilterGroup.add({
  3365. 'type': 'string',
  3366. 'text': '{{userstyleTitle}}',
  3367. 'key': 'weibo.tool.userstyle',
  3368. 'init': function () {
  3369. var conf = this.conf; GM_addStyle(conf);
  3370. var set = this.putconf.bind(this);
  3371. // 在 GM 中注册菜单项以支持对自定义 CSS 的修改
  3372. // 此处并非常规设置方式,仅应在因用户加入的CSS导致无法正常显示脚本设置界面时使用。
  3373. // 所以此处设置时不应依赖网页界面实现。
  3374. var putconf = function (css) {
  3375. conf = css;
  3376. setTimeout(function () { set(css); config.write(); location.reload(); }, 0);
  3377. };
  3378. GM_registerMenuCommand(fillStr('{{userstyleEditDesc}}'), function () {
  3379. var newcss = prompt(fillStr('{{userstyleEditDetails}}'), conf);
  3380. if (newcss !== null) putconf(newcss);
  3381. }, "S");
  3382. },
  3383. });
  3384.  
  3385. // 脚本设置
  3386. var scriptFilterGroup = filterGroup('scriptFilterGroup');
  3387.  
  3388. // 导入导出
  3389. scriptFilterGroup.add({
  3390. 'type': 'subtitle',
  3391. 'text': '{{configImportAndExport}}',
  3392. });
  3393.  
  3394. scriptFilterGroup.add({
  3395. 'show': function () {
  3396. var dom = cewih('div', html.configImportExport).firstChild;
  3397. var bii = dom.querySelector('input[type="file"]');
  3398. var be = dom.querySelector('[node-type="export"]');
  3399. var br = dom.querySelector('[node-type="reset"]');
  3400. // 导出按钮
  3401. var updateExportButton = function () {
  3402. be.href = 'data:application/octet-stream;base64,' +
  3403. btoa(unescape(encodeURIComponent(config.export())));
  3404. be.setAttribute('download', 'yawf-config.yawf');
  3405. };
  3406. // 导入按钮
  3407. var doImport = function (file) {
  3408. var reader = new FileReader();
  3409. // 导入成功
  3410. var success = function () {
  3411. Alert('yawf-config-import-success', {
  3412. 'title': fillStr('{{configImportSuccessTitle}}'),
  3413. 'text': fillStr('{{configImportSuccess}}'),
  3414. 'icon': 'succ'
  3415. });
  3416. };
  3417. // 导入失败
  3418. var error = function () {
  3419. Alert('yawf-config-import-fail', {
  3420. 'title': fillStr('{{configImportFailTitle}}'),
  3421. 'text': fillStr('{{configImportFail}}'),
  3422. 'icon': 'error'
  3423. });
  3424. };
  3425. // 读文件
  3426. if (file.size > (1 << 24)) error();
  3427. else reader.addEventListener('load', function () {
  3428. config.clear();
  3429. if (config.import(reader.result)) {
  3430. updateExportButton();
  3431. success();
  3432. } else error();
  3433. });
  3434. reader.readAsText(file);
  3435. bii.value = '';
  3436. };
  3437. bii.addEventListener('change', function () {
  3438. var file = bii.files[0];
  3439. Confirm('yawf-config-import-warning', {
  3440. 'title': fillStr('{{configImportWarningTitle}}'),
  3441. 'text': fillStr('{{configImportWarning}}'),
  3442. 'onOk': function () { doImport(file); },
  3443. });
  3444. });
  3445. updateExportButton();
  3446. // 重置按钮
  3447. var doReset = function () {
  3448. config.clear();
  3449. updateExportButton();
  3450. GM_deleteValue('notification');
  3451. };
  3452. br.addEventListener('click', function () {
  3453. Confirm('yawf-config-reset-warning', {
  3454. 'title': fillStr('{{configResetWarningTitle}}'),
  3455. 'text': fillStr('{{configResetWarning}}'),
  3456. 'onOk': doReset,
  3457. });
  3458. });
  3459. return dom;
  3460. },
  3461. });
  3462.  
  3463. // 调试
  3464. scriptFilterGroup.add({
  3465. 'type': 'subtitle',
  3466. 'text': '{{scriptDebugTitle}}',
  3467. });
  3468.  
  3469. scriptFilterGroup.add({
  3470. 'type': 'boolean',
  3471. 'text': '{{scriptDebug}}',
  3472. 'getconf': function () { return !!GM_getValue('debug', false); },
  3473. 'putconf': function (value) { GM_setValue('debug', !!value); return !!value; },
  3474. });
  3475.  
  3476. // 关于
  3477. scriptFilterGroup.add({
  3478. 'type': 'subtitle',
  3479. 'text': '{{scriptAboutTitle}}',
  3480. });
  3481.  
  3482. scriptFilterGroup.add({
  3483. 'type': 'text', 'text': '',
  3484. 'shown': function (dom) {
  3485. dom.innerHTML = fillStr(text.scriptAbout, {
  3486. 'version': ((GM_info || {}).script || {}).version || '?'
  3487. });
  3488. },
  3489. });
  3490.  
  3491. // 添加一些样式
  3492. scriptFilterGroup.add({
  3493. 'init': function () {
  3494. var isEn = i18n.lang === 'en';
  3495. css.add(fillStr(funcStr(function () { /*!CSS
  3496. .layoutFilterGroupLayer .yawf-configBoolean { width: {{layoutOptionWidth}}; }
  3497. */ }), {
  3498. 'layoutOptionWidth': isEn ? '320px' : '160px',
  3499. }));
  3500. },
  3501. });
  3502.  
  3503. // 检查是否要在本页上运行
  3504. var validPage = function () {
  3505. if (self !== top) return false;
  3506. if (!unsafeWindow.$CONFIG) return false;
  3507. if (!unsafeWindow.$CONFIG.uid) return false;
  3508. if (!unsafeWindow.$CONFIG.lang) return false;
  3509. return true;
  3510. };
  3511.  
  3512. // 完成加载时
  3513. var dcl = function () {
  3514. if (!validPage()) return;
  3515. // 初始化用户语言
  3516. i18n(unsafeWindow.$CONFIG.lang);
  3517. // 加载用户配置
  3518. config = config(unsafeWindow.$CONFIG.uid);
  3519. // 初始化文本和网页数据(基于用户选择的语言)
  3520. Object.keys(text).map(function (key) { i18n(text[key]); text[key] = text[key].local; });
  3521. Object.keys(html).map(function (key) { html[key] = fillStr(html[key]); });
  3522. // 初始化所有过滤器
  3523. filters.init();
  3524. // 初始化折叠微博后的显示
  3525. fixFoldWeibo.init();
  3526. // 注册样式
  3527. css.init();
  3528. // 初始化界面
  3529. showIcon();
  3530. // 开始过滤
  3531. newNode.active();
  3532. };
  3533. if (document.body) call(dcl);
  3534. else document.addEventListener('DOMContentLoaded', dcl);
  3535.  
  3536. GM_addStyle(fillStr((funcStr(function () { /*!CSS
  3537. // 在顶部添加按钮
  3538. .gn_setting[node-type="member"]:last-child { margin-right: 44px; }
  3539. .WB_global_nav .gn_setting .gn_tab.gn_filter .ico { background-image: url("{{filter-img}}"); !important; background-position: 0 0 !important; }
  3540. .WB_global_nav .gn_search { width: 210px !important; left: 440px !important; position: absolute !important; }
  3541. .WB_global_nav .gn_search .gn_input { width: 168px !important; }
  3542. // 设置框相关样式
  3543. .yawf-Layer.yawf-drag { opacity: 0.67; -moz-user-select: none; user-select: none; }
  3544. #yawf-config [node-type="inner"] { padding: 20px; }
  3545. .yawf-config-body { margin: -20px; max-height: 360px; overflow-y: auto; padding: 20px; width: 760px; }
  3546. #yawf-config .profile_tab { font-size: 12px; margin: -20px -20px 20px; width: 800px; }
  3547. .yawf-config-layer { padding-bottom: 20px; }
  3548. .yawf-groupSubtitle, .yawf-groupRemark { margin: 5px 10px; padding: 10px 0 0 0; }
  3549. .yawf-groupSubtitle { font-weight: bold; }
  3550. .yawf-configInput { display: inline; }
  3551. .yawf-configStringInput { display: block; }
  3552. .yawf-configItem, .yawf-groupText { margin: 0 20px; padding: 0 0; }
  3553. .yawf-configItem { line-height: 30px; }
  3554. .yawf-groupText { line-height: 1em; }
  3555. .yawf-groupText p { margin: 2px 0 0; }
  3556. .yawf-configKeyInput button { padding: 0 1em; }
  3557. .yawf-configKeyInput span { display: none; }
  3558. .yawf-configKeyInput button:focus~span { display: inline; }
  3559. .yawf-configItem label+label { margin-left: 0.5em; }
  3560. .yawf-configItem br+label { margin-left: 4em; }
  3561. .yawf-whitelistFilterTitle::before, .yawf-blacklistFilterTitle::before, .yawf-foldlistFilterTitle::before { content: " "; display: inline-block; width: 0.8em; height: 0.8em; border-radius: 1em; margin-right: 0.5em; border: 1px solid white; vertical-align: middle; }
  3562. .yawf-whitelistFilterTitle::before { background: #37c837; box-shadow: 0 0 2px #37c837; }
  3563. .yawf-blacklistFilterTitle::before { background: #c83737; box-shadow: 0 0 2px #c83737; }
  3564. .yawf-foldlistFilterTitle::before { background: #c8c837; box-shadow: 0 0 2px #c8c837; }
  3565. .yawf-configString span { line-height: 16px; width:calc(100% - 56px); margin: 1px 1px -21px; padding: 2px 10px; display: block; position: relative; }
  3566. .yawf-configString textarea.W_input { width: calc(100% - 20px); padding-top: 20px; min-height: 80px; resize: vertical; background: linear-gradient(to bottom, -moz-Dialog 0px, -moz-Dialog 20px, transparent 21px, transparent 100%); }
  3567. .yawf-configStringsInput, .yawf-configUsersInput { margin: 5px; }
  3568. .yawf-configStringsItems, .yawf-configUsersItems { padding: 5px 10px; line-height: 1em; }
  3569. .yawf-configStringsItem, .yawf-configUsersItem { display: inline-block; margin: 2px; }
  3570. .yawf-configStringsItem a.icon_close, .yawf-configUsersItem a.icon_close { margin-left: 3px; vertical-align: -2px; }
  3571. .yawf-configUsersItem .shield_object_card { display: inline-block; }
  3572. .yawf-configUsersItem .shield_object_card .card_bg { border: 1px solid #e6e6e6; border-radius: 2px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.02); padding: 1px 5px 1px 1px; }
  3573. .yawf-configUsersItem .shield_object_card .card_pic { float: left; width: 50px; }
  3574. .yawf-configUsersItem .shield_object_card .card_pic .pic_box { display: block; }
  3575. .yawf-configUsersItem .shield_object_card .card_content { margin-left: 60px; }
  3576. .yawf-configUsersItem .shield_object_card .object_info { height: 22px; margin-top: 2px; }
  3577. .yawf-configUsersItem .shield_object_card .object_name { line-height: 22px; overflow: hidden; }
  3578. .yawf-configUsersItem .shield_object_card .other_info { line-height: 24px; }
  3579. .yawf-configImportExport [node-type] { margin-right: 20px; }
  3580. .yawf-configAdd { appearance: none; }
  3581. #yawf-config .btn { border-top: 1px solid #ccc; margin: 15px 0 0; padding: 10px 0 0; }
  3582. #yawf-config .btn .W_btn_b_disable:hover { border-color: #d9d9d9; }
  3583. #yawf-config .btn .W_btn_b_disable:hover span { border-color: #ffffff; }
  3584. .layoutFilterGroupLayer .yawf-configBoolean { display: inline-block; margin-right: 0; }
  3585. .yawf-userstyles-tip { float: right; margin: 0 0 0 1em; }
  3586. // 隐藏微博
  3587. [yawf-display$="-hidden"] { display: none !important; }
  3588. [node-type="feed_list"] .WB_feed_type:not([yawf-display]), [node-type="feed_list"] .WB_feed_type .WB_feed_type:not([yawf-display]) { visibility: hidden !important; }
  3589. // 折叠微博
  3590. [node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"]::before { display: block; width: 100%; height: 24px; line-height: 24px; padding: 0 2em 20px; border-bottom: #e6e6e6 1px solid; }
  3591. [node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"] { height: 45px; overflow: hidden; cursor: pointer; }
  3592. [node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"] .WB_screen { margin-top: -40px !important; }
  3593. [node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"] .WB_feed_datail,
  3594. [node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"] .type_spe_pos { display: none !important; }
  3595. // 子微博
  3596. [node-type="feed_list"] .WB_feed_type[yawf-display$="-hidden"]+.WB_feed_type[yawf-display$="-son"],
  3597. [node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"]+.WB_feed_type[yawf-display$="-son"] { display: none !important; }
  3598. [node-type="feed_list"] .WB_feed_type:not([yawf-display$="-son"]) .WB_feed_together { display: none !important; }
  3599. [node-type="feed_list"] .WB_feed_type[yawf-withson="son"] .WB_feed_datail,
  3600. [node-type="feed_list"] .WB_feed_type[yawf-withson="son"][yawf-display$="-fold"]::before { border: 0 none !important; }
  3601. [node-type="feed_list"] .WB_feed_type[yawf-display$="-son"] { padding-top: 0 !important; }
  3602. [node-type="feed_list"] .WB_feed_type[yawf-display$="-son"]>.WB_screen,
  3603. [node-type="feed_list"] .WB_feed_type[yawf-display$="-son"]>.WB_feed_datail>.WB_face,
  3604. [node-type="feed_list"] .WB_feed_type[yawf-display$="-son"]>.WB_feed_datail>.WB_detail>*:not(.WB_feed_together) { display: none !important; }
  3605. [node-type="feed_list"] .WB_feed_type[yawf-display$="-son"]>.WB_feed_datail>.WB_detail { margin-top: -20px; margin-bottom: -10px; }
  3606. // 其他
  3607. .WB_feed_together .wft_users { display: none; }
  3608. .WB_feed_together[yawf-sonfold="display"] [node-type="feed_list_wrapForward"] { display: block !important; }
  3609. .WB_feed_together[yawf-sonfold="display"] [action-type="feed_list_seeAll"],
  3610. .WB_feed_together[yawf-sonfold="display"] [action-type="feed_list_foldForward"] { display: none !important; }
  3611. .W_miniblog { visibility: hidden; }
  3612. .yawf-range-container { background-color: #f0f0f0; background-color: -moz-dialog; position: relative; display: inline-block; margin-left: -66px; width: 81px; margin-right: -15px; -webkit-transform: rotate(270deg); transform: rotate(270deg); top: calc(-1em - 36px); box-shadow: 0px 12px #f0f0f0, 0px -12px #f0f0f0; box-shadow: 0px 12px -moz-dialog, 0px -12px -moz-dialog; }
  3613. input[type="number"]:not(:focus) ~ .yawf-range-container:not(:hover) > input[type="range"]:not(:focus) { display: none; }
  3614. // 拖拽
  3615. #yawf-drop-area { background: rgba(251, 251, 216, 0.8); display: none; height: 230px; left: calc(50% + 260px); position: fixed; top: 40px; width: 230px; z-index: 9999; }
  3616. .yawf-drop-area-desc { height: 170px; width: 170px; margin: 16px 16px -206px 16px; padding: 10px; -moz-user-select: none; user-select: none; border: 4px dashed #ddd; border-radius: 20px; }
  3617. .yawf-drop-area-title { font-size: 150%; font-weight: bold; }
  3618. .yawf-drop-area-text { padding: 10px; }
  3619. #yawf-drop-area-content { height: 230px; width: 230px; position: relative; z-index: 10002; opacity: 0; }
  3620. #yawf-fast-filter-chose, #yawf-fast-filter-list { padding: 20px 40px; }
  3621. #yawf-fast-filter-text { font-weight: bold; }
  3622. */ }) + '\n').replace(/\/\/.*\n/g, '\n'), {
  3623. 'filter-img': images.filter,
  3624. }));