Yet Another Weibo Filter

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

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

  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.1.28 alpha
  8. // @author 田生
  9. // @copyright 2013+, 田生
  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': { 'zh-cn': '"来自 @" attr(yawf-author) " 的一条微博被折叠,请点击查看"', 'zh-hk': '"來自 @" attr(yawf-author) " 的一條微博被折疊,請點擊查看"', 'zh-tw': '"來自 @" attr(yawf-author) " 的一條微博被折疊,請點擊查看"', 'en': '"A Weibo from @" attr(yawf-author) " was folded, click to view."' },
  51. // 设置框
  52. 'filter': { 'zh-cn': '过滤器', 'zh-hk': '篩選器', 'zh-tw': '篩選器', 'en': 'Filter' },
  53. 'configDialogTitle': { 'zh-cn': '过滤器设置', 'zh-hk': '篩選器設定', 'zh-tw': '篩選器設定', 'en': 'Filter Settings' },
  54. 'configRefreshNotice': { 'zh-cn': '部分设置修改需要保存后重新载入页面才能生效', 'zh-hk': '部分設定變更需要儲存後重新載入網頁才能生效', 'zh-tw': '部分設定變更需要儲存後重新載入網頁才能生效', 'en': 'Some settings need refresh webpage after save to apply' },
  55. 'whitelistFilterDesc': { 'zh-cn': '总是显示{{{typed}}}', 'zh-hk': '總是顯示{{{typed}}}', 'zh-tw': '總是顯示{{{typed}}}', 'en': 'Always show {{{typed}}}' },
  56. 'blacklistFilterDesc': { 'zh-cn': '隐藏{{{typed}}}', 'zh-hk': '隱藏{{{typed}}}', 'zh-tw': '隱藏{{{typed}}}', 'en': 'Hide {{{typed}}}' },
  57. 'foldlistFilterDesc': { 'zh-cn': '折叠{{{typed}}}', 'zh-hk': '折疊{{{typed}}}', 'zh-tw': '折疊{{{typed}}}', 'en': 'Fold {{{typed}}}' },
  58. 'whitelistActionDesc': { 'zh-cn': '显示', 'zh-hk': '顯示', 'zh-tw': '顯示', 'en': 'Show' },
  59. 'blacklistActionDesc': { 'zh-cn': '隐藏', 'zh-hk': '隱藏', 'zh-tw': '隱藏', 'en': 'Hide' },
  60. 'foldlistActionDesc': { 'zh-cn': '折叠', 'zh-hk': '折疊', 'zh-tw': '折疊', 'en': 'Fold' },
  61. // 关键词
  62. 'keywordFilterGroupTitle': { 'zh-cn': '内容', 'zh-hk': '內容', 'zh-tw': '內容', 'en': 'Content' },
  63. 'keywordFilterDesc': { 'zh-cn': '关键词', 'zh-hk': '關鍵字', 'zh-tw': '關鍵字', 'en': 'Keyword' },
  64. 'keywordFilterDetails': { 'zh-cn': '包含以下关键词的微博', 'zh-hk': '包含以下關鍵字的微博', 'zh-tw': '包含以下關鍵字的微博', 'en': 'Weibo with these keywords' },
  65. 'keywordFilterFast': { 'zh-cn': '包含关键词“{{text}}”的微博', 'zh-hk': '包含關鍵字“{{text}}”的微博', 'zh-tw': '包含關鍵字“{{text}}”的微博', 'en': 'Weibo contains keyword "{{text}}"' },
  66. // 正则表达式
  67. 'regexpFilterGroupTitle': { 'zh-cn': '正则', 'zh-hk': '正則', 'zh-tw': '正規', 'en': 'Regexp' },
  68. 'regexpFilterDesc': { 'zh-cn': '正则式', 'zh-hk': '正則式', 'zh-tw': '正規式', 'en': 'Regexp' },
  69. 'regexpFilterDetails': { 'zh-cn': '匹配以下正则表达式的微博', 'zh-hk': '匹配以下正則表達式的微博', 'zh-tw': '匹配以下正規表示式的微博', 'en': 'Weibo matches these regular expressions' },
  70. 'regexpFilterRemark': { 'zh-cn': '书写时不需要对“/”字符转义', 'zh-hk': '書寫時不需要對“/”字符轉義', 'zh-tw': '書寫時不需要對“/”字符轉義', 'en': 'Do not escape "/" in your regexp.' },
  71. 'regexpBadFormedTitle': { 'zh-cn': '非法的正则表达式', 'zh-hk': '不合法的正則表達式', 'zh-tw': '不合法的正規表示式', 'en': 'Illegal Regexp' },
  72. 'regexpBadFormed': { 'zh-cn': '您输入的/{{regexp}}/不能被正确地解析为正则表达式,请检查您的输入。如需关键词屏蔽请到内容标签页设置。', 'zh-hk': '您输入的/{{regexp}}/不能被正确地解析为正则表达式,请检查您的输入。如需关键词屏蔽请到内容标签页面设置。', 'zh-tw': '您輸入的/{{regexp}}/不能被正確地解析為正規表示式,請檢查您的輸入。如需關鍵詞屏蔽請到內容標籤頁面設置。', 'en': 'Can not parse /{{regexp}}/ as regexp. Please check your input. You may hide Weibo by keywords in Content tab page.' },
  73. // 帐号
  74. 'accountFilterGroupTitle': { 'zh-cn': '帐号', 'zh-hk': '帳號', 'zh-tw': '帳號', 'en': 'Account' },
  75. 'accountFilterDesc': { 'zh-cn': '帐号', 'zh-hk': '帳號', 'zh-tw': '帳號', 'en': 'Account' },
  76. 'accountFilterDetails': { 'zh-cn': '来自以下帐号的微博', 'zh-hk': '來自以下帳號的微博', 'zh-tw': '來自以下帳號的微博', 'en': 'Weibo from these accounts' },
  77. 'accountFilterFast': { 'zh-cn': '作者是“@{{name}}”的微博', 'zh-hk': '作者是“@{{name}}”的微博', 'zh-tw': '作者是“@{{name}}”的微博', 'en': 'Weibo from "@{{name}}"', },
  78. 'accountFilterRemark': {
  79. 'zh-cn': '推荐您到<a target="_blank" href="http://account.weibo.com/set/privacy#open=privacy_feeduser">隐私设置 - 屏蔽账号</a>隐藏您关注了但不想在首页看到的账号。',
  80. 'zh-hk': '推薦您到<a target="_blank" href="http://account.weibo.com/set/privacy#open=privacy_feeduser">隱私設置 - 屏蔽帐号</a>隱藏您關注了但不想在首頁看到的帳號。',
  81. 'zh-tw': '推薦您到<a target="_blank" href="http://account.weibo.com/set/privacy#open=privacy_feeduser">隱私設置 - 屏蔽帐号</a>隱藏您關注了但不想在首頁看到的帳號。',
  82. 'en': 'You can hide 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>.'
  83. },
  84. 'accountNotExistErrorTitle': { 'zh-cn': '帐号不存在', 'zh-hk': '帳號不存在', 'zh-tw': '帳號不存在', 'en': 'Account does not exist' },
  85. 'accountNotExistError': { 'zh-cn': '不存在名为{{name}}的账号', 'zh-hk': '不存在名為{{name}}的賬號', 'zh-tw': '不存在名為{{name}}的賬號', 'en': 'Account named {{name}} does not exist' },
  86. // 原创
  87. 'originalFilterGroupTitle': { 'zh-cn': '原创', 'zh-hk': '原創', 'zh-tw': '原創', 'en': 'Original' },
  88. 'originalFilterDesc': { 'zh-cn': '帐号', 'zh-hk': '帳號', 'zh-tw': '帳號', 'en': 'Account' },
  89. 'originalFilterDetails': { 'zh-cn': '转发自以下账号的微博', 'zh-hk': '隱藏轉發自以下帳號的微博', 'zh-tw': '隱藏轉發自以下帳號的微博', 'en': 'Hide Weibo forwarded from these accounts' },
  90. 'originalFilterFast': { 'zh-cn': '转发自“@{{name}}”的微博', 'zh-hk': '轉發自“@{{name}}”的微博', 'zh-tw': '轉發自“@{{name}}”的微博', 'en': 'Weibo forwarded from "@{{name}}"' },
  91. // 提到
  92. 'mentionFilterGroupTitle': { 'zh-cn': '提到', 'zh-hk': '提到', 'zh-tw': '提到', 'en': 'Mention' },
  93. 'mentionFilterDesc': { 'zh-cn': '帐号', 'zh-hk': '帳號', 'zh-tw': '帳號', 'en': 'Account' },
  94. 'mentionFilterDetails': { 'zh-cn': '提到以下账号的微博', 'zh-hk': '提到以下帳號的微博', 'zh-tw': '提到以下帳號的微博', 'en': 'Weibo mentioned these accounts' },
  95. 'mentionFilterFast': { 'zh-cn': '提到了“@{{name}}”的微博', 'zh-hk': '提到了“@{{name}}”的微博', 'zh-tw': '提到了“@{{name}}”的微博', 'en': 'Weibo mentioned "@{{name}}"' },
  96. // 话题
  97. 'topicFilterGroupTitle': { 'zh-cn': '话题', 'zh-hk': '話題', 'zh-tw': '話題', 'en': 'Topic' },
  98. 'topicFilterDesc': { 'zh-cn': '话题', 'zh-hk': '話題', 'zh-tw': '話題', 'en': 'Topic' },
  99. 'topicFilterDetails': { 'zh-cn': '包含以下话题的微博', 'zh-hk': '包含以下話題的微博', 'zh-tw': '包含以下話題的微博', 'en': 'Weibo with these topics' },
  100. 'topicFilterFast': { 'zh-cn': '包含“#{{topic}}#”话题的微博', 'zh-hk': '包含“#{{topic}}#”話題的微博', 'zh-tw': '包含“#{{topic}}#”話題的微博', 'en': 'Weibo contains topic "#{{topic}}#"' },
  101. // 来源
  102. 'sourceFilterGroupTitle': { 'zh-cn': '来源', 'zh-hk': '來源', 'zh-tw': '來源', 'en': 'Source' },
  103. 'sourceFilterDesc': { 'zh-cn': '来自', 'zh-hk': '來自', 'zh-tw': '來自', 'en': 'Via' },
  104. 'sourceFilterDetails': { 'zh-cn': '以下来源的微博', 'zh-hk': '以下來源的微博', 'zh-tw': '以下來源的微博', 'en': 'Weibo from these sources' },
  105. 'sourceFilterFast': { 'zh-cn': '来自“{{source}}”的微博', 'zh-hk': '來自“{{source}}”的微博', 'zh-tw': '來自“{{source}}”的微博', 'en': 'Weibo via "{{source}}"' },
  106. 'sourceFilterWarningTitle': { 'zh-cn': '默认来源', 'zh-hk': '預設來源', 'zh-tw': '預設來源', 'en': 'Default Source' },
  107. 'sourceFilterWarning': { 'zh-cn': '不能添加默认来源', 'zh-hk': '不能新增預設來源', 'zh-tw': '不能新增預設來源', 'en': 'You cannot add default source' },
  108. // 超链接
  109. 'hyperlinkFilterGroupTitle': { 'zh-cn': '链接', 'zh-hk': '連結', 'zh-tw': '連結', 'en': 'Link' },
  110. 'hyperlinkFilterDesc': { 'zh-cn': '超链接', 'zh-hk': '超連結', 'zh-tw': '超連結', 'en': 'Hyperlink' },
  111. 'hyperlinkFilterDetails': { 'zh-cn': '包含指向以下网站的超链接的微博', 'zh-hk': '包含指向以下站點的超連結的微博', 'zh-tw': '包含指向以下站點的超連結的微博', 'en': 'Weibo with hyperlink to these website' },
  112. 'hyperlinkFilterFast': { 'zh-cn': '包含指向包含“{{host}}”地址链接的微博', 'zh-hk': '包含指向包含“{{host}}”位址連結的微博', 'zh-tw': '包含指向包含“{{host}}”位址連結的微博', 'en': 'Weibo contains hyperlink to "{{host}}"' },
  113. // 更多
  114. 'otherFilterGroupTitle': { 'zh-cn': '更多', 'zh-hk': '其他', 'zh-tw': '其他', 'en': 'More' },
  115. // 显示
  116. 'otherWhitelistTitle': { 'zh-cn': '显示以下内容(不计入白名单)', 'zh-hk': '顯示以下內容(不計入白名單)', 'zh-tw': '顯示以下內容(不計入白名單)', 'en': 'Show following content (not regard as whitelist)' },
  117. 'showMyWeiboDesc': { 'zh-cn': '自己的微博', 'zh-hk': '自己的微博', 'zh-tw': '自己的微博', 'en': 'Weibo by myself' },
  118. 'showMyOriginalDesc': { 'zh-cn': '自己微博的转发', 'zh-hk': '自己微博的轉發', 'zh-tw': '自己微博的轉發', 'en': 'Forward of my Weibo' },
  119. 'showMentionMeDesc': { 'zh-cn': '提到自己的微博', 'zh-hk': '提到自己的微博', 'zh-tw': '提到自己的微博', 'en': 'Weibo mentioned me' },
  120. // 隐藏
  121. 'otherBlacklistTitle': { 'zh-cn': '隐藏以下内容', 'zh-hk': '以下內容', 'zh-tw': '隱藏以下內容', 'en': 'Hide following content' },
  122. 'adfeedFilterDesc': { 'zh-cn': '推广微博', 'zh-hk': '推廣微博', 'zh-tw': '推廣微博', 'en': 'Ad Weibo' },
  123. 'recommandFeedDesc': { 'zh-cn': '推荐微博', 'zh-hk': '建議微博', 'zh-tw': '建議微博', 'en': 'Recommand Weibo' },
  124. 'fakeWeiboFilterDesc': { 'zh-cn': '混入微博列表的其它内容', 'zh-hk': '混入微博列表的其它內容', 'zh-tw': '混入微博列表的其它內容', 'en': 'Other contents in Weibo list' },
  125. 'deletedForwardFilterDesc': { 'zh-cn': '已删除微博的转发', 'zh-hk': '已刪除微博的轉發', 'zh-tw': '已刪除微博的轉發', 'en': 'Forward of deleted Weibo' },
  126. 'voteWeiboFilterDesc': { 'zh-cn': '投票微博', 'zh-hk': '投票微博', 'zh-tw': '投票微博', 'en': 'Vote weibo' },
  127. // 刷屏与版聊
  128. 'otherSpammingTitle': { 'zh-cn': '刷屏与版聊', 'zh-hk': '洗版與版聊', 'zh-tw': '洗版與版聊', 'en': 'Spamming &amp; Chating' },
  129. 'sameAccountFilterDesc': { 'zh-cn': '相同作者的微博:', 'zh-hk': '相同作者的微博:', 'zh-tw': '相同作者的微博:', 'en': 'Weibo from same account: ' },
  130. 'sameForwardFilterDesc': { 'zh-cn': '相同微博的转发:', 'zh-hk': '相同微博的轉發:', 'zh-tw': '相同微博的轉發:', 'en': 'Forward from same Weibo: ' },
  131. 'sameNumberOptionDesc': { 'zh-cn': '超过{{number}}条时', 'zh-hk': '超過{{number}}條時', 'zh-tw': '超過{{number}}條時', 'en': 'display no more than {{number}} ' },
  132. 'sameActionOptionDesc': { 'zh-cn': '{{{select}}}', 'zh-hk': '{{{select}}}', 'zh-tw': '{{{select}}}', 'en': 'or {{{select}}} it' },
  133. // 分组浏览
  134. 'otherGroupTitle': { 'zh-cn': '分组浏览', 'zh-hk': '分組流覽', 'zh-tw': '分組流覽', 'en': 'Browse by Group' },
  135. 'accountByGroup': { 'zh-cn': '分组浏览时禁用按账号隐藏', 'zh-hk': '分組流覽時禁用按帳號隱藏', 'zh-tw': '分組流覽時禁用按帳號隱藏', 'en': 'Disable hide by account filter when browsing by group' },
  136. 'sameAccountByGroup': { 'zh-cn': '浏览分组时禁用相同作者数量限制', 'zh-hk': '流覽分組時禁用相同作者數量限制', 'zh-tw': '流覽分組時禁用相同作者數量限制', 'en': 'Disable hide too many Weibo from same account filter when browsing by group' },
  137. // 模块
  138. 'layoutFilterGroupTitle': { 'zh-cn': '模块', 'zh-hk': '模組', 'zh-tw': '模組', 'en': 'Module' },
  139. 'layoutFilterGroupDesc': { 'zh-cn': '隐藏以下模块', 'zh-hk': '隱藏以下模組', 'zh-tw': '隱藏以下模組', 'en': 'Hide following modules' },
  140. // 标识图标
  141. 'layoutHideIcon': { 'zh-cn': '标识/图标', 'zh-hk': '標誌/圖示', 'zh-tw': '標誌/圖示', 'en': 'Logo / Icon' },
  142. 'layoutHideIconLevel': { 'zh-cn': '等级', 'zh-hk': 'Level', 'zh-tw': '等級', 'en': 'Level' },
  143. 'layoutHideIconMember': { 'zh-cn': '微博会员', 'zh-hk': '微博會員', 'zh-tw': '微博會員', 'en': 'Weibo VIP / Member' },
  144. 'layoutHideIconApprove': { 'zh-cn': '个人认证', 'zh-hk': '個人認證', 'zh-tw': '個人認證', 'en': 'Personal Authentication / 個人認證' },
  145. 'layoutHideIconApproveCo': { 'zh-cn': '机构认证', 'zh-hk': '企業認證', 'zh-tw': '企業認證', 'en': 'Weibo Verification / 企業認證' },
  146. 'layoutHideIconClub': { 'zh-cn': '微博达人', 'zh-hk': '微博達人', 'zh-tw': '微博達人', 'en': 'Pioneer' },
  147. 'layoutHideIconVGirl': { 'zh-cn': '微博女郎', 'zh-hk': '微博女郎', 'zh-tw': '微博女郎', 'en': 'Weibo girl' },
  148. 'layoutHideIconTaobao': { 'zh-cn': '淘宝商户', 'zh-hk': '淘寶商戶', 'zh-tw': '淘寶商戶', 'en': 'Taobao Merchant' },
  149. // 导航栏
  150. 'layoutHideNav': { 'zh-cn': '导航栏', 'zh-hk': '導覽列', 'zh-tw': '導覽列', 'en': 'Navigation Bar' },
  151. 'layoutHideNavMain': { 'zh-cn': '首页', 'zh-hk': '首頁', 'zh-tw': '首頁', 'en': 'Home' },
  152. 'layoutHideNavHot': { 'zh-cn': '热门', 'zh-hk': '熱門', 'zh-tw': '熱門', 'en': 'Hot' },
  153. 'layoutHideNavApp': { 'zh-cn': '应用', 'zh-hk': '應用', 'zh-tw': '應用', 'en': 'Apps' },
  154. 'layoutHideNavGame': { 'zh-cn': '游戏', 'zh-hk': '遊戲', 'zh-tw': '遊戲', 'en': 'Game' },
  155. 'layoutHideNavMember': { 'zh-cn': '会员菜单', 'zh-hk': '會員功能表', 'zh-tw': '會員功能表', 'en': 'VIP Menu' },
  156. // 左栏
  157. 'layoutHideLeft': { 'zh-cn': '左栏', 'zh-hk': '左欄', 'zh-tw': '左欄', 'en': 'Left Column' },
  158. 'layoutHideLeftToMe': { 'zh-cn': '发给我的', 'zh-hk': '發給我的', 'zh-tw': '發給我的', 'en': 'Send to me' },
  159. 'layoutHideLeftFriends': { 'zh-cn': '好友圈', 'zh-hk': '好友圈', 'zh-tw': '好友圈', 'en': 'Friends' },
  160. 'layoutHideLeftApp': { 'zh-cn': '应用', 'zh-hk': '应用', 'zh-tw': '应用'/* as is */, 'en': 'Apps' },
  161. // 中栏
  162. 'layoutHideMiddle': { 'zh-cn': '中栏', 'zh-hk': '中欄', 'zh-tw': '中欄', 'en': 'Middle Column' },
  163. 'layoutHideMiddleRecommendedTopic': { 'zh-cn': '热门微博(发布框上方)', 'zh-hk': '热门微博(發布框上方)', 'zh-tw': '热门微博(發布框上方)'/* as is */, 'en': '热门微博 (Hot Weibo), top of publisher' },
  164. 'layoutHideMiddleMemberTip': { 'zh-cn': '开通会员提示(底部)', 'zh-hk': '開通會員提示(底部)', 'zh-tw': '開通會員提示(底部)', 'en': 'Tip of Join Weibo VIP, bottom' },
  165. // 右栏
  166. 'layoutHideRight': { 'zh-cn': '右栏', 'zh-hk': '右欄', 'zh-tw': '右欄', 'en': 'Right Column' },
  167. 'layoutHideRightWhole': { 'zh-cn': '整个右栏', 'zh-hk': '整個右欄', 'zh-tw': '整個右欄', 'en': 'Whole Right Column' },
  168. 'layoutHideRightTemplate': { 'zh-cn': '设置模板', 'zh-hk': '背景設定', 'zh-tw': '背景設定', 'en': 'Template Settings' },
  169. 'layoutHideRightInfo': { 'zh-cn': '头像', 'zh-hk': '頭像', 'zh-tw': '頭像', 'en': 'Avatar' },
  170. 'layoutHideRightTrial': { 'zh-cn': '会员资格体验', 'zh-hk': '会员资格体验', 'zh-tw': '会员资格体验'/* as is */, 'en': '会员资格体验 (Trial of VIP)' },
  171. 'layoutHideRightAtten': { 'zh-cn': '关注/粉丝/微博数', 'zh-hk': '關注/粉絲/微博數', 'zh-tw': '關注/粉絲/微博數', 'en': 'Numbers of Following/Followers/Weibo' },
  172. 'layoutHideRightInterest': { 'zh-cn': '可能感兴趣的人', 'zh-hk': '可能感興趣的人', 'zh-tw': '可能感興趣的人', 'en': 'You may know' },
  173. 'layoutHideRightHotTopic': { 'zh-cn': '热门话题', 'zh-hk': '熱門話題', 'zh-tw': '熱門話題', 'en': 'Hot Topic' },
  174. 'layoutHideRightMember': { 'zh-cn': '会员专区', 'zh-hk': '會員專區', 'zh-tw': '會員專區', 'en': 'Weibo VIP' },
  175. 'layoutHideRightWeibo': { 'zh-cn': '热门微博', 'zh-hk': '熱門微博', 'zh-tw': '熱門微博', 'en': 'Hot Weibo' },
  176. 'layoutHideRightLocation': { 'zh-cn': '地点推荐', 'zh-hk': '地點推薦', 'zh-tw': '地點推薦', 'en': 'Location' },
  177. 'layoutHideRightMusic': { 'zh-cn': ' 热门歌曲', 'zh-hk': '熱門歌曲', 'zh-tw': '熱門歌曲', 'en': 'Hot Music' },
  178. 'layoutHideRightMovie': { 'zh-cn': '最新电影', 'zh-hk': '最新電影', 'zh-tw': '最新電影', 'en': 'Hot Movie' },
  179. 'layoutHideRightBook': { 'zh-cn': '人气图书', 'zh-hk': '人氣圖書', 'zh-tw': '人氣圖書', 'en': 'Hot Book' },
  180. 'layoutHideRightNotice': { 'zh-cn': '公告栏', 'zh-hk': '公告欄', 'zh-tw': '公告欄', 'en': 'Bulletin Board' },
  181. // 微博内
  182. 'layoutHideWeibo': { 'zh-cn': '微博内', 'zh-hk': '微博內', 'zh-tw': '微博內', 'en': 'In Weibo' },
  183. 'layoutHideWeiboRecomFeed': { 'zh-cn': '精彩微博推荐', 'zh-hk': '精彩微博推薦', 'zh-tw': '精彩微博推薦', 'en': '精彩微博推荐 (Weibo you may interested in)' },
  184. 'layoutHideWeiboTopicCard': { 'zh-cn': '话题卡片', 'zh-hk': '話題卡片', 'zh-tw': '話題卡片', 'en': 'Topic Cards' },
  185. 'layoutHideWeiboLocationCard': { 'zh-cn': '位置卡片', 'zh-hk': '位置卡片', 'zh-tw': '位置卡片', 'en': 'Location Cards' },
  186. 'layoutHideWeiboFeedTip': { 'zh-cn': '评论框提示横幅', 'zh-hk': '評論框提示橫幅', 'zh-tw': '評論框提示橫幅', 'en': 'Tips for Comment' },
  187. // 个人主页
  188. 'layoutHidePerson': { 'zh-cn': '个人主页', 'zh-hk': '個人主頁', 'zh-tw': '個人主頁', 'en': 'Ones home page' },
  189. 'layoutHidePersonCover': { 'zh-cn': '封面图', 'zh-hk': '封面圖', 'zh-tw': '封面圖', 'en': 'Cover Picture' },
  190. 'layoutHidePersonTemplate': { 'zh-cn': '模板设置', 'zh-hk': '模板設置', 'zh-tw': '模板設置', 'en': 'Template Settings' },
  191. 'layoutHidePersonBadgeIcon': { 'zh-cn': '勋章', 'zh-hk': '勳章', 'zh-tw': '勳章', 'en': 'Badges' },
  192. 'layoutHidePersonStats': { 'zh-cn': '关注/粉丝/微博数', 'zh-hk': '關注/粉絲/微博數', 'zh-tw': '關注/粉絲/微博數', 'en': 'Numbers of Following/Followers/Weibo' },
  193. 'layoutHidePersonMyData': { 'zh-cn': '我的微博人气', 'zh-hk': '我的微博人气', 'zh-tw': '我的微博人气', 'en': '我的微博人气 (My Micro World)' },
  194. 'layoutHidePersonSuggestUser': { 'zh-cn': '可能感兴趣的人', 'zh-hk': '可能感兴趣的人', 'zh-tw': '可能感兴趣的人'/* as is */, 'en': 'Suggested' },
  195. 'layoutHidePersonGroup': { 'zh-cn': '推荐的人', 'zh-hk': '推荐的人', 'zh-tw': '推荐的人'/* as is */, 'en': '推荐的人 (Suggested Group)' },
  196. 'layoutHidePersonRelation': { 'zh-cn': '微关系', 'zh-hk': '微关系', 'zh-tw': '微关系'/* as is */, 'en': 'Relationship' },
  197. 'layoutHidePersonAlbum': { 'zh-cn': '图片', 'zh-hk': '相冊', 'zh-tw': '相冊', 'en': 'Album' },
  198. 'layoutHidePersonHotTopic': { 'zh-cn': '话题', 'zh-hk': '話題', 'zh-tw': '話題', 'en': 'Topic' },
  199. 'layoutHidePersonHotWeibo': { 'zh-cn': '热门微博', 'zh-hk': '熱門微博', 'zh-tw': '熱門微博', 'en': 'Hot Weibo' },
  200. // 杂项
  201. 'layoutHideOther': { 'zh-cn': '杂项', 'zh-hk': '雜項', 'zh-tw': '雜項', 'en': 'Others' },
  202. 'layoutHideOtherAds': { 'zh-cn': '广告', 'zh-hk': '廣告', 'zh-tw': '廣告', 'en': 'Advertisement' },
  203. 'layoutHideOtherFeedRecom': { 'zh-cn': '相关微博推荐', 'zh-hk': '相关推荐', 'zh-tw': '相关推荐', 'en': '相关推荐 (Related Weibo Suggestion)' },
  204. 'layoutHideOtherFooter': { 'zh-cn': '页面底部', 'zh-hk': '頁面底部', 'zh-tw': '頁面底部', 'en': 'Footer' },
  205. 'layoutHideOtherWbIm': { 'zh-cn': '微博桌面推荐(右下)', 'zh-hk': '微博桌面推薦(右下)', 'zh-tw': '微博桌面推薦(右下)', 'en': '微博桌面2014 (Desktop Weibo), bottom right' },
  206. 'layoutHideOtherTip': { 'zh-cn': '功能提示框', 'zh-hk': '功能提示框', 'zh-tw': '功能提示框', 'en': 'Function Tips' },
  207. // 工具
  208. 'toolFilterGroupTitle': { 'zh-cn': '工具', 'zh-hk': '工具', 'zh-tw': '工具', 'en': 'Tool' },
  209. 'useFastCreator': { 'zh-cn': '使用拖放快速创建过滤器', 'zh-hk': '使用拖放快速創建篩選器', 'zh-tw': '使用拖放快速創建篩選器', 'en': 'Use drag and drop to create filters' },
  210. 'clearDefTopicDesc': { 'zh-cn': '清除发布框中的默认话题', 'zh-hk': '清除發布框中的預設話題', 'zh-tw': '清除發布框中的預設話題', 'en': 'Remove default topic in Publisher' },
  211. 'userstyleTitle': { 'zh-cn': '自定义CSS', 'zh-hk': '自訂CSS', 'zh-tw': '自訂CSS', 'en': 'Customize CSS' },
  212. 'userstyleEditDesc': { 'zh-cn': '编辑微博自定义CSS', 'zh-hk': '編輯微博自訂CSS', 'zh-tw': '編輯微博自訂CSS', 'en': 'Edit Weibo Customize CSS' },
  213. 'userstyleEditDetails': { 'zh-cn': 'YAWF CSS: ', 'zh-hk': 'YAWF CSS: ', 'zh-tw': 'YAWF CSS: ', 'en': 'YAWF CSS: ' },
  214. 'noFloatNav': { 'zh-cn': '禁用导航栏顶端固定', 'zh-hk': '禁用導覽列頂端固定', 'zh-tw': '禁用導覽列頂端固定', 'en': 'Make navigation scroll with page' },
  215. 'showAllGroupDesc': { 'zh-cn': '展开左栏分组', 'zh-hk': '展開左欄分組', 'zh-tw': '展開左欄分組', 'en': 'Unfold groups in left column' },
  216. 'showAllMsgNavDesc': { 'zh-cn': '展开左栏消息', 'zh-hk': '展開左欄消息', 'zh-tw': '展開左欄消息', 'en': 'Unfold news in left column' },
  217. 'unwrapTextDesc': { 'zh-cn': '微博作者和正文同行', 'zh-hk': '微博作者和正文同行', 'zh-tw': '微博作者和正文同行', 'en': 'No line break after author' },
  218. 'personalRedirectWeibo': { 'zh-cn': '访问账号主页显示微博页面', 'zh-hk': '訪問帳號主頁顯示微博頁面', 'zh-tw': '訪問帳號主頁顯示微博頁面', 'en': 'Show Weibo page instead of personal mainpage by default' },
  219. 'viewOriginalDesc': { 'zh-cn': '添加“查看原图”链接', 'zh-hk': '添加“查看原圖”連結', 'zh-tw': '添加“查看原圖”連結', 'en': 'add "Original Picture" link' },
  220. 'viewOriginalText': { 'zh-cn': '查看原图', 'zh-hk': '查看原圖', 'zh-tw': '查看原圖', 'en': 'Original Picture' },
  221. 'blockHiddenWeiboDesc': { 'zh-cn': '告知服务器被隐藏的微博以避免再次加载', 'zh-hk': '告知伺服器被隱藏的微博以避免再次載入', 'zh-tw': '告知伺服器被隱藏的微博以避免再次載入', 'en': 'Send blocked Weibo to server to avoid load it again' },
  222. 'whitelistHighlightDesc': { 'zh-cn': '以该背景色显示白名单的微博:', 'zh-hk': '以該背景色顯示白名單的微博:', 'zh-tw': '以該背景色顯示白名單的微博:', 'en': 'Show Weibo in whitelist with background color: ' },
  223. 'transparencyInput': { 'zh-cn': '透明度{{number}}%', 'zh-hk': '透明度{{number}}%', 'zh-tw': '透明度{{number}}%', 'en': ' transparency {{number}} %' },
  224. 'mainBackgroundColorOverride': { 'zh-cn': '首页背景颜色', 'zh-hk': '首頁背景色彩', 'zh-tw': '首頁背景色彩', 'en': 'Background color for home page' },
  225. 'profileBackgroundColorOverride': { 'zh-cn': '个人主页背景颜色', 'zh-hk': '個人主頁背景色彩', 'zh-tw': '個人主頁背景色彩', 'en': 'Background color for personal home page' },
  226. // 脚本
  227. 'scriptFilterGroupTitle': { 'zh-cn': '脚本', 'zh-hk': '腳本', 'zh-tw': '腳本', 'en': 'Script' },
  228. // 导入导出
  229. 'configImportAndExport': { 'zh-cn': '设置', 'zh-hk': '設定', 'zh-tw': '設定', 'en': 'Setting' },
  230. 'configImportButton': { 'zh-cn': '导入', 'zh-hk': '匯入', 'zh-tw': '匯入', 'en': 'Import' },
  231. 'configImportWarningTitle': { 'zh-cn': '设置导入', 'zh-hk': '設定匯入', 'zh-tw': '設定匯入', 'en': 'Setting Import' },
  232. 'configImportWarning': { 'zh-cn': '导入的设置会覆盖您当前已有的设置,确实要导入设置吗?', 'zh-hk': '匯入的設定會覆蓋您當前已有的設定,您確定要匯入設定嗎?', 'zh-tw': '匯入的設定會覆蓋您當前已有的設定,您確定要匯入設定嗎?', 'en': 'The imported settings may replace your current settings. Are you sure you want to import this file?' },
  233. 'configImportSuccessTitle': { 'zh-cn': '设置导入完成', 'zh-hk': '設定匯入完成', 'zh-tw': '設定匯入完成', 'en': 'Import settings' },
  234. 'configImportSuccess': { 'zh-cn': '已经成功地导入了设置', 'zh-hk': '已经成功地匯入了設定', 'zh-tw': '已经成功地匯入了設定', 'en': 'Successfully imported settings' },
  235. 'configImportFailTitle': { 'zh-cn': '设置导入失败', 'zh-hk': '設定匯入失败', 'zh-tw': '設定匯入失败', 'en': 'Import settings' },
  236. 'configImportFail': { 'zh-cn': '导入设置文件时出现错误,可能是使用了错误的文件,文件被损坏或文件的版本不支持', 'zh-hk': '匯入設定檔案時出現錯誤,可能是使用了錯誤的檔案,檔案被損壞或設定檔案的版本不支持', 'zh-tw': '匯入設定檔案時出現錯誤,可能是使用了錯誤的檔案,檔案被損壞或設定檔案的版本不支持', '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.' },
  237. 'configExportButton': { 'zh-cn': '导出', 'zh-hk': '匯出', 'zh-tw': '匯出', 'en': 'Export' },
  238. 'configResetButton': { 'zh-cn': '重置', 'zh-hk': '重設', 'zh-tw': '重設', 'en': 'Reset' },
  239. 'configResetWarningTitle': { 'zh-cn': '设置重置', 'zh-hk': '設定重設', 'zh-tw': '設定重設', 'en': 'Setting Reset' },
  240. 'configResetWarning': { 'zh-cn': '这将会清空您当前的所有配置,确实要重置设置吗?', 'zh-hk': '這將會清空您當前的所有設定,您確定要重置設定嗎?', 'zh-tw': '這將會清空您當前的所有設定,您確定要重置設定嗎?', 'en': 'You are deleting all your settings. Are you sure you want to reset your settings?' },
  241. // 调试
  242. 'scriptDebugTitle': { 'zh-cn': '调试', 'zh-hk': '偵錯', 'zh-tw': '偵錯', 'en': 'Debug' },
  243. 'scriptDebug': { 'zh-cn': '在控制台打印调试信息', 'zh-hk': '將偵錯訊息列印到主控台', 'zh-tw': '將偵錯訊息列印到主控台', 'en': 'Print debug info to console' },
  244. // 关于
  245. 'scriptAboutTitle': { 'zh-cn': '关于', 'zh-hk': '關於', 'zh-tw': '關於', 'en': 'About' },
  246. 'scriptAbout': {
  247. 'zh-cn': '<p>Yet Another Weibo Filter (YAWF) {{version}}</p><p>YAWF 使用 MIT 协议授权。您可以访问<a href="https://tiansh.github.io/yawf/">脚本主页</a>获取详细信息。<br />如果您在使用过程中遇到任何脚本的错误,或对脚本有任何建议,您可以到<a href="https://github.com/tiansh/yawf/issues">反馈页面</a>提供报告,或直接<a href="http://weibo.com/tsh90/weibo">私信作者</a>。</p><p>本脚本参考并使用了<a href="https://code.google.com/p/weibo-content-filter/">眼不见心不烦</a>脚本的部分代码。</p>',
  248. 'zh-hk': '<p>Yet Another Weibo Filter (YAWF) {{version}}</p><p>YAWF 使用 MIT 協定授權。您可以訪問<a href="https://tiansh.github.io/yawf/">腳本主頁</a>獲取詳細資訊。<br />如果您在使用過程中遇到任何腳本的錯誤,或對腳本有任何建議,您可以到<a href="https://github.com/tiansh/yawf/issues">回饋頁面</a>提供報告,或直接<a href="http://weibo.com/tsh90/weibo">私信作者</a>。</p><p>本腳本參考並使用了<a href="https://code.google.com/p/weibo-content-filter/">眼不見心不煩</a>腳本的部分原始碼。</p>',
  249. 'zh-tw': '<p>Yet Another Weibo Filter (YAWF) {{version}}</p><p>YAWF 使用 MIT 協定授權。您可以訪問<a href="https://tiansh.github.io/yawf/">腳本主頁</a>獲取詳細資訊。<br />如果您在使用過程中遇到任何腳本的錯誤,或對腳本有任何建議,您可以到<a href="https://github.com/tiansh/yawf/issues">回饋頁面</a>提供報告,或直接<a href="http://weibo.com/tsh90/weibo">私信作者</a>。</p><p>本腳本參考並使用了<a href="https://code.google.com/p/weibo-content-filter/">眼不見心不煩</a>腳本的部分原始碼。</p>',
  250. 'en': '<p>Yet Another Weibo Filter (YAWF) {{version}}</p><p>YAWF is under the MIT License. You may want to visit <a href="https://tiansh.github.io/yawf/">project homepage</a> for more information.<br />If you find any bugs or have feature request, please report them in the <a href="https://github.com/tiansh/yawf/issues">feedback page</a>, or <a href="http://weibo.com/tsh90/weibo">send message to author</a>. </p><p>Some codes of this script come from <a href="https://code.google.com/p/weibo-content-filter/"><span lang="zh-cn">眼不见心不烦</span> (Weibo Content Filter)</a> script.</p>',
  251. },
  252. // 拖拽
  253. 'dropAreaTitle': { 'zh-cn': '拖放至此<br />快速创建过滤器', 'zh-hk': '拖放至此<br />快速創建篩選器', 'zh-tw': '拖放至此<br />快速創建篩篩器', 'en': 'Drop Here to Create Filter' },
  254. 'dropAreaText': { 'zh-cn': '将文字或链接拖放至此,快速创建过滤器。', 'zh-hk': '將文字或連結拖放至此,快速創建篩選器。', 'zh-tw': '將文字或連結拖放至此,快速創建篩選器。', 'en': 'Drop text or link here to create filter.' },
  255. 'fastCreateChoseTitle': { 'zh-cn': '创建过滤器', 'zh-hk': '創建篩篩器', 'zh-tw': '創建篩篩器', 'en': 'Create Filter' },
  256. 'fastFilterChoseText': { 'zh-cn': '请选择要创建的过滤器:', 'zh-hk': '請選擇要創建的篩選器:', 'zh-tw': '請選擇要創建的篩選器:', 'en': 'Chose the filter(s) you want:' },
  257. };
  258.  
  259. // 页面常量
  260. var html = {
  261. '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>',
  262. '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>',
  263. '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>',
  264. '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>',
  265. 'icon': '<div class="gn_setting" node-type="filter"><i><a class="gn_tab gn_filter" href="#"><span class="ico">{{filter}}</span></a></i></div>',
  266. 'configHeaderTop': '<div class="profile_tab S_line5 yawf-config-header" node-type="yawf-config-header"><ul class="pftb_ul S_line1">',
  267. '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>',
  268. 'configHeaderBottom': '</ul></div>',
  269. 'configLayerTop': '<div node-type="yawf-config-body" class="yawf-config-body">',
  270. 'configLayerItem': '<div class="{{name}} yawf-config-layer" node-type="{{name}}" style="display: none;"></div>',
  271. 'configLayerBottom': '</div>',
  272. 'configFooter': '',
  273. 'configSubtitle': '<div class="yawf-groupSubtitle">{{{text}}}</div>',
  274. 'configText': '<div class="yawf-groupText">{{{text}}}</div>',
  275. 'configText': '<div class="yawf-groupRemark">{{{text}}}</div>',
  276. 'configBoolean': '<div class="yawf-configBoolean yawf-configItem"><label><input id="yawf-{{key}}" class="W_checkbox yawf-configBooleanInput" type="checkbox" name="yawf-{{key}}"><span class="yawf-configDesc yawf-configBooleanDesc">{{{text}}}</span></label></div>',
  277. 'configString': '<div class="yawf-configString yawf-configItem"><label><span>{{{text}}}</span><textarea id="yawf-{{key}}" class="W_input yawf-configStringInput" name="yawf-{{key}}"></label></div>',
  278. '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>',
  279. 'configStringsItem': '<li class="W_btn_arrow tag yawf-configStringsItem"><span>{{[item]}}<a class="W_ico12 icon_close" href="javascript:void(0);"></a></span></li>',
  280. '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>',
  281. '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>',
  282. '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>',
  283. '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>',
  284. 'colorInput': '<input type="color" class="W_f14" style="width: 40px;" />',
  285. 'numberInput': '<input type="number" class="W_f14" style="width: 60px;" />',
  286. 'transparencyInput': '<input type="number" min="0" max="100" maxlength="3" class="W_f14" style="width: 45px; text-align: right;" /><div class="yawf-transparency-range" style="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;"><input type="range" style="height: 1em; width: 66px; margin-left: 7px; margin-right: 7px; " tabindex="-1" /></div>',
  287. 'select': '<select>{{options}}</select>',
  288. 'option': '<option value="{{value}}">{{{text}}}</option>',
  289. '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>',
  290. '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-chose">',
  291. 'fastFilterItem': '<li class="yawf-fast-filter-item"><label><input class="W_checkbox yawf-configBooleanInput" type="checkbox"><span>{{inner}}</span></label><select value="blacklist"><option value="whitelist">{{whitelistActionDesc}}</option><option value="blacklist">{{blacklistActionDesc}}</option><option value="foldlist">{{foldlistActionDesc}}</option></select></li>',
  292. '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>',
  293. };
  294.  
  295. var url = {
  296. 'newcard': 'http://www.weibo.com/aj/user/newcard?type=1&{{query}}&_t=1&callback={{callback}}',
  297. 'view_ori': 'http://photo.weibo.com/{{uid}}/wbphotos/large/mid/{{mid}}/pid/{{pid}}',
  298. 'block_wb': 'http://weibo.com/aj/user/block?_wv=5&__rnd={{rnd}}',
  299. };
  300.  
  301. // 微博过滤规则
  302. var rules = (function () {
  303. var list = [];
  304. var add = function (priority, rule) {
  305. list.push({ 'priority': priority, 'rule': rule });
  306. list.sort(function (x, y) { return y.priority - x.priority; });
  307. };
  308. var parse = function (feed) {
  309. var result = null;
  310. list.some(function (item) {
  311. try { result = item.rule(feed) || result; }
  312. catch (e) { debug('error while parsing rule %o: %o', item.rule, e); }
  313. if (result) debug('%o(%o) -> %s', item.rule, feed, result);
  314. return result;
  315. });
  316. return result;
  317. };
  318. return {
  319. 'add': add,
  320. 'parse': parse,
  321. };
  322. }());
  323.  
  324. // 根据用户界面上的语言做不同调整
  325. var i18n = (function () {
  326. var defaultLang = 'zh-cn';
  327. var lang = null;
  328. var pending = [];
  329. var chose = function (langObj) {
  330. langObj.local = langObj[lang] || langObj[defaultLang];
  331. };
  332. var langs = function (langObj) {
  333. pending.push(langObj);
  334. };
  335. var setLang = function (l) {
  336. lang = l;
  337. pending.map(chose);
  338. pending = [];
  339. i18n = chose;
  340. i18n.lang = l;
  341. };
  342. langs.setLang = setLang;
  343. return langs;
  344. }());
  345.  
  346. // 将字符串用&#dd的形式转义
  347. var escapeXml = function (s) {
  348. return s.replace(/./g, function (c) { return '&#' + c.charCodeAt(0); });
  349. };
  350.  
  351. // 以参数填充字符串
  352. var fillStr = function (base) {
  353. var argdatas = Array.apply(Array, arguments).slice(1);
  354. var datas = argdatas.concat([text]);
  355. return base.replace(/{{([\[{]?([a-zA-Z0-9_-]*)[\]}]?)}}/g, function (o, i, p) {
  356. var ret = null;
  357. datas.some(function (data) {
  358. if (p in data && typeof data[p] === 'string') ret = data[p];
  359. return ret !== null;
  360. });
  361. if (ret) {
  362. if (i[0] === '{') return fillStr.bind(this, ret).apply(null, argdatas);
  363. if (i[0] === '[') return escapeXml(ret);
  364. }
  365. return ret || o;
  366. });
  367. };
  368.  
  369. // 设置项
  370. var config = function (uid) {
  371. var config = {}, keys = [], onputs = [], storageKey = 'user' + uid + 'config';
  372. var tonputs = function (key, value, oldValue) {
  373. onputs.map(function (f) { f(key, value, oldValue); });
  374. };
  375. // 读取到内存
  376. var read = function () {
  377. try { config = JSON.parse(GM_getValue(storageKey, '{}')); }
  378. catch (e) { config = {}; }
  379. };
  380. // 从内存写出
  381. var write = function () {
  382. GM_setValue(storageKey, JSON.stringify(config));
  383. };
  384. // 写入到内存
  385. var put = function (key, value) {
  386. if (keys.indexOf(key) === -1) return;
  387. tonputs(key, value, config[key]);
  388. config[key] = value;
  389. write();
  390. return value;
  391. };
  392. // 从内存读取
  393. var get = function (key, value, type) {
  394. read();
  395. if (!(key in config)) return value;
  396. var val = config[key];
  397. if (typeof val === 'undefined') return value;
  398. if (type && (val === null || val.constructor !== type)) return value;
  399. return val;
  400. };
  401. // 当内存配置被修改时调用
  402. var onput = function (f) {
  403. onputs.push(f);
  404. };
  405. // 从字串导入
  406. var import_ = function (s) {
  407. try {
  408. clear();
  409. s = JSON.parse(s).conf;
  410. Object.keys(s).forEach(function (key) {
  411. put(key, s[key]);
  412. });
  413. write();
  414. return true;
  415. } catch (e) { }
  416. return false;
  417. };
  418. // 导出成为字串
  419. var export_ = function () {
  420. var info = GM_info || {}, script = info.script || {};
  421. return JSON.stringify({
  422. 'ua': navigator.userAgent,
  423. 'yawf': script.name,
  424. 'ver': script.version,
  425. 'gm': (info.scriptHandler || '') + info.version,
  426. 'conf': config,
  427. }, null, 2);
  428. };
  429. // 清空设置
  430. var clear = function () {
  431. config = {};
  432. tonputs();
  433. write();
  434. };
  435. // 注册键
  436. var reg = function (key) { keys.push(key); };
  437. // 初始化
  438. return {
  439. 'uid': uid,
  440. 'put': put, 'get': get, 'onput': onput,
  441. 'read': read, 'write': write,
  442. 'import': import_, 'export': export_,
  443. 'clear': clear,
  444. 'reg': reg,
  445. };
  446. };
  447.  
  448. var debug = !!GM_getValue('debug', false) ?
  449. console.log.bind(console) : function () { };
  450.  
  451. // 显示右上角过滤器图标
  452. var showIcon = function () {
  453. var p = document.querySelector('.WB_global_nav .gn_person');
  454. if (!p) return setTimeout(showIcon, 100);
  455. var d = cewih('div', html.icon).firstChild;
  456. p.appendChild(d);
  457. var f = document.querySelector('.gn_filter');
  458. f.addEventListener('click', function (e) {
  459. filters.showDialog();
  460. e.preventDefault();
  461. });
  462. };
  463. // 对话框
  464. var Form = function (dom, display, details) {
  465. var ok = dom.querySelector('[node-type="OK"]');
  466. var cancel = dom.querySelector('[node-type="cancel"]');
  467. var close = dom.querySelector('[node-type="close"]');
  468. var title = dom.querySelector('.title');
  469. var mouse = null, pos;
  470. var setPos = function (pos) {
  471. var left = pos[0], top = pos[1];
  472. left = Math.min(Math.max(0, left), document.body.clientWidth - dom.clientWidth - 2);
  473. top = Math.min(Math.max(pageYOffset, top), pageYOffset + window.innerHeight - dom.clientHeight - 2);
  474. dom.style.left = left + 'px';
  475. dom.style.top = top + 'px';
  476. return [left, top];
  477. };
  478. var dragMove = function (e) {
  479. var mouse_new = [e.clientX, e.clientY];
  480. pos[0] += mouse_new[0] - mouse[0];
  481. pos[1] += mouse_new[1] - mouse[1];
  482. setPos(pos);
  483. mouse = mouse_new;
  484. };
  485. var dragMoveDone = function () {
  486. document.removeEventListener('mousemove', dragMove);
  487. document.removeEventListener('mouseup', dragMoveDone);
  488. dom.classList.remove('yawf-drag');
  489. if (dom.releaseCapture) { dom.releaseCapture(); }
  490. pos = setPos(pos);
  491. mouse = null;
  492. };
  493. if (title) {
  494. title.style.cursor = 'move';
  495. title.addEventListener('mousedown', function (e) {
  496. mouse = [e.clientX, e.clientY];
  497. document.addEventListener('mousemove', dragMove);
  498. document.addEventListener('mouseup', dragMoveDone);
  499. dom.classList.add('yawf-drag');
  500. if (dom.setCapture) { dom.setCapture(); }
  501. });
  502. }
  503. if (details.onOk) if (ok) ok.addEventListener('click', details.onOk);
  504. if (details.onCancel) {
  505. if (cancel) cancel.addEventListener('click', details.onCancel);
  506. if (close) close.addEventListener('click', details.onCancel);
  507. }
  508. var cover = cewih('div', html.cover).firstChild;
  509. var keys = function (e) {
  510. if (e.keyCode === 13) if (ok) ok.click();
  511. if (e.keyCode === 27) if (close) close.click();
  512. };
  513. var hide = function () {
  514. document.body.removeChild(dom);
  515. document.body.removeChild(cover);
  516. document.removeEventListener('keypress', keys);
  517. };
  518. var show = function (top, left) {
  519. document.body.appendChild(cover);
  520. document.body.appendChild(dom);
  521. if (top == null) top = (window.innerHeight - dom.clientHeight) / 2;
  522. if (left == null) left = (window.innerWidth - dom.clientWidth) / 2;
  523. pos = [left, top + pageYOffset];
  524. setPos(pos);
  525. document.addEventListener('keypress', keys);
  526. document.activeElement.blur();
  527. };
  528. if (display) show();
  529. if (ok) ok.addEventListener('click', hide);
  530. if (cancel) cancel.addEventListener('click', hide);
  531. if (close) close.addEventListener('click', hide);
  532. return {
  533. 'hide': hide,
  534. 'show': show,
  535. };
  536. };
  537.  
  538. // 显示一个对话框
  539. var Dialog = function (id, title, fillFun) {
  540. var dom = cewih('div', fillStr(html.dialog, { 'id': id, 'title': fillStr(title) })).firstChild;
  541. var form = Form(dom, false, {});
  542. fillFun(dom.querySelector('[node-type="inner"]'));
  543. return form;
  544. };
  545.  
  546. // 显示一个提示框
  547. var Alert = function (id, details) {
  548. var dom = cewih('div', fillStr(html.alert, { 'id': id, 'title': details.title, 'text': details.text, 'icon': details.icon || 'warn' })).firstChild;
  549. var form = Form(dom, true, details);
  550. return form;
  551. };
  552.  
  553. var Confirm = function (id, details) {
  554. var dom = cewih('div', fillStr(html.confirm, { 'id': id, 'title': details.title, 'text': details.text, 'icon': details.icon || 'question' })).firstChild;
  555. var form = Form(dom, true, details);
  556. return form;
  557. };
  558.  
  559. // 延迟调用函数
  560. var call = function (f) {
  561. setTimeout.bind(this, f, 0).apply(null, Array.apply(Array, arguments).slice(1));
  562. };
  563.  
  564. // 套上try-catch
  565. var withTry = function (f, fc) {
  566. return function () {
  567. try { f.apply(this, arguments); }
  568. catch (e) {
  569. debug('Exception while run %o: %o (%o)', f, e, e.stack);
  570. if (fc) fc(e);
  571. }
  572. };
  573. };
  574.  
  575. // 管理样式
  576. var css = (function () {
  577. var styleText = '';
  578. var fun = function (css) {
  579. return function () {
  580. if (this.conf) styleText += css + '\n';
  581. };
  582. };
  583. fun.init = function () { GM_addStyle(styleText); };
  584. fun.add = function (css) { styleText += css + '\n'; };
  585. return fun;
  586. }());
  587.  
  588. // 产生一个假的回调函数
  589. var dateStr = (function () {
  590. var last = 0;
  591. return function () {
  592. return '' + (last = Math.max(last + 1, Number(new Date())));
  593. };
  594. }());
  595.  
  596. // 维护账号信息,用于显示
  597. var account = (function () {
  598. var idCache = {}, nameCache = {}, working = {};
  599. var request = function (queryStr, onsucc, onerror) {
  600. if (working[queryStr]) return working[queryStr].push([onsucc, onerror]);
  601. working[queryStr] = [[onsucc, onerror]];
  602. var done = function (success, data) {
  603. working[queryStr].forEach(function (w) { w[success ? 0 : 1](data); });
  604. delete working[queryStr];
  605. };
  606. GM_xmlhttpRequest({
  607. 'method': 'GET',
  608. 'url': fillStr(url.newcard, { 'query': queryStr, 'callback': 'STK_' + dateStr() }),
  609. 'onload': withTry(function (resp) {
  610. var respJson = JSON.parse(resp.responseText.replace(/^try{[^{]*\(/, '').replace(/\)}catch\(e\){};$/, ''));
  611. var namecard = cewih('div', respJson.data);
  612. var avatar = namecard.querySelector('.name dt img').getAttribute('src');
  613. var name = namecard.querySelector('.name dd a[uid]').getAttribute('title');
  614. var uid = namecard.querySelector('.name dd a[uid]').getAttribute('uid');
  615. var data = { 'avatar': avatar, 'id': uid, 'name': name };
  616. nameCache[name] = idCache[uid] = data;
  617. done(true, data);
  618. }, done.bind(this, false)),
  619. 'onerror': function () { done(false); },
  620. });
  621. return queryStr;
  622. };
  623. var byId = function (id, onsucc, onerror) {
  624. if (idCache[id]) onsucc(idCache[id]);
  625. else request('id=' + id, onsucc, onerror);
  626. };
  627. var byName = function (name, onsucc, onerror) {
  628. if (nameCache[name]) onsucc(nameCache[name]);
  629. else request('name=' + encodeURIComponent(name), onsucc, onerror);
  630. };
  631. return { 'id': byId, 'name': byName };
  632. }());
  633.  
  634. // 过滤器管理器
  635. var filters = (function () {
  636. var list = [], preinit = true;
  637. var add = function (details) {
  638. list.push(details);
  639. if (!preinit) details.init();
  640. return details;
  641. };
  642. var init = function () {
  643. list.forEach(function (x) { x.init(); });
  644. preinit = false;
  645. };
  646. var dialog = null;
  647. var lastTab = 0;
  648. var dialogTabs = function (list, inner, page) {
  649. var alist = Array.apply(Array, inner.querySelectorAll('.yawf-config-header a'));
  650. var llist = Array.apply(Array, inner.querySelectorAll('.yawf-config-body .yawf-config-layer'));
  651. var choseLList = function (i) {
  652. llist.forEach(function (l) { l.style.display = 'none'; });
  653. alist.forEach(function (a) { a.classList.remove('current'); a.classList.remove('S_bg5'); a.classList.add('S_bg1'); });
  654. llist[i].innerHTML = ''; list[i].show(llist[i]); llist[i].style.display = 'block';
  655. alist[i].classList.add('current'); alist[i].classList.remove('S_bg1'); alist[i].classList.add('S_bg5');
  656. lastTab = i;
  657. };
  658. list.map(function (filter, i) {
  659. var a = alist[i];
  660. a.addEventListener('mousedown', function () { choseLList(i); });
  661. a.addEventListener('keydown', function () { choseLList(i); });
  662. });
  663. choseLList(page);
  664. };
  665. var showDialog = function (page, count) {
  666. var showDialogInner = function (inner) {
  667. inner.innerHTML = [html.configHeaderTop,
  668. list.map(function (filter, index) {
  669. return fillStr(html.configHeaderItem, {
  670. 'name': text[filter.name + 'Title'],
  671. 'aclass': index === 0 ? 'S_bg5 current' : 'S_bg1',
  672. 'liclass': index === list.length - 1 ? 'pftb_itm_lst' : ' ',
  673. });
  674. }).join(''),
  675. html.configHeaderBottom,
  676. html.configLayerTop,
  677. list.map(function (filter, index) {
  678. return fillStr(html.configLayerItem, {
  679. 'name': filter.name + 'Layer',
  680. });
  681. }).join(''),
  682. html.configLayerBottom,
  683. html.configFooter,
  684. ].join('');
  685. call(function () {
  686. dialog.show(0);
  687. });
  688. if (list.indexOf(page) === -1) dialogTabs(list, inner, lastTab);
  689. else dialogTabs(list, inner, list.indexOf(page));
  690. };
  691. if (!(dialog = Dialog('yawf-config', '{{configDialogTitle}}', showDialogInner))) {
  692. if (!count || count < 100) setTimeout(showDialog, 100, page, (count || 0) + 1);
  693. }
  694. };
  695. return {
  696. 'add': add,
  697. 'init': init,
  698. 'showDialog': showDialog,
  699. };
  700. }());
  701.  
  702. // 快速创建播放器的对话框
  703. var fastFilterDialog = function (chose) {
  704. var dialogInner = function (inner) {
  705. inner.innerHTML = [html.fastFilterHeader,
  706. chose.map(function (c) {
  707. return fillStr(html.fastFilterItem, { 'inner': c.filter.desc(c.val) });
  708. }).join(''),
  709. html.fastFilterFooter].join('');
  710. var checkboxList = Array.apply(Array, inner.querySelectorAll('input[type="checkbox"]'));
  711. var selectList = Array.apply(Array, inner.querySelectorAll('select'));
  712. selectList.forEach(function (select) { select.value = 'blacklist'; });
  713. var allChecked = function () {
  714. var active = [];
  715. checkboxList.forEach(function (checkbox, i) {
  716. if (checkbox.checked)
  717. active.push({ 'chose': chose[i], 'action': selectList[i].value });
  718. });
  719. return active;
  720. };
  721. if (checkboxList.length === 1) checkboxList[0].checked = true;
  722. else checkboxList.forEach(function (checkbox) { checkbox.checked = false; });
  723. var updateOkButton = function () {
  724. if (allChecked().length) ok.classList.remove('W_btn_a_disable');
  725. else ok.classList.add('W_btn_a_disable');
  726. };
  727. var ok = inner.querySelector('[action-type="ok"]');
  728. ok.addEventListener('click', function () {
  729. var active = allChecked();
  730. if (!active.length) return null;
  731. active.forEach(function (act) {
  732. act.chose.filter.add(act.chose.val, act.action);
  733. });
  734. dialog.hide();
  735. });
  736. checkboxList.forEach(function (checkbox) {
  737. checkbox.addEventListener('change', updateOkButton);
  738. });
  739. updateOkButton();
  740. var cancel = inner.querySelector('[action-type="cancel"]');
  741. cancel.addEventListener('click', function () { dialog.hide(); })
  742. };
  743. var dialog = Dialog('yawf-drop-select', '{{fastCreateChoseTitle}}', dialogInner);
  744. return dialog;
  745. };
  746.  
  747. // 将文本、链接等拖拽到框内,快速创建过滤器
  748. var dropdown = (function () {
  749. var dropArea, content;
  750. var dropdownFilters = [];
  751. var got = function (element) {
  752. if (!element) return;
  753. // 忽略最外面套的em/strong
  754. if (element.tagName && element.firstChild === element.lastChild &&
  755. ['strong', 'em'].indexOf(element.tagName.toLowerCase()) !== -1)
  756. element = element.firstChild;
  757. debug('got %o', element);
  758. var chose = [];
  759. dropdownFilters.forEach(function (filter, i) { chose[i] = null; });
  760. dropdownFilters.forEach(function (filter, i) {
  761. filter.valid(element, function (val) {
  762. if (!val) chose[i] = [];
  763. else if (val.constructor !== Array) chose[i] = [{ 'filter': filter, 'val': val }];
  764. else chose[i] = val.map(function (val) { return { 'filter': filter, 'val': val }; });
  765. if (chose.filter(function (x) { return !x; }).length) return;
  766. var chosen = chose.reduce(function (x, y) { return x.concat(y); });
  767. console.log('chose: %o', chosen);
  768. if (chosen.length) {
  769. var dialog = fastFilterDialog(chosen);
  770. call(function () { dialog.show(); });
  771. }
  772. });
  773. });
  774. };
  775. var init = function () {
  776. // 拖放到的框
  777. dropArea = cewih('div', html.dropArea).firstChild;
  778. var active = false, target = null;
  779. content = dropArea.querySelector('#yawf-drop-area-content');
  780. document.body.appendChild(dropArea);
  781. var hideDropArea = function () {
  782. if (target && target.hover) target.hover(); target = null;
  783. dropArea.style.display = 'none';
  784. };
  785. // 只接受从微博拽过来的东西
  786. var checkTarget = function () {
  787. var checker = target;
  788. for (var checker = target; checker && checker !== document; checker = checker.parentNode) {
  789. if (!checker.classList || !checker.classList.contains || !checker.tagName) continue;
  790. if (checker.classList.contains('WB_feed')) return true;
  791. if (checker.classList.contains('W_miniblog')) return false;
  792. if (checker.tagName.toLowerCase() === 'body') return true;
  793. }
  794. return false;
  795. };
  796. // 开始拽
  797. document.addEventListener('dragstart', function (e) {
  798. var cover = document.querySelector('body>div[node-type="outer"]');
  799. if (cover && cover.clientHeight) return;
  800. target = e.explicitOriginalTarget; if (target && !checkTarget()) return;
  801. active = true;
  802. dropArea.style.display = 'block';
  803. }, false);
  804. // 拽完了
  805. document.addEventListener('dragend', function (e) {
  806. console.log('dragend! %o', e);
  807. if (!active) return; active = false;
  808. e.preventDefault(); e.stopPropagation();
  809. if (content.firstChild === content.lastChild) got(content.firstChild);
  810. else got(content);
  811. content.innerHTML = '';
  812. hideDropArea();
  813. }, false);
  814. // 拽出去了
  815. document.addEventListener('mouseout', function (e) {
  816. if (!active) return; active = false;
  817. hideDropArea();
  818. });
  819. };
  820. var add = function (details) {
  821. dropdownFilters.push(details);
  822. };
  823. return {
  824. 'init': init,
  825. 'add': add,
  826. }
  827. }());
  828.  
  829. var bindInputValue = function (input, obj, attr, standlize) {
  830. var onchange = function () {
  831. var val = input.value, valid;
  832. if (standlize) valid = standlize(val); else valid = val;
  833. if (String(valid) !== val) input.value = valid;
  834. obj['putconf' + attr](valid);
  835. };
  836. input.value = obj['getconf' + attr]();
  837. input.addEventListener('change', onchange);
  838. return onchange;
  839. };
  840.  
  841. // 告诉服务器屏蔽被隐藏的微博
  842. var blockWeibo = (function () {
  843. var buffer = [], busy = false;
  844. var delay = function () { return 3000 + Math.round(20 * Math.random()) * 100; };
  845. var block = function (mid, callback) {
  846. var done = function () { setTimeout(callback, delay()); };
  847. debug('blocking weibo %s', mid);
  848. GM_xmlhttpRequest({
  849. 'method': 'POST',
  850. 'url': fillStr(url.block_wb, { 'rnd': dateStr() }),
  851. 'headers': {
  852. 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  853. 'Cache-Control': 'no-cache',
  854. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
  855. 'Cookie': document.cookie,
  856. 'Referer': location.href,
  857. 'X-Requested-With': 'XMLHttpRequest',
  858. },
  859. 'data': 'filter_type=0&mid=' + mid + '&justhide=0&location=home&_t=0',
  860. 'onload': function (resp) { debug('block %s response: %s', mid, resp.responseText); done(); },
  861. 'onerror': function () { debug('block %s network error', mid); done(); },
  862. });
  863. };
  864. var active = function () {
  865. if (!(busy = !!buffer.length)) return;
  866. var mid = buffer.shift();
  867. block(mid, active);
  868. };
  869. return function (mid) {
  870. buffer.push(mid);
  871. if (!busy) active();
  872. return mid;
  873. };
  874. }());
  875.  
  876. // 检查是否有新的节点
  877. var newNode = (function () {
  878. var callbacks = [], actived = false;
  879. var callAll = function (mutation) {
  880. callbacks.forEach(function (c) { c(mutation); });
  881. };
  882. var observe = function () {
  883. callAll();
  884. (new MutationObserver(function (mutations) {
  885. mutations.forEach(function (mutation) { callAll(mutation); });
  886. })).observe(document.body, { 'childList': true, 'subtree': true });
  887. };
  888. var add = function (callback) {
  889. callbacks.push(withTry(callback));
  890. return callback;
  891. };
  892. var remove = function (callback) {
  893. var found = false;
  894. callbacks = callbacks.filter(function (x) {
  895. if (x === callback) return found = true; return false;
  896. });
  897. };
  898. var active = function () {
  899. if (actived) return;
  900. actived = true;
  901. observe();
  902. };
  903. return {
  904. 'add': add,
  905. 'remove': remove,
  906. 'active': active,
  907. };
  908. }());
  909.  
  910. // 添加点击后展开折叠消息的事件
  911. var fixFoldWeibo = (function () {
  912. var fixOne = withTry(function (feed) {
  913. var display = feed.getAttribute('yawf-display').replace(/fold$/g, 'unfold');
  914. var showFeed = function () {
  915. feed.setAttribute('yawf-display', display);
  916. feed.removeEventListener('click', showFeed);
  917. };
  918. var author = feed.querySelector('.WB_name[usercard]').getAttribute('title');
  919. feed.setAttribute('yawf-author', author);
  920. feed.addEventListener('click', showFeed);
  921. });
  922. var fix = function (feed) {
  923. var feeds = [feed].concat(Array.apply(Array, feed.querySelectorAll('.WB_feed_type')));
  924. feeds.forEach(function (feed) {
  925. if (feed.getAttribute('yawf-display').lastIndexOf('-fold') === -1) return;
  926. if (feed.getAttribute('yawf-author')) return;
  927. fixOne(feed);
  928. });
  929. };
  930. fix.init = function () {
  931. css.add(fillStr('[node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"]::before { content: {{foldedWeiboText}}; }'));
  932. };
  933. return fix;
  934. }());
  935.  
  936. var swapParentSonWeibo = function (parent, son) {
  937. var x = cewih('div', '');
  938. ['.WB_face', '.WB_info', '.WB_text', '.WB_func'].map(function (q) {
  939. (function (a, b) {
  940. b.parentNode.replaceChild(x, b);
  941. a.parentNode.replaceChild(b, a);
  942. x.parentNode.replaceChild(a, x);
  943. }(parent.querySelector(q), son.querySelector(q)));
  944. });
  945. var mid = parent.getAttribute('mid');
  946. parent.setAttribute('mid', son.getAttribute('mid'));
  947. son.setAttribute('mid', mid);
  948. // 各种细节的修补(原网站做的太乱了……)
  949. var pf = parent.querySelector('.WB_face'), sf = son.querySelector('.WB_face');
  950. var pfa = pf.querySelector('a'), pfi = pf.querySelector('img');
  951. var sfa = sf.querySelector('a'), sfi = sf.querySelector('img');
  952. if (pfa.href.indexOf('?') === -1) pfa.href += '?from=feed&loc=avatar';
  953. if (sfa.href.indexOf('?') !== -1) sfa.href = sfa.href.slice(0, sfa.href.indexOf('?'));
  954. if (!pfa.title) pfa.title = pfi.title;
  955. if (sfa.title) sfa.removeAttribute('title');
  956. sfi.width = sfi.height = '30'; pfi.width = pfi.height = '50';
  957. return son;
  958. };
  959.  
  960. // 如果有一个微博的子微博都隐藏了,那么就隐藏这个微博的子微博框
  961. var fixSonWeiboDisplay = function (feed) {
  962. if (!feed.querySelector('.WB_feed_together')) return fixFoldWeibo(feed);
  963. var sonList = Array.apply(Array, feed.querySelectorAll('.WB_feed_together .WB_sonFeed .WB_feed_type[yawf-display]'));
  964. // 交换两个子微博
  965. var swapSon = function (p, q) {
  966. var x = sonList[p], y = sonList[q];
  967. var fakeNode = document.createElement('div');
  968. x.parentNode.insertBefore(fakeNode, x);
  969. y.parentNode.insertBefore(x, y);
  970. fakeNode.parentNode.insertBefore(y, fakeNode);
  971. fakeNode.parentNode.removeChild(fakeNode);
  972. sonList[p] = y; sonList[q] = x;
  973. };
  974. // 把子微博重新排序一下,按照从想看到不想看的顺序排列,排序算法和一趟快排差不多
  975. var p = 0, q;
  976. ['show', 'unset', 'unfold', 'fold', 'hidden'].forEach(function (display) {
  977. q = sonList.length - 1;
  978. while (p < q) {
  979. if (sonList[p].getAttribute('yawf-display').lastIndexOf(display) !== -1) p++;
  980. else if (sonList[q].getAttribute('yawf-display').lastIndexOf(display) === -1) q--;
  981. else swapSon(p, q);
  982. }
  983. });
  984. // 看看还有多少显示出来的子微博,更新一下子微博的计数
  985. var sonCount = feed.querySelectorAll('.WB_feed_together .WB_sonFeed .WB_feed_type:not([yawf-display$="-hidden"])').length;
  986. if (sonCount === 0) feed.querySelector('.WB_feed_together').setAttribute('yawf-display', 'display-hidden');
  987. else feed.querySelector('[node-type="followNum"]').textContent = sonCount;
  988. // 如果下面更多的按钮已经没用了,就藏起来吧
  989. var foldSonCount = feed.querySelectorAll('[node-type="feed_list_wrapForward"] .WB_feed_type:not([yawf-display$="-hidden"])').length;
  990. if (foldSonCount === 0 && feed.querySelector('[node-type="feed_list_wrapForward"]')) {
  991. feed.querySelector('.WB_feed_together').setAttribute('yawf-sonfold', 'display');
  992. }
  993. // 把原始微博和子微博拆开
  994. var another = feed.cloneNode(true);
  995. feed.parentNode.insertBefore(another, feed.nextSibling);
  996. feed.setAttribute('yawf-withson', 'son');
  997. another.setAttribute('yawf-display', 'display-son');
  998. fixFoldWeibo(feed);
  999. fixFoldWeibo(another);
  1000. };
  1001.  
  1002. // 真正微博过滤的核心模块
  1003. var weiboFilter = function () {
  1004. var feeds = Array.apply(Array,
  1005. document.querySelectorAll('[node-type="feed_list"] .WB_feed_type:not([yawf-display])'));
  1006. feeds.forEach(function (feed) {
  1007. // 同源合并的微博
  1008. var sonFeeds = Array.apply(Array, feed.querySelectorAll('[node-type="feed_list"] .WB_feed_type:not([yawf-display])'));
  1009. var action = null, parentAction = null;
  1010. var needSwap = function (action) {
  1011. if (!sonFeeds.length) return false;
  1012. if (['hidden', 'fold'].indexOf(action) === -1) return false;
  1013. return true;
  1014. };
  1015. var setAction = function (feed, action) {
  1016. feed.setAttribute('yawf-display', 'display-' + action);
  1017. };
  1018. while (true) {
  1019. action = rules.parse(feed) || 'unset';
  1020. // 如果父微博被屏蔽或折叠,那么就把下面一条没被屏蔽的拉上来换个位置
  1021. if (!needSwap(action)) break;
  1022. setAction(swapParentSonWeibo(feed, sonFeeds.pop()), action);
  1023. }
  1024. parentAction = action;
  1025. // 最后处理所有下面的子微博
  1026. var fixSonWeibo = function (son) {
  1027. var action = rules.parse(son) || 'unset';
  1028. setAction(son, action);
  1029. // 如果一列里面有白名单的,那么把白名单的特别换到外面去
  1030. if (parentAction !== 'show' && action === 'show') {
  1031. setAction(swapParentSonWeibo(feed, son), parentAction);
  1032. parentAction = action;
  1033. }
  1034. };
  1035. while (sonFeeds.length) fixSonWeibo(sonFeeds.shift());
  1036. setAction(feed, parentAction);
  1037. fixSonWeiboDisplay(feed);
  1038. });
  1039. return feeds;
  1040. };
  1041.  
  1042. var addWeiboFilterListener = (function () {
  1043. var listeners = [];
  1044. // 逐条进行过滤
  1045. newNode.add(function () {
  1046. var feeds = weiboFilter();
  1047. feeds.forEach(function (feed) {
  1048. listeners.forEach(function (f) { f(feed); });
  1049. });
  1050. });
  1051. return function (callback) {
  1052. listeners.push(withTry(callback));
  1053. };
  1054. }());
  1055.  
  1056. var typedConfig = (function () {
  1057. var inits = [];
  1058. // 字符串
  1059. var baseConfig = function (type) {
  1060. return function (key) {
  1061. return function (item) {
  1062. var skey = item.key + (key ? '.' + key : key);
  1063. if (!item['getconf' + key]) item['getconf' + key] = function () {
  1064. return item['conf' + key] = config.get(skey, item['default' + key] || type(), type);
  1065. };
  1066. if (!item['putconf' + key]) item['putconf' + key] = function (conf) {
  1067. return config.put(skey, item['conf' + key] = conf);
  1068. };
  1069. inits.push(function () {
  1070. config.reg(skey);
  1071. item['putconf' + key](item['getconf' + key]());
  1072. });
  1073. };
  1074. };
  1075. };
  1076. // 集合类型的add/del操作
  1077. var itemsConfig = function (key) {
  1078. return function (item) {
  1079. baseConfig(Array)(key)(item);
  1080. if (!item['delconf' + key]) item['delconf' + key] = function (str) {
  1081. var val = item['getconf' + key]();
  1082. val = val.filter(function (x) { return x !== str; });
  1083. return item['putconf' + key](val)
  1084. };
  1085. if (!item['addconf' + key]) item['addconf' + key] = function (str) {
  1086. item['delconf' + key](str);
  1087. var val = item['getconf' + key](); val.push(str);
  1088. return item['putconf' + key](val)
  1089. };
  1090. };
  1091. };
  1092. var init = function () {
  1093. while (inits.length) inits.shift()();
  1094. };
  1095. init.string = baseConfig(String);
  1096. init.strings = itemsConfig;
  1097. init.boolean = baseConfig(Boolean);
  1098. init.users = itemsConfig;
  1099. init.number = baseConfig(Number);
  1100. return init;
  1101. }());
  1102.  
  1103. // 根据不同类型生成带有事件的文档节点
  1104. var typedHtml = (function () {
  1105. // 副标题
  1106. var subtitle = function (item) {
  1107. return cewih('div', fillStr(html.configSubtitle, item)).firstChild;
  1108. };
  1109.  
  1110. // 文本
  1111. var text = function (item) {
  1112. return cewih('div', fillStr(html.configText, item)).firstChild;
  1113. };
  1114.  
  1115. // 不缩进的文本
  1116. var remark = function (item) {
  1117. return cewih('div', fillStr(html.configRemark, item)).firstChild;
  1118. };
  1119.  
  1120. // 真假值的设置项
  1121. var boolean = function (item) {
  1122. var dom = cewih('div', fillStr(html.configBoolean, item)).firstChild;
  1123. var input = dom.querySelector('input');
  1124. input.checked = item.getconf();
  1125. input.addEventListener('change', function () {
  1126. item.putconf(input.checked);
  1127. });
  1128. return dom;
  1129. };
  1130.  
  1131. // 字符串的设置项
  1132. var string = function (item) {
  1133. var dom = cewih('div', fillStr(html.configString, item)).firstChild;
  1134. var textarea = dom.querySelector('textarea');
  1135. textarea.value = item.getconf();
  1136. textarea.addEventListener('change', function () { item.putconf(textarea.value); });
  1137. textarea.addEventListener('keypress', function () { item.putconf(textarea.value); });
  1138. return dom;
  1139. };
  1140.  
  1141. // 字符串数组设置项模板
  1142. var items = function (base, genli, item) {
  1143. var dom = cewih('div', fillStr(base, item)).firstChild;
  1144. var form = dom.querySelector('form'), input = dom.querySelector('input'), ul = dom.querySelector('ul');
  1145. var shown = {};
  1146. // 将某个已经有的字符串显示到末尾
  1147. var moveToEnd = function (x) {
  1148. var p = x.parentNode; p.appendChild(p.removeChild(x));
  1149. };
  1150. // 显示一个新的字符串
  1151. var showStrings = function (userinput, str, onsucc, ondone) {
  1152. genli(item, userinput, str, function (str, li) {
  1153. if (ondone) ondone();
  1154. if (!str || !li) return;
  1155. if (shown[str]) return moveToEnd(shown[str]);
  1156. var del = li.querySelector('a.icon_close');
  1157. del.addEventListener('click', function () {
  1158. delete shown[str];
  1159. if (item.del) item.del(str);
  1160. li.parentNode.removeChild(li);
  1161. item.delconf(str);
  1162. });
  1163. ul.appendChild(shown[str] = li);
  1164. if (onsucc) onsucc(str);
  1165. });
  1166. };
  1167. item.getconf().forEach(function (str) { showStrings(false, str); });
  1168. form.addEventListener('submit', function (e) {
  1169. e.preventDefault();
  1170. var str = input.value;
  1171. input.disabled = true;
  1172. showStrings(true, str, function (str) {
  1173. item.addconf(str);
  1174. }, function () {
  1175. input.value = '';
  1176. input.disabled = false;
  1177. });
  1178. });
  1179. return dom;
  1180. };
  1181.  
  1182. // 字符串设置项
  1183. var strings = items.bind(null, html.configStrings, function (item, userinput, str, callback) {
  1184. if (userinput && item.add && !(str = item.add(str))) callback();
  1185. else callback(str, cewih('ul', fillStr(html.configStringsItem, { 'item': item.display ? item.display(str) : str })).firstChild);
  1186. });
  1187.  
  1188. // 用户列表的设置项
  1189. var users = items.bind(null, html.configUsers, function (item, userinput, str, callback) {
  1190. var showUserNotExistError = function () {
  1191. Alert('yawf-user-not-exist', {
  1192. 'title': fillStr('{{accountNotExistErrorTitle}}'),
  1193. 'text': fillStr('{{{accountNotExistError}}}', { 'name': escapeXml(str) }),
  1194. 'icon': 'error'
  1195. });
  1196. callback();
  1197. };
  1198. if (userinput) {
  1199. if (!(str = str.trim().replace(/^@/, ''))) return callback();
  1200. account.name(str, function (info) {
  1201. if (!info) showUserNotExistError();
  1202. else if (item.add && !item.add(info)) callback();
  1203. else callback(info.id, cewih('ul', fillStr(html.configUsersItem, info)).firstChild);
  1204. }, showUserNotExistError);
  1205. } else {
  1206. var emptyInfo = { 'id': str, 'name': ' ', 'avatar': ' ' };
  1207. var li = cewih('ul', fillStr(html.configUsersItem, emptyInfo)).firstChild;
  1208. callback(str, li);
  1209. account.id(str, function (info) {
  1210. var u = li.querySelector('[uid]');
  1211. u.setAttribute('uid', info.id); u.setAttribute('title', info.name); u.textContent = info.name;
  1212. var p = li.querySelector('.pic img');
  1213. p.src = info.avatar;
  1214. });
  1215. }
  1216. });
  1217.  
  1218. return {
  1219. 'subtitle': subtitle,
  1220. 'text': text,
  1221. 'remark': remark,
  1222. 'string': string,
  1223. 'strings': strings,
  1224. 'boolean': boolean,
  1225. 'users': users,
  1226. };
  1227. }());
  1228.  
  1229. // 过滤器组
  1230. var filterGroup = function (groupName) {
  1231. var items = [];
  1232. // 向过滤器组里面添加一个项目
  1233. var add = function (item) {
  1234. items.push(item);
  1235. try {
  1236. if (item.type && typedConfig[item.type])
  1237. typedConfig[item.type]('')(item);
  1238. if (item.keys) Object.keys(item.keys).forEach(function (key) {
  1239. if (typedConfig[item.keys[key]]) typedConfig[item.keys[key]](key)(item);
  1240. });
  1241. } catch (e) { }
  1242. return item;
  1243. };
  1244. // 网页被初始化时初始化所有过滤器
  1245. var init = function () {
  1246. items.forEach(withTry(function (item) {
  1247. if (item.init) item.init();
  1248. if (item.rule) rules.add(item.priority || 0, item.rule.bind(item));
  1249. }));
  1250. };
  1251. // 需要显示选项时生成界面
  1252. var show = function (inner) {
  1253. items.forEach(withTry(function (item) {
  1254. var dom = null;
  1255. if (item.show) dom = item.show(dom);
  1256. else if (item.type && typedHtml[item.type])
  1257. dom = typedHtml[item.type](item);
  1258. if (dom && item.shown) item.shown(dom);
  1259. if (dom) inner.appendChild(dom);
  1260. }));
  1261. };
  1262. // 注册到过滤器分组
  1263. var group = {
  1264. 'name': groupName,
  1265. 'show': show,
  1266. 'init': init,
  1267. 'add': add
  1268. };
  1269. return filters.add(group);
  1270. };
  1271.  
  1272. // 当前是查看分组的页面吗?
  1273. var onGroupPage = function () {
  1274. return location.pathname.slice(-9) === '/mygroups';
  1275. };
  1276.  
  1277. // 白名单、黑名单和折叠名单一式三份
  1278. var allInOneFilters = function (details) {
  1279. var filters = [
  1280. { 'type': 'whitelist', 'priority': 1e5, 'action': 'show' },
  1281. { 'type': 'blacklist', 'priority': 0, 'action': 'hidden' },
  1282. { 'type': 'foldlist', 'priority': -1e5, 'action': 'fold' },
  1283. ];
  1284. var rules = {};
  1285. var typedFilterGroup = filterGroup(details.name + 'FilterGroup');
  1286. filters.forEach(function (filter) {
  1287. typedFilterGroup.add({
  1288. 'type': 'subtitle',
  1289. 'text': '{{{' + filter.type + 'FilterDesc}}}',
  1290. 'typed': '{{' + details.name + 'FilterDetails}}',
  1291. 'shown': function (dom) {
  1292. dom.classList.add('yawf-' + filter.type + 'FilterTitle');
  1293. },
  1294. });
  1295. var rule = {
  1296. 'type': details.type || 'strings',
  1297. 'key': 'weibo.filters.' + details.name + '.' + filter.type,
  1298. 'priority': filter.priority,
  1299. 'text': '{{' + details.name + 'FilterDesc}}',
  1300. };
  1301. if (details.add) rule.add = details.add.bind(rule);
  1302. if (details.display) rule.display = details.display.bind(rule);
  1303. rule.rule = details.rule.bind(rule, filter.action);
  1304. if (details[filter.type]) {
  1305. Object.keys(details[filter.type]).forEach(function (override) {
  1306. rule[override] = details[filter.type][override](rule[override]);
  1307. });
  1308. }
  1309. rules[filter.type] = typedFilterGroup.add(rule);
  1310. });
  1311. if (details.fast) {
  1312. dropdown.add({
  1313. 'valid': details.fast.valid,
  1314. 'desc': details.fast.desc,
  1315. 'add': function (val, action) {
  1316. rules[action].addconf(details.fast.add(val));
  1317. },
  1318. });
  1319. }
  1320. return typedFilterGroup;
  1321. };
  1322.  
  1323. // 方便的选择器
  1324. var weiboContentSelector = function (feed, f) {
  1325. var content = feed.querySelector('[node-type="feed_list_content"]');
  1326. var reason = feed.querySelector('[node-type="feed_list_reason"] em');
  1327. var items = [];
  1328. if (content) items = items.concat(Array.apply(Array, f(content)));
  1329. if (reason) items = items.concat(Array.apply(Array, f(reason)));
  1330. return items;
  1331. };
  1332.  
  1333. // 关键字过滤
  1334. var keywordFilterGroup = allInOneFilters({
  1335. 'name': 'keyword',
  1336. 'add': function (s) { return s.trim(); },
  1337. 'rule': function keywordMatch(action, feed) {
  1338. var keywords = this.conf;
  1339. var texts = weiboContentSelector(feed, function (m) {
  1340. return Array.apply(Array, m.childNodes)
  1341. .filter(function (node) { return node.nodeType === Node.TEXT_NODE; })
  1342. .map(function (node) { return node.textContent; });
  1343. }).join(' ').toUpperCase();
  1344. var match = keywords.some(function (keyword) {
  1345. if (!keyword) return false;
  1346. return texts.indexOf(keyword.toUpperCase()) !== -1;
  1347. });
  1348. if (match) return action; else return null;
  1349. },
  1350. 'fast': {
  1351. 'valid': function (element, callback) {
  1352. var valid = false;
  1353. if (element.nodeType === Node.TEXT_NODE) valid = true;
  1354. else if ((element.tagName || '').toLowerCase() === 'em' &&
  1355. element.firstChild === element.lastChild &&
  1356. element.firstChild.nodeType === Node.TEXT_NODE) valid = true;
  1357. if (valid) callback({ 'text': element.textContent }); else callback();
  1358. },
  1359. 'desc': function (val) {
  1360. return fillStr('{{{keywordFilterFast}}}', { 'text': escapeXml(val.text) });
  1361. },
  1362. 'add': function (val) { return val.text; },
  1363. }
  1364. });
  1365.  
  1366. // 按照正则式过滤
  1367. var regexpFilterGroup = allInOneFilters({
  1368. 'name': 'regexp',
  1369. 'add': function (s) {
  1370. s = s.trim();
  1371. if (s[0] === '/' && s[s.length - 1] === '/') s = s.slice(1, -1);
  1372. try { RegExp(s).exec(''); } catch (e) {
  1373. Alert('yawf-regexp-bad-formed', {
  1374. 'title': fillStr('{{regexpBadFormedTitle}}'),
  1375. 'text': fillStr('{{{regexpBadFormed}}}', { 'regexp': escapeXml(s) }),
  1376. 'icon': 'error'
  1377. });
  1378. s = null;
  1379. }
  1380. return s;
  1381. },
  1382. 'display': function (s) { return '/' + s + '/'; },
  1383. 'rule': function regexpMatch(action, feed) {
  1384. if (!this.regexen) this.regexen = this.conf.map(function (s) {
  1385. try { return RegExp(s); }
  1386. catch (e) { debug('erorr while compile regexp %s : %o', s, e); }
  1387. }).filter(function (x) { return x; });
  1388. var regexen = this.regexen;
  1389. var texts = weiboContentSelector(feed, function (m) {
  1390. return Array.apply(Array, m.childNodes)
  1391. .filter(function (node) { return node.nodeType === Node.TEXT_NODE; })
  1392. .map(function (node) { return node.textContent; });
  1393. }).join(' ');
  1394. var match = regexen.some(function (regexp) {
  1395. return !!(regexp.exec(texts));
  1396. });
  1397. if (match) return action; else return null;
  1398. },
  1399. });
  1400.  
  1401. regexpFilterGroup.add({
  1402. 'type': 'text',
  1403. 'text': '{{regexpFilterRemark}}',
  1404. });
  1405.  
  1406. // 从一条微博中找到他的作者
  1407. var getFeedAuthorId = function (feed) {
  1408. var author = feed.querySelector('.WB_name[usercard]');
  1409. if (!author) return null;
  1410. return author.getAttribute('usercard').split('=')[1];
  1411. };
  1412.  
  1413. // 检查一个元素是不是用户相关的
  1414. var validUserElement = function (element, callback) {
  1415. var user = null;
  1416. if (element.nodeType === Node.TEXT_NODE) return callback();
  1417. var a = null;
  1418. // 作者或来源
  1419. try {
  1420. if (element.classList.contains('WB_name')) a = element;
  1421. else a = element.querySelector('.WB_name');
  1422. if (a && (a.getAttribute('usercard') || '').indexOf('id=') === 0) {
  1423. return callback({
  1424. 'name': a.getAttribute('title'),
  1425. 'id': a.getAttribute('usercard').slice(3),
  1426. });
  1427. }
  1428. } catch (e) {}
  1429. // 提及
  1430. try {
  1431. if (element.getAttribute('usercard')) a = element;
  1432. else a = element.querySelector('[usercard]');
  1433. if (a && (a.getAttribute('usercard') || '').indexOf('name=') === 0) {
  1434. return account.name(a.getAttribute('usercard').slice(5), callback, callback);
  1435. }
  1436. } catch (e) {}
  1437. // 其他
  1438. try {
  1439. if (element.getAttribute('title') && element.getAttribute('uid')) a = element;
  1440. else if (element.getAttribute('title') && element.getAttribute('usercard').indexOf('id=') === 0) a = element;
  1441. else a = element.querySelector('[title][uid], [title][usercard^="id="]');
  1442. if (a) {
  1443. return callback({
  1444. 'name': a.getAttribute('title'),
  1445. 'id': a.getAttribute('uid') || a.getAttribute('usercard').slice(3),
  1446. });
  1447. }
  1448. } catch (e) { }
  1449. callback();
  1450. };
  1451.  
  1452. // 作者用户过滤
  1453. var accountFilterGroup = allInOneFilters({
  1454. 'name': 'account',
  1455. 'type': 'users',
  1456. 'rule': function accountMatch(action, feed) {
  1457. var accounts = this.conf, id = getFeedAuthorId(feed);
  1458. if (!id) return null;
  1459. var match = accounts.some(function (x) { return x === id; });
  1460. if (match) return action; else return null;
  1461. },
  1462. 'blacklist': {
  1463. 'rule': function accountMatchBlacklistOverride(_super) {
  1464. return function accountMatchBlacklist(feed) {
  1465. if (!accountByGroup.conf || !onGroupPage()) return _super(feed);
  1466. return null;
  1467. };
  1468. },
  1469. },
  1470. 'fast': {
  1471. 'valid': validUserElement,
  1472. 'desc': function (val) {
  1473. return fillStr('{{{accountFilterFast}}}', { 'name': escapeXml(val.name) });
  1474. },
  1475. 'add': function (val) { return val.id; },
  1476. },
  1477. });
  1478.  
  1479. accountFilterGroup.add({
  1480. 'type': 'text',
  1481. 'text': '{{accountFilterRemark}}',
  1482. });
  1483.  
  1484.  
  1485. // 从一条微博中找到他的作者
  1486. var getFeedOriginalId = function (feed) {
  1487. var originalAuthor = feed.querySelector('.WB_media_expand .WB_info .WB_name');
  1488. if (!originalAuthor) return null;
  1489. return originalAuthor.getAttribute('usercard').split('=')[1];
  1490. };
  1491.  
  1492. // 原创用户过滤
  1493. var originalFilterGroup = allInOneFilters({
  1494. 'name': 'original',
  1495. 'type': 'users',
  1496. 'rule': function originalMatch(action, feed) {
  1497. var originals = this.conf, id = getFeedOriginalId(feed);
  1498. if (!id) return null;
  1499. var match = originals.some(function (x) { return x === id; });
  1500. if (match) return action; else return null;
  1501. },
  1502. 'fast': {
  1503. 'valid': validUserElement,
  1504. 'desc': function (val) {
  1505. return fillStr('{{{originalFilterFast}}}', { 'name': escapeXml(val.name) });
  1506. },
  1507. 'add': function (val) { return val.id; },
  1508. },
  1509. });
  1510.  
  1511. // 找到在一条微博里面被提到的人的昵称
  1512. var getFeedMentionList = function (feed) {
  1513. return weiboContentSelector(feed, function (m) {
  1514. return Array.apply(Array, m.querySelectorAll('a[usercard^="name="][href$="loc=at"]'));
  1515. }).map(function (link) {
  1516. return link.getAttribute('usercard').slice('name='.length);
  1517. });
  1518. };
  1519.  
  1520. // 提到某人的微博
  1521. var mentionFilterGroup = allInOneFilters({
  1522. 'name': 'mention',
  1523. 'type': 'strings',
  1524. 'add': function (s) { return s.trim().replace(/^@/, ''); },
  1525. 'display': function (s) { return '@' + s; },
  1526. 'rule': function mentionMatch(action, feed) {
  1527. var mentions = this.conf, users = getFeedMentionList(feed);
  1528. var match = users.some(function (name) {
  1529. return mentions.indexOf(name) !== -1;
  1530. });
  1531. if (match) return action; else return null;
  1532. },
  1533. 'fast': {
  1534. 'valid': validUserElement,
  1535. 'desc': function (val) {
  1536. return fillStr('{{{mentionFilterFast}}}', { 'name': escapeXml(val.name) });
  1537. },
  1538. 'add': function (val) { return val.name; },
  1539. },
  1540. });
  1541.  
  1542. var getFeedTopicList = function (feed) {
  1543. return weiboContentSelector(feed, function (m) {
  1544. return Array.apply(Array, m.querySelectorAll('.a_topic'));
  1545. }).map(function (topic) { return topic.textContent; });
  1546. };
  1547.  
  1548. // 话题过滤
  1549. var topicFilterGroup = allInOneFilters({
  1550. 'name': 'topic',
  1551. 'add': function (s) { return s.trim().replace(/#/g, ''); },
  1552. 'display': function (s) { return '#' + s + '#'; },
  1553. 'rule': function topicMatch(action, feed) {
  1554. var topics = this.conf;
  1555. var text = getFeedTopicList(feed).join('##');
  1556. var match = topics.some(function (topic) { return text.indexOf(topic) !== -1; });
  1557. if (match) return action; else return null;
  1558. },
  1559. 'fast': {
  1560. 'valid': function (element, callback) {
  1561. var a = null;
  1562. if (element.nodeType === Node.TEXT_NODE) return callback();
  1563. try {
  1564. if (element.tagName.toLowerCase() === 'a' && element.classList.contains('a_topic')) a = element;
  1565. else a = element.querySelector('a.a_topic');
  1566. if (a) return callback({ 'topic': a.textContent.trim().replace(/#/g, '') });
  1567. } catch (e) { }
  1568. callback();
  1569. },
  1570. 'desc': function (val) {
  1571. return fillStr('{{{topicFilterFast}}}', { 'topic': escapeXml(val.topic) });
  1572. },
  1573. 'add': function (val) { return val.topic; },
  1574. }
  1575. });
  1576.  
  1577. // 获取一条微博的所有来源(包括转发)
  1578. var getFeedSourceList = function (feed) {
  1579. return ['[node-type="feed_list_funcLink"] [action-type="app_source"]',
  1580. '.WB_media_expand [action-type="app_source"]'].map(function (qs) {
  1581. var st = feed.querySelector(qs); if (!st) return null;
  1582. return st.getAttribute('title') || st.textContent || '未通过审核应用';
  1583. }).filter(function (x) { return x; });
  1584. };
  1585.  
  1586. // 来源过滤
  1587. var sourceFilterGroup = allInOneFilters({
  1588. 'name': 'source',
  1589. 'add': function (s) {
  1590. s = s.trim();
  1591. if (s === '微博 weibo.com') {
  1592. Alert('yawf-source-filter-warning', {
  1593. 'title': fillStr('{{sourceFilterWarningTitle}}'),
  1594. 'text': fillStr('{{sourceFilterWarning}}'),
  1595. 'icon': 'error'
  1596. });
  1597. s = null;
  1598. }
  1599. return s;
  1600. },
  1601. 'rule': function sourceMatch(action, feed) {
  1602. var sources = this.conf, _sources = getFeedSourceList(feed);
  1603. var match = _sources.some(function (s) { return sources.indexOf(s) !== -1; })
  1604. if (match) return action; else return null;
  1605. },
  1606. 'fast': {
  1607. 'valid': function (element, callback) {
  1608. var a = null;
  1609. if (element.nodeType === Node.TEXT_NODE) return callback();
  1610. try {
  1611. if (element.getAttribute('action-type') === 'app_source') a = element;
  1612. else a = element.querySelector('[action-type="app_source"]');
  1613. if (a) {
  1614. var source = a.getAttribute('title') || a.textContent || '未通过审核应用';
  1615. if (source && source !== '微博 weibo.com') return callback({ 'source': source });
  1616. }
  1617. } catch (e) { console.log('%o: %o', e, e.stack); }
  1618. callback();
  1619. },
  1620. 'desc': function (val) {
  1621. return fillStr('{{{sourceFilterFast}}}', { 'source': escapeXml(val.source) });
  1622. },
  1623. 'add': function (val) { return val.source; },
  1624. }
  1625. });
  1626.  
  1627. var getFeedHyperlinkList = function (feed) {
  1628. return Array.apply(Array, feed.querySelectorAll('a[title][href^="http://t.cn/"]')).map(function (a) {
  1629. return a.getAttribute('title');
  1630. });
  1631. };
  1632.  
  1633. // 超链接过滤
  1634. var hyperlinkFilterGroup = allInOneFilters({
  1635. 'name': 'hyperlink',
  1636. 'add': function (s) { return s.trim(); },
  1637. 'rule': function hyperlinkMatch(action, feed) {
  1638. var links = this.conf, _links = getFeedHyperlinkList(feed);
  1639. var match = _links.some(function (l) {
  1640. return links.some(function (link) {
  1641. return l.indexOf(link) !== -1;
  1642. });
  1643. });
  1644. if (match) return action; else return null;
  1645. },
  1646. 'fast': {
  1647. 'valid': function (element, callback) {
  1648. if (element.nodeType === Node.TEXT_NODE) return callback();
  1649. try {
  1650. if (element.tagName.toLowerCase() === 'a' &&
  1651. element.getAttribute('title') &&
  1652. element.getAttribute('href').indexOf('http://t.cn/') === 0) a = element;
  1653. else a = element.querySelector('a[title][href^="http://t.cn/"]');
  1654. if (a) {
  1655. var x = document.createElement('a'); x.href = a.getAttribute('title');
  1656. if (x.host !== 'weibo.com') return callback({ 'host': x.host });
  1657. }
  1658. } catch (e) { }
  1659. callback();
  1660. },
  1661. 'desc': function (val) {
  1662. return fillStr('{{{hyperlinkFilterFast}}}', { 'host': escapeXml(val.host) });
  1663. },
  1664. 'add': function (val) { return val.host; },
  1665. },
  1666. });
  1667.  
  1668. var otherFilterGroup = filterGroup('otherFilterGroup');
  1669.  
  1670. otherFilterGroup.add({
  1671. 'type': 'subtitle',
  1672. 'text': '{{otherWhitelistTitle}}'
  1673. });
  1674.  
  1675. // 总是显示自己的微博
  1676. otherFilterGroup.add({
  1677. 'type': 'boolean',
  1678. 'key': 'weibo.other.my_weibo',
  1679. 'text': '{{showMyWeiboDesc}}',
  1680. 'priority': 1e5 - 1e3, // 略低于白名单,但高于其他
  1681. 'rule': function showMyWeiboRule(feed) {
  1682. if (!this.conf) return;
  1683. if (getFeedAuthorId(feed) === config.uid) return 'showme'; else return null;
  1684. },
  1685. });
  1686.  
  1687. // 总是显示自己原创的微博
  1688. otherFilterGroup.add({
  1689. 'type': 'boolean',
  1690. 'key': 'weibo.other.my_original',
  1691. 'text': '{{showMyOriginalDesc}}',
  1692. 'priority': 1e5 - 1e3, // 略低于白名单,但高于其他
  1693. 'rule': function showMyOriginalRule(feed) {
  1694. if (!this.conf) return;
  1695. if (getFeedOriginalId(feed) === config.uid) return 'showme'; else return null;
  1696. },
  1697. });
  1698.  
  1699. // 总是显示自己原创的微博
  1700. otherFilterGroup.add({
  1701. 'type': 'boolean',
  1702. 'key': 'weibo.other.mention_me',
  1703. 'text': '{{showMentionMeDesc}}',
  1704. 'priority': 1e5 - 1e3, // 略低于白名单,但高于其他
  1705. 'rule': function showMentionMeRule(feed) {
  1706. if (!this.conf) return;
  1707. if (getFeedMentionList(feed).indexOf(config.uid) !== -1) return 'showme'; else return null;
  1708. },
  1709. });
  1710.  
  1711. otherFilterGroup.add({
  1712. 'type': 'subtitle',
  1713. 'text': '{{otherBlacklistTitle}}'
  1714. });
  1715.  
  1716. // 推广微博
  1717. otherFilterGroup.add({
  1718. 'type': 'boolean',
  1719. 'key': 'weibo.other.ad_feed',
  1720. 'text': '{{adfeedFilterDesc}}',
  1721. 'rule': function adFeedFilterRule(feed) {
  1722. if (!this.conf) return null;
  1723. return feed.getAttribute('feedtype') === 'ad' ? 'hidden' : null;
  1724. },
  1725. });
  1726.  
  1727. // 关注推荐微博
  1728. otherFilterGroup.add({
  1729. 'type': 'boolean',
  1730. 'key': 'weibo.other.fake_weibo',
  1731. 'text': '{{fakeWeiboFilterDesc}}',
  1732. 'rule': function fakeWeiboFilterRule(feed) {
  1733. if (!this.conf) return null;
  1734. if (!feed.getAttribute('mid')) return 'hidden';
  1735. return null;
  1736. },
  1737. });
  1738.  
  1739. // 已删除或没有权限查看的微博的转发
  1740. otherFilterGroup.add({
  1741. 'type': 'boolean',
  1742. 'key': 'weibo.other.deleted_forward',
  1743. 'text': '{{deletedForwardFilterDesc}}',
  1744. 'rule': function deletedForwardFilterRule(feed) {
  1745. if (!this.conf) return null;
  1746. if (feed.getAttribute('isforward') === '1' &&
  1747. !feed.querySelector('.WB_media_expand .WB_info .WB_name')) return 'hidden';
  1748. return null;
  1749. },
  1750. });
  1751.  
  1752. // 投票微博
  1753. otherFilterGroup.add({
  1754. 'type': 'boolean',
  1755. 'key': 'weibo.other.vote_weibo',
  1756. 'text': '{{voteWeiboFilterDesc}}',
  1757. 'rule': function voteWeiboFilterRule(feed) {
  1758. if (!this.conf) return null;
  1759. if (feed.querySelector('.WB_from a[href^="http://vote.weibo.com/"]'))
  1760. return 'hidden';
  1761. return null;
  1762. },
  1763. });
  1764.  
  1765. otherFilterGroup.add({
  1766. 'type': 'subtitle',
  1767. 'text': '{{otherSpammingTitle}}',
  1768. });
  1769.  
  1770. // 添加数量和折叠/隐藏的
  1771. var lotShown = function (dom) {
  1772. var nl = cewih('label', fillStr(text.sameNumberOptionDesc, { 'number': html.numberInput }));
  1773. var sl = cewih('label', fillStr(text.sameActionOptionDesc, {
  1774. 'select': html.select,
  1775. 'options': fillStr(html.option, { 'value': 'fold', 'text': '{{foldlistActionDesc}}' }) +
  1776. fillStr(html.option, { 'value': 'hidden', 'text': '{{blacklistActionDesc}}' }),
  1777. }));
  1778. var n = nl.querySelector('input'), s = sl.querySelector('select');
  1779. n.setAttribute('min', '1');
  1780. bindInputValue(n, this, 'number', function (val) {
  1781. if (isNaN(val)) val = 1; else val = parseInt(val);
  1782. return Math.max(val, 1);
  1783. });
  1784. bindInputValue(s, this, 'action');
  1785. dom.appendChild(nl); dom.appendChild(sl);
  1786. };
  1787.  
  1788. // 相同账号的过多微博
  1789. otherFilterGroup.add({
  1790. 'type': 'boolean',
  1791. 'priority': -1e6, // 低优先级
  1792. 'key': 'weibo.other.same_account',
  1793. 'keys': { 'number': 'number', 'action': 'string' },
  1794. 'defaultnumber': 5,
  1795. 'defaultaction': 'fold',
  1796. 'text': '{{sameAccountFilterDesc}}',
  1797. 'shown': lotShown,
  1798. 'rule': function sameAccountRule(feed) {
  1799. if (!this.conf) return null;
  1800. if (sameAccountByGroup.conf && onGroupPage()) return null;
  1801. var author = feed.querySelector('.WB_name[usercard]');
  1802. if (!author) return null;
  1803. var id = author.getAttribute('usercard').split('=')[1];
  1804. var number = document.querySelectorAll('[node-type="feed_list"] ' +
  1805. '.WB_feed_type[yawf-display]:not([yawf-display$="-fold"]):not([yawf-display$="-unfold"]):not([yawf-display$="-hidden"])' +
  1806. '>.WB_feed_datail>.WB_detail>.WB_info>a.WB_name[usercard="id=' + id + '"]').length;
  1807. if (number >= this.confnumber) return 'account-' + this.confaction; else return null;
  1808. },
  1809. });
  1810.  
  1811. // 相同微博的过多转发
  1812. otherFilterGroup.add({
  1813. 'type': 'boolean',
  1814. 'priority': -1e6, // 低优先级
  1815. 'key': 'weibo.other.same_forward',
  1816. 'keys': { 'number': 'number', 'action': 'string' },
  1817. 'defaultnumber': 3,
  1818. 'defaultaction': 'fold',
  1819. 'text': '{{sameForwardFilterDesc}}',
  1820. 'shown': lotShown,
  1821. 'rule': function sameForwardRule(feed) {
  1822. if (!this.conf) return null;
  1823. var omid = feed.getAttribute('omid');
  1824. if (!omid) return null;
  1825. var number = document.querySelectorAll('[node-type="feed_list"] ' +
  1826. '.WB_feed_type[omid="' + omid + '"][yawf-display]:not([yawf-display$="-fold"]):not([yawf-display$="-unfold"]):not([yawf-display$="-hidden"])').length;
  1827. if (number >= this.confnumber) return 'forward-' + this.confaction; else return null;
  1828. },
  1829. });
  1830.  
  1831. // 分组浏览
  1832. otherFilterGroup.add({
  1833. 'type': 'subtitle',
  1834. 'text': '{{otherGroupTitle}}',
  1835. });
  1836.  
  1837. // 分组浏览不做按帐号隐藏
  1838. var accountByGroup = otherFilterGroup.add({
  1839. 'type': 'boolean',
  1840. 'key': 'weibo.other.group_account',
  1841. 'text': '{{accountByGroup}}',
  1842. });
  1843.  
  1844. // 分组浏览不做刷屏检查
  1845. var sameAccountByGroup = otherFilterGroup.add({
  1846. 'type': 'boolean',
  1847. 'key': 'weibo.other.group_same_account',
  1848. 'text': '{{sameAccountByGroup}}',
  1849. });
  1850.  
  1851. var layoutFilterGroup = filterGroup('layoutFilterGroup');
  1852.  
  1853. layoutFilterGroup.add({
  1854. 'type': 'subtitle',
  1855. 'text': '{{layoutFilterGroupDesc}}',
  1856. });
  1857.  
  1858. // 大部分选择器参考了 眼不见心不烦 脚本
  1859. var layouts = (function () {
  1860. var current = null;
  1861. var subtitle = function (name) {
  1862. layoutFilterGroup.add({
  1863. 'type': 'subtitle',
  1864. 'text': '{{layoutHide' + name + '}}',
  1865. });
  1866. current = name;
  1867. };
  1868.  
  1869. var item = function (name, cssText, defaultValue) {
  1870. layoutFilterGroup.add({
  1871. 'type': 'boolean',
  1872. 'key': 'weibo.layoutHide' + current + name,
  1873. 'default': defaultValue || false,
  1874. 'text': '{{layoutHide' + current + name + '}}',
  1875. 'init': css(cssText),
  1876. });
  1877. };
  1878.  
  1879. subtitle('Icon');
  1880. item('Level', '.icon_bed[node-type="level"] { display: none !important; }');
  1881. item('Member', '.W_ico16[class*="ico_member"], .ico_member_dis { display: none !important; }');
  1882. item('Approve', '.approve { display: none !important; }');
  1883. item('ApproveCo', '.approve_co { display: none !important; }');
  1884. item('Club', '.ico_club { display: none !important; }');
  1885. item('VGirl', '.ico_vlady { display: none !important; }');
  1886. item('Taobao', '.ico_taobao { display: none !important; }');
  1887.  
  1888. subtitle('Nav');
  1889. item('Main', '.gn_nav>div:nth-child(1) { display: none !important; }');
  1890. item('Hot', '.gn_nav>div:nth-child(2) { display: none !important; }');
  1891. item('App', '.gn_nav>div:nth-child(3) { display: none !important; }');
  1892. item('Game', '.gn_nav>div:nth-child(4) { display: none !important; }');
  1893. item('Member', '.gn_setting[node-type="member"] { display: none !important; }');
  1894.  
  1895. subtitle('Left');
  1896. item('ToMe', '#pl_leftnav_common a[href^="/direct/tome"] { display: none !important; }');
  1897. 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; }');
  1898. item('App', '#pl_leftnav_app { display: none !important; }');
  1899.  
  1900. subtitle('Middle');
  1901. item('MemberTip', '[node-type="feed_list_shieldKeyword"] { display: none !important; }');
  1902. item('RecommendedTopic', '#pl_content_publisherTop div[node-type="recommendTopic"] { display: none !important; }');
  1903.  
  1904. subtitle('Right');
  1905. item('Whole', '.B_profile .W_main_c, .B_profile .WB_feed .repeat .input textarea { width: 100% } .B_profile .WB_feed .WB_screen { margin-left: 928px } .B_profile .W_main_2r { display: none !important; }');
  1906. item('Template', '.templete_enter { display: none !important; }');
  1907. item('Info', '.W_person_info { display: none !important; }');
  1908. item('Atten', '#pl_rightmod_myinfo .user_atten { display: none !important; }');
  1909. item('Trial', '#trustPagelet_checkin_lotteryv5 { display: none !important; }');
  1910. item('Interest', '[yawf-id="rightmod_recom_interest"] { display: none !important; }');
  1911. item('HotTopic', '[yawf-id="rightmod_zt_hottopic"] { display: none !important; }');
  1912. item('Member', '#trustPagelet_recom_memberv5 { display: none !important; }');
  1913. item('Weibo', '[yawf-id="rightmod_recom_weibo"] { display: none !important; }');
  1914. item('Location', '[yawf-id="rightmod_recom_location"] { display: none !important; }');
  1915. item('Music', '[yawf-id="rightmod_recom_music"] { display: none !important; }');
  1916. item('Movie', '[yawf-id="rightmod_recom_movie"] { display: none !important; }');
  1917. item('Book', '[yawf-id="rightmod_recom_book"] { display: none !important; }');
  1918. item('Notice', '#pl_rightmod_noticeboard { display: none !important; }');
  1919.  
  1920. subtitle('Weibo');
  1921. item('RecomFeed', '[node-type="feed_list_recommend"] { display: none !important; }');
  1922. item('TopicCard', '.WB_feed_spec[exp-data*="value=1022-topic"] { display: none !important; }');
  1923. item('LocationCard', '.WB_feed_spec[exp-data*="value=1022-place"] { display: none !important; }');
  1924. item('FeedTip', '[node-type="feed_privateset_tip"] { display: none !important; }');
  1925.  
  1926. subtitle('Person');
  1927. item('Cover', funcStr(function () { /* !CSS
  1928. .S_profile_pic { display: none; }
  1929. .profile_top { margin-top: 20px; }
  1930. .profile_top .pf_head { top: 5px; margin-top: 0 !important; }
  1931. .profile_top .pf_head_pic { height: 120px; width: 120px; float: right; }
  1932. .profile_top .pf_head_pic img { height: 120px; }
  1933. .profile_top .pf_head .user_atten { width: 60px; float: left; height: 120px; }
  1934. .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; }
  1935. .profile_top .pf_head .user_atten li strong { margin: 3px 0 0; }
  1936. */ }));
  1937. item('BadgeIcon', '.pf_badge_icon { display: none !important; }');
  1938. item('Stats', '.profile_top .user_atten { display: none !important; } .profile_top .pf_head { margin-top: 51px; } ');
  1939. item('MyData', '.W_main_c [id^="Pl_Official_MyMicroworld__"] { display: none !important; }');
  1940. item('Group', '.W_main_2r [id^="Pl_Core_RightGroupsBtn__"] { display: none !important; }');
  1941. item('SuggestUser', '.W_main_2r [id^="Pl_Core_RightUserList__"] { display: none !important; }');
  1942. item('Relation', '.W_main_2r [id^="Pl_Core_RightUserGrid__"] { display: none !important; }');
  1943. item('Album', '.W_main_2r [id^="Pl_Core_RightPicMulti__"] { display: none !important; }'); // FIXME
  1944. item('HotTopic', '.W_main_2r [id^="Pl_Core_RightTextSingle__"] { display: none !important; }');
  1945. item('HotWeibo', '.W_main_2r [id^="Pl_Core_RightPicText__"] { display: none !important; }');
  1946.  
  1947. subtitle('Other');
  1948. 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; }');
  1949. item('FeedRecom', '.W_main_2r [id^="Pl_Third_Inline__"] { display: none !important; }');
  1950. item('Footer', '.global_footer { display: none !important; }');
  1951. item('WbIm', '.WBIM_news { display: none !important; }');
  1952. item('Tip', '.layer_tips { display: none !important; }');
  1953.  
  1954. var tagRightbarMods = function () {
  1955. var mods = document.querySelectorAll('#trustPagelet_indexright_recom .WB_right_module:not([yawf-id])');
  1956. if (!mods) return;
  1957. var identifiers = {
  1958. '.right_content.hot_topic': 'rightmod_zt_hottopic',
  1959. '.right_content.person_list': 'rightmod_recom_interest',
  1960. '[change-data*="key=index_weibo"]': 'rightmod_recom_weibo',
  1961. '[change-data*="key=index_LBS"]': 'rightmod_recom_location',
  1962. '[change-data*="key=index_song"]': 'rightmod_recom_music',
  1963. '[change-data*="key=index_mov"]': 'rightmod_recom_movie',
  1964. '[change-data*="key=index_book"]': 'rightmod_recom_book'
  1965. };
  1966. Array.apply(Array, mods).forEach(function (mod) {
  1967. Object.keys(identifiers).forEach(function (qs) {
  1968. if (mod.querySelector(qs)) mod.setAttribute('yawf-id', identifiers[qs]);
  1969. });
  1970. });
  1971. };
  1972.  
  1973. newNode.add(tagRightbarMods);
  1974. tagRightbarMods();
  1975. css.add('.W_miniblog { visibility: visible !important; }');
  1976.  
  1977. }());
  1978.  
  1979. // 改造设置
  1980. var toolFilterGroup = filterGroup('toolFilterGroup');
  1981.  
  1982. // 快速创建过滤器
  1983. toolFilterGroup.add({
  1984. 'type': 'boolean',
  1985. 'key': 'weibo.tool.use_fast_creator',
  1986. 'default': true,
  1987. 'text': '{{useFastCreator}}',
  1988. 'init': function () {
  1989. if (!this.conf) return;
  1990. dropdown.init();
  1991. },
  1992. });
  1993.  
  1994. // 清除发布框中的默认话题 (wcf)
  1995. toolFilterGroup.add({
  1996. 'type': 'boolean',
  1997. 'key': 'weibo.tool.clear_def_topic',
  1998. 'text': '{{clearDefTopicDesc}}',
  1999. 'init': function () {
  2000. if (!this.conf) return;
  2001. var clearDefTopic = function () {
  2002. var inputBox = document.querySelector('#pl_content_publisherTop .send_weibo .input textarea');
  2003. if (inputBox && inputBox.hasAttribute('hottopic')) {
  2004. inputBox.removeAttribute('hottopic'); inputBox.removeAttribute('hottopicid');
  2005. inputBox.value = 'DUMMY'; inputBox.focus();
  2006. inputBox.value = ''; inputBox.blur();
  2007. }
  2008. };
  2009. newNode.add(clearDefTopic);
  2010. },
  2011. });
  2012.  
  2013. // 展开左栏分组
  2014. toolFilterGroup.add({
  2015. 'type': 'boolean',
  2016. 'key': 'weibo.tool.noFloatNav',
  2017. 'text': '{{noFloatNav}}',
  2018. 'init': css('.WB_global_nav { position: absolute !important; }'),
  2019. });
  2020.  
  2021. // 展开左栏分组
  2022. toolFilterGroup.add({
  2023. 'type': 'boolean',
  2024. 'key': 'weibo.tool.showAllGroup',
  2025. 'text': '{{showAllGroupDesc}}',
  2026. 'init': css('#pl_leftnav_group div[node-type="moreList"] { display: block !important } #pl_leftnav_group > div[node-type="groupList"] > .level_2_Box > .levmore { display: none }'),
  2027. });
  2028.  
  2029. // 展开左栏消息
  2030. toolFilterGroup.add({
  2031. 'type': 'boolean',
  2032. 'key': 'weibo.tool.showAllMsgNav',
  2033. 'text': '{{showAllMsgNavDesc}}',
  2034. 'init': css('#pl_leftnav_common > .level_1_Box > .lev2_new { display: block !important }'),
  2035. });
  2036.  
  2037. // 微博作者与正文同行
  2038. toolFilterGroup.add({
  2039. 'type': 'boolean',
  2040. 'key': 'weibo.tool.unwrapText',
  2041. 'text': '{{unwrapTextDesc}}',
  2042. 'init': 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 }'),
  2043. });
  2044.  
  2045. // 个人主页自动打开微博列表
  2046. toolFilterGroup.add({
  2047. 'type': 'boolean',
  2048. 'key': 'weibo.tool.redirectWeibo',
  2049. 'text': '{{personalRedirectWeibo}}',
  2050. 'init': function () {
  2051. if (!this.conf) return;
  2052. var locat = unsafeWindow.$CONFIG.location;
  2053. if (locat.slice(-5) !== '_home') return;
  2054. if (!document.body.classList.contains('B_profile')) return;
  2055. var from = (location.search.match(/from=([^&]*)/) || {})[1];
  2056. if (locat.indexOf(from) === 0) return;
  2057. var redirect = function () {
  2058. var link = document.querySelector('.PRF_tab_noicon li.pftb_itm a[href*="/weibo?"]'); if (!link) return;
  2059. if (!link) return false;
  2060. newNode.remove(redirect);
  2061. location.replace(link.href);
  2062. };
  2063. newNode.add(redirect);
  2064. redirect();
  2065. },
  2066. });
  2067.  
  2068. // 查看大图旁添加查看原图链接
  2069. toolFilterGroup.add({
  2070. 'type': 'boolean',
  2071. 'default': true,
  2072. 'key': 'weibo.tool.viewOriginal',
  2073. 'text': '{{viewOriginalDesc}}',
  2074. 'init': function () {
  2075. if (!this.conf) return;
  2076. var addOriLink = function () {
  2077. var a = document.querySelector('a.show_big[action-data]:not([yawf-viewori])');
  2078. if (!a) return; a.setAttribute('yawf-viewori', 'yawf-viewori');
  2079. var arg = a.getAttribute('action-data').match(/pid=(\w+)&mid=(\d+)&uid=(\d+)/);
  2080. if (!arg) return;
  2081. var vol = cewih('div', fillStr(html.viewOriginalLink)), l = vol.firstChild;
  2082. var img = fillStr(url.view_ori, { 'uid': arg[3], 'mid': arg[2], 'pid': arg[1] });
  2083. while (vol.firstChild) a.parentNode.insertBefore(vol.firstChild, a);
  2084. if (0) GM_xmlhttpRequest({
  2085. 'method': 'GET',
  2086. 'url': img,
  2087. 'onload': function (resp) {
  2088. var h = (new DOMParser()).parseFromString(resp.responseText, 'text/html');
  2089. l.href = h.querySelector('#pic').src;
  2090. },
  2091. }); l.href = img;
  2092. };
  2093. newNode.add(addOriLink);
  2094. },
  2095. });
  2096.  
  2097. // 屏蔽隐藏微博
  2098. toolFilterGroup.add({
  2099. 'type': 'boolean',
  2100. 'key': 'weibo.tool.block_hidden',
  2101. 'text': '{{blockHiddenWeiboDesc}}',
  2102. 'init': function () {
  2103. if (!this.conf) return;
  2104. addWeiboFilterListener(function (feed) {
  2105. [feed].concat(Array.apply(Array, feed.querySelectorAll('.WB_feed_type'))).forEach(function (feed) {
  2106. var display = feed.getAttribute('yawf-display');
  2107. if (display !== 'display-hidden') return;
  2108. if (!feed.getAttribute('mid')) return;
  2109. blockWeibo(feed.getAttribute('mid'));
  2110. feed.setAttribute('yawf-block', 'block');
  2111. });
  2112. });
  2113. }
  2114. });
  2115.  
  2116. // 显示一个透明度设置框
  2117. var genTransparencyInput = function (binder) {
  2118. var l = cewih('label', fillStr(text.transparencyInput, { 'number': html.transparencyInput }));
  2119. var n = l.querySelector('input[type="number"]'), r = l.querySelector('input[type="range"]');
  2120. var onchange = binder(n, function (val) {
  2121. if (isNaN(parseInt(val))) return 0;
  2122. return Math.min(Math.max(parseInt(val), 0), 100);
  2123. });
  2124. r.value = n.value;
  2125. var updateN = function () { if (r.value !== n.value) n.value = r.value; onchange(); };
  2126. var updateR = function () { if (r.value !== n.value) r.value = n.value; onchange(); };
  2127. r.addEventListener('change', updateN); r.addEventListener('mousemove', updateN);
  2128. n.addEventListener('change', updateR); n.addEventListener('keypress', updateR);
  2129. return l;
  2130. };
  2131.  
  2132. // 显示一个颜色&透明度设置框
  2133. var genColorWithTransparencyInput = function (binder1, binder2) {
  2134. var color = cewih('label', html.colorInput);
  2135. var c = color.querySelector('input[type="color"]');
  2136. binder1(c);
  2137. var transparency = genTransparencyInput(binder2);
  2138. return [color, transparency];
  2139. };
  2140.  
  2141. // 将颜色和透明度转换为一个表示颜色的字符串
  2142. var colorStr = function (color, transparency) {
  2143. return 'rgba(' + color.slice(1)
  2144. .split(/(..)/).filter(function (x) { return x; })
  2145. .map(function (x) { return parseInt(x, 16); }).join(',') +
  2146. ',' + (100 - transparency) / 100 + ')';
  2147. };
  2148.  
  2149. // 一个带有颜色/透明度的选框项
  2150. var coloredConfigItem = function (details) {
  2151. var conf = {
  2152. 'type': 'boolean',
  2153. 'key': details.key,
  2154. 'keys': { 'color': 'string', 'transparency': 'number', 'blur': 'boolean' },
  2155. 'defaultcolor': details.defaultcolor,
  2156. 'defaulttransparency': details.defaulttransparency,
  2157. 'text': details.text,
  2158. 'shown': function (dom) {
  2159. var elements = genColorWithTransparencyInput(function (c, s) {
  2160. bindInputValue(c, this, 'color', s);
  2161. }.bind(this), function (t, s) {
  2162. return bindInputValue(t, this, 'transparency', s);
  2163. }.bind(this));
  2164. elements.forEach(dom.appendChild.bind(dom));
  2165. },
  2166. 'init': function () {
  2167. if (!this.conf) return;
  2168. details.init(colorStr(this.confcolor, this.conftransparency));
  2169. },
  2170. };
  2171. return conf;
  2172. };
  2173.  
  2174. // 高亮显示白名单微博
  2175. toolFilterGroup.add(coloredConfigItem({
  2176. 'key': 'weibo.tool.whitelist_highlight',
  2177. 'defaultcolor': '#fef3da',
  2178. 'text': '{{whitelistHighlightDesc}}',
  2179. 'init': function (color) {
  2180. css.add(fillStr(funcStr(function () { /*
  2181. [node-type="feed_list"] .WB_feed_type[yawf-display$="-show"] { background-color: {{color}} !important; box-shadow: -20px 0 0 {{color}}, 20px 0 0 {{color}}; }
  2182. [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}}; }
  2183. */ }), { 'color': color }));
  2184. },
  2185. }));
  2186.  
  2187. // 首页背景
  2188. toolFilterGroup.add(coloredConfigItem({
  2189. 'key': 'weibo.tool.my_background_color',
  2190. 'defaultcolor': '#ffffff',
  2191. 'defaulttransparency': 30,
  2192. 'text': '{{mainBackgroundColorOverride}}',
  2193. 'init': function (color) {
  2194. css.add(fillStr(funcStr(function () { /*
  2195. body:not(.S_profile) .W_main { background-image: none !important; background-color: {{color}} !important }
  2196. body:not(.S_profile) .S_bg4, body:not(.S_profile) .W_main_a, body:not(.S_profile) .W_main_bg { background: transparent !important; }
  2197. */ }), { 'color': color }));
  2198. },
  2199. }));
  2200.  
  2201. // 个人主页背景
  2202. toolFilterGroup.add(coloredConfigItem({
  2203. 'key': 'weibo.tool.other_background_color',
  2204. 'defaultcolor': '#ffffff',
  2205. 'defaulttransparency': 30,
  2206. 'text': '{{profileBackgroundColorOverride}}',
  2207. 'init': function (color) {
  2208. css.add(fillStr(funcStr(function () { /*
  2209. .S_profile .W_profile_bg, .S_profile .S_bg5 { background-color: {{color}} !important; }
  2210. .S_profile .S_bg4:not(.W_profile_bg) { background: none transparent !important }
  2211. */ }), { 'color': color }));
  2212. },
  2213. }));
  2214.  
  2215.  
  2216. // 自定义样式
  2217. toolFilterGroup.add({
  2218. 'type': 'string',
  2219. 'text': '{{userstyleTitle}}',
  2220. 'key': 'weibo.tool.userstyle',
  2221. 'init': function () {
  2222. var conf = this.conf; GM_addStyle(conf);
  2223. var set = this.putconf.bind(this);
  2224. var putconf = function (css) {
  2225. conf = css;
  2226. setTimeout(function () { set(css); config.write(); location.reload(); }, 0);
  2227. };
  2228. GM_registerMenuCommand(fillStr('{{userstyleEditDesc}}'), function () {
  2229. var newcss = prompt(fillStr('{{userstyleEditDetails}}'), conf);
  2230. if (newcss !== null) putconf(newcss);
  2231. }, "S");
  2232. },
  2233. });
  2234.  
  2235.  
  2236. // 脚本设置
  2237. var scriptFilterGroup = filterGroup('scriptFilterGroup');
  2238.  
  2239. // 导入导出
  2240. scriptFilterGroup.add({
  2241. 'type': 'subtitle',
  2242. 'text': '{{configImportAndExport}}',
  2243. });
  2244.  
  2245. scriptFilterGroup.add({
  2246. 'show': function () {
  2247. var dom = cewih('div', html.configImportExport).firstChild;
  2248. var bii = dom.querySelector('input[type="file"]');
  2249. var be = dom.querySelector('[node-type="export"]');
  2250. var br = dom.querySelector('[node-type="reset"]');
  2251. // 导出按钮
  2252. var updateExportButton = function () {
  2253. be.href = 'data:application/octet-stream;base64,' +
  2254. btoa(unescape(encodeURIComponent(config.export())));
  2255. be.setAttribute('download', 'yawf-config.yawf');
  2256. };
  2257. // 导入按钮
  2258. var doImport = function (file) {
  2259. var reader = new FileReader();
  2260. var success = function () {
  2261. Alert('yawf-config-import-success', {
  2262. 'title': fillStr('{{configImportSuccessTitle}}'),
  2263. 'text': fillStr('{{configImportSuccess}}'),
  2264. 'icon': 'succ'
  2265. });
  2266. };
  2267. var error = function () {
  2268. Alert('yawf-config-import-fail', {
  2269. 'title': fillStr('{{configImportFailTitle}}'),
  2270. 'text': fillStr('{{configImportFail}}'),
  2271. 'icon': 'error'
  2272. });
  2273. };
  2274. if (file.size > (1 << 24)) error();
  2275. else reader.addEventListener('load', function () {
  2276. if (config.import(reader.result)) {
  2277. updateExportButton();
  2278. success();
  2279. } else error();
  2280. });
  2281. reader.readAsText(file);
  2282. bii.value = '';
  2283. };
  2284. bii.addEventListener('change', function () {
  2285. var file = bii.files[0];
  2286. Confirm('yawf-config-import-warning', {
  2287. 'title': fillStr('{{configImportWarningTitle}}'),
  2288. 'text': fillStr('{{configImportWarning}}'),
  2289. 'onOk': function () { doImport(file); },
  2290. });
  2291. });
  2292. updateExportButton();
  2293. // 重置按钮
  2294. var doReset = function () {
  2295. config.clear();
  2296. updateExportButton();
  2297. };
  2298. br.addEventListener('click', function () {
  2299. Confirm('yawf-config-reset-warning', {
  2300. 'title': fillStr('{{configResetWarningTitle}}'),
  2301. 'text': fillStr('{{configResetWarning}}'),
  2302. 'onOk': doReset,
  2303. });
  2304. });
  2305. return dom;
  2306. },
  2307. });
  2308.  
  2309. // 调试
  2310. scriptFilterGroup.add({
  2311. 'type': 'subtitle',
  2312. 'text': '{{scriptDebugTitle}}',
  2313. });
  2314.  
  2315. scriptFilterGroup.add({
  2316. 'show': function () {
  2317. var dom = cewih('div', fillStr(html.configBoolean, { 'key': 'debug', 'text': '{{scriptDebug}}' })).firstChild;
  2318. var input = dom.querySelector('input');
  2319. input.checked = !!GM_getValue('debug', false);
  2320. input.addEventListener('change', function () {
  2321. GM_setValue('debug', !GM_getValue('debug', false));
  2322. });
  2323. return dom;
  2324. }
  2325. });
  2326.  
  2327. // 关于
  2328. scriptFilterGroup.add({
  2329. 'type': 'subtitle',
  2330. 'text': '{{scriptAboutTitle}}',
  2331. });
  2332.  
  2333. scriptFilterGroup.add({
  2334. 'type': 'text', 'text': '',
  2335. 'shown': function (dom) {
  2336. dom.innerHTML = fillStr(text.scriptAbout, {
  2337. 'version': ((GM_info || {}).script || {}).version || '?'
  2338. });
  2339. },
  2340. });
  2341.  
  2342. scriptFilterGroup.add({
  2343. 'init': function () {
  2344. var isEn = i18n.lang === 'en';
  2345. css.add(fillStr(funcStr(function () { /*!CSS
  2346. .profile_tab .pftb_lk { padding-left: {{headerWidth}}; padding-right: {{headerWidth}}; }
  2347. .profile_tab .current.pftb_lk { padding-left: {{headerWidth2}}; padding-right: {{headerWidth2}}; }
  2348. .layoutFilterGroupLayer .yawf-configBoolean { width: {{layoutOptionWidth}}; }
  2349. */ }), {
  2350. 'headerWidth': isEn ? '12px' : '15px',
  2351. 'headerWidth2': isEn ? '9px' : '12px',
  2352. 'layoutOptionWidth': isEn ? '320px' : '160px',
  2353. }));
  2354. },
  2355. });
  2356.  
  2357. // 检查是否要在本页上运行
  2358. var validPage = function () {
  2359. if (self !== top) return false;
  2360. if (!unsafeWindow.$CONFIG.uid) return false;
  2361. if (!unsafeWindow.$CONFIG.lang) return false;
  2362. return true;
  2363. };
  2364.  
  2365. // 完成加载时
  2366. var dcl = function () {
  2367. if (!validPage()) return;
  2368. // 初始化用户语言
  2369. i18n.setLang(unsafeWindow.$CONFIG.lang);
  2370. // 加载用户配置
  2371. config = config(unsafeWindow.$CONFIG.uid);
  2372. typedConfig();
  2373. // 初始化文本和网页数据(基于用户选择的语言)
  2374. Object.keys(text).map(function (key) { i18n(text[key]); text[key] = text[key].local; });
  2375. Object.keys(html).map(function (key) { html[key] = fillStr(html[key]); });
  2376. // 初始化所有过滤器
  2377. filters.init();
  2378. // 初始化折叠微博
  2379. fixFoldWeibo.init();
  2380. // 注册样式
  2381. css.init();
  2382. // 初始化界面
  2383. showIcon();
  2384. // 开始过滤
  2385. newNode.active();
  2386. };
  2387. if (document.body) call(dcl);
  2388. else document.addEventListener('DOMContentLoaded', dcl);
  2389.  
  2390. GM_addStyle(fillStr((funcStr(function () { /*!CSS
  2391. // 在顶部添加按钮
  2392. .gn_setting[node-type="member"]:last-child { margin-right: 44px; }
  2393. .WB_global_nav .gn_setting .gn_tab.gn_filter .ico { background-image: url("{{filter-img}}"); !important; background-position: 0 0 !important; }
  2394. .WB_global_nav .gn_search { width: 210px !important; left: 440px !important; position: absolute !important; }
  2395. .WB_global_nav .gn_search .gn_input { width: 168px !important; }
  2396. // 设置框相关样式
  2397. .yawf-Layer.yawf-drag { opacity: 0.67; -moz-user-select: none; user-select: none; }
  2398. #yawf-config [node-type="inner"] { padding: 20px; }
  2399. .yawf-config-body { margin: -20px; max-height: 360px; overflow-y: auto; padding: 20px; width: 760px; }
  2400. #yawf-config .profile_tab { font-size: 12px; margin: -20px -20px 20px; width: 800px; }
  2401. .yawf-config-layer { padding-bottom: 20px; }
  2402. .yawf-groupSubtitle, .yawf-groupRemark { margin: 5px 10px; padding: 10px 0 0 0; }
  2403. .yawf-groupSubtitle { font-weight: bold; }
  2404. .yawf-configItem, .yawf-groupText { margin: 5px 20px; padding: 5px 0; }
  2405. .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; }
  2406. .yawf-whitelistFilterTitle::before { background: #37c837; box-shadow: 0 0 2px #37c837; }
  2407. .yawf-blacklistFilterTitle::before { background: #c83737; box-shadow: 0 0 2px #c83737; }
  2408. .yawf-foldlistFilterTitle::before { background: #c8c837; box-shadow: 0 0 2px #c8c837; }
  2409. .yawf-configString span { line-height: 16px; padding: 2px 10px; margin-bottom: -20px; display: block; width: calc(100% - 20px); position: relative; }
  2410. .yawf-configString textarea.W_input { width: calc(100% - 20px); padding-top: 20px; min-height: 80px; resize: vertical; }
  2411. .yawf-configStringsInput, .yawf-configUsersInput { margin: 5px; }
  2412. .yawf-configStringsItems, .yawf-configUsersItems { padding: 5px 10px; }
  2413. .yawf-configStringsItem, .yawf-configUsersItem { display: inline-block; margin: 2px; }
  2414. .yawf-configStringsItem a.icon_close, .yawf-configUsersItem a.icon_close { margin-left: 3px; vertical-align: -2px; }
  2415. .yawf-configUsersItem .shield_object_card { display: inline-block; }
  2416. .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; }
  2417. .yawf-configUsersItem .shield_object_card .card_pic { float: left; width: 50px; }
  2418. .yawf-configUsersItem .shield_object_card .card_pic .pic_box { display: block; }
  2419. .yawf-configUsersItem .shield_object_card .card_content { margin-left: 60px; }
  2420. .yawf-configUsersItem .shield_object_card .object_info { height: 22px; margin-top: 2px; }
  2421. .yawf-configUsersItem .shield_object_card .object_name { line-height: 22px; overflow: hidden; }
  2422. .yawf-configUsersItem .shield_object_card .other_info { line-height: 24px; }
  2423. .yawf-configImportExport [node-type] { margin-right: 20px; }
  2424. .yawf-configAdd { appearance: none; }
  2425. #yawf-config .btn { border-top: 1px solid #ccc; margin: 15px 0 0; padding: 10px 0 0; }
  2426. #yawf-config .btn .W_btn_b_disable:hover { border-color: #d9d9d9; }
  2427. #yawf-config .btn .W_btn_b_disable:hover span { border-color: #ffffff; }
  2428. .layoutFilterGroupLayer .yawf-configBoolean { display: inline-block; margin-right: 0; }
  2429. // 隐藏微博
  2430. [yawf-display$="-hidden"] { display: none !important; }
  2431. [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; }
  2432. // 折叠微博
  2433. [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; }
  2434. [node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"] { height: 45px; overflow: hidden; cursor: pointer; }
  2435. [node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"] .WB_screen { margin-top: -40px !important; }
  2436. [node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"] .WB_feed_datail { display: none !important; }
  2437. // 子微博
  2438. [node-type="feed_list"] .WB_feed_type[yawf-display$="-hidden"]+.WB_feed_type[yawf-display$="-son"],
  2439. [node-type="feed_list"] .WB_feed_type[yawf-display$="-fold"]+.WB_feed_type[yawf-display$="-son"] { display: none !important; }
  2440. [node-type="feed_list"] .WB_feed_type:not([yawf-display$="-son"]) .WB_feed_together { display: none !important; }
  2441. [node-type="feed_list"] .WB_feed_type[yawf-withson="son"] .WB_feed_datail,
  2442. [node-type="feed_list"] .WB_feed_type[yawf-withson="son"][yawf-display$="-fold"]::before { border: 0 none !important; }
  2443. [node-type="feed_list"] .WB_feed_type[yawf-display$="-son"] { padding-top: 0 !important; }
  2444. [node-type="feed_list"] .WB_feed_type[yawf-display$="-son"]>.WB_screen,
  2445. [node-type="feed_list"] .WB_feed_type[yawf-display$="-son"]>.WB_feed_datail>.WB_face,
  2446. [node-type="feed_list"] .WB_feed_type[yawf-display$="-son"]>.WB_feed_datail>.WB_detail>*:not(.WB_feed_together) { display: none !important; }
  2447. [node-type="feed_list"] .WB_feed_type[yawf-display$="-son"]>.WB_feed_datail>.WB_detail { margin-top: -20px; margin-bottom: -10px; }
  2448. // 其他
  2449. .WB_feed_together .wft_users { display: none; }
  2450. .WB_feed_together[yawf-sonfold="display"] [node-type="feed_list_wrapForward"] { display: block !important; }
  2451. .WB_feed_together[yawf-sonfold="display"] [action-type="feed_list_seeAll"],
  2452. .WB_feed_together[yawf-sonfold="display"] [action-type="feed_list_foldForward"] { display: none !important; }
  2453. .W_miniblog { visibility: hidden; }
  2454. input[type="number"]:not(:focus) ~ .yawf-transparency-range:not(:hover) > input[type="range"]:not(:focus) { display: none; }
  2455. // 拖拽
  2456. #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; }
  2457. .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; }
  2458. .yawf-drop-area-title { font-size: 150%; font-weight: bold; }
  2459. .yawf-drop-area-text { padding: 10px; }
  2460. #yawf-drop-area-content { height: 230px; width: 230px; position: relative; z-index: 10002; opacity: 0; }
  2461. #yawf-fast-filter-chose { padding: 20px 40px; }
  2462. #yawf-fast-filter-text { font-weight: bold; }
  2463. */ }) + '\n').replace(/\/\/.*\n/g, '\n'), {
  2464. 'filter-img': images.filter,
  2465. }));
  2466.