Yet Another Weibo Filter

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

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

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